diff --git a/client/galaxy/scripts/mvc/toolshed/repository-view.js b/client/galaxy/scripts/mvc/toolshed/repository-view.js index a0507194d90..d31a5364fc3 100644 --- a/client/galaxy/scripts/mvc/toolshed/repository-view.js +++ b/client/galaxy/scripts/mvc/toolshed/repository-view.js @@ -48,7 +48,7 @@ var ToolShedRepositoryView = Backbone.View.extend({ this.options.tps_select_options = this.templatePanelSelectOptions; this.options.tool_dependencies = models.get("tool_dependencies"); this.options.shed_tool_conf = this.templateShedToolConf({ - stc_html: models.get("shed_conf") + shed_tool_confs: models.get("shed_conf") }); this.options.panel_section_dict = models.get("panel_section_dict"); this.options.api_url = `${Galaxy.root}api/tool_shed_repositories/install?async=True`; @@ -474,7 +474,11 @@ var ToolShedRepositoryView = Backbone.View.extend({ '
Shed tool configuration file:
', '
', '
', - "<%= stc_html %>", + '', '
Select the file whose tool_path setting you want used for installing repositories.
', "
", "
" diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 79628c559af..225c8205499 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -5,7 +5,6 @@ Naming: try to use class names that have a distinct plural form so that the relationship cardinalities are obvious (e.g. prefer Dataset to Data) """ import errno -import json import logging import numbers import operator @@ -30,8 +29,8 @@ from galaxy.managers import tags from galaxy.model.item_attrs import UsesAnnotations from galaxy.model.util import pgcalc from galaxy.security import get_permitted_actions -from galaxy.util import (directory_hash_id, Params, ready_name_for_url, - restore_text, unicodify, unique_id) +from galaxy.util import (directory_hash_id, ready_name_for_url, + unicodify, unique_id) from galaxy.util.bunch import Bunch from galaxy.util.dictifiable import Dictifiable from galaxy.util.hash_util import new_secure_hash @@ -2667,32 +2666,6 @@ class Library(object, Dictifiable, HasName): active_folders.extend(self.get_active_folders(active_folder, folders)) return sort_by_attr(active_folders, 'id') - def get_info_association(self, restrict=False, inherited=False): - if self.info_association: - if not inherited or self.info_association[0].inheritable: - return self.info_association[0], inherited - else: - return None, inherited - return None, inherited - - def get_template_widgets(self, trans, get_contents=True): - # See if we have any associated templates - the returned value for - # inherited is not applicable at the library level. The get_contents - # param is passed by callers that are inheriting a template - these - # are usually new library datsets for which we want to include template - # fields on the upload form, but not necessarily the contents of the - # inherited template saved for the parent. - info_association, inherited = self.get_info_association() - if info_association: - template = info_association.template - if get_contents: - # See if we have any field contents - info = info_association.info - if info: - return template.get_widgets(trans.user, contents=info.content) - return template.get_widgets(trans.user) - return [] - def get_access_roles(self, trans): roles = [] for lp in self.actions: @@ -2723,51 +2696,6 @@ class LibraryFolder(object, Dictifiable, HasName): folder.order_id = self.item_count self.item_count += 1 - def get_info_association(self, restrict=False, inherited=False): - # If restrict is True, we will return this folder's info_association, not inheriting. - # If restrict is False, we'll return the next available info_association in the - # inheritable hierarchy if it is "inheritable". True is also returned if the - # info_association was inherited and False if not. This enables us to eliminate - # displaying any contents of the inherited template. - if self.info_association: - if not inherited or self.info_association[0].inheritable: - return self.info_association[0], inherited - else: - return None, inherited - if restrict: - return None, inherited - if self.parent: - return self.parent.get_info_association(inherited=True) - if self.library_root: - return self.library_root[0].get_info_association(inherited=True) - return None, inherited - - def get_template_widgets(self, trans, get_contents=True): - # See if we have any associated templates. The get_contents - # param is passed by callers that are inheriting a template - these - # are usually new library datsets for which we want to include template - # fields on the upload form. - info_association, inherited = self.get_info_association() - if info_association: - if inherited: - template = info_association.template.current.latest_form - else: - template = info_association.template - # See if we have any field contents, but only if the info_association was - # not inherited ( we do not want to display the inherited contents ). - # (gvk: 8/30/10) Based on conversations with Dan, we agreed to ALWAYS inherit - # contents. We'll use this behavior until we hear from the community that - # contents should not be inherited. If we don't hear anything for a while, - # eliminate the old commented out behavior. - # if not inherited and get_contents: - if get_contents: - info = info_association.info - if info: - return template.get_widgets(trans.user, info.content) - else: - return template.get_widgets(trans.user) - return [] - @property def activatable_library_datasets(self): # This needs to be a list @@ -2775,13 +2703,6 @@ class LibraryFolder(object, Dictifiable, HasName): def to_dict(self, view='collection', value_mapper=None): rval = super(LibraryFolder, self).to_dict(view=view, value_mapper=value_mapper) - info_association, inherited = self.get_info_association() - if info_association: - if inherited: - template = info_association.template.current.latest_form - else: - template = info_association.template - rval['data_template'] = template.name rval['library_path'] = self.library_path rval['parent_library_id'] = self.parent_library.id return rval @@ -2855,15 +2776,6 @@ class LibraryDataset(object): # display in other objects, we can't use the simpler method used by # other model classes. ldda = self.library_dataset_dataset_association - template_data = {} - for temp_info in ldda.info_association: - template = temp_info.template - content = temp_info.info.content - tmp_dict = {} - for field in template.fields: - tmp_dict[field['label']] = content[field['name']] - template_data[template.name] = tmp_dict - rval = dict(id=self.id, ldda_id=ldda.id, parent_library_id=self.folder.parent_library.id, @@ -2881,8 +2793,7 @@ class LibraryDataset(object): genome_build=ldda.dbkey, misc_info=ldda.info, misc_blurb=ldda.blurb, - peek=(lambda ldda: ldda.display_peek() if ldda.peek and ldda.peek != 'no peek' else None)(ldda), - template_data=template_data) + peek=(lambda ldda: ldda.display_peek() if ldda.peek and ldda.peek != 'no peek' else None)(ldda)) if ldda.dataset.uuid is None: rval['uuid'] = None else: @@ -2987,19 +2898,6 @@ class LibraryDatasetDatasetAssociation(DatasetInstance, HasName): def has_manage_permissions_roles(self, trans): return self.dataset.has_manage_permissions_roles(trans) - def get_info_association(self, restrict=False, inherited=False): - # If restrict is True, we will return this ldda's info_association whether it - # exists or not ( in which case None will be returned ). If restrict is False, - # we'll return the next available info_association in the inheritable hierarchy. - # True is also returned if the info_association was inherited, and False if not. - # This enables us to eliminate displaying any contents of the inherited template. - # SM: Accessing self.info_association can cause a query to be emitted - if self.info_association: - return self.info_association[0], inherited - if restrict: - return None, inherited - return self.library_dataset.folder.get_info_association(inherited=True) - def to_dict(self, view='collection'): # Since this class is a proxy to rather complex attributes we want to # display in other objects, we can't use the simpler method used by @@ -3044,55 +2942,6 @@ class LibraryDatasetDatasetAssociation(DatasetInstance, HasName): rval['metadata_' + name] = val return rval - def get_template_widgets(self, trans, get_contents=True): - # See if we have any associated templatesThe get_contents - # param is passed by callers that are inheriting a template - these - # are usually new library datsets for which we want to include template - # fields on the upload form, but not necessarily the contents of the - # inherited template saved for the parent. - info_association, inherited = self.get_info_association() - if info_association: - if inherited: - template = info_association.template.current.latest_form - else: - template = info_association.template - # See if we have any field contents, but only if the info_association was - # not inherited ( we do not want to display the inherited contents ). - # (gvk: 8/30/10) Based on conversations with Dan, we agreed to ALWAYS inherit - # contents. We'll use this behavior until we hear from the community that - # contents should not be inherited. If we don't hear anything for a while, - # eliminate the old commented out behavior. - # if not inherited and get_contents: - if get_contents: - info = info_association.info - if info: - return template.get_widgets(trans.user, info.content) - else: - return template.get_widgets(trans.user) - return [] - - def templates_dict(self, use_name=False): - """ - Returns a dict of template info - """ - # TODO: Should have a method that allows names and labels to be returned together in a structured way - template_data = {} - for temp_info in self.info_association: - template = temp_info.template - content = temp_info.info.content - tmp_dict = {} - for field in template.fields: - if use_name: - name = field['name'] - else: - name = field['label'] - tmp_dict[name] = content.get(field['name']) - template_data[template.name] = tmp_dict - return template_data - - def templates_json(self, use_name=False): - return json.dumps(self.templates_dict(use_name=use_name)) - class ExtendedMetadata(object): def __init__(self, data): @@ -4450,98 +4299,6 @@ class FormDefinition(object, Dictifiable): gridfields[i] = f return gridfields - def get_widgets(self, user, contents={}, **kwd): - ''' - Return the list of widgets that comprise a form definition, - including field contents if any. - ''' - params = Params(kwd) - widgets = [] - for index, field in enumerate(self.fields): - field_type = field['type'] - if 'name' in field: - field_name = field['name'] - else: - # Default to names like field_0, field_1, etc for backward compatibility - # (not sure this is necessary)... - field_name = 'field_%i' % index - # Determine the value of the field - if field_name in kwd: - # The form was submitted via refresh_on_change - if field_type == 'CheckboxField': - value = CheckboxField.is_checked(params.get(field_name, False)) - else: - value = restore_text(params.get(field_name, '')) - elif contents: - try: - # This field has a saved value. - value = str(contents[field['name']]) - except Exception: - # If there was an error getting the saved value, we'll still - # display the widget, but it will be empty. - if field_type == 'AddressField': - value = 'none' - elif field_type == 'CheckboxField': - # Since we do not have contents, set checkbox value to False - value = False - else: - # Set other field types to empty string - value = '' - else: - # If none of the above, then leave the field empty - if field_type == 'AddressField': - value = 'none' - elif field_type == 'CheckboxField': - # Since we do not have contents, set checkbox value to False - value = False - else: - # Set other field types to the default value of the field - value = field.get('default', '') - # Create the field widget - field_widget = eval(field_type)(field_name) - if field_type in ['TextField', 'PasswordField']: - field_widget.set_size(40) - field_widget.value = value - elif field_type == 'TextArea': - field_widget.set_size(3, 40) - field_widget.value = value - elif field_type in ['AddressField', 'WorkflowField', 'WorkflowMappingField', 'HistoryField']: - field_widget.user = user - field_widget.value = value - field_widget.params = params - elif field_type == 'SelectField': - for option in field['selectlist']: - if option == value: - field_widget.add_option(option, option, selected=True) - else: - field_widget.add_option(option, option) - elif field_type == 'CheckboxField': - field_widget.set_checked(value) - if field['required'] == 'required': - req = 'Required' - else: - req = 'Optional' - if field['helptext']: - helptext = '%s (%s)' % (field['helptext'], req) - else: - helptext = '(%s)' % req - widgets.append(dict(label=field['label'], widget=field_widget, helptext=helptext)) - return widgets - - def field_as_html(self, field): - """Generates disabled html for a field""" - type = field['type'] - form_field = None - for field_type in self.supported_field_types: - if type == field_type.__name__: - # Name it AddressField, CheckboxField, etc. - form_field = field_type(type) - break - if form_field: - return form_field.get_html(disabled=True) - # Return None if unsupported field type - return None - class FormDefinitionCurrent(object): def __init__(self, form_definition=None): @@ -4581,30 +4338,6 @@ class UserAddress(object): 'country' : sanitize_html(self.country), 'phone' : sanitize_html(self.phone)} - def get_html(self): - # This should probably be deprecated eventually. It should currently - # sanitize. - # TODO Find out where else uses this and replace with - # templates - html = '' - if self.name: - html = html + sanitize_html(self.name) - if self.institution: - html = html + '
' + sanitize_html(self.institution) - if self.address: - html = html + '
' + sanitize_html(self.address) - if self.city: - html = html + '
' + sanitize_html(self.city) - if self.state: - html = html + ' ' + sanitize_html(self.state) - if self.postal_code: - html = html + ' ' + sanitize_html(self.postal_code) - if self.country: - html = html + '
' + sanitize_html(self.country) - if self.phone: - html = html + '
' + 'phone: ' + sanitize_html(self.phone) - return html - class UserOpenID(object): def __init__(self, user=None, session=None, openid=None): diff --git a/lib/galaxy/model/metadata.py b/lib/galaxy/model/metadata.py index ba937e61391..817a1a809e9 100644 --- a/lib/galaxy/model/metadata.py +++ b/lib/galaxy/model/metadata.py @@ -227,29 +227,6 @@ class MetadataParameter(object): other_values = other_values or {} return form_builder.TextField(self.spec.name, value=value) - def get_html(self, value, context=None, other_values=None, **kwd): - """ - The "context" is simply the metadata collection/bunch holding - this piece of metadata. This is passed in to allow for - metadata to validate against each other (note: this could turn - into a huge, recursive mess if not done with care). For - example, a column assignment should validate against the - number of columns in the dataset. - """ - context = context or {} - other_values = other_values or {} - - if self.spec.get("readonly"): - return value - if self.spec.get("optional"): - checked = False - if value: - checked = "true" - checkbox = form_builder.CheckboxField("is_" + self.spec.name, checked=checked) - return checkbox.get_html() + self.get_field(value=value, context=context, other_values=other_values, **kwd).get_html() - else: - return self.get_field(value=value, context=context, other_values=other_values, **kwd).get_html() - def to_string(self, value): return str(value) @@ -390,16 +367,6 @@ class SelectParameter(MetadataParameter): field.add_option(val, label, selected=False) return field - def get_html(self, value, context=None, other_values=None, values=None, **kwd): - context = context or {} - other_values = other_values or {} - - if self.spec.get("readonly"): - if value in [None, []]: - return str(self.spec.no_value) - return ", ".join(map(str, value)) - return MetadataParameter.get_html(self, value, context=context, other_values=other_values, values=values, **kwd) - def wrap(self, value, session): # do we really need this (wasteful)? - yes because we are not sure that # all existing selects have been stored previously as lists. Also this @@ -433,15 +400,6 @@ class DBKeyParameter(SelectParameter): pass return super(DBKeyParameter, self).get_field(value, context, other_values, values, **kwd) - def get_html(self, value=None, context=None, other_values=None, values=None, **kwd): - context = context or {} - other_values = other_values or {} - try: - values = kwd['trans'].app.genome_builds.get_genome_build_names(kwd['trans']) - except KeyError: - pass - return super(DBKeyParameter, self).get_html(value, context, other_values, values, **kwd) - class RangeParameter(SelectParameter): @@ -460,14 +418,6 @@ class RangeParameter(SelectParameter): values = list(zip(range(self.min, self.max, self.step), range(self.min, self.max, self.step))) return SelectParameter.get_field(self, value=value, context=context, other_values=other_values, values=values, **kwd) - def get_html(self, value, context=None, other_values=None, values=None, **kwd): - context = context or {} - other_values = other_values or {} - - if values is None: - values = list(zip(range(self.min, self.max, self.step), range(self.min, self.max, self.step))) - return SelectParameter.get_html(self, value, context=context, other_values=other_values, values=values, **kwd) - @classmethod def marshal(cls, value): value = SelectParameter.marshal(value) @@ -486,15 +436,6 @@ class ColumnParameter(RangeParameter): values = list(zip(column_range, column_range)) return RangeParameter.get_field(self, value=value, context=context, other_values=other_values, values=values, **kwd) - def get_html(self, value, context=None, other_values=None, values=None, **kwd): - context = context or {} - other_values = other_values or {} - - if values is None and context: - column_range = range(1, (context.columns or 0) + 1, 1) - values = list(zip(column_range, column_range)) - return RangeParameter.get_html(self, value, context=context, other_values=other_values, values=values, **kwd) - class ColumnTypesParameter(MetadataParameter): @@ -530,11 +471,6 @@ class PythonObjectParameter(MetadataParameter): other_values = other_values or {} return form_builder.TextField(self.spec.name, value=self._to_string(value)) - def get_html(self, value=None, context=None, other_values=None, **kwd): - context = context or {} - other_values = other_values or {} - return str(self) - @classmethod def marshal(cls, value): return value @@ -556,11 +492,6 @@ class FileParameter(MetadataParameter): other_values = other_values or {} return form_builder.TextField(self.spec.name, value=str(value.id)) - def get_html(self, value=None, context=None, other_values=None, **kwd): - context = context or {} - other_values = other_values or {} - return "
No display available for Metadata Files
" - def wrap(self, value, session): if value is None: return None diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index 6cc79b47b36..660f4786963 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -309,11 +309,9 @@ class ToolBox(BaseGalaxyToolBox): def __build_tool_version_select_field(self, tools, tool_id, set_selected): """Build a SelectField whose options are the ids for the received list of tools.""" options = [] - refresh_on_change_values = [] for tool in tools: options.insert(0, (tool.version, tool.id)) - refresh_on_change_values.append(tool.id) - select_field = SelectField(name='tool_id', refresh_on_change=True, refresh_on_change_values=refresh_on_change_values) + select_field = SelectField(name='tool_id') for option_tup in options: selected = set_selected and option_tup[1] == tool_id if selected: @@ -1042,8 +1040,6 @@ class Tool(object, Dictifiable): group.default_file_type = elem.get('default_file_type', group.default_file_type) group.metadata_ref = elem.get('metadata_ref', group.metadata_ref) rval[group.file_type_name].refresh_on_change = True - rval[group.file_type_name].refresh_on_change_values = \ - self.app.datatypes_registry.get_composite_extensions() group_page_source = XmlPageSource(elem) group.inputs = self.parse_input_elem(group_page_source, enctypes, context) rval[group.name] = group diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index 6022318a2c2..5ae79a7e303 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -75,7 +75,6 @@ class ToolParameter(object, Dictifiable): def __init__(self, tool, input_source, context=None): input_source = ensure_input_source(input_source) self.tool = tool - self.refresh_on_change_values = [] self.argument = input_source.get("argument") self.name = self.__class__.parse_name(input_source) self.type = input_source.get("type") diff --git a/lib/galaxy/web/__init__.py b/lib/galaxy/web/__init__.py index a522f38e040..a7284fffafe 100644 --- a/lib/galaxy/web/__init__.py +++ b/lib/galaxy/web/__init__.py @@ -23,10 +23,6 @@ from .framework.decorators import ( require_admin, require_login ) -from .framework.formbuilder import ( - form, - FormBuilder -) __all__ = ('url_for', 'error', 'expose', 'json', 'json_pretty', 'require_admin', 'require_login', 'expose_api', 'expose_api_anonymous', diff --git a/lib/galaxy/web/form_builder.py b/lib/galaxy/web/form_builder.py index c0c49f9af0b..506ed5cc0f7 100644 --- a/lib/galaxy/web/form_builder.py +++ b/lib/galaxy/web/form_builder.py @@ -4,14 +4,9 @@ Classes for generating HTML forms from __future__ import print_function import logging -from cgi import escape - -from six import string_types from galaxy.util import ( - asbool, - restore_text, - unicodify + asbool ) log = logging.getLogger(__name__) @@ -29,16 +24,6 @@ class BaseField(object): self.optional = kwds.get('required', 'optional') == 'optional' self.help = kwds.get('helptext') - def get_html(self, prefix=""): - """Returns the html widget corresponding to the parameter""" - raise TypeError("Abstract Method") - - def get_disabled_str(self, disabled=False): - if disabled: - return ' disabled="disabled"' - else: - return '' - def to_dict(self): return { 'name' : self.name, @@ -53,25 +38,7 @@ class BaseField(object): class TextField(BaseField): """ A standard text input box. - - >>> print(TextField( "foo" ).get_html()) - - >>> print(TextField( "bins", size=4, value="default" ).get_html()) - """ - - def __init__(self, name, size=None, value=None, **kwds): - super(TextField, self).__init__(name, value, **kwds) - self.size = int(size or 10) - - def get_html(self, prefix="", disabled=False): - value = unicodify(self.value or "") - return unicodify('' - % (prefix, self.name, self.size, escape(value, quote=True), self.get_disabled_str(disabled))) - - def set_size(self, size): - self.size = int(size) - def to_dict(self): d = super(TextField, self).to_dict() d['type'] = 'text' @@ -81,26 +48,7 @@ class TextField(BaseField): class PasswordField(BaseField): """ A password input box. text appears as "******" - - >>> print(PasswordField( "foo" ).get_html()) - - >>> print(PasswordField( "bins", size=4, value="default" ).get_html()) - """ - - def __init__(self, name, size=None, value=None, **kwds): - super(PasswordField, self).__init__(name, value, **kwds) - self.name = name - self.size = int(size or 10) - self.value = value or "" - - def get_html(self, prefix="", disabled=False): - return unicodify('' - % (prefix, self.name, self.size, escape(str(self.value), quote=True), self.get_disabled_str(disabled))) - - def set_size(self, size): - self.size = int(size) - def to_dict(self): d = super(PasswordField, self).to_dict() d['type'] = 'password' @@ -110,31 +58,7 @@ class PasswordField(BaseField): class TextArea(BaseField): """ A standard text area box. - - >>> print(TextArea( "foo" ).get_html()) - - >>> print(TextArea( "bins", size="4x5", value="default" ).get_html()) - """ - _DEFAULT_SIZE = "5x25" - - def __init__(self, name, size=None, value=None, **kwds): - super(TextArea, self).__init__(name, value, **kwds) - self.name = name - size = size or self._DEFAULT_SIZE - self.size = size.split("x") - self.rows = int(self.size[0]) - self.cols = int(self.size[-1]) - self.value = value or "" - - def get_html(self, prefix="", disabled=False): - return unicodify('' - % (prefix, self.name, self.rows, self.cols, self.get_disabled_str(disabled), escape(str(self.value), quote=True))) - - def set_size(self, rows, cols): - self.rows = rows - self.cols = cols - def to_dict(self): d = super(TextArea, self).to_dict() d['type'] = 'text' @@ -145,46 +69,12 @@ class TextArea(BaseField): class CheckboxField(BaseField): """ A checkbox (boolean input) - - >>> print(CheckboxField( "foo" ).get_html()) - - >>> print(CheckboxField( "bar", checked="yes" ).get_html()) - """ - - def __init__(self, name, checked=None, refresh_on_change=False, refresh_on_change_values=None, value=None, **kwds): - super(CheckboxField, self).__init__(name, value, **kwds) - self.name = name - self.checked = (checked is True) or (isinstance(checked, string_types) and (checked.lower() in ("yes", "true", "on"))) - self.refresh_on_change = refresh_on_change - self.refresh_on_change_values = refresh_on_change_values or [] - if self.refresh_on_change: - self.refresh_on_change_text = ' refresh_on_change="true" ' - if self.refresh_on_change_values: - self.refresh_on_change_text = '%s refresh_on_change_values="%s" ' % (self.refresh_on_change_text, ",".join(self.refresh_on_change_values)) - else: - self.refresh_on_change_text = '' - - def get_html(self, prefix="", disabled=False): - if self.checked: - checked_text = ' checked="checked"' - else: - checked_text = '' - id_name = prefix + self.name - return unicodify('' - % (id_name, id_name, checked_text, self.get_disabled_str(disabled), self.refresh_on_change_text, id_name, self.get_disabled_str(disabled))) - @staticmethod def is_checked(value): - if value in [True, "true"]: + if value in [True, "True", "true"]: return True - return isinstance(value, list) and ('__CHECKED__' in value or len(value) == 2) - - def set_checked(self, value): - if isinstance(value, string_types): - self.checked = value.lower() in ["yes", "true", "on"] - else: - self.checked = value + return False def to_dict(self): d = super(CheckboxField, self).to_dict() @@ -192,122 +82,17 @@ class CheckboxField(BaseField): return d -class FileField(BaseField): - """ - A file upload input. - - >>> print(FileField( "foo" ).get_html()) - - >>> print(FileField( "foo", ajax = True ).get_html()) - - """ - - def __init__(self, name, value=None, ajax=False, **kwds): - super(FileField, self).__init__(name, value, **kwds) - self.name = name - self.ajax = ajax - self.value = value - - def get_html(self, prefix=""): - value_text = "" - if self.value: - value_text = ' value="%s"' % escape(str(self.value), quote=True) - ajax_text = "" - if self.ajax: - ajax_text = ' galaxy-ajax-upload="true"' - return unicodify('' % (prefix, self.name, ajax_text, value_text)) - - -class GenomespaceFileField(BaseField): - """ - A genomspace file browser field. - """ - def __init__(self, name, value=None): - self.name = name - self.value = value or "" - - def get_html(self, prefix=""): - return unicodify('' - ' ' - '' - 'Browse'.format(prefix, self.name, escape(str(self.value), quote=True))) - - def to_dict(self): - return dict(name=self.name, - token_field=self.token_field) - - -class HiddenField(BaseField): - """ - A hidden field. - - >>> print(HiddenField( "foo", 100 ).get_html()) - - """ - - def __init__(self, name, value=None, **kwds): - super(HiddenField, self).__init__(name, value, **kwds) - self.name = name - self.value = value or "" - - def get_html(self, prefix=""): - return unicodify('' % (prefix, self.name, escape(str(self.value), quote=True))) - - def to_dict(self): - d = super(HiddenField, self).to_dict() - d['type'] = 'hidden' - d['hidden'] = True - return d - - class SelectField(BaseField): """ A select field. - - >>> t = SelectField( "foo", multiple=True ) - >>> t.add_option( "tuti", 1 ) - >>> t.add_option( "fruity", "x" ) - >>> print(t.get_html()) - - - >>> t = SelectField( "bar" ) - >>> t.add_option( "automatic", 3 ) - >>> t.add_option( "bazooty", 4, selected=True ) - >>> print(t.get_html()) - - - >>> t = SelectField( "foo", display="radio" ) - >>> t.add_option( "tuti", 1 ) - >>> t.add_option( "fruity", "x" ) - >>> print(t.get_html()) -
-
- - >>> t = SelectField( "bar", multiple=True, display="checkboxes" ) - >>> t.add_option( "automatic", 3 ) - >>> t.add_option( "bazooty", 4, selected=True ) - >>> print(t.get_html()) -
-
-
""" - def __init__(self, name, multiple=None, display=None, refresh_on_change=False, refresh_on_change_values=None, size=None, field_id=None, value=None, selectlist=None, **kwds): + def __init__(self, name, multiple=None, display=None, field_id=None, value=None, selectlist=None, refresh_on_change=False, **kwds): super(SelectField, self).__init__(name, value, **kwds) - self.name = name self.field_id = field_id self.multiple = multiple or False + self.refresh_on_change = refresh_on_change self.selectlist = selectlist or [] - self.value = value - self.size = size self.options = list() if display == "checkboxes": assert multiple, "Checkbox display only supported for multiple select" @@ -316,136 +101,10 @@ class SelectField(BaseField): elif display is not None: raise Exception("Unknown display type: %s" % display) self.display = display - self.refresh_on_change = refresh_on_change - self.refresh_on_change_values = refresh_on_change_values or [] - if self.refresh_on_change: - self.refresh_on_change_text = ' refresh_on_change="true"' - if self.refresh_on_change_values: - self.refresh_on_change_text = '%s refresh_on_change_values="%s"' % (self.refresh_on_change_text, escape(",".join(self.refresh_on_change_values), quote=True)) - else: - self.refresh_on_change_text = '' def add_option(self, text, value, selected=False): self.options.append((text, value, selected)) - def get_html(self, prefix="", disabled=False, extra_attr=None): - if extra_attr is not None: - self.extra_attributes = ' %s' % ' '.join(['%s="%s"' % (k, escape(v)) for k, v in extra_attr.items()]) - else: - self.extra_attributes = '' - if self.display == "checkboxes": - return self.get_html_checkboxes(prefix, disabled) - elif self.display == "radio": - return self.get_html_radio(prefix, disabled) - else: - return self.get_html_default(prefix, disabled) - - def get_html_checkboxes(self, prefix="", disabled=False): - rval = [] - ctr = 0 - if len(self.options) > 1: - rval.append('
' % (prefix, self.name)) # placeholder for the insertion of the Select All/Unselect All buttons - for text, value, selected in self.options: - style = "" - text = unicodify(text) - escaped_value = escape(unicodify(value), quote=True) - uniq_id = "%s%s|%s" % (prefix, self.name, escaped_value) - if len(self.options) > 2 and ctr % 2 == 1: - style = " class=\"odd_row\"" - selected_text = "" - if selected: - selected_text = " checked='checked'" - rval.append('' - % (style, prefix, self.name, escaped_value, uniq_id, selected_text, self.get_disabled_str(disabled), self.extra_attributes, uniq_id, escape(text, quote=True))) - ctr += 1 - return unicodify("\n".join(rval)) - - def get_html_radio(self, prefix="", disabled=False): - rval = [] - ctr = 0 - for text, value, selected in self.options: - style = "" - escaped_value = escape(str(value), quote=True) - uniq_id = "%s%s|%s" % (prefix, self.name, escaped_value) - if len(self.options) > 2 and ctr % 2 == 1: - style = " class=\"odd_row\"" - selected_text = "" - if selected: - selected_text = " checked='checked'" - rval.append('' - % (style, - prefix, - self.name, - self.refresh_on_change_text, - escaped_value, - uniq_id, - selected_text, - self.get_disabled_str(disabled), - self.extra_attributes, - uniq_id, - text)) - ctr += 1 - return unicodify("\n".join(rval)) - - def get_html_default(self, prefix="", disabled=False): - if self.multiple: - multiple = " multiple" - else: - multiple = "" - if self.size: - size = ' size="%s"' % str(self.size) - else: - size = '' - rval = [] - last_selected_value = "" - for text, value, selected in self.options: - if selected: - selected_text = " selected" - last_selected_value = value - if not isinstance(last_selected_value, string_types): - last_selected_value = str(last_selected_value) - else: - selected_text = "" - rval.append('' % (escape(unicodify(value), quote=True), selected_text, escape(unicodify(text), quote=True))) - if last_selected_value: - last_selected_value = ' last_selected_value="%s"' % escape(unicodify(last_selected_value), quote=True) - if self.field_id is not None: - id_string = ' id="%s"' % self.field_id - else: - id_string = '' - rval.insert(0, '') - return unicodify("\n".join(rval)) - - def get_selected(self, return_label=False, return_value=False, multi=False): - ''' - Return the currently selected option's label, value or both as a tuple. For - multi-select lists, a list is returned. - ''' - if multi: - selected_options = [] - for label, value, selected in self.options: - if selected: - if return_label and return_value: - if multi: - selected_options.append((label, value)) - else: - return (label, value) - elif return_label: - if multi: - selected_options.append(label) - else: - return label - elif return_value: - if multi: - selected_options.append(value) - else: - return value - if multi: - return selected_options - return None - def to_dict(self): d = super(SelectField, self).to_dict() d['type'] = 'select' @@ -470,63 +129,10 @@ class AddressField(BaseField): ("country", "Country", ""), ("phone", "Phone", "")] - def __init__(self, name, user=None, value=None, params=None, security=None, **kwds): + def __init__(self, name, user=None, value=None, security=None, **kwds): super(AddressField, self).__init__(name, value, **kwds) self.user = user self.security = security - self.select_address = None - self.params = params - - def get_html(self, disabled=False): - address_html = '' - add_ids = ['none'] - if self.user: - for a in self.user.addresses: - add_ids.append(str(a.id)) - add_ids.append('new') - self.select_address = SelectField(self.name, - refresh_on_change=True, - refresh_on_change_values=add_ids) - if self.value == 'none': - self.select_address.add_option('Select one', 'none', selected=True) - else: - self.select_address.add_option('Select one', 'none') - if self.user: - for a in self.user.addresses: - if not a.deleted: - if self.value == str(a.id): - self.select_address.add_option(a.desc, str(a.id), selected=True) - # Display this address - address_html += ''' -
- %s -
- ''' % a.get_html() - else: - self.select_address.add_option(a.desc, str(a.id)) - if self.value == 'new': - self.select_address.add_option('Add a new address', 'new', selected=True) - for field_name, label, help_text in self.fields(): - add_field = TextField(self.name + '_' + field_name, - 40, - restore_text(self.params.get(self.name + '_' + field_name, ''))) - address_html += ''' -
- - %s - ''' % (label, add_field.get_html(disabled=disabled)) - if help_text: - address_html += ''' -
- %s -
- ''' % help_text - address_html += ''' -
- ''' - else: - self.select_address.add_option('Add a new address', 'new') - return self.select_address.get_html(disabled=disabled) + address_html def to_dict(self): d = super(AddressField, self).to_dict() @@ -540,29 +146,11 @@ class AddressField(BaseField): class WorkflowField(BaseField): - def __init__(self, name, user=None, value=None, params=None, security=None, **kwds): + def __init__(self, name, user=None, value=None, security=None, **kwds): super(WorkflowField, self).__init__(name, value, **kwds) - self.name = name self.user = user self.value = value self.security = security - self.select_workflow = None - self.params = params - - def get_html(self, disabled=False): - self.select_workflow = SelectField(self.name) - if self.value == 'none': - self.select_workflow.add_option('Select one', 'none', selected=True) - else: - self.select_workflow.add_option('Select one', 'none') - if self.user: - for a in self.user.stored_workflows: - if not a.deleted: - if str(self.value) == str(a.id): - self.select_workflow.add_option(a.name, str(a.id), selected=True) - else: - self.select_workflow.add_option(a.name, str(a.id)) - return self.select_workflow.get_html(disabled=disabled) def to_dict(self): d = super(WorkflowField, self).to_dict() @@ -576,70 +164,17 @@ class WorkflowField(BaseField): class WorkflowMappingField(BaseField): - def __init__(self, name, user=None, value=None, params=None, **kwd): - # DBTODO integrate this with the new __build_workflow approach in requests_common. As it is, not particularly useful. - self.name = name + def __init__(self, name, user=None, value=None, **kwds): + super(WorkflowMappingField, self).__init__(name, value, **kwds) self.user = user - self.value = value - self.select_workflow = None - self.params = params - self.workflow_inputs = [] - - def get_html(self, disabled=False): - self.select_workflow = SelectField(self.name, refresh_on_change=True) - workflow_inputs = [] - if self.value == 'none': - self.select_workflow.add_option('Select one', 'none', selected=True) - else: - self.select_workflow.add_option('Select one', 'none') - if self.user: - for a in self.user.stored_workflows: - if not a.deleted: - if str(self.value) == str(a.id): - self.select_workflow.add_option(a.name, str(a.id), selected=True) - else: - self.select_workflow.add_option(a.name, str(a.id)) - if self.value and self.value != 'none': - # Workflow selected. Find all inputs. - for workflow in self.user.stored_workflows: - if workflow.id == int(self.value): - for step in workflow.latest_workflow.steps: - if step.type == 'data_input': - if step.tool_inputs and "name" in step.tool_inputs: - workflow_inputs.append((step.tool_inputs['name'], TextField('%s_%s' % (self.name, step.id), 20))) - # Do something more appropriate here and allow selection of inputs - return self.select_workflow.get_html(disabled=disabled) + ''.join(['
%s
' % (s[0], s[1].get_html()) for s in workflow_inputs]) class HistoryField(BaseField): - def __init__(self, name, user=None, value=None, params=None, security=None, **kwds): + def __init__(self, name, user=None, value=None, security=None, **kwds): super(HistoryField, self).__init__(name, value, **kwds) - self.name = name self.user = user self.value = value self.security = security - self.select_history = None - self.params = params - - def get_html(self, disabled=False): - self.select_history = SelectField(self.name) - if self.value == 'none': - self.select_history.add_option('No Import', 'none', selected=True) - self.select_history.add_option('New History', 'new') - else: - self.select_history.add_option('No Import', 'none') - if self.value == 'new': - self.select_history.add_option('New History', 'new', selected=True) - else: - self.select_history.add_option('New History', 'new') - if self.user: - for a in self.user.histories: - if not a.deleted: - if str(self.value) == str(a.id): - self.select_history.add_option(a.name, str(a.id), selected=True) - else: - self.select_history.add_option(a.name, str(a.id)) - return self.select_history.get_html(disabled=disabled) def to_dict(self): d = super(HistoryField, self).to_dict() @@ -657,55 +192,3 @@ def get_suite(): import doctest import sys return doctest.DocTestSuite(sys.modules[__name__]) - - -# --------- Utility methods ----------------------------- -def build_select_field(trans, objs, label_attr, select_field_name, initial_value='none', - selected_value='none', refresh_on_change=False, multiple=False, display=None, size=None): - """ - Build a SelectField given a set of objects. The received params are: - - - objs: the set of objects used to populate the option list - - label_attr: the attribute of each obj (e.g., name, email, etc ) whose value is used to populate each option label. - - - If the string 'self' is passed as label_attr, each obj in objs is assumed to be a string, so the obj itself is used - - - select_field_name: the name of the SelectField - - initial_value: the value of the first option in the SelectField - allows for an option telling the user to select something - - selected_value: the value of the currently selected option - - refresh_on_change: True if the SelectField should perform a refresh_on_change - """ - if initial_value == 'none': - values = [initial_value] - else: - values = [] - for obj in objs: - if label_attr == 'self': - # Each obj is a string - values.append(obj) - else: - values.append(trans.security.encode_id(obj.id)) - if refresh_on_change: - refresh_on_change_values = values - else: - refresh_on_change_values = [] - select_field = SelectField(name=select_field_name, - multiple=multiple, - display=display, - refresh_on_change=refresh_on_change, - refresh_on_change_values=refresh_on_change_values, - size=size) - for obj in objs: - if label_attr == 'self': - # Each obj is a string - if str(selected_value) == str(obj): - select_field.add_option(obj, obj, selected=True) - else: - select_field.add_option(obj, obj) - else: - label = getattr(obj, label_attr) - if str(selected_value) == str(obj.id) or str(selected_value) == trans.security.encode_id(obj.id): - select_field.add_option(label, trans.security.encode_id(obj.id), selected=True) - else: - select_field.add_option(label, trans.security.encode_id(obj.id)) - return select_field diff --git a/lib/galaxy/web/framework/formbuilder.py b/lib/galaxy/web/framework/formbuilder.py deleted file mode 100644 index 1603e3bf4a8..00000000000 --- a/lib/galaxy/web/framework/formbuilder.py +++ /dev/null @@ -1,91 +0,0 @@ -import logging - -from galaxy.util import bunch - -log = logging.getLogger(__name__) - - -def form(*args, **kwargs): - return FormBuilder(*args, **kwargs) - - -class FormBuilder(object): - """ - Simple class describing an HTML form - """ - - def __init__(self, action="", title="", name="form", submit_text="submit", use_panels=False): - self.title = title - self.name = name - self.action = action - self.submit_text = submit_text - self.inputs = [] - self.use_panels = use_panels - - def add_input(self, type, name, label, value=None, error=None, help=None, use_label=True): - self.inputs.append(FormInput(type, label, name, value, error, help, use_label)) - return self - - def add_checkbox(self, name, label, value=None, error=None, help=None): - return self.add_input('checkbox', label, name, value, error, help) - - def add_text(self, name, label, value=None, error=None, help=None): - return self.add_input('text', label, name, value, error, help) - - def add_password(self, name, label, value=None, error=None, help=None): - return self.add_input('password', label, name, value, error, help) - - def add_select(self, name, label, value=None, options=[], error=None, help=None, use_label=True): - self.inputs.append(SelectInput(name, label, value=value, options=options, error=error, help=help, use_label=use_label)) - return self - - -class FormInput(object): - """ - Simple class describing a form input element - """ - - def __init__(self, type, name, label, value=None, error=None, help=None, use_label=True, extra_attributes={}, **kwargs): - self.type = type - self.name = name - self.label = label - self.value = value - self.error = error - self.help = help - self.use_label = use_label - self.extra_attributes = extra_attributes - - -class DatalistInput(FormInput): - """ Data list input """ - - def __init__(self, name, *args, **kwargs): - if 'extra_attributes' not in kwargs: - kwargs['extra_attributes'] = {} - kwargs['extra_attributes']['list'] = name - FormInput.__init__(self, None, name, *args, **kwargs) - self.options = kwargs.get('options', {}) - - def body_html(self): - options = "".join(["" % (key, value) for key, value in self.options.iteritems()]) - return """%s""" % (self.name, options) - - -class SelectInput(FormInput): - """ A select form input. """ - - def __init__(self, name, label, value=None, options=[], error=None, help=None, use_label=True): - FormInput.__init__(self, "select", name, label, value=value, error=error, help=help, use_label=use_label) - self.options = options - - -class FormData(object): - """ - Class for passing data about a form to a template, very rudimentary, could - be combined with the tool form handling to build something more general. - """ - - def __init__(self): - # TODO: galaxy's two Bunchs are defined differently. Is this right? - self.values = bunch.Bunch() - self.errors = bunch.Bunch() diff --git a/lib/galaxy/web/framework/webapp.py b/lib/galaxy/web/framework/webapp.py index 831474246a1..91491195bf4 100644 --- a/lib/galaxy/web/framework/webapp.py +++ b/lib/galaxy/web/framework/webapp.py @@ -33,7 +33,6 @@ from galaxy.util import ( from galaxy.util.sanitize_html import sanitize_html from galaxy.web.framework import ( base, - formbuilder, helpers, url_for ) @@ -103,8 +102,6 @@ class WebApplication(base.WebApplication): return trans.show_message(sanitize_html(e.err_msg), e.type) def make_body_iterable(self, trans, body): - if isinstance(body, formbuilder.FormBuilder): - body = trans.show_form(body) return base.WebApplication.make_body_iterable(self, trans, body) def transaction_chooser(self, environ, galaxy_app, session_cookie): @@ -875,15 +872,6 @@ class GalaxyWebTransaction(base.DefaultWebTransaction, """ return self.show_message(message, 'warning', refresh_frames, use_panels=use_panels, active_view=active_view) - def show_form(self, form, header=None, template="form.mako", use_panels=False, active_view=""): - """ - Convenience method for displaying a simple page with a single HTML - form. - """ - return self.fill_template(template, form=form, header=header, - use_panels=(form.use_panels or use_panels), - active_view=active_view) - @property def session_csrf_token(self): token = '' diff --git a/lib/galaxy/webapps/galaxy/api/library_contents.py b/lib/galaxy/webapps/galaxy/api/library_contents.py index 70f51b5a88d..befe4263a56 100644 --- a/lib/galaxy/webapps/galaxy/api/library_contents.py +++ b/lib/galaxy/webapps/galaxy/api/library_contents.py @@ -32,10 +32,6 @@ from galaxy.web.base.controller import ( UsesLibraryMixin, UsesLibraryMixinItems ) -from galaxy.web.form_builder import ( - AddressField, - CheckboxField, -) log = logging.getLogger(__name__) @@ -300,18 +296,12 @@ class LibraryContentsController(BaseAPIController, UsesLibraryMixin, UsesLibrary roles = kwd.get('roles', '') is_admin = trans.user_is_admin() current_user_roles = trans.get_current_user_roles() - widgets = [] - info_association, inherited = None, None - template_id = "None" if replace_id not in ['', None, 'None']: replace_dataset = trans.sa_session.query(trans.app.model.LibraryDataset).get(trans.security.decode_id(replace_id)) self._check_access(trans, is_admin, replace_dataset, current_user_roles) self._check_modify(trans, is_admin, replace_dataset, current_user_roles) library = replace_dataset.folder.parent_library folder = replace_dataset.folder - info_association, inherited = replace_dataset.library_dataset_dataset_association.get_info_association() - if info_association and (not(inherited) or info_association.inheritable): - widgets = replace_dataset.library_dataset_dataset_association.get_template_widgets(trans) # The name is stored - by the time the new ldda is created, replace_dataset.name # will point to the new ldda, not the one it's replacing. if not last_used_build: @@ -342,56 +332,9 @@ class LibraryContentsController(BaseAPIController, UsesLibraryMixin, UsesLibrary if error: return 400, message else: - # See if we have any inherited templates. - if not info_association: - info_association, inherited = folder.get_info_association(inherited=True) - if info_association and info_association.inheritable: - template_id = str(info_association.template.id) - widgets = folder.get_template_widgets(trans, get_contents=True) - processed_widgets = [] - # The list of widgets may include an AddressField which we need to save if it is new - for index, widget_dict in enumerate(widgets): - widget = widget_dict['widget'] - if isinstance(widget, AddressField): - value = kwd.get(widget.name, '') - if value == 'new': - if self.field_param_values_ok(widget.name, 'AddressField', **kwd): - # Save the new address - address = trans.app.model.UserAddress(user=trans.user) - self.save_widget_field(trans, address, widget.name, **kwd) - widget.value = str(address.id) - widget_dict['widget'] = widget - processed_widgets.append(widget_dict) - # It is now critical to update the value of 'field_%i', replacing the string - # 'new' with the new address id. This is necessary because the upload_dataset() - # method below calls the handle_library_params() method, which does not parse the - # widget fields, it instead pulls form values from kwd. See the FIXME comments in the - # handle_library_params() method, and the CheckboxField code in the next conditional. - kwd[widget.name] = str(address.id) - else: - # The invalid address won't be saved, but we cannot display error - # messages on the upload form due to the ajax upload already occurring. - # When we re-engineer the upload process ( currently under way ), we - # will be able to check the form values before the ajax upload occurs - # in the background. For now, we'll do nothing... - pass - elif isinstance(widget, CheckboxField): - # We need to check the value from kwd since util.Params would have munged the list if - # the checkbox is checked. - value = kwd.get(widget.name, '') - if CheckboxField.is_checked(value): - widget.value = 'true' - widget_dict['widget'] = widget - processed_widgets.append(widget_dict) - kwd[widget.name] = 'true' - else: - processed_widgets.append(widget_dict) - widgets = processed_widgets created_outputs_dict = self._upload_dataset(trans, library_id=trans.security.encode_id(library.id), folder_id=trans.security.encode_id(folder.id), - template_id=template_id, - widgets=widgets, replace_dataset=replace_dataset, **kwd) if created_outputs_dict: diff --git a/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py b/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py index 5ffbdcfe1b2..60f6e4833af 100644 --- a/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py +++ b/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py @@ -263,8 +263,7 @@ class ToolShedRepositoriesController(BaseAPIController): else: repository_data['repository'] = json.loads(util.url_get(tool_shed_url, pathspec=['api', 'repositories', tsr_id])) repository_data['repository']['metadata'] = json.loads(util.url_get(tool_shed_url, pathspec=['api', 'repositories', tsr_id, 'metadata'])) - repository_data['shed_conf'] = tool_util.build_shed_tool_conf_select_field(trans.app).get_html().replace('\n', '') - repository_data['panel_section_html'] = tool_panel_section_select_field.get_html(extra_attr={'style': 'width: 30em;'}).replace('\n', '') + repository_data['shed_conf'] = tool_util.build_shed_tool_conf_select_field(trans.app).to_dict() repository_data['panel_section_dict'] = tool_panel_section_dict for changeset, metadata in repository_data['repository']['metadata'].items(): if changeset not in tool_dependencies: diff --git a/lib/galaxy/webapps/galaxy/api/toolshed.py b/lib/galaxy/webapps/galaxy/api/toolshed.py index c06360dbc66..2ecb92a5a99 100644 --- a/lib/galaxy/webapps/galaxy/api/toolshed.py +++ b/lib/galaxy/webapps/galaxy/api/toolshed.py @@ -252,8 +252,7 @@ class ToolShedController(BaseAPIController): else: repository_data['repository'] = json.loads(util.url_get(tool_shed_url, pathspec=['api', 'repositories', repository_id])) repository_data['repository']['metadata'] = json.loads(util.url_get(tool_shed_url, pathspec=['api', 'repositories', repository_id, 'metadata'])) - repository_data['shed_conf'] = tool_util.build_shed_tool_conf_select_field(trans.app).get_html().replace('\n', '') - repository_data['panel_section_html'] = tool_panel_section_select_field.get_html(extra_attr={'style': 'width: 30em;'}).replace('\n', '') + repository_data['shed_conf'] = tool_util.build_shed_tool_conf_select_field(trans.app).to_dict() repository_data['panel_section_dict'] = tool_panel_section_dict for changeset, metadata in repository_data['repository']['metadata'].items(): if changeset not in tool_dependencies: diff --git a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py index f9306436e45..c8d2c278d41 100644 --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -239,7 +239,7 @@ class AdminToolshed(AdminGalaxy): message += 'Attempting to uninstall tool dependencies resulted in errors: %s' % errors status = max(status, statuses.index('error')) status = statuses[status] - remove_from_disk_check_box = CheckboxField('remove_from_disk', checked=remove_from_disk_checked) + remove_from_disk_check_box = CheckboxField('remove_from_disk', value=remove_from_disk_checked) return trans.fill_template('/admin/tool_shed_repository/deactivate_or_uninstall_repository.mako', repository=tool_shed_repositories, remove_from_disk_check_box=remove_from_disk_check_box, @@ -535,10 +535,10 @@ class AdminToolshed(AdminGalaxy): else: install_tool_dependencies_check_box_checked = True install_tool_dependencies_check_box = CheckboxField('install_tool_dependencies', - checked=install_tool_dependencies_check_box_checked) + value=install_tool_dependencies_check_box_checked) view = views.DependencyResolversView(self.app) if view.installable_resolvers: - install_resolver_dependencies_check_box = CheckboxField('install_resolver_dependencies', checked=True) + install_resolver_dependencies_check_box = CheckboxField('install_resolver_dependencies', value=True) else: install_resolver_dependencies_check_box = None return trans.fill_template('/admin/tool_shed_repository/install_tool_dependencies_with_update.mako', @@ -1054,12 +1054,12 @@ class AdminToolshed(AdminGalaxy): else: install_tool_dependencies_check_box_checked = True install_tool_dependencies_check_box = CheckboxField('install_tool_dependencies', - checked=install_tool_dependencies_check_box_checked) + value=install_tool_dependencies_check_box_checked) # Handle repository dependencies check box. - install_repository_dependencies_check_box = CheckboxField('install_repository_dependencies', checked=True) + install_repository_dependencies_check_box = CheckboxField('install_repository_dependencies', value=True) view = views.DependencyResolversView(self.app) if view.installable_resolvers: - install_resolver_dependencies_check_box = CheckboxField('install_resolver_dependencies', checked=True) + install_resolver_dependencies_check_box = CheckboxField('install_resolver_dependencies', value=True) else: install_resolver_dependencies_check_box = None encoded_repo_info_dicts = encoding_util.encoding_sep.join(encoded_repo_info_dicts) @@ -1392,7 +1392,7 @@ class AdminToolshed(AdminGalaxy): else: original_section_name = '' tool_panel_section_select_field = tool_util.build_tool_panel_section_select_field(trans.app) - no_changes_check_box = CheckboxField('no_changes', checked=True) + no_changes_check_box = CheckboxField('no_changes', value=True) if original_section_name: message += "The tools contained in your %s repository were last loaded into the tool panel section %s. " \ % (escape(tool_shed_repository.name), original_section_name) @@ -1423,7 +1423,7 @@ class AdminToolshed(AdminGalaxy): # whether installed or missing. containers_dict = dd.merge_missing_repository_dependencies_to_installed_container(containers_dict) # Handle repository dependencies check box. - install_repository_dependencies_check_box = CheckboxField('install_repository_dependencies', checked=True) + install_repository_dependencies_check_box = CheckboxField('install_repository_dependencies', value=True) # Handle tool dependencies check box. if trans.app.config.tool_dependency_dir is None: if includes_tool_dependencies: @@ -1433,10 +1433,10 @@ class AdminToolshed(AdminGalaxy): install_tool_dependencies_check_box_checked = False else: install_tool_dependencies_check_box_checked = True - install_tool_dependencies_check_box = CheckboxField('install_tool_dependencies', checked=install_tool_dependencies_check_box_checked) + install_tool_dependencies_check_box = CheckboxField('install_tool_dependencies', value=install_tool_dependencies_check_box_checked) view = views.DependencyResolversView(self.app) if view.installable_resolvers: - install_resolver_dependencies_check_box = CheckboxField('install_resolver_dependencies', checked=True) + install_resolver_dependencies_check_box = CheckboxField('install_resolver_dependencies', value=True) else: install_resolver_dependencies_check_box = None return trans.fill_template('/admin/tool_shed_repository/reselect_tool_panel_section.mako', diff --git a/lib/galaxy/webapps/tool_shed/controllers/repository.py b/lib/galaxy/webapps/tool_shed/controllers/repository.py index 427856037c7..7b5606b90bb 100644 --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -20,7 +20,7 @@ from galaxy import ( ) from galaxy.tools.repositories import ValidationContext from galaxy.web.base.controller import BaseUIController -from galaxy.web.form_builder import CheckboxField +from galaxy.web.form_builder import CheckboxField, SelectField from galaxy.web.framework.helpers import grids from galaxy.webapps.tool_shed.util import ratings_util from tool_shed.capsule import capsule_manager @@ -974,7 +974,7 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings): repository_dependencies, repository_metadata, exclude=exclude) - export_repository_dependencies_check_box = CheckboxField('export_repository_dependencies', checked=True) + export_repository_dependencies_check_box = CheckboxField('export_repository_dependencies', value=True) else: containers_dict = None export_repository_dependencies_check_box = None @@ -1084,7 +1084,7 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings): else: message = "No search performed - each field must contain the same number of comma-separated items." status = "error" - exact_matches_check_box = CheckboxField('exact_matches', checked=exact_matches_checked) + exact_matches_check_box = CheckboxField('exact_matches', value=exact_matches_checked) return trans.fill_template('/webapps/tool_shed/repository/find_tools.mako', tool_id=basic_util.stringify(tool_ids), tool_name=basic_util.stringify(tool_names), @@ -1176,7 +1176,7 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings): else: exact_matches_checked = False workflow_names = [] - exact_matches_check_box = CheckboxField('exact_matches', checked=exact_matches_checked) + exact_matches_check_box = CheckboxField('exact_matches', value=exact_matches_checked) return trans.fill_template('/webapps/tool_shed/repository/find_workflows.mako', workflow_name=basic_util.stringify(workflow_names), exact_matches_check_box=exact_matches_check_box, @@ -1824,7 +1824,7 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings): else: message = 'You will not receive any email alerts for new valid tool shed repositories.' checked = new_repo_alert_checked or (user and user.new_repo_alert) - new_repo_alert_check_box = CheckboxField('new_repo_alert', checked=checked) + new_repo_alert_check_box = CheckboxField('new_repo_alert', value=checked) email_alert_repositories = [] for repository in trans.sa_session.query(trans.model.Repository) \ .filter(and_(trans.model.Repository.table.c.deleted == false(), @@ -1931,14 +1931,22 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings): message = "The repository information has been updated." if error: status = 'error' + allow_push_select_field = SelectField(name='allow_push', + multiple=True) current_allow_push = repository.allow_push(trans.app) if current_allow_push: current_allow_push_list = current_allow_push.split(',') else: current_allow_push_list = [] - allow_push_select_field = repository_util.build_allow_push_select_field(trans, current_allow_push_list) + options = [] + for user in trans.sa_session.query(trans.model.User): + if user.username not in current_allow_push_list: + options.append(user) + for obj in options: + label = getattr(obj, 'username') + allow_push_select_field.add_option(label, trans.security.encode_id(obj.id)) checked = alerts_checked or user.email in email_alerts - alerts_check_box = CheckboxField('alerts', checked=checked) + alerts_check_box = CheckboxField('alerts', value=checked) changeset_revision_select_field = grids_util.build_changeset_revision_select_field(trans, repository, selected_value=changeset_revision, @@ -2001,7 +2009,7 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings): message += malicious_error status = 'error' repository_type_select_field = rt_util.build_repository_type_select_field(trans, repository=repository) - malicious_check_box = CheckboxField('malicious', checked=is_malicious) + malicious_check_box = CheckboxField('malicious', value=is_malicious) categories = suc.get_categories(trans.app) selected_categories = [_rca.category_id for _rca in repository.categories] tsucm = ToolShedUtilityContainerManager(trans.app) @@ -2821,7 +2829,7 @@ class RepositoryController(BaseUIController, ratings_util.ItemRatings): trans.sa_session.add(repository) trans.sa_session.flush() checked = alerts_checked or (user and user.email in email_alerts) - alerts_check_box = CheckboxField('alerts', checked=checked) + alerts_check_box = CheckboxField('alerts', value=checked) changeset_revision_select_field = grids_util.build_changeset_revision_select_field(trans, repository, selected_value=changeset_revision, diff --git a/lib/galaxy/webapps/tool_shed/controllers/repository_review.py b/lib/galaxy/webapps/tool_shed/controllers/repository_review.py index b404f9fdbbe..a5c15816d87 100644 --- a/lib/galaxy/webapps/tool_shed/controllers/repository_review.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository_review.py @@ -278,6 +278,7 @@ class RepositoryReviewController(BaseUIController, ratings_util.ItemRatings): # The star rating form field is a radio button list, so it will not be received if it was not clicked in the form. # Due to this behavior, default the value to 0. rating = 0 + private = False for k, v in kwd.items(): if k.startswith('%s%s' % (component_name, STRSEP)): component_review_attr = k.replace('%s%s' % (component_name, STRSEP), '') diff --git a/lib/tool_shed/galaxy_install/metadata/installed_repository_metadata_manager.py b/lib/tool_shed/galaxy_install/metadata/installed_repository_metadata_manager.py index fc2f50dc0a9..20299bc27ea 100644 --- a/lib/tool_shed/galaxy_install/metadata/installed_repository_metadata_manager.py +++ b/lib/tool_shed/galaxy_install/metadata/installed_repository_metadata_manager.py @@ -12,7 +12,6 @@ from tool_shed.util import common_util from tool_shed.util import repository_util from tool_shed.util import tool_util from tool_shed.util import xml_util - log = logging.getLogger(__name__) diff --git a/lib/tool_shed/grids/repository_grids.py b/lib/tool_shed/grids/repository_grids.py index e305bfb8e59..d4228adb59e 100644 --- a/lib/tool_shed/grids/repository_grids.py +++ b/lib/tool_shed/grids/repository_grids.py @@ -110,7 +110,11 @@ class RepositoryGrid(grids.Grid): # A repository's metadata revisions may not all be installable, as some may contain only invalid tools. select_field = grids_util.build_changeset_revision_select_field(trans, repository, downloadable=False) if len(select_field.options) > 1: - return select_field.get_html() + tmpl = "" + return tmpl elif len(select_field.options) == 1: option_items = select_field.options[0][0] rev_label, rev_date = option_items.split(' ') @@ -1331,7 +1335,11 @@ class ValidRepositoryGrid(RepositoryGrid): """Display a SelectField whose options are the changeset_revision strings of all download-able revisions of this repository.""" select_field = grids_util.build_changeset_revision_select_field(trans, repository, downloadable=True) if len(select_field.options) > 1: - return select_field.get_html() + tmpl = "" + return tmpl elif len(select_field.options) == 1: return select_field.options[0][0] return '' diff --git a/lib/tool_shed/grids/util.py b/lib/tool_shed/grids/util.py index 810a0ab42b9..fc2ee84ea48 100644 --- a/lib/tool_shed/grids/util.py +++ b/lib/tool_shed/grids/util.py @@ -71,9 +71,7 @@ def build_changeset_revision_select_field(trans, repository, selected_value=None name = 'changeset_revision_%d' % repository.id else: name = 'changeset_revision' - select_field = SelectField(name=name, - refresh_on_change=True, - refresh_on_change_values=refresh_on_change_values) + select_field = SelectField(name=name, refresh_on_change=True) for option_tup in options: selected = selected_value and option_tup[1] == selected_value select_field.add_option(option_tup[0], option_tup[1], selected=selected) diff --git a/lib/tool_shed/util/hg_util.py b/lib/tool_shed/util/hg_util.py index f979e73c8cc..30b3e5e4d02 100644 --- a/lib/tool_shed/util/hg_util.py +++ b/lib/tool_shed/util/hg_util.py @@ -54,6 +54,7 @@ def clone_repository(repository_clone_url, repository_file_dir, ctx_rev): Clone the repository up to the specified changeset_revision. No subsequent revisions will be present in the cloned repository. """ + stdouterr = None try: stdouterr = subprocess.check_output(['hg', 'clone', '-r', ctx_rev, repository_clone_url, repository_file_dir], stderr=subprocess.STDOUT) return True, None diff --git a/lib/tool_shed/util/repository_util.py b/lib/tool_shed/util/repository_util.py index 9e3c870d3fc..23d39f2f08b 100644 --- a/lib/tool_shed/util/repository_util.py +++ b/lib/tool_shed/util/repository_util.py @@ -11,7 +11,6 @@ import tool_shed.dependencies.repository import tool_shed.util.metadata_util as metadata_util from galaxy import util from galaxy import web -from galaxy.web.form_builder import build_select_field from tool_shed.util import basic_util, common_util, encoding_util, hg_util from tool_shed.util.web_util import escape @@ -20,20 +19,6 @@ log = logging.getLogger(__name__) VALID_REPOSITORYNAME_RE = re.compile("^[a-z0-9\_]+$") -def build_allow_push_select_field(trans, current_push_list, selected_value='none'): - options = [] - for user in trans.sa_session.query(trans.model.User): - if user.username not in current_push_list: - options.append(user) - return build_select_field(trans, - objs=options, - label_attr='username', - select_field_name='allow_push', - selected_value=selected_value, - refresh_on_change=False, - multiple=True) - - def change_repository_name_in_hgrc_file(hgrc_file, new_name): config = configparser.ConfigParser() config.read(hgrc_file) diff --git a/lib/tool_shed/util/tool_dependency_util.py b/lib/tool_shed/util/tool_dependency_util.py index e470f9fffd8..3b83716a515 100644 --- a/lib/tool_shed/util/tool_dependency_util.py +++ b/lib/tool_shed/util/tool_dependency_util.py @@ -6,8 +6,10 @@ from sqlalchemy import and_ from galaxy import util from galaxy.web.form_builder import SelectField -from tool_shed.util import hg_util -from tool_shed.util import xml_util +from tool_shed.util import ( + hg_util, + xml_util +) log = logging.getLogger(__name__) diff --git a/static/scripts/bundled/adminToolshed.bundled.js b/static/scripts/bundled/adminToolshed.bundled.js index cd09499b9dd..cb6b84ceaa7 100644 --- a/static/scripts/bundled/adminToolshed.bundled.js +++ b/static/scripts/bundled/adminToolshed.bundled.js @@ -47,7 +47,14 @@ r=i,l=e("
",{css:{position:"absolute",top:"-200px",left:s?"0px":"-1000px", if(v === 'i' && !ins.is_loaded(p)) { } */ <<<<<<< HEAD +<<<<<<< HEAD +p=!0,_=0,f=o.data.nodes.length;_e.inArray(o.data.nodes[_],v.children)&&(m-=1)),!(p=p&&(w&&w.settings&&w.settings.dnd&&!1===w.settings.dnd.check_while_dragging||w.check(g,o.data.origin&&o.data.origin!==w?o.data.origin.get_node(o.data.nodes[_]):o.data.nodes[_],c,m,{dnd:!0,ref:w.get_node(x.parent()),pos:j,is_multi:o.data.origin&&o.data.origin!==w,is_foreign:!o.data.origin})))){w&&w.last_error&&(i=w.last_error());break}if(p)return"i"===j&&x.parent().is(".jstree-closed")&&w.settings.dnd.open_timeout&&(s=setTimeout(function(e,t){return function(){e.open_node(t)}}(w,x),w.settings.dnd.open_timeout)),t={ins:w,par:c,pos:"i"!==j||"last"!==b||0!==h||w.is_loaded(y)?h:"last"},n.css({left:r+"px",top:l+"px"}).show(),o.helper.find(".jstree-icon:eq(0)").removeClass("jstree-er").addClass("jstree-ok"),i={},u=!0,!1}),!0===u))return}else{for(p=!0,_=0,f=o.data.nodes.length;_
").html(n).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),e(document).bind("mousemove touchmove",e.vakata.dnd.drag),e(document).bind("mouseup touchend",e.vakata.dnd.stop),!1},drag:function(i){if("touchmove"===i.type&&i.originalEvent&&i.originalEvent.changedTouches&&i.originalEvent.changedTouches[0]&&(i.pageX=i.originalEvent.changedTouches[0].pageX,i.pageY=i.originalEvent.changedTouches[0].pageY,i.target=document.elementFromPoint(i.originalEvent.changedTouches[0].pageX-window.pageXOffset,i.originalEvent.changedTouches[0].pageY-window.pageYOffset)),t.is_down){if(!t.is_drag){if(!(Math.abs(i.pageX-t.init_x)>(t.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)||Math.abs(i.pageY-t.init_y)>(t.is_touch?e.vakata.dnd.settings.threshold_touch:e.vakata.dnd.settings.threshold)))return;t.helper&&(t.helper.appendTo("body"),t.helper_w=t.helper.outerWidth()),t.is_drag=!0,e.vakata.dnd._trigger("start",i)}var s=!1,n=!1,a=!1,o=!1,r=!1,l=!1,d=!1,c=!1,h=!1,u=!1;return t.scroll_t=0,t.scroll_l=0,t.scroll_e=!1,e(e(i.target).parentsUntil("body").addBack().get().reverse()).filter(function(){return/^auto|scroll$/.test(e(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var s=e(this),n=s.offset();if(this.scrollHeight>this.offsetHeight&&(n.top+s.height()-i.pageYthis.offsetWidth&&(n.left+s.width()-i.pageXo&&i.pageY-do&&o-(i.pageY-d)l&&i.pageX-cl&&l-(i.pageX-c)a&&(h=a-50),r&&u+t.helper_w>r&&(u=r-(t.helper_w+2)),t.helper.css({left:u+"px",top:h+"px"})),e.vakata.dnd._trigger("move",i),!1}},stop:function(i){if("touchend"===i.type&&i.originalEvent&&i.originalEvent.changedTouches&&i.originalEvent.changedTouches[0]&&(i.pageX=i.originalEvent.changedTouches[0].pageX,i.pageY=i.originalEvent.changedTouches[0].pageY,i.target=document.elementFromPoint(i.originalEvent.changedTouches[0].pageX-window.pageXOffset,i.originalEvent.changedTouches[0].pageY-window.pageYOffset)),t.is_drag)e.vakata.dnd._trigger("stop",i);else if("touchend"===i.type&&i.target===t.target){var s=setTimeout(function(){e(i.target).click()},100);e(i.target).one("click",function(){s&&clearTimeout(s)})}return e.vakata.dnd._clean(),!1}}}(e),e.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},e.jstree.plugins.search=function(t,i){this.bind=function(){i.bind.call(this),this._data.search.str="",this._data.search.dom=e(),this._data.search.res=[],this._data.search.opn=[],this.element.on("before_open.jstree",e.proxy(function(t,i){var s,n,a=this._data.search.res,o=[],r=e();if(a&&a.length&&(this._data.search.dom=e(this.element[0].querySelectorAll("#"+e.map(a,function(t){return-1!=="0123456789".indexOf(t[0])?"\\3"+t[0]+" "+t.substr(1).replace(e.jstree.idregex,"\\$&"):t.replace(e.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.dom.children(".jstree-anchor").addClass("jstree-search"),this.settings.search.show_only_matches&&this._data.search.res.length)){for(s=0,n=a.length;s32&&(i.fuzzy=!1),i.fuzzy&&(s=1<=_;l--)if(m=n[t.charAt(l-1)],g[l]=0===o?(g[l+1]<<1|1)&m:(g[l+1]<<1|1)&m|(p[l+1]|p[l])<<1|1|p[l+1],g[l]&s&&(x=a(o,l-1))<=b){if(b=x,y=l-1,k.push(y),!(y>r))break;_=Math.max(1,2*r-y)}if(a(o+1,r)>b)break;p=g}return{isMatch:y>=0,score:x}},!0===t?{search:o}:o(t)}}(e),e.jstree.defaults.sort=function(e,t){return this.get_text(e)>this.get_text(t)?1:-1},e.jstree.plugins.sort=function(t,i){this.bind=function(){i.bind.call(this),this.element.on("model.jstree",e.proxy(function(e,t){this.sort(t.parent,!0)},this)).on("rename_node.jstree create_node.jstree",e.proxy(function(e,t){this.sort(t.parent||t.node.parent,!1),this.redraw_node(t.parent||t.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",e.proxy(function(e,t){this.sort(t.parent,!1),this.redraw_node(t.parent,!0)},this))},this.sort=function(t,i){var s,n;if((t=this.get_node(t))&&t.children&&t.children.length&&(t.children.sort(e.proxy(this.settings.sort,this)),i))for(s=0,n=t.children_d.length;st.ttl)&&(t&&t.state&&(t=t.state),t&&e.isFunction(this.settings.state.filter)&&(t=this.settings.state.filter.call(this,t)),!!t&&(this.element.one("set_state.jstree",function(i,s){s.instance.trigger("restore_state",{state:e.extend(!0,{},t)})}),this.set_state(t),!0))},this.clear_state=function(){return e.vakata.storage.del(this.settings.state.key)}},function(e,t){e.vakata.storage={set:function(e,t){return window.localStorage.setItem(e,t)},get:function(e){return window.localStorage.getItem(e)},del:function(e){return window.localStorage.removeItem(e)}}}(e),e.jstree.defaults.types={"#":{},default:{}},e.jstree.plugins.types=function(i,s){this.init=function(e,i){var n,a;if(i&&i.types&&i.types.default)for(n in i.types)if("default"!==n&&"#"!==n&&i.types.hasOwnProperty(n))for(a in i.types.default)i.types.default.hasOwnProperty(a)&&i.types[n][a]===t&&(i.types[n][a]=i.types.default[a]);s.init.call(this,e,i),this._model.data["#"].type="#"},this.refresh=function(e,t){s.refresh.call(this,e,t),this._model.data["#"].type="#"},this.bind=function(){this.element.on("model.jstree",e.proxy(function(e,i){var s,n,a=this._model.data,o=i.nodes,r=this.settings.types,l="default";for(s=0,n=o.length;s .jstree-ocl",e.proxy(function(t){t.stopImmediatePropagation();var i=e.Event("click",{metaKey:t.metaKey,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey});e(t.currentTarget).closest(".jstree-node").children(".jstree-anchor:eq(0)").trigger(i).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",e.proxy(function(e){return e.stopImmediatePropagation(),this.hover_node(e.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",e.proxy(function(e){this.dehover_node(e.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),i.teardown.call(this)},this.redraw_node=function(t,s,n){if(t=i.redraw_node.call(this,t,s,n)){var a=_.cloneNode(!0);-1!==e.inArray(t.id,this._data.core.selected)&&(a.className+=" jstree-wholerow-clicked"),t.insertBefore(a,t.childNodes[0])}return t}}}})},20:function(e,t,i){"use strict";(function(e,s,n){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(3),r=(a(o),i(11)),l=a(r),d=i(4),c=a(d),h=i(48),u=a(h),p=i(44),_=a(p);t.default=e.View.extend({initialize:function(t){this.model=new e.Model({initial_errors:!1,cls:"ui-portlet-limited",icon:null,always_refresh:!0,status:"warning",hide_operations:!1,onchange:function(){}}).set(t),this.setElement("
"),this.render()},update:function(e){var t=this;this.data.matchModel(e,function(e,i){var n=t.input_list[i];if(n&&n.options&&!s.isEqual(n.options,e.options)){n.options=e.options;var a=t.field_list[i];if(a.update){var o=[];if(-1!=["data","data_collection","drill_down"].indexOf(n.type))o=n.options;else for(var r in e.options){var l=e.options[r];l.length>2&&o.push({label:l[0],value:l[1]})}a.update(o),a.trigger("change"),Galaxy.emit.debug("form-view::update()","Updating options for "+i)}}})},wait:function(e){for(var t in this.input_list){var i=this.field_list[t];this.input_list[t].is_dynamic&&i.wait&&i.unwait&&i[e?"wait":"unwait"]()}},highlight:function(e,t,i){var s=this.element_list[e];if(s&&(s.error(t||"Please verify this parameter."),this.portlet.expand(),this.trigger("expand",e),!i)){var a=this.$el.parents().filter(function(){return-1!=["auto","scroll"].indexOf(n(this).css("overflow"))}).first();a.animate({scrollTop:a.scrollTop()+s.$el.offset().top-120},500)}},errors:function(e){if(this.trigger("reset"),e&&e.errors){var t=this.data.matchResponse(e.errors);for(var i in this.element_list){this.element_list[i];t[i]&&this.highlight(i,t[i],!0)}}},render:function(){var e=this;this.off("change"),this.off("reset"),this.field_list={},this.input_list={},this.element_list={},this.data=new _.default.Manager(this),this._renderForm(),this.data.create(),this.model.get("initial_errors")&&this.errors(this.model.attributes);var t=this.data.checksum();return this.on("change",function(i){var s=e.input_list[i];if(!s||s.refresh_on_change||e.model.get("always_refresh")){var n=e.data.checksum();n!=t&&(t=n,e.model.get("onchange")())}}),this.on("reset",function(){s.each(e.element_list,function(e){e.reset()})}),this},_renderForm:function(){n(".tooltip").remove();var e=this.model.attributes;this.message=new c.default.UnescapedMessage,this.section=new u.default.View(this,{inputs:e.inputs}),this.portlet=new l.default.View({icon:e.icon,title:e.title,cls:e.cls,operations:!e.hide_operations&&e.operations,buttons:e.buttons,collapsible:e.collapsible,collapsed:e.collapsed,onchange_title:e.onchange_title}),this.portlet.append(this.message.$el),this.portlet.append(this.section.$el),this.$el.empty(),e.inputs&&this.$el.append(this.portlet.$el),e.message&&this.message.update({persistent:!0,status:e.status,message:e.message}),Galaxy.emit.debug("form-view::initialize()","Completed")}})}).call(t,i(1),i(2),i(0))},22:function(e,t,i){"use strict";(function(e,s,n){function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=i(3),r=a(o),l=i(12),d=a(l),c=e.View.extend({initialize:function(t){var i=this;this.data=[],this.data2=[],this.model=t&&t.model||new e.Model({id:r.default.uid(),cls:"ui-select",error_text:"No options available",empty_text:"Nothing selected",visible:!0,wait:!1,multiple:!1,searchable:!0,optional:!1,disabled:!1,readonly:!1,onchange:function(){},value:null,individual:!1,pagesize:20}).set(t),this.on("change",function(){i.model.get("onchange")&&i.model.get("onchange")(i.value())}),this.listenTo(this.model,"change:data",this._changeData,this),this.listenTo(this.model,"change:disabled",this._changeDisabled,this),this.listenTo(this.model,"change:wait",this._changeWait,this),this.listenTo(this.model,"change:visible",this._changeVisible,this),this.listenTo(this.model,"change:value",this._changeValue,this),this.listenTo(this.model,"change:multiple change:searchable change:cls change:id",this.render,this),this.render()},render:function(){var e=this;this.model.get("searchable")?this._renderSearchable():this._renderClassic(),this.$el.addClass(this.model.get("cls")).attr("id",this.model.get("id")),this.$select.empty().addClass("select").attr("id",this.model.get("id")+"_select").prop("multiple",this.model.get("multiple")).on("change",function(){e.value(e._getValue()),e.trigger("change")}),this._changeData(),this._changeWait(),this._changeVisible(),this._changeDisabled()},_renderClassic:function(){var e=this;this.$el.addClass(this.model.get("multiple")?"ui-select-multiple":"ui-select").append(this.$select=s("").attr({id:t,type:this.model.get("type"),name:this.model.id,value:e.value})).append(s("