galaxy-commits
Threads by month
- ----- 2025 -----
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 15302 discussions

galaxy-dist commit 8ce82d60b2ab: - added the change data library sample operation functional test.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1290011634 18000
# Node ID 8ce82d60b2ab55966d133db136fcb2f809201c4b
# Parent 19b10fff133595cb5cd1851a7f24024c2637ad2b
- added the change data library sample operation functional test.
- renaming dataset now checks for incorrect filename characters
- fixed bugs
--- a/lib/galaxy/web/controllers/requests_common.py
+++ b/lib/galaxy/web/controllers/requests_common.py
@@ -1079,7 +1079,7 @@ class RequestsCommon( BaseController, Us
cntrller=cntrller,
action='update_request_state',
request_id=trans.security.encode_id( request.id ) ) )
- elif sample_operation == trans.model.sample.bulk_operations.SELECT_LIBRARY:
+ elif sample_operation == trans.model.Sample.bulk_operations.SELECT_LIBRARY:
# TODO: fix the code so that the sample_operation_select_field does not use
# sample_0_library_id as it's name. it should use something like sample_operation_library_id
# and sample_operation_folder_id because the name sample_0_library_id should belong to the
--- a/templates/admin/requests/rename_datasets.mako
+++ b/templates/admin/requests/rename_datasets.mako
@@ -16,6 +16,7 @@
<div class="toolForm"><form name="rename_datasets" id="rename_datasets" action="${h.url_for( controller='requests_admin', action='rename_datasets', id_list=id_list, sample_id=trans.security.encode_id( sample.id ) )}" method="post" >
+
<table class="grid"><thead><tr>
@@ -43,9 +44,16 @@
</tbody></table><br/>
+ <div class="form-row">
+ <div class="toolParamHelp" style="clear: both;">
+ A dataset name should only contain the alphanumeric characters or underscore(_).
+ If a dataset name contains any other character, it would be replaced by an underscore(_).
+ </div>
+ </div><div class="form-row"><input type="submit" name="rename_datasets_button" value="Save"/><input type="submit" name="cancel_rename_datasets_button" value="Close"/></div></form>
+
</div>
--- a/scripts/galaxy_messaging/server/setup_rabbitmq.py
+++ b/scripts/galaxy_messaging/server/setup_rabbitmq.py
@@ -24,7 +24,7 @@ def main( config_file ):
cmd_list = [
'add_user %s %s' % ( username, password ),
- 'add_vhost %s' % config.get( 'galaxy_amqp', 'virtual_host' ),
+ 'add_vhost %s' % virtual_host,
'set_permissions -p %s %s ".*" ".*" ".*"' % ( virtual_host, username )
]
--- a/test/functional/test_sample_tracking.py
+++ b/test/functional/test_sample_tracking.py
@@ -430,8 +430,8 @@ class TestFormsAndRequests( TwillTestCas
"""Testing editing the sample information of new request1"""
# logged in as regular_user1
# target data library - change it to library1
- target_library_info = dict(library=self.security.encode_id(library1.id),
- folder=self.security.encode_id(library1_folder1.id) )
+ target_library_info = dict(library=self.security.encode_id( library1.id ),
+ folder=self.security.encode_id( library1_folder1.id ) )
new_sample_value_tuples = \
[ ( 'Sample1_renamed', target_library_info, [ 'option2', 'sample1 field2 value edited', 'sample1 field3 value edited' ] ),
( 'Sample2_renamed', target_library_info, [ 'option1', 'sample2 field2 value edited', 'sample2 field3 value edited' ] ),
@@ -494,6 +494,23 @@ class TestFormsAndRequests( TwillTestCas
strings_displayed_count=strings_displayed_count,
strings_not_displayed=[ request1.states.COMPLETE,
request1.states.REJECTED ] )
+ # change the target data library back to library2 using sample operation user interface
+ self.change_sample_target_data_library( cntrller='requests',
+ request_id=self.security.encode_id( request1.id ),
+ sample_ids=[ sample.id for sample in request1.samples ],
+ new_library_id=self.security.encode_id( library2.id ),
+ new_folder_id=self.security.encode_id( library2_folder1.id ),
+ strings_displayed=[ 'Edit Current Samples of Sequencing Request "%s"' % request1.name ],
+ strings_displayed_after_submit=[ 'Changes made to the samples have been saved.' ] )
+ # check the changed target data library & folder on the request page
+ strings_displayed_count = []
+ strings_displayed_count.append( ( library2.name, len( request1.samples ) ) )
+ strings_displayed_count.append( ( library2_folder1.name, len( request1.samples ) ) )
+ self.view_request( cntrller='requests',
+ request_id=self.security.encode_id( request1.id ),
+ strings_displayed=[],
+ strings_displayed_count=strings_displayed_count )
+
#
# ====== Sequencing request test methods - Admin perspective ================
#
@@ -537,7 +554,7 @@ class TestFormsAndRequests( TwillTestCas
request1.type.states[4].desc ]
# check history of each sample
for sample in request1.samples:
- strings_displayed = [ 'Events for Sample "%s"' % sample.name,
+ strings_displayed = [ 'History of sample "%s"' % sample.name,
'Sequencing request submitted and sample state set to %s' % request1.type.states[0].name,
request1.type.states[0].name,
request1.type.states[1].name ]
--- a/lib/galaxy/web/controllers/requests_admin.py
+++ b/lib/galaxy/web/controllers/requests_admin.py
@@ -361,17 +361,29 @@ class RequestsAdmin( BaseController, Use
sample_dataset = trans.sa_session.query( trans.app.model.SampleDataset ).get( trans.security.decode_id( sample_dataset_id ) )
sample_datasets.append( sample_dataset )
if params.get( 'rename_datasets_button', False ):
+ incorrect_dataset_names = []
for sample_dataset in sample_datasets:
encoded_id = trans.security.encode_id( sample_dataset.id )
selected_option = util.restore_text( params.get( 'rename_datasets_for_sample_%s' % encoded_id, '' ) )
new_name = util.restore_text( params.get( 'new_name_%s' % encoded_id, '' ) )
+ if not new_name:
+ incorrect_dataset_names.append( sample_dataset.name )
+ continue
+ new_name = util.sanitize_for_filename( new_name )
if selected_option == 'none':
sample_dataset.name = new_name
else:
sample_dataset.name = '%s_%s' % ( selected_option, new_name )
trans.sa_session.add( sample_dataset )
trans.sa_session.flush()
- message = 'Changes saved successfully.'
+ if len( sample_datasets ) == len( incorrect_dataset_names ):
+ status = 'error'
+ message = 'All datasets renamed incorrectly.'
+ elif len( incorrect_dataset_names ):
+ status = 'done'
+ message = 'Changes saved successfully. The following datasets were renamed incorrectly: %s.' % str( incorrect_dataset_names )
+ else:
+ message = 'Changes saved successfully.'
return trans.fill_template( '/admin/requests/rename_datasets.mako',
sample=sample,
id_list=id_list,
--- a/test/base/twilltestcase.py
+++ b/test/base/twilltestcase.py
@@ -1638,6 +1638,23 @@ class TwillTestCase( unittest.TestCase )
tc.submit( "save_samples_button" )
for check_str in strings_displayed_after_submit:
self.check_page_for_string( check_str )
+ def change_sample_target_data_library( self, cntrller, request_id, sample_ids, new_library_id, new_folder_id, comment='', strings_displayed=[], strings_displayed_after_submit=[] ):
+ url = "%s/requests_common/edit_samples?cntrller=%s&id=%s&editing_samples=True" % ( self.url, cntrller, request_id )
+ self.visit_url( url )
+ for check_str in strings_displayed:
+ self.check_page_for_string( check_str )
+ for sample_id in sample_ids:
+ tc.fv( "1", "select_sample_%i" % sample_id, True )
+ tc.fv( "1", "sample_operation", 'Select data library and folder' )
+ self.refresh_form( "sample_operation", 'Select data library and folder' )
+ self.check_page_for_string( "Select data library:" )
+ tc.fv( "1", "sample_0_library_id", new_library_id )
+ self.refresh_form( "sample_0_library_id", new_library_id )
+ self.check_page_for_string( "Select folder:" )
+ tc.fv( "1", "sample_0_folder_id", new_folder_id )
+ tc.submit( "save_samples_button" )
+ for check_str in strings_displayed_after_submit:
+ self.check_page_for_string( check_str )
def add_user_address( self, user_id, address_dict ):
self.home()
self.visit_url( "%s/user/new_address?admin_view=False&user_id=%i" % ( self.url, user_id ) )
--- a/lib/galaxy/web/controllers/forms.py
+++ b/lib/galaxy/web/controllers/forms.py
@@ -635,8 +635,8 @@ class Forms( BaseController ):
if form_type == trans.model.FormDefinition.types.SAMPLE:
for ft in trans.model.Sample.supported_field_types:
if ft.__name__ == field[ 'type' ]:
- self.fieldtype.add_option( ft.__name__, ft__name__, selected=True )
- if ft == 'SelectField':
+ self.fieldtype.add_option( ft.__name__, ft.__name__, selected=True )
+ if ft.__name__ == 'SelectField':
self.selectbox_ui( field )
else:
self.fieldtype.add_option( ft.__name__, ft.__name__ )
@@ -644,7 +644,7 @@ class Forms( BaseController ):
for ft in trans.model.FormDefinition.supported_field_types:
if ft.__name__ == field[ 'type' ]:
self.fieldtype.add_option( ft.__name__, ft.__name__, selected=True )
- if ft == 'SelectField':
+ if ft.__name__ == 'SelectField':
self.selectbox_ui( field )
else:
self.fieldtype.add_option( ft.__name__, ft.__name__ )
1
0

galaxy-dist commit 29227c9c5992: Relax GTF sniffer ever so slightly so that Ensembl GTF files are sniffed correctly.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User jeremy goecks <jeremy.goecks(a)emory.edu>
# Date 1290019719 18000
# Node ID 29227c9c599292f7608e61cdd4b2be424b7a7bfc
# Parent 1ee9e2490e1968957f5f440a9dd08fb75aa3eb70
Relax GTF sniffer ever so slightly so that Ensembl GTF files are sniffed correctly.
--- a/lib/galaxy/datatypes/interval.py
+++ b/lib/galaxy/datatypes/interval.py
@@ -965,7 +965,9 @@ class Gtf( Gff ):
if len( attributes ) >= 2:
try:
# Imprecise: should check for a single space per the spec.
- attr_name, attr_value = attributes[0].split(" ")
+ # strip() needed b/c Ensembl GTF files include an (illegal)
+ # space before attributes string.
+ attr_name, attr_value = attributes[0].strip().split(" ")
if attr_name != 'gene_id':
return False
except:
1
0

galaxy-dist commit 39f41821aa4e: Adding data table configuration file for backwards compatibility with local installs: for people who don't want to update loc file style (changes made in rev 4550:535d276c92bc)
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kelly Vincent <kpvincent(a)bx.psu.edu>
# Date 1290011565 18000
# Node ID 39f41821aa4eec15b04509d24715946552bb14a6
# Parent 19b10fff133595cb5cd1851a7f24024c2637ad2b
Adding data table configuration file for backwards compatibility with local installs: for people who don't want to update loc file style (changes made in rev 4550:535d276c92bc)
--- /dev/null
+++ b/tool_data_table_conf.xml.oldlocstyle
@@ -0,0 +1,73 @@
+<!-- Use this file if you don't want to update your loc files as changed in revision 4550:535d276c92bc-->
+<tables>
+ <!-- Locations of all fasta files under genome directory -->
+ <table name="all_fasta" comment_char="#">
+ <columns>value, dbkey, name, path</columns>
+ <file path="tool-data/all_fasta.loc" />
+ </table>
+ <!-- Locations of indexes in the BFAST mapper format -->
+ <table name="bfast_indexes" comment_char="#">
+ <columns>value, dbkey, formats, name, path</columns>
+ <file path="tool-data/bfast_indexes.loc" />
+ </table>
+ <!-- Locations of nucleotide (mega)blast databases -->
+ <table name="blastdb" comment_char="#">
+ <columns>name, value</columns>
+ <file path="tool-data/blastdb.loc" />
+ </table>
+ <!-- Locations of protein (mega)blast databases -->
+ <table name="blastdb_p" comment_char="#">
+ <columns>name, value</columns>
+ <file path="tool-data/blastdb_p.loc" />
+ </table>
+ <!-- Locations of indexes in the Bowtie mapper format -->
+ <table name="bowtie_indexes" comment_char="#">
+ <columns>name, value</columns>
+ <file path="tool-data/bowtie_indices.loc" />
+ </table>
+ <!-- Locations of indexes in the Bowtie color mapper format -->
+ <table name="bowtie_indexes_color" comment_char="#">
+ <columns>name, value</columns>
+ <file path="tool-data/bowtie_indices_color.loc" />
+ </table>
+ <!-- Locations of indexes in the BWA mapper format -->
+ <table name="bwa_indexes" comment_char="#">
+ <columns>name, value</columns>
+ <file path="tool-data/bwa_index.loc" />
+ </table>
+ <!-- Locations of MAF files that have been indexed with bx-python -->
+ <table name="indexed_maf_files">
+ <columns>name, value, dbkey, species</columns>
+ <file path="tool-data/maf_index.loc" />
+ </table>
+ <!-- Locations of fasta files appropriate for NGS simulation -->
+ <table name="ngs_sim_fasta" comment_char="#">
+ <columns>value, dbkey, name, path</columns>
+ <file path="tool-data/ngs_sim_fasta.loc" />
+ </table>
+ <!-- Locations of 2bit sequence files for use in Lastz -->
+ <table name="lastz_seqs" comment_char="#">
+ <columns>name, value</columns>
+ <file path="tool-data/lastz_seqs.loc" />
+ </table>
+ <!-- Locations of PerM base index files -->
+ <table name="perm_base_indexes" comment_char="#">
+ <columns>name, value</columns>
+ <file path="tool-data/perm_base_index.loc" />
+ </table>
+ <!-- Locations of PerM color index files -->
+ <table name="perm_color_indexes" comment_char="#">
+ <columns>name, value</columns>
+ <file path="tool-data/perm_color_index.loc" />
+ </table>
+ <!-- Location of SRMA dict file and other files -->
+ <table name="srma_indexes" comment_char="#">
+ <columns>name, value</columns>
+ <file path="tool-data/srma_index.loc" />
+ </table>
+ <!-- Locations of indexes in the Bowtie mapper format for TopHat to use -->
+ <table name="tophat_indexes" comment_char="#">
+ <columns>name, value</columns>
+ <file path="tool-data/bowtie_indices.loc" />
+ </table>
+</tables>
1
0

galaxy-dist commit 7bded9108bd8: More miscellaneous Sample Tracking cleanup and bug fixes, move supported form_builder field types from form_builder.BaseField to Request.model and Sample.model.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1290007512 18000
# Node ID 7bded9108bd8297ea609e9ec06bbe516b5f0b83a
# Parent a68c74ec8cfbc641db4b6fe424e3f77b9f3c5d3c
More miscellaneous Sample Tracking cleanup and bug fixes, move supported form_builder field types from form_builder.BaseField to Request.model and Sample.model.
--- a/templates/admin/requests/edit_request_type.mako
+++ b/templates/admin/requests/edit_request_type.mako
@@ -28,7 +28,7 @@
</div><div class="form-row"><label>
- Sequencing Request Form definition:
+ Sequencing request form definition:
</label><select name="form_id">
%for form in forms:
@@ -42,7 +42,7 @@
</div><div class="form-row"><label>
- Sample Form definition:
+ Sample form definition:
</label><select name="form_id">
%for form in forms:
--- a/lib/galaxy/web/form_builder.py
+++ b/lib/galaxy/web/form_builder.py
@@ -18,12 +18,6 @@ class BaseField(object):
return ' disabled="disabled"'
else:
return ''
- @staticmethod
- def form_field_types():
- return ['TextField', 'TextArea', 'SelectField', 'CheckboxField', 'AddressField', 'WorkflowField']
- @staticmethod
- def sample_field_types():
- return ['TextField', 'SelectField', 'CheckboxField', 'WorkflowField']
class TextField(BaseField):
"""
@@ -559,8 +553,8 @@ class AddressField(BaseField):
self.select_address.add_option( 'Add a new address', 'new' )
return self.select_address.get_html( disabled=disabled ) + address_html
-class WorkflowField(BaseField):
- def __init__(self, name, user=None, value=None, params=None):
+class WorkflowField( BaseField ):
+ def __init__( self, name, user=None, value=None, params=None ):
self.name = name
self.user = user
self.value = value
@@ -580,7 +574,7 @@ class WorkflowField(BaseField):
else:
self.select_workflow.add_option( a.name, str( a.id ) )
return self.select_workflow.get_html( disabled=disabled )
-
+
def get_suite():
"""Get unittest suite for this module"""
import doctest, sys
@@ -592,11 +586,11 @@ def build_select_field( trans, objs, lab
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 object used to populate the option list
+ - 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 vlaue of the first option in the SelectField - allows for an option telling the user to select something
+ - 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
"""
--- a/templates/admin/requests/view_request_type.mako
+++ b/templates/admin/requests/view_request_type.mako
@@ -38,7 +38,7 @@
<div style="clear: both"></div></div><div class="form-row">
- <label>Sequencing Request form definition</label>
+ <label>Sequencing request form definition</label>
${request_type.request_form.name}
</div><div class="form-row">
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -1495,12 +1495,11 @@ class MetadataFile( object ):
class FormDefinition( object ):
# The following form_builder classes are supported by the FormDefinition class.
- # AddressField, CheckboxField, SelectField, TextArea, TextField, WorkflowField
supported_field_types = [ AddressField, CheckboxField, SelectField, TextArea, TextField, WorkflowField ]
types = Bunch( REQUEST = 'Sequencing Request Form',
SAMPLE = 'Sequencing Sample Form',
LIBRARY_INFO_TEMPLATE = 'Library information template',
- USER_INFO = 'User Information' )
+ USER_INFO = 'User Information' )
def __init__( self, name=None, desc=None, fields=[], form_definition_current=None, form_type=None, layout=None ):
self.name = name
self.desc = desc
@@ -1792,6 +1791,8 @@ class RequestTypePermissions( object ):
self.role = role
class Sample( object ):
+ # The following form_builder classes are supported by the Sample class.
+ supported_field_types = [ CheckboxField, SelectField, TextField, WorkflowField ]
bulk_operations = Bunch( CHANGE_STATE = 'Change state',
SELECT_LIBRARY = 'Select data library and folder' )
api_collection_visible_keys = ( 'id', 'name' )
--- a/lib/galaxy/web/controllers/requests_common.py
+++ b/lib/galaxy/web/controllers/requests_common.py
@@ -588,12 +588,8 @@ class RequestsCommon( BaseController, Us
request = trans.sa_session.query( trans.model.Request ).get( trans.security.decode_id( request_id ) )
except:
return invalid_id_redirect( trans, cntrller, request_id )
- events_list = []
- for event in request.events:
- events_list.append( ( event.state, time_ago( event.update_time ), event.comment ) )
return trans.fill_template( '/requests/common/view_request_history.mako',
cntrller=cntrller,
- events_list=events_list,
request=request )
@web.expose
@web.require_login( "edit email notification settings" )
@@ -777,7 +773,7 @@ class RequestsCommon( BaseController, Us
search_box=search_box )
@web.expose
@web.require_login( "sample events" )
- def sample_events( self, trans, cntrller, **kwd ):
+ def view_sample_history( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
status = params.get( 'status', 'done' )
message = util.restore_text( params.get( 'message', '' ) )
@@ -786,15 +782,8 @@ class RequestsCommon( BaseController, Us
sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id( sample_id ) )
except:
return invalid_id_redirect( trans, cntrller, sample_id )
- events_list = []
- for event in sample.events:
- events_list.append( ( event.state.name,
- event.state.desc,
- time_ago( event.update_time ),
- event.comment ) )
- return trans.fill_template( '/requests/common/sample_events.mako',
+ return trans.fill_template( '/requests/common/view_sample_history.mako',
cntrller=cntrller,
- events_list=events_list,
sample=sample )
@web.expose
@web.require_login( "add sample" )
@@ -1054,9 +1043,9 @@ class RequestsCommon( BaseController, Us
# selected sets of samples. If samples are selected, the sample_operation param
# will have a value other than 'none', and the samples param will be a list of
# encoded sample ids. There are currently only 2 multi-select operations;
- # 'Change state' and 'Select data library and folder'. If sample_operation is
- # 'none, then the samples param will be a list of sample objects.
- if sample_operation == 'Change state':
+ # model.Sample.bulk_operations.CHANGE_STATE and model.sample.bulk_operations.SELECT_LIBRARY.
+ # If sample_operation is 'none, then the samples param will be a list of sample objects.
+ if sample_operation == trans.model.Sample.bulk_operations.CHANGE_STATE:
sample_state_id = params.get( 'sample_state_id', None )
if sample_state_id in [ None, 'none' ]:
message = "Select a new state from the <b>Change current state</b> list before clicking the <b>Save</b> button."
@@ -1090,7 +1079,7 @@ class RequestsCommon( BaseController, Us
cntrller=cntrller,
action='update_request_state',
request_id=trans.security.encode_id( request.id ) ) )
- elif sample_operation == 'Select data library and folder':
+ elif sample_operation == trans.model.sample.bulk_operations.SELECT_LIBRARY:
# TODO: fix the code so that the sample_operation_select_field does not use
# sample_0_library_id as it's name. it should use something like sample_operation_library_id
# and sample_operation_folder_id because the name sample_0_library_id should belong to the
--- a/lib/galaxy/web/controllers/forms.py
+++ b/lib/galaxy/web/controllers/forms.py
@@ -64,12 +64,12 @@ class FormsGrid( grids.Grid ):
]
class Forms( BaseController ):
- # Empty form field
+ # Empty TextField
empty_field = { 'label': '',
'helptext': '',
'visible': True,
'required': False,
- 'type': BaseField.form_field_types()[0],
+ 'type': model.TextField.__name__,
'selectlist': [],
'layout': 'none',
'default': '' }
@@ -597,12 +597,12 @@ class Forms( BaseController ):
self.selectbox_options = []
# if the form is for defining samples, then use the sample field types
# which does not include TextArea & AddressField
- if form_type == trans.app.model.FormDefinition.types.SAMPLE:
- for ft in BaseField.sample_field_types():
- self.fieldtype.add_option(ft, ft)
+ if form_type == trans.model.FormDefinition.types.SAMPLE:
+ for ft in trans.model.Sample.supported_field_types:
+ self.fieldtype.add_option( ft.__name__, ft.__name__ )
else:
- for ft in BaseField.form_field_types():
- self.fieldtype.add_option(ft, ft)
+ for ft in trans.model.Request.supported_field_types:
+ self.fieldtype.add_option( ft.__name__, ft__name__ )
self.required = SelectField('field_required_'+str(index), display='radio')
self.required.add_option('Required', 'required')
self.required.add_option('Optional', 'optional', selected=True)
@@ -632,22 +632,22 @@ class Forms( BaseController ):
field[ 'selectlist' ] = ['', '']
# if the form is for defining samples, then use the sample field types
# which does not include TextArea & AddressField
- if form_type == trans.app.model.FormDefinition.types.SAMPLE:
- for ft in BaseField.sample_field_types():
- if ft == field['type']:
- self.fieldtype.add_option(ft, ft, selected=True)
+ if form_type == trans.model.FormDefinition.types.SAMPLE:
+ for ft in trans.model.Sample.supported_field_types:
+ if ft.__name__ == field[ 'type' ]:
+ self.fieldtype.add_option( ft.__name__, ft__name__, selected=True )
if ft == 'SelectField':
- self.selectbox_ui(field)
+ self.selectbox_ui( field )
else:
- self.fieldtype.add_option(ft, ft)
+ self.fieldtype.add_option( ft.__name__, ft.__name__ )
else:
- for ft in BaseField.form_field_types():
- if ft == field['type']:
- self.fieldtype.add_option(ft, ft, selected=True)
+ for ft in trans.model.Request.supported_field_types:
+ if ft.__name__ == field[ 'type' ]:
+ self.fieldtype.add_option( ft.__name__, ft.__name__, selected=True )
if ft == 'SelectField':
- self.selectbox_ui(field)
+ self.selectbox_ui( field )
else:
- self.fieldtype.add_option(ft, ft)
+ self.fieldtype.add_option( ft.__name__, ft.__name__ )
# required/optional
if field['required'] == 'required':
self.required = SelectField('field_required_'+str(self.index), display='radio')
--- a/templates/admin/requests/create_request_type.mako
+++ b/templates/admin/requests/create_request_type.mako
@@ -39,7 +39,7 @@
<div style="clear: both"></div></div>
%endfor
- <div class="toolFormTitle">Possible sample states</div>
+ <div class="toolFormTitle">Sample states</div>
%if len(rt_states_widgets):
%for index, info in enumerate(rt_states_widgets):
${render_state( index, info[0], info[1] )}
--- a/templates/requests/common/common.mako
+++ b/templates/requests/common/common.mako
@@ -160,7 +160,7 @@
%if is_unsubmitted:
<td>Unsubmitted</td>
%else:
- <td valign="top"><a href="${h.url_for( controller='requests_common', action='sample_events', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${sample.state.name}</a></td>
+ <td valign="top"><a href="${h.url_for( controller='requests_common', action='view_sample_history', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${sample.state.name}</a></td>
%endif
%else:
<td></td>
@@ -334,7 +334,7 @@
%if is_unsubmitted:
<td>Unsubmitted</td>
%else:
- <td><a id="sampleState-${sample.id}" href="${h.url_for( controller='requests_common', action='sample_events', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${render_sample_state( sample )}</a></td>
+ <td><a id="sampleState-${sample.id}" href="${h.url_for( controller='requests_common', action='view_sample_history', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${render_sample_state( sample )}</a></td>
%endif
%if sample_widget_library and library_cntrller is not None:
<td><a href="${h.url_for( controller='library_common', action='browse_library', cntrller=library_cntrller, id=trans.security.encode_id( sample_widget_library.id ) )}">${sample_widget_library.name}</a></td>
--- a/test/base/twilltestcase.py
+++ b/test/base/twilltestcase.py
@@ -1536,7 +1536,7 @@ class TwillTestCase( unittest.TestCase )
self.visit_url( "%s/requests_common/view_request_history?cntrller=%s&id=%s" % ( self.url, cntrller, request_id ) )
self.check_page( strings_displayed, strings_displayed_count, strings_not_displayed )
def view_sample_history( self, cntrller, sample_id, strings_displayed=[], strings_displayed_count=[], strings_not_displayed=[] ):
- self.visit_url( "%s/requests_common/sample_events?cntrller=%s&sample_id=%s" % ( self.url, cntrller, sample_id ) )
+ self.visit_url( "%s/requests_common/view_sample_history?cntrller=%s&sample_id=%s" % ( self.url, cntrller, sample_id ) )
self.check_page( strings_displayed, strings_displayed_count, strings_not_displayed )
def edit_basic_request_info( self, cntrller, request_id, name, new_name='', new_desc='', new_fields=[],
strings_displayed=[], strings_displayed_after_submit=[] ):
--- a/templates/requests/common/edit_basic_request_info.mako
+++ b/templates/requests/common/edit_basic_request_info.mako
@@ -8,7 +8,6 @@
is_unsubmitted = request.is_unsubmitted
can_add_samples = is_unsubmitted
can_reject = is_admin and is_submitted
- can_select_datasets = is_admin and ( is_complete or is_submitted )
can_submit_request = request.samples and is_unsubmitted
%>
@@ -24,9 +23,6 @@
%if can_reject:
<a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject this request</a>
%endif
- %if can_select_datasets:
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', request_id=trans.security.encode_id( request.id ) )}">Select datasets to transfer</a>
- %endif
</div></ul>
--- /dev/null
+++ b/templates/requests/common/view_sample_history.mako
@@ -0,0 +1,38 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+
+<% from galaxy.web.framework.helpers import time_ago %>
+
+<br/><br/>
+<ul class="manage-table-actions">
+ <li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( sample.request.id ) )}">Browse this request</a></li>
+</ul>
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<h3>History of sample "${sample.name}"</h3>
+
+<div class="toolForm">
+ <table class="grid">
+ <thead>
+ <tr>
+ <th>State</th>
+ <th>Description</th>
+ <th>Last Updated</th>
+ <th>Comments</th>
+ </tr>
+ </thead>
+ <tbody>
+ %for event in sample.events:
+ <tr>
+ <td><b>${event.state.name}</b></td>
+ <td>${event.state.desc}</td>
+ <td>${time_ago( event.update_time )}</td>
+ <td>${event.comment}</td>
+ </tr>
+ %endfor
+ </tbody>
+ </table>
+</div>
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -44,8 +44,6 @@ class Configuration( object ):
# web API
self.enable_api = string_as_bool( kwargs.get( 'enable_api', False ) )
self.enable_openid = string_as_bool( kwargs.get( 'enable_openid', False ) )
- # Communication with a sequencer
- self.enable_sequencer_communication = string_as_bool( kwargs.get( 'enable_sequencer_communication', False ) )
# dataset Track files
self.track_store_path = kwargs.get( "track_store_path", "${extra_files_path}/tracks")
self.tool_path = resolve_path( kwargs.get( "tool_path", "tools" ), self.root )
--- a/templates/requests/common/view_request_history.mako
+++ b/templates/requests/common/view_request_history.mako
@@ -2,6 +2,8 @@
<%namespace file="/message.mako" import="render_msg" /><%
+ from galaxy.web.framework.helpers import time_ago
+
is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
is_complete = request.is_complete
is_submitted = request.is_submitted
@@ -41,16 +43,16 @@
<thead><tr><th>State</th>
- <th>Last Update</th>
+ <th>Last Updated</th><th>Comments</th></tr></thead><tbody>
- %for state, updated, comments in events_list:
- <tr class="libraryRow libraryOrFolderRow" id="libraryRow">
- <td><b><a>${state}</a></b></td>
- <td><a>${updated}</a></td>
- <td><a>${comments}</a></td>
+ %for event in request.events:
+ <tr>
+ <td><b>${event.state}</b></td>
+ <td>${time_ago( event.update_time )}</td>
+ <td>${event.comment}</td></tr>
%endfor
</tbody>
--- a/templates/requests/common/sample_events.mako
+++ /dev/null
@@ -1,44 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-<%def name="title()">Events for Sample ${sample.name}</%def>
-
-<h2>Events for Sample "${sample.name}"</h2>
-<ul class="manage-table-actions">
- <li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( sample.request.id ) )}">Browse this request</a></li>
-</ul>
-<h3>Sequencing Request "${sample.request.name}"</h3>
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<div class="toolForm">
- <div class="form-row">
- <div class="toolParamHelp" style="clear: both;">
- <b>Possible states: </b>
- <% states = " > ".join([ ss.name for ss in sample.request.type.states ]) %>
- ${states}
- </div>
- </div>
- <table class="grid">
- <thead>
- <tr>
- <th>State</th>
- <th>Description</th>
- <th>Last Update</th>
- <th>Comments</th>
- </tr>
- </thead>
- <tbody>
- %for state, desc, updated, comments in events_list:
- <tr class="libraryRow libraryOrFolderRow" id="libraryRow">
- <td><b><a>${state}</a></b></td>
- <td><a>${desc}</a></td>
- <td><a>${updated}</a></td>
- <td><a>${comments}</a></td>
- </tr>
- %endfor
- </tbody>
- </table>
-</div>
1
0

galaxy-dist commit 1bf064c8ab88: Fixed functional tests and samples grid alignment bug
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1289928056 18000
# Node ID 1bf064c8ab88621dd58890f6cd56ad4900d10d6b
# Parent 2e2ee0289d67d244954aa05bfe315dbb5ff413eb
Fixed functional tests and samples grid alignment bug
--- a/test/functional/test_sample_tracking.py
+++ b/test/functional/test_sample_tracking.py
@@ -341,7 +341,7 @@ class TestFormsAndRequests( TwillTestCas
request_id=self.security.encode_id( request1.id ),
strings_displayed=[ 'History of sequencing request "%s"' % request1.name,
request1.states.NEW,
- 'Request created' ],
+ 'Sequencing request created' ],
strings_not_displayed=[ request1.states.SUBMITTED,
request1.states.COMPLETE,
request1.states.REJECTED ] )
@@ -412,7 +412,7 @@ class TestFormsAndRequests( TwillTestCas
self.add_samples( cntrller='requests',
request_id=self.security.encode_id( request1.id ),
sample_value_tuples=sample_value_tuples,
- strings_displayed=[ 'Add Samples to Request "%s"' % request1.name,
+ strings_displayed=[ 'Add Samples to Sequencing Request "%s"' % request1.name,
'<input type="text" name="sample_0_name" value="Sample_1" size="10"/>' ], # sample name input field
strings_displayed_after_submit=strings_displayed_after_submit )
# check the new sample field values on the request page
@@ -446,7 +446,7 @@ class TestFormsAndRequests( TwillTestCas
self.edit_samples( cntrller='requests',
request_id=self.security.encode_id( request1.id ),
sample_value_tuples=new_sample_value_tuples,
- strings_displayed=[ 'Edit Current Samples of Request "%s"' % request1.name,
+ strings_displayed=[ 'Edit Current Samples of Sequencing Request "%s"' % request1.name,
'<input type="text" name="sample_0_name" value="Sample1" size="10"/>' ], # sample name input field
strings_displayed_after_submit=strings_displayed_after_submit )
# check the changed sample field values on the request page
@@ -465,14 +465,14 @@ class TestFormsAndRequests( TwillTestCas
self.submit_request( cntrller='requests',
request_id=self.security.encode_id( request1.id ),
request_name=request1.name,
- strings_displayed_after_submit=[ 'The request has been submitted.' ] )
+ strings_displayed_after_submit=[ 'The sequencing request has been submitted.' ] )
refresh( request1 )
# Make sure the request is showing in the 'submitted' filter
self.check_request_grid( cntrller='requests',
state=request1.states.SUBMITTED,
strings_displayed=[ request1.name ] )
# Make sure the request's state is now set to 'submitted'
- assert request1.state is not request1.states.SUBMITTED, "The state of the request '%s' should be set to '%s'" \
+ assert request1.state is not request1.states.SUBMITTED, "The state of the sequencing request '%s' should be set to '%s'" \
% ( request1.name, request1.states.SUBMITTED )
# the sample state should appear once for each sample
strings_displayed_count = [ ( request1.type.states[0].name, len( request1.samples ) ) ]
@@ -485,8 +485,8 @@ class TestFormsAndRequests( TwillTestCas
strings_displayed_count=strings_displayed_count,
strings_not_displayed=strings_not_displayed )
strings_displayed=[ 'History of sequencing request "%s"' % request1.name,
- 'Request submitted by %s' % regular_user1.email,
- 'Request created' ]
+ 'Sequencing request submitted by %s' % regular_user1.email,
+ 'Sequencing request created' ]
strings_displayed_count = [ ( request1.states.SUBMITTED, 1 ) ]
self.view_request_history( cntrller='requests',
request_id=self.security.encode_id( request1.id ),
@@ -519,7 +519,7 @@ class TestFormsAndRequests( TwillTestCas
self.add_bar_codes( cntrller='requests_admin',
request_id=self.security.encode_id( request1.id ),
bar_codes=bar_codes,
- strings_displayed=[ 'Edit Current Samples of Request "%s"' % request1.name ],
+ strings_displayed=[ 'Edit Current Samples of Sequencing Request "%s"' % request1.name ],
strings_displayed_after_submit=strings_displayed_after_submit )
# the second sample state should appear once for each sample
strings_displayed_count = [ ( request1.type.states[1].name, len( request1.samples ) ),
@@ -538,7 +538,7 @@ class TestFormsAndRequests( TwillTestCas
# check history of each sample
for sample in request1.samples:
strings_displayed = [ 'Events for Sample "%s"' % sample.name,
- 'Request submitted and sample state set to %s' % request1.type.states[0].name,
+ 'Sequencing request submitted and sample state set to %s' % request1.type.states[0].name,
request1.type.states[0].name,
request1.type.states[1].name ]
self.view_sample_history( cntrller='requests_admin',
@@ -558,9 +558,9 @@ class TestFormsAndRequests( TwillTestCas
if index > 1:
# status message
if index == len( request_type1.states ) - 1:
- status_msg = 'All samples of this request are in the final sample state (%s).' % state.name
+ status_msg = 'All samples of this sequencing request are in the final sample state (%s).' % state.name
else:
- status_msg = 'All samples of this request are in the (%s) sample state. ' % state.name
+ status_msg = 'All samples of this sequencing request are in the (%s) sample state. ' % state.name
# check email notification message
email_msg = ''
if state.id in [ email_state.id for email_state in email_notification_sample_states ]:
@@ -568,7 +568,7 @@ class TestFormsAndRequests( TwillTestCas
self.change_sample_state( request_id=self.security.encode_id( request1.id ),
sample_ids=[ sample.id for sample in request1.samples ],
new_sample_state_id=self.security.encode_id( state.id ),
- strings_displayed=[ 'Edit Current Samples of Request "%s"' % request1.name ],
+ strings_displayed=[ 'Edit Current Samples of Sequencing Request "%s"' % request1.name ],
strings_displayed_after_submit = [ status_msg, email_msg ] )
# check request history page
if index == len( request_type1.states ) - 1:
@@ -584,7 +584,7 @@ class TestFormsAndRequests( TwillTestCas
self.check_request_grid( cntrller='requests_admin',
state='Complete',
strings_displayed=[ request1.name ] )
- assert request1.state is not request1.states.COMPLETE, "The state of the request '%s' should be set to '%s'" \
+ assert request1.state is not request1.states.COMPLETE, "The state of the sequencing request '%s' should be set to '%s'" \
% ( request1.name, request1.states.COMPLETE )
# def test_045_admin_create_request_on_behalf_of_regular_user( self ):
--- a/templates/requests/common/common.mako
+++ b/templates/requests/common/common.mako
@@ -113,27 +113,23 @@
</script></%def>
-<%def name="render_editable_sample_row( cntrller, sample, sample_widget_index, sample_widget, encoded_selected_sample_ids )">
+<%def name="render_editable_sample_row( cntrller, request, sample, sample_widget_index, sample_widget, encoded_selected_sample_ids )"><%
+ trans.sa_session.refresh( request )
is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
+ is_rejected = request.is_rejected
+ is_complete = request.is_complete
+ is_submitted = request.is_submitted
+ is_unsubmitted = request.is_unsubmitted
if sample:
- trans.sa_session.refresh( sample.request )
- is_complete = sample.request.is_complete
- is_rejected = request.is_rejected
- is_submitted = sample.request.is_submitted
- is_unsubmitted = sample.request.is_unsubmitted
can_delete_samples = editing_samples and request.samples and ( ( is_admin and not is_complete ) or is_unsubmitted )
display_checkboxes = editing_samples and ( is_complete or is_rejected or is_submitted )
- display_bar_code = request.samples and ( is_complete or is_rejected or is_submitted )
display_datasets = request.samples and ( is_complete or is_submitted )
else:
- is_complete = False
- is_submitted = False
- is_unsubmitted = False
can_delete_samples = False
display_checkboxes = False
- display_bar_code = False
display_datasets = False
+ display_bar_code = request.samples and ( is_complete or is_rejected or is_submitted )
%><%
if display_checkboxes and trans.security.encode_id( sample.id ) in encoded_selected_sample_ids:
@@ -152,15 +148,13 @@
</td>
%if display_bar_code:
<td valign="top">
- %if is_admin:
+ %if is_admin and is_submitted:
<input type="text" name="sample_${sample_widget_index}_bar_code" value="${sample_widget['bar_code']}" size="10"/>
%else:
${sample_widget['bar_code']}
<input type="hidden" name="sample_${sample_widget_index}_bar_code" value="${sample_widget['bar_code']}"/>
%endif
</td>
- %else:
- <td></td>
%endif
%if sample:
%if is_unsubmitted:
@@ -305,7 +299,7 @@
sample = None
%>
%if editing_samples:
- <tr>${render_editable_sample_row( cntrller, sample, sample_widget_index, sample_widget, encoded_selected_sample_ids )}</tr>
+ <tr>${render_editable_sample_row( cntrller, request, sample, sample_widget_index, sample_widget, encoded_selected_sample_ids )}</tr>
%elif sample:
<tr><td>
@@ -401,7 +395,7 @@
</tr>
%else:
## The Add sample button was clicked for this sample_widget
- <tr>${render_editable_sample_row( cntrller, None, sample_widget_index, sample_widget, encoded_selected_sample_ids )}</tr>
+ <tr>${render_editable_sample_row( cntrller, request, None, sample_widget_index, sample_widget, encoded_selected_sample_ids )}</tr>
%endif
%endfor
</tbody>
1
0

galaxy-dist commit a68c74ec8cfb: OpenID support for Galaxy.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Nate Coraor <nate(a)bx.psu.edu>
# Date 1290006822 18000
# Node ID a68c74ec8cfbc641db4b6fe424e3f77b9f3c5d3c
# Parent 56431b214df16653a966b96bf399c7646da267b8
OpenID support for Galaxy.
--- a/eggs.ini
+++ b/eggs.ini
@@ -44,6 +44,7 @@ Paste = 1.6
PasteDeploy = 1.3.3
PasteScript = 1.7.3
pexpect = 2.4
+python_openid = 2.2.5
Routes = 1.12.3
SQLAlchemy = 0.5.6
sqlalchemy_migrate = 0.5.4
--- /dev/null
+++ b/templates/user/openid_manage.mako
@@ -0,0 +1,17 @@
+## Template generates a grid that enables user to select items.
+<%namespace file="../grid_base.mako" import="make_grid" />
+<%namespace file="login.mako" import="render_openid_form" />
+
+<%inherit file="../grid_base.mako" />
+
+<%def name="grid_body( grid )">
+ ${make_grid( grid )}
+ <h2>Associate more OpenIDs</h2>
+ ${render_openid_form( kwargs['referer'], True, kwargs['openid_providers'] )}
+</%def>
+
+<%def name="center_panel()">
+ <div style="margin: 1em;">
+ ${grid_body( grid )}
+ </div>
+</%def>
Binary file static/images/openid-16x16.gif has changed
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -1953,6 +1953,12 @@ class UserAddress( object ):
html = html + '<br/>' + 'Phone: ' + self.phone
return html
+class UserOpenID( object ):
+ def __init__( self, user=None, session=None, openid=None ):
+ self.user = user
+ self.session = session
+ self.openid = openid
+
class Page( object ):
def __init__( self ):
self.id = None
--- a/templates/user/index.mako
+++ b/templates/user/index.mako
@@ -15,6 +15,9 @@
%if trans.app.config.enable_api:
<li><a href="${h.url_for( controller='user', action='api_keys' )}">${_('Manage your API Keys')}</a> for new histories</li>
%endif
+ %if trans.app.config.enable_openid:
+ <li><a href="${h.url_for( controller='user', action='openid_manage' )}">${ ('Manage OpenIDs')}</a> linked to your account</li>
+ %endif
%else:
<li><a href="${h.url_for( controller='user', action='show_info', webapp='community' )}">${_('Manage your information')}</a></li>
%endif
--- /dev/null
+++ b/lib/galaxy/model/migrate/versions/0062_user_openid_table.py
@@ -0,0 +1,48 @@
+"""
+Migration script to create table for associating sessions and users with
+OpenIDs.
+"""
+
+from sqlalchemy import *
+from sqlalchemy.orm import *
+from migrate import *
+from migrate.changeset import *
+
+import datetime
+now = datetime.datetime.utcnow
+
+import logging
+log = logging.getLogger( __name__ )
+
+metadata = MetaData( migrate_engine )
+db_session = scoped_session( sessionmaker( bind=migrate_engine, autoflush=False, autocommit=True ) )
+
+# Table to add
+
+UserOpenID_table = Table( "galaxy_user_openid", metadata,
+ Column( "id", Integer, primary_key=True ),
+ Column( "create_time", DateTime, default=now ),
+ Column( "update_time", DateTime, index=True, default=now, onupdate=now ),
+ Column( "session_id", Integer, ForeignKey( "galaxy_session.id" ), index=True ),
+ Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
+ Column( "openid", TEXT, index=True, unique=True ),
+ )
+
+def upgrade():
+ print __doc__
+ metadata.reflect()
+
+ # Create galaxy_user_openid table
+ try:
+ UserOpenID_table.create()
+ except Exception, e:
+ log.debug( "Creating galaxy_user_openid table failed: %s" % str( e ) )
+
+def downgrade():
+ metadata.reflect()
+
+ # Drop galaxy_user_openid table
+ try:
+ UserOpenID_table.drop()
+ except Exception, e:
+ log.debug( "Dropping galaxy_user_openid table failed: %s" % str( e ) )
--- a/templates/user/login.mako
+++ b/templates/user/login.mako
@@ -1,23 +1,77 @@
-<%inherit file="/base.mako"/>
+<%!
+ def inherit(context):
+ if context.get('use_panels'):
+ if context.get('webapp'):
+ webapp = context.get('webapp')
+ else:
+ webapp = 'galaxy'
+ return '/webapps/%s/base_panels.mako' % webapp
+ else:
+ return '/base.mako'
+%>
+<%inherit file="${inherit(context)}"/>
+
+<%def name="init()">
+<%
+ self.has_left_panel=False
+ self.has_right_panel=False
+ self.active_view=active_view
+ self.message_box_visible=False
+%>
+</%def>
+
<%namespace file="/message.mako" import="render_msg" />
-%if redirect_url:
- <script type="text/javascript">
- top.location.href = '${redirect_url}';
- </script>
-%endif
+<%def name="center_panel()">
+ ${body()}
+</%def>
-%if not redirect_url and message:
- ${render_msg( message, status )}
-%endif
+<%def name="body()">
-%if not trans.user:
+ %if redirect_url:
+ <script type="text/javascript">
+ top.location.href = '${redirect_url}';
+ </script>
+ %endif
+
+ %if context.get('use_panels'):
+ <div style="margin: 1em;">
+ %else:
+ <div>
+ %endif
+
+ %if message:
+ ${render_msg( message, status )}
+ %endif
+
+ %if not trans.user:
+
+ ${render_login_form()}
+
+ %if trans.app.config.enable_openid:
+ <br/>
+ ${render_openid_form( referer, False, openid_providers )}
+ %endif
+
+ %endif
+
+ </div>
+
+</%def>
+
+<%def name="render_login_form( form_action=None )">
+
+ <%
+ if form_action is None:
+ form_action = h.url_for( controller='user', action='login', use_panels=use_panels )
+ %>
+
%if header:
${header}
%endif
<div class="toolForm"><div class="toolFormTitle">Login</div>
- <form name="login" id="login" action="${h.url_for( controller='user', action='login' )}" method="post" >
+ <form name="login" id="login" action="${form_action}" method="post" ><div class="form-row"><label>Email address:</label><input type="text" name="email" value="${email}" size="40"/>
@@ -36,4 +90,32 @@
</div></form></div>
-%endif
+
+</%def>
+
+<%def name="render_openid_form( referer, auto_associate, openid_providers )">
+
+ <div class="toolForm">
+ <div class="toolFormTitle">OpenID Login</div>
+ <form name="openid" id="openid" action="${h.url_for( controller='user', action='openid_auth' )}" method="post" >
+ <div class="form-row">
+ <label>OpenID URL:</label>
+ <input type="text" name="openid_url" size="60" style="background-image:url('${h.url_for( '/static/images/openid-16x16.gif' )}' ); background-repeat: no-repeat; padding-right: 20px; background-position: 99% 50%;"/>
+ <input type="hidden" name="webapp" value="${webapp}" size="40"/>
+ <input type="hidden" name="referer" value="${referer}" size="40"/>
+ <input type="hidden" name="auto_associate" value="${auto_associate}" size="40"/>
+ </div>
+ <div class="form-row">
+ Or, authenticate with your <select name="openid_provider">
+ %for provider in openid_providers.keys():
+ <option>${provider}</option>
+ %endfor
+ </select> account.
+ </div>
+ <div class="form-row">
+ <input type="submit" name="login_button" value="Login"/>
+ </div>
+ </form>
+ </div>
+
+</%def>
--- a/lib/galaxy/eggs/__init__.py
+++ b/lib/galaxy/eggs/__init__.py
@@ -321,6 +321,7 @@ class GalaxyConfig( object ):
"pbs_python": lambda: "pbs" in self.config.get( "app:main", "start_job_runners" ).split(","),
"threadframe": lambda: self.config.get( "app:main", "use_heartbeat" ),
"guppy": lambda: self.config.get( "app:main", "use_memdump" ),
+ "python_openid": lambda: self.config.get( "app:main", "enable_openid" ),
"GeneTrack": lambda: sys.version_info[:2] >= ( 2, 5 ),
"pysam": check_pysam()
}.get( egg_name, lambda: True )()
--- /dev/null
+++ b/templates/user/openid_associate.mako
@@ -0,0 +1,75 @@
+<%!
+ def inherit(context):
+ if context.get('use_panels'):
+ if context.get('webapp'):
+ webapp = context.get('webapp')
+ else:
+ webapp = 'galaxy'
+ return '/webapps/%s/base_panels.mako' % webapp
+ else:
+ return '/base.mako'
+%>
+<%inherit file="${inherit(context)}"/>
+
+<%def name="init()">
+<%
+ self.has_left_panel=False
+ self.has_right_panel=False
+ self.active_view=active_view
+ self.message_box_visible=False
+%>
+</%def>
+
+<%namespace file="/message.mako" import="render_msg" />
+<%namespace file="login.mako" import="render_login_form" />
+<%namespace file="register.mako" import="render_registration_form" />
+
+<%def name="center_panel()">
+ ${body()}
+</%def>
+
+<%def name="body()">
+
+ %if context.get('use_panels'):
+ <div style="margin: 1em;">
+ %else:
+ <div>
+ %endif
+
+ %if message:
+ ${render_msg( message, status )}
+ %endif
+
+ <h2>OpenID Account Association</h2>
+ <div>
+ OpenIDs must be associated with a Galaxy account before they can be used for authentication. This only needs to be done once per OpenID. You may associate your OpenID with an existing Galaxy account, or create a new one.
+ </div>
+ <br/>
+
+ %if len( openids ) > 1:
+ <div>
+ The following OpenIDs will be associated with the account chosen or created below.
+ <ul>
+ %for openid in openids:
+ <li>${openid.openid}</li>
+ %endfor
+ </ul>
+ </div>
+ %else:
+ <div>
+ The OpenID <strong>${openids[0].openid}</strong> will be associated with the account chosen or created.
+ </div>
+ %endif
+ <br/>
+
+ <% form_action = h.url_for( use_panels=use_panels ) %>
+
+ ${render_login_form( form_action=form_action )}
+
+ <br/>
+
+ ${render_registration_form( form_action=form_action )}
+
+ </div>
+
+</%def>
--- a/templates/user/register.mako
+++ b/templates/user/register.mako
@@ -22,8 +22,18 @@
## An admin user may be creating a new user account, in which case we want to display the registration form.
## But if the current user is not an admin user, then don't display the registration form.
%if trans.user_is_admin() or not trans.user:
+ ${render_registration_form()}
+%endif
+
+<%def name="render_registration_form( form_action=None )">
+
+ <%
+ if form_action is None:
+ form_action = h.url_for( controller='user', action='create', admin_view=admin_view )
+ %>
+
<div class="toolForm">
- <form name="registration" id="registration" action="${h.url_for( controller='user', action='create', admin_view=admin_view )}" method="post" >
+ <form name="registration" id="registration" action="${form_action}" method="post" ><div class="toolFormTitle">Create account</div><div class="form-row"><label>Email address:</label>
@@ -83,4 +93,5 @@
</div></form></div>
-%endif
+
+</%def>
--- a/universe_wsgi.ini.sample
+++ b/universe_wsgi.ini.sample
@@ -324,6 +324,10 @@ use_interactive = True
# WYSIWYG editor that is very similar to a word processor.
#enable_pages = False
+# Enable authentication via OpenID. Allows users to log in to their Galaxy
+# account by authenticating with an OpenID provider.
+#enable_openid = False
+
# Enable the (experimental! beta!) Web API. Documentation forthcoming.
#enable_api = False
--- a/lib/galaxy/model/mapping.py
+++ b/lib/galaxy/model/mapping.py
@@ -68,6 +68,15 @@ UserAddress.table = Table( "user_address
Column( "deleted", Boolean, index=True, default=False ),
Column( "purged", Boolean, index=True, default=False ) )
+UserOpenID.table = Table( "galaxy_user_openid", metadata,
+ Column( "id", Integer, primary_key=True ),
+ Column( "create_time", DateTime, default=now ),
+ Column( "update_time", DateTime, index=True, default=now, onupdate=now ),
+ Column( "session_id", Integer, ForeignKey( "galaxy_session.id" ), index=True ),
+ Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
+ Column( "openid", TEXT, index=True, unique=True ),
+ )
+
History.table = Table( "history", metadata,
Column( "id", Integer, primary_key=True),
Column( "create_time", DateTime, default=now ),
@@ -968,6 +977,17 @@ assign_mapper( context, UserAddress, Use
order_by=desc(UserAddress.table.c.update_time)),
) )
+assign_mapper( context, UserOpenID, UserOpenID.table,
+ properties=dict(
+ session=relation( GalaxySession,
+ primaryjoin=( UserOpenID.table.c.session_id == GalaxySession.table.c.id ),
+ backref='openids',
+ order_by=desc( UserOpenID.table.c.update_time ) ),
+ user=relation( User,
+ primaryjoin=( UserOpenID.table.c.user_id == User.table.c.id ),
+ backref='openids',
+ order_by=desc( UserOpenID.table.c.update_time ) ) ) )
+
assign_mapper( context, ValidationError, ValidationError.table )
--- a/templates/display_common.mako
+++ b/templates/display_common.mako
@@ -85,6 +85,8 @@
class_plural = "Forms"
elif a_class == model.RequestType:
class_plural = "sequencer configurations"
+ elif a_class == model.UserOpenID:
+ class_plural = "OpenIDs"
else:
class_plural = a_class.__name__ + "s"
return class_plural
--- a/lib/galaxy/app.py
+++ b/lib/galaxy/app.py
@@ -60,6 +60,10 @@ class UniverseApplication( object ):
self.heartbeat = None
self.memdump = None
self.memory_usage = None
+ # Container for OpenID authentication routines
+ if self.config.enable_openid:
+ from galaxy.web.framework import openid_manager
+ self.openid_manager = openid_manager.OpenIDManager( self.config.openid_consumer_cache_path )
# Start the heartbeat process if configured and available
if self.config.use_heartbeat:
from galaxy.util import heartbeat
--- /dev/null
+++ b/lib/galaxy/web/framework/openid_manager.py
@@ -0,0 +1,53 @@
+"""
+Mange the OpenID consumer and related data stores.
+"""
+
+import os, pickle, logging
+
+from galaxy import eggs
+eggs.require( 'python-openid' )
+
+import openid
+from openid import oidutil
+from openid.store import filestore
+from openid.consumer import consumer
+from openid.extensions import sreg
+
+log = logging.getLogger( __name__ )
+def oidlog( message, level=0 ):
+ log.debug( message )
+oidutil.log = oidlog
+
+class OpenIDManager( object ):
+ def __init__( self, cache_path ):
+ self.session_path = os.path.join( cache_path, 'session' )
+ self.store_path = os.path.join( cache_path, 'store' )
+ for dir in self.session_path, self.store_path:
+ if not os.path.exists( dir ):
+ os.makedirs( dir )
+ self.store = filestore.FileOpenIDStore( self.store_path )
+ def get_session( self, trans ):
+ session_file = os.path.join( self.session_path, str( trans.galaxy_session.id ) )
+ if not os.path.exists( session_file ):
+ pickle.dump( dict(), open( session_file, 'w' ) )
+ return pickle.load( open( session_file ) )
+ def persist_session( self, trans, oidconsumer ):
+ session_file = os.path.join( self.session_path, str( trans.galaxy_session.id ) )
+ pickle.dump( oidconsumer.session, open( session_file, 'w' ) )
+ def get_consumer( self, trans ):
+ return consumer.Consumer( self.get_session( trans ), self.store )
+ def add_sreg( self, trans, request, required=None, optional=None ):
+ if required is None:
+ required = []
+ if optional is None:
+ optional = []
+ sreg_request = sreg.SRegRequest( required=required, optional=optional )
+ request.addExtension( sreg_request )
+ def get_sreg( self, info ):
+ return sreg.SRegResponse.fromSuccessResponse( info )
+
+ # so I don't have to expose all of openid.consumer.consumer
+ FAILURE = consumer.FAILURE
+ SUCCESS = consumer.SUCCESS
+ CANCEL = consumer.CANCEL
+ SETUP_NEEDED = consumer.SETUP_NEEDED
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -39,9 +39,11 @@ class Configuration( object ):
# Where dataset files are stored
self.file_path = resolve_path( kwargs.get( "file_path", "database/files" ), self.root )
self.new_file_path = resolve_path( kwargs.get( "new_file_path", "database/tmp" ), self.root )
+ self.openid_consumer_cache_path = resolve_path( kwargs.get( "openid_consumer_cache_path", "database/openid_consumer_cache" ), self.root )
self.cookie_path = kwargs.get( "cookie_path", "/" )
# web API
self.enable_api = string_as_bool( kwargs.get( 'enable_api', False ) )
+ self.enable_openid = string_as_bool( kwargs.get( 'enable_openid', False ) )
# Communication with a sequencer
self.enable_sequencer_communication = string_as_bool( kwargs.get( 'enable_sequencer_communication', False ) )
# dataset Track files
@@ -161,7 +163,17 @@ class Configuration( object ):
if not os.path.isdir( path ):
raise ConfigurationError("Directory does not exist: %s" % path )
# Create the directories that it makes sense to create
- for path in self.file_path, self.new_file_path, self.job_working_directory, self.cluster_files_directory, self.template_cache, self.ftp_upload_dir, self.library_import_dir, self.user_library_import_dir, self.nginx_upload_store, './static/genetrack/plots', os.path.join( self.tool_data_path, 'shared', 'jars' ):
+ for path in self.file_path, \
+ self.new_file_path, \
+ self.job_working_directory, \
+ self.cluster_files_directory, \
+ self.template_cache, \
+ self.ftp_upload_dir, \
+ self.library_import_dir, \
+ self.user_library_import_dir, \
+ self.nginx_upload_store, \
+ './static/genetrack/plots', \
+ os.path.join( self.tool_data_path, 'shared', 'jars' ):
if path not in [ None, False ] and not os.path.isdir( path ):
try:
os.makedirs( path )
--- a/lib/galaxy/web/controllers/user.py
+++ b/lib/galaxy/web/controllers/user.py
@@ -1,9 +1,10 @@
"""
Contains the user interface in the Universe class
"""
+from galaxy.web.framework.helpers import time_ago, grids
from galaxy.web.base.controller import *
from galaxy.model.orm import *
-from galaxy import util
+from galaxy import util, model
import logging, os, string, re, smtplib, socket
from random import choice
from email.MIMEText import MIMEText
@@ -26,48 +27,337 @@ require_login_creation_template = requir
VALID_USERNAME_RE = re.compile( "^[a-z0-9\-]+$" )
+OPENID_PROVIDERS = { 'Google' : 'https://www.google.com/accounts/o8/id',
+ 'Yahoo!' : 'http://yahoo.com',
+ 'AOL/AIM' : 'http://openid.aol.com',
+ 'Flickr' : 'http://flickr.com',
+ 'Launchpad' : 'http://login.launchpad.net',
+ }
+
+class UserOpenIDGrid( grids.Grid ):
+ use_panels = False
+ title = "OpenIDs linked to your account"
+ model_class = model.UserOpenID
+ template = '/user/openid_manage.mako'
+ default_filter = { "openid" : "All" }
+ default_sort_key = "-create_time"
+ columns = [
+ grids.TextColumn( "OpenID URL", key="openid" ),
+ grids.GridColumn( "Created", key="create_time", format=time_ago ),
+ ]
+ operations = [
+ grids.GridOperation( "Delete", async_compatible=True ),
+ ]
+ def build_initial_query( self, trans, **kwd ):
+ return trans.sa_session.query( self.model_class ).filter( self.model_class.user_id == trans.user.id )
+
class User( BaseController, UsesFormDefinitionWidgets ):
+ user_openid_grid = UserOpenIDGrid()
@web.expose
def index( self, trans, webapp='galaxy', **kwd ):
return trans.fill_template( '/user/index.mako', webapp=webapp )
@web.expose
+ def openid_auth( self, trans, webapp='galaxy', **kwd ):
+ if not trans.app.config.enable_openid:
+ return trans.show_error_message( 'OpenID authentication is not enabled in this instance of Galaxy' )
+ message = 'Unspecified failure authenticating via OpenID'
+ status = kwd.get( 'status', 'done' )
+ openid_url = kwd.get( 'openid_url', '' )
+ openid_provider = kwd.get( 'openid_provider', '' )
+ referer = kwd.get( 'referer', trans.request.referer )
+ auto_associate = util.string_as_bool( kwd.get( 'auto_associate', False ) )
+ use_panels = util.string_as_bool( kwd.get( 'use_panels', False ) )
+ action = 'login'
+ if auto_associate:
+ action = 'openid_manage'
+ if not referer:
+ referer = url_for( '/' )
+ consumer = trans.app.openid_manager.get_consumer( trans )
+ process_url = trans.request.base.rstrip( '/' ) + url_for( controller='user', action='openid_process', referer=referer, auto_associate=auto_associate )
+ if not openid_url and openid_provider and openid_provider in OPENID_PROVIDERS:
+ openid_url = OPENID_PROVIDERS[openid_provider]
+ if openid_url:
+ request = None
+ try:
+ request = consumer.begin( openid_url )
+ if request is None:
+ message = 'No OpenID services are available at %s' % openid_url
+ except Exception, e:
+ message = 'Failed to begin OpenID authentication: %s' % str( e )
+ if request is not None:
+ trans.app.openid_manager.add_sreg( trans, request, optional=[ 'nickname', 'email' ] )
+ if request.shouldSendRedirect():
+ redirect_url = request.redirectURL(
+ trans.request.base, process_url )
+ trans.app.openid_manager.persist_session( trans, consumer )
+ trans.response.send_redirect( redirect_url )
+ return
+ else:
+ form = request.htmlMarkup( trans.request.base, process_url, form_tag_attrs={'id':'openid_message','target':'_top'} )
+ trans.app.openid_manager.persist_session( trans, consumer )
+ return form
+ return trans.response.send_redirect( url_for( controller='user',
+ action=action,
+ use_panels=use_panels,
+ message=message,
+ status='error' ) )
+ @web.expose
+ def openid_process( self, trans, webapp='galaxy', **kwd ):
+ if not trans.app.config.enable_openid:
+ return trans.show_error_message( 'OpenID authentication is not enabled in this instance of Galaxy' )
+ auto_associate = util.string_as_bool( kwd.get( 'auto_associate', False ) )
+ action = 'login'
+ if auto_associate:
+ action = 'openid_manage'
+ if trans.app.config.bugs_email is not None:
+ contact = '<a href="mailto:%s">contact support</a>' % trans.app.config.bugs_email
+ else:
+ contact = 'contact support'
+ message = 'Verification failed for an unknown reason. Please contact support for assistance.'
+ status = 'error'
+ consumer = trans.app.openid_manager.get_consumer( trans )
+ info = consumer.complete( kwd, trans.request.url )
+ display_identifier = info.getDisplayIdentifier()
+ redirect_url = kwd.get( 'referer', url_for( '/' ) )
+ if info.status == trans.app.openid_manager.FAILURE and display_identifier:
+ message = "Login via OpenID failed. The technical reason for this follows, please include this message in your email if you need to %s to resolve this problem: %s" % ( contact, info.message )
+ return trans.response.send_redirect( url_for( controller='user',
+ action=action,
+ use_panels=True,
+ message=message,
+ status='error' ) )
+ elif info.status == trans.app.openid_manager.SUCCESS:
+ if info.endpoint.canonicalID:
+ display_identifier = info.endpoint.canonicalID
+ user_openid = trans.sa_session.query( trans.app.model.UserOpenID ).filter( trans.app.model.UserOpenID.table.c.openid == display_identifier ).first()
+ if not user_openid:
+ user_openid = trans.app.model.UserOpenID( session=trans.galaxy_session, openid=display_identifier )
+ elif not user_openid.user and user_openid.session.id != trans.galaxy_session.id:
+ user_openid.session = trans.galaxy_session
+ elif user_openid.user and not auto_associate:
+ trans.handle_user_login( user_openid.user, webapp )
+ trans.log_event( "User logged in via OpenID: %s" % display_identifier )
+ trans.response.send_redirect( redirect_url )
+ return
+ if auto_associate and trans.user:
+ # The user is already logged in and requested association from
+ # the user prefs as opposed to using the OpenID form on the
+ # login page.
+ if user_openid.user and user_openid.user.id != trans.user.id:
+ message = "The OpenID <strong>%s</strong> is already associated with another Galaxy account, <strong>%s</strong>. Please disassociate it from that account before attempting to associate it with a new account." % ( display_identifier, user_openid.user.email )
+ status = "error"
+ elif user_openid.user and user_openid.user.id == trans.user.id:
+ message = "The OpenID <strong>%s</strong> is already associated with your Galaxy account, <strong>%s</strong>." % ( display_identifier, trans.user.email )
+ status = "warning"
+ else:
+ user_openid.user_id = trans.user.id
+ trans.sa_session.add( user_openid )
+ trans.sa_session.flush()
+ trans.log_event( "User associated OpenID: %s" % display_identifier )
+ message = "The OpenID <strong>%s</strong> has been associated with your Galaxy account, <strong>%s</strong>." % ( display_identifier, trans.user.email )
+ status = "done"
+ trans.response.send_redirect( url_for( controller='user',
+ action='openid_manage',
+ use_panels=True,
+ message=message,
+ status=status ) )
+ return
+ trans.sa_session.add( user_openid )
+ trans.sa_session.flush()
+ message = "OpenID authentication was successful, but you need to associate your OpenID with a Galaxy account."
+ sreg_resp = trans.app.openid_manager.get_sreg( info )
+ try:
+ username = sreg_resp.get( 'nickname', '' )
+ except AttributeError:
+ username = ''
+ try:
+ email = sreg_resp.get( 'email', '' )
+ except AttributeError:
+ email = ''
+ trans.response.send_redirect( url_for( controller='user',
+ action='openid_associate',
+ use_panels=True,
+ username=username,
+ email=email,
+ message=message,
+ status='warning' ) )
+ elif info.status == trans.app.openid_manager.CANCEL:
+ message = "Login via OpenID was cancelled by an action at the OpenID provider's site."
+ status = "warning"
+ elif info.status == trans.app.openid_manager.SETUP_NEEDED:
+ if info.setup_url:
+ return trans.response.send_redirect( info.setup_url )
+ else:
+ message = "Unable to log in via OpenID. Setup at the provider is required before this OpenID can be used. Please visit your provider's site to complete this step."
+ return trans.response.send_redirect( url_for( controller='user',
+ action=action,
+ use_panels=True,
+ message=message,
+ status=status ) )
+ @web.expose
+ def openid_associate( self, trans, webapp='galaxy', **kwd ):
+ if not trans.app.config.enable_openid:
+ return trans.show_error_message( 'OpenID authentication is not enabled in this instance of Galaxy' )
+ use_panels = util.string_as_bool( kwd.get( 'use_panels', False ) )
+ message = kwd.get( 'message', '' )
+ status = kwd.get( 'status', 'done' )
+ email = kwd.get( 'email', '' )
+ username = kwd.get( 'username', '' )
+ referer = kwd.get( 'referer', trans.request.referer )
+ params = util.Params( kwd )
+ admin_view = util.string_as_bool( params.get( 'admin_view', False ) )
+ openids = trans.galaxy_session.openids
+ if not openids:
+ return trans.show_error_message( 'You have not successfully completed an OpenID authentication in this session. You can do so on the <a href="%s">login</a> page.' % url_for( controller='user', action='login', use_panels=use_panels ) )
+ elif admin_view:
+ return trans.show_error_message( 'Associating OpenIDs with accounts cannot be done by administrators.' )
+ if kwd.get( 'login_button', False ):
+ message, status, user, success = self.__validate_login( trans, webapp, **kwd )
+ if success:
+ for openid in openids:
+ openid.user = user
+ trans.sa_session.add( openid )
+ trans.sa_session.flush()
+ for openid in openids:
+ trans.log_event( "User associated OpenID: %s" % openid.openid )
+ redirect_url = referer
+ if not redirect_url:
+ redirect_url = url_for( '/' )
+ trans.response.send_redirect( redirect_url )
+ return
+ if kwd.get( 'create_user_button', False ):
+ password = kwd.get( 'password', '' )
+ confirm = kwd.get( 'confirm', '' )
+ subscribe = params.get( 'subscribe', '' )
+ subscribe_checked = CheckboxField.is_checked( subscribe )
+ error = ''
+ if not trans.app.config.allow_user_creation and not trans.user_is_admin():
+ error = 'User registration is disabled. Please contact your Galaxy administrator for an account.'
+ else:
+ # Check email and password validity
+ error = self.__validate( trans, params, email, password, confirm, username, webapp )
+ if not error:
+ # all the values are valid
+ message, status, user, success = self.__register( trans, webapp, email, password, username, subscribe_checked, kwd )
+ if success:
+ trans.handle_user_login( user, webapp )
+ trans.log_event( "User created a new account" )
+ trans.log_event( "User logged in" )
+ for openid in openids:
+ openid.user = user
+ trans.sa_session.add( openid )
+ trans.sa_session.flush()
+ for openid in openids:
+ trans.log_event( "User associated OpenID: %s" % openid.openid )
+ redirect_url = referer
+ if not redirect_url:
+ redirect_url = url_for( '/' )
+ trans.response.send_redirect( redirect_url )
+ else:
+ message = error
+ status = 'error'
+ if webapp == 'galaxy':
+ user_info_select, user_info_form, widgets = self.__user_info_ui( trans, **kwd )
+ else:
+ user_info_select = []
+ user_info_form = []
+ widgets = []
+ return trans.fill_template( '/user/openid_associate.mako',
+ webapp=webapp,
+ email=email,
+ password='',
+ confirm='',
+ username=username,
+ header='',
+ use_panels=use_panels,
+ redirect_url='',
+ referer='',
+ refresh_frames=[],
+ message=message,
+ status=status,
+ active_view="user",
+ subscribe_checked=False,
+ admin_view=False,
+ user_info_select=user_info_select,
+ user_info_form=user_info_form,
+ widgets=widgets,
+ openids=openids )
+ @web.expose
+ @web.require_login( 'manage OpenIDs' )
+ def openid_disassociate( self, trans, webapp='galaxy', **kwd ):
+ if not trans.app.config.enable_openid:
+ return trans.show_error_message( 'OpenID authentication is not enabled in this instance of Galaxy' )
+ params = util.Params( kwd )
+ ids = params.get( 'id', None )
+ message = params.get( 'message', None )
+ status = params.get( 'status', None )
+ use_panels = params.get( 'use_panels', False )
+ user_openids = []
+ if not ids:
+ message = 'You must select at least one OpenID to disassociate from your Galaxy account.'
+ status = 'error'
+ else:
+ ids = util.listify( params.id )
+ for id in ids:
+ id = trans.security.decode_id( id )
+ user_openid = trans.sa_session.query( trans.app.model.UserOpenID ).get( int( id ) )
+ if not user_openid or ( trans.user.id != user_openid.user_id ):
+ message = 'The selected OpenID(s) are not associated with your Galaxy account.'
+ status = 'error'
+ user_openids = []
+ break
+ user_openids.append( user_openid )
+ if user_openids:
+ deleted_urls = []
+ for user_openid in user_openids:
+ trans.sa_session.delete( user_openid )
+ deleted_urls.append( user_openid.openid )
+ trans.sa_session.flush()
+ for deleted_url in deleted_urls:
+ trans.log_event( "User disassociated OpenID: %s" % deleted_url )
+ message = '%s OpenIDs were disassociated from your Galaxy account.' % len( ids )
+ status = 'done'
+ trans.response.send_redirect( url_for( controller='user',
+ action='openid_manage',
+ use_panels=use_panels,
+ message=message,
+ status=status ) )
+ @web.expose
+ @web.require_login( 'manage OpenIDs' )
+ def openid_manage( self, trans, webapp='galaxy', **kwd ):
+ if not trans.app.config.enable_openid:
+ return trans.show_error_message( 'OpenID authentication is not enabled in this instance of Galaxy' )
+ use_panels = kwd.get( 'use_panels', False )
+ if 'operation' in kwd:
+ operation = kwd['operation'].lower()
+ if operation == "delete":
+ trans.response.send_redirect( url_for( controller='user',
+ action='openid_disassociate',
+ use_panels=use_panels,
+ id=kwd['id'] ) )
+ kwd['referer'] = url_for( controller='user', action='openid_manage', use_panels=True )
+ kwd['openid_providers'] = OPENID_PROVIDERS
+ return self.user_openid_grid( trans, **kwd )
+ @web.expose
def login( self, trans, webapp='galaxy', redirect_url='', refresh_frames=[], **kwd ):
referer = kwd.get( 'referer', trans.request.referer )
- use_panels = util.string_as_bool( kwd.get( 'use_panels', True ) )
+ use_panels = util.string_as_bool( kwd.get( 'use_panels', False ) )
message = kwd.get( 'message', '' )
status = kwd.get( 'status', 'done' )
header = ''
user = None
email = kwd.get( 'email', '' )
if kwd.get( 'login_button', False ):
- password = kwd.get( 'password', '' )
- referer = kwd.get( 'referer', '' )
if webapp == 'galaxy' and not refresh_frames:
if trans.app.config.require_login:
refresh_frames = [ 'masthead', 'history', 'tools' ]
else:
refresh_frames = [ 'masthead', 'history' ]
- user = trans.sa_session.query( trans.app.model.User ).filter( trans.app.model.User.table.c.email==email ).first()
- if not user:
- message = "No such user"
- status = 'error'
- elif user.deleted:
- message = "This account has been marked deleted, contact your Galaxy administrator to restore the account."
- status = 'error'
- elif user.external:
- message = "This account was created for use with an external authentication method, contact your local Galaxy administrator to activate it."
- status = 'error'
- elif not user.check_password( password ):
- message = "Invalid password"
- status = 'error'
- else:
- trans.handle_user_login( user, webapp )
- trans.log_event( "User logged in" )
- message = 'You are now logged in as %s.<br>You can <a target="_top" href="%s">go back to the page you were visiting</a> or <a target="_top" href="%s">go to the home page</a>.' % \
- ( user.email, referer, url_for( '/' ) )
- if trans.app.config.require_login:
- message += ' <a target="_top" href="%s">Click here</a> to continue to the home page.' % web.url_for( '/static/welcome.html' )
+ message, status, user, success = self.__validate_login( trans, webapp, **kwd )
+ if success and referer:
redirect_url = referer
+ elif success:
+ redirect_url = url_for( '/' )
if not user and trans.app.config.require_login:
if trans.app.config.allow_user_creation:
header = require_login_creation_template % web.url_for( action='create' )
@@ -83,7 +373,37 @@ class User( BaseController, UsesFormDefi
refresh_frames=refresh_frames,
message=message,
status=status,
+ openid_providers=OPENID_PROVIDERS,
active_view="user" )
+ def __validate_login( self, trans, webapp='galaxy', **kwd ):
+ message = kwd.get( 'message', '' )
+ status = kwd.get( 'status', 'done' )
+ email = kwd.get( 'email', '' )
+ password = kwd.get( 'password', '' )
+ referer = kwd.get( 'referer', trans.request.referer )
+ success = False
+ user = trans.sa_session.query( trans.app.model.User ).filter( trans.app.model.User.table.c.email==email ).first()
+ if not user:
+ message = "No such user"
+ status = 'error'
+ elif user.deleted:
+ message = "This account has been marked deleted, contact your Galaxy administrator to restore the account."
+ status = 'error'
+ elif user.external:
+ message = "This account was created for use with an external authentication method, contact your local Galaxy administrator to activate it."
+ status = 'error'
+ elif not user.check_password( password ):
+ message = "Invalid password"
+ status = 'error'
+ else:
+ trans.handle_user_login( user, webapp )
+ trans.log_event( "User logged in" )
+ message = 'You are now logged in as %s.<br>You can <a target="_top" href="%s">go back to the page you were visiting</a> or <a target="_top" href="%s">go to the home page</a>.' % \
+ ( user.email, referer, url_for( '/' ) )
+ if trans.app.config.require_login:
+ message += ' <a target="_top" href="%s">Click here</a> to continue to the home page.' % web.url_for( '/static/welcome.html' )
+ success = True
+ return ( message, status, user, success )
@web.expose
def logout( self, trans, webapp='galaxy' ):
if webapp == 'galaxy':
@@ -138,54 +458,25 @@ class User( BaseController, UsesFormDefi
error = self.__validate( trans, params, email, password, confirm, username, webapp )
if not error:
# all the values are valid
- user = trans.app.model.User( email=email )
- user.set_password_cleartext( password )
- user.username = username
- trans.sa_session.add( user )
- trans.sa_session.flush()
- trans.app.security_agent.create_private_user_role( user )
- message = 'Now logged in as %s.<br><a target="_top" href="%s">Return to the home page.</a>' % ( user.email, url_for( '/' ) )
- if webapp == 'galaxy':
- # We set default user permissions, before we log in and set the default history permissions
- trans.app.security_agent.user_set_default_permissions( user,
- default_access_private=trans.app.config.new_user_dataset_access_role_default_private )
- # save user info
- self.__save_user_info( trans, user, action='create', new_user=True, **kwd )
- if subscribe_checked:
- # subscribe user to email list
- if trans.app.config.smtp_server is None:
- error = "Now logged in as " + user.email + ". However, subscribing to the mailing list has failed because mail is not configured for this Galaxy instance."
- else:
- msg = MIMEText( 'Join Mailing list.\n' )
- to = msg[ 'To' ] = trans.app.config.mailing_join_addr
- frm = msg[ 'From' ] = email
- msg[ 'Subject' ] = 'Join Mailing List'
- try:
- s = smtplib.SMTP()
- s.connect( trans.app.config.smtp_server )
- s.sendmail( frm, [ to ], msg.as_string() )
- s.close()
- except:
- error = "Now logged in as " + user.email + ". However, subscribing to the mailing list has failed."
- if not error and not admin_view:
- # The handle_user_login() method has a call to the history_set_default_permissions() method
- # (needed when logging in with a history), user needs to have default permissions set before logging in
- trans.handle_user_login( user, webapp )
- trans.log_event( "User created a new account" )
- trans.log_event( "User logged in" )
- elif not error:
- trans.response.send_redirect( web.url_for( controller='admin',
- action='users',
- message='Created new user account (%s)' % user.email,
- status='done' ) )
- elif not admin_view:
+ message, status, user, success = self.__register( trans, webapp, email, password, username, subscribe_checked, kwd )
+ if success and not admin_view and webapp != 'galaxy':
# Must be logging into the community space webapp
trans.handle_user_login( user, webapp )
- if not error:
- redirect_url = referer
- if error:
- message=error
- status='error'
+ redirect_url = referer
+ if success and not admin_view:
+ # The handle_user_login() method has a call to the history_set_default_permissions() method
+ # (needed when logging in with a history), user needs to have default permissions set before logging in
+ trans.handle_user_login( user, webapp )
+ trans.log_event( "User created a new account" )
+ trans.log_event( "User logged in" )
+ elif success:
+ trans.response.send_redirect( web.url_for( controller='admin',
+ action='users',
+ message='Created new user account (%s)' % user.email,
+ status='done' ) )
+ else:
+ message = error
+ status = 'error'
if webapp == 'galaxy':
user_info_select, user_info_form, widgets = self.__user_info_ui( trans, **kwd )
else:
@@ -209,6 +500,57 @@ class User( BaseController, UsesFormDefi
refresh_frames=refresh_frames,
message=message,
status=status )
+ def __register( self, trans, webapp, email, password, username, subscribe_checked, kwd ):
+ status = kwd.get( 'status', 'done' )
+ admin_view = util.string_as_bool( kwd.get( 'admin_view', False ) )
+ user = trans.app.model.User( email=email )
+ user.set_password_cleartext( password )
+ user.username = username
+ trans.sa_session.add( user )
+ trans.sa_session.flush()
+ trans.app.security_agent.create_private_user_role( user )
+ error = ''
+ if webapp == 'galaxy':
+ # We set default user permissions, before we log in and set the default history permissions
+ trans.app.security_agent.user_set_default_permissions( user,
+ default_access_private=trans.app.config.new_user_dataset_access_role_default_private )
+ # save user info
+ self.__save_user_info( trans, user, action='create', new_user=True, **kwd )
+ if subscribe_checked:
+ # subscribe user to email list
+ if trans.app.config.smtp_server is None:
+ error = "Now logged in as " + user.email + ". However, subscribing to the mailing list has failed because mail is not configured for this Galaxy instance."
+ else:
+ msg = MIMEText( 'Join Mailing list.\n' )
+ to = msg[ 'To' ] = trans.app.config.mailing_join_addr
+ frm = msg[ 'From' ] = email
+ msg[ 'Subject' ] = 'Join Mailing List'
+ try:
+ s = smtplib.SMTP()
+ s.connect( trans.app.config.smtp_server )
+ s.sendmail( frm, [ to ], msg.as_string() )
+ s.close()
+ except:
+ error = "Now logged in as " + user.email + ". However, subscribing to the mailing list has failed."
+ if not error and not admin_view:
+ # The handle_user_login() method has a call to the history_set_default_permissions() method
+ # (needed when logging in with a history), user needs to have default permissions set before logging in
+ trans.handle_user_login( user, webapp )
+ trans.log_event( "User created a new account" )
+ trans.log_event( "User logged in" )
+ elif not error:
+ trans.response.send_redirect( web.url_for( controller='admin',
+ action='users',
+ message='Created new user account (%s)' % user.email,
+ status='done' ) )
+ if error:
+ message = error
+ status = 'error'
+ success = False
+ else:
+ message = 'Now logged in as %s.<br><a target="_top" href="%s">Return to the home page.</a>' % ( user.email, url_for( '/' ) )
+ success = True
+ return ( message, status, user, success )
def __save_user_info(self, trans, user, action, new_user=True, **kwd):
'''
This method saves the user information for new users as well as editing user
--- a/templates/grid_base.mako
+++ b/templates/grid_base.mako
@@ -29,12 +29,19 @@
##
<%def name="center_panel()">
- ${make_grid( grid )}
+ ${self.grid_body( grid )}
</%def>
## Render the grid's basic elements. Each of these elements can be subclassed.
<%def name="body()">
- ${make_grid( grid )}
+ ${self.grid_body( grid )}
+</%def>
+
+## Because body() is special and always exists even if not explicitly defined,
+## it's not possible to override body() in the topmost template in the chain.
+## Because of this, override grid_body() instead.
+<%def name="grid_body( grid )">
+ ${self.make_grid( grid )}
</%def><%def name="title()">${grid.title}</%def>
1
0

galaxy-dist commit 56431b214df1: Don't 'use strict' as FF4 beta doesn't support it
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1289944688 18000
# Node ID 56431b214df16653a966b96bf399c7646da267b8
# Parent 394d8186f666b506cd0a93aefb7a079e0c9ec59b
Don't 'use strict' as FF4 beta doesn't support it
--- a/static/scripts/jquery.jstore.js
+++ b/static/scripts/jquery.jstore.js
@@ -15,7 +15,7 @@
* http://creativecommons.org/licenses/by/3.0/us
*/
-"use strict";
+//"use strict";
/*global Class, window, jQuery, ActiveXObject, google */
--- a/static/scripts/class.js
+++ b/static/scripts/class.js
@@ -5,7 +5,7 @@
* Inspired by base2 and Prototype
*/
-"use strict";
+//"use strict";
(function () {
--- a/static/scripts/packed/jquery.jstore.js
+++ b/static/scripts/packed/jquery.jstore.js
@@ -14,4 +14,4 @@
* Licensed under the Creative Commons Attribution 3.0 United States License:
* http://creativecommons.org/licenses/by/3.0/us
*/
-"use strict";(function(i,n){var h="JSTORE_ENGINE_UNSTABLE",t="JSTORE_UNKNOWN_ENGINE_REQUESTED",r="JSTORE_ENGINE_NAMESPACE_COLLISION",j="JSTORE_RESOURCE_NAMESPACE_COLLISION",m="JSTORE_ENGINE_UNAVAILABLE",o="JSTORE_INVALID_FLAVOR",f=(function(){try{return new RegExp('^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t])+?$')}catch(I){return(/^(true|false|null|\[.*\]|\{.*\}|".*"|\d+|\d+\.\d+)$/)}}()),b="jstore-html5-local",y="jstore-html5-sql",F="jstore-flash",G="jstore-google-gears",A="jstore-msie",u,E={},D={},C={},c=false,d={},q={project:undefined,flash:"jStore.Flash.html",json:"browser.json.js"},l;function z(I){switch(I){case b:case y:case F:case G:case A:return true;default:return false}}function g(I,J){return !I?false:I.constructor.toString().match(new RegExp(J+"\\(\\)","i"))!==null}function s(K,I,J){if(g(K,"Function")){return K.apply(I||E,g(J,"Array")?J:[J])}}function p(J,I){i.ajax({url:J,complete:I||i.noop(),type:"GET",dataType:"script",cache:false})}func
tion x(I){if(I===undefined){return""}if(g(I,"Object")||g(I,"Array")||g(I,"Function")){return JSON.stringify(I)}return I}function k(I){return f.test(I)?JSON.parse(I):I}function w(I){return I.replace(/^\s+|\s+$/g,"")}function e(I,J,K){if(!z(I)){throw o}if(K[I]!==undefined){throw r}if(s(K)===true){E.available[I]=true;J.flavor=I;D[I]=u.extend(J)}else{E.available[I]=false;E.enginePriority=i.map(E.enginePriority,function(L){if(L===I){return null}else{return L}})}}function v(){if(E.isReady){return}if((c&&E.isFlashReady)||!c){E.isReady=true;E.trigger("jstore-ready",[C[l]])}}function a(){E.create(E.enginePriority[0],undefined,"best-fit")}function H(){try{var J=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");try{J.AllowScriptAccess="always"}catch(L){return"6,0,0"}return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(K){try{if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){return(navi
gator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}}catch(I){}}return"0,0,0"}function B(I){var N=H().match(/\d+/g),L=I.match(/\d+/g),J=0,K,M;for(;J<3;J++){K=parseInt(N[J],10);M=parseInt(L[J],10);if(K<M){return false}else{if(K>M){return true}}}return true}i.extend(E,{enginePriority:[b,y,F,A],available:{},isReady:false,isFlashReady:false,flavors:{local:b,sql:y,flash:F,gears:G,msie:A},init:function(J,K,I){i.extend(q,{project:J},K);i(function(){if(n.JSON===undefined){p(q.json)}if(I!==undefined){E.create(I,J,"default")}else{a()}});return E},create:function(I,M,J){M=M||q.project||location.hostname.replace(/\./g,"-")||"unknown";if(!z(I)){throw o}if(D[I]===undefined){throw m}var L=(J!==undefined?J+".":"")+M+"."+I,K;if(C[L]!==undefined){throw j}K=C[L]=new D[I](M,L);K.ready(function(){E.trigger("jstore-engine-ready",[K])});if(I===F&&!E.isFlashReady){if(l===undefined){c=true}n.jstore_ready=function(){E.isFl
ashReady=true;E.trigger("flash-ready");if(l===undefined){v()}n.flash_ready=undefined};n.jstore_error=function(N){E.trigger("jstore-error",["JSTORE_FLASH_EXCEPTION",null,N])};i('<iframe style="height:1px;width:1px;position:absolute;left:0;top:0;margin-left:-100px;" id="jStoreFlashFrame" src="'+q.flash+'"></iframe>').appendTo("body")}else{if(l===undefined){l=L;v()}}return K},engine:function(I){return C[I]},activeEngine:function(I){if(I!==undefined){if(C[I]===undefined){throw t}else{l=I}}return C[l]},bind:function(J,K,I){I=I||"jstore";if(d[I]===undefined){d[I]={}}if(d[I][J]===undefined){d[I][J]=[K]}else{d[I][J].push(K)}return E},trigger:function(K,J,I){I=I||"jstore";if(d[I]!==undefined){if(d[I][K]!==undefined){i.each(d[I][K],function(){s(this,E,J)})}}return E},error:function(I){E.bind("jstore-error",I)},ready:function(I){if(E.isReady){s(I)}else{E.bind("jstore-ready",I)}return E},engineReady:function(I){if(E.isReady){s(I)}else{E.bind("jstore-engine-ready",I)}return E},store:func
tion(I,J){return J===undefined?E.get(I):E.set(I,J)},remove:function(I){return E.activeEngine().remove(I)},get:function(I){return E.activeEngine().get(I)},set:function(I,J){return E.activeEngine().set(I,J)}});u=Class.extend({project:undefined,jri:undefined,flavor:undefined,database:undefined,data:undefined,limit:undefined,isReady:undefined,init:function(J,I){this.project=J;this.jri=I;this.data={};this.isReady=false;this.updateCache()},updateCache:function(){this.isReady=true;this.trigger("engine-ready",[this])},bind:function(I,J){E.bind(I,J,this.jri)},trigger:function(J,I){E.trigger(J,I,this.jri)},ready:function(I){if(this.isReady){s(I,this)}else{this.bind("engine-ready",I)}},get:function(I){this.__interruptAccess();return this.data[I]},set:function(I,J){this.__interruptAccess();I=w(I);try{this.__set(I,J)}catch(K){E.trigger("jstore-error",["JSTORE_STORAGE_FAILURE",this.jri,K])}this.data[I]=J;return J},remove:function(J){this.__interruptAccess();J=w(J);try{this.__remove(J)}cat
ch(K){E.trigger("jstore-error",["JSTORE_REMOVE_FAILURE",this.jri,K])}var I=this.data[J];this.data[J]=undefined;return I},__interruptAccess:function(){if(!this.isReady){throw h}},__set:function(I,J){return},__remove:function(I){return}});i.extend(i.fn,{store:function(I,J){if(J===undefined){E.get(I)}else{E.set(I,J)}return this},removeStore:function(I){E.activeEngine().remove(I);return this},getStore:function(I){return E.activeEngine().get(I)},setStore:function(I,J){E.activeEngine().set(I,J);return this}});n.jStore=i.jStore=E;e(b,{limit:parseInt(500000,16),init:function(J,I){this.database=n.globalStorage===undefined?n.localStorage:n.globalStorage[location.hostname];this._super(J,I)},updateCache:function(){var J,K;for(J in this.database){var I=false;if(this.database.hasOwnProperty){if(this.database.hasOwnProperty(J)){I=true}}else{if(this.database.getItem(J)!==null){I=true}}if(I){K=this.database.getItem(J);this.data[J]=k(K&&K.value?K.value:K)}}this._super()},__set:function(I,J){t
his.database.setItem(I,x(J))},__remove:function(I){this.database.removeItem(I)}},function(){return n.localStorage!==undefined||n.globalStorage!==undefined});e(y,{limit:parseInt(32000,16),init:function(J,I){this.database=n.openDatabase("jstore-"+J,"1.0",J,this.limit);if(!this.database){throw"JSTORE_SQL_NO_DB"}this.database.transaction(function(K){K.executeSql("CREATE TABLE IF NOT EXISTS jstore (k TEXT UNIQUE NOT NULL PRIMARY KEY, v TEXT NOT NULL)")});this._super(J,I)},updateCache:function(){var I=this,J=this._super;this.database.transaction(function(K){K.executeSql("SELECT k,v FROM jstore",[],function(O,L){var N=L.rows,M=0,P;for(;M<N.length;++M){P=N.item(M);I.data[P.k]=k(P.v)}J.apply(I)})})},__set:function(I,J){this.database.transaction(function(K){K.executeSql("INSERT OR REPLACE INTO jstore(k, v) VALUES (?, ?)",[I,x(J)])})},__remove:function(I){this.database.transaction(function(J){J.executeSql("DELETE FROM jstore WHERE k = ?",[I])})}},function(){return n.openDatabase!==unde
fined});e(F,{limit:-1,init:function(K,J){var I=this;E.bind("flash-ready",function(){I.__flashReadyListener()});this._super(K,J)},updateCache:function(I){if(I===true){var J,K=this.database.jstore_get_all();for(J in K){if(K.hasOwnProperty(J)){this.data[J]=k(this.database.jstore_get(J))}}this._super()}},__set:function(I,J){if(!this.database.jstore_set(I,x(J))){E.trigger("jstore-error",["JSTORE_STORAGE_FAILURE",this.jri,"Flash Exception"])}},__remove:function(I){this.database.jstore_remove(I)},__flashReadyListener:function(){var I=i("#jStoreFlashFrame")[0],J;if(I.Document!==undefined&&g(I.Document.jStoreFlash.jstore_get,"Function")){this.database=I.Document.jStoreFlash}else{if(I.contentWindow&&I.contentWindow.document){J=i(I.contentWindow.document);if(g(i("object",J)[0].jstore_get,"Function")){this.database=i("object",J)[0]}else{if(g(i("embed",J)[0].jstore_get,"Function")){this.database=i("embed",J)[0]}}}}if(this.database===undefined){throw"JSTORE_FLASH_REFERENCE_ISSUE"}else{thi
s.updateCache(true)}}},function(){return B("9.0.0")});e(G,{limit:-1,init:function(J,I){this.database=google.gears.factory.create("beta.database");this.database.open("jstore-"+J);this.database.execute("CREATE TABLE IF NOT EXISTS jstore (k TEXT UNIQUE NOT NULL PRIMARY KEY, v TEXT NOT NULL)");this._super(J,I)},updateCache:function(){var I=this.database.execute("SELECT k,v FROM jstore");while(I.isValidRow()){this.data[I.field(0)]=k(I.field(1));I.next()}I.close();this._super()},__set:function(I,J){this.database.execute("BEGIN");this.database.execute("INSERT OR REPLACE INTO jstore(k, v) VALUES (?, ?)",[I,x(J)]);this.database.execute("COMMIT")},__remove:function(I){this.database.execute("BEGIN");this.database.execute("DELETE FROM jstore WHERE k = ?",[I]);this.database.execute("COMMIT")}},function(){return n.google!==undefined&&n.google.gears!==undefined});e(A,{limit:parseInt(10000,16),init:function(J,I){this.database=i('<div style="display:none;behavior:url(\'#default#userData\')"
id="jstore-'+J+'"></div>').appendTo(document.body).get(0);this._super(J,I)},updateCache:function(){this.database.load(this.project);var K=document.getElementById("jstore-"+this.project),L=K.XMLDocument,I,J=0;if(L&&L.documentElement&&L.documentElement.attributes){I=L.documentElement;for(;J<I.attributes.length;++J){this.data[I.attributes.item(J).nodeName]=k(I.attributes.item(J).nodeValue)}}this._super()},__set:function(I,J){this.database.setAttribute(I,x(J));this.database.save(this.project)},__remove:function(I){this.database.removeAttribute(I);this.database.save(this.project)}},function(){return n.ActiveXObject!==undefined})}(jQuery,window));
+(function(i,n){var h="JSTORE_ENGINE_UNSTABLE",t="JSTORE_UNKNOWN_ENGINE_REQUESTED",r="JSTORE_ENGINE_NAMESPACE_COLLISION",j="JSTORE_RESOURCE_NAMESPACE_COLLISION",m="JSTORE_ENGINE_UNAVAILABLE",o="JSTORE_INVALID_FLAVOR",f=(function(){try{return new RegExp('^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t])+?$')}catch(I){return(/^(true|false|null|\[.*\]|\{.*\}|".*"|\d+|\d+\.\d+)$/)}}()),b="jstore-html5-local",y="jstore-html5-sql",F="jstore-flash",G="jstore-google-gears",A="jstore-msie",u,E={},D={},C={},c=false,d={},q={project:undefined,flash:"jStore.Flash.html",json:"browser.json.js"},l;function z(I){switch(I){case b:case y:case F:case G:case A:return true;default:return false}}function g(I,J){return !I?false:I.constructor.toString().match(new RegExp(J+"\\(\\)","i"))!==null}function s(K,I,J){if(g(K,"Function")){return K.apply(I||E,g(J,"Array")?J:[J])}}function p(J,I){i.ajax({url:J,complete:I||i.noop(),type:"GET",dataType:"script",cache:false})}function x(I){if(
I===undefined){return""}if(g(I,"Object")||g(I,"Array")||g(I,"Function")){return JSON.stringify(I)}return I}function k(I){return f.test(I)?JSON.parse(I):I}function w(I){return I.replace(/^\s+|\s+$/g,"")}function e(I,J,K){if(!z(I)){throw o}if(K[I]!==undefined){throw r}if(s(K)===true){E.available[I]=true;J.flavor=I;D[I]=u.extend(J)}else{E.available[I]=false;E.enginePriority=i.map(E.enginePriority,function(L){if(L===I){return null}else{return L}})}}function v(){if(E.isReady){return}if((c&&E.isFlashReady)||!c){E.isReady=true;E.trigger("jstore-ready",[C[l]])}}function a(){E.create(E.enginePriority[0],undefined,"best-fit")}function H(){try{var J=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");try{J.AllowScriptAccess="always"}catch(L){return"6,0,0"}return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(K){try{if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){return(navigator.plugins
["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}}catch(I){}}return"0,0,0"}function B(I){var N=H().match(/\d+/g),L=I.match(/\d+/g),J=0,K,M;for(;J<3;J++){K=parseInt(N[J],10);M=parseInt(L[J],10);if(K<M){return false}else{if(K>M){return true}}}return true}i.extend(E,{enginePriority:[b,y,F,A],available:{},isReady:false,isFlashReady:false,flavors:{local:b,sql:y,flash:F,gears:G,msie:A},init:function(J,K,I){i.extend(q,{project:J},K);i(function(){if(n.JSON===undefined){p(q.json)}if(I!==undefined){E.create(I,J,"default")}else{a()}});return E},create:function(I,M,J){M=M||q.project||location.hostname.replace(/\./g,"-")||"unknown";if(!z(I)){throw o}if(D[I]===undefined){throw m}var L=(J!==undefined?J+".":"")+M+"."+I,K;if(C[L]!==undefined){throw j}K=C[L]=new D[I](M,L);K.ready(function(){E.trigger("jstore-engine-ready",[K])});if(I===F&&!E.isFlashReady){if(l===undefined){c=true}n.jstore_ready=function(){E.isFlashReady=true
;E.trigger("flash-ready");if(l===undefined){v()}n.flash_ready=undefined};n.jstore_error=function(N){E.trigger("jstore-error",["JSTORE_FLASH_EXCEPTION",null,N])};i('<iframe style="height:1px;width:1px;position:absolute;left:0;top:0;margin-left:-100px;" id="jStoreFlashFrame" src="'+q.flash+'"></iframe>').appendTo("body")}else{if(l===undefined){l=L;v()}}return K},engine:function(I){return C[I]},activeEngine:function(I){if(I!==undefined){if(C[I]===undefined){throw t}else{l=I}}return C[l]},bind:function(J,K,I){I=I||"jstore";if(d[I]===undefined){d[I]={}}if(d[I][J]===undefined){d[I][J]=[K]}else{d[I][J].push(K)}return E},trigger:function(K,J,I){I=I||"jstore";if(d[I]!==undefined){if(d[I][K]!==undefined){i.each(d[I][K],function(){s(this,E,J)})}}return E},error:function(I){E.bind("jstore-error",I)},ready:function(I){if(E.isReady){s(I)}else{E.bind("jstore-ready",I)}return E},engineReady:function(I){if(E.isReady){s(I)}else{E.bind("jstore-engine-ready",I)}return E},store:function(I,J){ret
urn J===undefined?E.get(I):E.set(I,J)},remove:function(I){return E.activeEngine().remove(I)},get:function(I){return E.activeEngine().get(I)},set:function(I,J){return E.activeEngine().set(I,J)}});u=Class.extend({project:undefined,jri:undefined,flavor:undefined,database:undefined,data:undefined,limit:undefined,isReady:undefined,init:function(J,I){this.project=J;this.jri=I;this.data={};this.isReady=false;this.updateCache()},updateCache:function(){this.isReady=true;this.trigger("engine-ready",[this])},bind:function(I,J){E.bind(I,J,this.jri)},trigger:function(J,I){E.trigger(J,I,this.jri)},ready:function(I){if(this.isReady){s(I,this)}else{this.bind("engine-ready",I)}},get:function(I){this.__interruptAccess();return this.data[I]},set:function(I,J){this.__interruptAccess();I=w(I);try{this.__set(I,J)}catch(K){E.trigger("jstore-error",["JSTORE_STORAGE_FAILURE",this.jri,K])}this.data[I]=J;return J},remove:function(J){this.__interruptAccess();J=w(J);try{this.__remove(J)}catch(K){E.trigg
er("jstore-error",["JSTORE_REMOVE_FAILURE",this.jri,K])}var I=this.data[J];this.data[J]=undefined;return I},__interruptAccess:function(){if(!this.isReady){throw h}},__set:function(I,J){return},__remove:function(I){return}});i.extend(i.fn,{store:function(I,J){if(J===undefined){E.get(I)}else{E.set(I,J)}return this},removeStore:function(I){E.activeEngine().remove(I);return this},getStore:function(I){return E.activeEngine().get(I)},setStore:function(I,J){E.activeEngine().set(I,J);return this}});n.jStore=i.jStore=E;e(b,{limit:parseInt(500000,16),init:function(J,I){this.database=n.globalStorage===undefined?n.localStorage:n.globalStorage[location.hostname];this._super(J,I)},updateCache:function(){var J,K;for(J in this.database){var I=false;if(this.database.hasOwnProperty){if(this.database.hasOwnProperty(J)){I=true}}else{if(this.database.getItem(J)!==null){I=true}}if(I){K=this.database.getItem(J);this.data[J]=k(K&&K.value?K.value:K)}}this._super()},__set:function(I,J){this.database.
setItem(I,x(J))},__remove:function(I){this.database.removeItem(I)}},function(){return n.localStorage!==undefined||n.globalStorage!==undefined});e(y,{limit:parseInt(32000,16),init:function(J,I){this.database=n.openDatabase("jstore-"+J,"1.0",J,this.limit);if(!this.database){throw"JSTORE_SQL_NO_DB"}this.database.transaction(function(K){K.executeSql("CREATE TABLE IF NOT EXISTS jstore (k TEXT UNIQUE NOT NULL PRIMARY KEY, v TEXT NOT NULL)")});this._super(J,I)},updateCache:function(){var I=this,J=this._super;this.database.transaction(function(K){K.executeSql("SELECT k,v FROM jstore",[],function(O,L){var N=L.rows,M=0,P;for(;M<N.length;++M){P=N.item(M);I.data[P.k]=k(P.v)}J.apply(I)})})},__set:function(I,J){this.database.transaction(function(K){K.executeSql("INSERT OR REPLACE INTO jstore(k, v) VALUES (?, ?)",[I,x(J)])})},__remove:function(I){this.database.transaction(function(J){J.executeSql("DELETE FROM jstore WHERE k = ?",[I])})}},function(){return n.openDatabase!==undefined});e(F,{
limit:-1,init:function(K,J){var I=this;E.bind("flash-ready",function(){I.__flashReadyListener()});this._super(K,J)},updateCache:function(I){if(I===true){var J,K=this.database.jstore_get_all();for(J in K){if(K.hasOwnProperty(J)){this.data[J]=k(this.database.jstore_get(J))}}this._super()}},__set:function(I,J){if(!this.database.jstore_set(I,x(J))){E.trigger("jstore-error",["JSTORE_STORAGE_FAILURE",this.jri,"Flash Exception"])}},__remove:function(I){this.database.jstore_remove(I)},__flashReadyListener:function(){var I=i("#jStoreFlashFrame")[0],J;if(I.Document!==undefined&&g(I.Document.jStoreFlash.jstore_get,"Function")){this.database=I.Document.jStoreFlash}else{if(I.contentWindow&&I.contentWindow.document){J=i(I.contentWindow.document);if(g(i("object",J)[0].jstore_get,"Function")){this.database=i("object",J)[0]}else{if(g(i("embed",J)[0].jstore_get,"Function")){this.database=i("embed",J)[0]}}}}if(this.database===undefined){throw"JSTORE_FLASH_REFERENCE_ISSUE"}else{this.updateCache
(true)}}},function(){return B("9.0.0")});e(G,{limit:-1,init:function(J,I){this.database=google.gears.factory.create("beta.database");this.database.open("jstore-"+J);this.database.execute("CREATE TABLE IF NOT EXISTS jstore (k TEXT UNIQUE NOT NULL PRIMARY KEY, v TEXT NOT NULL)");this._super(J,I)},updateCache:function(){var I=this.database.execute("SELECT k,v FROM jstore");while(I.isValidRow()){this.data[I.field(0)]=k(I.field(1));I.next()}I.close();this._super()},__set:function(I,J){this.database.execute("BEGIN");this.database.execute("INSERT OR REPLACE INTO jstore(k, v) VALUES (?, ?)",[I,x(J)]);this.database.execute("COMMIT")},__remove:function(I){this.database.execute("BEGIN");this.database.execute("DELETE FROM jstore WHERE k = ?",[I]);this.database.execute("COMMIT")}},function(){return n.google!==undefined&&n.google.gears!==undefined});e(A,{limit:parseInt(10000,16),init:function(J,I){this.database=i('<div style="display:none;behavior:url(\'#default#userData\')" id="jstore-'+
J+'"></div>').appendTo(document.body).get(0);this._super(J,I)},updateCache:function(){this.database.load(this.project);var K=document.getElementById("jstore-"+this.project),L=K.XMLDocument,I,J=0;if(L&&L.documentElement&&L.documentElement.attributes){I=L.documentElement;for(;J<I.attributes.length;++J){this.data[I.attributes.item(J).nodeName]=k(I.attributes.item(J).nodeValue)}}this._super()},__set:function(I,J){this.database.setAttribute(I,x(J));this.database.save(this.project)},__remove:function(I){this.database.removeAttribute(I);this.database.save(this.project)}},function(){return n.ActiveXObject!==undefined})}(jQuery,window));
--- a/static/scripts/packed/class.js
+++ b/static/scripts/packed/class.js
@@ -4,4 +4,4 @@
* Copyright (c) 2008 John Resig (http://ejohn.org/blog/simple-javascript-inheritance/)
* Inspired by base2 and Prototype
*/
-"use strict";(function(){var a=false,b=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(g){var f=this.prototype;a=true;var e=new this();a=false;for(var d in g){e[d]=(typeof g[d]==="function"&&typeof f[d]==="function"&&b.test(g[d])?(function(h,i){return function(){var k=this._super;this._super=f[h];var j=i.apply(this,arguments);this._super=k;return j}}(d,g[d])):g[d])}function c(){if(!a&&this.init){this.init.apply(this,arguments)}}c.prototype=e;c.constructor=c;c.extend=arguments.callee;return c}}());
+(function(){var a=false,b=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(g){var f=this.prototype;a=true;var e=new this();a=false;for(var d in g){e[d]=(typeof g[d]==="function"&&typeof f[d]==="function"&&b.test(g[d])?(function(h,i){return function(){var k=this._super;this._super=f[h];var j=i.apply(this,arguments);this._super=k;return j}}(d,g[d])):g[d])}function c(){if(!a&&this.init){this.init.apply(this,arguments)}}c.prototype=e;c.constructor=c;c.extend=arguments.callee;return c}}());
1
0

galaxy-dist commit 918a25ed14f5: Bug fix due to my last commit - Requests do not have supported_field_types, FormDefinitions do.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1290008781 18000
# Node ID 918a25ed14f5427f70970b0c436159fc58fd111e
# Parent 7bded9108bd8297ea609e9ec06bbe516b5f0b83a
Bug fix due to my last commit - Requests do not have supported_field_types, FormDefinitions do.
--- a/lib/galaxy/web/controllers/forms.py
+++ b/lib/galaxy/web/controllers/forms.py
@@ -601,7 +601,7 @@ class Forms( BaseController ):
for ft in trans.model.Sample.supported_field_types:
self.fieldtype.add_option( ft.__name__, ft.__name__ )
else:
- for ft in trans.model.Request.supported_field_types:
+ for ft in trans.model.FormDefinition.supported_field_types:
self.fieldtype.add_option( ft.__name__, ft__name__ )
self.required = SelectField('field_required_'+str(index), display='radio')
self.required.add_option('Required', 'required')
@@ -641,7 +641,7 @@ class Forms( BaseController ):
else:
self.fieldtype.add_option( ft.__name__, ft.__name__ )
else:
- for ft in trans.model.Request.supported_field_types:
+ for ft in trans.model.FormDefinition.supported_field_types:
if ft.__name__ == field[ 'type' ]:
self.fieldtype.add_option( ft.__name__, ft.__name__, selected=True )
if ft == 'SelectField':
1
0

galaxy-dist commit 2e2ee0289d67: Fix BLAST+ regression from changeset 535d276c92bc (loc file columns)
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1289925107 0
# Node ID 2e2ee0289d67d244954aa05bfe315dbb5ff413eb
# Parent d2d0c199c20ddf942e1e2587dc9aede8acd9cebc
Fix BLAST+ regression from changeset 535d276c92bc (loc file columns)
--- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
@@ -40,10 +40,13 @@ blastn
</param><when value="db"><param name="database" type="select" label="Nucleotide BLAST database">
- <!-- <options from_data_table="blastdb" /> -->
+ <!-- The BLAST loc file has three columns:
+ column 0 is an identifier (not used here, see legacy megablast wrapper),
+ column 1 is the caption (show this to the user),
+ column 2 is the database path (given to BLAST+) --><options from_file="blastdb.loc">
- <column name="name" index="2"/>
- <column name="value" index="0"/>
+ <column name="name" index="1"/>
+ <column name="value" index="2"/></options></param><param name="subject" type="hidden" value="" />
--- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
@@ -41,10 +41,13 @@ blastp
</param><when value="db"><param name="database" type="select" label="Protein BLAST database">
- <!-- <options from_data_table="blastdb_p" /> -->
+ <!-- The BLAST loc file has three columns:
+ column 0 is an identifier (not used),
+ column 1 is the caption (show this to the user),
+ column 2 is the database path (given to BLAST+) --><options from_file="blastdb_p.loc">
- <column name="name" index="2"/>
- <column name="value" index="0"/>
+ <column name="name" index="1"/>
+ <column name="value" index="2"/></options></param><param name="subject" type="hidden" value="" />
--- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
@@ -39,10 +39,13 @@ tblastx
</param><when value="db"><param name="database" type="select" label="Nucleotide BLAST database">
- <!-- <options from_data_table="blastdb" /> -->
+ <!-- The BLAST loc file has three columns:
+ column 0 is an identifier (not used here, see legacy megablast wrapper),
+ column 1 is the caption (show this to the user),
+ column 2 is the database path (given to BLAST+) --><options from_file="blastdb.loc">
- <column name="name" index="2"/>
- <column name="value" index="0"/>
+ <column name="name" index="1"/>
+ <column name="value" index="2"/></options></param><param name="subject" type="hidden" value="" />
--- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
@@ -40,10 +40,13 @@ blastx
</param><when value="db"><param name="database" type="select" label="Protein BLAST database">
- <!-- <options from_data_table="blastdb_p" /> -->
+ <!-- The BLAST loc file has three columns:
+ column 0 is an identifier (not used),
+ column 1 is the caption (show this to the user),
+ column 2 is the database path (given to BLAST+) --><options from_file="blastdb_p.loc">
- <column name="name" index="2"/>
- <column name="value" index="0"/>
+ <column name="name" index="1"/>
+ <column name="value" index="2"/></options></param><param name="subject" type="hidden" value="" />
--- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
@@ -40,10 +40,13 @@ tblastn
</param><when value="db"><param name="database" type="select" label="Nucleotide BLAST database">
- <!-- <options from_data_table="blastdb" /> -->
+ <!-- The BLAST loc file has three columns:
+ column 0 is an identifier (not used here, see legacy megablast wrapper),
+ column 1 is the caption (show this to the user),
+ column 2 is the database path (given to BLAST+) --><options from_file="blastdb.loc">
- <column name="name" index="2"/>
- <column name="value" index="0"/>
+ <column name="name" index="1"/>
+ <column name="value" index="2"/></options></param><param name="subject" type="hidden" value="" />
1
0

galaxy-dist commit 394d8186f666: tool_form: Make radio and select box labels explicitly inline. Workflow: add colons after parameter names where appropriate. Fixes #419
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1289929775 18000
# Node ID 394d8186f666b506cd0a93aefb7a079e0c9ec59b
# Parent 1bf064c8ab88621dd58890f6cd56ad4900d10d6b
tool_form: Make radio and select box labels explicitly inline. Workflow: add colons after parameter names where appropriate. Fixes #419
--- a/static/june_2007_style/base.css.tmpl
+++ b/static/june_2007_style/base.css.tmpl
@@ -210,6 +210,10 @@ div.form-row label {
margin-bottom: .2em;
}
+div.form-row label.inline {
+ display: inline;
+}
+
div.form-row-input {
float: left;
}
--- a/templates/workflow/editor_tool_form.mako
+++ b/templates/workflow/editor_tool_form.mako
@@ -7,8 +7,8 @@ from galaxy.util.expressions import Expr
<% ctx = ExpressionContext( values, ctx ) %>
%for input_index, input in enumerate( inputs.itervalues() ):
%if input.type == "repeat":
- <div class="repeat-group">
- <div class="form-title-row"><b>${input.title_plural}</b></div>
+ <div class="repeat-group form-row">
+ <label>${input.title_plural}:</label><% repeat_values = values[input.name] %>
%for i in range( len( repeat_values ) ):
<%
@@ -19,7 +19,7 @@ from galaxy.util.expressions import Expr
index = repeat_values[i]['__index__']
%><div class="repeat-group-item">
- <div class="form-title-row"><b>${input.title} ${i + 1}</b></div>
+ <div class="form-title-row"><label>${input.title} ${i + 1}</label></div>
${do_inputs( input.inputs, repeat_values[ i ], rep_errors, prefix + input.name + "_" + str(index) + "|", ctx )}
<div class="form-row"><input type="submit" name="${prefix}${input.name}_${index}_remove" value="Remove ${input.title} ${i+1}"></div></div>
@@ -63,7 +63,7 @@ from galaxy.util.expressions import Expr
%else:
%if isinstance( value, RuntimeValue ):
<label>
- ${param.get_label()}
+ ${param.get_label()}:
<span class="popupmenu"><button type="submit" name="make_buildtime" value="${prefix}${param.name}">Set in advance</button></span>
@@ -73,7 +73,7 @@ from galaxy.util.expressions import Expr
</div>
%else:
<label>
- ${param.get_label()}
+ ${param.get_label()}:
%if allow_runtime:
<span class="popupmenu"><button type="submit" name="make_runtime" value="${prefix}${param.name}">Set at runtime</button>
--- a/lib/galaxy/web/form_builder.py
+++ b/lib/galaxy/web/form_builder.py
@@ -248,16 +248,16 @@ class SelectField(BaseField):
>>> t.add_option( "tuti", 1 )
>>> t.add_option( "fruity", "x" )
>>> print t.get_html()
- <div><input type="radio" name="foo" value="1" id="foo|1"><label for="foo|1">tuti</label></div>
- <div><input type="radio" name="foo" value="x" id="foo|x"><label for="foo|x">fruity</label></div>
+ <div><input type="radio" name="foo" value="1" id="foo|1"><label class="inline" for="foo|1">tuti</label></div>
+ <div><input type="radio" name="foo" value="x" id="foo|x"><label class="inline" for="foo|x">fruity</label></div>
>>> t = SelectField( "bar", multiple=True, display="checkboxes" )
>>> t.add_option( "automatic", 3 )
>>> t.add_option( "bazooty", 4, selected=True )
>>> print t.get_html()
<div class="checkUncheckAllPlaceholder" checkbox_name="bar"></div>
- <div><input type="checkbox" name="bar" value="3" id="bar|3"><label for="bar|3">automatic</label></div>
- <div><input type="checkbox" name="bar" value="4" id="bar|4" checked='checked'><label for="bar|4">bazooty</label></div>
+ <div><input type="checkbox" name="bar" value="3" id="bar|3"><label class="inline" for="bar|3">automatic</label></div>
+ <div><input type="checkbox" name="bar" value="4" id="bar|4" checked='checked'><label class="inline" for="bar|4">bazooty</label></div>
"""
def __init__( self, name, multiple=None, display=None, refresh_on_change=False, refresh_on_change_values=[], size=None ):
self.name = name
@@ -302,7 +302,7 @@ class SelectField(BaseField):
selected_text = ""
if selected:
selected_text = " checked='checked'"
- rval.append( '<div%s><input type="checkbox" name="%s%s" value="%s" id="%s"%s%s><label for="%s">%s</label></div>' % \
+ rval.append( '<div%s><input type="checkbox" name="%s%s" value="%s" id="%s"%s%s><label class="inline" for="%s">%s</label></div>' % \
( style, prefix, self.name, escaped_value, uniq_id, selected_text, self.get_disabled_str( disabled ), uniq_id, text ) )
ctr += 1
return "\n".join( rval )
@@ -318,7 +318,7 @@ class SelectField(BaseField):
selected_text = ""
if selected:
selected_text = " checked='checked'"
- rval.append( '<div%s><input type="radio" name="%s%s"%s value="%s" id="%s"%s%s><label for="%s">%s</label></div>' % \
+ rval.append( '<div%s><input type="radio" name="%s%s"%s value="%s" id="%s"%s%s><label class="inline" for="%s">%s</label></div>' % \
( style,
prefix,
self.name,
--- a/static/june_2007_style/blue/base.css
+++ b/static/june_2007_style/blue/base.css
@@ -39,6 +39,7 @@ div.form-title-row{padding:5px 10px;}
div.repeat-group-item{border-left:solid #d8b365 5px;margin-left:10px;margin-bottom:10px;}
div.form-row-error{background:#FFCCCC;}
div.form-row label{font-weight:bold;display:block;margin-bottom:.2em;}
+div.form-row label.inline{display:inline;}
div.form-row-input{float:left;}
div.form-row-input label{font-weight:normal;display:inline;}
div.form-row-error-message{width:300px;float:left;color:red;font-weight:bold;padding:3px 0 0 1em;}
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -515,14 +515,14 @@ class SelectToolParameter( ToolParameter
blah
>>> print p.get_html()
<div class="checkUncheckAllPlaceholder" checkbox_name="blah"></div>
- <div><input type="checkbox" name="blah" value="x" id="blah|x"><label for="blah|x">I am X</label></div>
- <div class="odd_row"><input type="checkbox" name="blah" value="y" id="blah|y" checked='checked'><label for="blah|y">I am Y</label></div>
- <div><input type="checkbox" name="blah" value="z" id="blah|z" checked='checked'><label for="blah|z">I am Z</label></div>
+ <div><input type="checkbox" name="blah" value="x" id="blah|x"><label class="inline" for="blah|x">I am X</label></div>
+ <div class="odd_row"><input type="checkbox" name="blah" value="y" id="blah|y" checked='checked'><label class="inline" for="blah|y">I am Y</label></div>
+ <div><input type="checkbox" name="blah" value="z" id="blah|z" checked='checked'><label class="inline" for="blah|z">I am Z</label></div>
>>> print p.get_html( value=["x","y"])
<div class="checkUncheckAllPlaceholder" checkbox_name="blah"></div>
- <div><input type="checkbox" name="blah" value="x" id="blah|x" checked='checked'><label for="blah|x">I am X</label></div>
- <div class="odd_row"><input type="checkbox" name="blah" value="y" id="blah|y" checked='checked'><label for="blah|y">I am Y</label></div>
- <div><input type="checkbox" name="blah" value="z" id="blah|z"><label for="blah|z">I am Z</label></div>
+ <div><input type="checkbox" name="blah" value="x" id="blah|x" checked='checked'><label class="inline" for="blah|x">I am X</label></div>
+ <div class="odd_row"><input type="checkbox" name="blah" value="y" id="blah|y" checked='checked'><label class="inline" for="blah|y">I am Y</label></div>
+ <div><input type="checkbox" name="blah" value="z" id="blah|z"><label class="inline" for="blah|z">I am Z</label></div>
>>> print p.to_param_dict_string( ["y", "z"] )
y,z
"""
1
0

galaxy-dist commit 94c2040e5825: More minor ui fixes in sample tracking
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1289918776 18000
# Node ID 94c2040e58255136741d776de8401cfb4128133b
# Parent 7cc69601ca2da9b6d21f980585b59d73c0133cba
More minor ui fixes in sample tracking
--- a/templates/requests/common/common.mako
+++ b/templates/requests/common/common.mako
@@ -220,7 +220,7 @@
%endif
%if can_delete_samples:
## Delete button
- <td valign="top"><a class="action-button" href="${h.url_for( controller='requests_common', action='delete_sample', cntrller=cntrller, request_id=trans.security.encode_id( request.id ), sample_id=sample_widget_index )}"><img src="${h.url_for('/static/images/delete_icon.png')}" style="cursor:pointer;"/></a></td>
+ <td valign="top"><a class="action-button" confirm="This sample is not recoverable after deletion. Click Ok to delete." href="${h.url_for( controller='requests_common', action='delete_sample', cntrller=cntrller, request_id=trans.security.encode_id( request.id ), sample_id=sample_widget_index )}"><img src="${h.url_for('/static/images/delete_icon.png')}" style="cursor:pointer;"/></a></td>
%endif
</%def>
--- a/templates/requests/common/edit_samples.mako
+++ b/templates/requests/common/edit_samples.mako
@@ -12,19 +12,22 @@
<%def name="javascripts()">
${parent.javascripts()}
${common_javascripts()}
+ ${local_javascripts()}
</%def>
-<script type="text/javascript">
- // This function stops the form from getting submitted when return key is pressed
- // This is needed in this form as the barcode scanner (when in keyboard emulation mode)
- // may send a return key appended to the scanned barcode string.
- function stopRKey(evt) {
- var evt = (evt) ? evt : ((event) ? event : null);
- var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
- if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
- }
- document.onkeypress = stopRKey
-</script>
+<%def name="local_javascripts()">
+ <script type="text/javascript">
+ // This function stops the form from getting submitted when return key is pressed
+ // This is needed in this form as the barcode scanner (when in keyboard emulation mode)
+ // may send a return key appended to the scanned barcode string.
+ function stopRKey(evt) {
+ var evt = (evt) ? evt : ((event) ? event : null);
+ var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
+ if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
+ }
+ document.onkeypress = stopRKey
+ </script>
+</%def><%
from galaxy.web.framework.helpers import time_ago
@@ -68,7 +71,7 @@
%if request.samples_without_library_destinations:
<p>
- <font color="red"><b><i>Select a target data library and folder for a sample before selecting its datasets to transfer from the sequencer</i></b></font>
+ <font color="red"><b><i>Select a target data library and folder for a sample before selecting it's datasets to transfer from the sequencer</i></b></font></p>
%endif
--- a/templates/requests/common/view_request.mako
+++ b/templates/requests/common/view_request.mako
@@ -59,7 +59,7 @@
%if request.samples_without_library_destinations:
<p>
- <font color="red"><b><i>Select a target data library and folder for a sample before selecting its datasets to transfer from the sequencer</i></b></font>
+ <font color="red"><b><i>Select a target data library and folder for a sample before selecting it's datasets to transfer from the sequencer</i></b></font></p>
%endif
1
0

galaxy-dist commit 7cc69601ca2d: minor ui fixes in sample tracking
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1289916735 18000
# Node ID 7cc69601ca2da9b6d21f980585b59d73c0133cba
# Parent def13f052a4a22c46ec5be6481ad874ceb734799
minor ui fixes in sample tracking
--- a/templates/admin/requests/reject.mako
+++ b/templates/admin/requests/reject.mako
@@ -4,8 +4,8 @@
%if message:
${render_msg( message, status )}
%endif
-
-<h2>Reject Sequencing Request "${request.name}"</h2>
+<br/><br/>
+##<h2>Reject Sequencing Request "${request.name}"</h2><ul class="manage-table-actions"><li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request_history', cntrller=cntrller, id=trans.security.encode_id(request.id) )}">View history</a>
@@ -16,7 +16,7 @@
</ul><div class="toolForm">
- <div class="toolFormTitle">Reject request</div>
+ <div class="toolFormTitle">Reject sequencing request "${request.name}"</div><form name="event" action="${h.url_for( controller='requests_admin', action='reject_request', id=trans.security.encode_id( request.id ) )}" method="post" ><div class="form-row">
Rejecting this request will move the request state to <b>Rejected</b>.
--- a/templates/requests/common/view_request.mako
+++ b/templates/requests/common/view_request.mako
@@ -58,9 +58,9 @@
%endif
%if request.samples_without_library_destinations:
- <br/>
- <font color="red"><b><i>Select a target data library and folder for all samples before starting the sequence run</i></b></font>
- <br/>
+ <p>
+ <font color="red"><b><i>Select a target data library and folder for a sample before selecting its datasets to transfer from the sequencer</i></b></font>
+ </p>
%endif
%if message:
--- a/templates/requests/common/edit_samples.mako
+++ b/templates/requests/common/edit_samples.mako
@@ -67,9 +67,9 @@
</ul>
%if request.samples_without_library_destinations:
- <br/>
- <font color="red"><b><i>Select a target data library and folder for all samples before starting the sequence run</i></b></font>
- <br/>
+ <p>
+ <font color="red"><b><i>Select a target data library and folder for a sample before selecting its datasets to transfer from the sequencer</i></b></font>
+ </p>
%endif
%if request.is_rejected:
--- a/templates/requests/common/view_request_history.mako
+++ b/templates/requests/common/view_request_history.mako
@@ -34,7 +34,7 @@
${render_msg( message, status )}
%endif
-<h2>History of sequencing request "${request.name}"</h2>
+<h3>History of sequencing request "${request.name}"</h3><div class="toolForm"><table class="grid">
1
0

20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Anton Nekrutenko <anton(a)bx.psu.edu>
# Date 1289851601 18000
# Node ID 0505090dbbe610741cacd7a9a1c2e79b8cc9ea5c
# Parent 9a7482206be274678079271331171600a2023b03
Changing back
--- a/tools/taxonomy/t2ps_wrapper.py
+++ b/tools/taxonomy/t2ps_wrapper.py
@@ -59,7 +59,7 @@ except OSError, e:
# Convert PS to PDF
try:
- ps2pdf_cmd = 'pstopdf %s -o %s' % ( ps_file.name, pdf_file )
+ ps2pdf_cmd = 'ps2pdf %s %s' % ( ps_file.name, pdf_file )
retcode = subprocess.call( ps2pdf_cmd, shell=True )
if retcode < 0:
print >>sys.stderr, "Execution of ps2pdf terminated by signal", -retcode
1
0

galaxy-dist commit d2d0c199c20d: Improvements to annotation display when running workflows: (1) workflow annotation is shown at the top of the page; (2) step annotations are shown in the step header rather than at the bottom. Fixes Issue #420
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User jeremy goecks <jeremy.goecks(a)emory.edu>
# Date 1289925819 18000
# Node ID d2d0c199c20ddf942e1e2587dc9aede8acd9cebc
# Parent 5a217a7ce999bbe218432a7442751b5b78684798
Improvements to annotation display when running workflows: (1) workflow annotation is shown at the top of the page; (2) step annotations are shown in the step header rather than at the bottom. Fixes Issue #420
--- a/lib/galaxy/web/controllers/workflow.py
+++ b/lib/galaxy/web/controllers/workflow.py
@@ -1333,6 +1333,7 @@ class WorkflowController( BaseController
# Connections by input name
step.input_connections_by_name = dict( ( conn.input_name, conn ) for conn in step.input_connections )
# Render the form
+ stored.annotation = self.get_item_annotation_str( trans.sa_session, trans.user, stored )
return trans.fill_template(
"workflow/run.mako",
steps=workflow.steps,
--- a/templates/workflow/run.mako
+++ b/templates/workflow/run.mako
@@ -20,6 +20,14 @@
margin-top: 10px;
margin-bottom: 10px;
}
+ .step-annotation {
+ margin-top: 0.25em;
+ font-weight: normal;
+ font-size: 97%;
+ }
+ .workflow-annotation {
+ margin-bottom: 1em;
+ }
</style></%def>
@@ -129,6 +137,11 @@ from galaxy.jobs.actions.post import Act
</div>
%endif
+%if workflow.annotation:
+ <div class="workflow-annotation">Annotation: ${workflow.annotation}</div>
+ <hr/>
+%endif
+
<form id="tool_form" name="tool_form" method="POST">
## <input type="hidden" name="workflow_name" value="${h.to_unicode( workflow.name ) | h}" />
%for i, step in enumerate( steps ):
@@ -136,7 +149,12 @@ from galaxy.jobs.actions.post import Act
<% tool = app.toolbox.tools_by_id[step.tool_id] %><input type="hidden" name="${step.id}|tool_state" value="${step.state.encode( tool, app )}"><div class="toolForm">
- <div class="toolFormTitle">Step ${int(step.order_index)+1}: ${tool.name}</div>
+ <div class="toolFormTitle">
+ Step ${int(step.order_index)+1}: ${tool.name}
+ % if step.annotations:
+ <div class="step-annotation">Annotation: ${h.to_unicode( step.annotations[0].annotation )}</div>
+ % endif
+ </div><div class="toolFormBody">
${do_inputs( tool.inputs, step.state.inputs, errors.get( step.id, dict() ), "", step )}
% if step.post_job_actions:
@@ -150,27 +168,21 @@ from galaxy.jobs.actions.post import Act
${'<br/>'.join([ActionBox.get_short_str(pja) for pja in step.post_job_actions])}
</div>
% endif
- % if step.annotations:
- <hr/>
- <div class='form-row'>
- <label>Annotation:</label> ${h.to_unicode( step.annotations[0].annotation )}
- </div>
- % endif
</div></div>
%else:
<% module = step.module %><input type="hidden" name="${step.id}|tool_state" value="${module.encode_runtime_state( t, step.state )}"><div class="toolForm">
- <div class="toolFormTitle">Step ${int(step.order_index)+1}: ${module.name}</div>
+ <div class="toolFormTitle">
+ Step ${int(step.order_index)+1}: ${module.name}
+ % if step.annotations:
+ <div class="step-annotation">Annotation: ${step.annotations[0].annotation}</div>
+ % endif
+
+ </div><div class="toolFormBody">
${do_inputs( module.get_runtime_inputs(), step.state.inputs, errors.get( step.id, dict() ), "", step )}
- % if step.annotations:
- <hr/>
- <div class='form-row'>
- <label>Annotation:</label> ${step.annotations[0].annotation}
- </div>
- % endif
</div></div>
%endif
1
0

galaxy-dist commit 3868982a4eff: trackster: Fix error on saving when no chrom is currently viewed due to new saving of current viewport. Remove debug statements
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1289849956 18000
# Node ID 3868982a4eff5036f13650ab303e0b9a4fb30da8
# Parent 2bfb046649f059734e2709643785a95af3b85e81
trackster: Fix error on saving when no chrom is currently viewed due to new saving of current viewport. Remove debug statements
--- a/static/scripts/trackster.js
+++ b/static/scripts/trackster.js
@@ -83,6 +83,7 @@ var Cache = function( num_elements ) {
var View = function( container, title, vis_id, dbkey, callback ) {
this.container = container;
+ this.chrom = null;
this.vis_id = vis_id;
this.dbkey = dbkey;
this.title = title;
--- a/templates/tracks/browser.mako
+++ b/templates/tracks/browser.mako
@@ -201,8 +201,7 @@
});
}
- var payload = { 'tracks': tracks, 'viewport': { 'chrom': view.chrom, 'start': view.low , 'end': view.high } }
- console.log( payload );
+ var payload = { 'tracks': tracks, 'viewport': { 'chrom': view.chrom, 'start': view.low , 'end': view.high } };
$.ajax({
url: "${h.url_for( action='save' )}",
--- a/templates/tracks/new_browser.mako
+++ b/templates/tracks/new_browser.mako
@@ -18,12 +18,11 @@
<div style="clear: both;"></div></div><div class="form-row">
- Is your build not listed here?
+ Is the build not listed here?
<a href="${h.url_for( controller='user', action='dbkeys', panels=True )}">Add a Custom Build</a></div>
%if default_dbkey is not None:
<script type="text/javascript">
- console.log("${default_dbkey}");
$("#new-dbkey option[value='${default_dbkey}']").attr("selected", true);
</script>
%endif
--- a/static/scripts/packed/trackster.js
+++ b/static/scripts/packed/trackster.js
@@ -1,1 +1,1 @@
-var DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=50,CONNECTOR_COLOR="#ccc",DATA_ERROR="There was an error in indexing this dataset.",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",FILTERABLE_CLASS="filterable",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=5,CACHED_DATA=5,DUMMY_CANVAS=document.createElement("canvas"),RIGHT_STRAND,LEFT_STRAND;if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(DUMMY_CANVAS)}CONTEXT=DUMMY_CANVAS.getContext("2d");PX_PER_CHAR=CONTEXT.measureText("A").width;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPa
ttern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var View=function(a,d,c,b,e){this.container=a;this.vis_id=c;this.dbkey=b;this.
title=d;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(e);this.reset()};$.extend(View.prototype,{init:function(d){var c=this.container,a=this;this.top_container=$("<div/>").addClass("top-container").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(c);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top
_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div />").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form=$("<form/>").attr("action",function(){}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-a
utocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(f){if(f.type==="focusout"||(f.keyCode||f.which)===13||(f.keyCode||f.which)===27){if((f.keyCode||f.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return false}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a id='zoom-out' />").click(function(){a.zoom_out();a.redraw()}).appendTo(this.chrom_form);this.zi_link=$("<a id='zoom-in' />").click(function(){a.zoom_in();a.redraw()}).append
To(this.chrom_form);$.ajax({url:chrom_url,data:(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}),dataType:"json",success:function(f){if(f.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=f.chrom_info;var j='<option value="">Select Chrom/Contig</option>';for(var h=0,e=a.chrom_data.length;h<e;h++){var g=a.chrom_data[h].chrom;j+='<option value="'+g+'">'+g+"</option>"}a.chrom_select.html(j);a.intro_div.show();a.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())});if(d){d()}},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}});this.content_div.bind("dblclick",function(f){a.zoom_in(f.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(f){this.current_x=f.offsetX}).bind("drag",function(f){var h=f.offsetX-this.current_x;this.current_x=f.offsetX;var g=Math.round(h/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-g)});this.overview_close.bind("click",function(){for
(var f=0,e=a.tracks.length;f<e;f++){a.tracks[f].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("dragstart",function(f){this.original_low=a.low;this.current_height=f.clientY;this.current_x=f.offsetX;this.enable_pan=(f.clientX<a.viewport_container.width()-16)?true:false}).bind("drag",function(h){if(!this.enable_pan||this.in_reordering){return}var f=$(this);var j=h.offsetX-this.current_x;var g=f.scrollTop()-(h.clientY-this.current_height);f.scrollTop(g);this.current_height=h.clientY;this.current_x=h.offsetX;var i=Math.round(j/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)});this.top_labeltrack.bind("dragstart",function(f){this.drag_origin_x=f.clientX;this.drag_origin_pos=f.clientX/a.viewport_container.width()*(a.high-a.low)+a.low;this.drag_div=$("<div />").css({height:a.content_div.height()+a.top_labeltrack.height()+a.nav
_labeltrack.height(),top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j){var g=Math.min(j.clientX,this.drag_origin_x)-a.container.offset().left,f=Math.max(j.clientX,this.drag_origin_x)-a.container.offset().left,i=(a.high-a.low),h=a.viewport_container.width();a.update_location(Math.round(g/h*i)+a.low,Math.round(f/h*i)+a.low);this.drag_div.css({left:g+"px",width:(f-g)+"px"})}).bind("dragend",function(k){var g=Math.min(k.clientX,this.drag_origin_x),f=Math.max(k.clientX,this.drag_origin_x),i=(a.high-a.low),h=a.viewport_container.width(),j=a.low;a.low=Math.round(g/h*i)+j;a.high=Math.round(f/h*i)+j;this.drag_div.remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack));$(window).bind("resize",function(){a.resize_window()});$(document).bind("redraw",function(){a.redraw()});this.reset();$(window).trigger("resize")},upd
ate_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},change_chrom:function(e,b,g){var d=this;var f=$.grep(d.chrom_data,function(j,k){return j.chrom===e})[0];if(f===undefined){return}if(e!==d.chrom){d.chrom=e;if(!d.chrom){d.intro_div.show()}else{d.intro_div.hide()}d.chrom_select.val(d.chrom);d.max_high=f.len;d.reset();d.redraw(true);for(var h=0,a=d.tracks.length;h<a;h++){var c=d.tracks[h];if(c.init){c.init()}}}if(b!==undefined&&g!==undefined){d.low=Math.max(b,0);d.high=Math.min(g,d.max_high)}d.reset_overview();d.redraw()},go_to:function(f){var j=this,a,d,b=f.split(":"),h=b[0],i=b[1];if(i!==undefined){try{var g=i.split("-");a=parseInt(g[0].replace(/,/g,""),10);d=parseInt(g[1].replace(/,/g,""),10)}catch(c){return false}}j.change_chrom(h,a,d)},move_fraction:function(c){var a=this;var b=a.high-a.low;this.move_delta(c*b)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<
a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(
Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var e=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a,width:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+th
is.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var Filter=function(b,a,c){this.name=b;this.index=a;this.value=c};var NumberFilter=function(b,a){this.name=b;this.index=a;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.slider_min=Number.MAX_VALUE;this.slider_max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null}
;$.extend(NumberFilter.prototype,{applies_to:function(a){if(a.length>this.index){return true}return false},keep:function(a){if(!this.applies_to(a)){return true}return(a[this.index]>=this.low&&a[this.index]<=this.high)},update_attrs:function(b){var a=false;if(!this.applies_to(b)){return a}if(b[this.index]<this.slider_min){this.slider_min=b[this.index];a=true}if(b[this.index]>this.slider_max){this.slider_max=b[this.index];a=false}return a},update_ui_elt:function(){var b=this.slider.slider("option","min"),a=this.slider.slider("option","max");if(this.slider_min<b||this.slider_max>a){this.slider.slider("option","min",this.slider_min);this.slider.slider("option","max",this.slider_max);this.slider.slider("option","values",[this.slider_min,this.slider_max])}}});var get_filters=function(a){var g=[];for(var d=0;d<a.length;d++){var f=a[d];var c=f.name,e=f.type,b=f.index;if(e=="int"||e=="float"){g[d]=new NumberFilter(c,b)}else{g[d]=new Filter(c,b,e)}}return g};var Track=function(b,a,d,c
){this.name=b;this.view=a;this.parent_element=d;this.filters=(c!==undefined?get_filters(c):[]);this.init_global()};$.extend(Track.prototype,{init_global:function(){this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.filtering_div=$("<div class='track-filters'>").appendTo(this.container_div);this.filtering_div.hide();this.filtering_div.bind("drag",function(i){i.stopPropagation()});var b=$("<table class='filters'>").appendTo(this.filtering_div);var c=this;for(var e=0;e<this.filters.length;e++){var a=this.filters[e];var f=$("<tr>").appendTo(b);var g=$("<th cla
ss='filter-info'>").appendTo(f);var j=$("<span class='name'>").appendTo(g);j.text(a.name+" ");var d=$("<span class='values'>").appendTo(g);var h=$("<td>").appendTo(f);a.control_element=$("<div id='"+a.name+"-filter-control' style='width: 200px; position: relative'>").appendTo(h);a.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(k,l){var i=l.values;d.text("["+i[0]+"-"+i[1]+"]");a.low=i[0];a.high=i[1];c.draw(true)},change:function(i,k){a.control_element.slider("option","slide").call(a.control_element,i,k)}});a.slider=a.control_element;a.slider_label=d}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)},init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");if(!a.content_div.text()){a.content_div.text(DATA_LOADING)}a.container_div.r
emoveClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"||d.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(d.message){var f=a.view.tracks.indexOf(a);var e=$("<a href='javascript:void(0);'></a>").attr("id",f+"_error");e.text("Click to view error");$("#"+f+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+d.message+"</pre>",{Close:hide_modal})});a.content_div.append(e)}}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(d.data!==undefined&&(d.data===null||d.data.length===0)){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("nodata");a.conte
nt_div.text(DATA_NONE)}}});var TiledTrack=function(){var b=this,j=b.view;if(b.hidden){return}if(b.display_modes!==undefined){if(b.mode_div===undefined){b.mode_div=$("<div class='right-float menubutton popup' />").appendTo(b.header_div);var e=b.display_modes[0];b.mode=e;b.mode_div.text(e);var c=function(i){b.mode_div.text(i);b.mode=i;b.tile_cache.clear();b.draw()};var a={};for(var f=0,h=b.display_modes.length;f<h;f++){var g=b.display_modes[f];a[g]=function(i){return function(){c(i)}}(g)}make_popupmenu(b.mode_div,a)}else{b.mode_div.hide()}}var d={};d["Set as overview"]=function(){j.overview_viewport.find("canvas").remove();b.is_overview=true;b.set_overview();for(var i in j.tracks){if(j.tracks[i]!==b){j.tracks[i].is_overview=false}}};d["Edit configuration"]=function(){var l=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},i=function(){b.update_options(b.track_id);hide_modal();$(window).unbind("keypress.check_enter_esc")},k=function(m){if((m.keyCode||m.which
)===27){l()}else{if((m.keyCode||m.which)===13){i()}}};$(window).bind("keypress.check_enter_esc",k);show_modal("Configure Track",b.gen_options(b.track_id),{Cancel:l,OK:i})};if(b.filters.length>0){d["Show filters"]=function(){var i;if(!b.filtering_div.is(":visible")){i="Hide filters";b.filters_visible=true}else{i="Show filters";b.filters_visible=false}$("#"+b.name_div.attr("id")+"-menu").find("li").eq(2).text(i);b.filtering_div.toggle()}}d.Remove=function(){j.remove_track(b);if(j.num_tracks===0){$("#no-tracks").show()}};b.popup_menu=make_popupmenu(b.name_div,d);show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(a){var k=this.view.low,g=this.view.high,h=g-k,f=this.view.resolution;var n=$("<div style='position: relative;'></div>"),o=this.content_div.width()/h;this.content_div.append(n);this.max_height=0;var b=Math.floor(k/f/DENSITY);var j={};while((b*DENSITY*f)<g){var l=this.content_div.width()+"_"+
o+"_"+b;var e=this.tile_cache.get(l);if(!a&&e){var i=b*DENSITY*f;var d=(i-k)*o;if(this.left_offset){d-=this.left_offset}e.css({left:d});this.show_tile(e,n)}else{this.delayed_draw(this,l,k,g,b,f,n,o,j)}b+=1}var c=this;var m=setInterval(function(){if(obj_length(j)===0){if(c.content_div.children().length>1){c.content_div.children(":first").remove()}for(var p=0;p<c.filters.length;p++){c.filters[p].update_ui_elt()}clearInterval(m)}},50)},delayed_draw:function(c,h,g,e,b,d,i,j,f){var a=setTimeout(function(){if(g<=c.view.high&&e>=c.view.low){var k=c.draw_tile(d,b,i,j);if(k){if(!c.initial_canvas&&!window.G_vmlCanvasManager){c.initial_canvas=$(k).clone();var n=k.get(0).getContext("2d");var l=c.initial_canvas.get(0).getContext("2d");var m=n.getImageData(0,0,n.canvas.width,n.canvas.height);l.putImageData(m,0,0);c.set_overview()}c.tile_cache.set(h,k);c.show_tile(k,i)}}delete f[a]},50);f[a]=true},show_tile:function(a,c){var b=this;c.append(a);b.max_height=Math.max(b.max_height,a.height())
;b.content_div.css("height",b.max_height+"px");if(a.hasClass(FILTERABLE_CLASS)){show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters");if(b.filters_visible){b.filtering_div.show()}}else{show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false);b.filtering_div.hide()}},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div styl
e='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.data_queue={};this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})
}},draw_tile:function(f,b,k,o){var g=b*DENSITY*f,d=DENSITY*f,j=f+"_"+b;var e=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(e)}e=$(e);var n=e.get(0).getContext("2d");if(o>PX_PER_CHAR){if(this.data_cache.get(j)===undefined){this.get_data(f,b);return}var m=this.data_cache.get(j);if(m===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*o+this.left_offset);e.get(0).height=this.height_px;e.css({position:"absolute",top:0,left:(g-this.view.low)*o-this.left_offset});for(var h=0,l=m.length;h<l;h++){var a=Math.round(h*o),i=Math.round(o/2);n.fillText(m[h],a+this.left_offset+i,10)}k.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=function(d,b,a,c){this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=80;this.dataset_id=a;this.data_cache=new Cache(CACHED_DA
TA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={color:"black",min_value:undefined,max_value:undefined,mode:this.mode}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");var e=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=e.min;a.prefs.max_value=e.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=e.total_frequency;a.container_div.find(".yaxislabel").remove();var f=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.pref
s.max_value));d.css({position:"absolute",top:"24px",left:"10px"});d.prependTo(a.container_div);f.css({position:"absolute",top:a.height_px+12+"px",left:"10px"});f.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){var h=g.data;c.data_cache.set(e,h);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(o,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*o,a=DENSITY*o,w=o+"_"+r;var b=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(b)}b=$(b);if(this.data_cache.get(w)===undefined){this.get_data(o,r);return}var v=this.data_cache.get(w);if(!v){return}b.css({position:"absolute",top:0,left:(s-this.view.low)*e});b.get(0).width=Mat
h.ceil(a*e);b.get(0).height=this.height_px;var n=b.get(0).getContext("2d"),j=false,k=this.prefs.min_value,g=this.prefs.max_value,m=this.vertical_range,t=this.total_frequency,d=this.height_px,l=this.mode;n.beginPath();n.fillStyle=this.prefs.color;var u,h,f;if(v.length>1){f=Math.ceil((v[1][0]-v[0][0])*e)}else{f=10}for(var p=0,q=v.length;p<q;p++){u=Math.round((v[p][0]-s)*e);h=v[p][1];if(h===null){if(j&&l==="Filled"){n.lineTo(u,d)}j=false;continue}if(h<k){h=k}else{if(h>g){h=g}}if(l==="Histogram"){h=Math.round(d-(h-k)/m*d);n.fillRect(u,h,f,d-h)}else{if(l==="Intensity"){h=255-Math.floor((h-k)/m*255);n.fillStyle="rgb("+h+","+h+","+h+")";n.fillRect(u,0,f,d)}else{h=Math.round(d-(h-k)/m*d);if(j){n.lineTo(u,h)}else{j=true;if(l==="Filled"){n.moveTo(u,d);n.lineTo(u,h)}else{n.moveTo(u,h)}}}}}if(l==="Filled"){if(j){n.lineTo(u,d)}n.fill()}else{n.stroke()}c.append(b);return b},gen_options:function(m){var a=$("<div />").addClass("form-row");var e="track_"+m+"_color",b=$("<label />").attr("for
",e).text("Color:"),c=$("<input />").attr("id",e).attr("name",e).val(this.prefs.color),h="track_"+m+"_minval",l=$("<label></label>").attr("for",h).text("Min value:"),d=(this.prefs.min_value===undefined?"":this.prefs.min_value),k=$("<input></input>").attr("id",h).val(d),j="track_"+m+"_maxval",g=$("<label></label>").attr("for",j).text("Max value:"),i=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",j).val(i);return a.append(l).append(k).append(g).append(f).append(b).append(c)},update_options:function(d){var a=$("#track_"+d+"_minval").val(),c=$("#track_"+d+"_maxval").val(),b=$("#track_"+d+"_color").val();if(a!==this.prefs.min_value||c!==this.prefs.max_value||b!==this.prefs.color){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(c);this.prefs.color=b;this.vertical_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+d+"_minval").text(this.prefs.min_value);$("#linetrack_"+d+"_maxval").text(this.prefs.max_valu
e);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(d,b,a,e,c){this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,d,b,b.viewport_container,e);TiledTrack.call(this);this.height_px=0;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=3;this.summary_draw_height=30;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new Cache(20);this.left_offset=200;this.prefs={block_color:"#444",label_color:"black",show_counts:true}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b="initial";this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution,mode:a.mode},fun
ction(c){a.mode_div.show();a.data_cache.set(b,c);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,g,b,q){if(!this.inc_slots[a]){this.inc_slots[a]={};this.inc_slots[a].w_scale=a;this.inc_slots[a].mode=q;this.s_e_by_tile[a]={}}var m=this.inc_slots[a].w_scale,y=[],h=0,n=this.view.max_low;var A=[];if(this.inc_slots[a].mode!==q){delete this.inc_slots[a];this.inc_slots[a]={mode:q,w_scale:m};delete this.s_e_by_tile[a];this.s_e_by_tile[a]={}}for(var v=0,w=g.length;v<w;v++){var f=g[v],l=f[0];if(this.inc_slots[a][l]!==undefined){h=Math.max(h,this.inc_slots[a][l]);A.push(this.inc_slots[a][l])}else{y.push(v)}}for(var v=0,w=y.length;v<w;v++){var f=g[y[v]],l=f[0],r=f[1],c=f[2],p=f[3],d=Math.floor((r-n)*m),e=Math.ceil((c-n
)*m);if(p!==undefined&&!b){var s=CONTEXT.measureText(p).width;if(d-s<0){e+=s}else{d-=s}}var u=0;while(u<=MAX_FEATURE_DEPTH){var o=true;if(this.s_e_by_tile[a][u]!==undefined){for(var t=0,z=this.s_e_by_tile[a][u].length;t<z;t++){var x=this.s_e_by_tile[a][u][t];if(e>x[0]&&d<x[1]){o=false;break}}}if(o){if(this.s_e_by_tile[a][u]===undefined){this.s_e_by_tile[a][u]=[]}this.s_e_by_tile[a][u].push([d,e]);this.inc_slots[a][l]=u;h=Math.max(h,u);break}u++}}return h},rect_or_text:function(r,l,t,b,q,f,i,e){r.textAlign="center";var k=0,p=Math.round(l/2);for(var m=0,s=i.length;m<s;m++){var j=i[m],d="MIDNSHP"[j[0]],n=j[1];if(d==="H"||d==="S"){k-=n}var g=q+k,w=Math.floor(Math.max(0,(g-t)*l)),h=Math.floor(Math.max(0,(g+n-t)*l));switch(d){case"S":case"H":case"M":var o=f.slice(k,n);if((this.mode==="Pack"||this.mode==="Auto")&&f!==undefined&&l>PX_PER_CHAR){r.fillStyle=this.prefs.block_color;r.fillRect(w+this.left_offset,e+1,h-w,9);r.fillStyle=CONNECTOR_COLOR;for(var u=0,a=o.length;u<a;u++){if(g+
u>=t&&g+u<=b){var v=Math.floor(Math.max(0,(g+u-t)*l));r.fillText(o[u],v+this.left_offset+p,e+9)}}}else{r.fillStyle=this.prefs.block_color;r.fillRect(w+this.left_offset,e+4,h-w,3)}break;case"N":r.fillStyle=CONNECTOR_COLOR;r.fillRect(w+this.left_offset,e+5,h-w,1);break;case"D":r.fillStyle="red";r.fillRect(w+this.left_offset,e+4,h-w,3);break;case"P":case"I":break}k+=n}},draw_tile:function(ag,o,s,av){var N=o*DENSITY*ag,al=(o+1)*DENSITY*ag,M=al-N;var an=(!this.initial_canvas?"initial":N+"_"+al);var I=this.data_cache.get(an);var e;if(I===undefined||(this.mode!=="Auto"&&I.dataset_type==="summary_tree")){this.data_queue[[N,al]]=true;this.get_data(N,al);return}var a=Math.ceil(M*av),ai=this.prefs.label_color,l=this.prefs.block_color,r=this.mode,z=25,ae=(r==="Squish")||(r==="Dense")&&(r!=="Pack")||(r==="Auto"&&(I.extra_info==="no_detail")),W=this.left_offset,au,D,aw;var q=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(q)}q=$(q);if(I.datase
t_type==="summary_tree"){D=this.summary_draw_height}else{if(r==="Dense"){D=z;aw=10}else{aw=(ae?this.vertical_nodetail_px:this.vertical_detail_px);var A=(av<0.0001?1/this.view.zoom_res:av);D=this.incremental_slots(A,I.data,ae,r)*aw+z;au=this.inc_slots[A]}}q.css({position:"absolute",top:0,left:(N-this.view.low)*av-W});q.get(0).width=a+W;q.get(0).height=D;s.parent().css("height",Math.max(this.height_px,D)+"px");var J=q.get(0).getContext("2d");J.fillStyle=l;J.font=this.default_font;J.textAlign="right";this.container_div.find(".yaxislabel").remove();if(I.dataset_type=="summary_tree"){var Y=I.data,L=I.max,b=Math.ceil(I.delta*av);var p=$("<div />").addClass("yaxislabel").text(L);p.css({position:"absolute",top:"22px",left:"10px"});p.prependTo(this.container_div);for(var ap=0,H=Y.length;ap<H;ap++){var aa=Math.floor((Y[ap][0]-N)*av);var Z=Y[ap][1];if(!Z){continue}var am=Z/L*this.summary_draw_height;J.fillStyle="black";J.fillRect(aa+W,this.summary_draw_height-am,b,am);if(this.prefs.sho
w_counts&&J.measureText(Z).width<b){J.fillStyle="#bbb";J.textAlign="center";J.fillText(Z,aa+W+(b/2),this.summary_draw_height-5)}}e="Summary";s.append(q);return q}if(I.message){q.css({border:"solid red","border-width":"2px 2px 2px 0px"});J.fillStyle="red";J.textAlign="left";J.fillText(I.message,100+W,aw)}var ad=false;if(I.data){ad=true;for(var ar=0;ar<this.filters.length;ar++){if(!this.filters[ar].applies_to(I.data[0])){ad=false}}}if(ad){q.addClass(FILTERABLE_CLASS)}var at=I.data;var ao=0;for(var ap=0,H=at.length;ap<H;ap++){var S=at[ap],R=S[0],aq=S[1],ac=S[2],O=S[3];if(au[R]===undefined){continue}var ab=false;var U;for(var ar=0;ar<this.filters.length;ar++){U=this.filters[ar];U.update_attrs(S);if(!U.keep(S)){ab=true;break}}if(ab){continue}if(aq<=al&&ac>=N){var af=Math.floor(Math.max(0,(aq-N)*av)),K=Math.ceil(Math.min(a,Math.max(0,(ac-N)*av))),X=(r==="Dense"?1:(1+au[R]))*aw;var G,aj,P=null,ax=null;if(I.dataset_type==="bai"){var v=S[4];J.fillStyle=l;if(S[5] instanceof Array){var
E=Math.floor(Math.max(0,(S[5][0]-N)*av)),Q=Math.ceil(Math.min(a,Math.max(0,(S[5][1]-N)*av))),C=Math.floor(Math.max(0,(S[6][0]-N)*av)),w=Math.ceil(Math.min(a,Math.max(0,(S[6][1]-N)*av)));if(S[5][1]>=N&&S[5][0]<=al){this.rect_or_text(J,av,N,al,S[5][0],S[5][2],v,X)}if(S[6][1]>=N&&S[6][0]<=al){this.rect_or_text(J,av,N,al,S[6][0],S[6][2],v,X)}if(C>Q){J.fillStyle=CONNECTOR_COLOR;J.fillRect(Q+W,X+5,C-Q,1)}}else{J.fillStyle=l;this.rect_or_text(J,av,N,al,aq,O,v,X)}if(r!=="Dense"&&!ae&&aq>N){J.fillStyle=this.prefs.label_color;if(o===0&&af-J.measureText(O).width<0){J.textAlign="left";J.fillText(R,K+2+W,X+8)}else{J.textAlign="right";J.fillText(R,af-2+W,X+8)}J.fillStyle=l}}else{if(I.dataset_type==="interval_index"){if(ae){J.fillStyle=l;J.fillRect(af+W,X+5,K-af,1)}else{var F=S[4],V=S[5],ah=S[6],h=S[7];if(V&&ah){P=Math.floor(Math.max(0,(V-N)*av));ax=Math.ceil(Math.min(a,Math.max(0,(ah-N)*av)))}if(r!=="Dense"&&O!==undefined&&aq>N){J.fillStyle=ai;if(o===0&&af-J.measureText(O).width<0){J.tex
tAlign="left";J.fillText(O,K+2+W,X+8)}else{J.textAlign="right";J.fillText(O,af-2+W,X+8)}J.fillStyle=l}if(h){if(F){if(F=="+"){J.fillStyle=RIGHT_STRAND}else{if(F=="-"){J.fillStyle=LEFT_STRAND}}J.fillRect(af+W,X,K-af,10);J.fillStyle=l}for(var an=0,g=h.length;an<g;an++){var u=h[an],d=Math.floor(Math.max(0,(u[0]-N)*av)),T=Math.ceil(Math.min(a,Math.max((u[1]-N)*av)));if(d>T){continue}G=5;aj=3;J.fillRect(d+W,X+aj,T-d,G);if(P!==undefined&&!(d>ax||T<P)){G=9;aj=1;var ak=Math.max(d,P),B=Math.min(T,ax);J.fillRect(ak+W,X+aj,B-ak,G)}}}else{G=9;aj=1;J.fillRect(af+W,X+aj,K-af,G);if(S.strand){if(S.strand=="+"){J.fillStyle=RIGHT_STRAND_INV}else{if(S.strand=="-"){J.fillStyle=LEFT_STRAND_INV}}J.fillRect(af+W,X,K-af,10);J.fillStyle=l}}}}else{if(I.dataset_type==="vcf"){if(ae){J.fillStyle=l;J.fillRect(af+W,X+5,K-af,1)}else{var t=S[4],n=S[5],c=S[6];G=9;aj=1;J.fillRect(af+W,X,K-af,G);if(r!=="Dense"&&O!==undefined&&aq>N){J.fillStyle=ai;if(o===0&&af-J.measureText(O).width<0){J.textAlign="left";J.fillT
ext(O,K+2+W,X+8)}else{J.textAlign="right";J.fillText(O,af-2+W,X+8)}J.fillStyle=l}var m=t+" / "+n;if(aq>N&&J.measureText(m).width<(K-af)){J.fillStyle="white";J.textAlign="center";J.fillText(m,W+af+(K-af)/2,X+8);J.fillStyle=l}}}}}ao++}}return q},gen_options:function(i){var a=$("<div />").addClass("form-row");var e="track_"+i+"_block_color",k=$("<label />").attr("for",e).text("Block color:"),l=$("<input />").attr("id",e).attr("name",e).val(this.prefs.block_color),j="track_"+i+"_label_color",g=$("<label />").attr("for",j).text("Text color:"),h=$("<input />").attr("id",j).attr("name",j).val(this.prefs.label_color),f="track_"+i+"_show_count",c=$("<label />").attr("for",f).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",f).attr("name",f).attr("checked",this.prefs.show_counts),d=$("<div />").append(b).append(c);return a.append(k).append(l).append(g).append(h).append(d)},update_options:function(d){var b=$("#track_"+d+"_block_color").va
l(),c=$("#track_"+d+"_label_color").val(),a=$("#track_"+d+"_show_count").attr("checked");if(b!==this.prefs.block_color||c!==this.prefs.label_color||a!==this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=c;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(d,b,a,e,c){FeatureTrack.call(this,d,b,a,e,c);this.track_type="ReadTrack";this.vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
+var DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=50,CONNECTOR_COLOR="#ccc",DATA_ERROR="There was an error in indexing this dataset.",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",FILTERABLE_CLASS="filterable",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=5,CACHED_DATA=5,DUMMY_CANVAS=document.createElement("canvas"),RIGHT_STRAND,LEFT_STRAND;if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(DUMMY_CANVAS)}CONTEXT=DUMMY_CANVAS.getContext("2d");PX_PER_CHAR=CONTEXT.measureText("A").width;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPa
ttern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var View=function(a,d,c,b,e){this.container=a;this.chrom=null;this.vis_id=c;th
is.dbkey=b;this.title=d;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(e);this.reset()};$.extend(View.prototype,{init:function(d){var c=this.container,a=this;this.top_container=$("<div/>").addClass("top-container").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(c);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").pr
ependTo(this.top_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div />").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form=$("<form/>").attr("action",function(){}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em"
).addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(f){if(f.type==="focusout"||(f.keyCode||f.which)===13||(f.keyCode||f.which)===27){if((f.keyCode||f.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return false}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a id='zoom-out' />").click(function(){a.zoom_out();a.redraw()}).appendTo(this.chrom_form);this.zi_link=$("<a id='zoom-in' />").click(function(){a.zoom_in();a.r
edraw()}).appendTo(this.chrom_form);$.ajax({url:chrom_url,data:(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}),dataType:"json",success:function(f){if(f.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=f.chrom_info;var j='<option value="">Select Chrom/Contig</option>';for(var h=0,e=a.chrom_data.length;h<e;h++){var g=a.chrom_data[h].chrom;j+='<option value="'+g+'">'+g+"</option>"}a.chrom_select.html(j);a.intro_div.show();a.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())});if(d){d()}},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}});this.content_div.bind("dblclick",function(f){a.zoom_in(f.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(f){this.current_x=f.offsetX}).bind("drag",function(f){var h=f.offsetX-this.current_x;this.current_x=f.offsetX;var g=Math.round(h/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-g)});this.overview_close.bind("click
",function(){for(var f=0,e=a.tracks.length;f<e;f++){a.tracks[f].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("dragstart",function(f){this.original_low=a.low;this.current_height=f.clientY;this.current_x=f.offsetX;this.enable_pan=(f.clientX<a.viewport_container.width()-16)?true:false}).bind("drag",function(h){if(!this.enable_pan||this.in_reordering){return}var f=$(this);var j=h.offsetX-this.current_x;var g=f.scrollTop()-(h.clientY-this.current_height);f.scrollTop(g);this.current_height=h.clientY;this.current_x=h.offsetX;var i=Math.round(j/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)});this.top_labeltrack.bind("dragstart",function(f){this.drag_origin_x=f.clientX;this.drag_origin_pos=f.clientX/a.viewport_container.width()*(a.high-a.low)+a.low;this.drag_div=$("<div />").css({height:a.content_div.height()+a.top_labeltrac
k.height()+a.nav_labeltrack.height(),top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j){var g=Math.min(j.clientX,this.drag_origin_x)-a.container.offset().left,f=Math.max(j.clientX,this.drag_origin_x)-a.container.offset().left,i=(a.high-a.low),h=a.viewport_container.width();a.update_location(Math.round(g/h*i)+a.low,Math.round(f/h*i)+a.low);this.drag_div.css({left:g+"px",width:(f-g)+"px"})}).bind("dragend",function(k){var g=Math.min(k.clientX,this.drag_origin_x),f=Math.max(k.clientX,this.drag_origin_x),i=(a.high-a.low),h=a.viewport_container.width(),j=a.low;a.low=Math.round(g/h*i)+j;a.high=Math.round(f/h*i)+j;this.drag_div.remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack));$(window).bind("resize",function(){a.resize_window()});$(document).bind("redraw",function(){a.redraw()});this.reset();$(window).trigge
r("resize")},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},change_chrom:function(e,b,g){var d=this;var f=$.grep(d.chrom_data,function(j,k){return j.chrom===e})[0];if(f===undefined){return}if(e!==d.chrom){d.chrom=e;if(!d.chrom){d.intro_div.show()}else{d.intro_div.hide()}d.chrom_select.val(d.chrom);d.max_high=f.len;d.reset();d.redraw(true);for(var h=0,a=d.tracks.length;h<a;h++){var c=d.tracks[h];if(c.init){c.init()}}}if(b!==undefined&&g!==undefined){d.low=Math.max(b,0);d.high=Math.min(g,d.max_high)}d.reset_overview();d.redraw()},go_to:function(f){var j=this,a,d,b=f.split(":"),h=b[0],i=b[1];if(i!==undefined){try{var g=i.split("-");a=parseInt(g[0].replace(/,/g,""),10);d=parseInt(g[1].replace(/,/g,""),10)}catch(c){return false}}j.change_chrom(h,a,d)},move_fraction:function(c){var a=this;var b=a.high-a.low;this.move_delta(c*b)},move_delta:function(c){var a=this;var b=a.high-a
.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.p
ow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var e=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a,width:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.h
igh-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var Filter=function(b,a,c){this.name=b;this.index=a;this.value=c};var NumberFilter=function(b,a){this.name=b;this.index=a;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.slider_min=Number.MAX_VALUE;this.slider_max=-Number.MAX_VALUE;this.slider=null;this.sl
ider_label=null};$.extend(NumberFilter.prototype,{applies_to:function(a){if(a.length>this.index){return true}return false},keep:function(a){if(!this.applies_to(a)){return true}return(a[this.index]>=this.low&&a[this.index]<=this.high)},update_attrs:function(b){var a=false;if(!this.applies_to(b)){return a}if(b[this.index]<this.slider_min){this.slider_min=b[this.index];a=true}if(b[this.index]>this.slider_max){this.slider_max=b[this.index];a=false}return a},update_ui_elt:function(){var b=this.slider.slider("option","min"),a=this.slider.slider("option","max");if(this.slider_min<b||this.slider_max>a){this.slider.slider("option","min",this.slider_min);this.slider.slider("option","max",this.slider_max);this.slider.slider("option","values",[this.slider_min,this.slider_max])}}});var get_filters=function(a){var g=[];for(var d=0;d<a.length;d++){var f=a[d];var c=f.name,e=f.type,b=f.index;if(e=="int"||e=="float"){g[d]=new NumberFilter(c,b)}else{g[d]=new Filter(c,b,e)}}return g};var Track=
function(b,a,d,c){this.name=b;this.view=a;this.parent_element=d;this.filters=(c!==undefined?get_filters(c):[]);this.init_global()};$.extend(Track.prototype,{init_global:function(){this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.filtering_div=$("<div class='track-filters'>").appendTo(this.container_div);this.filtering_div.hide();this.filtering_div.bind("drag",function(i){i.stopPropagation()});var b=$("<table class='filters'>").appendTo(this.filtering_div);var c=this;for(var e=0;e<this.filters.length;e++){var a=this.filters[e];var f=$("<tr>").appendTo(b);
var g=$("<th class='filter-info'>").appendTo(f);var j=$("<span class='name'>").appendTo(g);j.text(a.name+" ");var d=$("<span class='values'>").appendTo(g);var h=$("<td>").appendTo(f);a.control_element=$("<div id='"+a.name+"-filter-control' style='width: 200px; position: relative'>").appendTo(h);a.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(k,l){var i=l.values;d.text("["+i[0]+"-"+i[1]+"]");a.low=i[0];a.high=i[1];c.draw(true)},change:function(i,k){a.control_element.slider("option","slide").call(a.control_element,i,k)}});a.slider=a.control_element;a.slider_label=d}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)},init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");if(!a.content_div.text()){a.content_div.text(DATA_LOADING)}a
.container_div.removeClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"||d.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(d.message){var f=a.view.tracks.indexOf(a);var e=$("<a href='javascript:void(0);'></a>").attr("id",f+"_error");e.text("Click to view error");$("#"+f+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+d.message+"</pre>",{Close:hide_modal})});a.content_div.append(e)}}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(d.data!==undefined&&(d.data===null||d.data.length===0)){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("
nodata");a.content_div.text(DATA_NONE)}}});var TiledTrack=function(){var b=this,j=b.view;if(b.hidden){return}if(b.display_modes!==undefined){if(b.mode_div===undefined){b.mode_div=$("<div class='right-float menubutton popup' />").appendTo(b.header_div);var e=b.display_modes[0];b.mode=e;b.mode_div.text(e);var c=function(i){b.mode_div.text(i);b.mode=i;b.tile_cache.clear();b.draw()};var a={};for(var f=0,h=b.display_modes.length;f<h;f++){var g=b.display_modes[f];a[g]=function(i){return function(){c(i)}}(g)}make_popupmenu(b.mode_div,a)}else{b.mode_div.hide()}}var d={};d["Set as overview"]=function(){j.overview_viewport.find("canvas").remove();b.is_overview=true;b.set_overview();for(var i in j.tracks){if(j.tracks[i]!==b){j.tracks[i].is_overview=false}}};d["Edit configuration"]=function(){var l=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},i=function(){b.update_options(b.track_id);hide_modal();$(window).unbind("keypress.check_enter_esc")},k=function(m){if((m.
keyCode||m.which)===27){l()}else{if((m.keyCode||m.which)===13){i()}}};$(window).bind("keypress.check_enter_esc",k);show_modal("Configure Track",b.gen_options(b.track_id),{Cancel:l,OK:i})};if(b.filters.length>0){d["Show filters"]=function(){var i;if(!b.filtering_div.is(":visible")){i="Hide filters";b.filters_visible=true}else{i="Show filters";b.filters_visible=false}$("#"+b.name_div.attr("id")+"-menu").find("li").eq(2).text(i);b.filtering_div.toggle()}}d.Remove=function(){j.remove_track(b);if(j.num_tracks===0){$("#no-tracks").show()}};b.popup_menu=make_popupmenu(b.name_div,d);show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(a){var k=this.view.low,g=this.view.high,h=g-k,f=this.view.resolution;var n=$("<div style='position: relative;'></div>"),o=this.content_div.width()/h;this.content_div.append(n);this.max_height=0;var b=Math.floor(k/f/DENSITY);var j={};while((b*DENSITY*f)<g){var l=this.content_
div.width()+"_"+o+"_"+b;var e=this.tile_cache.get(l);if(!a&&e){var i=b*DENSITY*f;var d=(i-k)*o;if(this.left_offset){d-=this.left_offset}e.css({left:d});this.show_tile(e,n)}else{this.delayed_draw(this,l,k,g,b,f,n,o,j)}b+=1}var c=this;var m=setInterval(function(){if(obj_length(j)===0){if(c.content_div.children().length>1){c.content_div.children(":first").remove()}for(var p=0;p<c.filters.length;p++){c.filters[p].update_ui_elt()}clearInterval(m)}},50)},delayed_draw:function(c,h,g,e,b,d,i,j,f){var a=setTimeout(function(){if(g<=c.view.high&&e>=c.view.low){var k=c.draw_tile(d,b,i,j);if(k){if(!c.initial_canvas&&!window.G_vmlCanvasManager){c.initial_canvas=$(k).clone();var n=k.get(0).getContext("2d");var l=c.initial_canvas.get(0).getContext("2d");var m=n.getImageData(0,0,n.canvas.width,n.canvas.height);l.putImageData(m,0,0);c.set_overview()}c.tile_cache.set(h,k);c.show_tile(k,i)}}delete f[a]},50);f[a]=true},show_tile:function(a,c){var b=this;c.append(a);b.max_height=Math.max(b.max_he
ight,a.height());b.content_div.css("height",b.max_height+"px");if(a.hasClass(FILTERABLE_CLASS)){show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters");if(b.filters_visible){b.filtering_div.show()}}else{show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false);b.filtering_div.hide()}},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(
),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.data_queue={};this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,i){conso
le.log(h,g,i)}})}},draw_tile:function(f,b,k,o){var g=b*DENSITY*f,d=DENSITY*f,j=f+"_"+b;var e=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(e)}e=$(e);var n=e.get(0).getContext("2d");if(o>PX_PER_CHAR){if(this.data_cache.get(j)===undefined){this.get_data(f,b);return}var m=this.data_cache.get(j);if(m===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*o+this.left_offset);e.get(0).height=this.height_px;e.css({position:"absolute",top:0,left:(g-this.view.low)*o-this.left_offset});for(var h=0,l=m.length;h<l;h++){var a=Math.round(h*o),i=Math.round(o/2);n.fillText(m[h],a+this.left_offset+i,10)}k.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=function(d,b,a,c){this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=80;this.dataset_id=a;this.data_cache=new
Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={color:"black",min_value:undefined,max_value:undefined,mode:this.mode}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");var e=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=e.min;a.prefs.max_value=e.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=e.total_frequency;a.container_div.find(".yaxislabel").remove();var f=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(r
ound_1000(a.prefs.max_value));d.css({position:"absolute",top:"24px",left:"10px"});d.prependTo(a.container_div);f.css({position:"absolute",top:a.height_px+12+"px",left:"10px"});f.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){var h=g.data;c.data_cache.set(e,h);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(o,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*o,a=DENSITY*o,w=o+"_"+r;var b=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(b)}b=$(b);if(this.data_cache.get(w)===undefined){this.get_data(o,r);return}var v=this.data_cache.get(w);if(!v){return}b.css({position:"absolute",top:0,left:(s-this.view.low)*e});b.
get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var n=b.get(0).getContext("2d"),j=false,k=this.prefs.min_value,g=this.prefs.max_value,m=this.vertical_range,t=this.total_frequency,d=this.height_px,l=this.mode;n.beginPath();n.fillStyle=this.prefs.color;var u,h,f;if(v.length>1){f=Math.ceil((v[1][0]-v[0][0])*e)}else{f=10}for(var p=0,q=v.length;p<q;p++){u=Math.round((v[p][0]-s)*e);h=v[p][1];if(h===null){if(j&&l==="Filled"){n.lineTo(u,d)}j=false;continue}if(h<k){h=k}else{if(h>g){h=g}}if(l==="Histogram"){h=Math.round(d-(h-k)/m*d);n.fillRect(u,h,f,d-h)}else{if(l==="Intensity"){h=255-Math.floor((h-k)/m*255);n.fillStyle="rgb("+h+","+h+","+h+")";n.fillRect(u,0,f,d)}else{h=Math.round(d-(h-k)/m*d);if(j){n.lineTo(u,h)}else{j=true;if(l==="Filled"){n.moveTo(u,d);n.lineTo(u,h)}else{n.moveTo(u,h)}}}}}if(l==="Filled"){if(j){n.lineTo(u,d)}n.fill()}else{n.stroke()}c.append(b);return b},gen_options:function(m){var a=$("<div />").addClass("form-row");var e="track_"+m+"_color",b=$("<labe
l />").attr("for",e).text("Color:"),c=$("<input />").attr("id",e).attr("name",e).val(this.prefs.color),h="track_"+m+"_minval",l=$("<label></label>").attr("for",h).text("Min value:"),d=(this.prefs.min_value===undefined?"":this.prefs.min_value),k=$("<input></input>").attr("id",h).val(d),j="track_"+m+"_maxval",g=$("<label></label>").attr("for",j).text("Max value:"),i=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",j).val(i);return a.append(l).append(k).append(g).append(f).append(b).append(c)},update_options:function(d){var a=$("#track_"+d+"_minval").val(),c=$("#track_"+d+"_maxval").val(),b=$("#track_"+d+"_color").val();if(a!==this.prefs.min_value||c!==this.prefs.max_value||b!==this.prefs.color){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(c);this.prefs.color=b;this.vertical_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+d+"_minval").text(this.prefs.min_value);$("#linetrack_"+d+"_maxval").text(thi
s.prefs.max_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(d,b,a,e,c){this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,d,b,b.viewport_container,e);TiledTrack.call(this);this.height_px=0;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=3;this.summary_draw_height=30;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new Cache(20);this.left_offset=200;this.prefs={block_color:"#444",label_color:"black",show_counts:true}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b="initial";this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution,
mode:a.mode},function(c){a.mode_div.show();a.data_cache.set(b,c);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,g,b,q){if(!this.inc_slots[a]){this.inc_slots[a]={};this.inc_slots[a].w_scale=a;this.inc_slots[a].mode=q;this.s_e_by_tile[a]={}}var m=this.inc_slots[a].w_scale,y=[],h=0,n=this.view.max_low;var A=[];if(this.inc_slots[a].mode!==q){delete this.inc_slots[a];this.inc_slots[a]={mode:q,w_scale:m};delete this.s_e_by_tile[a];this.s_e_by_tile[a]={}}for(var v=0,w=g.length;v<w;v++){var f=g[v],l=f[0];if(this.inc_slots[a][l]!==undefined){h=Math.max(h,this.inc_slots[a][l]);A.push(this.inc_slots[a][l])}else{y.push(v)}}for(var v=0,w=y.length;v<w;v++){var f=g[y[v]],l=f[0],r=f[1],c=f[2],p=f[3],d=Math.floor((r-n)*m),
e=Math.ceil((c-n)*m);if(p!==undefined&&!b){var s=CONTEXT.measureText(p).width;if(d-s<0){e+=s}else{d-=s}}var u=0;while(u<=MAX_FEATURE_DEPTH){var o=true;if(this.s_e_by_tile[a][u]!==undefined){for(var t=0,z=this.s_e_by_tile[a][u].length;t<z;t++){var x=this.s_e_by_tile[a][u][t];if(e>x[0]&&d<x[1]){o=false;break}}}if(o){if(this.s_e_by_tile[a][u]===undefined){this.s_e_by_tile[a][u]=[]}this.s_e_by_tile[a][u].push([d,e]);this.inc_slots[a][l]=u;h=Math.max(h,u);break}u++}}return h},rect_or_text:function(r,l,t,b,q,f,i,e){r.textAlign="center";var k=0,p=Math.round(l/2);for(var m=0,s=i.length;m<s;m++){var j=i[m],d="MIDNSHP"[j[0]],n=j[1];if(d==="H"||d==="S"){k-=n}var g=q+k,w=Math.floor(Math.max(0,(g-t)*l)),h=Math.floor(Math.max(0,(g+n-t)*l));switch(d){case"S":case"H":case"M":var o=f.slice(k,n);if((this.mode==="Pack"||this.mode==="Auto")&&f!==undefined&&l>PX_PER_CHAR){r.fillStyle=this.prefs.block_color;r.fillRect(w+this.left_offset,e+1,h-w,9);r.fillStyle=CONNECTOR_COLOR;for(var u=0,a=o.lengt
h;u<a;u++){if(g+u>=t&&g+u<=b){var v=Math.floor(Math.max(0,(g+u-t)*l));r.fillText(o[u],v+this.left_offset+p,e+9)}}}else{r.fillStyle=this.prefs.block_color;r.fillRect(w+this.left_offset,e+4,h-w,3)}break;case"N":r.fillStyle=CONNECTOR_COLOR;r.fillRect(w+this.left_offset,e+5,h-w,1);break;case"D":r.fillStyle="red";r.fillRect(w+this.left_offset,e+4,h-w,3);break;case"P":case"I":break}k+=n}},draw_tile:function(ag,o,s,av){var N=o*DENSITY*ag,al=(o+1)*DENSITY*ag,M=al-N;var an=(!this.initial_canvas?"initial":N+"_"+al);var I=this.data_cache.get(an);var e;if(I===undefined||(this.mode!=="Auto"&&I.dataset_type==="summary_tree")){this.data_queue[[N,al]]=true;this.get_data(N,al);return}var a=Math.ceil(M*av),ai=this.prefs.label_color,l=this.prefs.block_color,r=this.mode,z=25,ae=(r==="Squish")||(r==="Dense")&&(r!=="Pack")||(r==="Auto"&&(I.extra_info==="no_detail")),W=this.left_offset,au,D,aw;var q=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(q)}q=
$(q);if(I.dataset_type==="summary_tree"){D=this.summary_draw_height}else{if(r==="Dense"){D=z;aw=10}else{aw=(ae?this.vertical_nodetail_px:this.vertical_detail_px);var A=(av<0.0001?1/this.view.zoom_res:av);D=this.incremental_slots(A,I.data,ae,r)*aw+z;au=this.inc_slots[A]}}q.css({position:"absolute",top:0,left:(N-this.view.low)*av-W});q.get(0).width=a+W;q.get(0).height=D;s.parent().css("height",Math.max(this.height_px,D)+"px");var J=q.get(0).getContext("2d");J.fillStyle=l;J.font=this.default_font;J.textAlign="right";this.container_div.find(".yaxislabel").remove();if(I.dataset_type=="summary_tree"){var Y=I.data,L=I.max,b=Math.ceil(I.delta*av);var p=$("<div />").addClass("yaxislabel").text(L);p.css({position:"absolute",top:"22px",left:"10px"});p.prependTo(this.container_div);for(var ap=0,H=Y.length;ap<H;ap++){var aa=Math.floor((Y[ap][0]-N)*av);var Z=Y[ap][1];if(!Z){continue}var am=Z/L*this.summary_draw_height;J.fillStyle="black";J.fillRect(aa+W,this.summary_draw_height-am,b,am);i
f(this.prefs.show_counts&&J.measureText(Z).width<b){J.fillStyle="#bbb";J.textAlign="center";J.fillText(Z,aa+W+(b/2),this.summary_draw_height-5)}}e="Summary";s.append(q);return q}if(I.message){q.css({border:"solid red","border-width":"2px 2px 2px 0px"});J.fillStyle="red";J.textAlign="left";J.fillText(I.message,100+W,aw)}var ad=false;if(I.data){ad=true;for(var ar=0;ar<this.filters.length;ar++){if(!this.filters[ar].applies_to(I.data[0])){ad=false}}}if(ad){q.addClass(FILTERABLE_CLASS)}var at=I.data;var ao=0;for(var ap=0,H=at.length;ap<H;ap++){var S=at[ap],R=S[0],aq=S[1],ac=S[2],O=S[3];if(au[R]===undefined){continue}var ab=false;var U;for(var ar=0;ar<this.filters.length;ar++){U=this.filters[ar];U.update_attrs(S);if(!U.keep(S)){ab=true;break}}if(ab){continue}if(aq<=al&&ac>=N){var af=Math.floor(Math.max(0,(aq-N)*av)),K=Math.ceil(Math.min(a,Math.max(0,(ac-N)*av))),X=(r==="Dense"?1:(1+au[R]))*aw;var G,aj,P=null,ax=null;if(I.dataset_type==="bai"){var v=S[4];J.fillStyle=l;if(S[5] insta
nceof Array){var E=Math.floor(Math.max(0,(S[5][0]-N)*av)),Q=Math.ceil(Math.min(a,Math.max(0,(S[5][1]-N)*av))),C=Math.floor(Math.max(0,(S[6][0]-N)*av)),w=Math.ceil(Math.min(a,Math.max(0,(S[6][1]-N)*av)));if(S[5][1]>=N&&S[5][0]<=al){this.rect_or_text(J,av,N,al,S[5][0],S[5][2],v,X)}if(S[6][1]>=N&&S[6][0]<=al){this.rect_or_text(J,av,N,al,S[6][0],S[6][2],v,X)}if(C>Q){J.fillStyle=CONNECTOR_COLOR;J.fillRect(Q+W,X+5,C-Q,1)}}else{J.fillStyle=l;this.rect_or_text(J,av,N,al,aq,O,v,X)}if(r!=="Dense"&&!ae&&aq>N){J.fillStyle=this.prefs.label_color;if(o===0&&af-J.measureText(O).width<0){J.textAlign="left";J.fillText(R,K+2+W,X+8)}else{J.textAlign="right";J.fillText(R,af-2+W,X+8)}J.fillStyle=l}}else{if(I.dataset_type==="interval_index"){if(ae){J.fillStyle=l;J.fillRect(af+W,X+5,K-af,1)}else{var F=S[4],V=S[5],ah=S[6],h=S[7];if(V&&ah){P=Math.floor(Math.max(0,(V-N)*av));ax=Math.ceil(Math.min(a,Math.max(0,(ah-N)*av)))}if(r!=="Dense"&&O!==undefined&&aq>N){J.fillStyle=ai;if(o===0&&af-J.measureText(O
).width<0){J.textAlign="left";J.fillText(O,K+2+W,X+8)}else{J.textAlign="right";J.fillText(O,af-2+W,X+8)}J.fillStyle=l}if(h){if(F){if(F=="+"){J.fillStyle=RIGHT_STRAND}else{if(F=="-"){J.fillStyle=LEFT_STRAND}}J.fillRect(af+W,X,K-af,10);J.fillStyle=l}for(var an=0,g=h.length;an<g;an++){var u=h[an],d=Math.floor(Math.max(0,(u[0]-N)*av)),T=Math.ceil(Math.min(a,Math.max((u[1]-N)*av)));if(d>T){continue}G=5;aj=3;J.fillRect(d+W,X+aj,T-d,G);if(P!==undefined&&!(d>ax||T<P)){G=9;aj=1;var ak=Math.max(d,P),B=Math.min(T,ax);J.fillRect(ak+W,X+aj,B-ak,G)}}}else{G=9;aj=1;J.fillRect(af+W,X+aj,K-af,G);if(S.strand){if(S.strand=="+"){J.fillStyle=RIGHT_STRAND_INV}else{if(S.strand=="-"){J.fillStyle=LEFT_STRAND_INV}}J.fillRect(af+W,X,K-af,10);J.fillStyle=l}}}}else{if(I.dataset_type==="vcf"){if(ae){J.fillStyle=l;J.fillRect(af+W,X+5,K-af,1)}else{var t=S[4],n=S[5],c=S[6];G=9;aj=1;J.fillRect(af+W,X,K-af,G);if(r!=="Dense"&&O!==undefined&&aq>N){J.fillStyle=ai;if(o===0&&af-J.measureText(O).width<0){J.textAlig
n="left";J.fillText(O,K+2+W,X+8)}else{J.textAlign="right";J.fillText(O,af-2+W,X+8)}J.fillStyle=l}var m=t+" / "+n;if(aq>N&&J.measureText(m).width<(K-af)){J.fillStyle="white";J.textAlign="center";J.fillText(m,W+af+(K-af)/2,X+8);J.fillStyle=l}}}}}ao++}}return q},gen_options:function(i){var a=$("<div />").addClass("form-row");var e="track_"+i+"_block_color",k=$("<label />").attr("for",e).text("Block color:"),l=$("<input />").attr("id",e).attr("name",e).val(this.prefs.block_color),j="track_"+i+"_label_color",g=$("<label />").attr("for",j).text("Text color:"),h=$("<input />").attr("id",j).attr("name",j).val(this.prefs.label_color),f="track_"+i+"_show_count",c=$("<label />").attr("for",f).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",f).attr("name",f).attr("checked",this.prefs.show_counts),d=$("<div />").append(b).append(c);return a.append(k).append(l).append(g).append(h).append(d)},update_options:function(d){var b=$("#track_"+d+"_
block_color").val(),c=$("#track_"+d+"_label_color").val(),a=$("#track_"+d+"_show_count").attr("checked");if(b!==this.prefs.block_color||c!==this.prefs.label_color||a!==this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=c;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(d,b,a,e,c){FeatureTrack.call(this,d,b,a,e,c);this.track_type="ReadTrack";this.vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
1
0

galaxy-dist commit def13f052a4a: Restored the function to stop the edit samples form from getting submitted when return key is pressed. This is needed in this form as the barcode scanner (when in keyboard emulation mode) may send a return key appended to the scanned barcode string.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1289853524 18000
# Node ID def13f052a4a22c46ec5be6481ad874ceb734799
# Parent 02f6c9dae26e9aef40a44bc151ed07b457715839
Restored the function to stop the edit samples form from getting submitted when return key is pressed. This is needed in this form as the barcode scanner (when in keyboard emulation mode) may send a return key appended to the scanned barcode string.
--- a/scripts/galaxy_messaging/server/amqp_consumer.py
+++ b/scripts/galaxy_messaging/server/amqp_consumer.py
@@ -68,7 +68,7 @@ def update_sample_state( message ):
api_key = get_value(dom, 'api_key')
log.debug('Barcode: ' + barcode)
log.debug('State: ' + state)
- log.debug('api_key: ' + api_key)
+ log.debug('API Key: ' + api_key)
# validate
if not barcode or not state or not api_key:
log.debug( 'Incomplete sample_state_update message received. Sample barcode, desired state and user API key is required.' )
--- a/templates/requests/common/edit_samples.mako
+++ b/templates/requests/common/edit_samples.mako
@@ -14,6 +14,18 @@
${common_javascripts()}
</%def>
+<script type="text/javascript">
+ // This function stops the form from getting submitted when return key is pressed
+ // This is needed in this form as the barcode scanner (when in keyboard emulation mode)
+ // may send a return key appended to the scanned barcode string.
+ function stopRKey(evt) {
+ var evt = (evt) ? evt : ((event) ? event : null);
+ var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
+ if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
+ }
+ document.onkeypress = stopRKey
+</script>
+
<%
from galaxy.web.framework.helpers import time_ago
1
0

galaxy-dist commit 33dacaafc62e: Change in output redirect. Should fix drawing phylogeny bug. Thanks Nate for pointing this out.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User anton(a)grusha.bx.psu.edu
# Date 1289920626 18000
# Node ID 33dacaafc62eac4a8940c4bc978da1d1a6c68af9
# Parent 94c2040e58255136741d776de8401cfb4128133b
Change in output redirect. Should fix drawing phylogeny bug. Thanks Nate for pointing this out.
--- a/tools/taxonomy/t2ps_wrapper.py
+++ b/tools/taxonomy/t2ps_wrapper.py
@@ -38,7 +38,7 @@ ps_file = tempfile.NamedTemporaryFile('w
# Execute taxonomy2tree
try:
- t2t_cmd = 'taxonomy2tree %s %s %s /dev/null 1 &> /dev/null' % ( tree_file, max_tree_level, newick_file.name )
+ t2t_cmd = 'taxonomy2tree %s %s %s /dev/null 1 > /dev/null 2>&1' % ( tree_file, max_tree_level, newick_file.name )
retcode = subprocess.call( t2t_cmd, shell=True )
if retcode < 0:
print >>sys.stderr, "Execution of taxonomy2tree terminated by signal", -retcode
1
0

galaxy-dist commit 9a7482206be2: Tweaks to taxonomy tools
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Anton Nekrutenko <anton(a)bx.psu.edu>
# Date 1289851499 18000
# Node ID 9a7482206be274678079271331171600a2023b03
# Parent 3868982a4eff5036f13650ab303e0b9a4fb30da8
Tweaks to taxonomy tools
--- a/tools/taxonomy/t2ps_wrapper.py
+++ b/tools/taxonomy/t2ps_wrapper.py
@@ -59,7 +59,7 @@ except OSError, e:
# Convert PS to PDF
try:
- ps2pdf_cmd = 'ps2pdf %s %s' % ( ps_file.name, pdf_file )
+ ps2pdf_cmd = 'pstopdf %s -o %s' % ( ps_file.name, pdf_file )
retcode = subprocess.call( ps2pdf_cmd, shell=True )
if retcode < 0:
print >>sys.stderr, "Execution of ps2pdf terminated by signal", -retcode
--- a/scripts/taxonomy/processTaxonomy.sh
+++ b/scripts/taxonomy/processTaxonomy.sh
@@ -11,7 +11,7 @@ echo "Sorting gi2tax files..."
sort -n -k 1 gi_taxid_all.dmp > gi_taxid_sorted.txt
rm gi_taxid_nucl.dmp gi_taxid_prot.dmp gi_taxid_all.dmp
echo "Removing parenthesis from names.dmp"
-cat names.dmp | sed s/\(/_/g | sed s/\)/_/g > names.temporary
+cat names.dmp | sed s/[\(\)\'\"]/_/g > names.temporary
mv names.dmp names.dmp.orig
mv names.temporary names.dmp
1
0

galaxy-dist commit 5a217a7ce999: Replaced request with 'sequencing request' in sample tracking ui.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1289922517 18000
# Node ID 5a217a7ce999bbe218432a7442751b5b78684798
# Parent 33dacaafc62eac4a8940c4bc978da1d1a6c68af9
Replaced request with 'sequencing request' in sample tracking ui.
Show the request page instead of the request grid after submitting the request
--- a/templates/admin/requests/edit_request_type.mako
+++ b/templates/admin/requests/edit_request_type.mako
@@ -28,7 +28,7 @@
</div><div class="form-row"><label>
- Request Form definition:
+ Sequencing Request Form definition:
</label><select name="form_id">
%for form in forms:
--- a/templates/requests/common/edit_samples.mako
+++ b/templates/requests/common/edit_samples.mako
@@ -69,16 +69,16 @@
</div></ul>
-%if request.samples_without_library_destinations:
+%if request.is_rejected:
<p>
- <font color="red"><b><i>Select a target data library and folder for a sample before selecting it's datasets to transfer from the sequencer</i></b></font>
+ <font color="red"><b>${request.last_comment}</b></font></p>
%endif
-%if request.is_rejected:
- <br/>
- <font color="red"><b><i>Reason for rejection: </i></b></font><b>${request.last_comment}</b>
- <br/>
+%if request.samples_without_library_destinations:
+ <p>
+ <font color="red"><b><i>Select a target data library and folder for a sample before selecting it's datasets to transfer from the sequencer</i></b></font>
+ </p>
%endif
%if message:
@@ -90,9 +90,9 @@
%if displayable_sample_widgets:
<%
if editing_samples:
- grid_header = '<h3>Edit Current Samples of Request "%s"</h3>' % request.name
+ grid_header = '<h3>Edit Current Samples of Sequencing Request "%s"</h3>' % request.name
else:
- grid_header = '<h3>Add Samples to Request "%s"</h3>' % request.name
+ grid_header = '<h3>Add Samples to Sequencing Request "%s"</h3>' % request.name
%>
${render_samples_grid( cntrller, request, displayable_sample_widgets, action='edit_samples', editing_samples=editing_samples, encoded_selected_sample_ids=encoded_selected_sample_ids, render_buttons=False, grid_header=grid_header )}
%if editing_samples and len( sample_operation_select_field.options ) > 1 and not is_unsubmitted:
--- a/lib/galaxy/web/controllers/requests_common.py
+++ b/lib/galaxy/web/controllers/requests_common.py
@@ -157,7 +157,7 @@ class RequestsCommon( BaseController, Us
status = 'error'
else:
request = self.__save_request( trans, cntrller, **kwd )
- message = 'The request has been created.'
+ message = 'The sequencing request has been created.'
if params.get( 'create_request_button', False ):
return trans.response.send_redirect( web.url_for( controller=cntrller,
action='browse_requests',
@@ -316,7 +316,7 @@ class RequestsCommon( BaseController, Us
trans.sa_session.flush()
trans.sa_session.refresh( request )
# Create an event with state 'New' for this new request
- comment = "Request created by %s" % trans.user.email
+ comment = "Sequencing request created by %s" % trans.user.email
if request.user != trans.user:
comment += " on behalf of %s." % request.user.email
event = trans.model.RequestEvent( request, request.states.NEW, comment )
@@ -358,7 +358,7 @@ class RequestsCommon( BaseController, Us
status='error',
message=message ) )
# Change the request state to 'Submitted'
- comment = "Request submitted by %s" % trans.user.email
+ comment = "Sequencing request submitted by %s" % trans.user.email
if request.user != trans.user:
comment += " on behalf of %s." % request.user.email
event = trans.model.RequestEvent( request, request.states.SUBMITTED, comment )
@@ -373,7 +373,7 @@ class RequestsCommon( BaseController, Us
# request's RequestType configured by the admin.
initial_sample_state_after_request_submitted = request.type.states[0]
for sample in request.samples:
- event_comment = 'Request submitted and sample state set to %s.' % request.type.states[0].name
+ event_comment = 'Sequencing request submitted and sample state set to %s.' % request.type.states[0].name
event = trans.model.SampleEvent( sample,
initial_sample_state_after_request_submitted,
event_comment )
@@ -381,9 +381,10 @@ class RequestsCommon( BaseController, Us
trans.sa_session.add( request )
trans.sa_session.flush()
request.send_email_notification( trans, initial_sample_state_after_request_submitted )
- message = 'The request has been submitted.'
- return trans.response.send_redirect( web.url_for( controller=cntrller,
- action='browse_requests',
+ message = 'The sequencing request has been submitted.'
+ # show the request page after submitting the request
+ return trans.response.send_redirect( web.url_for( controller='requests_common',
+ action='view_request',
cntrller=cntrller,
id=request_id,
status=status,
@@ -528,7 +529,7 @@ class RequestsCommon( BaseController, Us
for s in request.samples:
s.deleted = True
trans.sa_session.add( s )
- comment = "Request marked deleted by %s." % trans.user.email
+ comment = "Sequencing request marked deleted by %s." % trans.user.email
# There is no DELETED state for a request, so keep the current request state
event = trans.model.RequestEvent( request, request.state, comment )
trans.sa_session.add( event )
@@ -568,7 +569,7 @@ class RequestsCommon( BaseController, Us
for s in request.samples:
s.deleted = False
trans.sa_session.add( s )
- comment = "Request marked undeleted by %s." % trans.user.email
+ comment = "Sequencing request marked undeleted by %s." % trans.user.email
event = trans.model.RequestEvent( request, request.state, comment )
trans.sa_session.add( event )
trans.sa_session.flush()
@@ -686,11 +687,11 @@ class RequestsCommon( BaseController, Us
request_type_state = request.type.final_sample_state
if common_state.id == request_type_state.id:
# since all the samples are in the final state, change the request state to 'Complete'
- comment = "All samples of this request are in the final sample state (%s). " % request_type_state.name
+ comment = "All samples of this sequencing request are in the final sample state (%s). " % request_type_state.name
state = request.states.COMPLETE
final_state = True
else:
- comment = "All samples of this request are in the (%s) sample state. " % common_state.name
+ comment = "All samples of this sequencing request are in the (%s) sample state. " % common_state.name
state = request.states.SUBMITTED
event = trans.model.RequestEvent( request, state, comment )
trans.sa_session.add( event )
--- a/templates/admin/requests/view_request_type.mako
+++ b/templates/admin/requests/view_request_type.mako
@@ -38,7 +38,7 @@
<div style="clear: both"></div></div><div class="form-row">
- <label>Request form definition</label>
+ <label>Sequencing Request form definition</label>
${request_type.request_form.name}
</div><div class="form-row">
--- a/lib/galaxy/web/controllers/requests_admin.py
+++ b/lib/galaxy/web/controllers/requests_admin.py
@@ -223,11 +223,11 @@ class RequestsAdmin( BaseController, Use
status=status,
message=message )
# Create an event with state 'Rejected' for this request
- event_comment = "Request marked rejected by %s. Reason: %s " % ( trans.user.email, comment )
+ event_comment = "Sequencing request marked rejected by %s. Reason: %s " % ( trans.user.email, comment )
event = trans.model.RequestEvent( request, request.states.REJECTED, event_comment )
trans.sa_session.add( event )
trans.sa_session.flush()
- message='Request (%s) has been rejected.' % request.name
+ message='Sequencing request (%s) has been rejected.' % request.name
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='browse_requests',
status=status,
--- a/templates/admin/requests/reject.mako
+++ b/templates/admin/requests/reject.mako
@@ -5,7 +5,6 @@
${render_msg( message, status )}
%endif
<br/><br/>
-##<h2>Reject Sequencing Request "${request.name}"</h2><ul class="manage-table-actions"><li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request_history', cntrller=cntrller, id=trans.security.encode_id(request.id) )}">View history</a>
--- a/templates/requests/common/view_request.mako
+++ b/templates/requests/common/view_request.mako
@@ -52,14 +52,14 @@
</ul>
%if request.is_rejected:
- <br/>
- <font color="red"><b><i>Reason for rejection: </i></b></font><b>${request.last_comment}</b>
- <br/>
+ <p>
+ <font color="red"><b>${request.last_comment}</b></font>
+ </p>
%endif
%if request.samples_without_library_destinations:
<p>
- <font color="red"><b><i>Select a target data library and folder for a sample before selecting it's datasets to transfer from the sequencer</i></b></font>
+ <font color="red"><b><i>Select a target data library and folder for a sample before selecting it's datasets to transfer from the sequencer</i></b></font></p>
%endif
--- a/templates/requests/common/common.mako
+++ b/templates/requests/common/common.mako
@@ -159,6 +159,8 @@
<input type="hidden" name="sample_${sample_widget_index}_bar_code" value="${sample_widget['bar_code']}"/>
%endif
</td>
+ %else:
+ <td></td>
%endif
%if sample:
%if is_unsubmitted:
1
0

galaxy-dist commit 02f6c9dae26e: Data libraries: Fix 'import from current history' showing metadata files that are not visible. Also fix this same issue for 'Copy history items' feature. Do this by adding new 'visible_datasets' mapping property for HDAs. Checkbox labels for both features can now be clicked.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1289852143 18000
# Node ID 02f6c9dae26e9aef40a44bc151ed07b457715839
# Parent 0505090dbbe610741cacd7a9a1c2e79b8cc9ea5c
Data libraries: Fix 'import from current history' showing metadata files that are not visible. Also fix this same issue for 'Copy history items' feature. Do this by adding new 'visible_datasets' mapping property for HDAs. Checkbox labels for both features can now be clicked.
--- a/templates/root/index.mako
+++ b/templates/root/index.mako
@@ -40,7 +40,7 @@
"Show Hidden Datasets": function() {
galaxy_history.location = "${h.url_for( controller='root', action='history', show_hidden=True)}";
},
- "Show structure": function() {
+ "Show Structure": function() {
galaxy_main.location = "${h.url_for( controller='history', action='display_structured' )}";
},
"Export to File": function() {
--- a/templates/library/common/common.mako
+++ b/templates/library/common/common.mako
@@ -427,14 +427,11 @@
<input type="hidden" name="upload_option" value="import_from_history"/><input type="hidden" name="ldda_message" value="${ldda_message}"/><%
+ role_ids_selected = ''
if roles_select_list:
- role_ids_selected = roles_select_list.get_selected( return_value=True, multi=True )
- if role_ids_selected:
- role_ids_selected = ','.join( role_ids_selected )
- else:
- role_ids_selected = ''
- else:
- role_ids_selected = ''
+ selected = roles_select_list.get_selected( return_value=True, multi=True )
+ if selected:
+ role_ids_selected = ','.join( selected )
%><input type="hidden" name="roles" value="${role_ids_selected}"/>
%if replace_dataset not in [ None, 'None' ]:
@@ -450,9 +447,11 @@
${render_template_field( field, render_as_hidden=True )}
%endfor
%endif
- %for hda in history.active_datasets:
+ %for hda in history.visible_datasets:
+ <% encoded_id = trans.security.encode_id( hda.id ) %><div class="form-row">
- <input name="hda_ids" value="${trans.security.encode_id( hda.id )}" type="checkbox"/>${hda.hid}: ${hda.name}
+ <input name="hda_ids" id="hist_${encoded_id}" value="${encoded_id}" type="checkbox"/>
+ <label for="hist_${encoded_id}" style="display: inline;font-weight:normal;">${hda.hid}: ${hda.name}</label></div>
%endfor
<div class="form-row">
@@ -460,9 +459,7 @@
</div></form>
%else:
- <p/>
- Your current history is empty
- <p/>
+ <p>Your current history is empty</p>
%endif
</div></div>
--- a/templates/dataset/copy_view.mako
+++ b/templates/dataset/copy_view.mako
@@ -17,22 +17,29 @@
</p>
%endif
<p>
+ <div class="infomessage">Select any number of source history items and any number of target histories and click "Copy History Items" to add a copy of each selected history item to each selected target history.</div>
+ <div style="clear: both"></div>
+</p>
+<p><div class="toolForm"><form>
- <div style="float: left; width: 50%; padding: 0px 0px 0px 0px;">
+ <div style="float: left; width: 50%; padding: 0px;"><div class="toolFormTitle">Source History Items</div><div class="toolFormBody">
%for data in source_datasets:
<%
checked = ""
if data.id in source_dataset_ids:
- checked = " checked"
+ checked = " checked='checked'"
%>
- <div class="form-row"><input type="checkbox" name="source_dataset_ids" value="${data.id}"${checked}/> ${data.hid}: ${data.name}</div>
+ <div class="form-row">
+ <input type="checkbox" name="source_dataset_ids" id="dataset_${data.id}" value="${data.id}"${checked}/>
+ <label for="dataset_${data.id}" style="display: inline;font-weight:normal;"> ${data.hid}: ${data.name}</label>
+ </div>
%endfor
</div></div>
- <div style="float: right; width: 50%; padding: 0px 0px 0px 0px;">
+ <div style="float: right; width: 50%; padding: 0px;"><div class="toolFormTitle">Target Histories</div><div class="toolFormBody">
%for i, hist in enumerate( target_histories ):
@@ -44,13 +51,16 @@
if hist == trans.get_history():
cur_history_text = " <strong>(current history)</strong>"
%>
- <div class="form-row"><input type="checkbox" name="target_history_ids" value="${hist.id}"${checked}/> ${i + 1}${cur_history_text}: ${hist.name}</div>
+ <div class="form-row">
+ <input type="checkbox" name="target_history_ids" id="hist_${hist.id}" value="${hist.id}"${checked}/>
+ <label for="hist_${hist.id}" style="display: inline;font-weight:normal;">${i + 1}: ${hist.name}${cur_history_text}</label>
+ </div>
%endfor
%if trans.get_user():
<%
checked = ""
if "create_new_history" in target_history_ids:
- checked = " checked"
+ checked = " checked='checked'"
%><br/><div class="form-row"><input type="checkbox" name="target_history_ids" value="create_new_history"${checked}/>New history named: <input type="textbox" name="new_history_name" value="${new_history_name}"/></div>
@@ -64,8 +74,3 @@
</form></div></p>
-<div style="clear: both"></div>
-<p>
- <div class="infomessage">Select any number of source history items and any number of target histories and click "Copy History Items" to add a copy of each selected history item to each selected target history.</div>
- <div style="clear: both"></div>
-</p>
--- a/lib/galaxy/web/controllers/dataset.py
+++ b/lib/galaxy/web/controllers/dataset.py
@@ -773,7 +773,7 @@ class DatasetInterface( BaseController,
trans.sa_session.refresh( history )
elif create_new_history:
target_history_ids.append( "create_new_history" )
- source_datasets = history.active_datasets
+ source_datasets = history.visible_datasets
target_histories = [history]
if user:
target_histories = user.active_histories
--- a/lib/galaxy/model/mapping.py
+++ b/lib/galaxy/model/mapping.py
@@ -1033,7 +1033,9 @@ assign_mapper( context, ImplicitlyConver
assign_mapper( context, History, History.table,
properties=dict( galaxy_sessions=relation( GalaxySessionToHistoryAssociation ),
datasets=relation( HistoryDatasetAssociation, backref="history", order_by=asc(HistoryDatasetAssociation.table.c.hid) ),
- active_datasets=relation( HistoryDatasetAssociation, primaryjoin=( ( HistoryDatasetAssociation.table.c.history_id == History.table.c.id ) & ( not_( HistoryDatasetAssociation.table.c.deleted ) ) ), order_by=asc( HistoryDatasetAssociation.table.c.hid ), viewonly=True ),
+ active_datasets=relation( HistoryDatasetAssociation, primaryjoin=( ( HistoryDatasetAssociation.table.c.history_id == History.table.c.id ) & not_( HistoryDatasetAssociation.table.c.deleted ) ), order_by=asc( HistoryDatasetAssociation.table.c.hid ), viewonly=True ),
+ visible_datasets=relation( HistoryDatasetAssociation, primaryjoin=( ( HistoryDatasetAssociation.table.c.history_id == History.table.c.id ) & not_( HistoryDatasetAssociation.table.c.deleted ) & HistoryDatasetAssociation.table.c.visible ),
+ order_by=asc( HistoryDatasetAssociation.table.c.hid ), viewonly=True ),
tags=relation( HistoryTagAssociation, order_by=HistoryTagAssociation.table.c.id, backref="histories" ),
annotations=relation( HistoryAnnotationAssociation, order_by=HistoryAnnotationAssociation.table.c.id, backref="histories" ),
ratings=relation( HistoryRatingAssociation, order_by=HistoryRatingAssociation.table.c.id, backref="histories" ) )
1
0

galaxy-dist commit 2bfb046649f0: Cleaned up the remote file size method so that only the file size is stored.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1289848701 18000
# Node ID 2bfb046649f059734e2709643785a95af3b85e81
# Parent 796201bc8dbc531ddaec5d75fadb88e858adfbc4
Cleaned up the remote file size method so that only the file size is stored.
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -1864,20 +1864,21 @@ class Sample( object ):
untransferred_datasets.append( dataset )
return untransferred_datasets
def get_untransferred_dataset_size( self, filepath ):
- # TODO: RC: If rsh keys are not set, this method will return something like the following:
- # greg(a)scofield.bx.psu.edu's password: 46M /afs/bx.psu.edu/home/greg/chr22/chr21.fa
- # This method should return the number of bytes in the file. I believe du
- # displays the file system block usage which may not be the number of bytes in the file.
- # Would ls -l be better?
def print_ticks( d ):
pass
datatx_info = self.request.type.datatx_info
- cmd = 'ssh %s@%s "du -sh \'%s\'"' % ( datatx_info['username'], datatx_info['host'], filepath )
+ login_str = '%s@%s' % ( datatx_info['username'], datatx_info['host'] )
+ cmd = 'ssh %s "du -sh \'%s\'"' % ( login_str, filepath )
output = pexpect.run( cmd,
events={ '.ssword:*': datatx_info['password']+'\r\n',
pexpect.TIMEOUT:print_ticks},
timeout=10 )
- return output.replace( filepath, '' ).strip()
+ # cleanup the output to get just the file size
+ return output.replace( filepath, '' )\
+ .replace( 'Password:', '' )\
+ .replace( "'s password:", '' )\
+ .replace( login_str, '' )\
+ .strip()
def get_api_value( self, view='collection' ):
rval = {}
try:
1
0

galaxy-dist commit efc0b15af402: More tests added to sample tracking functional tests
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1289841695 18000
# Node ID efc0b15af4026aa039945c799354e8cac5975528
# Parent bde1ca8b6134079a9323d76bcaf057b3cc4166c1
More tests added to sample tracking functional tests
--- a/test/functional/test_sample_tracking.py
+++ b/test/functional/test_sample_tracking.py
@@ -360,10 +360,13 @@ class TestFormsAndRequests( TwillTestCas
strings_displayed=[ 'Edit sequencing request "%s"' % request1.name ],
strings_displayed_after_submit=[ new_name, new_desc ] )
refresh( request1 )
- # now check email notification settings
- check_sample_states = [ ( request1.type.states[0].name, request1.type.states[0].id, True ),
- ( request1.type.states[2].name, request1.type.states[2].id, True ),
- ( request1.type.states[4].name, request1.type.states[4].id, True ) ]#[ ( state.id, True ) for state in request1.type.states ]
+ # define the sample states when we want an email notification
+ global email_notification_sample_states
+ email_notification_sample_states = [ request1.type.states[2], request1.type.states[4] ]
+ # check email notification settings
+ check_sample_states = []
+ for state in email_notification_sample_states:
+ check_sample_states.append( ( state.name, state.id, True ) )
strings_displayed = [ 'Edit sequencing request "%s"' % request1.name,
'Email notification settings' ]
additional_emails = [ 'test@.bx.psu.edu', 'test2@.bx.psu.edu' ]
@@ -496,7 +499,9 @@ class TestFormsAndRequests( TwillTestCas
#
def test_050_receive_request_as_admin( self ):
"""Testing receiving a sequencing request and assigning it barcodes"""
+ # logged in as regular_user1
self.logout()
+ # login as a admin_user to assign bar codes to samples
self.login( email=admin_user.email )
self.check_request_grid( cntrller='requests_admin',
state=request1.states.SUBMITTED,
@@ -540,49 +545,48 @@ class TestFormsAndRequests( TwillTestCas
sample_id=self.security.encode_id( sample.id ),
strings_displayed=strings_displayed,
strings_not_displayed=strings_not_displayed )
-# def test_040_request_lifecycle( self ):
-# """Testing request life-cycle as it goes through all the states"""
-# # logged in as regular_user1
-# self.logout()
-# self.login( email=admin_user.email )
-# self.check_request_grid( cntrller='requests_admin',
-# state=request1.states.SUBMITTED,
-# strings_displayed=[ request1.name ] )
-# self.visit_url( "%s/requests_common/view_request?cntrller=requests&id=%s" % ( self.url, self.security.encode_id( request1.id ) ) )
-# # TODO: add some string for checking on the page above...
-# # Set bar codes for the samples
-# bar_codes = [ '1234567890', '0987654321' ]
-# strings_displayed_after_submit=[ 'Changes made to the samples have been saved.' ]
-# for bar_code in bar_codes:
-# strings_displayed_after_submit.append( bar_code )
-# self.add_bar_codes( request_id=self.security.encode_id( request1.id ),
-# request_name=request1.name,
-# bar_codes=bar_codes,
-# samples=request1.samples,
-# strings_displayed_after_submit=strings_displayed_after_submit )
-# # Change the states of all the samples of this request to ultimately be COMPLETE
-# self.change_sample_state( request_id=self.security.encode_id( request1.id ),
-# request_name=request1.name,
-# sample_names=[ sample.name for sample in request1.samples ],
-# sample_ids=[ sample.id for sample in request1.samples ],
-# new_sample_state_id=request_type1.states[1].id,
-# new_state_name=request_type1.states[1].name )
-# self.change_sample_state( request_id=self.security.encode_id( request1.id ),
-# request_name=request1.name,
-# sample_names=[ sample.name for sample in request1.samples ],
-# sample_ids=[ sample.id for sample in request1.samples ],
-# new_sample_state_id=request_type1.states[2].id,
-# new_state_name=request_type1.states[2].name )
-# refresh( request1 )
-# self.logout()
-# self.login( email=regular_user1.email )
-# # check if the request's state is now set to 'complete'
-# self.check_request_grid( cntrller='requests',
-# state='Complete',
-# strings_displayed=[ request1.name ] )
-# assert request1.state is not request1.states.COMPLETE, "The state of the request '%s' should be set to '%s'" \
-# % ( request1.name, request1.states.COMPLETE )
-#
+ def test_055_request_lifecycle( self ):
+ """Testing request life-cycle as it goes through all the states"""
+ # logged in as admin_user
+ self.check_request_grid( cntrller='requests_admin',
+ state=request1.states.SUBMITTED,
+ strings_displayed=[ request1.name ] )
+ strings_displayed=[ 'History of sequencing request "%s"' % request1.name ]
+ # Change the states of all the samples of this request to ultimately be COMPLETE
+ for index, state in enumerate( request_type1.states ):
+ # start from the second state onwards
+ if index > 1:
+ # status message
+ if index == len( request_type1.states ) - 1:
+ status_msg = 'All samples of this request are in the final sample state (%s).' % state.name
+ else:
+ status_msg = 'All samples of this request are in the (%s) sample state. ' % state.name
+ # check email notification message
+ email_msg = ''
+ if state.id in [ email_state.id for email_state in email_notification_sample_states ]:
+ email_msg = 'Email notification failed as SMTP server not set in config file'
+ self.change_sample_state( request_id=self.security.encode_id( request1.id ),
+ sample_ids=[ sample.id for sample in request1.samples ],
+ new_sample_state_id=self.security.encode_id( state.id ),
+ strings_displayed=[ 'Edit Current Samples of Request "%s"' % request1.name ],
+ strings_displayed_after_submit = [ status_msg, email_msg ] )
+ # check request history page
+ if index == len( request_type1.states ) - 1:
+ strings_displayed.append( status_msg )
+ else:
+ strings_displayed.append( status_msg )
+ self.view_request_history( cntrller='requests_admin',
+ request_id=self.security.encode_id( request1.id ),
+ strings_displayed=strings_displayed,
+ strings_not_displayed=[ request1.states.REJECTED ] )
+ refresh( request1 )
+ # check if the request's state is now set to 'complete'
+ self.check_request_grid( cntrller='requests_admin',
+ state='Complete',
+ strings_displayed=[ request1.name ] )
+ assert request1.state is not request1.states.COMPLETE, "The state of the request '%s' should be set to '%s'" \
+ % ( request1.name, request1.states.COMPLETE )
+
# def test_045_admin_create_request_on_behalf_of_regular_user( self ):
# """Testing creating and submitting a request as an admin on behalf of a regular user"""
# # Logged in as regular_user1
@@ -660,7 +664,7 @@ class TestFormsAndRequests( TwillTestCas
# # Make sure the request's state is now set to REJECTED
# assert request2.state is not request2.states.REJECTED, "The state of the request '%s' should be set to '%s'" \
# % ( request2.name, request2.states.REJECTED )
- def test_055_reset_data_for_later_test_runs( self ):
+ def __test_055_reset_data_for_later_test_runs( self ):
"""Reseting data to enable later test runs to pass"""
# Logged in as admin_user
self.logout()
--- a/test/base/twilltestcase.py
+++ b/test/base/twilltestcase.py
@@ -1434,9 +1434,9 @@ class TwillTestCase( unittest.TestCase )
'''View form details'''
self.home()
self.visit_url( "%s/forms/manage?operation=view&id=%s" % ( self.url, id ) )
- self.check_page_for_string( form_type )
+ #self.check_page_for_string( form_type )
self.check_page_for_string( form_name )
- self.check_page_for_string( form_desc )
+ #self.check_page_for_string( form_desc )
self.check_page_for_string( form_layout_name )
for i, field_dict in enumerate( field_dicts ):
self.check_page_for_string( field_dict[ 'name' ] )
@@ -1495,8 +1495,7 @@ class TwillTestCase( unittest.TestCase )
'''View request_type details'''
self.home()
self.visit_url( "%s/requests_admin/view_request_type?id=%s" % ( self.url, request_type_id ) )
- self.check_page_for_string( 'Sequencer configuration information' )
- self.check_page_for_string( request_type_name )
+ self.check_page_for_string( '"%s" sequencer configuration' % request_type_name )
for name, desc in sample_states:
self.check_page_for_string( name )
self.check_page_for_string( desc )
@@ -1624,23 +1623,21 @@ class TwillTestCase( unittest.TestCase )
tc.submit( "reject_button" )
for check_str in strings_displayed_after_submit:
self.check_page_for_string( check_str )
- def change_sample_state( self, request_id, request_name, sample_names, sample_ids, new_sample_state_id, new_state_name, comment='',
- strings_displayed=[], strings_displayed_after_submit=[] ):
- # We have to simulate the form submission here since twill barfs on the page
- # gvk - 9/22/10 - TODO: make sure the mako template produces valid html
- url = "%s/requests_common/edit_samples?cntrller=requests_admin&id=%s" % ( self.url, request_id )
- url += "&comment=%s&sample_state_id=%s" % ( comment, self.security.encode_id( new_sample_state_id ) )
- # select_sample_%i=true must be included twice for each sample to simulate a CheckboxField checked setting.
+ def change_sample_state( self, request_id, sample_ids, new_sample_state_id, comment='', strings_displayed=[], strings_displayed_after_submit=[] ):
+ url = "%s/requests_common/edit_samples?cntrller=requests_admin&id=%s&editing_samples=True" % ( self.url, request_id )
+ self.visit_url( url )
+ for check_str in strings_displayed:
+ self.check_page_for_string( check_str )
for sample_id in sample_ids:
- url += "&select_sample_%i=true&select_sample_%i=true" % ( sample_id, sample_id )
- url += "&sample_operation=Change%20state&refresh=true"
- url += "&save_changes_button=Save&editing_samples=True"
- self.visit_url( url )
- self.check_page_for_string( 'Edit Current Samples of Request "%s"' % request_name )
- for sample_id, sample_name in zip( sample_ids, sample_names ):
- self.visit_url( "%s/requests_common/sample_events?cntrller=requests_admin&sample_id=%s" % ( self.url, self.security.encode_id( sample_id ) ) )
- self.check_page_for_string( 'Events for Sample "%s"' % sample_name )
- self.check_page_for_string( new_state_name )
+ tc.fv( "1", "select_sample_%i" % sample_id, True )
+ tc.fv( "1", "sample_operation", 'Change state' )
+ self.refresh_form( "sample_operation", 'Change state' )
+ self.check_page_for_string( "Change current state" )
+ tc.fv( "1", "sample_state_id", new_sample_state_id )
+ tc.fv( "1", "sample_event_comment", comment )
+ tc.submit( "save_samples_button" )
+ for check_str in strings_displayed_after_submit:
+ self.check_page_for_string( check_str )
def add_user_address( self, user_id, address_dict ):
self.home()
self.visit_url( "%s/user/new_address?admin_view=False&user_id=%i" % ( self.url, user_id ) )
--- a/templates/requests/common/edit_samples.mako
+++ b/templates/requests/common/edit_samples.mako
@@ -137,7 +137,8 @@
<p/><div class="form-row">
## hidden element to make twill work.
- <input type="hidden" name="hidden_input" value=""/>
+ ## Greg will fix this
+ <input type="hidden" name="twill" value=""/>
%if ( request.samples or displayable_sample_widgets ) and ( editing_samples or len( displayable_sample_widgets ) > len( request.samples ) ):
<input type="submit" name="add_sample_button" value="Add sample" /><input type="submit" name="save_samples_button" value="Save"/>
@@ -156,7 +157,8 @@
<p/><div class="form-row">
## hidden element to make twill work.
- <input type="hidden" name="hidden_input" value=""/>
+ ## Greg will fix this
+ <input type="hidden" name="twill" value=""/><input type="submit" name="save_samples_button" value="Save"/><input type="submit" name="cancel_changes_button" value="Cancel"/><div class="toolParamHelp" style="clear: both;">
--- a/lib/galaxy/web/controllers/forms.py
+++ b/lib/galaxy/web/controllers/forms.py
@@ -420,7 +420,7 @@ class Forms( BaseController ):
'visible': True,
'required': required,
'type': field_type,
- 'selectlist': selectlist,
+ 'selectlist': options,
'layout': layout,
'default': default }
return { 'label': name,
1
0

galaxy-dist commit bde1ca8b6134: First pass at cleaning up the Galaxy Form Definition UI ( forms controller still needs a re-write ).
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1289839599 18000
# Node ID bde1ca8b6134079a9323d76bcaf057b3cc4166c1
# Parent 095dc06e0728556426a9288e6448fd1114e24063
First pass at cleaning up the Galaxy Form Definition UI ( forms controller still needs a re-write ).
--- a/lib/galaxy/webapps/community/controllers/__init__.py
+++ b/lib/galaxy/webapps/community/controllers/__init__.py
@@ -1,1 +1,1 @@
-"""Galaxy community space controllers."""
+"""Galaxy tool shed controllers."""
--- a/templates/admin/forms/edit_form.mako
+++ /dev/null
@@ -1,137 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<script type="text/javascript">
-$(document).ready(function(){
- //hide the all of the element with class msg_body
- $(".msg_body").hide();
- //toggle the componenet with class msg_body
- $(".msg_head").click(function(){
- $(this).next(".msg_body").slideToggle(450);
- });
-});
-</script>
-<style type="text/css">
-.msg_head {
- padding: 0px 0px;
- cursor: pointer;
-}
-
-}
-</style>
-
-<%def name="render_selectbox_options( index, field_attr )">
- %if field_attr[0] == 'Type':
- %if field_attr[1].get_selected( return_label=True ) == 'SelectField':
- <% options = field_attr[2] %>
- <div class="repeat-group-item">
- <div class="form-row">
- <label> Options</label>
- %for i, option in enumerate(options):
- <div class="form-row">
- <b> ${i+1}</b>
- ${option[1].get_html()}
- <input type="submit" name="removeoption_${index}_${i}" value="Remove"/>
- </div>
- %endfor
- </div>
- </div>
- <div class="form-row">
- <input type="submit" name="addoption_${index}" value="Add"/>
- </div>
- %endif
- %endif
-</%def>
-
-<%def name="render_field( index, field, saved )">
- %if saved:
- <h4 class="msg_head">
- <div class="form-row">${index+1}. ${field[0][1].value} (${field[2][1].get_selected( return_value=True )})</div>
- </h4>
- <div class="msg_body">
- %else:
- <div class="msg_body2">
- %endif
- <div class="repeat-group-item">
- %for field_attr in field:
- <div class="form-row">
- <label>${field_attr[0]}</label>
- ${field_attr[1].get_html()}
- ${render_selectbox_options( index, field_attr )}
- </div>
- %endfor
- <div class="form-row">
- <input type="submit" name="remove_button" value="Remove field ${index+1}"/>
- </div>
- </div>
- </div>
-</%def>
-
-<%def name="render_layout( index, widget )">
- <div class="repeat-group-item">
- <div class="form-row">
- <b> ${index+1}</b>
- ${widget.get_html()}
- <input type="submit" name="remove_layout_grid_button" value="Remove grid ${index+1}"/>
- </div>
- </div>
-</%def>
-
-<div class="toolForm">
- <div class="toolFormTitle">Edit form definition "${form.name}"</div>
- <form id="edit_form" name="edit_form" action="${h.url_for( controller='forms', action='edit', id=trans.security.encode_id(form.current.id) )}" method="post" >
- %if response_redirect:
- <input type="hidden" name="response_redirect" value="${response_redirect}" size="40" />
- %endif
- %for label, input in form_details:
- <div class="form-row">
- ## TODO: RC, this will keep the form type select list label
- ## from being displayed here. At this point, the select list is a hidden field.
- ## Make sure this is the best solution to this problem.
- %if label != 'Type':
- <label>${label}</label>
- %endif
- <div style="float: left; width: 250px; margin-right: 10px;">
- ${input.get_html()}
- </div>
- <div style="clear: both"></div>
- </div>
- %endfor
- %if current_form_type == trans.app.model.FormDefinition.types.SAMPLE:
- <div class="toolFormTitle">Form Layout</div>
- <div class="form-row">
- <label>Layout grid names</label>
- </div>
- %for index, lg in enumerate(layout_grids):
- ${render_layout( index, lg )}
- %endfor
- <div class="form-row">
- <input type="submit" name="add_layout_grid" value="Add layout grid"/>
- </div>
- %endif
- <div class="toolFormTitle">Fields (${len(form.fields)})</div>
- %for ctr, field in enumerate(field_details):
- %if ctr < len(form.fields):
- ${render_field( ctr, field, True )}
- %else:
- ${render_field( ctr, field, False )}
- %endif
- %endfor
- <div class="form-row">
- <input type="submit" name="add_field_button" value="Add field"/>
- </div>
- <div class="form-row">
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="hidden" name="refresh" value="true" size="40"/>
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <input type="submit" name="save_changes_button" value="Save"/>
- </div>
- </form>
-</div>
--- a/lib/galaxy/security/__init__.py
+++ b/lib/galaxy/security/__init__.py
@@ -19,14 +19,14 @@ class Action( object ):
class RBACAgent:
"""Class that handles galaxy security"""
permitted_actions = Bunch(
- DATASET_MANAGE_PERMISSIONS = Action( "manage permissions", "Role members can manage the roles associated with permissions on this dataset", "grant" ),
- DATASET_ACCESS = Action( "access", "Role members can import this dataset into their history for analysis", "restrict" ),
- LIBRARY_ACCESS = Action( "access library", "Restrict access to this library to only role members", "restrict" ),
- LIBRARY_ADD = Action( "add library item", "Role members can add library items to this library item", "grant" ),
- LIBRARY_MODIFY = Action( "modify library item", "Role members can modify this library item", "grant" ),
- LIBRARY_MANAGE = Action( "manage library permissions", "Role members can manage roles associated with permissions on this library item", "grant" ),
+ DATASET_MANAGE_PERMISSIONS = Action( "manage permissions", "Users having associated role can manage the roles associated with permissions on this dataset", "grant" ),
+ DATASET_ACCESS = Action( "access", "Users having associated role can import this dataset into their history for analysis", "restrict" ),
+ LIBRARY_ACCESS = Action( "access library", "Restrict access to this library to only users having assocaited role", "restrict" ),
+ LIBRARY_ADD = Action( "add library item", "Users having associated role can add library items to this library item", "grant" ),
+ LIBRARY_MODIFY = Action( "modify library item", "Users having associated role can modify this library item", "grant" ),
+ LIBRARY_MANAGE = Action( "manage library permissions", "Users having associated role can manage roles associated with permissions on this library item", "grant" ),
# Request type permissions
- REQUEST_TYPE_ACCESS = Action( "access request_type", "Restrict access to this request_type to only role members", "restrict" )
+ REQUEST_TYPE_ACCESS = Action( "access request_type", "Restrict access to only users having associated role", "restrict" )
)
def get_action( self, name, default=None ):
@@ -912,9 +912,6 @@ class GalaxyRBACAgent( RBACAgent ):
else:
hidden_folder_ids = '%d' % sub_folder.id
return False, hidden_folder_ids
- #
- # RequestType Permissions
- #
def can_access_request_type( self, roles, request_type ):
action = self.permitted_actions.REQUEST_TYPE_ACCESS
request_type_actions = []
--- a/universe_wsgi.ini.sample
+++ b/universe_wsgi.ini.sample
@@ -312,6 +312,9 @@ use_interactive = True
# -- Beta features
+# Enable Galaxy to communicate directly with a sequencer
+#enable_sequencer_communication = False
+
# Enable Galaxy's built-in visualization module, Trackster.
#enable_tracks = False
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -1494,6 +1494,9 @@ class MetadataFile( object ):
return os.path.abspath( os.path.join( path, "metadata_%d.dat" % self.id ) )
class FormDefinition( object ):
+ # The following form_builder classes are supported by the FormDefinition class.
+ # AddressField, CheckboxField, SelectField, TextArea, TextField, WorkflowField
+ supported_field_types = [ AddressField, CheckboxField, SelectField, TextArea, TextField, WorkflowField ]
types = Bunch( REQUEST = 'Sequencing Request Form',
SAMPLE = 'Sequencing Sample Form',
LIBRARY_INFO_TEMPLATE = 'Library information template',
@@ -1587,6 +1590,19 @@ class FormDefinition( object ):
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):
--- a/templates/webapps/galaxy/admin/index.mako
+++ b/templates/webapps/galaxy/admin/index.mako
@@ -101,11 +101,11 @@
</div><div class="toolSectionPad"></div><div class="toolSectionTitle">
- <span>Forms</span>
+ <span>Form Definitions</span></div><div class="toolSectionBody"><div class="toolSectionBg">
- <div class="toolTitle"><a href="${h.url_for( controller='forms', action='manage' )}" target="galaxy_main">Manage forms</a></div>
+ <div class="toolTitle"><a href="${h.url_for( controller='forms', action='manage' )}" target="galaxy_main">Manage form definitions</a></div></div></div><div class="toolSectionPad"></div>
@@ -114,7 +114,7 @@
</div><div class="toolSectionBody"><div class="toolSectionBg">
- <div class="toolTitle"><a href="${h.url_for( controller='requests_admin', action='browse_request_types' )}" target="galaxy_main">Sequencer configurations</a></div>
+ <div class="toolTitle"><a href="${h.url_for( controller='requests_admin', action='browse_request_types' )}" target="galaxy_main">Manage sequencers</a></div><div class="toolTitle"><a href="${h.url_for( controller='requests_admin', action='browse_requests' )}" target="galaxy_main">Sequencing requests</a></div><div class="toolTitle"><a href="${h.url_for( controller='requests_common', action='find_samples', cntrller='requests_admin' )}" target="galaxy_main">Find samples</a></div></div>
--- a/templates/admin/requests/view_request_type.mako
+++ b/templates/admin/requests/view_request_type.mako
@@ -1,78 +1,102 @@
<%inherit file="/base.mako"/><%namespace file="/message.mako" import="render_msg" />
+<%
+ states_list = request_type.states
+ can_edit_permissions = not request_type.deleted
+ can_delete = not request_type.deleted
+ can_undelete = request_type.deleted
+%>
+
+<br/><br/>
+<ul class="manage-table-actions">
+ %if can_edit_permissions:
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='request_type_permissions', id=trans.security.encode_id( request_type.id ) )}">Edit permissions</a></li>
+ %endif
+ %if can_delete:
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='delete_request_type', id=trans.security.encode_id( request_type.id ) )}">Delete</a></li>
+ %endif
+ %if can_undelete:
+ <li><a class="action-button" href="${h.url_for( controller='requests_common', action='undelete_request_type', id=trans.security.encode_id( request_type.id ) )}">Undelete</a></li>
+ %endif
+</ul>
+
%if message:
${render_msg( message, status )}
%endif
-<% states_list = request_type.states %>
-
-<h2>Sequencer Configuration "${request_type.name}"</h2>
-
<div class="toolForm">
- <div class="toolFormTitle">Sequencer configuration information</div>
+ <div class="toolFormTitle">"${request_type.name}" sequencer configuration</div>
+ <div class="form-row">
+ <label>Name</label>
+ ${request_type.name}
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <label>Description</label>
+ ${request_type.desc}
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <label>Request form definition</label>
+ ${request_type.request_form.name}
+ </div>
+ <div class="form-row">
+ <label>Sample form definition</label>
+ ${request_type.sample_form.name}
+ </div>
+</div>
+<p/>
+<div class="toolForm">
+ <div class="toolFormTitle">Sample states defined for this sequencer configuration</div>
+ %for state in states_list:
+ <div class="form-row">
+ <label>${state.name}</label>
+ ${state.desc}
+ </div>
+ <div style="clear: both"></div>
+ %endfor
+</div>
+<p/>
+<div class="toolForm">
+ <div class="toolFormTitle">Sequencer login information</div><form name="view_request_type" action="${h.url_for( controller='requests_admin', action='create_request_type', rt_id=trans.security.encode_id( request_type.id ))}" method="post" ><div class="form-row">
- <label>Name</label>
- ${request_type.name}
- <div style="clear: both"></div>
+ This information is needed only if you will transfer datasets from the sequencer to a target Galaxy data library
</div>
- <div class="form-row">
- <label>Description</label>
- ${request_type.desc}
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <label>
- Request Form definition
- </label>
- ${request_type.request_form.name}
- </div>
- <div class="form-row">
- <label>
- Sample Form definition
- </label>
- ${request_type.sample_form.name}
- </div>
- <div class="toolFormTitle">Possible sample states</div>
- %for element_count, state in enumerate(states_list):
- <div class="form-row">
- <label>${1+element_count}. ${state.name}</label>
- ${state.desc}
- </div>
- <div style="clear: both"></div>
- %endfor
- <div class="toolFormTitle">Sequencer information</div>
- <div class="form-row">
- This information is only needed for transferring data from sequencer to Galaxy
- </div>
+ <div style="clear: both"></div><div class="form-row"><label>Hostname or IP Address:</label><input type="text" name="host" value="${request_type.datatx_info['host']}" size="40"/></div>
+ <div style="clear: both"></div><div class="form-row"><label>Username:</label><input type="text" name="username" value="${request_type.datatx_info['username']}" size="40"/></div>
+ <div style="clear: both"></div><div class="form-row"><label>Password:</label><input type="password" name="password" value="${request_type.datatx_info['password']}" size="40"/></div>
+ <div style="clear: both"></div><div class="form-row"><label>Data directory:</label><input type="text" name="data_dir" value="${request_type.datatx_info.get('data_dir', '')}" size="40"/></div>
+ <div style="clear: both"></div><div class="form-row">
- <label>Add experiment name and the sample name to the dataset name?</label>
+ <label>Prepend the experiment name and sample name to the dataset name?</label>
${rename_dataset_select_field.get_html()}
<div class="toolParamHelp" style="clear: both;">
- The datasets are renamed by prepending the experiment name and the sample name to the dataset name. <br/>This
- makes sure that dataset names remain unique in Galaxy even when they have the
- same name in the sequencer.
+ Galaxy datasets are renamed by prepending the experiment name and sample name to the dataset name, ensuring<br/>
+ dataset names remain unique in Galaxy even when multiple datasets have the same name on the sequencer.
</div></div>
+ <div style="clear: both"></div><div class="form-row">
- <input type="submit" name="save_changes" value="Save changes"/>
+ <input type="submit" name="save_changes" value="Save changes"/></div>
+ <div style="clear: both"></div></form></div>
--- a/templates/library/common/ldda_permissions.mako
+++ b/templates/library/common/ldda_permissions.mako
@@ -12,9 +12,7 @@
<br/><br/><ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=library_id, use_panels=use_panels, show_deleted=show_deleted )}"><span>Browse this data library</span></a>
- </li>
+ <li><a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller=cntrller, id=library_id, use_panels=use_panels, show_deleted=show_deleted )}"><span>Browse this data library</span></a></li></ul>
%if message:
--- a/lib/galaxy/web/controllers/forms.py
+++ b/lib/galaxy/web/controllers/forms.py
@@ -105,7 +105,7 @@ class Forms( BaseController ):
action='manage',
message='Invalid form',
status='error' ) )
- return trans.fill_template( '/admin/forms/show_form_read_only.mako',
+ return trans.fill_template( '/admin/forms/view_form_definition.mako',
form_definition=fdc.latest_form )
def __form_types_widget(self, trans, selected='none'):
form_type_selectbox = SelectField( 'form_type_selectbox' )
@@ -223,8 +223,13 @@ class Forms( BaseController ):
# unsaved form, with the error message
if not fd_new:
current_form = self.__get_form( trans, **kwd )
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status='error', response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status='error',
+ response_redirect=response_redirect,
+ **kwd )
# everything went fine. form saved successfully. Show the saved form or redirect
# to response_redirect if appropriate.
if response_redirect:
@@ -232,8 +237,13 @@ class Forms( BaseController ):
fd = fd_new
current_form = self.__get_saved_form( fd )
message = "The form '%s' has been updated with the changes." % fd.name
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
#
# Add a layout grid
#
@@ -241,8 +251,13 @@ class Forms( BaseController ):
current_form = self.__get_form( trans, **kwd )
current_form['layout'].append('')
# show the form again
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
#
# Delete a layout grid
#
@@ -250,8 +265,13 @@ class Forms( BaseController ):
current_form = self.__get_form( trans, **kwd )
index = int( kwd[ 'remove_layout_grid_button' ].split( ' ' )[2] ) - 1
del current_form['layout'][index]
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
#
# Add a field
#
@@ -259,8 +279,13 @@ class Forms( BaseController ):
current_form = self.__get_form( trans, **kwd )
current_form['fields'].append( self.empty_field )
# show the form again with one empty field
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
#
# Delete a field
#
@@ -269,8 +294,13 @@ class Forms( BaseController ):
# find the index of the field to be removed from the remove button label
index = int( kwd[ 'remove_button' ].split( ' ' )[2] ) - 1
del current_form['fields'][index]
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
#
# Add SelectField option
#
@@ -286,15 +316,25 @@ class Forms( BaseController ):
#
elif params.get( 'refresh', False ):
current_form = self.__get_form( trans, **kwd )
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
#
# Show the form for editing
#
else:
current_form = self.__get_saved_form( fd )
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
def __add_selectbox_option( self, trans, fd, message, status, response_redirect=None, **kwd ):
'''
@@ -311,13 +351,22 @@ class Forms( BaseController ):
break
if index == -1:
# something wrong happened
- return self.__show( trans=trans, form=fd, current_form=current_form,
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
message='Error in adding selectfield option',
- status='error', response_redirect=response_redirect, **kwd )
+ status='error',
+ response_redirect=response_redirect,
+ **kwd )
# add an empty option
current_form[ 'fields' ][ index ][ 'selectlist' ].append( '' )
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
def __remove_selectbox_option( self, trans, fd, message, status, response_redirect=None, **kwd ):
'''
This method removes a selectbox option. The kwd dict searched for
@@ -334,13 +383,22 @@ class Forms( BaseController ):
break
if option == -1:
# something wrong happened
- return self.__show( trans=trans, form=fd, current_form=current_form,
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
message='Error in removing selectfield option',
- status='error', response_redirect=response_redirect, **kwd )
+ status='error',
+ response_redirect=response_redirect,
+ **kwd )
# remove the option
del current_form[ 'fields' ][ index ][ 'selectlist' ][ option ]
- return self.__show( trans=trans, form=fd, current_form=current_form,
- message=message, status=status, response_redirect=response_redirect, **kwd )
+ return self.__show( trans=trans,
+ form_definition=fd,
+ current_form=current_form,
+ message=message,
+ status=status,
+ response_redirect=response_redirect,
+ **kwd )
def __get_field(self, index, **kwd):
@@ -356,22 +414,22 @@ class Forms( BaseController ):
layout = params.get( 'field_layout_%i' % index, '' )
default = params.get( 'field_default_%i' % index, '' )
if field_type == 'SelectField':
- selectlist = self.__get_selectbox_options(index, **kwd)
- return {'label': name,
- 'helptext': helptext,
- 'visible': True,
- 'required': required,
- 'type': field_type,
- 'selectlist': selectlist,
- 'layout': layout,
- 'default': default }
- return {'label': name,
- 'helptext': helptext,
- 'visible': True,
- 'required': required,
- 'type': field_type,
- 'layout': layout,
- 'default': default}
+ options = self.__get_selectbox_options(index, **kwd)
+ return { 'label': name,
+ 'helptext': helptext,
+ 'visible': True,
+ 'required': required,
+ 'type': field_type,
+ 'selectlist': selectlist,
+ 'layout': layout,
+ 'default': default }
+ return { 'label': name,
+ 'helptext': helptext,
+ 'visible': True,
+ 'required': required,
+ 'type': field_type,
+ 'layout': layout,
+ 'default': default }
def __get_selectbox_options(self, index, **kwd):
'''
This method gets all the options entered by the user for field when
@@ -452,23 +510,23 @@ class Forms( BaseController ):
continue
options = row[5].split(',')
if len(row) >= 8:
- fields.append({'label': row[0],
- 'helptext': row[1],
- 'visible': row[2],
- 'required': row[3],
- 'type': row[4],
- 'selectlist': options,
- 'layout':row[6],
- 'default': row[7]})
+ fields.append( { 'label': row[0],
+ 'helptext': row[1],
+ 'visible': row[2],
+ 'required': row[3],
+ 'type': row[4],
+ 'selectlist': options,
+ 'layout':row[6],
+ 'default': row[7] } )
layouts.add(row[6])
else:
- fields.append({'label': row[0],
- 'helptext': row[1],
- 'visible': row[2],
- 'required': row[3],
- 'type': row[4],
- 'selectlist': options,
- 'default': row[6]})
+ fields.append( { 'label': row[0],
+ 'helptext': row[1],
+ 'visible': row[2],
+ 'required': row[3],
+ 'type': row[4],
+ 'selectlist': options,
+ 'default': row[6] } )
except:
return trans.response.send_redirect( web.url_for( controller='forms',
action='create_form',
@@ -570,8 +628,8 @@ class Forms( BaseController ):
refresh_on_change_values=['SelectField'])
if field_type:
field['type'] = unicode(field_type)
- if field_type == 'SelectField' and not field['selectlist']:
- field['selectlist'] = ['', '']
+ if field_type == 'SelectField' and not field[ 'selectlist' ]:
+ field[ 'selectlist' ] = ['', '']
# if the form is for defining samples, then use the sample field types
# which does not include TextArea & AddressField
if form_type == trans.app.model.FormDefinition.types.SAMPLE:
@@ -605,8 +663,8 @@ class Forms( BaseController ):
self.layout_selectbox.add_option("%i. %s" %(i+1, grid_name), i)
def selectbox_ui(self, field):
self.selectbox_options = []
- if field['selectlist']:
- for ctr, option in enumerate(field['selectlist']):
+ if field[ 'selectlist' ]:
+ for ctr, option in enumerate(field[ 'selectlist' ]):
self.selectbox_options.append(('Option '+str(ctr+1),
TextField('field_'+str(self.index)+'_option_'+str(ctr),
40, option)))
@@ -628,17 +686,14 @@ class Forms( BaseController ):
def label(self):
return str(self.index)+'.'+self.label
- def __show( self, trans, form, current_form, message='', status='done', response_redirect=None, **kwd ):
- '''
- This method displays the form and any of the changes made to it,
- The empty_form param allows for this method to simulate clicking
- the "add_field_button" on the edit_form.mako page so that the page
- is displayed with the first field to be added, saving a mouse click.
- '''
+ def __show( self, trans, form_definition, current_form, message='', status='done', response_redirect=None, **kwd ):
+ """
+ Displays the form and any of the changes made to it, The empty_form param allows for this method to
+ simulate clicking the "add_field_button" on the edit_form_definition.mako page so that the page is
+ displayed with the first field to be added, saving a mouse click.
+ """
params = util.Params( kwd )
# name & description
- # TODO: RC, I've changed Type to be a hidden field since it should not be displayed on the edit_form.mako
- # template. Make sure this is the optimal solution for this problem. See my additional TODO in edit_form.mako.
form_details = [ ( 'Name', TextField( 'name', 40, current_form[ 'name' ] ) ),
( 'Description', TextField( 'description', 40, current_form[ 'desc' ] ) ),
( 'Type', HiddenField( 'form_type_selectbox', current_form['type']) ) ]
@@ -654,10 +709,10 @@ class Forms( BaseController ):
else:
field_ui = self.FieldUI( trans, None, index, field, form_type=current_form['type'] )
field_details.append( field_ui.get() )
- return trans.fill_template( '/admin/forms/edit_form.mako',
+ return trans.fill_template( '/admin/forms/edit_form_definition.mako',
form_details=form_details,
field_details=field_details,
- form=form,
+ form_definition=form_definition,
field_types=BaseField.form_field_types(),
message=message,
status=status,
--- a/templates/admin/requests/create_request_type.mako
+++ b/templates/admin/requests/create_request_type.mako
@@ -69,12 +69,11 @@
<input type="text" name="data_dir" value="" size="40"/></div><div class="form-row">
- <label>Add experiment name and the sample name to the dataset name?</label>
+ <label>Prepend the experiment name and sample name to the dataset name?</label>
${rename_dataset_select_field.get_html()}
<div class="toolParamHelp" style="clear: both;">
- The datasets are renamed by prepending the experiment name and the sample name to the dataset name. <br/>This
- makes sure that dataset names remain unique in Galaxy even when they have the
- same name in the sequencer.
+ Galaxy datasets are renamed by prepending the experiment name and sample name to the dataset name, ensuring<br/>
+ dataset names remain unique in Galaxy even when multiple datasets have the same name on the sequencer.
</div></div><div class="form-row">
--- a/test/functional/test_library_security.py
+++ b/test/functional/test_library_security.py
@@ -393,8 +393,8 @@ class TestLibrarySecurity( TwillTestCase
# admin_user is associated with role1, so should have all permissions on imported datasets
check_edit_page( latest_3_lddas,
strings_displayed=[ 'Manage dataset permissions on',
- 'Role members can manage the roles associated with permissions on this dataset',
- 'Role members can import this dataset into their history for analysis' ] )
+ 'can manage the roles associated with permissions on this dataset',
+ 'can import this dataset into their history for analysis' ] )
self.logout()
# regular_user1 is associated with role1, so should have all permissions on imported datasets
self.login( email=regular_user1.email )
@@ -423,8 +423,8 @@ class TestLibrarySecurity( TwillTestCase
check_edit_page( latest_3_lddas,
strings_displayed=[ 'View Permissions' ],
strings_not_displayed=[ 'Manage dataset permissions on',
- 'Role members can manage roles associated with permissions on this library item',
- 'Role members can import this dataset into their history for analysis' ] )
+ 'can manage roles associated with permissions on this library item',
+ 'can import this dataset into their history for analysis' ] )
def test_060_restrict_access_to_library2( self ):
"""Testing restricting access to library2"""
# Logged in as admin_user
--- a/templates/admin/forms/show_form_read_only.mako
+++ /dev/null
@@ -1,115 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<%def name="render_grid( grid_index, grid_name, fields_dict )">
- %if grid_name:
- <div class="form-row">
- <h4>${grid_name}</h4>
- </div>
- %endif
- <div style="clear: both"></div>
- <table class="grid">
- <thead>
- <tr>
- %for index, field in fields_dict.items():
- <th>
- ${field['label']}
- <div class="toolParamHelp" style="clear: both;">
- <i>${field['helptext']}</i>
- </div>
- </th>
- %endfor
- <th></th>
- </tr>
- <thead>
- <tbody>
- <tr>
- %for index, field in fields_dict.items():
- <td>
- <div>${field['required']}</div>
-## <div>${field['type']}</div>
- </td>
- %endfor
- <th></th>
- </tr>
- %for index, field in fields_dict.items():
- <td>
-## <div>${field['required']}</div>
- <div><i>Type:</i></div>
- <div>${field['type']}</div>
- </td>
- %endfor
- <th></th>
- </tr>
- <tr>
- %for index, field in fields_dict.items():
- <td>
- %if field['type'] == 'SelectField':
- <div><i>Options:</i></div>
- %for option in field['selectlist']:
- <div>${option}</div>
- %endfor
- %endif
- </td>
- %endfor
- <th></th>
- </tr>
- <tbody>
- </table>
-</%def>
-
-<div class="toolForm">
- %if form_definition.desc:
- <div class="toolFormTitle">${form_definition.name} - <i> ${form_definition.desc}</i> (${form_definition.type})
- <a id="form_definition-${form_definition.id}-popup" class="popup-arrow" style="display: none;">▼</a>
- <div popupmenu="form_definition-${form_definition.id}-popup">
- <a class="action-button" href="${h.url_for( controller='forms', action='manage', operation='Edit', id=trans.security.encode_id(form_definition.current.id) )}">Edit</a>
- </div>
- </div>
- %else:
- <div class="toolFormTitle">${form_definition.name} (${form_definition.type})
- <a id="form_definition-${form_definition.id}-popup" class="popup-arrow" style="display: none;">▼</a>
- <div popupmenu="form_definition-${form_definition.id}-popup">
- <a class="action-button" href="${h.url_for( controller='forms', action='manage', operation='Edit', id=trans.security.encode_id(form_definition.current.id) )}">Edit</a>
- </div>
- </div>
- %endif
- <form name="library" action="${h.url_for( controller='forms', action='manage' )}" method="post" >
- %if form_definition.type == trans.app.model.FormDefinition.types.SAMPLE:
- %if not len(form_definition.layout):
- ${render_grid( 0, '', form_definition.grid_fields( None ) )}
- %else:
- %for grid_index, grid_name in enumerate(form_definition.layout):
- ${render_grid( grid_index, grid_name, form_definition.grid_fields( grid_index ) )}
- %endfor
- %endif
- %else:
- %for index, field in enumerate(form_definition.fields):
- <div class="form-row">
- <label>${field['label']}</label>
- %if field['helptext']:
- <div class="toolParamHelp" style="clear: both;">
- <i>${field['helptext']}</i>
- </div>
- %endif
- <div>${field['required']}</div>
- <i>Type: </i> ${field['type']}
- %if field['type'] == 'SelectField':
- <div>
- <div><i>Options:</i></div>
- %for option in field['selectlist']:
- <div>${option}</div>
- %endfor
- </div>
- %endif
- </div>
- <div style="clear: both"></div>
- %endfor
- %endif
- </form>
- </div>
-</div>
--- a/lib/galaxy/web/controllers/requests_admin.py
+++ b/lib/galaxy/web/controllers/requests_admin.py
@@ -57,7 +57,7 @@ class RequestTypeGrid( grids.Grid ):
columns = [
NameColumn( "Name",
key="name",
- link=( lambda item: iff( item.deleted, None, dict( operation="view", id=item.id ) ) ),
+ link=( lambda item: iff( item.deleted, None, dict( operation="view_request_type", id=item.id ) ) ),
attach_popup=True,
filterable="advanced" ),
DescriptionColumn( "Description",
@@ -78,12 +78,12 @@ class RequestTypeGrid( grids.Grid ):
visible=False,
filterable="standard" ) )
operations = [
- grids.GridOperation( "Permissions", allow_multiple=False, condition=( lambda item: not item.deleted ) ),
+ grids.GridOperation( "Edit permissions", allow_multiple=False, condition=( lambda item: not item.deleted ) ),
grids.GridOperation( "Delete", allow_multiple=True, condition=( lambda item: not item.deleted ) ),
grids.GridOperation( "Undelete", condition=( lambda item: item.deleted ) ),
]
global_actions = [
- grids.GridAction( "Create new sequencer configuration", dict( controller='requests_admin', action='create_request_type' ) )
+ grids.GridAction( "Create new configuration", dict( controller='requests_admin', action='create_request_type' ) )
]
class DataTransferGrid( grids.Grid ):
@@ -638,23 +638,21 @@ class RequestsAdmin( BaseController, Use
err_msg += "Set your API Key in your User Preferences to transfer datasets."
# check if library_import_dir is set
if not trans.app.config.library_import_dir:
- err_msg = "'The library_import_dir' setting is not set in the Galaxy config file."
+ err_msg = "'The library_import_dir' setting is not correctly set in the Galaxy config file."
# check the RabbitMQ server settings in the config file
for k, v in trans.app.config.amqp.items():
if not v:
- err_msg += 'Set RabbitMQ server settings in the "galaxy_amqp" section of the Galaxy config file. %s is not set.' % k
+ err_msg += 'Set RabbitMQ server settings in the "galaxy_amqp" section of the Galaxy config file, specifically "%s" is not set.' % k
break
return err_msg
@web.expose
@web.require_admin
def initiate_data_transfer( self, trans, sample_id, sample_datasets=[], sample_dataset_id='' ):
'''
- This method initiates the transfer of the datasets from the sequencer. It
- happens in the following steps:
- - The current admin user needs to have LIBRARY_ADD permission for the
- target library and folder
- - Create an XML message encapsulating all the data transfer info and send it
- to the message queue (RabbitMQ broker)
+ Initiate the transfer of the datasets from the sequencer to the target Galaxy data library:
+ - The admin user must have LIBRARY_ADD permission for the target library and folder
+ - Create an XML message encapsulating all the data transfer information and send it
+ to the message queue (RabbitMQ broker).
'''
try:
sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id( sample_id ) )
@@ -735,13 +733,13 @@ class RequestsAdmin( BaseController, Use
obj_id = kwd.get( 'id', None )
if operation == "view_form_definition":
return self.view_form_definition( trans, **kwd )
- elif operation == "view":
+ elif operation == "view_request_type":
return self.view_request_type( trans, **kwd )
elif operation == "delete":
return self.delete_request_type( trans, **kwd )
elif operation == "undelete":
return self.undelete_request_type( trans, **kwd )
- elif operation == "permissions":
+ elif operation == "edit permissions":
return self.request_type_permissions( trans, **kwd )
# Render the grid view
return self.requesttype_grid( trans, **kwd )
@@ -888,11 +886,9 @@ class RequestsAdmin( BaseController, Use
request_type = trans.sa_session.query( trans.model.RequestType ).get( trans.security.decode_id( request_type_id ) )
except:
return invalid_id_redirect( trans, 'requests_admin', request_type_id, action='browse_request_types' )
- forms = self.get_all_forms( trans )
rename_dataset_select_field = self.__build_rename_dataset_select_field( trans, request_type )
return trans.fill_template( '/admin/requests/view_request_type.mako',
request_type=request_type,
- forms=forms,
rename_dataset_select_field=rename_dataset_select_field )
@web.expose
@web.require_admin
@@ -902,7 +898,7 @@ class RequestsAdmin( BaseController, Use
form_definition = trans.sa_session.query( trans.model.FormDefinition ).get( trans.security.decode_id( form_definition_id ) )
except:
return invalid_id_redirect( trans, 'requests_admin', form_definition_id, action='browse_request_types' )
- return trans.fill_template( '/admin/forms/show_form_read_only.mako',
+ return trans.fill_template( '/admin/forms/view_form_definition.mako',
form_definition=form_definition )
@web.expose
@web.require_admin
--- a/test/base/twilltestcase.py
+++ b/test/base/twilltestcase.py
@@ -1494,7 +1494,7 @@ class TwillTestCase( unittest.TestCase )
def view_request_type( self, request_type_id, request_type_name, sample_states, strings_displayed=[] ):
'''View request_type details'''
self.home()
- self.visit_url( "%s/requests_admin/browse_request_types?operation=view&id=%s" % ( self.url, request_type_id ) )
+ self.visit_url( "%s/requests_admin/view_request_type?id=%s" % ( self.url, request_type_id ) )
self.check_page_for_string( 'Sequencer configuration information' )
self.check_page_for_string( request_type_name )
for name, desc in sample_states:
--- /dev/null
+++ b/templates/admin/forms/edit_form_definition.mako
@@ -0,0 +1,140 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+
+<script type="text/javascript">
+$(document).ready(function(){
+ //hide the all of the element with class msg_body
+ $(".msg_body").hide();
+ //toggle the componenet with class msg_body
+ $(".msg_head").click(function(){
+ $(this).next(".msg_body").slideToggle(450);
+ });
+});
+</script>
+<style type="text/css">
+.msg_head {
+ padding: 0px 0px;
+ cursor: pointer;
+}
+
+}
+</style>
+
+<%def name="render_selectbox_options( index, field_attr )">
+ %if field_attr[0] == 'Type':
+ %if field_attr[1].get_selected( return_label=True ) == 'SelectField':
+ <% options = field_attr[2] %>
+ <div class="repeat-group-item">
+ <div class="form-row">
+ <label> Options</label>
+ %for i, option in enumerate(options):
+ <div class="form-row">
+ <b> ${i+1}</b>
+ ${option[1].get_html()}
+ <input type="submit" name="removeoption_${index}_${i}" value="Remove"/>
+ </div>
+ %endfor
+ </div>
+ </div>
+ <div class="form-row">
+ <input type="submit" name="addoption_${index}" value="Add"/>
+ </div>
+ %endif
+ %endif
+</%def>
+
+<%def name="render_field( index, field, saved )">
+ %if saved:
+ <h4 class="msg_head">
+ <div class="form-row">${index+1}. ${field[0][1].value} (${field[2][1].get_selected( return_value=True )})</div>
+ </h4>
+ <div class="msg_body">
+ %else:
+ <div class="msg_body2">
+ %endif
+ <div class="repeat-group-item">
+ %for field_attr in field:
+ <div class="form-row">
+ <label>${field_attr[0]}</label>
+ ${field_attr[1].get_html()}
+ ${render_selectbox_options( index, field_attr )}
+ </div>
+ %endfor
+ <div class="form-row">
+ <input type="submit" name="remove_button" value="Remove field ${index+1}"/>
+ </div>
+ </div>
+ </div>
+</%def>
+
+<%def name="render_layout( index, widget )">
+ <div class="repeat-group-item">
+ <div class="form-row">
+ <b> ${index+1}</b>
+ ${widget.get_html()}
+ <input type="submit" name="remove_layout_grid_button" value="Remove grid ${index+1}"/>
+ </div>
+ </div>
+</%def>
+
+<br/><br/>
+<ul class="manage-table-actions">
+ <li><a class="action-button" href="${h.url_for( controller='forms', action='manage', operation='View', id=trans.security.encode_id( form_definition.current.id ) )}">View</a></li>
+</ul>
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<div class="toolForm">
+ <div class="toolFormTitle">Edit form definition "${form_definition.name}"</div>
+ <form id="edit_form_definition" name="edit_form_definition" action="${h.url_for( controller='forms', action='edit', id=trans.security.encode_id( form_definition.current.id ) )}" method="post" >
+ %if response_redirect:
+ <input type="hidden" name="response_redirect" value="${response_redirect}" size="40" />
+ %endif
+ %for label, input in form_details:
+ <div class="form-row">
+ %if label != 'Type':
+ <label>${label}</label>
+ %endif
+ <div style="float: left; width: 250px; margin-right: 10px;">
+ ${input.get_html()}
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ %endfor
+ %if current_form_type == trans.app.model.FormDefinition.types.SAMPLE:
+ <div class="toolFormTitle">Form Layout</div>
+ <div class="form-row">
+ <label>Layout grid names</label>
+ </div>
+ %for index, lg in enumerate( layout_grids ):
+ ${render_layout( index, lg )}
+ %endfor
+ <div class="form-row">
+ <input type="submit" name="add_layout_grid" value="Add layout grid"/>
+ </div>
+ %endif
+ <div class="toolFormTitle">Form fields</div>
+ %for ctr, field in enumerate(field_details):
+ %if ctr < len( form_definition.fields ):
+ ${render_field( ctr, field, True )}
+ %else:
+ ${render_field( ctr, field, False )}
+ %endif
+ %endfor
+ <div class="form-row">
+ <input type="submit" name="add_field_button" value="Add field"/>
+ </div>
+ <div class="form-row">
+ ## TODO: Eliminate the need for this hidden refresh param
+ <div style="float: left; width: 250px; margin-right: 10px;">
+ <input type="hidden" name="refresh" value="true" size="40"/>
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ <div class="form-row">
+ <input type="submit" name="save_changes_button" value="Save"/>
+ </div>
+ </form>
+</div>
--- a/templates/webapps/galaxy/admin/center.mako
+++ b/templates/webapps/galaxy/admin/center.mako
@@ -51,9 +51,9 @@
be granted to 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 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>
+ <li><strong>add library item</strong> - Users that have the role can add library items to this data library or folder</li>
+ <li><strong>modify library item</strong> - Users that have the role can modify this library item</li>
+ <li><strong>manage library permissions</strong> - Users that have the role can manage permissions applied to this library item</li></ul><p/>
The default behavior is for no permissions to be applied to a data library item, but applied permissions are inherited downward (with the exception
--- a/templates/admin/requests/request_type_permissions.mako
+++ b/templates/admin/requests/request_type_permissions.mako
@@ -1,11 +1,6 @@
<%inherit file="/base.mako"/><%namespace file="/message.mako" import="render_msg" />
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
<script type="text/javascript">
$( document ).ready( function () {
$( '.role_add_button' ).click( function() {
@@ -28,19 +23,23 @@
});
</script>
+<br/><br/>
+<ul class="manage-table-actions">
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='view_request_type', id=trans.security.encode_id( request_type.id ) )}"><span>Browse this configuration</span></a></li>
+</ul>
+
+%if message:
+ ${render_msg( message, status )}
+%endif
<div class="toolForm">
- <div class="toolFormTitle">Manage permissions on "${request_type.name}"</div>
+ <div class="toolFormTitle">Manage access permissions on sequencer interface "${request_type.name}"</div><div class="toolFormBody"><form name="request_type_permissions" id="request_type_permissions" action="${h.url_for( controller='requests_admin', action='request_type_permissions', id=trans.security.encode_id( request_type.id ) )}" method="post"><div class="form-row"><%
- obj_name = request_type.name
current_actions = request_type.actions
- permitted_actions = trans.app.model.RequestType.permitted_actions.items()
- action = trans.app.model.RequestType.permitted_actions.REQUEST_TYPE_ACCESS
- obj_str = 'request_type %s' % obj_name
- obj_type = 'request_type'
+ action = trans.app.security_agent.permitted_actions.REQUEST_TYPE_ACCESS
all_roles = roles
action_key = 'REQUEST_TYPE_ACCESS'
@@ -51,9 +50,7 @@
in_roles.add( a.role )
out_roles = filter( lambda x: x not in in_roles, all_roles )
%>
- <p>
- <b>access sequencer configuration:</b> Restrict access to this sequencer configuration to only role members
- </p>
+ ${action.description}<br/><br/><div style="width: 100%; white-space: nowrap;"><div style="float: left; width: 50%;">
Roles associated:<br/>
@@ -74,7 +71,6 @@
<input type="submit" id="${action_key}_add_button" class="role_add_button" value="<<"/></div></div>
-## </%def></div><div class="form-row"><input type="submit" name="update_roles_button" value="Save"/>
--- a/lib/galaxy/config.py
+++ b/lib/galaxy/config.py
@@ -42,6 +42,8 @@ class Configuration( object ):
self.cookie_path = kwargs.get( "cookie_path", "/" )
# web API
self.enable_api = string_as_bool( kwargs.get( 'enable_api', False ) )
+ # Communication with a sequencer
+ self.enable_sequencer_communication = string_as_bool( kwargs.get( 'enable_sequencer_communication', False ) )
# dataset Track files
self.track_store_path = kwargs.get( "track_store_path", "${extra_files_path}/tracks")
self.tool_path = resolve_path( kwargs.get( "tool_path", "tools" ), self.root )
--- /dev/null
+++ b/templates/admin/forms/view_form_definition.mako
@@ -0,0 +1,85 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<%def name="render_grid( grid_index, grid_name, fields_dict )">
+ %if grid_name:
+ <div class="form-row">
+ <label>${grid_name}</label>
+ </div>
+ %endif
+ <div style="clear: both"></div>
+ <table class="grid">
+ <thead>
+ <tr>
+ %for index, field in fields_dict.items():
+ <th>${field[ 'label' ]}</th>
+ %endfor
+ </tr>
+ <thead>
+ <tbody>
+ <tr>
+ %for index, field in fields_dict.items():
+ <td>
+ ${field[ 'type' ]}: ${form_definition.field_as_html( field )}<br/>
+ <div class="toolParamHelp" style="clear: both;">
+ <i>${field[ 'helptext' ]}</i> - (${field[ 'required' ]})
+ </div>
+ %if field[ 'type' ] == 'SelectField':
+ <div class="toolParamHelp" style="clear: both;">
+ <label>Options:</label>
+ %for option in field[ 'selectlist' ]:
+ ${option}
+ %endfor
+ </div>
+ %endif
+ </td>
+ %endfor
+ </tr>
+ <tbody>
+ </table>
+</%def>
+
+<br/><br/>
+<ul class="manage-table-actions">
+ <li><a class="action-button" href="${h.url_for( controller='forms', action='manage', operation='Edit', id=trans.security.encode_id( form_definition.current.id ) )}">Edit</a></li>
+</ul>
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<div class="toolForm">
+ <div class="toolFormTitle">Form definition "${form_definition.name}"</div>
+ %if form_definition.type == trans.app.model.FormDefinition.types.SAMPLE:
+ %if form_definition.layout:
+ %for grid_index, grid_name in enumerate( form_definition.layout ):
+ ${render_grid( grid_index, grid_name, form_definition.grid_fields( grid_index ) )}
+ %endfor
+ %else:
+ ${render_grid( 0, '', form_definition.grid_fields( None ) )}
+ %endif
+ %else:
+ %for index, field in enumerate( form_definition.fields ):
+ <div class="form-row">
+ <label>${field[ 'label' ]}</label>
+ ${field[ 'type' ]}: ${form_definition.field_as_html( field )}
+ <div class="toolParamHelp" style="clear: both;">
+ <i>${field[ 'helptext' ]}</i> - (${field[ 'required' ]})
+ </div>
+ %if field[ 'type' ] == 'SelectField':
+ <div class="toolParamHelp" style="clear: both;">
+ <label>Options:</label>
+ %for option in field[ 'selectlist' ]:
+ ${option}
+ %endfor
+ </div>
+ %endif
+ </div>
+ <div style="clear: both"></div>
+ %endfor
+ %endif
+</div>
--- a/templates/requests/common/common.mako
+++ b/templates/requests/common/common.mako
@@ -430,7 +430,7 @@
<input type="text" name="sample_${index}_field_${field_index}" value="${sample_values[field_index]}" size="7"/>
%elif field_type == 'SelectField':
<select name="sample_${index}_field_${field_index}" last_selected_value="2">
- %for option_index, option in enumerate(field['selectlist']):
+ %for option_index, option in enumerate(field[ 'selectlist' ]):
%if option == sample_values[field_index]:
<option value="${option}" selected>${option}</option>
%else:
1
0

galaxy-dist commit 796201bc8dbc: Enabled the cleanup method which was disabled by mistake in the previous commit.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1289841891 18000
# Node ID 796201bc8dbc531ddaec5d75fadb88e858adfbc4
# Parent efc0b15af4026aa039945c799354e8cac5975528
Enabled the cleanup method which was disabled by mistake in the previous commit.
--- a/test/functional/test_sample_tracking.py
+++ b/test/functional/test_sample_tracking.py
@@ -664,7 +664,7 @@ class TestFormsAndRequests( TwillTestCas
# # Make sure the request's state is now set to REJECTED
# assert request2.state is not request2.states.REJECTED, "The state of the request '%s' should be set to '%s'" \
# % ( request2.name, request2.states.REJECTED )
- def __test_055_reset_data_for_later_test_runs( self ):
+ def test_055_reset_data_for_later_test_runs( self ):
"""Reseting data to enable later test runs to pass"""
# Logged in as admin_user
self.logout()
1
0

galaxy-dist commit 095dc06e0728: Python 2.4 Compatibility Fix. ( with open():)
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Dannon Baker <dannonbaker(a)me.com>
# Date 1289832899 18000
# Node ID 095dc06e0728556426a9288e6448fd1114e24063
# Parent 47d6c393f4cf9562e4e3e10211389f84bf0a2f24
Python 2.4 Compatibility Fix. ( with open():)
--- a/lib/galaxy/jobs/splitters/basic.py
+++ b/lib/galaxy/jobs/splitters/basic.py
@@ -3,17 +3,19 @@ log = logging.getLogger( __name__ )
def _file_len(fname):
i = 0
- with open(fname) as f:
- for i, l in enumerate(f):
- pass
+ f = open(fname)
+ for i, l in enumerate(f):
+ pass
+ f.close()
return i + 1
def _fq_seq_count(fname):
count = 0
- with open(fname) as f:
- for i, l in enumerate(f):
- if l.startswith('@'):
- count += 1
+ f = open(fname)
+ for i, l in enumerate(f):
+ if l.startswith('@'):
+ count += 1
+ f.close()
return count
def split_fq(input_file, working_directory, parts):
@@ -25,25 +27,27 @@ def split_fq(input_file, working_directo
if length < parts:
parts = length
len_each, remainder = divmod(length, parts)
- with open(input_file, 'rt') as f:
- for p in range(0, parts):
- part_dir = os.path.join( os.path.abspath(working_directory), 'task_%s' % p)
- if not os.path.exists( part_dir ):
- os.mkdir( part_dir )
- part_path = os.path.join(part_dir, os.path.basename(input_file))
- with open(part_path, 'w') as part_file:
- for l in range(0, len_each):
- part_file.write(f.readline())
- part_file.write(f.readline())
- part_file.write(f.readline())
- part_file.write(f.readline())
- if remainder > 0:
- part_file.write(f.readline())
- part_file.write(f.readline())
- part_file.write(f.readline())
- part_file.write(f.readline())
- remainder -= 1
- outputs.append(part_path)
+ f = open(input_file, 'rt')
+ for p in range(0, parts):
+ part_dir = os.path.join( os.path.abspath(working_directory), 'task_%s' % p)
+ if not os.path.exists( part_dir ):
+ os.mkdir( part_dir )
+ part_path = os.path.join(part_dir, os.path.basename(input_file))
+ part_file = open(part_path, 'w')
+ for l in range(0, len_each):
+ part_file.write(f.readline())
+ part_file.write(f.readline())
+ part_file.write(f.readline())
+ part_file.write(f.readline())
+ if remainder > 0:
+ part_file.write(f.readline())
+ part_file.write(f.readline())
+ part_file.write(f.readline())
+ part_file.write(f.readline())
+ remainder -= 1
+ outputs.append(part_path)
+ part_file.close()
+ f.close()
return outputs
def split_txt(input_file, working_directory, parts):
@@ -52,19 +56,21 @@ def split_txt(input_file, working_direct
if length < parts:
parts = length
len_each, remainder = divmod(length, parts)
- with open(input_file, 'rt') as f:
- for p in range(0, parts):
- part_dir = os.path.join( os.path.abspath(working_directory), 'task_%s' % p)
- if not os.path.exists( part_dir ):
- os.mkdir( part_dir )
- part_path = os.path.join(part_dir, os.path.basename(input_file))
- with open(part_path, 'w') as part_file:
- for l in range(0, len_each):
- part_file.write(f.readline())
- if remainder > 0:
- part_file.write(f.readline())
- remainder -= 1
- outputs.append(part_path)
+ f = open(input_file, 'rt')
+ for p in range(0, parts):
+ part_dir = os.path.join( os.path.abspath(working_directory), 'task_%s' % p)
+ if not os.path.exists( part_dir ):
+ os.mkdir( part_dir )
+ part_path = os.path.join(part_dir, os.path.basename(input_file))
+ part_file = open(part_path, 'w')
+ for l in range(0, len_each):
+ part_file.write(f.readline())
+ if remainder > 0:
+ part_file.write(f.readline())
+ remainder -= 1
+ outputs.append(part_path)
+ part_file.close()
+ f.close()
return outputs
def split( input_file, working_directory, parts, file_type = None):
1
0