root/galaxy-central/templates/library/common/browse_library.mako

リビジョン 2, 37.1 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
1<%namespace file="/message.mako" import="render_msg" />
2<%namespace file="/library/common/library_item_info.mako" import="render_library_item_info" />
3<%namespace file="/library/common/common.mako" import="render_actions_on_multiple_items" />
4
5<%!
6    def inherit(context):
7        if context.get('use_panels'):
8            return '/webapps/galaxy/base_panels.mako'
9        else:
10            return '/base.mako'
11%>
12<%inherit file="${inherit(context)}"/>
13
14<%def name="init()">
15<%
16    self.has_left_panel=False
17    self.has_right_panel=False
18    self.message_box_visible=False
19    self.active_view="user"
20    self.overlay_visible=False
21%>
22</%def>
23
24##
25## Override methods from base.mako and base_panels.mako
26##
27<%def name="center_panel()">
28   <div style="overflow: auto; height: 100%;">
29       <div class="page-container" style="padding: 10px;">
30           ${render_content()}
31       </div>
32   </div>
33</%def>
34
35## Render the grid's basic elements. Each of these elements can be subclassed.
36<%def name="body()">
37    ${render_content()}
38</%def>
39
40<%def name="title()">Browse data library</%def>
41<%def name="stylesheets()">
42    ${parent.stylesheets()}
43    ${h.css( "library" )}
44</%def>
45
46<%def name="javascripts()">
47    ${parent.javascripts()}
48    ${h.js("class", "jquery.jstore")}
49    ${self.grid_javascripts()}
50</%def>
51
52<%def name="grid_javascripts()">
53    <script type="text/javascript">
54        $(function() {
55            $.jStore.init("galaxy"); // Auto-select best storage
56            var storage_id = "library-expand-state-${trans.security.encode_id(library.id)}";
57           
58            var restore_folder_state = function() {
59                var state = $.jStore.store(storage_id);
60                if (state) {
61                    for (var id in state) {
62                        if (state[id] === true) {
63                            var row = $("#" + id),
64                                index = row.parent().children().index(row);
65                            row.addClass("expanded").show();
66                            row.siblings().filter("tr[parent='" + index + "']").show();
67                        }
68                    }
69                }
70            };
71               
72            var save_folder_state = function() {
73                var state = {};
74                $("tr.folderRow").each( function() {
75                    var folder = $(this);
76                    state[folder.attr("id")] = folder.hasClass("expanded");
77                });
78                $.jStore.store(storage_id, state);
79            };
80           
81            $("#library-grid").each(function() {
82               // Recursively fill in children and descendents of each row
83               var process_row = function(q, parents) {
84                    // Find my index
85                    var index = q.parent().children().index(q);
86                    // Find my immediate children
87                    var children = q.siblings().filter("[parent='" + index + "']");
88                    // Recursively handle them
89                    var descendents = children;
90                    children.each( function() {
91                        child_descendents = process_row( $(this), parents.add(q) );
92                        descendents = descendents.add(child_descendents);
93                    });
94                    // Set up expand / hide link
95                    var expand_fn = function() {
96                        if ( q.hasClass("expanded") ) {
97                            descendents.hide();
98                            descendents.removeClass("expanded");
99                            q.removeClass("expanded");
100                        } else {
101                            children.show();
102                            q.addClass("expanded");
103                        }
104                        save_folder_state();
105                    };
106                    $(q).find("span.expandLink").click(expand_fn);
107                    $(q).find("span.expandLink a").click(expand_fn);
108                    // Check/uncheck boxes in subfolders.
109                    q.children("td").children("input[type=checkbox]").click( function() {
110                        if ( $(this).is(":checked") ) {
111                            descendents.find("input[type=checkbox]").attr("checked", true);
112                        } else {
113                            descendents.find("input[type=checkbox]").attr("checked", false);
114                            // If you uncheck a lower level checkbox, uncheck the boxes above it
115                            // (since deselecting a child means the parent is not fully selected any
116                            // more).
117                            parents.children("td").children("input[type=checkbox]").attr("checked", false);
118                        }
119                    });
120                    // return descendents for use by parent
121                    return descendents;
122               }
123               $(this).find("tbody tr").not("[parent]").each( function() {
124                    descendents = process_row( $(this), $([]) );
125                    descendents.hide();
126               });
127            });
128           
129            $.jStore.engineReady(function() {
130                restore_folder_state();
131            });
132        });
133       
134        // For view info links, use a modal popup
135        /*$(".view-info").live("click", function() {
136            $.get( $(this).attr("href"), function(info) {
137                show_modal("View Information", info, {
138                    "Close": function() { hide_modal(); }
139                });
140            });
141            return false;
142        });*/
143       
144        function checkForm() {
145            if ( $("select#action_on_datasets_select option:selected").text() == "delete" ) {
146                if ( confirm( "Click OK to delete these datasets?" ) ) {
147                    return true;
148                } else {
149                    return false;
150                }
151            }
152        }
153        // Looks for changes in dataset state using an async request. Keeps
154        // calling itself (via setTimeout) until all datasets are in a terminal
155        // state.
156        var updater = function ( tracked_datasets ) {
157            // Check if there are any items left to track
158            var empty = true;
159            for ( i in tracked_datasets ) {
160                empty = false;
161                break;
162            }
163            if ( ! empty ) {
164                setTimeout( function() { updater_callback( tracked_datasets ) }, 3000 );
165            }
166        };
167        var updater_callback = function ( tracked_datasets ) {
168            // Build request data
169            var ids = []
170            var states = []
171            $.each( tracked_datasets, function ( id, state ) {
172                ids.push( id );
173                states.push( state );
174            });
175            // Make ajax call
176            $.ajax( {
177                type: "POST",
178                url: "${h.url_for( controller='library_common', action='library_item_updates' )}",
179                dataType: "json",
180                data: { ids: ids.join( "," ), states: states.join( "," ) },
181                success : function ( data ) {
182                    $.each( data, function( id, val ) {
183                        // Replace HTML
184                        var cell = $("#libraryItem-" + id).find("#libraryItemInfo");
185                        cell.html( val.html );
186                        // If new state was terminal, stop tracking
187                        if (( val.state == "ok") || ( val.state == "error") || ( val.state == "empty") || ( val.state == "deleted" ) || ( val.state == "discarded" )) {
188                            delete tracked_datasets[ parseInt(id) ];
189                        } else {
190                            tracked_datasets[ parseInt(id) ] = val.state;
191                        }
192                    });
193                    updater( tracked_datasets );
194                },
195                error: function() {
196                    // Just retry, like the old method, should try to be smarter
197                    updater( tracked_datasets );
198                }
199            });
200        };
201    </script>
202</%def>
203
204<%def name="render_dataset( cntrller, ldda, library_dataset, selected, library, folder, pad, parent, row_counter, tracked_datasets, show_deleted=False )">
205    <%
206        ## The received ldda must always be a LibraryDatasetDatasetAssociation object.  The object id passed to methods
207        ## from the drop down menu should be the ldda id to prevent id collision ( which could happen when displaying
208        ## children, which are always lddas ).  We also need to make sure we're displaying the latest version of this
209        ## library_dataset, so we display the attributes from the ldda.
210
211        from galaxy.web.controllers.library_common import active_folders, active_folders_and_lddas, activatable_folders_and_lddas, branch_deleted
212
213        if ldda.user:
214            uploaded_by = ldda.user.email
215        else:
216            uploaded_by = 'anonymous'
217        if ldda == library_dataset.library_dataset_dataset_association:
218            current_version = True
219            if trans.user_is_admin() and cntrller == 'library_admin':
220                can_modify = can_manage = True
221            elif cntrller in [ 'library', 'requests' ]:
222                can_modify = trans.app.security_agent.can_modify_library_item( current_user_roles, library_dataset )
223                can_manage = trans.app.security_agent.can_manage_library_item( current_user_roles, library_dataset )
224            else:
225                can_modify = can_manage = False
226        else:
227            current_version = False
228        if current_version and ldda.state not in ( 'ok', 'error', 'empty', 'deleted', 'discarded' ):
229            tracked_datasets[ldda.id] = ldda.state
230        info_association, inherited = ldda.get_info_association( restrict=True )
231    %>
232    %if current_version and ( not ldda.library_dataset.deleted or show_deleted ):
233        <tr class="datasetRow"
234            %if parent is not None:
235                parent="${parent}"
236            %endif
237            id="libraryItem-${ldda.id}">
238            <td style="padding-left: ${pad+20}px;">
239                <input style="float: left;" type="checkbox" name="ldda_ids" value="${trans.security.encode_id( ldda.id )}"
240                %if selected:
241                    checked="checked"
242                %endif
243                />
244                %if ldda.library_dataset.deleted:
245                   <span class="libraryItem-error">
246                %endif
247                <div style="float: left; margin-left: 1px;" class="menubutton split popup" id="dataset-${ldda.id}-popup">
248                    <a class="view-info" href="${h.url_for( controller='library_common', action='ldda_info', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">${ldda.name[:50]}</a>
249                </div>
250                %if ldda.library_dataset.deleted:
251                    </span>
252                %endif
253                %if not library.deleted:
254                    <div popupmenu="dataset-${ldda.id}-popup">
255                        %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and can_modify:
256                            <a class="action-button" href="${h.url_for( controller='library_common', action='ldda_edit_info', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit information</a>
257                        %else:
258                            <a class="action-button" class="view-info" href="${h.url_for( controller='library_common', action='ldda_info', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">View information</a>
259                        %endif
260                        %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and can_modify and not info_association:
261                            <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add template</a>
262                        %endif
263                        %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and can_modify and info_association:
264                            <a class="action-button" href="${h.url_for( controller='library_common', action='edit_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit template</a>
265                            <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='ldda', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), ldda_id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Delete template</a>
266                        %endif
267                        %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and can_manage:
268                            %if not trans.app.security_agent.dataset_is_public( ldda.dataset ):
269                                <a class="action-button" href="${h.url_for( controller='library_common', action='make_library_item_public', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_type='ldda', id=trans.security.encode_id( ldda.dataset.id ), use_panels=use_panels, show_deleted=show_deleted )}">Make public</a>
270                            %endif
271                            <a class="action-button" href="${h.url_for( controller='library_common', action='ldda_permissions', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), id=trans.security.encode_id( ldda.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit permissions</a>
272                        %endif
273                        %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and can_modify:
274                            <a class="action-button" href="${h.url_for( controller='library_common', action='upload_library_dataset', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), replace_id=trans.security.encode_id( library_dataset.id ), show_deleted=show_deleted )}">Upload a new version of this dataset</a>
275                        %endif
276                        %if not branch_deleted( folder ) and not ldda.library_dataset.deleted and ldda.has_data:
277                            <a class="action-button" href="${h.url_for( controller='library_common', action='act_on_multiple_datasets', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), ldda_ids=trans.security.encode_id( ldda.id ), do_action='import_to_history', use_panels=use_panels, show_deleted=show_deleted )}">Import this dataset into your current history</a>
278                            <a class="action-button" href="${h.url_for( controller='library_common', action='download_dataset_from_folder', cntrller=cntrller, id=trans.security.encode_id( ldda.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels )}">Download this dataset</a>
279                        %endif
280                        %if can_modify:
281                            %if not library.deleted and not branch_deleted( folder ) and not ldda.library_dataset.deleted:
282                                <a class="action-button" confirm="Click OK to delete dataset '${ldda.name}'." href="${h.url_for( controller='library_common', action='delete_library_item', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( library_dataset.id ), item_type='library_dataset', show_deleted=show_deleted )}">Delete this dataset</a>
283                            %elif not library.deleted and not branch_deleted( folder ) and not ldda.library_dataset.purged and ldda.library_dataset.deleted:
284                                <a class="action-button" href="${h.url_for( controller='library_common', action='undelete_library_item', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( library_dataset.id ), item_type='library_dataset', show_deleted=show_deleted )}">Undelete this dataset</a>
285                            %endif
286                        %endif
287                    </div>
288                %endif
289            </td>
290            <td id="libraryItemInfo">${render_library_item_info( ldda )}</td>
291            <td>${uploaded_by}</td>
292            <td>${ldda.create_time.strftime( "%Y-%m-%d" )}</td>
293            <td>${ldda.get_size( nice_size=True )}</td>
294        </tr>
295        <%
296            my_row = row_counter.count
297            row_counter.increment()
298        %>
299    %endif
300</%def>
301
302<%def name="render_folder( cntrller, folder, folder_pad, created_ldda_ids, library, hidden_folder_ids, tracked_datasets, show_deleted=False, parent=None, row_counter=None, root_folder=False )">
303    <%
304        from galaxy.web.controllers.library_common import active_folders, active_folders_and_lddas, activatable_folders_and_lddas, branch_deleted
305
306        if root_folder:
307            pad = folder_pad
308            expander = h.url_for("/static/images/silk/resultset_bottom.png")
309            folder_img = h.url_for("/static/images/silk/folder_page.png")
310        else:
311            pad = folder_pad + 20
312            expander = h.url_for("/static/images/silk/resultset_next.png")
313            folder_img = h.url_for("/static/images/silk/folder.png")
314        if created_ldda_ids:
315            created_ldda_ids = util.listify( created_ldda_ids )
316        if str( folder.id ) in hidden_folder_ids:
317            return ""
318        my_row = None
319        if trans.user_is_admin() and cntrller == 'library_admin':
320            can_add = can_modify = can_manage = True
321        elif cntrller in [ 'library', 'requests' ]:
322            can_access, folder_ids = trans.app.security_agent.check_folder_contents( trans.user, current_user_roles, folder )
323            if not can_access:
324                can_show, folder_ids = \
325                    trans.app.security_agent.show_library_item( trans.user,
326                                                                current_user_roles,
327                                                                folder,
328                                                                [ trans.app.security_agent.permitted_actions.LIBRARY_ADD,
329                                                                  trans.app.security_agent.permitted_actions.LIBRARY_MODIFY,
330                                                                  trans.app.security_agent.permitted_actions.LIBRARY_MANAGE ] )
331                if not can_show:
332                    return ""
333            can_add = trans.app.security_agent.can_add_library_item( current_user_roles, folder )
334            can_modify = trans.app.security_agent.can_modify_library_item( current_user_roles, folder )
335            can_manage = trans.app.security_agent.can_manage_library_item( current_user_roles, folder )
336        else:
337            can_add = can_modify = can_manage = False
338        info_association, inherited = folder.get_info_association( restrict=True )
339    %>
340    %if not root_folder and ( not folder.deleted or show_deleted ):
341        <tr id="folder-${trans.security.encode_id(folder.id)}" class="folderRow libraryOrFolderRow"
342            %if parent is not None:
343                parent="${parent}"
344                style="display: none;"
345            %endif
346            >
347            <td style="padding-left: ${folder_pad}px;">
348                <input type="checkbox" class="folderCheckbox"/>
349               
350                %if folder.deleted:
351                    <span class="libraryItem-error">
352                %endif
353                <span class="expandLink"><span class="rowIcon"></span>
354                <div style="float: left; margin-left: 2px;" class="menubutton split popup" id="folder_img-${folder.id}-popup">
355                    <a href="javascript:void(0);">${folder.name}</a>
356                </div>
357               
358                %if folder.deleted:
359                    </span>
360                %endif
361                %if not branch_deleted( folder ):
362                    %if not library.deleted:
363                        <div popupmenu="folder_img-${folder.id}-popup">
364                            %if not branch_deleted( folder ) and can_add:
365                                <a class="action-button" href="${h.url_for( controller='library_common', action='upload_library_dataset', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add datasets</a>
366                                <a class="action-button" href="${h.url_for( controller='library_common', action='create_folder', cntrller=cntrller, parent_id=trans.security.encode_id( folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add sub-folder</a>
367                            %endif
368                            %if not branch_deleted( folder ):
369                                %if can_modify:
370                                    <a class="action-button" href="${h.url_for( controller='library_common', action='folder_info', cntrller=cntrller, id=trans.security.encode_id( folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit information</a>
371                                %else:
372                                    <a class="action-button" class="view-info" href="${h.url_for( controller='library_common', action='folder_info', cntrller=cntrller, id=trans.security.encode_id( folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">View information</a>
373                                %endif
374                            %endif
375                            %if not branch_deleted( folder ) and can_modify and not info_association:
376                                <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='folder', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add template</a>
377                            %endif
378                            %if not branch_deleted( folder ) and can_modify and info_association:
379                                <a class="action-button" href="${h.url_for( controller='library_common', action='edit_template', cntrller=cntrller, item_type='folder', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit template</a>
380                                <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='folder', library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Delete template</a>
381                            %endif
382                            %if not branch_deleted( folder ) and can_manage:
383                               %if not trans.app.security_agent.folder_is_public( folder ):
384                                   <a class="action-button" href="${h.url_for( controller='library_common', action='make_library_item_public', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_type='folder', id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Make public</a>
385                               %endif
386                                <a class="action-button" href="${h.url_for( controller='library_common', action='folder_permissions', cntrller=cntrller, id=trans.security.encode_id( folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit permissions</a>
387                            %endif
388                            %if can_modify:
389                                %if not library.deleted and not folder.deleted:
390                                    <a class="action-button" confirm="Click OK to delete the folder '${folder.name}.'" href="${h.url_for( controller='library_common', action='delete_library_item', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( folder.id ), item_type='folder', show_deleted=show_deleted )}">Delete this folder</a>
391                                %elif not library.deleted and folder.deleted and not folder.purged:
392                                    <a class="action-button" href="${h.url_for( controller='library_common', action='undelete_library_item', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( folder.id ), item_type='folder', show_deleted=show_deleted )}">Undelete this folder</a>
393                                %endif
394                            %endif
395                        </div>
396                    %endif
397                %endif
398            <td>
399            %if folder.description:
400                ${folder.description}
401            %endif
402            <td colspan="3"></td>
403        </tr>
404        <%
405            my_row = row_counter.count
406            row_counter.increment()
407        %>
408    %endif
409    %if cntrller == 'library':
410        <% sub_folders = active_folders( trans, folder ) %>
411        %for sub_folder in sub_folders:
412            ${render_folder( cntrller, sub_folder, pad, created_ldda_ids, library, hidden_folder_ids, tracked_datasets, show_deleted=show_deleted, parent=my_row, row_counter=row_counter, root_folder=False )}
413        %endfor
414        %for library_dataset in folder.active_library_datasets:
415            <%
416                ldda = library_dataset.library_dataset_dataset_association
417                can_access = trans.app.security_agent.can_access_dataset( current_user_roles, ldda.dataset )
418                selected = created_ldda_ids and str( ldda.id ) in created_ldda_ids
419            %>
420            %if can_access:
421                ${render_dataset( cntrller, ldda, library_dataset, selected, library, folder, pad, my_row, row_counter, tracked_datasets, show_deleted=show_deleted )}
422            %endif
423        %endfor
424    %elif trans.user_is_admin() and cntrller == 'library_admin':
425        <%
426            if show_deleted:
427                sub_folders, lddas = activatable_folders_and_lddas( trans, folder )
428            else:
429                sub_folders, lddas = active_folders_and_lddas( trans, folder )
430        %>
431        %for sub_folder in sub_folders:
432            ${render_folder( cntrller, sub_folder, pad, created_ldda_ids, library, [], tracked_datasets, show_deleted=show_deleted, parent=my_row, row_counter=row_counter, root_folder=False )}
433        %endfor
434        %for ldda in lddas:
435            <%
436                library_dataset = ldda.library_dataset
437                selected = created_ldda_ids and str( ldda.id ) in created_ldda_ids
438            %>
439            ${render_dataset( cntrller, ldda, library_dataset, selected, library, folder, pad, my_row, row_counter, tracked_datasets, show_deleted=show_deleted )}
440        %endfor
441    %endif
442</%def>
443
444<%def name="render_content()">
445    <%
446        from galaxy import util
447        from galaxy.web.controllers.library_common import branch_deleted
448        from time import strftime
449 
450        if trans.user_is_admin() and cntrller == 'library_admin':
451            can_add = can_modify = can_manage = True
452        elif cntrller in [ 'library', 'requests' ]:
453            can_add = trans.app.security_agent.can_add_library_item( current_user_roles, library )
454            can_modify = trans.app.security_agent.can_modify_library_item( current_user_roles, library )
455            can_manage = trans.app.security_agent.can_manage_library_item( current_user_roles, library )
456        else:
457            can_add = can_modify = can_manage = False
458        info_association, inherited = library.get_info_association()
459 
460        tracked_datasets = {}
461 
462        class RowCounter( object ):
463            def __init__( self ):
464                self.count = 0
465            def increment( self ):
466                self.count += 1
467            def __str__( self ):
468                return str( self.count )
469    %>
470 
471    <h2>Data Library &ldquo;${library.name}&rdquo;</h2>
472 
473     <ul class="manage-table-actions">
474         %if not library.deleted and ( ( trans.user_is_admin() and cntrller == 'library_admin' ) or can_add ):
475             <li><a class="action-button" href="${h.url_for( controller='library_common', action='upload_library_dataset', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( library.root_folder.id ), use_panels=use_panels, show_deleted=show_deleted )}"><span>Add datasets</span></a></li>
476             <li><a class="action-button" href="${h.url_for( controller='library_common', action='create_folder', cntrller=cntrller, parent_id=trans.security.encode_id( library.root_folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add folder</a></li>
477         %endif
478         %if ( ( not library.deleted ) and ( can_modify or can_manage ) ) or ( can_modify and not library.purged ) or ( library.purged ):
479             <li><a class="action-button" id="library-${library.id}-popup" class="menubutton">Library Actions</a></li>
480             <div popupmenu="library-${library.id}-popup">
481                 %if not library.deleted:
482                     %if can_modify:
483                         <a class="action-button" href="${h.url_for( controller='library_common', action='library_info', cntrller=cntrller, id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit information</a>
484                         <a class="action-button" confirm="Click OK to delete the library named '${library.name}'." href="${h.url_for( controller='library_common', action='delete_library_item', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( library.id ), item_type='library' )}">Delete this data library</a>
485                         %if show_deleted:
486                             <a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=False )}">Hide deleted items</a>
487                         %else:
488                             <a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=True )}">Show deleted items</a>
489                         %endif
490                     %endif
491                     %if can_modify and not library.info_association:
492                         <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='library', library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add template</a>
493                     %endif
494                     %if can_modify and info_association:
495                         <a class="action-button" href="${h.url_for( controller='library_common', action='edit_template', cntrller=cntrller, item_type='library', library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit template</a>
496                         <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='library', library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Delete template</a>
497                     %endif
498                     %if can_manage:
499                         %if not trans.app.security_agent.library_is_public( library, contents=True ):
500                             <a class="action-button" href="${h.url_for( controller='library_common', action='make_library_item_public', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_type='library', id=trans.security.encode_id( library.id ), contents=True, use_panels=use_panels, show_deleted=show_deleted )}">Make public</a>
501                         %endif
502                         <a class="action-button" href="${h.url_for( controller='library_common', action='library_permissions', cntrller=cntrller, id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit permissions</a>
503                     %endif
504                 %elif can_modify and not library.purged:
505                     <a class="action-button" href="${h.url_for( controller='library_common', action='undelete_library_item', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( library.id ), item_type='library', use_panels=use_panels )}">Undelete this data library</a>
506                 %elif library.purged:
507                     <a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">This data library has been purged</a>
508                 %endif
509             </div>
510         %endif
511    </ul>
512 
513    %if message:
514        ${render_msg( message, status )}
515    %endif
516 
517    %if library.synopsis not in [ 'None', None ]:
518        <div class="libraryItemBody">
519            ${library.synopsis}
520        </div>
521        <br/>
522    %endif
523 
524    <form name="act_on_multiple_datasets" action="${h.url_for( controller='library_common', action='act_on_multiple_datasets', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}" onSubmit="javascript:return checkForm();" method="post">
525        <table cellspacing="0" cellpadding="0" border="0" width="100%" class="grid" id="library-grid">
526            <thead>
527                <tr class="libraryTitle">
528                    <th>Name</th>       
529                    <th>Information</th>
530                    <th>Uploaded By</th>
531                    <th>Date</th>
532                    <th>File Size</th>
533                </tr>
534            </thead>
535            <% row_counter = RowCounter() %>
536            %if cntrller in [ 'library', 'requests' ]:
537                ${self.render_folder( 'library', library.root_folder, 0, created_ldda_ids, library, hidden_folder_ids, tracked_datasets, show_deleted=show_deleted, parent=None, row_counter=row_counter, root_folder=True )}
538                %if not library.deleted:
539                    ${render_actions_on_multiple_items()}
540                %endif
541            %elif ( trans.user_is_admin() and cntrller in [ 'library_admin', 'requests_admin' ] ):
542                ${self.render_folder( 'library_admin', library.root_folder, 0, created_ldda_ids, library, [], tracked_datasets, show_deleted=show_deleted, parent=None, row_counter=row_counter, root_folder=True )}
543                %if not library.deleted and not show_deleted:
544                    ${render_actions_on_multiple_items()}
545                %endif
546            %endif
547        </table>
548    </form>
549 
550    %if tracked_datasets:
551        <script type="text/javascript">
552            // Updater
553            updater({${ ",".join( [ '"%s" : "%s"' % ( k, v ) for k, v in tracked_datasets.iteritems() ] ) }});
554        </script>
555        <!-- running: do not change this comment, used by TwillTestCase.library_wait -->
556    %endif
557 
558    ## Help about compression types
559 
560    <div class="libraryItemBody">
561        <p class="infomark">
562            TIP: You can download individual library files by selecting "Download this dataset" from the context menu (triangle) next to the dataset's name.
563        </p>
564    </div>
565    %if len( comptypes ) > 1:
566        <div class="libraryItemBody">
567            <p class="infomark">
568                TIP: Multiple compression options are available for downloading library datasets:
569            </p>
570            <ul style="padding-left: 1em; list-style-type: disc;">
571                %if 'gz' in comptypes:
572                    <li>gzip: Recommended for fast network connections
573                        %if trans.app.config.upstream_gzip:
574                            NOTE: The file you receive will be an uncompressed .tar file - this is because the Galaxy server compresses it and your browser decompresses it on the fly.
575                        %endif
576                    </li>
577                %endif
578                %if 'bz2' in comptypes:
579                    <li>bzip2: Recommended for slower network connections (smaller size but takes longer to compress)</li>
580                %endif
581                %if 'zip' in comptypes:
582                    <li>zip: Not recommended but is provided as an option for those who cannot open the above formats</li>
583                %endif
584            </ul>
585        </div>
586    %endif
587</%def>
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。