Refactored the library_dataset_dataset_association methods in the library_admin and library controllers, renamed the library_dataset controller to be library_common and moved several common methods to it, and some other code cleanup.

This commit is contained in:
Greg Von Kuster
2009-09-30 05:16:17 -04:00
parent 91df9752f6
commit baa64fc6a7
43 changed files with 1456 additions and 1635 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,300 @@
import os, os.path, shutil, urllib, StringIO, re, gzip, tempfile, shutil, zipfile
from galaxy.web.base.controller import *
from galaxy import util, jobs
from galaxy.datatypes import sniff
from galaxy.security import RBACAgent
from galaxy.util.json import to_json_string
from galaxy.tools.actions import upload_common
from galaxy.web.controllers.forms import get_all_forms
from galaxy.model.orm import *
log = logging.getLogger( __name__ )
class LibraryCommon( BaseController ):
@web.json
def library_item_updates( self, trans, ids=None, states=None ):
# Avoid caching
trans.response.headers['Pragma'] = 'no-cache'
trans.response.headers['Expires'] = '0'
# Create new HTML for any that have changed
rval = {}
if ids is not None and states is not None:
ids = map( int, ids.split( "," ) )
states = states.split( "," )
for id, state in zip( ids, states ):
data = self.app.model.LibraryDatasetDatasetAssociation.get( id )
if data.state != state:
job_ldda = data
while job_ldda.copied_from_library_dataset_dataset_association:
job_ldda = job_ldda.copied_from_library_dataset_dataset_association
force_history_refresh = False
rval[id] = {
"state": data.state,
"html": unicode( trans.fill_template( "library/library_item_info.mako", ldda=data ), 'utf-8' )
#"force_history_refresh": force_history_refresh
}
return rval
def upload_dataset( self, trans, controller, library_id, folder_id, replace_dataset=None, **kwd ):
# Set up the traditional tool state/params
tool_id = 'upload1'
tool = trans.app.toolbox.tools_by_id[ tool_id ]
state = tool.new_state( trans )
errors = tool.update_state( trans, tool.inputs_by_page[0], state.inputs, kwd, changed_dependencies={} )
tool_params = state.inputs
dataset_upload_inputs = []
for input_name, input in tool.inputs.iteritems():
if input.type == "upload_dataset":
dataset_upload_inputs.append( input )
# Library-specific params
params = util.Params( kwd ) # is this filetoolparam safe?
library_bunch = upload_common.handle_library_params( trans, params, folder_id, replace_dataset )
msg = util.restore_text( params.get( 'msg', '' ) )
messagetype = params.get( 'messagetype', 'done' )
server_dir = util.restore_text( params.get( 'server_dir', '' ) )
if replace_dataset not in [ None, 'None' ]:
replace_id = replace_dataset.id
else:
replace_id = None
upload_option = params.get( 'upload_option', 'upload_file' )
err_redirect = False
if upload_option == 'upload_directory':
if server_dir in [ None, 'None', '' ]:
err_redirect = True
if controller == 'library_admin':
import_dir = trans.app.config.library_import_dir
import_dir_desc = 'library_import_dir'
full_dir = os.path.join( import_dir, server_dir )
else:
import_dir = trans.app.config.user_library_import_dir
import_dir_desc = 'user_library_import_dir'
if server_dir == trans.user.email:
full_dir = os.path.join( import_dir, server_dir )
else:
full_dir = os.path.join( import_dir, trans.user.email, server_dir )
if import_dir:
msg = 'Select a directory'
else:
msg = '"%s" is not defined in the Galaxy configuration file' % import_dir_desc
# Proceed with (mostly) regular upload processing
precreated_datasets = upload_common.get_precreated_datasets( trans, tool_params, trans.app.model.LibraryDatasetDatasetAssociation, controller=controller )
if upload_option == 'upload_file':
tool_params = upload_common.persist_uploads( tool_params )
uploaded_datasets = upload_common.get_uploaded_datasets( trans, tool_params, precreated_datasets, dataset_upload_inputs, library_bunch=library_bunch )
elif upload_option == 'upload_directory':
uploaded_datasets = self.get_server_dir_uploaded_datasets( trans, params, full_dir, import_dir_desc, library_bunch, err_redirect, msg )
upload_common.cleanup_unused_precreated_datasets( precreated_datasets )
if upload_option == 'upload_file' and not uploaded_datasets:
msg = 'Select a file, enter a URL or enter text'
err_redirect = True
if err_redirect:
trans.response.send_redirect( web.url_for( controller=controller,
action='upload_library_dataset',
library_id=library_id,
folder_id=folder_id,
replace_id=replace_id,
upload_option=upload_option,
msg=util.sanitize_text( msg ),
messagetype='error' ) )
json_file_path = upload_common.create_paramfile( uploaded_datasets )
data_list = [ ud.data for ud in uploaded_datasets ]
return upload_common.create_job( trans, tool_params, tool, json_file_path, data_list, folder=library_bunch.folder )
def get_server_dir_uploaded_datasets( self, trans, params, full_dir, import_dir_desc, library_bunch, err_redirect, msg ):
files = []
try:
for entry in os.listdir( full_dir ):
# Only import regular files
if os.path.isfile( os.path.join( full_dir, entry ) ):
files.append( entry )
except Exception, e:
msg = "Unable to get file list for configured %s, error: %s" % ( import_dir_desc, str( e ) )
err_redirect = True
return None
if not files:
msg = "The directory '%s' contains no valid files" % full_dir
err_redirect = True
return None
uploaded_datasets = []
for file in files:
library_bunch.replace_dataset = None
uploaded_dataset = util.bunch.Bunch()
uploaded_dataset.path = os.path.join( full_dir, file )
if not os.path.isfile( uploaded_dataset.path ):
continue
uploaded_dataset.type = 'server_dir'
uploaded_dataset.name = file
uploaded_dataset.ext = None
uploaded_dataset.file_type = params.file_type
uploaded_dataset.dbkey = params.dbkey
uploaded_dataset.space_to_tab = params.space_to_tab
uploaded_dataset.data = upload_common.new_upload( trans, uploaded_dataset, library_bunch )
uploaded_datasets.append( uploaded_dataset )
return uploaded_datasets
@web.expose
def info_template( self, trans, cntrller, library_id, response_action='library', obj_id=None, folder_id=None, ldda_id=None, **kwd ):
# Only adding a new templAte to a library or folder is currently allowed. Editing an existing template is
# a future enhancement. The response_action param is the name of the method to which this method will redirect
# if a new template is being added to a library or folder.
params = util.Params( kwd )
msg = util.restore_text( params.get( 'msg', '' ) )
messagetype = params.get( 'messagetype', 'done' )
if obj_id:
library_item = trans.app.model.FormDefinition.get( int( obj_id ) )
library_item_desc = 'information template'
response_id = obj_id
elif folder_id:
library_item = trans.app.model.LibraryFolder.get( int( folder_id ) )
library_item_desc = 'folder'
response_id = folder_id
elif ldda_id:
library_item = trans.app.model.LibraryDatasetDatasetAssociation.get( int( ldda_id ) )
library_item_desc = 'library dataset'
response_id = ldda_id
else:
library_item = trans.app.model.Library.get( int( library_id ) )
library_item_desc = 'library'
response_id = library_id
forms = get_all_forms( trans,
filter=dict( deleted=False ),
form_type=trans.app.model.FormDefinition.types.LIBRARY_INFO_TEMPLATE )
if not forms:
msg = "There are no forms on which to base the template, so create a form and "
msg += "try again to add the information template to the %s." % library_item_desc
trans.response.send_redirect( web.url_for( controller='forms',
action='new',
new=True,
msg=msg,
messagetype='done' ) )
if params.get( 'add_info_template_button', False ):
form = trans.app.model.FormDefinition.get( int( kwd[ 'form_id' ] ) )
#fields = list( copy.deepcopy( form.fields ) )
form_values = trans.app.model.FormValues( form, [] )
form_values.flush()
if folder_id:
assoc = trans.app.model.LibraryFolderInfoAssociation( library_item, form, form_values )
elif ldda_id:
assoc = trans.app.model.LibraryDatasetDatasetInfoAssociation( library_item, form, form_values )
else:
assoc = trans.app.model.LibraryInfoAssociation( library_item, form, form_values )
assoc.flush()
msg = 'An information template based on the form "%s" has been added to this %s.' % ( form.name, library_item_desc )
trans.response.send_redirect( web.url_for( controller=cntrller,
action=response_action,
obj_id=response_id,
msg=msg,
message_type='done' ) )
# TODO: handle this better
if cntrller == 'library_admin':
tmplt = '/admin/library/select_info_template.mako'
else:
tmplt = '/ibrary/select_info_template.mako'
return trans.fill_template( tmplt,
library_item_name=library_item.name,
library_item_desc=library_item_desc,
library_id=library_id,
folder_id=folder_id,
ldda_id=ldda_id,
forms=forms,
msg=msg,
messagetype=messagetype )
@web.expose
def edit_template_info( self, trans, cntrller, library_id, response_action, num_widgets, library_item_id=None, library_item_type=None, **kwd ):
params = util.Params( kwd )
msg = util.restore_text( params.get( 'msg', '' ) )
messagetype = params.get( 'messagetype', 'done' )
folder_id = None
if library_item_type == 'library':
library_item = trans.app.model.Library.get( library_item_id )
elif library_item_type == 'library_dataset':
library_item = trans.app.model.LibraryDataset.get( library_item_id )
elif library_item_type == 'folder':
library_item = trans.app.model.LibraryFolder.get( library_item_id )
elif library_item_type == 'library_dataset_dataset_association':
library_item = trans.app.model.LibraryDatasetDatasetAssociation.get( library_item_id )
# This response_action method requires a folder_id
folder_id = library_item.library_dataset.folder.id
else:
msg = "Invalid library item type ( %s ) specified, id ( %s )" % ( str( library_item_type ), str( library_item_id ) )
return trans.response.send_redirect( web.url_for( controller=cntrller,
action='browse_library',
obj_id=library_id,
msg=util.sanitize_text( msg ),
messagetype='error' ) )
# Save updated template field contents
field_contents = []
for index in range( int( num_widgets ) ):
field_contents.append( util.restore_text( params.get( 'field_%i' % ( index ), '' ) ) )
if field_contents:
# Since information templates are inherited, the template fields can be displayed on the information
# page for a folder or library dataset when it has no info_association object. If the user has added
# field contents on an inherited template via a parent's info_association, we'll need to create a new
# form_values and info_association for the current object. The value for the returned inherited variable
# is not applicable at this level.
info_association, inherited = library_item.get_info_association( restrict=True )
if info_association:
template = info_association.template
info = info_association.info
form_values = trans.app.model.FormValues.get( info.id )
# Update existing content only if it has changed
if form_values.content != field_contents:
form_values.content = field_contents
form_values.flush()
else:
# Inherit the next available info_association so we can get the template
info_association, inherited = library_item.get_info_association()
template = info_association.template
# Create a new FormValues object
form_values = trans.app.model.FormValues( template, field_contents )
form_values.flush()
# Create a new info_association between the current library item and form_values
if library_item_type == 'folder':
info_association = trans.app.model.LibraryFolderInfoAssociation( library_item, template, form_values )
info_association.flush()
elif library_item_type == 'library_dataset_dataset_association':
info_association = trans.app.model.LibraryDatasetDatasetInfoAssociation( library_item, template, form_values )
info_association.flush()
msg = 'The information has been updated.'
return trans.response.send_redirect( web.url_for( controller=cntrller,
action=response_action,
library_id=library_id,
folder_id=folder_id,
obj_id=library_item.id,
msg=util.sanitize_text( msg ),
messagetype='done' ) )
# ---- Utility methods -------------------------------------------------------
def active_folders( trans, folder ):
# Much faster way of retrieving all active sub-folders within a given folder than the
# performance of the mapper. This query also eagerloads the permissions on each folder.
return trans.sa_session.query( trans.app.model.LibraryFolder ) \
.filter_by( parent=folder, deleted=False ) \
.options( eagerload_all( "actions" ) ) \
.order_by( trans.app.model.LibraryFolder.table.c.name ) \
.all()
def activatable_folders( trans, folder ):
return trans.sa_session.query( trans.app.model.LibraryFolder ) \
.filter_by( parent=folder, purged=False ) \
.options( eagerload_all( "actions" ) ) \
.order_by( trans.app.model.LibraryFolder.table.c.name ) \
.all()
def active_folders_and_lddas( trans, folder ):
folders = active_folders( trans, folder )
# This query is much faster than the folder.active_library_datasets property
lddas = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ) \
.filter_by( deleted=False ) \
.join( "library_dataset" ) \
.filter( trans.app.model.LibraryDataset.table.c.folder_id==folder.id ) \
.order_by( trans.app.model.LibraryDatasetDatasetAssociation.table.c.name ) \
.all()
return folders, lddas
def activatable_folders_and_lddas( trans, folder ):
folders = activatable_folders( trans, folder )
# This query is much faster than the folder.activatable_library_datasets property
lddas = trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ) \
.join( "library_dataset" ) \
.filter( trans.app.model.LibraryDataset.table.c.folder_id==folder.id ) \
.join( "dataset" ) \
.filter( trans.app.model.Dataset.table.c.deleted==False ) \
.order_by( trans.app.model.LibraryDatasetDatasetAssociation.table.c.name ) \
.all()
return folders, lddas
@@ -1,129 +0,0 @@
import os, os.path, shutil, urllib, StringIO, re, gzip, tempfile, shutil, zipfile
from galaxy.web.base.controller import *
from galaxy import util, jobs
from galaxy.datatypes import sniff
from galaxy.security import RBACAgent
from galaxy.util.json import to_json_string
from galaxy.tools.actions import upload_common
log = logging.getLogger( __name__ )
class UploadLibraryDataset( BaseController ):
@web.json
def library_item_updates( self, trans, ids=None, states=None ):
# Avoid caching
trans.response.headers['Pragma'] = 'no-cache'
trans.response.headers['Expires'] = '0'
# Create new HTML for any that have changed
rval = {}
if ids is not None and states is not None:
ids = map( int, ids.split( "," ) )
states = states.split( "," )
for id, state in zip( ids, states ):
data = self.app.model.LibraryDatasetDatasetAssociation.get( id )
if data.state != state:
job_ldda = data
while job_ldda.copied_from_library_dataset_dataset_association:
job_ldda = job_ldda.copied_from_library_dataset_dataset_association
force_history_refresh = False
rval[id] = {
"state": data.state,
"html": unicode( trans.fill_template( "library/library_item_info.mako", ldda=data ), 'utf-8' )
#"force_history_refresh": force_history_refresh
}
return rval
def upload_dataset( self, trans, controller, library_id, folder_id, replace_dataset=None, **kwd ):
# Set up the traditional tool state/params
tool_id = 'upload1'
tool = trans.app.toolbox.tools_by_id[ tool_id ]
state = tool.new_state( trans )
errors = tool.update_state( trans, tool.inputs_by_page[0], state.inputs, kwd, changed_dependencies={} )
tool_params = state.inputs
dataset_upload_inputs = []
for input_name, input in tool.inputs.iteritems():
if input.type == "upload_dataset":
dataset_upload_inputs.append( input )
# Library-specific params
params = util.Params( kwd ) # is this filetoolparam safe?
library_bunch = upload_common.handle_library_params( trans, params, folder_id, replace_dataset )
msg = util.restore_text( params.get( 'msg', '' ) )
messagetype = params.get( 'messagetype', 'done' )
server_dir = util.restore_text( params.get( 'server_dir', '' ) )
if replace_dataset not in [ None, 'None' ]:
replace_id = replace_dataset.id
else:
replace_id = None
upload_option = params.get( 'upload_option', 'upload_file' )
err_redirect = False
if upload_option == 'upload_directory':
if server_dir in [ None, 'None', '' ]:
err_redirect = True
if controller == 'library_admin':
import_dir = trans.app.config.library_import_dir
import_dir_desc = 'library_import_dir'
full_dir = os.path.join( import_dir, server_dir )
else:
import_dir = trans.app.config.user_library_import_dir
import_dir_desc = 'user_library_import_dir'
if server_dir == trans.user.email:
full_dir = os.path.join( import_dir, server_dir )
else:
full_dir = os.path.join( import_dir, trans.user.email, server_dir )
if import_dir:
msg = 'Select a directory'
else:
msg = '"%s" is not defined in the Galaxy configuration file' % import_dir_desc
# Proceed with (mostly) regular upload processing
precreated_datasets = upload_common.get_precreated_datasets( trans, tool_params, trans.app.model.LibraryDatasetDatasetAssociation, controller=controller )
if upload_option == 'upload_file':
tool_params = upload_common.persist_uploads( tool_params )
uploaded_datasets = upload_common.get_uploaded_datasets( trans, tool_params, precreated_datasets, dataset_upload_inputs, library_bunch=library_bunch )
elif upload_option == 'upload_directory':
uploaded_datasets = self.get_server_dir_uploaded_datasets( trans, params, full_dir, import_dir_desc, library_bunch, err_redirect, msg )
upload_common.cleanup_unused_precreated_datasets( precreated_datasets )
if upload_option == 'upload_file' and not uploaded_datasets:
msg = 'Select a file, enter a URL or enter text'
err_redirect = True
if err_redirect:
trans.response.send_redirect( web.url_for( controller=controller,
action='library_dataset_dataset_association',
library_id=library_id,
folder_id=folder_id,
replace_id=replace_id,
upload_option=upload_option,
msg=util.sanitize_text( msg ),
messagetype='error' ) )
json_file_path = upload_common.create_paramfile( uploaded_datasets )
data_list = [ ud.data for ud in uploaded_datasets ]
return upload_common.create_job( trans, tool_params, tool, json_file_path, data_list, folder=library_bunch.folder )
def get_server_dir_uploaded_datasets( self, trans, params, full_dir, import_dir_desc, library_bunch, err_redirect, msg ):
files = []
try:
for entry in os.listdir( full_dir ):
# Only import regular files
if os.path.isfile( os.path.join( full_dir, entry ) ):
files.append( entry )
except Exception, e:
msg = "Unable to get file list for configured %s, error: %s" % ( import_dir_desc, str( e ) )
err_redirect = True
return None
if not files:
msg = "The directory '%s' contains no valid files" % full_dir
err_redirect = True
return None
uploaded_datasets = []
for file in files:
library_bunch.replace_dataset = None
uploaded_dataset = util.bunch.Bunch()
uploaded_dataset.path = os.path.join( full_dir, file )
if not os.path.isfile( uploaded_dataset.path ):
continue
uploaded_dataset.type = 'server_dir'
uploaded_dataset.name = file
uploaded_dataset.ext = None
uploaded_dataset.file_type = params.file_type
uploaded_dataset.dbkey = params.dbkey
uploaded_dataset.space_to_tab = params.space_to_tab
uploaded_dataset.data = upload_common.new_upload( trans, uploaded_dataset, library_bunch )
uploaded_datasets.append( uploaded_dataset )
return uploaded_datasets
+1 -1
View File
@@ -37,7 +37,7 @@
users (a library item is one of: a data library, a library folder, a library dataset).
<p/>
<ul>
<li><strong>add library item</strong> - Role members can add library items to this library or folder</li>
<li><strong>add library item</strong> - Role members can add library items to this data library or folder</li>
<li><strong>modify library item</strong> - Role members can modify this library item</li>
<li><strong>manage library permissions</strong> - Role members can manage permissions applied to this library item</li>
</ul>
@@ -42,7 +42,7 @@
<tbody>
%for library in libraries:
<tr class="libraryRow libraryOrFolderRow" id="libraryRow">
<td><a href="${h.url_for( controller='library_admin', action='browse_library', id=library.id, deleted=deleted, show_deleted=show_deleted )}">${library.name}</a></td>
<td><a href="${h.url_for( controller='library_admin', action='browse_library', obj_id=library.id, deleted=deleted, show_deleted=show_deleted )}">${library.name}</a></td>
<td><i>${library.description}</i></td>
</tr>
%endfor
+19 -21
View File
@@ -4,7 +4,7 @@
<%
from time import strftime
from galaxy import util
from galaxy.web.controllers.library import active_folders_and_lddas, activatable_folders_and_lddas
from galaxy.web.controllers.library_common import active_folders_and_lddas, activatable_folders_and_lddas
%>
<%def name="stylesheets()">
@@ -128,18 +128,16 @@
<input type="checkbox" name="ldda_ids" value="${ldda.id}"/>
%endif
<span class="libraryItemDeleted-${ldda.deleted}">
<a href="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, info=True, deleted=deleted, show_deleted=show_deleted )}"><b>${ldda.name[:50]}</b></a>
<a href="${h.url_for( controller='library_admin', action='ldda_display_info', library_id=library.id, folder_id=folder.id, obj_id=ldda.id, 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;">&#9660;</a>
%if not library.deleted and not folder.deleted and not library_dataset.deleted:
<div popupmenu="dataset-${ldda.id}-popup">
<a class="action-button" href="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library.id, folder_id=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='library_admin', action='info_template', library_id=library.id, library_dataset_id=library_dataset.id, new_template=True )}">Add an information template to this dataset</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, permissions=True )}">Edit this dataset's permissions</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, replace_id=library_dataset.id )}">Upload a new version of this dataset</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='ldda_edit_info', library_id=library.id, folder_id=folder.id, obj_id=ldda.id )}">Edit this dataset's information</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='ldda_manage_permissions', library_id=library.id, folder_id=folder.id, obj_id=ldda.id, permissions=True )}">Edit this dataset's permissions</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='upload_library_dataset', library_id=library.id, folder_id=folder.id, replace_id=library_dataset.id )}">Upload a new version of this dataset</a>
%if ldda.has_data:
<a class="action-button" href="${h.url_for( controller='library_admin', action='download_dataset_from_folder', id=ldda.id, library_id=library.id )}">Download this dataset</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='download_dataset_from_folder', obj_id=ldda.id, library_id=library.id )}">Download this dataset</a>
%endif
<a class="action-button" confirm="Click OK to delete dataset '${ldda.name}'." href="${h.url_for( controller='library_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>
@@ -186,18 +184,18 @@
%endif
%if not folder.deleted:
<div popupmenu="folder-${folder.id}-popup">
<a class="action-button" href="${h.url_for( controller='library_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='library_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='library_admin', action='folder', information=True, id=folder.id, library_id=library_id )}">Edit this folder's information</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='upload_library_dataset', library_id=library_id, folder_id=folder.id )}">Add datasets to this folder</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='folder', new=True, obj_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='library_admin', action='folder', information=True, obj_id=folder.id, library_id=library_id )}">Edit this folder's information</a>
## Editing templates disabled until we determine optimal approach to re-linking library item to new version of form definition
##%if folder.info_association:
## <% form_id = folder.info_association[0].template.id %>
## <a class="action-button" href="${h.url_for( controller='forms', action='edit', form_id=form_id, show_form=True )}">Edit this folder's information template</a>
##%else:
%if not folder.info_association:
<a class="action-button" href="${h.url_for( controller='library_admin', action='info_template', library_id=library.id, folder_id=folder.id, add=True )}">Add an information template to this folder</a>
<a class="action-button" href="${h.url_for( controller='library_common', action='info_template', cntrller='library_admin', library_id=library.id, response_action='folder', folder_id=folder.id )}">Add an information template to this folder</a>
%endif
<a class="action-button" href="${h.url_for( controller='library_admin', action='folder', permissions=True, id=folder.id, library_id=library_id )}">Edit this folder's permissions</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='folder', permissions=True, obj_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='library_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>
%elif not deleted and folder.deleted and not folder.purged:
@@ -246,10 +244,10 @@
<ul class="manage-table-actions">
%if not deleted:
<li>
<a class="action-button" href="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library.id, folder_id=library.root_folder.id )}"><span>Add datasets to this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='upload_library_dataset', library_id=library.id, folder_id=library.root_folder.id )}"><span>Add datasets to this data library</span></a>
</li>
<li>
<a class="action-button" href="${h.url_for( controller='library_admin', action='folder', new=True, id=library.root_folder.id, library_id=library.id )}">Add a folder to this data library</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='folder', new=True, obj_id=library.root_folder.id, library_id=library.id )}">Add a folder to this data library</a>
</li>
%endif
</ul>
@@ -274,21 +272,21 @@
<a id="library-${library.id}-popup" class="popup-arrow" style="display: none;">&#9660;</a>
<div popupmenu="library-${library.id}-popup">
%if not deleted:
<a class="action-button" href="${h.url_for( controller='library_admin', action='library', id=library.id, information=True )}">Edit this data library's information</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='library', obj_id=library.id, information=True )}">Edit this data library's information</a>
## Editing templates disabled until we determine optimal approach to re-linking library item to new version of form definition
##%if library.info_association:
## <% form_id = library.info_association[0].template.id %>
## <a class="action-button" href="${h.url_for( controller='forms', action='edit', form_id=form_id, show_form=True )}">Edit this data library's information template</a>
##%else:
%if not library.info_association:
<a class="action-button" href="${h.url_for( controller='library_admin', action='info_template', library_id=library.id, add=True )}">Add an information template to this data library</a>
<a class="action-button" href="${h.url_for( controller='library_common', action='info_template', cntrller='library_admin', library_id=library.id, response_action='browse_library' )}">Add an information template to this data library</a>
%endif
<a class="action-button" href="${h.url_for( controller='library_admin', action='library', id=library.id, permissions=True )}">Edit this data library's permissions</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='library', obj_id=library.id, permissions=True )}">Edit this data library's permissions</a>
<a class="action-button" confirm="Click OK to delete the library named '${library.name}'." href="${h.url_for( controller='library_admin', action='delete_library_item', library_id=library.id, library_item_id=library.id, library_item_type='library' )}">Delete this data library and its contents</a>
%if show_deleted:
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', id=library.id, show_deleted=False )}">Hide deleted data library items</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', obj_id=library.id, show_deleted=False )}">Hide deleted data library items</a>
%else:
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', id=library.id, show_deleted=True )}">Show deleted data library items</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', obj_id=library.id, show_deleted=True )}">Show deleted data library items</a>
%endif
%elif not library.purged:
<a class="action-button" href="${h.url_for( controller='library_admin', action='undelete_library_item', library_id=library.id, library_item_id=library.id, library_item_type='library' )}">Undelete this data library</a>
@@ -310,7 +308,7 @@
<p>
<b>Perform action on selected datasets:</b>
<select name="action" id="action_on_datasets_select">
<option value="edit">Edit selected datasets' permissions</option>
<option value="manage_permissions">Edit selected datasets' permissions</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"/>
+2 -2
View File
@@ -1,5 +1,5 @@
<%def name="render_template_info( library_item, library_id, widgets, editable=True )">
<%def name="render_template_info( library_item, library_id, response_action, widgets, editable=True )">
<%
library_item_type = 'unknown type'
library_item_desc = ''
@@ -22,7 +22,7 @@
<div class="toolFormTitle">Other information about ${library_item_desc} ${library_item.name}</div>
<div class="toolFormBody">
%if editable:
<form name="edit_info" action="${h.url_for( controller='library_admin', action='edit_template_info', library_id=library_id, num_widgets=len( widgets ) )}" method="post">
<form name="edit_info" action="${h.url_for( controller='library_common', action='edit_template_info', cntrller='library_admin', library_id=library_id, response_action=response_action, num_widgets=len( widgets ) )}" method="post">
<input type="hidden" name="library_item_id" value="${library_item.id}"/>
<input type="hidden" name="library_item_type" value="${library_item_type}"/>
%for i, field in enumerate( widgets ):
+3 -3
View File
@@ -5,7 +5,7 @@
<br/><br/>
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -16,7 +16,7 @@
<div class="toolForm">
<div class="toolFormTitle">Edit folder name and description</div>
<div class="toolFormBody">
<form name="folder" action="${h.url_for( controller='library_admin', action='folder', information=True, id=folder.id, library_id=library_id )}" method="post" >
<form name="folder" action="${h.url_for( controller='library_admin', action='folder', information=True, obj_id=folder.id, library_id=library_id )}" method="post" >
<div class="form-row">
<label>Name:</label>
<input type="text" name="name" value="${folder.name}" size="40"/>
@@ -35,5 +35,5 @@
</div>
%if widgets:
${render_template_info( folder, library_id, widgets )}
${render_template_info( folder, library_id, 'folder', widgets )}
%endif
@@ -5,7 +5,7 @@
<br/><br/>
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -17,4 +17,4 @@
roles = trans.app.model.Role.filter( trans.app.model.Role.table.c.deleted==False ).order_by( trans.app.model.Role.table.c.name ).all()
%>
${render_permission_form( folder, folder.name, h.url_for( controller='library_admin', action='folder', id=folder.id, library_id=library_id, permissions=True ), roles )}
${render_permission_form( folder, folder.name, h.url_for( controller='library_admin', action='folder', obj_id=folder.id, library_id=library_id, permissions=True ), roles )}
+11 -11
View File
@@ -12,7 +12,7 @@
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -20,9 +20,9 @@
${render_msg( msg, messagetype )}
%endif
<%def name="datatype( ldda, datatypes )">
<%def name="datatype( ldda, file_formats )">
<select name="datatype">
%for ext in datatypes:
%for ext in file_formats:
%if ldda.ext == ext:
<option value="${ext}" selected="yes">${ext}</option>
%else:
@@ -35,8 +35,8 @@
<div class="toolForm">
<div class="toolFormTitle">Edit attributes of ${ldda.name}</div>
<div class="toolFormBody">
<form name="edit_attributes" action="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, edit_info=True )}" method="post">
<input type="hidden" name="id" value="${ldda.id}"/>
<form name="edit_attributes" action="${h.url_for( controller='library_admin', action='ldda_edit_info', library_id=library_id, folder_id=ldda.library_dataset.folder.id )}" method="post">
<input type="hidden" name="obj_id" value="${ldda.id}"/>
<br/>
<div class="form-row">
<label>Name:</label>
@@ -73,9 +73,9 @@
<input type="submit" name="save" value="Save"/>
</div>
</form>
<form name="auto_detect" action="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, edit_info=True )}" method="post">
<form name="auto_detect" action="${h.url_for( controller='library_admin', action='ldda_edit_info', library_id=library_id, folder_id=ldda.library_dataset.folder.id )}" method="post">
<div class="form-row">
<input type="hidden" name="id" value="${ldda.id}"/>
<input type="hidden" name="obj_id" value="${ldda.id}"/>
<input type="submit" name="detect" value="Auto-detect"/>
<div class="toolParamHelp" style="clear: both;">
This will inspect the dataset and attempt to correct the above column values if they are not accurate.
@@ -89,11 +89,11 @@
<div class="toolFormTitle">Change data type of ${ldda.name}</div>
<div class="toolFormBody">
%if ldda.datatype.allow_datatype_change:
<form name="change_datatype" action="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, edit_info=True )}" method="post">
<input type="hidden" name="id" value="${ldda.id}"/>
<form name="change_datatype" action="${h.url_for( controller='library_admin', action='ldda_edit_info', library_id=library_id, folder_id=ldda.library_dataset.folder.id )}" method="post">
<input type="hidden" name="obj_id" value="${ldda.id}"/>
<div class="form-row">
<label>New Type:</label>
${datatype( ldda, datatypes )}
${datatype( ldda, file_formats )}
<div class="toolParamHelp" style="clear: both;">
This will change the datatype of the existing dataset
but <i>not</i> modify its contents. Use this if Galaxy
@@ -114,5 +114,5 @@
</div>
%if widgets:
${render_template_info( ldda, library_id, widgets )}
${render_template_info( ldda, library_id, 'ldda_edit_info', widgets )}
%endif
+9 -11
View File
@@ -20,7 +20,7 @@
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', id=library_id, deleted=library.deleted, show_deleted=show_deleted )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', obj_id=library_id, deleted=library.deleted, show_deleted=show_deleted )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -41,18 +41,16 @@
%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;">&#9660;</a>
<div popupmenu="dataset-${ldda.id}-popup">
<a class="action-button" href="${h.url_for( controller='library_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='library_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='library_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>
<a class="action-button" href="${h.url_for( controller='library_admin', action='ldda_edit_info', library_id=library_id, folder_id=ldda.library_dataset.folder.id, obj_id=ldda.id )}">Edit this dataset's information</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='ldda_manage_permissions', library_id=library_id, folder_id=ldda.library_dataset.folder.id, obj_id=ldda.id )}">Edit this dataset's permissions</a>
%if current_version:
<a class="action-button" href="${h.url_for( controller='library_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>
<a class="action-button" href="${h.url_for( controller='library_admin', action='upload_library_dataset', 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='library_admin', action='download_dataset_from_folder', id=ldda.id, library_id=library_id )}">Download this dataset</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='download_dataset_from_folder', obj_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='library_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>
%if not library.deleted and not ldda.library_dataset.folder.deleted and not ldda.library_dataset.deleted:
<a class="action-button" confirm="Click OK to remove dataset '${ldda.name}'?" href="${h.url_for( controller='library_admin', action='delete_library_item', library_id=library_id, folder_id=ldda.library_dataset.folder.id, library_item_id=ldda.library_dataset.id, library_item_type='library_dataset' )}">Delete this dataset</a>
%endif
</div>
%endif
@@ -96,7 +94,7 @@
%endif
</div>
%if widgets:
${render_template_info( ldda, library.id, widgets, editable=False )}
${render_template_info( ldda, library.id, 'ldda_display_info', widgets, editable=False )}
%endif
%if current_version:
<% expired_lddas = [ e_ldda for e_ldda in ldda.library_dataset.expired_datasets ] %>
@@ -104,7 +102,7 @@
<div class="toolFormTitle">Expired versions of ${ldda.name}</div>
%for expired_ldda in expired_lddas:
<div class="form-row">
<a href="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=expired_ldda.library_dataset.folder.id, id=expired_ldda.id, info=True )}">${expired_ldda.name}</a>
<a href="${h.url_for( controller='library_admin', action='ldda_display_info', library_id=library_id, folder_id=expired_ldda.library_dataset.folder.id, obj_id=expired_ldda.id )}">${expired_ldda.name}</a>
</div>
%endfor
%endif
@@ -5,17 +5,17 @@
<%
roles = trans.app.model.Role.filter( trans.app.model.Role.table.c.deleted==False ).order_by( trans.app.model.Role.table.c.name ).all()
lddas = util.listify( ldda )
if len( lddas ) > 1:
name_str = '%d selected datasets' % len( lddas )
else:
ldda = lddas[0]
name_str = ldda.name
%>
<br/><br/>
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -35,7 +35,7 @@
<a id="ldda-${ldd_assoc.id}-popup" class="popup-arrow" style="display: none;">&#9660;</a>
</div>
<div popupmenu="ldd_assoc-${ldd_assoc.id}-popup">
<a class="action-button" href="${h.url_for( controller='library_admin', action='library_dataset', id=ldd_assoc.library_dataset_id, library_id=library_id )}">Manage this dataset's versions</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='library_dataset', obj_id=ldd_assoc.library_dataset_id, library_id=library_id )}">Manage this dataset's versions</a>
</div>
</td>
<td>
@@ -59,4 +59,4 @@
%endif
<% ldda_ids = ",".join( [ str( d.id ) for d in lddas ] ) %>
${render_permission_form( lddas[0], name_str, h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=lddas[0].library_dataset.folder.id, id=ldda_ids, permissions=True ), roles )}
${render_permission_form( lddas[0], name_str, h.url_for( controller='library_admin', action='ldda_manage_permissions', library_id=library_id, folder_id=lddas[0].library_dataset.folder.id, obj_id=ldda_ids ), roles )}
@@ -11,7 +11,7 @@
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -23,7 +23,7 @@
<div class="toolFormTitle">Edit attributes of ${library_dataset.name}</div>
<div class="toolFormBody">
<form name="edit_attributes" action="${h.url_for( controller='library_admin', action='library_dataset' )}" method="post">
<input type="hidden" name="id" value="${library_dataset.id}"/>
<input type="hidden" name="obj_id" value="${library_dataset.id}"/>
<div class="form-row">
<label>Name:</label>
<div style="float: left; width: 250px; margin-right: 10px;">
@@ -46,5 +46,5 @@
</div>
%if widgets:
${render_template_info( library_dataset, library.id, widgets )}
${render_template_info( library_dataset, library.id, '', widgets )}
%endif
@@ -11,7 +11,7 @@
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -23,4 +23,4 @@
roles = trans.app.model.Role.filter( trans.app.model.Role.table.c.deleted==False ).order_by( trans.app.model.Role.table.c.name ).all()
%>
${render_permission_form( library_dataset, library_dataset.name, h.url_for( controller='library_admin', action='library_dataset', id=library_dataset.id, library_id=library_id, permissions=True ), roles )}
${render_permission_form( library_dataset, library_dataset.name, h.url_for( controller='library_admin', action='library_dataset', obj_id=library_dataset.id, library_id=library_id, permissions=True ), roles )}
+3 -3
View File
@@ -5,7 +5,7 @@
<br/><br/>
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', id=library.id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', obj_id=library.id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -16,7 +16,7 @@
<div class="toolForm">
<div class="toolFormTitle">Change library name and description</div>
<div class="toolFormBody">
<form name="library" action="${h.url_for( controller='library_admin', action='library', information=True, id=library.id )}" method="post" >
<form name="library" action="${h.url_for( controller='library_admin', action='library', information=True, obj_id=library.id )}" method="post" >
<div class="form-row">
<label>Name:</label>
<div style="float: left; width: 250px; margin-right: 10px;">
@@ -44,5 +44,5 @@
%>
%if widgets:
${render_template_info( library, library.id, widgets )}
${render_template_info( library, library.id, 'library', widgets )}
%endif
@@ -5,7 +5,7 @@
<br/><br/>
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', id=library.id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', obj_id=library.id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -16,4 +16,4 @@
<%
roles = trans.app.model.Role.filter( trans.app.model.Role.table.c.deleted==False ).order_by( trans.app.model.Role.table.c.name ).all()
%>
${render_permission_form( library, library.name, h.url_for( conroller='admin', action='library', id=library.id, permissions=True ), roles )}
${render_permission_form( library, library.name, h.url_for( conroller='admin', action='library', obj_id=library.id, permissions=True ), roles )}
+2 -2
View File
@@ -4,7 +4,7 @@
<br/<br/>
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -15,7 +15,7 @@
<div class="toolForm">
<div class="toolFormTitle">Create a new folder</div>
<div class="toolFormBody">
<form name="folder" action="${h.url_for( controller='library_admin', action='folder', id=folder.id, library_id=library_id )}" method="post" >
<form name="folder" action="${h.url_for( controller='library_admin', action='folder', obj_id=folder.id, library_id=library_id )}" method="post" >
<div class="form-row">
<label>Name:</label>
<div style="float: left; width: 250px; margin-right: 10px;">
@@ -4,7 +4,7 @@
<br/><br/>
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -14,16 +14,19 @@
<div class="toolForm">
<div class="toolFormTitle">Select a form on which to base the template for the ${library_item_desc} '${library_item_name}'</div>
<form name="new_info_template" action="${h.url_for( controller='library_admin', action='info_template', add=True )}" method="post" >
<form name="new_info_template" action="${h.url_for( controller='library_common', action='info_template', cntrller='library_admin' )}" method="post" >
<div class="toolFormBody">
<div class="form-row">
<input type="hidden" name="library_id" value="${library_id}"/>
%if library_dataset_id:
<input type="hidden" name="library_dataset_id" value="${library_dataset_id}"/>
<input type="hidden" name="response_action" value="ldda_edit_info"/>
%elif folder_id:
<input type="hidden" name="folder_id" value="${folder_id}"/>
<input type="hidden" name="response_action" value="folder"/>
%elif ldda_id:
<input type="hidden" name="ldda_id" value="${ldda_id}"/>
<input type="hidden" name="response_action" value="ldda_edit_info"/>
%endif
<label>Template:</label>
<select name="form_id">
+5 -6
View File
@@ -1,6 +1,5 @@
<%inherit file="/base.mako"/>
<%namespace file="/message.mako" import="render_msg" />
<%namespace file="/admin/library/common.mako" import="render_template_info" />
<%namespace file="/library/library_dataset_common.mako" import="render_upload_form" />
<% import os, os.path %>
@@ -15,16 +14,16 @@
<b>Create new data library datasets</b>
<a id="upload-librarydataset--popup" class="popup-arrow" style="display: none;">&#9660;</a>
<div popupmenu="upload-librarydataset--popup">
<a class="action-button" href="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=folder_id, replace_id=replace_id, upload_option='upload_file' )}">Upload files</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='upload_library_dataset', library_id=library_id, folder_id=folder_id, replace_id=replace_id, upload_option='upload_file' )}">Upload files</a>
%if trans.app.config.library_import_dir and os.path.exists( trans.app.config.library_import_dir ):
<a class="action-button" href="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=folder_id, replace_id=replace_id, upload_option='upload_directory' )}">Upload directory of files</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='upload_library_dataset', library_id=library_id, folder_id=folder_id, replace_id=replace_id, upload_option='upload_directory' )}">Upload directory of files</a>
%endif
<a class="action-button" href="${h.url_for( controller='library_admin', action='library_dataset_dataset_association', library_id=library_id, folder_id=folder_id, replace_id=replace_id, upload_option='import_from_history' )}">Import datasets from your current history</a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='upload_library_dataset', library_id=library_id, folder_id=folder_id, replace_id=replace_id, upload_option='import_from_history' )}">Import datasets from your current history</a>
</div>
<br/><br/>
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library_admin', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -32,4 +31,4 @@
${render_msg( msg, messagetype )}
%endif
${render_upload_form( 'library_admin', upload_option, action, library_id, folder_id, replace_dataset, file_formats, dbkeys, roles, history, )}
${render_upload_form( 'library_admin', upload_option, action, library_id, folder_id, replace_dataset, file_formats, dbkeys, roles, history )}
+1 -1
View File
@@ -102,7 +102,7 @@
<i>None</i>
%else:
%if rd['label'] == 'Data library':
<a href="${h.url_for( controller='library_admin', action='browse_library', id=request.library.id )}">${rd['value']}</a>
<a href="${h.url_for( controller='library_admin', action='browse_library', obj_id=request.library.id )}">${rd['value']}</a>
%else:
${rd['value']}
%endif
+2 -2
View File
@@ -114,9 +114,9 @@
if ( $(this).find("input[name='folder_id']").val() != undefined ) {
var library_id = $(this).find("input[name='library_id']").val();
if ( location.pathname.indexOf( 'library_admin' ) ) {
$("iframe#galaxy_main").attr("src","${h.url_for(controller='library_admin', action='browse_library' )}?id=" + library_id + "&created_ldda_ids=" + async_datasets);
$("iframe#galaxy_main").attr("src","${h.url_for( controller='library_admin', action='browse_library' )}?obj_id=" + library_id + "&created_ldda_ids=" + async_datasets);
} else {
$("iframe#galaxy_main").attr("src","${h.url_for(controller='library', action='browse_library' )}?id=" + library_id + "&created_ldda_ids=" + async_datasets);
$("iframe#galaxy_main").attr("src","${h.url_for( controller='library', action='browse_library' )}?obj_id=" + library_id + "&created_ldda_ids=" + async_datasets);
}
} else {
$("iframe#galaxy_main").attr("src","${h.url_for(controller='tool_runner', action='upload_async_message')}");
+1 -1
View File
@@ -22,7 +22,7 @@
<tbody>
%for library, hidden_folder_ids in libraries.items():
<tr class="libraryRow libraryOrFolderRow" id="libraryRow">
<td><a href="${h.url_for( controller='library', action='browse_library', id=library.id, hidden_folder_ids=hidden_folder_ids )}">${library.name}</a></td>
<td><a href="${h.url_for( controller='library', action='browse_library', obj_id=library.id, hidden_folder_ids=hidden_folder_ids )}">${library.name}</a></td>
<td><i>${library.description}</i></td>
</tr>
%endfor
+19 -19
View File
@@ -3,7 +3,7 @@
<%namespace file="/library/library_item_info.mako" import="render_library_item_info" />
<%
from galaxy import util
from galaxy.web.controllers.library import active_folders
from galaxy.web.controllers.library_common import active_folders
from time import strftime
user, roles = trans.get_user_and_roles()
%>
@@ -162,23 +162,23 @@ class RowCounter( object ):
%else:
<input type="checkbox" name="ldda_ids" value="${ldda.id}"/>
%endif
<a href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, info=True )}"><b>${ldda.name[:60]}</b></a>
<a href="${h.url_for( controller='library', action='ldda_display_info', library_id=library.id, folder_id=folder.id, obj_id=ldda.id )}"><b>${ldda.name[:50]}</b></a>
<a id="dataset-${ldda.id}-popup" class="popup-arrow" style="display: none;">&#9660;</a>
<div popupmenu="dataset-${ldda.id}-popup">
%if can_modify_library_dataset:
<a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, edit_info=True )}">Edit this dataset's information</a>
<a class="action-button" href="${h.url_for( controller='library', action='ldda_edit_info', library_id=library.id, folder_id=folder.id, obj_id=ldda.id )}">Edit this dataset's information</a>
%else:
<a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, information=True )}">View this dataset's information</a>
<a class="action-button" href="${h.url_for( controller='library', action='ldda_display_info', library_id=library.id, folder_id=folder.id, obj_id=ldda.id, information=True )}">View this dataset's information</a>
%endif
%if can_manage_library_dataset:
<a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, id=ldda.id, permissions=True )}">Edit this dataset's permissions</a>
<a class="action-button" href="${h.url_for( controller='library', action='ldda_manage_permissions', library_id=library.id, folder_id=folder.id, obj_id=ldda.id, permissions=True )}">Edit this dataset's permissions</a>
%endif
%if can_modify_library_dataset:
<a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library.id, folder_id=folder.id, replace_id=library_dataset.id )}">Upload a new version of this dataset</a>
<a class="action-button" href="${h.url_for( controller='library', action='upload_library_dataset', library_id=library.id, folder_id=folder.id, replace_id=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='library', action='datasets', library_id=library.id, ldda_ids=str( ldda.id ), do_action='add' )}">Import this dataset into your current history</a>
<a class="action-button" href="${h.url_for( controller='library', action='download_dataset_from_folder', id=ldda.id, library_id=library.id )}">Download this dataset</a>
<a class="action-button" href="${h.url_for( controller='library', action='download_dataset_from_folder', obj_id=ldda.id, library_id=library.id )}">Download this dataset</a>
%endif
</div>
</td>
@@ -237,19 +237,19 @@ class RowCounter( object ):
<a id="folder_img-${folder.id}-popup" class="popup-arrow" style="display: none;">&#9660;</a>
<div popupmenu="folder_img-${folder.id}-popup">
%if can_add:
<a class="action-button" href="${h.url_for( controller='library', 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='library', 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='library', action='upload_library_dataset', library_id=library_id, folder_id=folder.id )}">Add datasets to this folder</a>
<a class="action-button" href="${h.url_for( controller='library', action='folder', new=True, obj_id=folder.id, library_id=library_id )}">Create a new sub-folder in this folder</a>
%endif
%if can_modify:
<a class="action-button" href="${h.url_for( controller='library', action='folder', information=True, id=folder.id, library_id=library_id )}">Edit this folder's information</a>
<a class="action-button" href="${h.url_for( controller='library', action='folder', information=True, obj_id=folder.id, library_id=library_id )}">Edit this folder's information</a>
%else:
<a class="action-button" href="${h.url_for( controller='library', action='folder', information=True, id=folder.id, library_id=library_id )}">View this folder's information</a>
<a class="action-button" href="${h.url_for( controller='library', action='folder', information=True, obj_id=folder.id, library_id=library_id )}">View this folder's information</a>
%endif
%if can_add and forms and not folder.info_association:
<a class="action-button" href="${h.url_for( controller='library', action='info_template', library_id=library.id, add=True )}">Add an information template to this folder</a>
<a class="action-button" href="${h.url_for( controller='library_common', action='info_template', cntrller='library', library_id=library.id, response_action='folder', folder_id=folder.id )}">Add an information template to this folder</a>
%endif
%if can_manage:
<a class="action-button" href="${h.url_for( controller='library', action='folder', permissions=True, id=folder.id, library_id=library_id )}">Edit this folder's permissions</a>
<a class="action-button" href="${h.url_for( controller='library', action='folder', permissions=True, obj_id=folder.id, library_id=library_id )}">Edit this folder's permissions</a>
%endif
</div>
</div>
@@ -287,22 +287,22 @@ class RowCounter( object ):
<ul class="manage-table-actions">
%if can_add:
<li>
<a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library.id, folder_id=library.root_folder.id )}"><span>Add datasets to this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library', action='upload_library_dataset', library_id=library.id, folder_id=library.root_folder.id )}"><span>Add datasets to this data library</span></a>
</li>
<li>
<a class="action-button" href="${h.url_for( controller='library', action='folder', new=True, id=library.root_folder.id, library_id=library.id )}">Add a folder to this library</a>
<a class="action-button" href="${h.url_for( controller='library', action='folder', new=True, obj_id=library.root_folder.id, library_id=library.id )}">Add a folder to this data library</a>
</li>
%endif
%if can_modify:
<li><a class="action-button" href="${h.url_for( controller='library', action='library', information=True, id=library.id )}">Edit this library's information</a></li>
<li><a class="action-button" href="${h.url_for( controller='library', action='library', information=True, obj_id=library.id )}">Edit this data library's information</a></li>
%else:
<li><a class="action-button" href="${h.url_for( controller='library', action='library', information=True, id=library.id )}">View this library's information</a></li>
<li><a class="action-button" href="${h.url_for( controller='library', action='library', information=True, obj_id=library.id )}">View this data library's information</a></li>
%endif
%if can_add and forms and not library.info_association:
<a class="action-button" href="${h.url_for( controller='library', action='info_template', library_id=library.id, add=True )}">Add an information template to this data library</a>
<a class="action-button" href="${h.url_for( controller='library_common', action='info_template', cntrller='library', library_id=library.id, response_action='browse_library' )}">Add an information template to this data library</a>
%endif
%if can_manage:
<li><a class="action-button" href="${h.url_for( controller='library', action='library', permissions=True, id=library.id )}">Edit this library's permissions</a></li>
<li><a class="action-button" href="${h.url_for( controller='library', action='library', permissions=True, obj_id=library.id )}">Edit this data library's permissions</a></li>
%endif
</ul>
+2 -2
View File
@@ -1,4 +1,4 @@
<%def name="render_template_info( library_item, library_id, widgets, editable=True )">
<%def name="render_template_info( library_item, library_id, response_action, widgets, editable=True )">
<%
library_item_type = 'unknown type'
library_item_desc = ''
@@ -22,7 +22,7 @@
<div class="toolFormTitle">Other information about ${library_item_desc} ${library_item.name}</div>
<div class="toolFormBody">
%if editable and trans.app.security_agent.can_modify_library_item( user, roles, library_item ):
<form name="edit_info" action="${h.url_for( controller='library', action='edit_template_info', library_id=library_id, num_widgets=len( widgets ) )}" method="post">
<form name="edit_info" action="${h.url_for( controller='library_common', action='edit_template_info', cntrller='library', library_id=library_id, response_action=response_action, num_widgets=len( widgets ) )}" method="post">
<input type="hidden" name="library_item_id" value="${library_item.id}"/>
<input type="hidden" name="library_item_type" value="${library_item_type}"/>
%for i, field in enumerate( widgets ):
+3 -3
View File
@@ -7,7 +7,7 @@
<br/><br/>
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -19,7 +19,7 @@
<div class="toolFormTitle">Edit folder name and description</div>
<div class="toolFormBody">
%if trans.app.security_agent.can_modify_library_item( user, roles, folder ):
<form name="folder" action="${h.url_for( controller='library', action='folder', rename=True, id=folder.id, library_id=library_id )}" method="post" >
<form name="folder" action="${h.url_for( controller='library', action='folder', rename=True, obj_id=folder.id, library_id=library_id )}" method="post" >
<div class="form-row">
<label>Name:</label>
<input type="text" name="name" value="${folder.name}" size="40"/>
@@ -49,5 +49,5 @@
</div>
</div>
%if widgets:
${render_template_info( folder, library_id, widgets )}
${render_template_info( folder, library_id, 'folder', widgets )}
%endif
+2 -2
View File
@@ -7,7 +7,7 @@
<br/><br/>
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -16,5 +16,5 @@
%endif
%if trans.app.security_agent.can_manage_library_item( user, roles, folder ):
${render_permission_form( folder, folder.name, h.url_for( controller='library', action='folder', id=folder.id, library_id=library_id, permissions=True ), trans.user.all_roles() )}
${render_permission_form( folder, folder.name, h.url_for( controller='library', action='folder', obj_id=folder.id, library_id=library_id, permissions=True ), trans.user.all_roles() )}
%endif
+9 -9
View File
@@ -14,7 +14,7 @@
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -22,9 +22,9 @@
${render_msg( msg, messagetype )}
%endif
<%def name="datatype( ldda, datatypes )">
<%def name="datatype( ldda, file_formats )">
<select name="datatype">
%for ext in datatypes:
%for ext in file_formats:
%if ldda.ext == ext:
<option value="${ext}" selected="yes">${ext}</option>
%else:
@@ -38,8 +38,8 @@
<div class="toolForm">
<div class="toolFormTitle">Edit attributes of ${ldda.name}</div>
<div class="toolFormBody">
<form name="edit_attributes" action="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, edit_info=True )}" method="post">
<input type="hidden" name="id" value="${ldda.id}"/>
<form name="edit_attributes" action="${h.url_for( controller='library', action='ldda_edit_info', library_id=library_id, folder_id=ldda.library_dataset.folder.id )}" method="post">
<input type="hidden" name="obj_id" value="${ldda.id}"/>
<div class="form-row">
<label>Name:</label>
<input type="text" name="name" value="${ldda.name}" size="40"/>
@@ -75,7 +75,7 @@
<input type="submit" name="save" value="Save"/>
</div>
</form>
<form name="auto_detect" action="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, edit_info=True )}" method="post">
<form name="auto_detect" action="${h.url_for( controller='library', action='ldda_edit_info', library_id=library_id, folder_id=ldda.library_dataset.folder.id )}" method="post">
<div class="form-row">
<input type="hidden" name="id" value="${ldda.id}"/>
<input type="submit" name="detect" value="Auto-detect"/>
@@ -91,11 +91,11 @@
<div class="toolFormTitle">Change data type</div>
<div class="toolFormBody">
%if ldda.datatype.allow_datatype_change:
<form name="change_datatype" action="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, edit_info=True )}" method="post">
<form name="change_datatype" action="${h.url_for( controller='library', action='ldda_edit_info', library_id=library_id, folder_id=ldda.library_dataset.folder.id )}" method="post">
<input type="hidden" name="id" value="${ldda.id}"/>
<div class="form-row">
<label>New Type:</label>
${datatype( ldda, datatypes )}
${datatype( ldda, file_formats )}
<div class="toolParamHelp" style="clear: both;">
This will change the datatype of the existing dataset
but <i>not</i> modify its contents. Use this if Galaxy
@@ -147,5 +147,5 @@
</div>
%endif
%if widgets:
${render_template_info( ldda, library_id, widgets )}
${render_template_info( ldda, library_id, 'ldda_edit_info', widgets )}
%endif
+8 -8
View File
@@ -20,7 +20,7 @@
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -41,19 +41,19 @@
<a id="dataset-${ldda.id}-popup" class="popup-arrow" style="display: none;">&#9660;</a>
<div popupmenu="dataset-${ldda.id}-popup">
%if trans.app.security_agent.can_modify_library_item( user, roles, ldda.library_dataset ):
<a class="action-button" href="${h.url_for( controller='library', 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>
<a class="action-button" href="${h.url_for( controller='library', action='ldda_edit_info', library_id=library_id, folder_id=ldda.library_dataset.folder.id, obj_id=ldda.id )}">Edit this dataset's information</a>
%else:
<a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library_id, folder_id=ldda.library_dataset.folder.id, id=ldda.id, information=True )}">View this dataset's information</a>
<a class="action-button" href="${h.url_for( controller='library', action='ldda_display_info', library_id=library_id, folder_id=ldda.library_dataset.folder.id, obj_id=ldda.id )}">View this dataset's information</a>
%endif
%if trans.app.security_agent.can_manage_dataset( roles, ldda.dataset ) and trans.app.security_agent.can_manage_library_item( user, roles, ldda.library_dataset ):
<a class="action-button" href="${h.url_for( controller='library', 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>
<a class="action-button" href="${h.url_for( controller='library', action='ldda_manage_permissions', library_id=library_id, folder_id=ldda.library_dataset.folder.id, obj_id=ldda.id, permissions=True )}">Edit this dataset's permissions</a>
%endif
%if current_version and trans.app.security_agent.can_modify_library_item( user, roles, ldda.library_dataset ):
<a class="action-button" href="${h.url_for( controller='library', 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>
<a class="action-button" href="${h.url_for( controller='library', action='upload_library_dataset', 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='library', action='datasets', library_id=library_id, ldda_ids=str( ldda.id ), do_action='add' )}">Import this dataset into your current history</a>
<a class="action-button" href="${h.url_for( controller='library', action='download_dataset_from_folder', id=ldda.id, library_id=library_id )}">Download this dataset</a>
<a class="action-button" href="${h.url_for( controller='library', action='download_dataset_from_folder', obj_id=ldda.id, library_id=library_id )}">Download this dataset</a>
%endif
</div>
</div>
@@ -96,7 +96,7 @@
%endif
</div>
%if widgets:
${render_template_info( ldda, library_id, widgets, editable=False )}
${render_template_info( ldda, library_id, 'ldda_display_info', widgets, editable=False )}
%endif
%if current_version:
<% expired_lddas = [ e_ldda for e_ldda in ldda.library_dataset.expired_datasets ] %>
@@ -104,7 +104,7 @@
<div class="toolFormTitle">Expired versions of ${ldda.name}</div>
%for expired_ldda in expired_lddas:
<div class="form-row">
<a href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library_id, folder_id=expired_ldda.library_dataset.folder.id, id=expired_ldda.id, info=True )}">${expired_ldda.name}</a>
<a href="${h.url_for( controller='library', action='ldda_display_info', library_id=library_id, folder_id=expired_ldda.library_dataset.folder.id, obj_id=expired_ldda.id )}">${expired_ldda.name}</a>
</div>
%endfor
%endif
+3 -3
View File
@@ -15,7 +15,7 @@
<br/><br/>
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -35,7 +35,7 @@
<a id="ldda-${ldd_assoc.id}-popup" class="popup-arrow" style="display: none;">&#9660;</a>
</div>
<div popupmenu="ldd_assoc-${ldd_assoc.id}-popup">
<a class="action-button" href="${h.url_for( controller='library', action='library_dataset', id=ldd_assoc.library_dataset_id, library_id=library_id )}">Manage this dataset's versions</a>
<a class="action-button" href="${h.url_for( controller='library', action='library_dataset', obj_id=ldd_assoc.library_dataset_id, library_id=library_id )}">Manage this dataset's versions</a>
</div>
</td>
<td>
@@ -59,4 +59,4 @@
%endif
<% ldda_ids = ",".join( [ str( d.id ) for d in lddas ] ) %>
${render_permission_form( lddas[0], name_str, h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library_id, folder_id=lddas[0].library_dataset.folder.id, id=ldda_ids, permissions=True ), roles )}
${render_permission_form( lddas[0], name_str, h.url_for( controller='library', action='ldda_manage_permissions', library_id=library_id, folder_id=lddas[0].library_dataset.folder.id, obj_id=ldda_ids ), roles )}
@@ -17,7 +17,7 @@
%if replace_dataset not in [ None, 'None' ]:
<input type="hidden" name="replace_id" value="${replace_dataset.id}"/>
<div class="form-row">
You are currently selecting a new file to replace '<a href="${h.url_for( controller=controller, action='library_dataset_dataset_association', library_id=library_id, folder_id=folder_id, id=replace_dataset.library_dataset_dataset_association.id )}">${replace_dataset.name}</a>'.
You are currently selecting a new file to replace '<a href="${h.url_for( controller=controller, action='ldda_display_info', library_id=library_id, folder_id=folder_id, obj_id=replace_dataset.library_dataset_dataset_association.id )}">${replace_dataset.name}</a>'.
<div style="clear: both"></div>
</div>
%endif
@@ -194,7 +194,7 @@
%if replace_dataset not in [ None, 'None' ]:
<input type="hidden" name="replace_id" value="${replace_dataset.id}"/>
<div class="form-row">
You are currently selecting a new file to replace '<a href="${h.url_for( controller=controller, action='library_dataset_dataset_association', library_id=library_id, folder_id=folder_id, id=replace_dataset.library_dataset_dataset_association.id )}">${replace_dataset.name}</a>'.
You are currently selecting a new file to replace '<a href="${h.url_for( controller=controller, action='ldda_display_info', library_id=library_id, folder_id=folder_id, obj_id=replace_dataset.library_dataset_dataset_association.id )}">${replace_dataset.name}</a>'.
<div style="clear: both"></div>
</div>
%endif
+3 -3
View File
@@ -13,7 +13,7 @@
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -25,7 +25,7 @@
<div class="toolForm">
<div class="toolFormTitle">Edit attributes of ${library_dataset.name}</div>
<div class="toolFormBody">
<form name="edit_attributes" action="${h.url_for( controller='library', action='library_dataset', id=library_dataset.id, library_id=library_id, information=True )}" method="post">
<form name="edit_attributes" action="${h.url_for( controller='library', action='library_dataset', obj_id=library_dataset.id, library_id=library_id, information=True )}" method="post">
<div class="form-row">
<label>Name:</label>
<div style="float: left; width: 250px; margin-right: 10px;">
@@ -64,5 +64,5 @@
%endif
%if widgets:
${render_template_info( library_dataset, library_id, widgets )}
${render_template_info( library_dataset, library_id, '', widgets )}
%endif
@@ -13,7 +13,7 @@
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -25,5 +25,5 @@
<%
roles = trans.app.model.Role.filter( trans.app.model.Role.table.c.deleted==False ).order_by( trans.app.model.Role.table.c.name ).all()
%>
${render_permission_form( library_dataset, library_dataset.name, h.url_for( controller='library', action='library_dataset', id=library_dataset.id, library_id=library_id, permissions=True ), roles )}
${render_permission_form( library_dataset, library_dataset.name, h.url_for( controller='library', action='library_dataset', obj_id=library_dataset.id, library_id=library_id, permissions=True ), roles )}
%endif
+3 -3
View File
@@ -7,7 +7,7 @@
<br/><br/>
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', id=library.id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', obj_id=library.id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -36,7 +36,7 @@
</div>
<div class="form-row">
<div style="float: left; width: 250px; margin-right: 10px;">
<input type="hidden" name="id" value="${library.id}"/>
<input type="hidden" name="obj_id" value="${library.id}"/>
</div>
<div style="clear: both"></div>
</div>
@@ -60,5 +60,5 @@
%endif
%if widgets:
${render_template_info( library, library.id, widgets )}
${render_template_info( library, library.id, 'library', widgets )}
%endif
+2 -2
View File
@@ -7,7 +7,7 @@
<br/><br/>
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', id=library.id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', obj_id=library.id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -19,5 +19,5 @@
<%
roles = trans.app.model.Role.filter( trans.app.model.Role.table.c.deleted==False ).order_by( trans.app.model.Role.table.c.name ).all()
%>
${render_permission_form( library, library.name, h.url_for( controller='library', action='library', id=library.id, permissions=True ), roles )}
${render_permission_form( library, library.name, h.url_for( controller='library', action='library', obj_id=library.id, permissions=True ), roles )}
%endif
+2 -2
View File
@@ -4,7 +4,7 @@
<br/<br/>
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -15,7 +15,7 @@
<div class="toolForm">
<div class="toolFormTitle">Create a new folder</div>
<div class="toolFormBody">
<form name="folder" action="${h.url_for( controller='library', action='folder', id=folder.id, library_id=library_id )}" method="post" >
<form name="folder" action="${h.url_for( controller='library', action='folder', obj_id=folder.id, library_id=library_id )}" method="post" >
<div class="form-row">
<label>Name:</label>
<div style="float: left; width: 250px; margin-right: 10px;">
+5 -2
View File
@@ -4,7 +4,7 @@
<br/><br/>
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -14,16 +14,19 @@
<div class="toolForm">
<div class="toolFormTitle">Select a form on which to base the template for the ${library_item_desc} '${library_item_name}'</div>
<form name="new_info_template" action="${h.url_for( controller='library', action='info_template', add=True )}" method="post" >
<form name="new_info_template" action="${h.url_for( controller='library_common', action='info_template', cntrller='library' )}" method="post" >
<div class="toolFormBody">
<div class="form-row">
<input type="hidden" name="library_id" value="${library_id}"/>
%if library_dataset_id:
<input type="hidden" name="library_dataset_id" value="${library_dataset_id}"/>
<input type="hidden" name="response_action" value="ldda_edit_info"/>
%elif folder_id:
<input type="hidden" name="folder_id" value="${folder_id}"/>
<input type="hidden" name="response_action" value="folder"/>
%elif ldda_id:
<input type="hidden" name="ldda_id" value="${ldda_id}"/>
<input type="hidden" name="response_action" value="ldda_edit_info"/>
%endif
<label>Template:</label>
<select name="form_id">
+5 -6
View File
@@ -1,6 +1,5 @@
<%inherit file="/base.mako"/>
<%namespace file="/message.mako" import="render_msg" />
<%namespace file="/admin/library/common.mako" import="render_template_info" />
<%namespace file="/library/library_dataset_common.mako" import="render_upload_form" />
<% import os, os.path %>
@@ -15,16 +14,16 @@
<b>Create new data library datasets</b>
<a id="upload-librarydataset--popup" class="popup-arrow" style="display: none;">&#9660;</a>
<div popupmenu="upload-librarydataset--popup">
<a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library_id, folder_id=folder_id, replace_id=replace_id, upload_option='upload_file' )}">Upload files</a>
<a class="action-button" href="${h.url_for( controller='library', action='upload_library_dataset', library_id=library_id, folder_id=folder_id, replace_id=replace_id, upload_option='upload_file' )}">Upload files</a>
%if trans.app.config.user_library_import_dir and os.path.exists( os.path.join( trans.app.config.user_library_import_dir, trans.user.email ) ):
<a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library_id, folder_id=folder_id, replace_id=replace_id, upload_option='upload_directory' )}">Upload directory of files</a>
<a class="action-button" href="${h.url_for( controller='library', action='upload_library_dataset', library_id=library_id, folder_id=folder_id, replace_id=replace_id, upload_option='upload_directory' )}">Upload directory of files</a>
%endif
<a class="action-button" href="${h.url_for( controller='library', action='library_dataset_dataset_association', library_id=library_id, folder_id=folder_id, replace_id=replace_id, upload_option='import_from_history' )}">Import datasets from your current history</a>
<a class="action-button" href="${h.url_for( controller='library', action='upload_library_dataset', library_id=library_id, folder_id=folder_id, replace_id=replace_id, upload_option='import_from_history' )}">Import datasets from your current history</a>
</div>
<br/><br/>
<ul class="manage-table-actions">
<li>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', id=library_id )}"><span>Browse this data library</span></a>
<a class="action-button" href="${h.url_for( controller='library', action='browse_library', obj_id=library_id )}"><span>Browse this data library</span></a>
</li>
</ul>
@@ -32,4 +31,4 @@
${render_msg( msg, messagetype )}
%endif
${render_upload_form( 'library', upload_option, action, library_id, folder_id, replace_dataset, file_formats, dbkeys, roles, history, )}
${render_upload_form( 'library', upload_option, action, library_id, folder_id, replace_dataset, file_formats, dbkeys, roles, history )}
+3 -3
View File
@@ -30,7 +30,7 @@
</div>
<div class="form-row">
<div style="float: left; width: 250px; margin-right: 10px;">
<input type="hidden" name="id" value="${library.id}"/>
<input type="hidden" name="obj_id" value="${library.id}"/>
</div>
<div style="clear: both"></div>
</div>
@@ -51,7 +51,7 @@
</div>
</div>
<div class="toolForm">
${render_template_info( library, library.id )}
${render_template_info( library, library.id, 'library' )}
</div>
</div>
%endif
@@ -63,5 +63,5 @@
%endif
%if widgets:
${render_template_info( library, library_id, widgets )}
${render_template_info( library, library_id, 'library', widgets )}
%endif
+1 -1
View File
@@ -104,7 +104,7 @@
%else:
%if rd['label'] == 'Data library':
%if rd['value']:
<a href="${h.url_for( controller='library', action='browse_library', id=request.library.id )}">${rd['value']}</a>
<a href="${h.url_for( controller='library', action='browse_library', obj_id=request.library.id )}">${rd['value']}</a>
%else:
<i>None</i>
%endif
+26 -26
View File
@@ -1145,7 +1145,7 @@ class TwillTestCase( unittest.TestCase ):
tc.submit( "create_library_button" )
self.home()
def set_library_permissions( self, library_id, library_name, role_id, permissions_in, permissions_out ):
url = "library_admin/library?id=%s&permissions=True&update_roles_button=Save" % ( library_id )
url = "library_admin/library?obj_id=%s&permissions=True&update_roles_button=Save" % ( library_id )
for po in permissions_out:
key = '%s_out' % po
url ="%s&%s=%s" % ( url, key, str( role_id ) )
@@ -1160,44 +1160,44 @@ class TwillTestCase( unittest.TestCase ):
def rename_library( self, library_id, old_name, name='Library One Renamed', description='This is Library One Re-described' ):
"""Rename a library"""
self.home()
self.visit_url( "%s/library_admin/library?information=True&id=%s" % ( self.url, library_id ) )
self.visit_url( "%s/library_admin/library?obj_id=%s&information=True" % ( self.url, library_id ) )
self.check_page_for_string( 'Change library name and description' )
# Since twill barfs on the form submisson, we ar forced to simulate it
url = "%s/library_admin/library?information=True&id=%s&rename_library_button=Save&description=%s&name=%s" % \
url = "%s/library_admin/library?obj_id=%s&information=True&rename_library_button=Save&description=%s&name=%s" % \
( self.url, library_id, description.replace( ' ', '+' ), name.replace( ' ', '+' ) )
self.home()
self.visit_url( url )
check_str = "Library '%s' has been renamed to '%s'" % ( old_name, name )
self.check_page_for_string( check_str )
self.home()
def add_library_info_template( self, library_id, library_name, form_id, form_name ):
def add_library_info_template( self, cntrller, library_id, library_name, form_id, form_name ):
"""Add a new info template to a library"""
self.home()
url = "%s/library_admin/info_template?library_id=%s&add=True" % ( self.url, library_id )
url = "%s/library_common/info_template?cntrller=%s&library_id=%s&response_action='browse_library'" % ( self.url, cntrller, library_id )
self.visit_url( url )
self.check_page_for_string ( "Select a form on which to base the template" )
tc.fv( '1', 'library_id', library_id )
tc.submit( 'add_info_template_button' )
self.check_page_for_string = 'An information template based on the form "%s" has been added to this library.' % form_name
self.check_page_for_string = 'An information template based on the form "%s" has been added to this data library.' % form_name
self.home()
def edit_library_info( self, library_id, library_name, ele_1_field_name, ele_1_contents, ele_2_field_name, ele_2_contents ):
"""Add information to a library using an existing template with 2 elements"""
self.home()
self.visit_url( "%s/library_admin/library?information=True&id=%s" % ( self.url, library_id ) )
self.visit_url( "%s/library_admin/library?obj_id=%s&information=True" % ( self.url, library_id ) )
check_str = 'Other information about library %s' % library_name
self.check_page_for_string( check_str )
tc.fv( '2', ele_1_field_name, ele_1_contents )
tc.fv( '2', ele_2_field_name, ele_2_contents )
tc.submit( 'create_new_info_button' )
self.home()
def edit_library_info_template( self, library_id, id, name, ele_name_1, name_1,
def edit_library_info_template( self, library_id, obj_id, name, ele_name_1, name_1,
ele_desc_1, desc_1, ele_name_2, name_2, ele_desc_2, desc_2 ):
"""Edit an existing library info template"""
self.home()
url = "%s/library_admin/info_template?library_id=%s&id=%s&edit_template=True" % ( self.url, library_id, id )
url = "%s/library_admin/edit_info_template?library_id=%s&obj_id=%s&response_action='browse_library'" % ( self.url, library_id, obj_id )
self.visit_url( url )
self.check_page_for_string ( 'Edit template' )
tc.fv( '1', 'id', id )
tc.fv( '1', 'obj_id', obj_id )
tc.fv( '1', 'set_num_fields', '0' )
tc.fv( '1', 'name', name )
tc.fv( '1', ele_name_1, name_1 )
@@ -1208,12 +1208,12 @@ class TwillTestCase( unittest.TestCase ):
check_str = "Information template '%s' has been updated" % name
self.check_page_for_string( check_str )
self.home()
def add_folder_info_template( self, library_id, library_name, folder_id, folder_name, num_fields='2',
def add_folder_info_template( self, cntrller, library_id, library_name, folder_id, folder_name, num_fields='2',
name='Folder Template 1', ele_name_0='Fu', ele_help_0='', ele_name_1='Bar', ele_help_1='' ):
"""Add a new info template to a folder"""
self.home()
url = "%s/library_admin/info_template?library_id=%s&folder_id=%s&new_template=True&num_fields=2&create_info_template_button=Go" % \
( self.url, library_id, folder_id )
url = "%s/library_admin/info_template?cntrller=%s&library_id=%s&response_action='folder'&create_info_template_button=Go" % \
( self.url, cntrller, library_id, folder_id )
self.home()
self.visit_url( url )
check_str = "Create a new information template for folder '%s'" % folder_name
@@ -1231,7 +1231,7 @@ class TwillTestCase( unittest.TestCase ):
def add_folder( self, library_id, folder_id, name='Folder One', description='This is Folder One' ):
"""Create a new folder"""
self.home()
self.visit_url( "%s/library_admin/folder?library_id=%s&id=%s&new=True" % ( self.url, library_id, folder_id ) )
self.visit_url( "%s/library_admin/folder?library_id=%s&obj_id=%s&new=True" % ( self.url, library_id, folder_id ) )
self.check_page_for_string( 'Create a new folder' )
tc.fv( "1", "name", name ) # form field 1 is the field named name...
tc.fv( "1", "description", description ) # form field 2 is the field named description...
@@ -1240,10 +1240,10 @@ class TwillTestCase( unittest.TestCase ):
def rename_folder( self, library_id, folder_id, old_name, name='Folder One Renamed', description='This is Folder One Re-described' ):
"""Rename a Folder"""
self.home()
self.visit_url( "%s/library_admin/folder?library_id=%s&manage=True&id=%s" % ( self.url, library_id, folder_id ) )
self.visit_url( "%s/library_admin/folder?library_id=%s&manage=True&obj_id=%s" % ( self.url, library_id, folder_id ) )
self.check_page_for_string( 'Edit folder name and description' )
# Since twill barfs on the form submisson, we ar forced to simulate it
url = "%s/library_admin/folder?library_id=%s&manage=True&id=%s&rename_folder_button=Save&description=%s&name=%s" % \
url = "%s/library_admin/folder?library_id=%s&manage=True&obj_id=%s&rename_folder_button=Save&description=%s&name=%s" % \
( self.url, library_id, folder_id, description.replace( ' ', '+' ), name.replace( ' ', '+' ) )
self.home()
self.visit_url( url )
@@ -1255,7 +1255,7 @@ class TwillTestCase( unittest.TestCase ):
"""Add a dataset to a folder"""
filename = self.get_filename( filename )
self.home()
self.visit_url( "%s/library_admin/library_dataset_dataset_association?upload_option=upload_file&library_id=%s&folder_id=%s&message=%s" % \
self.visit_url( "%s/library_admin/upload_library_dataset?upload_option=upload_file&library_id=%s&folder_id=%s&message=%s" % \
( self.url, library_id, folder_id, message ) )
self.check_page_for_string( 'Upload files' )
tc.fv( "1", "folder_id", folder_id )
@@ -1277,7 +1277,7 @@ class TwillTestCase( unittest.TestCase ):
self.library_wait( library_id )
self.home()
def set_library_dataset_permissions( self, library_id, folder_id, ldda_id, ldda_name, role_id, permissions_in, permissions_out ):
url = "library_admin/library_dataset_dataset_association?library_id=%s&folder_id=%s&&id=%s&permissions=True&update_roles_button=Save" % \
url = "library_admin/ldda_manage_permissions?library_id=%s&folder_id=%s&obj_id=%s&update_roles_button=Save" % \
( library_id, folder_id, ldda_id )
#role_ids = util.listify( role_ids )
#for role_id in role_ids:
@@ -1289,7 +1289,7 @@ class TwillTestCase( unittest.TestCase ):
url ="%s&%s=%s" % ( url, key, str( role_id ) )
self.home()
self.visit_url( "%s/%s" % ( self.url, url ) )
check_str = "Permissions updated for dataset '%s'" % ldda_name
check_str = "Permissions have been updated on 1 datasets"
self.check_page_for_string( check_str )
self.home()
def edit_ldda_template_element_info( self, library_id, folder_id, ldda_id, ldda_name, ele_1_field_name,
@@ -1297,7 +1297,7 @@ class TwillTestCase( unittest.TestCase ):
ele_3_field_name='', ele_3_contents='', ele_3_help='' ):
"""Edit library_dataset_dataset_association template element information"""
self.home()
self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
self.visit_url( "%s/library_admin/ldda_edit_info?library_id=%s&folder_id=%s&obj_id=%s" % \
( self.url, library_id, folder_id, ldda_id ) )
check_str = 'Edit attributes of %s' % ldda_name
self.check_page_for_string( check_str )
@@ -1329,7 +1329,7 @@ class TwillTestCase( unittest.TestCase ):
def edit_ldda_attribute_info( self, library_id, folder_id, ldda_id, ldda_name, new_ldda_name ):
"""Edit library_dataset_dataset_association attribute information"""
self.home()
self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
self.visit_url( "%s/library_admin/ldda_edit_info?library_id=%s&folder_id=%s&obj_id=%s" % \
( self.url, library_id, folder_id, ldda_id ) )
check_str = 'Edit attributes of %s' % ldda_name
self.check_page_for_string( check_str )
@@ -1345,7 +1345,7 @@ class TwillTestCase( unittest.TestCase ):
"""Upload new version(s) of a dataset"""
self.home()
filename = self.get_filename( filename )
self.visit_url( "%s/library_admin/library_dataset_dataset_association?upload_option=upload_file&library_id=%s&folder_id=%s&replace_id=%s&message=%s" % \
self.visit_url( "%s/library_admin/upload_library_dataset?upload_option=upload_file&library_id=%s&folder_id=%s&replace_id=%s&message=%s" % \
( self.url, library_id, folder_id, library_dataset_id, message ) )
self.check_page_for_string( 'Upload files' )
self.check_page_for_string( 'You are currently selecting a new file to replace' )
@@ -1378,7 +1378,7 @@ class TwillTestCase( unittest.TestCase ):
"""Add a directory of datasets to a folder"""
# roles is a list of tuples: [ ( role_id, role_description ) ]
self.home()
self.visit_url( "%s/library_admin/library_dataset_dataset_association?upload_option=upload_directory&library_id=%s&folder_id=%s" % ( self.url, library_id, folder_id ) )
self.visit_url( "%s/library_admin/upload_library_dataset?upload_option=upload_directory&library_id=%s&folder_id=%s" % ( self.url, library_id, folder_id ) )
self.check_page_for_string( 'Upload a directory of files' )
tc.fv( "1", "folder_id", folder_id )
tc.fv( "1", "file_type", file_type )
@@ -1400,7 +1400,7 @@ class TwillTestCase( unittest.TestCase ):
"""Add a directory of datasets to a folder"""
# roles is a list of tuples: [ ( role_id, role_description ) ]
self.home()
self.visit_url( "%s/library/library_dataset_dataset_association?upload_option=upload_directory&library_id=%s&folder_id=%s" % \
self.visit_url( "%s/library/upload_library_dataset?upload_option=upload_directory&library_id=%s&folder_id=%s" % \
( self.url, library_id, folder_id ) )
self.check_page_for_string( 'Upload a directory of files' )
tc.fv( "1", "folder_id", folder_id )
@@ -1445,7 +1445,7 @@ class TwillTestCase( unittest.TestCase ):
def purge_library( self, library_id, library_name ):
"""Purge a library"""
self.home()
self.visit_url( "%s/library_admin/purge_library?id=%s" % ( self.url, library_id ) )
self.visit_url( "%s/library_admin/purge_library?obj_id=%s" % ( self.url, library_id ) )
check_str = "Library '%s' and all of its contents have been purged" % library_name
self.check_page_for_string( check_str )
self.home()
@@ -1456,7 +1456,7 @@ class TwillTestCase( unittest.TestCase ):
self.home()
while count < maxiter:
count += 1
self.visit_url( "%s/%s/browse_library?id=%s" % ( self.url, controller, library_id ) )
self.visit_url( "%s/%s/browse_library?obj_id=%s" % ( self.url, controller, library_id ) )
page = tc.browser.get_html()
if page.find( '<!-- running: do not change this comment, used by TwillTestCase.library_wait -->' ) > -1:
time.sleep( sleep_amount )
+1 -1
View File
@@ -162,7 +162,7 @@ class TestFormsAndRequests( TwillTestCase ):
galaxy.model.LibraryFolder.table.c.name==name ) ).first()
assert folder_one is not None, 'Problem retrieving library folder named "%s" from the database' % name
self.home()
self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library_admin/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( name )
# create address
#self.create_address( user_address1 )
+92 -77
View File
@@ -30,7 +30,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
self.check_page_for_string( not_logged_in_security_msg )
self.visit_url( "%s/library_admin/library" % self.url )
self.check_page_for_string( not_logged_in_security_msg )
self.visit_url( "%s/library_admin/folder?id=1&new=True" % self.url )
self.visit_url( "%s/library_admin/folder?obj_id=1&new=True" % self.url )
self.check_page_for_string( not_logged_in_security_msg )
def test_005_login_as_admin_user( self ):
"""Testing logging in as an admin user test@bx.psu.edu - tests initial settings for DefaultUserPermissions and DefaultHistoryPermissions"""
@@ -494,7 +494,8 @@ class TestSecurityAndLibraries( TwillTestCase ):
assert form_one is not None, 'Problem retrieving form named (%s) from the database' % form_name
# Add a new information template to the library
template_name = 'Library Template 1'
self.add_library_info_template( str( library_one.id ),
self.add_library_info_template( 'library_admin',
str( library_one.id ),
library_one.name,
str( form_one.id ),
form_one.name )
@@ -510,14 +511,13 @@ class TestSecurityAndLibraries( TwillTestCase ):
global form_one_field_name
form_one_field_name = 'field_0'
contents = '%s library contents' % form_one_field_label
self.visit_url( '%s/library_admin/library?id=%s&information=True' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library_admin/library?obj_id=%s&information=True' % ( self.url, str( library_one.id ) ) )
# There are 2 forms on this page and the template is the 2nd form
tc.fv( '2', form_one_field_name, contents )
tc.submit( 'edit_info_button' )
# For some reason, the following check:
# self.check_page_for_string ( 'The information has been updated.' )
# ...throws the following exception - I have not idea why!
# self.check_page_for_string ( 'The information has been updated.' )
# TypeError: 'str' object is not callable
# The work-around is to not make ANY self.check_page_for_string() calls until the next method
def test_080_edit_template_contents_admin_view( self ):
@@ -525,7 +525,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
# First make sure the templlate contents from the previous method were correctly saved
contents = '%s library contents' % form_one_field_label
contents_edited = contents + ' edited'
self.visit_url( '%s/library_admin/library?id=%s&information=True' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library_admin/library?obj_id=%s&information=True' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( contents )
# Edit the contents and then save them
tc.fv( '2', form_one_field_name, contents_edited )
@@ -554,7 +554,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
.order_by( desc( galaxy.model.LibraryDatasetDatasetAssociation.table.c.create_time ) ).first()
assert ldda_one is not None, 'Problem retrieving LibraryDatasetDatasetAssociation ldda_one from the database'
self.home()
self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library_admin/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( "1.bed" )
self.check_page_for_string( message )
self.check_page_for_string( admin_user.email )
@@ -576,14 +576,14 @@ class TestSecurityAndLibraries( TwillTestCase ):
% ( ldda_one.dataset.id, dp.action ) )
# Make sure the library template contents were correctly saved
self.home()
self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
self.visit_url( "%s/library_admin/ldda_edit_info?library_id=%s&folder_id=%s&obj_id=%s" % \
( self.url, str( library_one.id ), str( library_one.root_folder.id ), str( ldda_one.id ) ) )
self.check_page_for_string( template_contents )
# Make sure other users can access the dataset from the Libraries view
self.logout()
self.login( email=regular_user2.email )
self.home()
self.visit_url( '%s/library/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( "1.bed" )
self.logout()
self.login( email=admin_user.email )
@@ -600,11 +600,11 @@ class TestSecurityAndLibraries( TwillTestCase ):
galaxy.model.LibraryFolder.table.c.description==description ) ).first()
assert folder_one is not None, 'Problem retrieving library folder named "%s" from the database' % name
self.home()
self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library_admin/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( name )
self.check_page_for_string( description )
self.home()
self.visit_url( '%s/library_admin/folder?id=%s&library_id=%s&information=True' % ( self.url, str( folder_one.id ), str( library_one.id ) ) )
self.visit_url( '%s/library_admin/folder?obj_id=%s&library_id=%s&information=True' % ( self.url, str( folder_one.id ), str( library_one.id ) ) )
# Make sure the template was inherited
self.check_page_for_string( form_one_field_name )
# Make sure the template contents were NOT inherited
@@ -632,11 +632,11 @@ class TestSecurityAndLibraries( TwillTestCase ):
galaxy.model.LibraryFolder.table.c.description==description ) ).first()
assert subfolder_one is not None, 'Problem retrieving library folder named "Folder Ones Subfolder" from the database'
self.home()
self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library_admin/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( name )
self.check_page_for_string( description )
self.home()
self.visit_url( '%s/library_admin/folder?id=%s&library_id=%s&information=True' % ( self.url, str( subfolder_one.id ), str( library_one.id ) ) )
self.visit_url( '%s/library_admin/folder?obj_id=%s&library_id=%s&information=True' % ( self.url, str( subfolder_one.id ), str( library_one.id ) ) )
# Make sure the template was inherited
self.check_page_for_string( form_one_field_name )
# Make sure the template contents were NOT inherited
@@ -665,11 +665,11 @@ class TestSecurityAndLibraries( TwillTestCase ):
galaxy.model.LibraryFolder.table.c.description==description ) ).first()
assert folder_two is not None, 'Problem retrieving library folder named "%s" from the database' % name
self.home()
self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library_admin/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( name )
self.check_page_for_string( description )
self.home()
self.visit_url( '%s/library_admin/folder?id=%s&library_id=%s&information=True' % ( self.url, str( subfolder_one.id ), str( library_one.id ) ) )
self.visit_url( '%s/library_admin/folder?obj_id=%s&library_id=%s&information=True' % ( self.url, str( subfolder_one.id ), str( library_one.id ) ) )
# Make sure the template was inherited
self.check_page_for_string( form_one_field_name )
# Make sure the template contents were NOT inherited
@@ -701,13 +701,13 @@ class TestSecurityAndLibraries( TwillTestCase ):
.order_by( desc( galaxy.model.LibraryDatasetDatasetAssociation.table.c.create_time ) ).first()
assert ldda_two is not None, 'Problem retrieving LibraryDatasetDatasetAssociation ldda_two from the database'
self.home()
self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library_admin/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( "2.bed" )
self.check_page_for_string( message )
self.check_page_for_string( admin_user.email )
# Make sure the library template contents were correctly saved
self.home()
self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
self.visit_url( "%s/library_admin/ldda_edit_info?library_id=%s&folder_id=%s&obj_id=%s" % \
( self.url, str( library_one.id ), str( folder_two.id ), str( ldda_two.id ) ) )
self.check_page_for_string( template_contents )
def test_110_add_2nd_public_dataset_to_root_folders_2nd_subfolder( self ):
@@ -732,13 +732,13 @@ class TestSecurityAndLibraries( TwillTestCase ):
.order_by( desc( galaxy.model.LibraryDatasetDatasetAssociation.table.c.create_time ) ).first()
assert ldda_three is not None, 'Problem retrieving LibraryDatasetDatasetAssociation ldda_three from the database'
self.home()
self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library_admin/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( "3.bed" )
self.check_page_for_string( message )
self.check_page_for_string( admin_user.email )
# Make sure the library template contents were correctly saved
self.home()
self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
self.visit_url( "%s/library_admin/ldda_edit_info?library_id=%s&folder_id=%s&obj_id=%s" % \
( self.url, str( library_one.id ), str( folder_two.id ), str( ldda_three.id ) ) )
self.check_page_for_string( template_contents )
def test_115_add_dataset_with_private_role_restriction_to_folder( self ):
@@ -775,21 +775,21 @@ class TestSecurityAndLibraries( TwillTestCase ):
.order_by( desc( galaxy.model.LibraryDatasetDatasetAssociation.table.c.create_time ) ).first()
assert ldda_four is not None, 'Problem retrieving LibraryDatasetDatasetAssociation ldda_four from the database'
self.home()
self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library_admin/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( "4.bed" )
self.check_page_for_string( message )
self.check_page_for_string( admin_user.email )
self.home()
# Make sure the library template contents were correctly saved
self.home()
self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
self.visit_url( "%s/library_admin/ldda_edit_info?library_id=%s&folder_id=%s&obj_id=%s" % \
( self.url, str( library_one.id ), str( folder_one.id ), str( ldda_four.id ) ) )
self.check_page_for_string( template_contents )
def test_120_accessing_dataset_with_private_role_restriction( self ):
"""Testing accessing a dataset with a private role restriction"""
# admin_user should not be able to see 2.bed from the analysis view's access libraries
self.home()
self.visit_url( '%s/library/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
try:
self.check_page_for_string( folder_one.name )
raise AssertionError( '%s can see library folder %s when it contains only datasets restricted by role %s' \
@@ -807,7 +807,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
# since it was associated with regular_user1's private role
self.login( email='test1@bx.psu.edu' )
self.home()
self.visit_url( '%s/library/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( folder_one.name )
self.check_page_for_string( '4.bed' )
self.logout()
@@ -854,7 +854,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
role_ids, permissions_in, permissions_out )
# admin_user should now be able to see 4.bed from the analysis view's access libraries
self.home()
self.visit_url( '%s/library/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( ldda_four.name )
self.home()
def test_130_add_dataset_with_role_associated_with_group_and_users( self ):
@@ -882,28 +882,28 @@ class TestSecurityAndLibraries( TwillTestCase ):
.order_by( desc( galaxy.model.LibraryDatasetDatasetAssociation.table.c.create_time ) ).first()
assert ldda_five is not None, 'Problem retrieving LibraryDatasetDatasetAssociation ldda_five from the database'
self.home()
self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library_admin/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( "5.bed" )
self.check_page_for_string( message )
self.check_page_for_string( admin_user.email )
self.home()
# Make sure the library template contents were correctly saved
self.home()
self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
self.visit_url( "%s/library_admin/ldda_edit_info?library_id=%s&folder_id=%s&obj_id=%s" % \
( self.url, str( library_one.id ), str( folder_one.id ), str( ldda_five.id ) ) )
self.check_page_for_string( template_contents )
def test_135_accessing_dataset_with_role_associated_with_group_and_users( self ):
"""Testing accessing a dataset with a role that is associated with a group and users"""
# admin_user should be able to see 5.bed since she is associated with role_two
self.home()
self.visit_url( '%s/library/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( "5.bed" )
self.check_page_for_string( admin_user.email )
self.logout()
# regular_user1 should be able to see 5.bed since she is associated with group_two
self.login( email = 'test1@bx.psu.edu' )
self.home()
self.visit_url( '%s/library/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( folder_one.name )
self.check_page_for_string( '5.bed' )
self.check_page_for_string( admin_user.email )
@@ -920,7 +920,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
# LIBRARY_MANAGE = Role One
# Role One aassociations: test@bx.psu.edu, test1@bx.psu.edu, test3@bx.psu.edu
self.home()
self.visit_url( '%s/library/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s' \
self.visit_url( '%s/library/ldda_edit_info?library_id=%s&folder_id=%s&obj_id=%s' \
% ( self.url, str( library_one.id ), str( folder_one.id ), str( ldda_five.id ) ) )
self.check_page_for_string( '5.bed' )
self.check_page_for_string( 'This is the latest version of this library dataset' )
@@ -937,7 +937,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
# regular_user2 should not be able to see 5.bed
self.login( email = 'test2@bx.psu.edu' )
self.home()
self.visit_url( '%s/library/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
try:
self.check_page_for_string( folder_one.name )
raise AssertionError( '%s can see library folder %s when it contains only datasets restricted by role %s' \
@@ -954,7 +954,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
# can access ) since she has Role One, and Role One has all library permissions ( see above ).
self.login( email = 'test3@bx.psu.edu' )
self.home()
self.visit_url( '%s/library/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( folder_one.name )
# regular_user3 should not be able to see 5.bed since users must have every role associated
# with the dataset in order to access it, and regular_user3 isnot associated with Role Two
@@ -989,7 +989,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
assert ldda_six is not None, 'Problem retrieving LibraryDatasetDatasetAssociation ldda_six from the database'
self.home()
# Make sure the correct template was inherited
self.visit_url( '%s/library/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s' \
self.visit_url( '%s/library/ldda_edit_info?library_id=%s&folder_id=%s&obj_id=%s' \
% ( self.url, str( library_one.id ), str( subfolder_one.id ), str( ldda_six.id ) ) )
self.check_page_for_string( form_one_field_name )
# Make sure the template contents were NOT inherited
@@ -1005,11 +1005,11 @@ class TestSecurityAndLibraries( TwillTestCase ):
self.edit_ldda_attribute_info( str( library_one.id ), str( subfolder_one.id ), str( ldda_six.id ), ldda_six.name, new_ldda_name )
self.home()
ldda_six.refresh()
self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library_admin/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( ldda_six.name )
self.home()
# Make sure the template contents were NOT inherited
self.visit_url( '%s/library/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s' \
self.visit_url( '%s/library/ldda_edit_info?library_id=%s&folder_id=%s&obj_id=%s' \
% ( self.url, str( library_one.id ), str( subfolder_one.id ), str( ldda_six.id ) ) )
self.check_page_for_string( form_one_field_name )
contents = "%s contents for Folder One's Subfolder" % form_one_field_label
@@ -1019,7 +1019,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
except:
pass
def test_150_uploading_new_dataset_version( self ):
"""Testing uploading a new version of a dataset"""
"""Testing uploading a new version of a library dataset"""
message = 'Testing uploading a new version of a dataset'
# The form_one template should be inherited to the library dataset upload form.
template_contents = "%s contents for %s new version of 6.bed" % ( form_one_field_label, folder_one.name )
@@ -1039,7 +1039,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
.order_by( desc( galaxy.model.LibraryDatasetDatasetAssociation.table.c.create_time ) ).first()
assert ldda_six_version_two is not None, 'Problem retrieving LibraryDatasetDatasetAssociation ldda_six_version_two from the database'
self.home()
self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
self.visit_url( "%s/library_admin/ldda_edit_info?library_id=%s&folder_id=%s&obj_id=%s" % \
( self.url, str( library_one.id ), str( subfolder_one.id ), str( ldda_six_version_two.id ) ) )
self.check_page_for_string( 'This is the latest version of this library dataset' )
# Make sure the correct template was inherited
@@ -1069,21 +1069,19 @@ class TestSecurityAndLibraries( TwillTestCase ):
raise AssertionError( 'ldda.dataset "%s" actions "%s" != ldda.dataset "%s" actions "%s"' \
% ( ldda_six.name, str( ldda_six.dataset.actions ), ldda_six_version_two.name, str( ldda_six_version_two.dataset.actions ) ) )
# Check the previous version
self.visit_url( "%s/library_admin/library_dataset_dataset_association?info=True&library_id=%s&folder_id=%s&id=%s" % \
self.visit_url( "%s/library_admin/ldda_display_info?library_id=%s&folder_id=%s&obj_id=%s" % \
( self.url, str( library_one.id ), str( subfolder_one.id ), str( ldda_six.id ) ) )
self.check_page_for_string( 'This is an expired version of this library dataset' )
self.home()
# Make sure ldda_six is no longer displayed in the library
self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library_admin/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
try:
self.check_page_for_string( ldda_six.name )
raise AssertionError, "Old version of library dataset %s is displayed in library" % ldda_six.name
except:
pass
self.home()
def test_155_uploading_new_dataset_versions( self ):
"""Testing uploading new versions of a dataset using a directory of files"""
message = 'Testing uploading new versions of a dataset using a directory of files'
message = 'Testing uploading a new version of a library dataset'
# The form_one template should be inherited to the library dataset upload form.
template_contents = "%s contents for %s 5th new version of 6.bed" % ( form_one_field_label, folder_one.name )
ldda_six_version_two.refresh()
@@ -1103,7 +1101,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
.order_by( desc( galaxy.model.LibraryDatasetDatasetAssociation.table.c.create_time ) ).first()
assert ldda_six_version_five is not None, 'Problem retrieving LibraryDatasetDatasetAssociation ldda_six_version_five from the database'
self.home()
self.visit_url( "%s/library_admin/library_dataset_dataset_association?edit_info=True&library_id=%s&folder_id=%s&id=%s" % \
self.visit_url( "%s/library_admin/ldda_edit_info?library_id=%s&folder_id=%s&obj_id=%s" % \
( self.url, str( library_one.id ), str( subfolder_one.id ), str( ldda_six_version_five.id ) ) )
self.check_page_for_string( 'This is the latest version of this library dataset' )
# Make sure the correct template was inherited
@@ -1120,13 +1118,13 @@ class TestSecurityAndLibraries( TwillTestCase ):
tc.submit( 'edit_info_button' )
self.check_page_for_string( 'The information has been updated.' )
self.check_page_for_string( template_contents )
self.visit_url( "%s/library_admin/library_dataset_dataset_association?info=True&library_id=%s&folder_id=%s&id=%s" % \
self.visit_url( "%s/library_admin/ldda_display_info?library_id=%s&folder_id=%s&obj_id=%s" % \
( self.url, str( library_one.id ), str( subfolder_one.id ), str( ldda_six_version_five.id ) ) )
check_str = 'Expired versions of %s' % ldda_six_version_five.name
self.check_page_for_string( check_str )
self.check_page_for_string( ldda_six.name )
self.home()
# Make sure th permissions are the same
# Make sure the permissions are the same
ldda_six.refresh()
if len( ldda_six.actions ) != len( ldda_six_version_five.actions ):
raise AssertionError( 'ldda "%s" actions "%s" != ldda "%s" actions "%s"' \
@@ -1139,11 +1137,11 @@ class TestSecurityAndLibraries( TwillTestCase ):
raise AssertionError( 'ldda.dataset "%s" actions "%s" != ldda.dataset "%s" actions "%s"' \
% ( ldda_six.name, str( ldda_six.dataset.actions ), ldda_six_version_five.name, str( ldda_six_version_five.dataset.actions ) ) )
# Check the previous version
self.visit_url( "%s/library_admin/library_dataset_dataset_association?info=True&library_id=%s&folder_id=%s&id=%s" % \
self.visit_url( "%s/library_admin/ldda_display_info?library_id=%s&folder_id=%s&obj_id=%s" % \
( self.url, str( library_one.id ), str( subfolder_one.id ), str( ldda_six_version_two.id ) ) )
self.check_page_for_string( 'This is an expired version of this library dataset' )
self.home()
def test_160_upload_directory_of_files_from_admin_view( self ):
def test_155_upload_directory_of_files_from_admin_view( self ):
"""Testing uploading a directory of files to a root folder from the Admin view"""
message = 'This is a test for uploading a directory of files'
template_contents = "%s contents for directory of 3 datasets in %s" % ( form_one_field_label, folder_one.name )
@@ -1156,11 +1154,11 @@ class TestSecurityAndLibraries( TwillTestCase ):
template_field_name1=form_one_field_name,
template_field_contents1=template_contents )
self.home()
self.visit_page( 'library_admin/browse_library?id=%s' % ( str( library_one.id ) ) )
self.visit_page( 'library_admin/browse_library?obj_id=%s' % ( str( library_one.id ) ) )
self.check_page_for_string( admin_user.email )
self.check_page_for_string( message )
self.home()
def test_165_change_permissions_on_datasets_uploaded_from_library_dir( self ):
def test_160_change_permissions_on_datasets_uploaded_from_library_dir( self ):
"""Testing changing the permissions on datasets uploaded from a directory"""
# It would be nice if twill functioned such that the above test resulted in a
# form with the uploaded datasets selected, but it does not ( they're not checked ),
@@ -1176,7 +1174,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
def build_url( permissions, role ):
# We'll bypass the library_admin/datasets method and directly call the library_admin/dataset method, setting
# access, manage permissions, and edit metadata permissions to role_one
url = '/library_admin/library_dataset_dataset_association?permissions=True&id=%s&library_id=%s&folder_id=%s&update_roles_button=Save' % ( ldda_ids, str( library_one.id ), str( folder_one.id ) )
url = '/library_admin/ldda_manage_permissions?obj_id=%s&library_id=%s&folder_id=%s&update_roles_button=Save' % ( ldda_ids, str( library_one.id ), str( folder_one.id ) )
for p in permissions:
url += '&%s_in=%s' % ( p, str( role.id ) )
return url
@@ -1213,7 +1211,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
# access to any of the 3 datasets, so she will not see folder_one on the libraries page
self.login( email='test2@bx.psu.edu' )
self.home()
self.visit_url( '%s/library/browse_library?id=%s' % ( self.url, str( library_one.id ) ) )
self.visit_url( '%s/library/browse_library?obj_id=%s' % ( self.url, str( library_one.id ) ) )
try:
self.check_page_for_string( folder_one.name )
raise AssertionError( '%s can access folder %s even though all contained datasets should be restricted from access by her' \
@@ -1268,7 +1266,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
pass
check_edit_page2( latest_3_lddas )
self.home()
def test_170_upload_directory_of_files_from_libraries_view( self ):
def test_165_upload_directory_of_files_from_libraries_view( self ):
"""Testing uploading a directory of files to a root folder from the Data Libraries view"""
# admin_user will not have the option sto upload a directory of files from the
# Libraries view since a sub-directory named the same as their email is not contained
@@ -1287,7 +1285,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
check_str_after_submit=check_str_after_submit,
message=message.replace( '+', ' ' ) )
self.home()
self.visit_page( 'library/browse_library?id=%s' % ( str( library_one.id ) ) )
self.visit_page( 'library/browse_library?obj_id=%s' % ( str( library_one.id ) ) )
self.check_page_for_string( regular_user1.email )
self.check_page_for_string( message )
self.logout()
@@ -1302,14 +1300,14 @@ class TestSecurityAndLibraries( TwillTestCase ):
check_str_after_submit=check_str_after_submit,
message=message.replace( '+', ' ' ) )
self.home()
self.visit_page( 'library/browse_library?id=%s' % ( str( library_one.id ) ) )
self.visit_page( 'library/browse_library?obj_id=%s' % ( str( library_one.id ) ) )
self.check_page_for_string( regular_user3.email )
self.check_page_for_string( message )
self.home()
self.logout()
self.login( email=admin_user.email )
def test_175_mark_group_deleted( self ):
def test_170_mark_group_deleted( self ):
"""Testing marking a group as deleted"""
self.home()
self.visit_url( '%s/admin/groups' % self.url )
@@ -1323,13 +1321,13 @@ class TestSecurityAndLibraries( TwillTestCase ):
raise AssertionError( '%s incorrectly lost all members when it was marked as deleted.' % group_two.name )
if not group_two.roles:
raise AssertionError( '%s incorrectly lost all role associations when it was marked as deleted.' % group_two.name )
def test_180_undelete_group( self ):
def test_175_undelete_group( self ):
"""Testing undeleting a deleted group"""
self.undelete_group( str( group_two.id ), group_two.name )
group_two.refresh()
if group_two.deleted:
raise AssertionError( '%s was not correctly marked as not deleted.' % group_two.name )
def test_185_mark_role_deleted( self ):
def test_180_mark_role_deleted( self ):
"""Testing marking a role as deleted"""
self.home()
self.visit_url( '%s/admin/roles' % self.url )
@@ -1343,15 +1341,15 @@ class TestSecurityAndLibraries( TwillTestCase ):
raise AssertionError( '%s incorrectly lost all user associations when it was marked as deleted.' % role_two.name )
if not role_two.groups:
raise AssertionError( '%s incorrectly lost all group associations when it was marked as deleted.' % role_two.name )
def test_190_undelete_role( self ):
def test_185_undelete_role( self ):
"""Testing undeleting a deleted role"""
self.undelete_role( str( role_two.id ), role_two.name )
def test_195_mark_dataset_deleted( self ):
def test_190_mark_dataset_deleted( self ):
"""Testing marking a library dataset as deleted"""
self.home()
self.delete_library_item( str( library_one.id ), str( ldda_two.library_dataset.id ), ldda_two.name, library_item_type='library_dataset' )
self.home()
self.visit_page( 'library_admin/browse_library?id=%s' % ( str( library_one.id ) ) )
self.visit_page( 'library_admin/browse_library?obj_id=%s' % ( str( library_one.id ) ) )
try:
# 2.bed was only contained in the library in 1 place, so it should no longer display
self.check_page_for_string( ldda_two.name )
@@ -1359,40 +1357,40 @@ class TestSecurityAndLibraries( TwillTestCase ):
except:
pass
self.home()
def test_200_display_deleted_dataset( self ):
def test_195_display_deleted_dataset( self ):
"""Testing displaying deleted dataset"""
self.home()
self.visit_url( "%s/library_admin/browse_library?id=%s&show_deleted=True" % ( self.url, str( library_one.id ) ) )
self.visit_url( "%s/library_admin/browse_library?obj_id=%s&show_deleted=True" % ( self.url, str( library_one.id ) ) )
self.check_page_for_string( ldda_two.name )
self.home()
def test_205_hide_deleted_dataset( self ):
def test_200_hide_deleted_dataset( self ):
"""Testing hiding deleted dataset"""
self.home()
self.visit_url( "%s/library_admin/browse_library?id=%s&show_deleted=False" % ( self.url, str( library_one.id ) ) )
self.visit_url( "%s/library_admin/browse_library?obj_id=%s&show_deleted=False" % ( self.url, str( library_one.id ) ) )
try:
self.check_page_for_string( ldda_two.name )
raise AssertionError( "Dataset '%s' is incorrectly displayed in the library after it has been deleted." % ldda_two.name )
except:
pass
self.home()
def test_210_mark_folder_deleted( self ):
def test_205_mark_folder_deleted( self ):
"""Testing marking a library folder as deleted"""
self.home()
self.delete_library_item( str( library_one.id ), str( folder_two.id ), folder_two.name, library_item_type='folder' )
self.home()
self.visit_page( 'library_admin/browse_library?id=%s' % ( str( library_one.id ) ) )
self.visit_page( 'library_admin/browse_library?obj_id=%s' % ( str( library_one.id ) ) )
try:
self.check_page_for_string( folder_two.name )
raise AssertionError( "Folder '%s' is incorrectly displayed in the library after it has been deleted." % folder_two.name )
except:
pass
self.home()
def test_215_mark_folder_undeleted( self ):
def test_210_mark_folder_undeleted( self ):
"""Testing marking a library folder as undeleted"""
self.home()
self.undelete_library_item( str( library_one.id ), str( folder_two.id ), folder_two.name, library_item_type='folder' )
self.home()
self.visit_page( 'library_admin/browse_library?id=%s' % ( str( library_one.id ) ) )
self.visit_page( 'library_admin/browse_library?obj_id=%s' % ( str( library_one.id ) ) )
self.check_page_for_string( folder_two.name )
try:
# 2.bed was deleted before the folder was deleted, so state should have been saved. In order
@@ -1402,7 +1400,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
except:
pass
self.home()
def test_220_mark_library_deleted( self ):
def test_215_mark_library_deleted( self ):
"""Testing marking a library as deleted"""
self.home()
# First mark folder_two as deleted to further test state saving when we undelete the library
@@ -1412,12 +1410,12 @@ class TestSecurityAndLibraries( TwillTestCase ):
self.visit_page( 'library_admin/deleted_libraries' )
self.check_page_for_string( library_one.name )
self.home()
def test_225_mark_library_undeleted( self ):
def test_220_mark_library_undeleted( self ):
"""Testing marking a library as undeleted"""
self.home()
self.undelete_library_item( str( library_one.id ), str( library_one.id ), library_one.name, library_item_type='library' )
self.home()
self.visit_page( 'library_admin/browse_library?id=%s' % ( str( library_one.id ) ) )
self.visit_page( 'library_admin/browse_library?obj_id=%s' % ( str( library_one.id ) ) )
self.check_page_for_string( library_one.name )
try:
# folder_two was marked deleted before the library was deleted, so it should not be displayed
@@ -1426,7 +1424,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
except:
pass
self.home()
def test_230_purge_user( self ):
def test_225_purge_user( self ):
"""Testing purging a user account"""
self.mark_user_deleted( user_id=self.security.encode_id( regular_user3.id ), email=regular_user3.email )
regular_user3.refresh()
@@ -1458,7 +1456,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
role = galaxy.model.Role.get( ura.role_id )
if role.type != 'private':
raise AssertionError( 'UserRoleAssociations for user %s are not related with the private role.' % regular_user3.email )
def test_235_manually_unpurge_user( self ):
def test_230_manually_unpurge_user( self ):
"""Testing manually un-purging a user account"""
# Reset the user for later test runs. The user's private Role and DefaultUserPermissions for that role
# should have been preserved, so all we need to do is reset purged and deleted.
@@ -1466,7 +1464,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
regular_user3.purged = False
regular_user3.deleted = False
regular_user3.flush()
def test_240_purge_group( self ):
def test_235_purge_group( self ):
"""Testing purging a group"""
group_id = str( group_two.id )
self.mark_group_deleted( group_id, group_two.name )
@@ -1481,7 +1479,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
raise AssertionError( "Purging the group did not delete the GroupRoleAssociations for group_id '%s'" % group_id )
# Undelete the group for later test runs
self.undelete_group( group_id, group_two.name )
def test_245_purge_role( self ):
def test_240_purge_role( self ):
"""Testing purging a role"""
role_id = str( role_two.id )
self.mark_role_deleted( role_id, role_two.name )
@@ -1506,14 +1504,14 @@ class TestSecurityAndLibraries( TwillTestCase ):
dp = galaxy.model.DatasetPermissions.filter( galaxy.model.DatasetPermissions.table.c.role_id == role_id ).all()
if dp:
raise AssertionError( "Purging the role did not delete the DatasetPermissionss for role_id '%s'" % role_id )
def test_250_manually_unpurge_role( self ):
def test_245_manually_unpurge_role( self ):
"""Testing manually un-purging a role"""
# Manually unpurge, then undelete the role for later test runs
# TODO: If we decide to implement the GUI feature for un-purging a role, replace this with a method call
role_two.purged = False
role_two.flush()
self.undelete_role( str( role_two.id ), role_two.name )
def test_255_purge_library( self ):
def test_250_purge_library( self ):
"""Testing purging a library"""
self.home()
self.delete_library_item( str( library_one.id ), str( library_one.id ), library_one.name, library_item_type='library' )
@@ -1549,7 +1547,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
raise AssertionError( 'The library_dataset id %s named "%s" has not been marked as deleted.' % \
( str( library_dataset.id ), library_dataset.name ) )
check_folder( library_one.root_folder )
def test_260_no_library_template( self ):
def test_255_no_library_template( self ):
"""Test library features when library has no template"""
name = "Library Two"
description = "This is Library Two"
@@ -1575,7 +1573,7 @@ class TestSecurityAndLibraries( TwillTestCase ):
.order_by( desc( galaxy.model.LibraryDatasetDatasetAssociation.table.c.create_time ) ).first()
assert ldda_seven is not None, 'Problem retrieving LibraryDatasetDatasetAssociation ldda_seven from the database'
self.home()
self.visit_url( '%s/library_admin/browse_library?id=%s' % ( self.url, str( library_two.id ) ) )
self.visit_url( '%s/library_admin/browse_library?obj_id=%s' % ( self.url, str( library_two.id ) ) )
self.check_page_for_string( "7.bed" )
self.check_page_for_string( admin_user.email )
# TODO: add a functional test to cover adding a library dataset via url_paste here...
@@ -1585,6 +1583,23 @@ class TestSecurityAndLibraries( TwillTestCase ):
self.delete_library_item( str( library_two.id ), str( library_two.id ), library_two.name, library_item_type='library' )
self.purge_library( str( library_two.id ), library_two.name )
self.home()
def test_260_library_permissions( self ):
"""Test library permissions"""
name = "Library Three"
description = "This is Library Three"
# Create a library, adding no template
self.create_library( name=name, description=description )
self.visit_page( 'library_admin/browse_libraries' )
self.check_page_for_string( name )
self.check_page_for_string( description )
library_three = galaxy.model.Library.filter( and_( galaxy.model.Library.table.c.name==name,
galaxy.model.Library.table.c.description==description,
galaxy.model.Library.table.c.deleted==False ) ).first()
assert library_three is not None, 'Problem retrieving library named "%s" from the database' % name
# TODO: add tests here...
self.home()
self.delete_library_item( str( library_three.id ), str( library_three.id ), library_three.name, library_item_type='library' )
self.purge_library( str( library_three.id ), library_three.name )
def test_265_reset_data_for_later_test_runs( self ):
"""Reseting data to enable later test runs to pass"""
##################