diff --git a/lib/galaxy/web/controllers/admin.py b/lib/galaxy/web/controllers/admin.py index 362440163ec..eac0ebeaaff 100644 --- a/lib/galaxy/web/controllers/admin.py +++ b/lib/galaxy/web/controllers/admin.py @@ -886,7 +886,7 @@ class Admin( BaseController ): return trans.response.send_redirect( web.url_for( controller='admin', action='library', id=id, - information=True, + edit_info=True, msg=util.sanitize_text( msg ), messagetype='done' ) ) return trans.fill_template( '/admin/library/library_info.mako', @@ -1090,7 +1090,7 @@ class Admin( BaseController ): action='folder', id=id, library_id=library_id, - information=True, + edit_info=True, msg=util.sanitize_text( msg ), messagetype='done' ) ) return trans.fill_template( '/admin/library/folder_info.mako', @@ -1147,10 +1147,7 @@ class Admin( BaseController ): messagetype = params.get( 'messagetype', 'done' ) if params.get( 'permissions', False ): action = 'permissions' - elif params.get( 'versions', False ): - action = 'versions' else: - # 'information' will be the default action = 'information' library_dataset = trans.app.model.LibraryDataset.get( id ) if not library_dataset: @@ -1181,17 +1178,6 @@ class Admin( BaseController ): render_templates=params.get( 'render_templates', False ), msg=msg, messagetype=messagetype ) - elif action == 'versions': - if params.get( 'change_version_button', False ): - target_lda = trans.app.model.LibraryDatasetDatasetAssociation.get( kwd.get( 'set_lda_id' ) ) - library_dataset.library_dataset_dataset_association = target_lda - trans.app.model.flush() - msg = 'The current version of this library dataset has been updated to be %s' % target_lda.name - return trans.fill_template( '/admin/library/library_dataset_versions.mako', - library_dataset=library_dataset, - library_id=library_id, - msg=msg, - messagetype=messagetype ) elif action == 'permissions': if params.get( 'update_roles_button', False ): # The user clicked the Save button on the 'Edit permissions and role associations' form @@ -1296,9 +1282,10 @@ class Admin( BaseController ): else: if params.get( 'permissions', False ): action = 'permissions' + elif params.get( 'edit_info', False ): + action = 'edit_info' else: - # 'information' will be the default - action = 'information' + action = 'info' if id.count( ',' ): ids = id.split( ',' ) id = None @@ -1341,13 +1328,19 @@ class Admin( BaseController ): library_id=library_id, msg=msg, messagetype=messagetype ) - elif action == 'information': + elif action == 'info': + return trans.fill_template( '/admin/library/ldda_info.mako', + ldda=ldda, + library_id=library_id, + msg=msg, + messagetype=messagetype ) + elif action == 'edit_info': if params.get( 'change', False ): # The user clicked the Save button on the 'Change data type' form trans.app.datatypes_registry.change_datatype( ldda, params.datatype ) trans.app.model.flush() msg = "Data type changed for library dataset '%s'" % ldda.name - return trans.fill_template( "/admin/library/ldda_info.mako", + return trans.fill_template( "/admin/library/ldda_edit_info.mako", ldda=ldda, library_id=library_id, datatypes=ldatatypes, @@ -1383,7 +1376,7 @@ class Admin( BaseController ): trans.app.model.flush() msg = 'Attributes updated for library dataset %s' % ldda.name messagetype = 'done' - return trans.fill_template( "/admin/library/ldda_info.mako", + return trans.fill_template( "/admin/library/ldda_edit_info.mako", ldda=ldda, library_id=library_id, datatypes=ldatatypes, @@ -1402,7 +1395,7 @@ class Admin( BaseController ): ldda.datatype.after_edit( ldda ) trans.app.model.flush() msg = 'Attributes updated for library dataset %s' % ldda.name - return trans.fill_template( "/admin/library/ldda_info.mako", + return trans.fill_template( "/admin/library/ldda_edit_info.mako", ldda=ldda, library_id=library_id, datatypes=ldatatypes, @@ -1416,7 +1409,7 @@ class Admin( BaseController ): ldda.deleted = True ldda.flush() msg = 'Dataset %s has been removed from this library' % ldda.name - return trans.fill_template( "/admin/library/ldda_info.mako", + return trans.fill_template( "/admin/library/ldda_edit_info.mako", ldda=ldda, library_id=library_id, datatypes=ldatatypes, @@ -1432,7 +1425,7 @@ class Admin( BaseController ): # case it resorts to the old dbkey. Setting the dbkey # sets it properly in the metadata ldda.metadata.dbkey = ldda.dbkey - return trans.fill_template( "/admin/library/ldda_info.mako", + return trans.fill_template( "/admin/library/ldda_edit_info.mako", ldda=ldda, library_id=library_id, datatypes=ldatatypes, @@ -1851,7 +1844,7 @@ class Admin( BaseController ): id=library_item.id, library_id=library_id, folder_id=folder_id, - information=True, + edit_info=True, msg=util.sanitize_text( msg ), messagetype='error' ) ) user = trans.get_user() @@ -1883,7 +1876,7 @@ class Admin( BaseController ): id=library_item.id, library_id=library_id, folder_id=folder_id, - information=True, + edit_info=True, msg=util.sanitize_text( msg ), messagetype='done' ) ) return trans.fill_template( "/admin/library/new_info.mako", @@ -1906,7 +1899,7 @@ class Admin( BaseController ): id=library_item.id, library_id=library_id, folder_id=folder_id, - information=True, + edit_info=True, msg=util.sanitize_text( msg ), messagetype='done' ) ) elif params.get( 'permissions', False ): diff --git a/lib/galaxy/web/controllers/library.py b/lib/galaxy/web/controllers/library.py index cb724f0ba15..da1a0b0e03f 100644 --- a/lib/galaxy/web/controllers/library.py +++ b/lib/galaxy/web/controllers/library.py @@ -118,7 +118,7 @@ class Library( BaseController ): return trans.response.send_redirect( web.url_for( controller='library', action='library', id=id, - information=True, + edit_info=True, msg=util.sanitize_text( msg ), messagetype='done' ) ) return trans.fill_template( '/library/library_info.mako', @@ -327,10 +327,7 @@ class Library( BaseController ): messagetype = params.get( 'messagetype', 'done' ) if params.get( 'permissions', False ): action = 'permissions' - elif params.get( 'versions', False ): - action = 'versions' else: - # 'information' will be the default action = 'information' library_dataset = trans.app.model.LibraryDataset.get( id ) if not library_dataset: @@ -368,24 +365,6 @@ class Library( BaseController ): render_templates=params.get( 'render_templates', False ), msg=msg, messagetype=messagetype ) - elif action == 'versions': - if params.get( 'change_version_button', False ): - if trans.app.security_agent.allow_action( trans.user, - trans.app.security_agent.permitted_actions.LIBRARY_MODIFY, - library_item=library_dataset ): - target_lda = trans.app.model.LibraryDatasetDatasetAssociation.get( kwd.get( 'set_lda_id' ) ) - library_dataset.library_dataset_dataset_association = target_lda - trans.app.model.flush() - msg = 'The current version of this library dataset has been updated to be %s' % target_lda.name - messagetype = 'done' - else: - msg = "You are not authorized to change the versions of this dataset" - messagetype = "error" - return trans.fill_template( '/library/library_dataset_versions.mako', - library_dataset=library_dataset, - library_id=library_id, - msg=msg, - messagetype=messagetype ) elif action == 'permissions': if params.get( 'update_roles_button', False ): if trans.app.security_agent.allow_action( trans.user, @@ -443,9 +422,10 @@ class Library( BaseController ): if id: if params.get( 'permissions', False ): action = 'permissions' + elif params.get( 'edit_info', False ): + action = 'edit_info' else: - # 'information' will be the default - action = 'information' + action = 'info' if id.count( ',' ): ids = id.split( ',' ) id = None @@ -500,7 +480,13 @@ class Library( BaseController ): library_id=library_id, msg=msg, messagetype=messagetype ) - elif action == 'information': + elif action == 'info': + return trans.fill_template( '/library/ldda_info.mako', + ldda=ldda, + library_id=library_id, + msg=msg, + messagetype=messagetype ) + elif action == 'edit_info': if params.get( 'change', False ): # The user clicked the Save button on the 'Change data type' form if trans.app.security_agent.allow_action( trans.user, @@ -513,7 +499,7 @@ class Library( BaseController ): else: msg = "You are not authorized to change the data type of dataset '%s'" % ldda.name messagetype = 'error' - return trans.fill_template( "/library/ldda_info.mako", + return trans.fill_template( "/library/ldda_edit_info.mako", ldda=ldda, library_id=library_id, datatypes=ldatatypes, @@ -555,7 +541,7 @@ class Library( BaseController ): else: msg = "you are not authorized to edit the attributes of dataset '%s'" % ldda.name messagetype = 'error' - return trans.fill_template( "/library/ldda_info.mako", + return trans.fill_template( "/library/ldda_edit_info.mako", ldda=ldda, library_id=library_id, datatypes=ldatatypes, @@ -581,7 +567,7 @@ class Library( BaseController ): else: msg = "you are not authorized to edit the attributes of dataset '%s'" % ldda.name messagetype = 'error' - return trans.fill_template( "/library/ldda_info.mako", + return trans.fill_template( "/library/ldda_edit_info.mako", ldda=ldda, library_id=library_id, datatypes=ldatatypes, @@ -602,7 +588,7 @@ class Library( BaseController ): else: msg = "you are not authorized to delete dataset '%s'" % ldda.name messagetype = 'error' - return trans.fill_template( "/library/ldda_info.mako", + return trans.fill_template( "/library/ldda_edit_info.mako", ldda=ldda, library_id=library_id, datatypes=ldatatypes, @@ -621,7 +607,7 @@ class Library( BaseController ): # case it resorts to the old dbkey. Setting the dbkey # sets it properly in the metadata ldda.metadata.dbkey = ldda.dbkey - return trans.fill_template( "/library/ldda_info.mako", + return trans.fill_template( "/library/ldda_edit_info.mako", ldda=ldda, library_id=library_id, datatypes=ldatatypes, @@ -1282,7 +1268,7 @@ class Library( BaseController ): id=library_item.id, library_id=library_id, folder_id=folder_id, - information=True, + edit_info=True, msg=util.sanitize_text( msg ), messagetype='error' ) ) user = trans.get_user() @@ -1314,7 +1300,7 @@ class Library( BaseController ): id=library_item.id, library_id=library_id, folder_id=folder_id, - information=True, + edit_info=True, msg=util.sanitize_text( msg ), messagetype='done' ) ) return trans.fill_template( "/library/new_info.mako", @@ -1337,7 +1323,7 @@ class Library( BaseController ): id=library_item.id, library_id=library_id, folder_id=folder_id, - information=True, + edit_info=True, msg=util.sanitize_text( msg ), messagetype='done' ) ) elif params.get( 'permissions', False ): diff --git a/templates/admin/library/browse_library.mako b/templates/admin/library/browse_library.mako index c3ead8a9aec..8622ed3b7ed 100644 --- a/templates/admin/library/browse_library.mako +++ b/templates/admin/library/browse_library.mako @@ -74,7 +74,11 @@ def name_sorted( l ): <%def name="render_folder( parent, parent_pad, deleted, created_ldda_ids, library_id )"> <% - pad = parent_pad + 20 + root_folder = not parent.parent + if root_folder: + pad = parent_pad + else: + pad = parent_pad + 20 if parent_pad == 0: expander = "/static/images/silk/resultset_bottom.png" folder = "/static/images/silk/folder_page.png" @@ -83,7 +87,6 @@ def name_sorted( l ): expander = "/static/images/silk/resultset_next.png" folder = "/static/images/silk/folder.png" subfolder = True - root_folder = not parent.parent created_ldda_id_list = util.listify( created_ldda_ids ) if created_ldda_id_list: created_ldda_ids = [ int( ldda_id ) for ldda_id in created_ldda_id_list ] @@ -208,9 +211,9 @@ def name_sorted( l ): ## %endif - Format - Db - Info + Information + Uploaded By + Date diff --git a/templates/admin/library/common.mako b/templates/admin/library/common.mako index 2b4a817f215..3f5fb11808d 100644 --- a/templates/admin/library/common.mako +++ b/templates/admin/library/common.mako @@ -1,3 +1,5 @@ +<% from time import strftime %> + <%def name="render_dataset( library_dataset, selected, library )"> <% ## The received data must always be a LibraryDataset object, but the object id passed to methods from the drop down menu @@ -5,6 +7,14 @@ ## lddas ). We also need to make sure we're displaying the latest version of this library_dataset, so we display the attributes ## from the ldda. ldda = library_dataset.library_dataset_dataset_association + if ldda.user: + uploaded_by = ldda.user.email + else: + uploaded_by = 'anonymous' + if ldda == ldda.library_dataset.library_dataset_dataset_association: + current_version = True + else: + current_version = False %>
## Header row for library items (name, state, action buttons) @@ -17,7 +27,7 @@ %else: %endif - ${ldda.name} + ${ldda.name[:50]} %if not library.deleted: <% library_item_ids = {} @@ -25,11 +35,13 @@ %>
- Edit this dataset's information + Edit this dataset's information ## We're disabling the ability to add templates at the LDDA and LibraryDataset level, but will leave this here for possible future use ##Add an information template to this dataset Edit this dataset's permissions - Manage this dataset's versions + %if current_version: + Upload a new version of this dataset + %endif %if ldda.has_data: Download this dataset %endif @@ -38,46 +50,16 @@
%endif - ${ldda.ext} - ${ldda.dbkey} - ${ldda.info} + ${ldda.message} + ${uploaded_by} + ${ldda.create_time.strftime( "%Y-%m-%d" )}
- - ## Body for library items, extra info and actions, data "peek" -
-
${ldda.blurb}
-
- %if ldda.has_data: - %for display_app in ldda.datatype.get_display_types(): - <% display_links = ldda.datatype.get_display_links( ldda, display_app, app, request.base ) %> - %if len( display_links ) > 0: - ${ldda.datatype.get_display_label(display_app)} - %for ldda.name, display_link in display_links: - ${ldda.name} - %endfor - %endif - %endfor - %endif -
- %if ldda.peek != "no peek": -
${ldda.display_peek()}
- %endif - ## Recurse for child datasets - %if len( ldda.visible_children ) > 0: -
- There are ${len( ldda.visible_children )} secondary datasets. - %for idx, child in enumerate( ldda.visible_children ): - ${ render_dataset( child, selected, library.deleted ) } - %endfor -
- %endif -
-<%def name="render_existing_library_item_info( library_item, library_id )"> +<%def name="render_library_item_info_for_edit( library_item, library_id )"> <% library_item_type = 'unknown type' library_item_desc = '' @@ -123,7 +105,7 @@ Edit this information's permissions - +
%endfor @@ -138,6 +120,55 @@ %endif +<%def name="render_library_item_info( library_item, library_id )"> + <% + library_item_type = 'unknown type' + library_item_desc = '' + library_item_info_associations = [] + if isinstance( library_item, trans.app.model.Library ): + library_item_type = 'library' + library_item_desc = 'library' + library_item_info_associations = library_item.library_info_associations + elif isinstance( library_item, trans.app.model.LibraryFolder ): + library_item_type = 'folder' + library_item_desc = 'folder' + library_item_info_associations = library_item.library_folder_info_associations + elif isinstance( library_item, trans.app.model.LibraryDataset ): + library_item_type = 'library_dataset' + library_item_desc = 'dataset' + library_item_info_associations = library_item.library_dataset_info_associations + elif isinstance( library_item, trans.app.model.LibraryDatasetDatasetAssociation ): + library_item_type = 'library_dataset_dataset_association' + library_item_desc = 'library dataset' + library_item_info_associations = library_item.library_dataset_dataset_info_associations + elif isinstance( library_item, trans.app.model.LibraryItemInfoElement ): + library_item_type = 'library_item_info' + library_item_desc = 'information' + library_item_info_associations = None + %> + %if library_item_info_associations: +

+

+
Other information about ${library_item_desc} ${library_item.name}
+
+ %for library_item_info_association in library_item_info_associations: + %for template_element in library_item_info_association.library_item_info.library_item_info_template.elements: + <% element = library_item_info_association.library_item_info.get_element_by_template_element( template_element ) %> +
+ +
+ ${element.contents} +
+
+
+ %endfor +
+ %endfor +
+
+ %endif + + <%def name="render_available_templates( library_item, library_id, restrict=False, upload=False )"> <% available_templates = library_item.get_library_item_info_templates( template_list=[], restrict=restrict ) @@ -168,7 +199,7 @@
%for available_template in available_templates: %if upload in [ False, 'False' ]: - # Only render a form if we're not within the upload form + ## Only render a form if we're not within the upload form
%endif @@ -178,7 +209,7 @@ %for info_elem in available_template.elements:
- +
${info_elem.description}
diff --git a/templates/admin/library/folder_info.mako b/templates/admin/library/folder_info.mako index 0691c5e1216..e9810b8a0cf 100644 --- a/templates/admin/library/folder_info.mako +++ b/templates/admin/library/folder_info.mako @@ -1,7 +1,7 @@ <%inherit file="/base.mako"/> <%namespace file="/message.mako" import="render_msg" /> <%namespace file="/admin/library/common.mako" import="render_available_templates" /> -<%namespace file="/admin/library/common.mako" import="render_existing_library_item_info" /> +<%namespace file="/admin/library/common.mako" import="render_library_item_info_for_edit" />

    @@ -39,7 +39,7 @@ <% folder.refresh() %> %if folder.library_folder_info_associations: - ${render_existing_library_item_info( folder, library_id )} + ${render_library_item_info_for_edit( folder, library_id )} %elif folder.library_folder_info_template_associations: ${render_available_templates( folder, library_id, restrict=True )} %else: diff --git a/templates/admin/library/ldda_edit_info.mako b/templates/admin/library/ldda_edit_info.mako new file mode 100644 index 00000000000..479aa8ba733 --- /dev/null +++ b/templates/admin/library/ldda_edit_info.mako @@ -0,0 +1,126 @@ +<%inherit file="/base.mako"/> +<%namespace file="/message.mako" import="render_msg" /> +<%namespace file="/admin/library/common.mako" import="render_available_templates" /> +<%namespace file="/admin/library/common.mako" import="render_library_item_info_for_edit" /> +<% from galaxy import util %> + +%if ldda == ldda.library_dataset.library_dataset_dataset_association: + This is the latest version of this library dataset +%else: + This is an expired version of this library dataset +%endif +

    + +

    + +%if msg: + ${render_msg( msg, messagetype )} +%endif + +<%def name="datatype( ldda, datatypes )"> + + + +
    +
    Edit attributes of ${ldda.name}
    +
    + + +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    + This information will be displayed in the library browser +
    +
    +
    + %for name, spec in ldda.metadata.spec.items(): + %if spec.visible: +
    + +
    + ${ldda.metadata.get_html_by_name( name )} +
    +
    +
    + %endif + %endfor +
    + +
    + +
    + +
    + +
    +
    + This will inspect the dataset and attempt to correct the above column values if they are not accurate. +
    +
    +
    +
    +

    +

    +
    Change data type of ${ldda.name}
    +
    +
    + +
    + +
    + ${datatype( ldda, datatypes )} +
    +
    + This will change the datatype of the existing dataset + but not modify its contents. Use this if Galaxy + has incorrectly guessed the type of your dataset. +
    +
    +
    +
    + +
    +
    +
    +
    + +<% ldda.refresh() %> +%if ldda.library_dataset_dataset_info_associations: + ${render_library_item_info_for_edit( ldda, library_id )} +%elif ldda.library_dataset_dataset_info_template_associations: + ${render_available_templates( ldda, library_id, restrict=True )} +%elif ldda.library_dataset.folder.library_folder_info_template_associations: + ${render_available_templates( ldda, library_id, restrict='folder' )} +%else: + ${render_available_templates( ldda, library_id, restrict=False )} +%endif diff --git a/templates/admin/library/ldda_info.mako b/templates/admin/library/ldda_info.mako index e9c88bda910..a2b3533d788 100644 --- a/templates/admin/library/ldda_info.mako +++ b/templates/admin/library/ldda_info.mako @@ -1,10 +1,17 @@ <%inherit file="/base.mako"/> <%namespace file="/message.mako" import="render_msg" /> <%namespace file="/admin/library/common.mako" import="render_available_templates" /> -<%namespace file="/admin/library/common.mako" import="render_existing_library_item_info" /> +<%namespace file="/admin/library/common.mako" import="render_library_item_info" /> <% from galaxy import util %> -%if ldda == ldda.library_dataset.library_dataset_dataset_association: +<% + if ldda == ldda.library_dataset.library_dataset_dataset_association: + current_version = True + else: + current_version = False +%> + +%if current_version: This is the latest version of this library dataset %else: This is an expired version of this library dataset @@ -21,106 +28,101 @@ ${render_msg( msg, messagetype )} %endif -<%def name="datatype( ldda, datatypes )"> - - +<% + if ldda.user: + uploaded_by = ldda.user.email + else: + uploaded_by = 'anonymous' +%>
    -
    Edit attributes of ${ldda.name}
    +
    + Information about ${ldda.name} + +
    + Edit this dataset's information + ## We're disabling the ability to add templates at the LDDA and LibraryDataset level, but will leave this here for possible future use + ##Add an information template to this dataset + Edit this dataset's permissions + %if current_version: + Upload a new version of this dataset + %endif + %if ldda.has_data: + Download this dataset + %endif + ##TODO: need to revamp the way we remove datasets from disk. + ##Remove this dataset from the library +
    +
    -
    - -
    -
    - -
    - -
    -
    +
    + +
    + ${ldda.message}
    -
    - -
    - -
    -
    -
    -
    - -
    - -
    -
    - This information will be displayed in the library browser -
    -
    +
    +
    +
    +
    + %if ldda.library_dataset_dataset_info_associations: + ${render_library_item_info( ldda, library_id )} + %endif + %if current_version: + <% expired_lddas = [ e_ldda for e_ldda in ldda.library_dataset.expired_datasets ] %> + %if expired_lddas: +
    Expired versions of ${ldda.name}
    + %for expired_ldda in expired_lddas: + %endfor -
    - -
    - -
    - -
    - -
    -
    - This will inspect the dataset and attempt to correct the above column values if they are not accurate. -
    -
    -
    + %endif + %endif
    -

    -

    -
    Change data type of ${ldda.name}
    -
    -
    - -
    - -
    - ${datatype( ldda, datatypes )} -
    -
    - This will change the datatype of the existing dataset - but not modify its contents. Use this if Galaxy - has incorrectly guessed the type of your dataset. -
    -
    -
    -
    - -
    -
    -
    -
    - -<% ldda.refresh() %> -%if ldda.library_dataset_dataset_info_associations: - ${render_existing_library_item_info( ldda, library_id )} -%elif ldda.library_dataset_dataset_info_template_associations: - ${render_available_templates( ldda, library_id, restrict=True )} -%elif ldda.library_dataset.folder.library_folder_info_template_associations: - ${render_available_templates( ldda, library_id, restrict='folder' )} -%else: - ${render_available_templates( ldda, library_id, restrict=False )} -%endif diff --git a/templates/admin/library/library_dataset_info.mako b/templates/admin/library/library_dataset_info.mako index e3972a43378..81a833128b2 100644 --- a/templates/admin/library/library_dataset_info.mako +++ b/templates/admin/library/library_dataset_info.mako @@ -1,7 +1,7 @@ <%inherit file="/base.mako"/> <%namespace file="/message.mako" import="render_msg" /> <%namespace file="/admin/library/common.mako" import="render_available_templates" /> -<%namespace file="/admin/library/common.mako" import="render_existing_library_item_info" /> +<%namespace file="/admin/library/common.mako" import="render_library_item_info_for_edit" /> %if library_dataset == library_dataset.library_dataset_dataset_association.library_dataset: This is the latest version of this library dataset @@ -48,7 +48,7 @@ <% library_dataset.refresh() %> %if library_dataset.library_dataset_info_associations: - ${render_existing_library_item_info( library_dataset, library_id )} + ${render_library_item_info_for_edit( library_dataset, library_id )} %elif library_dataset.folder.library_folder_info_template_associations: ${render_available_templates( library_dataset, library_id, restrict='folder' )} %else: diff --git a/templates/admin/library/library_dataset_versions.mako b/templates/admin/library/library_dataset_versions.mako deleted file mode 100644 index 62edf7f1a8f..00000000000 --- a/templates/admin/library/library_dataset_versions.mako +++ /dev/null @@ -1,55 +0,0 @@ -<%inherit file="/base.mako"/> -<%namespace file="/message.mako" import="render_msg" /> - -%if library_dataset == library_dataset.library_dataset_dataset_association.library_dataset: - This is the latest version of this library dataset -%else: - This is an expired version of this library dataset -%endif -

    - -

    - -%if msg: - ${render_msg( msg, messagetype )} -%endif - -
    -
    Set version of ${library_dataset.name}
    -
    -
    -
    -
    -
    - ${library_dataset.name} (current) - - - %for ldda in library_dataset.expired_datasets: -
    - ${ldda.name} - - - %endfor -
    -
    -
    -
    - %if library_dataset.expired_datasets: -
    - -
    - %endif -
    -
    -
    diff --git a/templates/admin/library/library_info.mako b/templates/admin/library/library_info.mako index f058dc9b179..527fea66839 100644 --- a/templates/admin/library/library_info.mako +++ b/templates/admin/library/library_info.mako @@ -1,7 +1,7 @@ <%inherit file="/base.mako"/> <%namespace file="/message.mako" import="render_msg" /> <%namespace file="/admin/library/common.mako" import="render_available_templates" /> -<%namespace file="/admin/library/common.mako" import="render_existing_library_item_info" /> +<%namespace file="/admin/library/common.mako" import="render_library_item_info_for_edit" />

      @@ -44,7 +44,7 @@ <% library.refresh() %> %if library.library_info_associations: - ${render_existing_library_item_info( library, library.id )} + ${render_library_item_info_for_edit( library, library.id )} %else: ${render_available_templates( library, library.id, restrict=False )} %endif diff --git a/templates/admin/library/new_dataset.mako b/templates/admin/library/new_dataset.mako index 9f0f477d357..33e90bdbdbf 100644 --- a/templates/admin/library/new_dataset.mako +++ b/templates/admin/library/new_dataset.mako @@ -125,7 +125,7 @@
    - This information will be displayed in the library browser + This information will be displayed in the "Information" column for this dataset in the library browser
    diff --git a/templates/library/browse_library.mako b/templates/library/browse_library.mako index 5f4081b45ee..9d2f0600c79 100644 --- a/templates/library/browse_library.mako +++ b/templates/library/browse_library.mako @@ -113,7 +113,11 @@ def name_sorted( l ): return False if not show_folder: return "" - pad = parent_pad + 20 + root_folder = not parent.parent + if root_folder: + pad = parent_pad + else: + pad = parent_pad + 20 if parent_pad == 0: expander = "/static/images/silk/resultset_bottom.png" folder = "/static/images/silk/folder_page.png" @@ -122,7 +126,6 @@ def name_sorted( l ): expander = "/static/images/silk/resultset_next.png" folder = "/static/images/silk/folder.png" subfolder = True - root_folder = not parent.parent created_ldda_id_list = util.listify( created_ldda_ids ) if created_ldda_id_list: created_ldda_ids = [ int( ldda_id ) for ldda_id in created_ldda_id_list ] @@ -242,9 +245,9 @@ def name_sorted( l ):
- Format - Db - Info + Information + Uploaded By + Date
diff --git a/templates/library/common.mako b/templates/library/common.mako index 6af6df3e675..a6e42f31a8d 100644 --- a/templates/library/common.mako +++ b/templates/library/common.mako @@ -1,3 +1,5 @@ +<% from time import strftime %> + <%def name="render_dataset( library_dataset, selected, library )"> <% ## The received data must always be a LibraryDataset object, but the object id passed to methods from the drop down menu @@ -5,6 +7,14 @@ ## lddas ). We also need to make sure we're displaying the latest version of this library_dataset, so we display the attributes ## from the ldda. ldda = library_dataset.library_dataset_dataset_association + if ldda.user: + uploaded_by = ldda.user.email + else: + uploaded_by = 'anonymous' + if ldda == ldda.library_dataset.library_dataset_dataset_association: + current_version = True + else: + current_version = False %>
## Header row for library items (name, state, action buttons) @@ -17,11 +27,11 @@ %else: %endif - ${ldda.name} + ${ldda.name[:60]}
%if trans.app.security_agent.allow_action( trans.user, trans.app.security_agent.permitted_actions.LIBRARY_MODIFY, library_item=ldda.library_dataset ): - Edit this dataset's information + Edit this dataset's information %else: View this dataset's information %endif @@ -31,8 +41,8 @@ ##%endif %if trans.app.security_agent.allow_action( trans.user, trans.app.security_agent.permitted_actions.DATASET_MANAGE_PERMISSIONS, dataset=ldda.dataset ) and trans.app.security_agent.allow_action( trans.user, trans.app.security_agent.permitted_actions.LIBRARY_MANAGE, library_item=ldda.library_dataset ): Edit this dataset's permissions - %if trans.app.security_agent.allow_action( trans.user, trans.app.security_agent.permitted_actions.LIBRARY_MODIFY, library_item=ldda.library_dataset ): - Manage this dataset's versions + %if current_version and trans.app.security_agent.allow_action( trans.user, trans.app.security_agent.permitted_actions.LIBRARY_MODIFY, library_item=ldda.library_dataset ): + Upload a new version of this dataset %endif %endif %if ldda.has_data: @@ -41,48 +51,19 @@ %endif
- ${ldda.ext} - ${ldda.dbkey} - ${ldda.info} + ${ldda.message} + ${uploaded_by} + ${ldda.create_time.strftime( "%Y-%m-%d" )}
- - ## Body for library items, extra info and actions, data "peek" -
-
${ldda.blurb}
-
- %if ldda.has_data: - %for display_app in ldda.datatype.get_display_types(): - <% display_links = ldda.datatype.get_display_links( ldda, display_app, app, request.base ) %> - %if len( display_links ) > 0: - ${ldda.datatype.get_display_label( display_app )} - %for ldda.name, display_link in display_links: - ${ldda.name} - %endfor - %endif - %endfor - %endif -
- %if ldda.peek != "no peek": -
${ldda.display_peek()}
- %endif - ## Recurse for child datasets - %if len( ldda.visible_children ) > 0: -
- There are ${len( ldda.visible_children )} secondary datasets. - %for idx, child in enumerate( ldda.visible_children ): - ${render_dataset( child, selected, library )} - %endfor -
- %endif -
-<%def name="render_existing_library_item_info( library_item, library_id )"> +<%def name="render_library_item_info_for_edit( library_item, library_id )"> <% - library_item_type = None + library_item_type = 'unknown type' + library_item_desc = '' library_item_info_associations = [] if isinstance( library_item, trans.app.model.Library ): library_item_type = 'library' @@ -100,6 +81,10 @@ library_item_type = 'library_dataset_dataset_association' library_item_desc = 'library dataset' library_item_info_associations = library_item.library_dataset_dataset_info_associations + elif isinstance( library_item, trans.app.model.LibraryItemInfoElement ): + library_item_type = 'library_item_info' + library_item_desc = 'information' + library_item_info_associations = None %> %if library_item_info_associations:

@@ -132,7 +117,7 @@ %endif %if can_modify: - + <% render_submit_button = True %> %else: ${element.contents} @@ -153,6 +138,55 @@ %endif +<%def name="render_library_item_info( library_item, library_id )"> + <% + library_item_type = 'unknown type' + library_item_desc = '' + library_item_info_associations = [] + if isinstance( library_item, trans.app.model.Library ): + library_item_type = 'library' + library_item_desc = 'library' + library_item_info_associations = library_item.library_info_associations + elif isinstance( library_item, trans.app.model.LibraryFolder ): + library_item_type = 'folder' + library_item_desc = 'folder' + library_item_info_associations = library_item.library_folder_info_associations + elif isinstance( library_item, trans.app.model.LibraryDataset ): + library_item_type = 'library_dataset' + library_item_desc = 'dataset' + library_item_info_associations = library_item.library_dataset_info_associations + elif isinstance( library_item, trans.app.model.LibraryDatasetDatasetAssociation ): + library_item_type = 'library_dataset_dataset_association' + library_item_desc = 'library dataset' + library_item_info_associations = library_item.library_dataset_dataset_info_associations + elif isinstance( library_item, trans.app.model.LibraryItemInfoElement ): + library_item_type = 'library_item_info' + library_item_desc = 'information' + library_item_info_associations = None + %> + %if library_item_info_associations: +

+

+
Other information about ${library_item_desc} ${library_item.name}
+
+ %for library_item_info_association in library_item_info_associations: + %for template_element in library_item_info_association.library_item_info.library_item_info_template.elements: + <% element = library_item_info_association.library_item_info.get_element_by_template_element( template_element ) %> +
+ +
+ ${element.contents} +
+
+
+ %endfor +
+ %endfor +
+
+ %endif + + <%def name="render_available_templates( library_item, library_id, restrict=False, upload=False )"> <% available_templates = library_item.get_library_item_info_templates( template_list=[], restrict=restrict ) @@ -177,15 +211,14 @@ library_item_ids[ 'library_id' ] = library_id %> %if available_templates: - ## There should only be 1 template here - %for available_template in available_templates: - %if trans.app.security_agent.allow_action( trans.user, trans.app.security_agent.permitted_actions.LIBRARY_ADD, library_item=available_template ): -

-

-
Other information about ${library_item_desc} ${library_item.name}
-
+

+

+
Other information about ${library_item_desc} ${library_item.name}
+
+ %for available_template in available_templates: + %if trans.app.security_agent.allow_action( trans.user, trans.app.security_agent.permitted_actions.LIBRARY_ADD, library_item=available_template ): %if upload in [ False, 'False' ]: - # Only render a form if we're not within the upload form + ## Only render a form if we're not within the upload form
%endif @@ -208,9 +241,9 @@
%endif -
-
- %endif - %endfor + %endif + %endfor +
+ %endif diff --git a/templates/library/folder_info.mako b/templates/library/folder_info.mako index fd83cddeab9..12817324a95 100644 --- a/templates/library/folder_info.mako +++ b/templates/library/folder_info.mako @@ -1,7 +1,7 @@ <%inherit file="/base.mako"/> <%namespace file="/message.mako" import="render_msg" /> <%namespace file="/library/common.mako" import="render_available_templates" /> -<%namespace file="/library/common.mako" import="render_existing_library_item_info" /> +<%namespace file="/library/common.mako" import="render_library_item_info_for_edit" />