details: http://www.bx.psu.edu/hg/galaxy/rev/2e2b80fcbd47 changeset: 2401:2e2b80fcbd47 user: Greg Von Kuster <greg@bx.psu.edu> date: Tue May 05 13:48:01 2009 -0400 description: Fixes for deleting library items on the admin side. - Purged library items will not be displayed - Deleted library items can only be viewed or undeleted - Differentiate between displaying deleted libraries and displaying deleted items within an undeleted library 8 file(s) affected in this change: lib/galaxy/web/controllers/admin.py lib/galaxy/web/controllers/library.py templates/admin/dataset_security/group_create.mako templates/admin/library/browse_libraries.mako templates/admin/library/browse_library.mako templates/admin/library/common.mako templates/admin/library/ldda_info.mako templates/library/ldda_info.mako diffs (551 lines): diff -r 8da91a231cdf -r 2e2b80fcbd47 lib/galaxy/web/controllers/admin.py --- a/lib/galaxy/web/controllers/admin.py Tue May 05 13:03:23 2009 -0400 +++ b/lib/galaxy/web/controllers/admin.py Tue May 05 13:48:01 2009 -0400 @@ -678,6 +678,7 @@ libraries=trans.app.model.Library.filter( trans.app.model.Library.table.c.deleted==False ) \ .order_by( trans.app.model.Library.name ).all(), deleted=False, + show_deleted=False, msg=msg, messagetype=messagetype ) @web.expose @@ -687,6 +688,8 @@ msg = util.restore_text( params.get( 'msg', '' ) ) messagetype = params.get( 'messagetype', 'done' ) id = params.get( 'id', None ) + deleted = util.string_as_bool( params.get( 'deleted', False ) ) + show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) if not id: msg = "You must specify a library id." return trans.response.send_redirect( web.url_for( controller='admin', @@ -701,9 +704,9 @@ msg=util.sanitize_text( msg ), messagetype='error' ) ) created_ldda_ids = params.get( 'created_ldda_ids', '' ) - show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) return trans.fill_template( '/admin/library/browse_library.mako', library=trans.app.model.Library.get( id ), + deleted=deleted, created_ldda_ids=created_ldda_ids, msg=msg, messagetype=messagetype, @@ -842,7 +845,7 @@ deleted=True, msg=msg, messagetype=messagetype, - show_deleted = True ) + show_deleted=True ) @web.expose @web.require_admin def undelete_library( self, trans, **kwd ): @@ -1088,7 +1091,9 @@ def library_dataset_dataset_association( self, trans, library_id, folder_id, id=None, **kwd ): params = util.Params( kwd ) msg = util.restore_text( params.get( 'msg', '' ) ) - messagetype = params.get( 'messagetype', 'done' ) + messagetype = params.get( 'messagetype', 'done' ) + deleted = util.string_as_bool( params.get( 'deleted', False ) ) + show_deleted = util.string_as_bool( params.get( 'show_deleted', False ) ) dbkey = params.get( 'dbkey', None ) if isinstance( dbkey, list ): last_used_build = dbkey[0] @@ -1250,6 +1255,8 @@ return trans.fill_template( '/admin/library/ldda_info.mako', ldda=ldda, library_id=library_id, + deleted=deleted, + show_deleted=show_deleted, msg=msg, messagetype=messagetype ) elif action == 'edit_info': @@ -1322,8 +1329,6 @@ msg=msg, messagetype=messagetype ) elif params.get( 'delete', False ): - # TODO: need to revamp the way we remove datasets from disk. - # The user selected the "Remove this dataset from the library" pop-up menu option ldda.deleted = True ldda.flush() msg = 'Dataset %s has been removed from this library' % ldda.name @@ -1955,69 +1960,56 @@ id=library_id, msg=util.sanitize_text( msg ), messagetype=messagetype ) ) - @web.expose @web.require_admin - def delete_library_item( self, trans, library_id = None, library_item_id = None, library_item_type = None ): - #this action will handle deleting all types of library items in library browsing mode - library_item_types = { 'library': trans.app.model.Library, 'folder': trans.app.model.LibraryFolder, 'dataset': trans.app.model.LibraryDataset, } + def delete_library_item( self, trans, library_id, library_item_id, library_item_type ): + # This action will handle deleting all types of library items. State is saved for libraries and + # folders ( i.e., if undeleted, the state of contents of the library or folder will remain, so previously + # deleted / purged contents will have the same state ). When a library or folder has been deleted for + # the amount of time defined in the cleanup_datasets.py script, the library or folder and all of its + # contents will be purged. The association between this method and the cleanup_datasets.py script + # enables clean maintenance of libraries and library dataset disk files. This is also why the following + # 3 objects, and not any of the associations ( the cleanup_datasets.py scipot handles everything else ). + library_item_types = { 'library': trans.app.model.Library, + 'folder': trans.app.model.LibraryFolder, + 'library_dataset': trans.app.model.LibraryDataset } if library_item_type not in library_item_types: - raise ValueError( 'Bad library_item_type specified: %s' % library_item_types ) - if library_item_id is None: - raise ValueError( 'library_item_id not specified' ) - library_item = library_item_types[ library_item_type ].get( int( library_item_id ) ) - library_item.deleted = True - library_item.flush() - #need to str because unicode isn't accepted... - msg = str( "%s '%s' has been marked deleted" % ( library_item_type, library_item.name ) ) - messagetype = str( "done" ) - if library_item_type == 'library' or library_id is None: - return self.browse_libraries( trans, msg = msg, messagetype = messagetype ) + msg = 'Bad library_item_type specified: %s' % str( library_item_type ) + messagetype = 'error' else: - return self.browse_library( trans, id = library_id , msg = msg, messagetype = messagetype ) - + library_item = library_item_types[ library_item_type ].get( int( library_item_id ) ) + library_item.deleted = True + library_item.flush() + msg = util.sanitize_text( "%s '%s' has been marked deleted" % ( library_item_type, library_item.name ) ) + messagetype = 'done' + if library_item_type == 'library': + return self.browse_libraries( trans, msg=msg, messagetype=messagetype ) + else: + return self.browse_library( trans, id=library_id , msg=msg, messagetype=messagetype ) @web.expose @web.require_admin - def undelete_library_item( self, trans, library_id = None, library_item_id = None, library_item_type = None ): - #this action will handle deleting all types of library items in library browsing mode - library_item_types = { 'library': trans.app.model.Library, 'folder': trans.app.model.LibraryFolder, 'dataset': trans.app.model.LibraryDataset, } + def undelete_library_item( self, trans, library_id, library_item_id, library_item_type ): + # This action will handle undeleting all types of library items + library_item_types = { 'library': trans.app.model.Library, + 'folder': trans.app.model.LibraryFolder, + 'library_dataset': trans.app.model.LibraryDataset } if library_item_type not in library_item_types: - raise ValueError( 'Bad library_item_type specified: %s' % library_item_types ) - if library_item_id is None: - raise ValueError( 'library_item_id not specified' ) - library_item = library_item_types[ library_item_type ].get( int( library_item_id ) ) - if library_item.purged: - raise ValueError( '%s %s cannot be undeleted' % ( library_item_type, library_item.name ) ) - library_item.deleted = False - library_item.flush() - msg = str( "%s '%s' has been undeleted" % ( library_item_type, library_item.name ) ) - messagetype = str( "done" ) - if library_item_type == 'library' or library_id is None: - return self.browse_libraries( trans, msg = msg, messagetype = messagetype ) + msg = 'Bad library_item_type specified: %s' % str( library_item_type ) + messagetype = 'error' else: - return self.browse_library( trans, id = library_id , msg = msg, messagetype = messagetype ) - - - - #@web.expose - #@web.require_admin - #def delete_dataset( self, trans, id=None, **kwd): - # if id: - # # id is a LibraryDatasetDatasetAssociation.id - # ldda = trans.app.model.LibraryDatasetDatasetAssociation.get( id ) - # ldda.deleted = True - # ldda.flush() - # msg = "Dataset %s was deleted from library folder %s" % ( ldda.name, ldda.folder.name ) - # trans.response.send_redirect( web.url_for( action='folder', - # id=str( ldda.folder.id ), - # msg=util.sanitize_text( msg ), - # messagetype='done' ) ) - # msg = "You did not specify a dataset to delete." - # return trans.response.send_redirect( web.url_for( action='folder', - # id=str( ldda.folder.id ), - # msg=util.sanitize_text( msg ), - # messagetype='error' ) ) - + library_item = library_item_types[ library_item_type ].get( int( library_item_id ) ) + if library_item.purged: + msg = '%s %s has been purged, so it cannot be undeleted' % ( library_item_type, library_item.name ) + messagetype = 'error' + else: + library_item.deleted = False + library_item.flush() + msg = util.sanitize_text( "%s '%s' has been marked undeleted" % ( library_item_type, library_item.name ) ) + messagetype = 'done' + if library_item_type == 'library': + return self.browse_libraries( trans, msg=msg, messagetype=messagetype ) + else: + return self.browse_library( trans, id=library_id , msg=msg, messagetype=messagetype ) @web.expose @web.require_admin def memdump( self, trans, ids = 'None', sorts = 'None', pages = 'None', new_id = None, new_sort = None, **kwd ): diff -r 8da91a231cdf -r 2e2b80fcbd47 lib/galaxy/web/controllers/library.py --- a/lib/galaxy/web/controllers/library.py Tue May 05 13:03:23 2009 -0400 +++ b/lib/galaxy/web/controllers/library.py Tue May 05 13:48:01 2009 -0400 @@ -587,8 +587,6 @@ msg=msg, messagetype=messagetype ) elif params.get( 'delete', False ): - # TODO: need to revamp the way we remove datasets from disk. - # The user selected the "Remove this dataset from the library" pop-up menu option if trans.app.security_agent.allow_action( trans.user, trans.app.security_agent.permitted_actions.LIBRARY_MODIFY, library_item=folder ): diff -r 8da91a231cdf -r 2e2b80fcbd47 templates/admin/dataset_security/group_create.mako --- a/templates/admin/dataset_security/group_create.mako Tue May 05 13:03:23 2009 -0400 +++ b/templates/admin/dataset_security/group_create.mako Tue May 05 13:48:01 2009 -0400 @@ -57,24 +57,24 @@ </div> <div class="form-row"> <div style="float: left; margin-right: 10px;"> - <label>Groups associated with new role</label> + <label>Roles associated with new group</label> ${render_select( "in_roles", in_roles )}<br/> <input type="submit" id="roles_remove_button" value=">>"/> </div> <div> - <label>Groups not associated with new role</label> + <label>Roles not associated with new group</label> ${render_select( "out_roles", out_roles )}<br/> <input type="submit" id="roles_add_button" value="<<"/> </div> </div> <div class="form-row"> <div style="float: left; margin-right: 10px;"> - <label>Users associated with new role</label> + <label>Users associated with new group</label> ${render_select( "in_users", in_users )}<br/> <input type="submit" id="users_remove_button" value=">>"/> </div> <div> - <label>Users not associated with new role</label> + <label>Users not associated with new group</label> ${render_select( "out_users", out_users )}<br/> <input type="submit" id="users_add_button" value="<<"/> </div> diff -r 8da91a231cdf -r 2e2b80fcbd47 templates/admin/library/browse_libraries.mako --- a/templates/admin/library/browse_libraries.mako Tue May 05 13:03:23 2009 -0400 +++ b/templates/admin/library/browse_libraries.mako Tue May 05 13:48:01 2009 -0400 @@ -42,7 +42,7 @@ <tbody> %for library in libraries: <tr class="libraryRow libraryOrFolderRow" id="libraryRow"> - <td><a href="${h.url_for( controller='admin', action='browse_library', id=library.id )}">${library.name}</a></td> + <td><a href="${h.url_for( controller='admin', action='browse_library', id=library.id, deleted=deleted, show_deleted=show_deleted )}">${library.name}</a></td> <td><i>${library.description}</i></td> </tr> %endfor diff -r 8da91a231cdf -r 2e2b80fcbd47 templates/admin/library/browse_library.mako --- a/templates/admin/library/browse_library.mako Tue May 05 13:03:23 2009 -0400 +++ b/templates/admin/library/browse_library.mako Tue May 05 13:48:01 2009 -0400 @@ -72,20 +72,20 @@ } </script> -<%def name="render_folder( parent, parent_pad, deleted, created_ldda_ids, library_id )"> +<%def name="render_folder( folder, folder_pad, deleted, show_deleted, created_ldda_ids, library_id )"> <% - root_folder = not parent.parent + root_folder = not folder.parent if root_folder: - pad = parent_pad + pad = folder_pad else: - pad = parent_pad + 20 - if parent_pad == 0: + pad = folder_pad + 20 + if folder_pad == 0: expander = "/static/images/silk/resultset_bottom.png" - folder = "/static/images/silk/folder_page.png" + folder_img = "/static/images/silk/folder_page.png" subfolder = False else: expander = "/static/images/silk/resultset_next.png" - folder = "/static/images/silk/folder.png" + folder_img = "/static/images/silk/folder.png" subfolder = True created_ldda_id_list = util.listify( created_ldda_ids ) if created_ldda_id_list: @@ -93,35 +93,37 @@ %> %if not root_folder: <li class="folderRow libraryOrFolderRow" style="padding-left: ${pad}px;"> - <div class="rowTitle libraryItemDeleted-${parent.deleted}"> - <img src="${h.url_for( expander )}" class="expanderIcon"/><img src="${h.url_for( folder )}" class="rowIcon"/> - ${parent.name} - %if parent.description: - <i>- ${parent.description}</i> - %endif - <a id="folder-${parent.id}-popup" class="popup-arrow" style="display: none;">▼</a> - </div> - %if not parent.deleted: + %if not folder.deleted or show_deleted: + <div class="rowTitle libraryItemDeleted-${deleted}"> + <img src="${h.url_for( expander )}" class="expanderIcon"/><img src="${h.url_for( folder_img )}" class="rowIcon"/> + ${folder.name} + %if folder.description: + <i>- ${folder.description}</i> + %endif + <a id="folder-${folder.id}-popup" class="popup-arrow" style="display: none;">▼</a> + </div> + %endif + %if not folder.deleted: <% library_item_ids = {} - library_item_ids[ 'folder' ] = parent.id + library_item_ids[ 'folder' ] = folder.id %> - <div popupmenu="folder-${parent.id}-popup"> - <a class="action-button" href="${h.url_for( controller='admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=parent.id )}">Add datasets to this folder</a> - <a class="action-button" href="${h.url_for( controller='admin', action='folder', new=True, id=parent.id, library_id=library_id )}">Create a new sub-folder in this folder</a> - <a class="action-button" href="${h.url_for( controller='admin', action='folder', information=True, id=parent.id, library_id=library_id )}">Edit this folder's information</a> - %if parent.library_folder_info_template_associations: - <% template = parent.get_library_item_info_templates( template_list=[], restrict=True )[0] %> - <a class="action-button" href="${h.url_for( controller='admin', action='info_template', library_id=library.id, id=template.id, edit_template=True )}">Edit this folder's information template</a> + <div popupmenu="folder-${folder.id}-popup"> + <a class="action-button" href="${h.url_for( controller='admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=folder.id )}">Add datasets to this folder</a> + <a class="action-button" href="${h.url_for( controller='admin', action='folder', new=True, id=folder.id, library_id=library_id )}">Create a new sub-folder in this folder</a> + <a class="action-button" href="${h.url_for( controller='admin', action='folder', information=True, id=folder.id, library_id=library_id )}">Edit this folder's information</a> + %if folder.library_folder_info_template_associations: + <% template = folder.get_library_item_info_templates( template_list=[], restrict=True )[0] %> + <a class="action-button" href="${h.url_for( controller='admin', action='info_template', library_id=library_id, id=template.id, edit_template=True )}">Edit this folder's information template</a> %else: - <a class="action-button" href="${h.url_for( controller='admin', action='info_template', library_id=library.id, folder_id=parent.id, new_template=True )}">Add an information template to this folder</a> + <a class="action-button" href="${h.url_for( controller='admin', action='info_template', library_id=library_id, folder_id=folder.id, new_template=True )}">Add an information template to this folder</a> %endif - <a class="action-button" href="${h.url_for( controller='admin', action='folder', permissions=True, id=parent.id, library_id=library_id )}">Edit this folder's permissions</a> - <a class="action-button" confirm="Click OK to delete the folder '${parent.name}'" href="${h.url_for( controller='admin', action='delete_library_item', library_id=library_id, library_item_id=parent.id, library_item_type='folder' )}">Remove this folder and its contents from the library</a> + <a class="action-button" href="${h.url_for( controller='admin', action='folder', permissions=True, id=folder.id, library_id=library_id )}">Edit this folder's permissions</a> + <a class="action-button" confirm="Click OK to delete the folder '${folder.name}.'" href="${h.url_for( controller='admin', action='delete_library_item', library_id=library_id, library_item_id=folder.id, library_item_type='folder' )}">Delete this folder and its contents</a> </div> - %else: - <div popupmenu="folder-${parent.id}-popup"> - <a class="action-button" href="${h.url_for( controller='admin', action='undelete_library_item', library_id=library_id, library_item_id=parent.id, library_item_type='folder' )}">Undelete this folder</a> + %elif not deleted and folder.deleted and not folder.purged: + <div popupmenu="folder-${folder.id}-popup"> + <a class="action-button" href="${h.url_for( controller='admin', action='undelete_library_item', library_id=library_id, library_item_id=folder.id, library_item_type='folder' )}">Undelete this folder</a> </div> %endif </li> @@ -131,31 +133,31 @@ %else: <ul> %endif - %if deleted: + %if show_deleted: <% - parent_folders = parent.activatable_folders - parent_datasets = parent.activatable_datasets + parent_folders = folder.activatable_folders + parent_datasets = folder.activatable_datasets %> %else: <% - parent_folders = parent.active_folders - parent_datasets = parent.active_datasets + parent_folders = folder.active_folders + parent_datasets = folder.active_datasets %> %endif %for folder in name_sorted( parent_folders ): - ${render_folder( folder, pad, deleted, created_ldda_ids, library.id )} + ${render_folder( folder, pad, deleted, show_deleted, created_ldda_ids, library_id )} %endfor %for library_dataset in name_sorted( parent_datasets ): <% selected = created_ldda_ids and library_dataset.library_dataset_dataset_association.id in created_ldda_ids %> - <li class="datasetRow" style="padding-left: ${pad + 18}px;">${render_dataset( library_dataset, selected, library )}</li> + <li class="datasetRow" style="padding-left: ${pad + 18}px;">${render_dataset( library_dataset, selected, library, deleted, show_deleted )}</li> %endfor </ul> </%def> <h2> - %if library.deleted: + %if deleted: Deleted %endif Library '${library.name}' @@ -183,7 +185,7 @@ <table cellspacing="0" cellpadding="0" border="0" width="100%" class="libraryTitle"> <th width="*"> <img src="${h.url_for( '/static/images/silk/resultset_bottom.png' )}" class="expanderIcon"/><img src="${h.url_for( '/static/images/silk/book_open.png' )}" class="rowIcon"/> - <span class="libraryItemDeleted-${library.deleted}"> + <span class="libraryItemDeleted-${deleted}"> ${library.name} %if library.description: <i>- ${library.description}</i> @@ -191,7 +193,7 @@ </span> <a id="library-${library.id}-popup" class="popup-arrow" style="display: none;">▼</a> <div popupmenu="library-${library.id}-popup"> - %if not library.deleted: + %if not deleted: <% library_item_ids = {} library_item_ids[ 'library' ] = library.id @@ -205,14 +207,14 @@ <a class="action-button" href="${h.url_for( controller='admin', action='info_template', library_id=library.id, new_template=True )}">Add an information template to this library</a> %endif <a class="action-button" href="${h.url_for( controller='admin', action='library', id=library.id, permissions=True )}">Edit this library's permissions</a> - <a class="action-button" confirm="Current state will not be saved, so undeleting the library will restore all of its contents. Click OK to delete the library named '${library.name}'?" href="${h.url_for( controller='admin', action='delete_library_item', library_item_type='library', library_item_id=library.id )}">Delete this library and its contents</a> + <a class="action-button" confirm="Click OK to delete the library named '${library.name}'." href="${h.url_for( controller='admin', action='delete_library_item', library_id=library.id, library_item_id=library.id, library_item_type='library' )}">Delete this library and its contents</a> %if show_deleted: <a class="action-button" href="${h.url_for( controller='admin', action='browse_library', id=library.id, show_deleted=False )}">Hide deleted library items</a> %else: <a class="action-button" href="${h.url_for( controller='admin', action='browse_library', id=library.id, show_deleted=True )}">Show deleted library items</a> %endif %elif not library.purged: - <a class="action-button" href="${h.url_for( controller='admin', action='undelete_library_item', library_item_type='library', library_item_id=library.id )}">Undelete this library</a> + <a class="action-button" href="${h.url_for( controller='admin', action='undelete_library_item', library_id=library.id, library_item_id=library.id, library_item_type='library' )}">Undelete this library</a> %endif </div> </th> @@ -223,16 +225,16 @@ </div> </li> <ul> - ${render_folder( library.root_folder, 0, library.deleted or show_deleted, created_ldda_ids, library.id )} + ${render_folder( library.root_folder, 0, deleted, show_deleted, created_ldda_ids, library.id )} </ul> <br/> </ul> - %if not library.deleted: + %if not deleted and not show_deleted: <p> <b>Perform action on selected datasets:</b> <select name="action" id="action_on_datasets_select"> <option value="edit">Edit selected datasets' permissions</option> - ##TODO: fix deleting library items<option value="delete">Remove selected datasets from this library</option> + <option value="delete">Delete selected datasets</option> </select> <input type="submit" class="primary-button" name="action_on_datasets_button" id="action_on_datasets_button" value="Go"/> </p> diff -r 8da91a231cdf -r 2e2b80fcbd47 templates/admin/library/common.mako --- a/templates/admin/library/common.mako Tue May 05 13:03:23 2009 -0400 +++ b/templates/admin/library/common.mako Tue May 05 13:48:01 2009 -0400 @@ -1,6 +1,6 @@ <% from time import strftime %> -<%def name="render_dataset( library_dataset, selected, library, show_deleted = False )"> +<%def name="render_dataset( library_dataset, selected, library, deleted, show_deleted )"> <% ## The received data must always be a LibraryDataset object, but the object id passed to methods from the drop down menu ## should be the underlying ldda id to prevent id collision ( which could happen when displaying children, which are always @@ -28,10 +28,10 @@ <input type="checkbox" name="ldda_ids" value="${ldda.id}"/> %endif <span class="libraryItemDeleted-${library_dataset.deleted}"> - <a href="${h.url_for( controller='admin', action='library_dataset_dataset_association', library_id=library.id, folder_id=library_dataset.folder.id, id=ldda.id, info=True )}"><b>${ldda.name[:50]}</b></a> + <a href="${h.url_for( controller='admin', action='library_dataset_dataset_association', library_id=library.id, folder_id=library_dataset.folder.id, id=ldda.id, info=True, deleted=deleted, show_deleted=show_deleted )}"><b>${ldda.name[:50]}</b></a> </span> <a id="dataset-${ldda.id}-popup" class="popup-arrow" style="display: none;">▼</a> - %if not library_dataset.deleted: + %if not library.deleted and not library_dataset.folder.deleted and not library_dataset.deleted: <% library_item_ids = {} library_item_ids[ 'ldda' ] = ldda.id @@ -47,12 +47,11 @@ %if ldda.has_data: <a class="action-button" href="${h.url_for( controller='admin', action='download_dataset_from_folder', id=ldda.id, library_id=library.id )}">Download this dataset</a> %endif - ##TODO: need to revamp the way we remove datasets from disk. - <a class="action-button" confirm="Click OK to remove dataset '${ldda.name}'?" href="${h.url_for( controller='admin', action='delete_library_item', library_id=library.id, library_item_id=library_dataset.id, library_item_type='dataset' )}">Remove this dataset from the library</a> + <a class="action-button" confirm="Click OK to delete dataset '${ldda.name}'." href="${h.url_for( controller='admin', action='delete_library_item', library_id=library.id, library_item_id=library_dataset.id, library_item_type='library_dataset' )}">Delete this dataset</a> </div> - %else: + %elif not library.deleted and not library_dataset.folder.deleted and library_dataset.deleted: <div popupmenu="dataset-${ldda.id}-popup"> - <a class="action-button" href="${h.url_for( controller='admin', action='undelete_library_item', library_id=library.id, library_item_id=library_dataset.id, library_item_type='dataset' )}">Undelete this dataset</a> + <a class="action-button" href="${h.url_for( controller='admin', action='undelete_library_item', library_id=library.id, library_item_id=library_dataset.id, library_item_type='library_dataset' )}">Undelete this dataset</a> </div> %endif </td> diff -r 8da91a231cdf -r 2e2b80fcbd47 templates/admin/library/ldda_info.mako --- a/templates/admin/library/ldda_info.mako Tue May 05 13:03:23 2009 -0400 +++ b/templates/admin/library/ldda_info.mako Tue May 05 13:48:01 2009 -0400 @@ -5,6 +5,7 @@ <% from galaxy import util %> <% + library = trans.app.model.Library.get( library_id ) if ldda == ldda.library_dataset.library_dataset_dataset_association: current_version = True else: @@ -20,7 +21,7 @@ <ul class="manage-table-actions"> <li> - <a class="action-button" href="${h.url_for( controller='admin', action='browse_library', id=library_id )}"><span>Browse this library</span></a> + <a class="action-button" href="${h.url_for( controller='admin', action='browse_library', id=library_id, deleted=library.deleted, show_deleted=show_deleted )}"><span>Browse this library</span></a> </li> </ul> @@ -38,21 +39,24 @@ <div class="toolForm"> <div class="toolFormTitle"> Information about ${ldda.name} - <a id="dataset-${ldda.id}-popup" class="popup-arrow" style="display: none;">▼</a> - <div popupmenu="dataset-${ldda.id}-popup"> - <a class="action-button" href="${h.url_for( controller='admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, id=ldda.id, edit_info=True )}">Edit this dataset's information</a> - ## We're disabling the ability to add templates at the LDDA and LibraryDataset level, but will leave this here for possible future use - ##<a class="action-button" href="${h.url_for( controller='admin', action='info_template', library_id=library_id, library_dataset_id=ldda.library_dataset.id, new_template=True )}">Add an information template to this dataset</a> - <a class="action-button" href="${h.url_for( controller='admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, id=ldda.id, permissions=True )}">Edit this dataset's permissions</a> - %if current_version: - <a class="action-button" href="${h.url_for( controller='admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, replace_id=ldda.library_dataset.id )}">Upload a new version of this dataset</a> - %endif - %if ldda.has_data: - <a class="action-button" href="${h.url_for( controller='admin', action='download_dataset_from_folder', id=ldda.id, library_id=library_id )}">Download this dataset</a> - %endif - ##TODO: need to revamp the way we remove datasets from disk. - ##<a class="action-button" confirm="Click OK to remove dataset '${ldda.name}'?" href="${h.url_for( controller='admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, id=ldda.id, delete=True )}">Remove this dataset from the library</a> - </div> + %if not library.deleted and not ldda.library_dataset.folder.deleted and not ldda.deleted: + <a id="dataset-${ldda.id}-popup" class="popup-arrow" style="display: none;">▼</a> + <div popupmenu="dataset-${ldda.id}-popup"> + <a class="action-button" href="${h.url_for( controller='admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, id=ldda.id, edit_info=True )}">Edit this dataset's information</a> + ## We're disabling the ability to add templates at the LDDA and LibraryDataset level, but will leave this here for possible future use + ##<a class="action-button" href="${h.url_for( controller='admin', action='info_template', library_id=library_id, library_dataset_id=ldda.library_dataset.id, new_template=True )}">Add an information template to this dataset</a> + <a class="action-button" href="${h.url_for( controller='admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, id=ldda.id, permissions=True )}">Edit this dataset's permissions</a> + %if current_version: + <a class="action-button" href="${h.url_for( controller='admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, replace_id=ldda.library_dataset.id )}">Upload a new version of this dataset</a> + %endif + %if ldda.has_data: + <a class="action-button" href="${h.url_for( controller='admin', action='download_dataset_from_folder', id=ldda.id, library_id=library_id )}">Download this dataset</a> + %endif + %if not library.deleted and not ldda.library_dataset.folder.deleted and not ldda.deleted: + <a class="action-button" confirm="Click OK to remove dataset '${ldda.name}'?" href="${h.url_for( controller='admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, id=ldda.id, delete=True )}">Delete this dataset</a> + %endif + </div> + %endif </div> <div class="toolFormBody"> <div class="form-row"> @@ -104,7 +108,10 @@ <div> There are ${len( ldda.visible_children )} secondary datasets. %for idx, child in enumerate( ldda.visible_children ): - ${ render_dataset( child, selected, library.deleted ) } + ## TODO: do we need to clarify if the child is deleted? + %if not child.purged: + ${ render_dataset( child, selected, library, False, False ) } + %endif %endfor </div> %endif diff -r 8da91a231cdf -r 2e2b80fcbd47 templates/library/ldda_info.mako --- a/templates/library/ldda_info.mako Tue May 05 13:03:23 2009 -0400 +++ b/templates/library/ldda_info.mako Tue May 05 13:48:01 2009 -0400 @@ -111,7 +111,10 @@ <div> There are ${len( ldda.visible_children )} secondary datasets. %for idx, child in enumerate( ldda.visible_children ): - ${ render_dataset( child, selected, library.deleted ) } + ## TODO: do we need to clarify if the child is deleted? + %if not child.purged: + ${ render_dataset( child, selected, library ) } + %endif %endfor </div> %endif