galaxy-dev
Threads by month
- ----- 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
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
July 2009
- 14 participants
- 68 discussions
Dear Sir,
I am installing Galaxy using setup.sh script on my 64 bit RED HAT
Enterprises Linux system but it gives an error .
I have Python 2.4.It works well on my other 32 bit RHEL system in the same
network.Could you please tell me whether current version of Galaxy is
compatible with 64 bit linux system or not?
Thanx in advance,
--
Regards,
Pankaj Narang
2
1
Hello,
We've encountered a small issue when using the extract-genomic-sequences
tool with a TwoBit file and lot's of sequences: memory and CPU usage
increases unnecessarily (and processing time, too).
Background:
a TwoBit (2bit) file is a binary representation of a FASTA file.
Unlike nbit files, TwoBit files contain multiple sequences per file.
For example,
The Drosophila Virilis 'genome' contains 13530 scaffolds.
Converting the droVir3 FASTA file into a 2bit file creates a 52MB file.
Details:
When trying to extract sequences (using extract_genomic_dna.py),
Each time a new chromosome/scaffold is encountered, the *entire* 2bit
file is loaded and stored.
This is unnecessary - the same 2bit file is used for all the scaffolds.
(Imagine a BED file with 1000 different scaffolds - memory usage goes to
1000 * 52MB... ).
The offending code is (extract_genomic_dna.py) :
-------------------
elif twobit_path and os.path.exists( twobit_path ):
if chrom in twobits:
t = twobits[chrom]
else:
twobits[chrom] = t = bx.seq.twobit.TwoBitFile( file(
twobit_path ) )
try:
sequence = t[chrom][start:end]
-------------------
the hash 'twobits' contains multiple copies of the same 2bit file, over
and over again (one per chromosome/scaffold), but only one
chromosome/scaffold is read from it.
An improvement would be to load the file only once, and each time take
the chromosome/scaffold from the already-loaded hash.
Here's a possible patch:
========================
--- extract_genomic_dna.py 2009-07-17 12:55:53.000000000 -0400
+++ extract_genomic_dna2.py 2009-07-17 12:55:18.000000000 -0400
@@ -84,6 +84,7 @@ def __main__():
fout = open( output_filename, "w" )
warnings = []
warning = ''
+ twobitfile = None
for i, line in enumerate( open( input_filename ) ):
line = line.rstrip( '\r\n' )
@@ -132,12 +133,10 @@ def __main__():
invalid_line = line
continue
elif twobit_path and os.path.exists( twobit_path ):
- if chrom in twobits:
- t = twobits[chrom]
- else:
- twobits[chrom] = t = bx.seq.twobit.TwoBitFile(
file( twobit_path ) )
+ if not twobitfile:
+ twobitfile = bx.seq.twobit.TwoBitFile( file(
twobit_path ) )
try:
- sequence = t[chrom][start:end]
+ sequence = twobitfile[chrom][start:end]
except:
warning = "Unable to fetch the sequence from '%d'
to '%d' for build '%s'. " %( start, end-start, dbkey )
warnings.append( warning )
========================
Technical note:
This code and patch refers to an older revision (before changeset
2457:8dfe971fcc27), but I think the new code still behaves this way.
Kudos to Ted Karginov who had to learn python to find and fix this bug.
-Gordon.
2
1
details: http://www.bx.psu.edu/hg/galaxy/rev/46bd94b12a0c
changeset: 2487:46bd94b12a0c
user: James Taylor <james(a)jamestaylor.org>
date: Thu Jul 16 15:35:58 2009 -0400
description:
Bugfix for history refresh in IE
1 file(s) affected in this change:
templates/root/history.mako
diffs (18 lines):
diff -r 079bf1a8422b -r 46bd94b12a0c templates/root/history.mako
--- a/templates/root/history.mako Thu Jul 16 09:45:43 2009 -0400
+++ b/templates/root/history.mako Thu Jul 16 15:35:58 2009 -0400
@@ -73,9 +73,12 @@
});
// Updater
updater({
- %for data in reversed( datasets ):
+ %for i, data in enumerate( reversed( datasets ) ):
%if data.visible and data.state not in [ "deleted", "empty", "error", "ok" ]:
- "${data.id}": "${data.state}";
+ %if i > 0:
+ ,
+ %endif
+ "${data.id}": "${data.state}"
%endif
%endfor
});
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/dacc94994979
changeset: 2484:dacc94994979
user: James Taylor <james(a)jamestaylor.org>
date: Wed Jul 15 12:18:43 2009 -0400
description:
Fix for deleted datasets in history pane
1 file(s) affected in this change:
lib/galaxy/web/controllers/root.py
diffs (12 lines):
diff -r 5707f033e31a -r dacc94994979 lib/galaxy/web/controllers/root.py
--- a/lib/galaxy/web/controllers/root.py Wed Jul 15 12:00:02 2009 -0400
+++ b/lib/galaxy/web/controllers/root.py Wed Jul 15 12:18:43 2009 -0400
@@ -68,7 +68,7 @@
.join( "dataset" ).filter( model.Dataset.purged == False ) \
.options( eagerload_all( "dataset.actions" ) )
if not show_deleted:
- query.filter_by( deleted=False )
+ query = query.filter( model.HistoryDatasetAssociation.deleted == False )
return trans.stream_template_mako( "root/history.mako",
history = history,
datasets = query.all(),
1
0
16 Jul '09
details: http://www.bx.psu.edu/hg/galaxy/rev/5707f033e31a
changeset: 2483:5707f033e31a
user: Nate Coraor <nate(a)bx.psu.edu>
date: Wed Jul 15 12:00:02 2009 -0400
description:
Updates to egg configs for Python 2.6 support. 2.6 is not yet supported, this commit is preliminary work for such support.
2 file(s) affected in this change:
dist-eggs.ini
eggs.ini
diffs (80 lines):
diff -r b0fb9200afe0 -r 5707f033e31a dist-eggs.ini
--- a/dist-eggs.ini Tue Jul 14 16:55:18 2009 -0400
+++ b/dist-eggs.ini Wed Jul 15 12:00:02 2009 -0400
@@ -11,36 +11,49 @@
py2.4-linux-i686-ucs4 = scofield.bx.psu.edu /depot/projects/pythons/linux-i686-ucs4/bin/python2.4
py2.5-linux-i686-ucs2 = scofield.bx.psu.edu /depot/projects/pythons/linux-i686-ucs2/bin/python2.5
py2.5-linux-i686-ucs4 = scofield.bx.psu.edu /depot/projects/pythons/linux-i686-ucs4/bin/python2.5
+py2.6-linux-i686-ucs2 = scofield.bx.psu.edu /depot/projects/pythons/linux-i686-ucs2/bin/python2.6
+py2.6-linux-i686-ucs4 = scofield.bx.psu.edu /depot/projects/pythons/linux-i686-ucs4/bin/python2.6
py2.4-linux-x86_64-ucs2 = herbie.bx.psu.edu /depot/projects/pythons/linux-x86_64-ucs2/bin/python2.4
py2.4-linux-x86_64-ucs4 = herbie.bx.psu.edu /depot/projects/pythons/linux-x86_64-ucs4/bin/python2.4
py2.5-linux-x86_64-ucs2 = herbie.bx.psu.edu /depot/projects/pythons/linux-x86_64-ucs2/bin/python2.5
py2.5-linux-x86_64-ucs4 = herbie.bx.psu.edu /depot/projects/pythons/linux-x86_64-ucs4/bin/python2.5
+py2.6-linux-x86_64-ucs2 = herbie.bx.psu.edu /depot/projects/pythons/linux-x86_64-ucs2/bin/python2.6
+py2.6-linux-x86_64-ucs4 = herbie.bx.psu.edu /depot/projects/pythons/linux-x86_64-ucs4/bin/python2.6
py2.4-macosx-10.3-fat-ucs2 = medeski.bx.psu.edu /usr/local/bin/python2.4
py2.5-macosx-10.3-fat-ucs2 = medeski.bx.psu.edu /usr/local/bin/python2.5
+py2.6-macosx-10.3-fat-ucs2 = medeski.bx.psu.edu /usr/local/bin/python2.6
py2.5-macosx-10.5-i386-ucs2 = lion.bx.psu.edu /usr/bin/python2.5
py2.4-solaris-2.11-i86pc-ucs2 = victory.bx.psu.edu /depot/projects/pythons/solaris-2.11-i86pc-ucs2/bin/python2.4
py2.5-solaris-2.11-i86pc-ucs2 = victory.bx.psu.edu /depot/projects/pythons/solaris-2.11-i86pc-ucs2/bin/python2.5
+py2.6-solaris-2.11-i86pc-ucs2 = victory.bx.psu.edu /depot/projects/pythons/solaris-2.11-i86pc-ucs2/bin/python2.6
py2.4-solaris-2.10-sun4u-ucs2 = v880.bx.psu.edu /depot/projects/pythons/solaris-2.10-sun4u-ucs2/bin/python2.4
py2.5-solaris-2.10-sun4u-ucs2 = v880.bx.psu.edu /depot/projects/pythons/solaris-2.10-sun4u-ucs2/bin/python2.5
+py2.6-solaris-2.10-sun4u-ucs2 = v880.bx.psu.edu /depot/projects/pythons/solaris-2.10-sun4u-ucs2/bin/python2.6
[groups]
py2.4-linux-i686 = py2.4-linux-i686-ucs2 py2.4-linux-i686-ucs4
py2.4-linux-x86_64 = py2.4-linux-x86_64-ucs2 py2.4-linux-x86_64-ucs4
py2.5-linux-i686 = py2.5-linux-i686-ucs2 py2.5-linux-i686-ucs4
py2.5-linux-x86_64 = py2.5-linux-x86_64-ucs2 py2.5-linux-x86_64-ucs4
+py2.6-linux-i686 = py2.6-linux-i686-ucs2 py2.6-linux-i686-ucs4
+py2.6-linux-x86_64 = py2.6-linux-x86_64-ucs2 py2.6-linux-x86_64-ucs4
py2.4-linux = py2.4-linux-i686 py2.4-linux-x86_64
py2.5-linux = py2.5-linux-i686 py2.5-linux-x86_64
-linux-i686 = py2.4-linux-i686 py2.5-linux-i686
-linux-x86_64 = py2.4-linux-x86_64 py2.5-linux-x86_64
+py2.6-linux = py2.6-linux-i686 py2.6-linux-x86_64
+linux-i686 = py2.4-linux-i686 py2.5-linux-i686 py2.6-linux-i686
+linux-x86_64 = py2.4-linux-x86_64 py2.5-linux-x86_64 py2.6-linux-x86_64
linux = linux-i686 linux-x86_64
py2.4-macosx = py2.4-macosx-10.3-fat-ucs2
py2.5-macosx = py2.5-macosx-10.3-fat-ucs2 py2.5-macosx-10.5-i386-ucs2
-macosx = py2.4-macosx py2.5-macosx
+py2.6-macosx = py2.6-macosx-10.3-fat-ucs2
+macosx = py2.4-macosx py2.5-macosx py2.6-macosx
py2.4-solaris = py2.4-solaris-2.11-i86pc-ucs2 py2.4-solaris-2.10-sun4u-ucs2
py2.5-solaris = py2.5-solaris-2.11-i86pc-ucs2 py2.5-solaris-2.10-sun4u-ucs2
-solaris = py2.4-solaris py2.5-solaris
+py2.6-solaris = py2.6-solaris-2.11-i86pc-ucs2 py2.6-solaris-2.10-sun4u-ucs2
+solaris = py2.4-solaris py2.5-solaris py2.6-solaris
py2.4-all = py2.4-linux py2.4-macosx py2.4-solaris
py2.5-all = py2.5-linux py2.5-macosx py2.5-solaris
-all = py2.4-all py2.5-all
+py2.6-all = py2.6-linux py2.6-macosx py2.6-solaris
+all = py2.4-all py2.5-all py2.6-all
; default hosts for platform-inspecific eggs
-noplatform = py2.4-linux-i686-ucs4 py2.5-linux-i686-ucs4
+noplatform = py2.4-linux-i686-ucs4 py2.5-linux-i686-ucs4 py2.6-linux-i686-ucs4
diff -r b0fb9200afe0 -r 5707f033e31a eggs.ini
--- a/eggs.ini Tue Jul 14 16:55:18 2009 -0400
+++ b/eggs.ini Wed Jul 15 12:00:02 2009 -0400
@@ -68,7 +68,7 @@
bx_python = http://bitbucket.org/james_taylor/bx-python/get/4bf1f32e6b76.bz2
Cheetah = http://voxel.dl.sourceforge.net/sourceforge/cheetahtemplate/Cheetah-1.0.tar…
DRMAA_python = http://gridengine.sunsource.net/files/documents/7/36/DRMAA-python-0.2.tar.gz
-MySQL_python = http://superb-west.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python… http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/mysql-5.0.67.tar.gz
+MySQL_python = http://superb-west.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python… http://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.67.tar.gz
pbs_python = http://ftp.sara.nl/pub/outgoing/pbs_python-2.9.4.tar.gz
psycopg2 = http://initd.org/pub/software/psycopg/PSYCOPG-2-0/psycopg2-2.0.6.tar.gz ftp://ftp-archives.postgresql.org/pub/source/v8.2.6/postgresql-8.2.6.tar.bz2
pycrypto = http://www.amk.ca/files/python/crypto/pycrypto-2.0.1.tar.gz
@@ -79,7 +79,7 @@
Beaker = http://cheeseshop.python.org/packages/source/B/Beaker/Beaker-0.5.tar.gz
docutils = http://downloads.sourceforge.net/docutils/docutils-0.4.tar.gz
elementtree = http://effbot.org/downloads/elementtree-1.2.6-20050316.tar.gz
-flup = http://www.saddi.com/software/flup/dist/flup-r2311.tar.gz
+flup = http://www.saddi.com/software/flup/dist/archive/flup-r2311.tar.gz
lrucache = http://evan.prodromou.name/lrucache/lrucache-0.2.tar.gz
Mako = http://www.makotemplates.org/downloads/Mako-0.1.10.tar.gz
MyghtyUtils = http://cheeseshop.python.org/packages/source/M/MyghtyUtils/MyghtyUtils-0.52…
1
0
16 Jul '09
details: http://www.bx.psu.edu/hg/galaxy/rev/dd5f1fe8f5e9
changeset: 2485:dd5f1fe8f5e9
user: Dan Blankenberg <dan(a)bx.psu.edu>
date: Wed Jul 15 14:11:35 2009 -0400
description:
Initial pass at allowing the setting of certain metadata parameters on upload (controlled via a flag). This allows the user to specify the 'base_name' to be used for Rgenetics datatypes, etc. Bunch of cleanup needed in upload.
9 file(s) affected in this change:
lib/galaxy/datatypes/data.py
lib/galaxy/datatypes/genetics.py
lib/galaxy/datatypes/metadata.py
lib/galaxy/datatypes/registry.py
lib/galaxy/tools/__init__.py
lib/galaxy/tools/actions/upload.py
lib/galaxy/tools/parameters/grouping.py
templates/tool_form.mako
tools/data_source/upload.xml
diffs (418 lines):
diff -r dacc94994979 -r dd5f1fe8f5e9 lib/galaxy/datatypes/data.py
--- a/lib/galaxy/datatypes/data.py Wed Jul 15 12:18:43 2009 -0400
+++ b/lib/galaxy/datatypes/data.py Wed Jul 15 14:11:35 2009 -0400
@@ -49,6 +49,8 @@
"""If False, the peek is regenerated whenever a dataset of this type is copied"""
copy_safe_peek = True
+
+ is_binary = True #The dataset contains binary data --> do not space_to_tab or convert newlines, etc. Allow binary file uploads of this type when True.
#Composite datatypes
composite_type = None
@@ -250,7 +252,8 @@
def after_edit( self, dataset ):
"""This function is called on the dataset after metadata is edited."""
dataset.clear_associated_files( metadata_safe = True )
- def __new_composite_file( self, optional = False, mimetype = None, description = None, substitute_name_with_metadata = None, **kwds ):
+ def __new_composite_file( self, name, optional = False, mimetype = None, description = None, substitute_name_with_metadata = None, **kwds ):
+ kwds[ 'name' ] = name
kwds[ 'optional' ] = optional
kwds[ 'mimetype' ] = mimetype
kwds[ 'description' ] = description
@@ -258,7 +261,7 @@
return Bunch( **kwds )
def add_composite_file( self, name, **kwds ):
#self.composite_files = self.composite_files.copy()
- self.composite_files[ name ] = self.__new_composite_file( **kwds )
+ self.composite_files[ name ] = self.__new_composite_file( name, **kwds )
def __substitute_composite_key( self, key, composite_file, dataset = None ):
@@ -273,7 +276,7 @@
def writable_files( self, dataset = None ):
files = odict()
if self.composite_type != 'auto_primary_file':
- files[ self.primary_file_name ] = self.__new_composite_file()
+ files[ self.primary_file_name ] = self.__new_composite_file( self.primary_file_name )
for key, value in self.get_composite_files( dataset = dataset ).iteritems():
files[ key ] = value
return files
diff -r dacc94994979 -r dd5f1fe8f5e9 lib/galaxy/datatypes/genetics.py
--- a/lib/galaxy/datatypes/genetics.py Wed Jul 15 12:18:43 2009 -0400
+++ b/lib/galaxy/datatypes/genetics.py Wed Jul 15 14:11:35 2009 -0400
@@ -117,7 +117,7 @@
class Rgenetics(Html):
"""class to use for rgenetics"""
"""Add metadata elements"""
- MetadataElement( name="base_name", desc="base name for all transformed versions of this genetic dataset", default="galaxy", readonly=True)
+ MetadataElement( name="base_name", desc="base name for all transformed versions of this genetic dataset", default="galaxy", readonly=True, set_in_upload=True)
file_ext="html"
composite_type = 'auto_primary_file'
@@ -151,10 +151,7 @@
else:
dataset.peek = 'file does not exist'
dataset.blurb = 'file purged from disk'
- #def sniff( self, filename ):
- # """
- # """
- # return True
+
class Lped(Rgenetics):
"""fake class to distinguish different species of Rgenetics data collections
@@ -245,7 +242,10 @@
MetadataElement( name="columns", default=0, desc="Number of columns", readonly=True, visible=False )
MetadataElement( name="column_names", default=[], desc="Column names", readonly=True,visible=True )
MetadataElement( name="base_name",
- desc="base name for all transformed versions of this genetic dataset", readonly=True)
+ desc="base name for all transformed versions of this genetic dataset", readonly=True, default='galaxy', set_in_upload=True)
+ ### Do we really need these below? can we rely on dataset.extra_files_path: os.path.join( dataset.extra_files_path, '%s.phenodata' % dataset.metadata.base_name ) ?
+ ### Do these have a different purpose? Ross will need to clarify
+ ### Uploading these datatypes will not work until this is sorted out (set_peek fails)...
MetadataElement( name="pheno_path",
desc="Path to phenotype data for this experiment", readonly=True)
MetadataElement( name="pheno",
@@ -253,11 +253,19 @@
file_ext = None
+ is_binary = True
+
+ composite_type = 'basic'
+
+ def __init__( self, **kwd ):
+ Html.__init__( self, **kwd )
+ self.add_composite_file( '%s.phenodata', substitute_name_with_metadata = 'base_name' )
+
def set_peek( self, dataset ):
"""expects a .pheno file in the extra_files_dir - ugh
note that R is wierd and does not include the row.name in
the header. why?"""
- p = file(dataset.metadata.pheno_path,'r').readlines()
+ p = file(dataset.metadata.pheno_path,'r').readlines() #this fails
head = p[0].strip().split('\t')
head.insert(0,'ChipFileName') # fix R write.table b0rken-ness
p[0] = '\t'.join(head)
@@ -295,6 +303,7 @@
if not dataset.peek:
dataset.set_peek()
pk = dataset.peek # use the peek which is the pheno data insead of dataset (!)
+ ###this is probably not the best source, can we just access the raw data directly?
if pk:
p = pk.split('\n')
h = p[0].strip().split('\t') # hope is header
@@ -339,10 +348,6 @@
"""Returns the mime type of the datatype"""
return 'application/gzip'
- def sniff(self):
- """ can we be bothered looking for the signature or loading via rpy?
- """
- return true
class AffyBatch( RexpBase ):
"""derived class for BioC data structures in Galaxy """
diff -r dacc94994979 -r dd5f1fe8f5e9 lib/galaxy/datatypes/metadata.py
--- a/lib/galaxy/datatypes/metadata.py Wed Jul 15 12:18:43 2009 -0400
+++ b/lib/galaxy/datatypes/metadata.py Wed Jul 15 14:11:35 2009 -0400
@@ -212,12 +212,13 @@
is a MetadataSpecCollection) of datatype.
"""
- def __init__( self, datatype, name=None, desc=None, param=MetadataParameter, default=None, no_value = None, visible=True, **kwargs ):
+ def __init__( self, datatype, name=None, desc=None, param=MetadataParameter, default=None, no_value = None, visible=True, set_in_upload = False, **kwargs ):
self.name = name
self.desc = desc or name
self.default = default
self.no_value = no_value
self.visible = visible
+ self.set_in_upload = set_in_upload
# Catch-all, allows for extra attributes to be set
self.__dict__.update(kwargs)
#set up param last, as it uses values set above
diff -r dacc94994979 -r dd5f1fe8f5e9 lib/galaxy/datatypes/registry.py
--- a/lib/galaxy/datatypes/registry.py Wed Jul 15 12:18:43 2009 -0400
+++ b/lib/galaxy/datatypes/registry.py Wed Jul 15 14:11:35 2009 -0400
@@ -308,3 +308,19 @@
def get_composite_extensions( self ):
return [ ext for ( ext, d_type ) in self.datatypes_by_extension.iteritems() if d_type.composite_type is not None ]
+ def get_upload_metadata_params( self, context, group, tool ):
+ """Returns dict of case value:inputs for metadata conditional for upload tool"""
+ rval = {}
+ for ext, d_type in self.datatypes_by_extension.iteritems():
+ inputs = []
+ for meta_name, meta_spec in d_type.metadata_spec.iteritems():
+ if meta_spec.set_in_upload:
+ help_txt = meta_spec.desc
+ if not help_txt or help_txt == meta_name:
+ help_txt = ""
+ inputs.append( '<param type="text" name="%s" label="Set metadata value for "%s"" value="%s" help="%s"/>' % ( meta_name, meta_name, meta_spec.default, help_txt ) )
+ rval[ ext ] = "\n".join( inputs )
+ if 'auto' not in rval and 'txt' in rval: #need to manually add 'auto' datatype
+ rval[ 'auto' ] = rval[ 'txt' ]
+ return rval
+
diff -r dacc94994979 -r dd5f1fe8f5e9 lib/galaxy/tools/__init__.py
--- a/lib/galaxy/tools/__init__.py Wed Jul 15 12:18:43 2009 -0400
+++ b/lib/galaxy/tools/__init__.py Wed Jul 15 14:11:35 2009 -0400
@@ -596,18 +596,40 @@
elif elem.tag == "conditional":
group = Conditional()
group.name = elem.get( "name" )
- # Should have one child "input" which determines the case
- input_elem = elem.find( "param" )
- assert input_elem is not None, "<conditional> must have a child <param>"
- group.test_param = self.parse_param_elem( input_elem, enctypes, context )
- # Must refresh when test_param changes
- group.test_param.refresh_on_change = True
- # And a set of possible cases
- for case_elem in elem.findall( "when" ):
- case = ConditionalWhen()
- case.value = case_elem.get( "value" )
- case.inputs = self.parse_input_elem( case_elem, enctypes, context )
- group.cases.append( case )
+
+ group.name = elem.get( "name" )
+
+ group.value_ref = elem.get( 'value_ref', None )
+ group.value_ref_in_group = util.string_as_bool( elem.get( 'value_ref_in_group', 'True' ) )
+ value_from = elem.get( "value_from" )
+ if value_from:
+ value_from = value_from.split( ':' )
+ group.value_from = locals().get( value_from[0] )
+ group.test_param = rval[ group.value_ref ]
+ group.test_param.refresh_on_change = True
+ for attr in value_from[1].split( '.' ):
+ group.value_from = getattr( group.value_from, attr )
+ for case_value, case_inputs in group.value_from( context, group, self ).iteritems():
+ case = ConditionalWhen()
+ case.value = case_value
+ if case_inputs:
+ case.inputs = self.parse_input_elem( ElementTree.XML( "<when>%s</when>" % case_inputs ), enctypes, context )
+ else:
+ case.inputs = {}
+ group.cases.append( case )
+ else:
+ # Should have one child "input" which determines the case
+ input_elem = elem.find( "param" )
+ assert input_elem is not None, "<conditional> must have a child <param>"
+ group.test_param = self.parse_param_elem( input_elem, enctypes, context )
+ # Must refresh when test_param changes
+ group.test_param.refresh_on_change = True
+ # And a set of possible cases
+ for case_elem in elem.findall( "when" ):
+ case = ConditionalWhen()
+ case.value = case_elem.get( "value" )
+ case.inputs = self.parse_input_elem( case_elem, enctypes, context )
+ group.cases.append( case )
rval[group.name] = group
elif elem.tag == "upload_dataset":
group = UploadDataset()
@@ -615,6 +637,7 @@
group.title = elem.get( "title" )
group.file_type_name = elem.get( 'file_type_name', group.file_type_name )
group.default_file_type = elem.get( 'default_file_type', group.default_file_type )
+ group.metadata_ref = elem.get( 'metadata_ref', group.metadata_ref )
rval[ group.file_type_name ].refresh_on_change = True
rval[ group.file_type_name ].refresh_on_change_values = self.app.datatypes_registry.get_composite_extensions()
group.inputs = self.parse_input_elem( elem, enctypes, context )
@@ -917,7 +940,10 @@
old_current_case = group_state['__current_case__']
group_prefix = "%s|" % ( key )
# Deal with the 'test' element and see if it's value changed
- test_param_key = group_prefix + input.test_param.name
+ if input.value_ref and not input.value_ref_in_group: #we are referencing an existant parameter, which is not part of this group
+ test_param_key = prefix + input.test_param.name
+ else:
+ test_param_key = group_prefix + input.test_param.name
test_param_error = None
test_incoming = get_incoming_value( incoming, test_param_key, None )
if test_param_key not in incoming \
diff -r dacc94994979 -r dd5f1fe8f5e9 lib/galaxy/tools/actions/upload.py
--- a/lib/galaxy/tools/actions/upload.py Wed Jul 15 12:18:43 2009 -0400
+++ b/lib/galaxy/tools/actions/upload.py Wed Jul 15 14:11:35 2009 -0400
@@ -46,21 +46,26 @@
uploaded_datasets = dataset_upload_input.get_uploaded_datasets( trans, incoming )
for uploaded_dataset in uploaded_datasets:
precreated_dataset = self.get_precreated_dataset( uploaded_dataset.precreated_name )
- dataset = self.add_file( trans, uploaded_dataset.primary_file, uploaded_dataset.name, uploaded_dataset.file_type, uploaded_dataset.is_multi_byte, uploaded_dataset.dbkey, space_to_tab = uploaded_dataset.space_to_tab, info = uploaded_dataset.info, precreated_dataset = precreated_dataset )
- if uploaded_dataset.composite_files:
+ dataset = self.add_file( trans, uploaded_dataset.primary_file, uploaded_dataset.name, uploaded_dataset.file_type, uploaded_dataset.is_multi_byte, uploaded_dataset.dbkey, space_to_tab = uploaded_dataset.space_to_tab, info = uploaded_dataset.info, precreated_dataset = precreated_dataset, metadata = uploaded_dataset.metadata )
+ composite_files = dataset.datatype.get_composite_files( dataset )
+ if composite_files:
os.mkdir( dataset.extra_files_path ) #make extra files path
- for name, value in uploaded_dataset.composite_files.iteritems():
+ for name, value in composite_files.iteritems():
#what about binary files here, need to skip converting newlines
- if value is None and not dataset.datatype.writable_files[ name ].optional:
+ if uploaded_dataset.composite_files[ value.name ] is None and not value.optional:
dataset.info = "A required composite data file was not provided (%s)" % name
dataset.state = dataset.states.ERROR
break
- elif value is not None:
- if value.space_to_tab:
- sniff.convert_newlines_sep2tabs( value.filename )
+ elif uploaded_dataset.composite_files[ value.name] is not None:
+ if uploaded_dataset.composite_files[ value.name ].space_to_tab:
+ sniff.convert_newlines_sep2tabs( uploaded_dataset.composite_files[ value.name ].filename )
else:
- sniff.convert_newlines( value.filename )
- shutil.move( value.filename, os.path.join( dataset.extra_files_path, name ) )
+ sniff.convert_newlines( uploaded_dataset.composite_files[ value.name ].filename )
+ shutil.move( uploaded_dataset.composite_files[ value.name ].filename, os.path.join( dataset.extra_files_path, name ) )
+ if dataset.datatype.composite_type == 'auto_primary_file':
+ #now that metadata is set, we should create the primary file as required
+ open( dataset.file_name, 'wb+' ).write( dataset.datatype.generate_primary_file( dataset = dataset ) )
+
data_list.append( dataset )
#clean up extra temp names
uploaded_dataset.clean_up_temp_files()
@@ -125,7 +130,7 @@
trans.log_event( 'job id %d ended with errors, err_msg: %s' % ( job.id, err_msg ), tool_id=job.tool_id )
return dict( output=data )
- def add_file( self, trans, temp_name, file_name, file_type, is_multi_byte, dbkey, info=None, space_to_tab=False, precreated_dataset=None ):
+ def add_file( self, trans, temp_name, file_name, file_type, is_multi_byte, dbkey, info=None, space_to_tab=False, precreated_dataset=None, metadata = {} ):
def dataset_no_data_error( data, message = 'there was an error uploading your file' ):
data.info = "No data: %s." % message
data.state = data.states.ERROR
@@ -217,6 +222,7 @@
if trans.app.datatypes_registry.get_datatype_by_extension( file_type ).composite_type != 'auto_primary_file' and self.check_html( temp_name ):
return dataset_no_data_error( data, message = "you attempted to upload an inappropriate file" )
#raise BadFileException( "you attempted to upload an inappropriate file." )
+ #if data_type != 'binary' and data_type != 'zip' and not trans.app.datatypes_registry.get_datatype_by_extension( ext ).is_binary:
if data_type != 'binary' and data_type != 'zip':
if space_to_tab:
self.line_count = sniff.convert_newlines_sep2tabs( temp_name )
@@ -235,9 +241,14 @@
data.info = info
data.flush()
shutil.move( temp_name, data.file_name )
- data.state = data.states.OK
+ ## FIXME
+ data.state = data.states.OK ##THIS SHOULD BE THE LAST THING DONE
+ #### its bad to set other things after this point, i.e. metadata and composite files...this creates a race condition where a dataset could be pushed into a job before its metadata, etc is set
data.set_size()
data.init_meta()
+ #need to set metadata, has to be done after extention is set
+ for meta_name, meta_value in metadata.iteritems():
+ setattr( data.metadata, meta_name, meta_value )
if self.line_count is not None:
try:
if is_multi_byte:
diff -r dacc94994979 -r dd5f1fe8f5e9 lib/galaxy/tools/parameters/grouping.py
--- a/lib/galaxy/tools/parameters/grouping.py Wed Jul 15 12:18:43 2009 -0400
+++ b/lib/galaxy/tools/parameters/grouping.py Wed Jul 15 14:11:35 2009 -0400
@@ -92,6 +92,7 @@
self.file_type_name = 'file_type'
self.default_file_type = 'txt'
self.file_type_to_ext = { 'auto':self.default_file_type }
+ self.metadata_ref = 'files_metadata'
def get_file_type( self, context ):
return context.get( self.file_type_name, self.default_file_type )
def get_datatype_ext( self, trans, context ):
@@ -297,6 +298,7 @@
self.composite_files = odict()
self.dbkey = None
self.warnings = []
+ self.metadata = {}
self._temp_filenames = [] #store all created filenames here, delete on cleanup
def register_temp_file( self, filename ):
@@ -333,6 +335,13 @@
dataset.datatype = d_type
dataset.dbkey = dbkey
+ #load metadata
+ files_metadata = context.get( self.metadata_ref, {} )
+ for meta_name, meta_spec in d_type.metadata_spec.iteritems():
+ if meta_spec.set_in_upload:
+ if meta_name in files_metadata:
+ dataset.metadata[ meta_name ] = files_metadata[ meta_name ]
+
temp_name = None
precreated_name = None
is_multi_byte = False
@@ -359,10 +368,10 @@
dataset.warnings.extend( warnings )
dataset.register_temp_file( temp_name )
- keys = writable_files.keys()
+ keys = [ value.name for value in writable_files.values() ]
for i, group_incoming in enumerate( groups_incoming[ writable_files_offset : ] ):
key = keys[ i + writable_files_offset ]
- if group_incoming is None and not writable_files[ key ].optional:
+ if group_incoming is None and not writable_files[ writable_files.keys()[ keys.index( key ) ] ].optional:
dataset.warnings.append( "A required composite file (%s) was not specified." % ( key ) )
dataset.composite_files[ key ] = None
else:
@@ -372,7 +381,7 @@
dataset.register_temp_file( temp_name )
else:
dataset.composite_files[ key ] = None
- if not writable_files[ key ].optional:
+ if not writable_files[ writable_files.keys()[ keys.index( key ) ] ].optional:
dataset.warnings.append( "A required composite file (%s) was not specified." % ( key ) )
return [ dataset ]
else:
@@ -404,6 +413,8 @@
Group.__init__( self )
self.test_param = None
self.cases = []
+ self.value_ref = None
+ self.value_ref_in_group = True #When our test_param is not part of the conditional Group, this is False
def get_current_case( self, value, trans ):
# Convert value to user representation
str_value = self.test_param.filter_value( value, trans )
@@ -460,4 +471,4 @@
class ConditionalWhen( object ):
def __init__( self ):
self.value = None
- self.inputs = None
\ No newline at end of file
+ self.inputs = None
diff -r dacc94994979 -r dd5f1fe8f5e9 templates/tool_form.mako
--- a/templates/tool_form.mako Wed Jul 15 12:18:43 2009 -0400
+++ b/templates/tool_form.mako Wed Jul 15 14:11:35 2009 -0400
@@ -102,7 +102,9 @@
current_case = group_state['__current_case__']
group_prefix = prefix + input.name + "|"
%>
- ${row_for_param( group_prefix, input.test_param, group_state, group_errors, other_values )}
+ %if input.value_ref_in_group:
+ ${row_for_param( group_prefix, input.test_param, group_state, group_errors, other_values )}
+ %endif
${do_inputs( input.cases[current_case].inputs, group_state, group_errors, group_prefix, other_values )}
%elif input.type == "upload_dataset":
%if input.get_datatype( trans, other_values ).composite_type is None: #have non-composite upload appear as before
diff -r dacc94994979 -r dd5f1fe8f5e9 tools/data_source/upload.xml
--- a/tools/data_source/upload.xml Wed Jul 15 12:18:43 2009 -0400
+++ b/tools/data_source/upload.xml Wed Jul 15 14:11:35 2009 -0400
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<tool name="Upload File" id="upload1" version="1.0.1">
+<tool name="Upload File" id="upload1" version="1.0.2">
<description>
from your computer
</description>
@@ -15,7 +15,7 @@
</options>
</param>
<param name="async_datasets" type="hidden" value="None"/>
- <upload_dataset name="files" title="Specify Files for Dataset" file_type_name="file_type">
+ <upload_dataset name="files" title="Specify Files for Dataset" file_type_name="file_type" metadata_ref="files_metadata">
<param name="file_data" type="file" size="30" label="File" ajax-upload="true">
<validator type="expression" message="You will need to reselect the file you specified (%s)." substitute_value_in_message="True">not ( ( isinstance( value, unicode ) or isinstance( value, str ) ) and value != "" )</validator> <!-- use validator to post message to user about needing to reselect the file, since most browsers won't accept the value attribute for file inputs -->
</param>
@@ -25,6 +25,7 @@
</param>
</upload_dataset>
<param name="dbkey" type="genomebuild" label="Genome" />
+ <conditional name="files_metadata" title="Specify metadata" value_from="self:app.datatypes_registry.get_upload_metadata_params" value_ref="file_type" value_ref_in_group="False" />
<!-- <param name="other_dbkey" type="text" label="Or user-defined Genome" /> -->
</inputs>
<help>
1
0
16 Jul '09
details: http://www.bx.psu.edu/hg/galaxy/rev/079bf1a8422b
changeset: 2486:079bf1a8422b
user: rc
date: Thu Jul 16 09:45:43 2009 -0400
description:
Replaced id's with objects as parameters to all the form & requests table classes
6 file(s) affected in this change:
lib/galaxy/model/__init__.py
lib/galaxy/model/mapping.py
lib/galaxy/web/controllers/admin.py
lib/galaxy/web/controllers/requests.py
lib/galaxy/web/controllers/requests_admin.py
templates/admin/requests/manage_request_types.mako
diffs (296 lines):
diff -r dd5f1fe8f5e9 -r 079bf1a8422b lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py Wed Jul 15 14:11:35 2009 -0400
+++ b/lib/galaxy/model/__init__.py Thu Jul 16 09:45:43 2009 -0400
@@ -1099,53 +1099,55 @@
class FormDefinition( object ):
- def __init__(self, name=None, desc=None, fields=[], current_form_id=None):
+ def __init__(self, name=None, desc=None, fields=[], current_form=None):
self.name = name
self.desc = desc
self.fields = fields
- self.form_definition_current_id = current_form_id
+ self.form_definition_current = current_form
class FormDefinitionCurrent( object ):
- def __init__(self, form_definition_id=None):
- self.latest_form_id = form_definition_id
+ def __init__(self, form_definition=None):
+ self.latest_form = form_definition
class FormValues( object ):
- def __init__(self, form_def_id=None, content=None):
- self.form_definition_id = form_def_id
+ def __init__(self, form_def=None, content=None):
+ self.form_definition = form_def
self.content = content
class Request( object ):
- def __init__(self, name=None, desc=None, request_type_id=None, user_id=None,
- form_values_id=None, library_id=None):
+ def __init__(self, name=None, desc=None, request_type=None, user=None,
+ form_values=None, library=None):
self.name = name
self.desc = desc
- self.request_type_id = request_type_id
- self.form_values_id = form_values_id
- self.user_id = user_id
- self.library_id = library_id
+ self.type = request_type
+ self.values = form_values
+ self.user = user
+ self.library = library
class RequestType( object ):
- def __init__(self, request_form_id=None, sample_form_id=None):
- self.request_form_id = request_form_id
- self.sample_form_id = sample_form_id
+ def __init__(self, request_form=None, sample_form=None):
+ self.request_form = request_form
+ self.sample_form = sample_form
class Sample( object ):
- def __init__(self, name=None, desc=None, request_id=None, form_values_id=None):
+ def __init__(self, name=None, desc=None, request=None, form_values=None):
self.name = name
self.desc = desc
- self.request_id = request_id
- self.form_values_id = form_values_id
+ self.request = request
+ self.values = form_values
+
+
class SampleState( object ):
- def __init__(self, name=None, desc=None, request_type_id=None):
+ def __init__(self, name=None, desc=None, request_type=None):
self.name = name
self.desc = desc
- self.request_type_id = request_type_id
+ self.request_type = request_type
class SampleEvent( object ):
- def __init__(self, sample_id=None, sample_state_id=None, comment=''):
- self.sample_id = sample_id
- self.sample_state_id = sample_state_id
+ def __init__(self, sample=None, sample_state=None, comment=''):
+ self.sample = sample
+ self.state = sample_state
self.comment = comment
diff -r dd5f1fe8f5e9 -r 079bf1a8422b lib/galaxy/model/mapping.py
--- a/lib/galaxy/model/mapping.py Wed Jul 15 14:11:35 2009 -0400
+++ b/lib/galaxy/model/mapping.py Thu Jul 16 09:45:43 2009 -0400
@@ -613,7 +613,10 @@
primaryjoin=( Sample.table.c.request_id == Request.table.c.id ) ),
) )
-assign_mapper( context, FormValues, FormValues.table, properties=None)
+assign_mapper( context, FormValues, FormValues.table,
+ properties=dict( form_definition=relation( FormDefinition,
+ primaryjoin=( FormValues.table.c.form_definition_id == FormDefinition.table.c.id ) )
+ ) )
assign_mapper( context, Request, Request.table,
properties=dict( values=relation( FormValues,
@@ -723,9 +726,7 @@
assign_mapper( context, User, User.table,
properties=dict( histories=relation( History, backref="user",
- order_by=desc(History.table.c.update_time) ),
-# requests=relation( Request, backref="user",
-# order_by=desc(Request.table.c.update_time) ),
+ order_by=desc(History.table.c.update_time) ),
active_histories=relation( History, primaryjoin=( ( History.table.c.user_id == User.table.c.id ) & ( not_( History.table.c.deleted ) ) ), order_by=desc( History.table.c.update_time ) ),
galaxy_sessions=relation( GalaxySession, order_by=desc( GalaxySession.table.c.update_time ) ),
stored_workflow_menu_entries=relation( StoredWorkflowMenuEntry, backref="user",
diff -r dd5f1fe8f5e9 -r 079bf1a8422b lib/galaxy/web/controllers/admin.py
--- a/lib/galaxy/web/controllers/admin.py Wed Jul 15 14:11:35 2009 -0400
+++ b/lib/galaxy/web/controllers/admin.py Thu Jul 16 09:45:43 2009 -0400
@@ -2185,8 +2185,8 @@
rt = trans.app.model.RequestType()
rt.name = util.restore_text( params.name )
rt.desc = util.restore_text( params.description ) or ""
- rt.request_form_id = int(util.restore_text( params.request_form_id ))
- rt.sample_form_id = int(util.restore_text( params.sample_form_id ))
+ rt.request_form = trans.app.model.FormDefinition.get(int( params.request_form_id ))
+ rt.sample_form = trans.app.model.FormDefinition.get(int( params.sample_form_id ))
rt.flush()
# set sample states
ss_list = trans.app.model.SampleState.filter(trans.app.model.SampleState.table.c.request_type_id == rt.id).all()
@@ -2196,7 +2196,7 @@
for i in range( num_states ):
name = util.restore_text( params.get( 'new_element_name_%i' % i, None ))
desc = util.restore_text( params.get( 'new_element_description_%i' % i, None ))
- ss = trans.app.model.SampleState(name, desc, rt.id)
+ ss = trans.app.model.SampleState(name, desc, rt)
ss.flush()
msg = "The new sample type named '%s' with %s state(s) has been created" % (rt.name, num_states)
return rt, msg
diff -r dd5f1fe8f5e9 -r 079bf1a8422b lib/galaxy/web/controllers/requests.py
--- a/lib/galaxy/web/controllers/requests.py Wed Jul 15 14:11:35 2009 -0400
+++ b/lib/galaxy/web/controllers/requests.py Thu Jul 16 09:45:43 2009 -0400
@@ -236,11 +236,11 @@
for index, field in enumerate(request_type.request_form.fields):
values.append(util.restore_text(params.get('field_%i' % index, '')))
if not request_id:
- form_values = trans.app.model.FormValues(request_type.request_form.id, values)
+ form_values = trans.app.model.FormValues(request_type.request_form, values)
form_values.flush()
- request = trans.app.model.Request(name, desc, request_type.id,
- trans.user.id, form_values.id,
- library_id)
+ request = trans.app.model.Request(name, desc, request_type,
+ trans.user, form_values,
+ trans.app.model.Library.get(library_id))
request.flush()
else:
# TODO editing
@@ -252,7 +252,7 @@
messagetype = params.get( 'messagetype', 'done' )
request_type = trans.app.model.RequestType.get(int(params.request_type_id))
if request:
- form_values = trans.app.model.FormValues.get(request.form_values_id)
+ form_values = request.values
else:
form_values = None
# list of widgets to be rendered on the request form
@@ -278,7 +278,8 @@
widget=lib_list,
helptext='Associated library where the resultant \
dataset will be stored'))
- widgets = self.__create_form(trans, request_type.request_form_id, widgets, form_values, **kwd)
+ widgets = self.__create_form(trans, request_type.request_form_id, widgets,
+ form_values, **kwd)
title = 'Add a new request of type: %s' % request_type.name
return trans.fill_template( '/requests/new_request.mako',
request_form_id=request_type.request_form_id,
@@ -336,7 +337,7 @@
messagetype = params.get( 'messagetype', 'done' )
request = trans.app.model.Request.get(int( params.request_id ))
if sample:
- form_values = trans.app.model.FormValues.get(sample.form_values_id)
+ form_values = sample.values
else:
form_values = None
# list of widgets to be rendered on the request form
@@ -349,7 +350,8 @@
widget=TextField('desc', 40,
util.restore_text( params.get( 'desc', '' ) )),
helptext='(Optional)'))
- widgets = self.__create_form(trans, request.type.sample_form_id, widgets, form_values, **kwd)
+ widgets = self.__create_form(trans, request.type.sample_form_id, widgets,
+ form_values, **kwd)
title = 'Add a new sample to request: %s of type: %s' % (request.name, request.type.name)
return trans.fill_template( '/sample/new_sample.mako',
sample_form_id=request.type.sample_form_id,
@@ -393,13 +395,13 @@
for index, field in enumerate(request.type.sample_form.fields):
values.append(util.restore_text(params.get('field_%i' % index, '')))
if not sample_id:
- form_values = trans.app.model.FormValues(request.type.sample_form.id, values)
+ form_values = trans.app.model.FormValues(request.type.sample_form, values)
form_values.flush()
- sample = trans.app.model.Sample(name, desc, request.id, form_values.id)
+ sample = trans.app.model.Sample(name, desc, request, form_values)
sample.flush()
# set the initial state
state = trans.app.model.SampleState.filter(trans.app.model.SampleState.table.c.request_type_id == request.type.id).first()
- event = trans.app.model.SampleEvent(sample.id, state.id)
+ event = trans.app.model.SampleEvent(sample, state)
event.flush()
else:
form_data.content = values
diff -r dd5f1fe8f5e9 -r 079bf1a8422b lib/galaxy/web/controllers/requests_admin.py
--- a/lib/galaxy/web/controllers/requests_admin.py Wed Jul 15 14:11:35 2009 -0400
+++ b/lib/galaxy/web/controllers/requests_admin.py Thu Jul 16 09:45:43 2009 -0400
@@ -242,15 +242,13 @@
return trans.fill_template( '/admin/samples/view_sample.mako',
sample_details=sample_details)
def __get_all_states(self, trans, sample):
- request = trans.app.model.Request.get(sample.request_id)
- request_type = trans.app.model.RequestType.get(request.request_type_id)
all_states = trans.app.model.SampleEvent.filter(trans.app.model.SampleEvent.table.c.sample_id == sample.id).all()
- curr_state = trans.app.model.SampleState.get(all_states[len(all_states)-1].sample_state_id)
- states_list = trans.app.model.SampleState.filter(trans.app.model.SampleState.table.c.request_type_id == request_type.id)
+ curr_state = all_states[len(all_states)-1].state
+ states_list = trans.app.model.SampleState.filter(trans.app.model.SampleState.table.c.request_type_id == sample.request.type.id)
return states_list
def __get_curr_state(self, trans, sample):
all_states = trans.app.model.SampleEvent.filter(trans.app.model.SampleEvent.table.c.sample_id == sample.id).all()
- curr_state = trans.app.model.SampleState.get(all_states[len(all_states)-1].sample_state_id)
+ curr_state = all_states[len(all_states)-1].state
return curr_state
def change_state(self, trans, sample_id_list):
sample = trans.app.model.Sample.get(sample_id_list[0])
@@ -280,35 +278,33 @@
sample_id_list = util.string_to_object(util.restore_text( params.sample_id_list ))
comments = util.restore_text( params.comment )
sample = trans.app.model.Sample.get(sample_id_list[0])
- request = trans.app.model.Request.get(sample.request_id)
selected_state = util.restore_text( params.select_state )
- new_state = trans.app.model.SampleState.filter(trans.app.model.SampleState.table.c.request_type_id == request.request_type_id
+ new_state = trans.app.model.SampleState.filter(trans.app.model.SampleState.table.c.request_type_id == sample.request.type.id
and trans.app.model.SampleState.table.c.name == selected_state)[0]
- for sample_id in sample_id_list:
- event = trans.app.model.SampleEvent(sample_id, new_state.id, comments)
+ for id in sample_id_list:
+ s = trans.app.model.Sample.get(id)
+ event = trans.app.model.SampleEvent(s, new_state, comments)
event.flush()
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='list',
operation='samples',
- id=trans.security.encode_id(request.id)) )
+ id=trans.security.encode_id(sample.request.id)) )
@web.expose
@web.require_admin
def show_events(self, trans, sample_id):
sample = trans.app.model.Sample.get(sample_id)
- request = trans.app.model.Request.get(sample.request_id)
events_list = []
all_events = trans.app.model.SampleEvent.filter(trans.app.model.SampleEvent.table.c.sample_id == sample_id).all()
all_events.reverse()
for event in all_events:
- state = trans.app.model.SampleState.get(event.sample_state_id)
delta = datetime.utcnow() - event.update_time
if delta > timedelta( minutes=60 ):
last_update = '%s hours' % int( delta.seconds / 60 / 60 )
else:
last_update = '%s minutes' % int( delta.seconds / 60 )
- events_list.append((state.name, state.desc, last_update, event.comment))
+ events_list.append((event.state.name, event.state.desc, last_update, event.comment))
return trans.fill_template( '/admin/samples/events.mako',
events_list=events_list,
- sample_name=sample.name, user=trans.app.model.User.get(request.user_id),
- request=request.name)
+ sample_name=sample.name, user=sample.request.user,
+ request=sample.request.name)
\ No newline at end of file
diff -r dd5f1fe8f5e9 -r 079bf1a8422b templates/admin/requests/manage_request_types.mako
--- a/templates/admin/requests/manage_request_types.mako Wed Jul 15 14:11:35 2009 -0400
+++ b/templates/admin/requests/manage_request_types.mako Thu Jul 16 09:45:43 2009 -0400
@@ -41,18 +41,8 @@
<tr>
<td><b><a href="${h.url_for( controller='admin', action='request_type', edit='True', id=request_type.id)}">${request_type.name}</a></b></td>
<td><i>${request_type.desc}</i></td>
- <% for form in forms:
- if form.id == request_type.request_form_id:
- form_name = form.name
- break
- %>
- <td><a href="${h.url_for( controller='forms', action='edit', form_id=request_type.request_form_id, read_only=True)}">${form_name}</a></td>
- <% for form in forms:
- if form.id == request_type.sample_form_id:
- form_name = form.name
- break
- %>
- <td><a href="${h.url_for( controller='forms', action='edit', form_id=request_type.sample_form_id, read_only=True)}">${form_name}</a></td>
+ <td><a href="${h.url_for( controller='forms', action='edit', form_id=request_type.request_form.id, read_only=True)}">${request_type.request_form.name}</a></td>
+ <td><a href="${h.url_for( controller='forms', action='edit', form_id=request_type.sample_form.id, read_only=True)}">${request_type.sample_form.name}</a></td>
</tr>
%endfor
</tbody>
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/b0fb9200afe0
changeset: 2482:b0fb9200afe0
user: rc
date: Tue Jul 14 16:55:18 2009 -0400
description:
Removed a debug statement
1 file(s) affected in this change:
lib/galaxy/web/controllers/requests.py
diffs (11 lines):
diff -r c60fc2075dd5 -r b0fb9200afe0 lib/galaxy/web/controllers/requests.py
--- a/lib/galaxy/web/controllers/requests.py Tue Jul 14 15:49:53 2009 -0400
+++ b/lib/galaxy/web/controllers/requests.py Tue Jul 14 16:55:18 2009 -0400
@@ -184,7 +184,6 @@
msg=msg,
messagetype=messagetype )
elif params.get('create', False) == 'True':
- print >> sys.stderr, '###KWD', kwd
return self.__show_request_form(trans=trans,
request=None, **kwd)
elif params.get('save', False) == 'True':
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/c60fc2075dd5
changeset: 2481:c60fc2075dd5
user: rc
date: Tue Jul 14 15:49:53 2009 -0400
description:
Updates to forms/requests:
- Mappers added to form & requests tables
- Required/optional fields in requests and samples are now enforced
Bug fix: duplicate field names in a request is working now
9 file(s) affected in this change:
lib/galaxy/model/__init__.py
lib/galaxy/model/mapping.py
lib/galaxy/web/controllers/admin.py
lib/galaxy/web/controllers/forms.py
lib/galaxy/web/controllers/requests.py
lib/galaxy/web/controllers/requests_admin.py
templates/base.mako
templates/sample/grid.mako
templates/sample/sample_events.mako
diffs (935 lines):
diff -r dc5068efc3e7 -r c60fc2075dd5 lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py Tue Jul 14 11:33:42 2009 -0400
+++ b/lib/galaxy/model/__init__.py Tue Jul 14 15:49:53 2009 -0400
@@ -1115,7 +1115,8 @@
self.content = content
class Request( object ):
- def __init__(self, name=None, desc=None, request_type_id=None, user_id=None, form_values_id=None, library_id=None):
+ def __init__(self, name=None, desc=None, request_type_id=None, user_id=None,
+ form_values_id=None, library_id=None):
self.name = name
self.desc = desc
self.request_type_id = request_type_id
diff -r dc5068efc3e7 -r c60fc2075dd5 lib/galaxy/model/mapping.py
--- a/lib/galaxy/model/mapping.py Tue Jul 14 11:33:42 2009 -0400
+++ b/lib/galaxy/model/mapping.py Tue Jul 14 15:49:53 2009 -0400
@@ -607,19 +607,39 @@
assign_mapper( context, Sample, Sample.table,
properties=dict( events=relation( SampleEvent, backref="sample",
order_by=desc(SampleEvent.table.c.update_time) ),
+ values=relation( FormValues,
+ primaryjoin=( Sample.table.c.form_values_id == FormValues.table.c.id ) ),
+ request=relation( Request,
+ primaryjoin=( Sample.table.c.request_id == Request.table.c.id ) ),
) )
assign_mapper( context, FormValues, FormValues.table, properties=None)
-assign_mapper( context, Request, Request.table, properties=None)
+assign_mapper( context, Request, Request.table,
+ properties=dict( values=relation( FormValues,
+ primaryjoin=( Request.table.c.form_values_id == FormValues.table.c.id ) ),
+ type=relation( RequestType,
+ primaryjoin=( Request.table.c.request_type_id == RequestType.table.c.id ) ),
+ user=relation( User,
+ primaryjoin=( Request.table.c.user_id == User.table.c.id ),
+ backref="requests" ),
+ library=relation( Library,
+ primaryjoin=( Request.table.c.library_id == Library.table.c.id ) ),
+ ) )
assign_mapper( context, RequestType, RequestType.table,
properties=dict( states=relation( SampleState, backref="request_type",
order_by=desc(SampleState.table.c.update_time) ),
+ request_form=relation( FormDefinition,
+ primaryjoin=( RequestType.table.c.request_form_id == FormDefinition.table.c.id ) ),
+ sample_form=relation( FormDefinition,
+ primaryjoin=( RequestType.table.c.sample_form_id == FormDefinition.table.c.id ) ),
) )
-assign_mapper( context, FormDefinition, FormDefinition.table, properties=None)
-
+assign_mapper( context, FormDefinition, FormDefinition.table,
+ properties=dict( current=relation( FormDefinitionCurrent,
+ primaryjoin=( FormDefinition.table.c.form_definition_current_id == FormDefinitionCurrent.table.c.id ) )
+ ) )
assign_mapper( context, FormDefinitionCurrent, FormDefinitionCurrent.table,
properties=dict( forms=relation( FormDefinition, backref='form_definition_current',
cascade="all, delete-orphan",
@@ -628,11 +648,14 @@
primaryjoin=( FormDefinitionCurrent.table.c.latest_form_id == FormDefinition.table.c.id ) )
) )
-assign_mapper( context, SampleEvent, SampleEvent.table, properties=None)
+assign_mapper( context, SampleEvent, SampleEvent.table,
+ properties=dict( state=relation( SampleState,
+ primaryjoin=( SampleEvent.table.c.sample_state_id == SampleState.table.c.id ) ),
+ ) )
+
assign_mapper( context, SampleState, SampleState.table,
- properties=None #dict( sample=relation( Sample, backref="sample" ),
- )# )
+ properties=None )
assign_mapper( context, ValidationError, ValidationError.table )
@@ -701,8 +724,8 @@
assign_mapper( context, User, User.table,
properties=dict( histories=relation( History, backref="user",
order_by=desc(History.table.c.update_time) ),
- requests=relation( Request, backref="user",
- order_by=desc(Request.table.c.update_time) ),
+# requests=relation( Request, backref="user",
+# order_by=desc(Request.table.c.update_time) ),
active_histories=relation( History, primaryjoin=( ( History.table.c.user_id == User.table.c.id ) & ( not_( History.table.c.deleted ) ) ), order_by=desc( History.table.c.update_time ) ),
galaxy_sessions=relation( GalaxySession, order_by=desc( GalaxySession.table.c.update_time ) ),
stored_workflow_menu_entries=relation( StoredWorkflowMenuEntry, backref="user",
diff -r dc5068efc3e7 -r c60fc2075dd5 lib/galaxy/web/controllers/admin.py
--- a/lib/galaxy/web/controllers/admin.py Tue Jul 14 11:33:42 2009 -0400
+++ b/lib/galaxy/web/controllers/admin.py Tue Jul 14 15:49:53 2009 -0400
@@ -2146,7 +2146,7 @@
msg=msg,
messagetype=messagetype)
elif params.get('save_new', False) == 'True':
- st, msg = self._save_request_type(trans, params, None)
+ st, msg = self._save_request_type(trans, **kwd)
if not st:
return trans.fill_template( '/admin/requests/create_request_type.mako',
forms=self._get_all_forms(trans, all_versions=False),
@@ -2170,24 +2170,9 @@
show_deleted=False,
msg=msg,
messagetype=messagetype )
- elif params.get('save_changes', False) == 'True':
- st = trans.app.model.SampleType.get(int(util.restore_text( params.id )))
- st, msg = self._save_sample_type(trans, params, st.id)
- if st:
- msg = "The sample type '%s' has been updated with the changes." % st.name
- messagetype = 'done'
- else:
- messagetype = 'error'
- ss_list = trans.app.model.SampleState.filter(trans.app.model.SampleState.table.c.sample_type_id == st.id).all()
- return trans.fill_template( '/admin/samples/edit_sample_type.mako',
- sample_type=st,
- forms=self._get_all_forms(trans, all_versions=False),
- states_list=ss_list,
- deleted=False,
- show_deleted=False,
- msg=msg,
- messagetype=messagetype )
- def _save_request_type(self, trans, params, request_type_id):
+
+ def _save_request_type(self, trans, **kwd):
+ params = util.Params( kwd )
num_states = int( util.restore_text( params.get( 'num_states', 0 ) ))
proceed = True
for i in range( num_states ):
@@ -2197,10 +2182,7 @@
if not proceed:
msg = "All the state name(s) must be completed."
return None, msg
- if not request_type_id: # create a new sample type to save
- rt = trans.app.model.RequestType()
- else: # use the existing sample type to save changes
- rt = trans.app.model.RequestType.get(request_type_id)
+ rt = trans.app.model.RequestType()
rt.name = util.restore_text( params.name )
rt.desc = util.restore_text( params.description ) or ""
rt.request_form_id = int(util.restore_text( params.request_form_id ))
diff -r dc5068efc3e7 -r c60fc2075dd5 lib/galaxy/web/controllers/forms.py
--- a/lib/galaxy/web/controllers/forms.py Tue Jul 14 11:33:42 2009 -0400
+++ b/lib/galaxy/web/controllers/forms.py Tue Jul 14 15:49:53 2009 -0400
@@ -70,7 +70,7 @@
elif params.get('create_form', False) == 'True':
if 'submitted' in params.new:
self.num_add_fields = 0
- fd, msg = self.__save_form(trans, params)
+ fd, msg = self.__save_form(trans, fdc_id=None, **kwd)
self.__get_saved_form(fd)
return self._show_forms_list(trans, msg, messagetype)
@web.expose
@@ -90,29 +90,34 @@
# the following two dicts store the unsaved select box options
self.del_options = {}
self.add_options = {}
- return self.__show(trans, params, fd)
+ return self.__show(trans=trans, form=fd, msg=msg,
+ messagetype=messagetype, **kwd)
# DELETE FIELD
elif params.get('remove_button', False):
- self.__update_current_form(params)
+ self.__update_current_form(**kwd)
index = int(params.get('remove_button', None).split(' ')[2])-1
self.__remove_field(index)
- return self.__show(trans, params, fd)
+ return self.__show(trans=trans, form=fd, msg=msg,
+ messagetype=messagetype, **kwd)
# SAVE CHANGES
elif params.get('save_changes_button', False) == 'Save':
- self.__update_current_form(params)
- fd_new, msg = self.__save_form(trans, params, fd.form_definition_current.id)
+ self.__update_current_form(**kwd)
+ fd_new, msg = self.__save_form(trans, fd.form_definition_current.id, **kwd)
if not fd_new:
- return self.__show(trans, params, fd, msg, 'error')
+ return self.__show(trans=trans, form=fd, msg=msg,
+ messagetype='error', **kwd)
else:
fd = fd_new
msg = "The form '%s' has been updated with the changes." % fd.name
- return self.__show(trans, params, fd, msg)
+ return self.__show(trans=trans, form=fd, msg=msg,
+ messagetype=messagetype, **kwd)
#ADD A FIELD
elif params.get('add_field_button', False) == 'Add field':
- self.__update_current_form(params)
+ self.__update_current_form(**kwd)
self.__add_field()
# show the form again with one empty field
- return self.__show(trans, params, fd)
+ return self.__show(trans=trans, form=fd, msg=msg,
+ messagetype=messagetype, **kwd)
# SHOW FORM READ ONLY
elif params.get('read_only', False):
return trans.fill_template( '/admin/forms/show_form_read_only.mako',
@@ -121,21 +126,24 @@
messagetype=messagetype )
# REFRESH PAGE, SelectField is selected/deselected as the type of a field
elif params.get('refresh', False) == 'true':
- self.__update_current_form(params)
- return self.__show(trans, params, fd)
+ self.__update_current_form(**kwd)
+ return self.__show(trans=trans, form=fd, msg=msg,
+ messagetype=messagetype, **kwd)
# REMOVE SelectField OPTION
elif params.get('select_box_options', False) == 'remove':
- #self.__update_current_form(params)
+ #self.__update_current_form(**kwd)
index = int(params.get( 'field_index', None ))
option = int(params.get( 'option_index', None ))
del self.current_form['fields'][index]['selectlist'][option]
- return self.__show(trans, params, fd)
+ return self.__show(trans=trans, form=fd, msg=msg,
+ messagetype=messagetype, **kwd)
# ADD SelectField OPTION
elif params.get('select_box_options', False) == 'add':
- #self.__update_current_form(params)
+ #self.__update_current_form(**kwd)
index = int(params.get( 'field_index', None ))
self.current_form['fields'][index]['selectlist'].append('')
- return self.__show(trans, params, fd)
+ return self.__show(trans=trans, form=fd, msg=msg,
+ messagetype=messagetype, **kwd)
def __remove_field(self, index):
del self.current_form['fields'][index]
def __add_field(self):
@@ -149,26 +157,31 @@
'type': BaseField.form_field_types()[0],
'selectlist': '' }
self.current_form['fields'].append(empty_field)
- def __get_field(self, params, index):
+ def __get_field(self, index, **kwd):
+ params = util.Params( kwd )
name = util.restore_text( params.get( 'field_name_%i' % index, None ) )
helptext = util.restore_text( params.get( 'field_helptext_%i' % index, None ) )
required = params.get( 'field_required_%i' % index, False )
field_type = util.restore_text( params.get( 'field_type_%i' % index, None ) )
if field_type == 'SelectField':
- selectlist = self.__get_selectbox_options(params, index)
- else:
- selectlist = None
+ selectlist = self.__get_selectbox_options(index, **kwd)
+ return {'label': name,
+ 'helptext': helptext,
+ 'visible': True,
+ 'required': required,
+ 'type': field_type,
+ 'selectlist': selectlist }
return {'label': name,
'helptext': helptext,
'visible': True,
'required': required,
- 'type': field_type,
- 'selectlist': selectlist }
- def __get_selectbox_options(self, params, index):
+ 'type': field_type}
+ def __get_selectbox_options(self, index, **kwd):
'''
This method gets all the options entered by the user for field when
the fieldtype is SelectField
'''
+ params = util.Params( kwd )
ctr=0
sb_options = []
while True:
@@ -183,12 +196,13 @@
self.current_form['name'] = fd.name
self.current_form['desc'] = fd.desc
self.current_form['fields'] = list(copy.deepcopy(fd.fields))
- def __validate_form(self, params):
+ def __validate_form(self, **kwd):
'''
This method checks the following text inputs are filled out by the user
- the name of form
- name of all the fields
'''
+ params = util.Params( kwd )
# form name
if not util.restore_text( params.name ):
return None, 'Form name must be filled.'
@@ -197,32 +211,33 @@
if not util.restore_text(params.get( 'field_name_%i' % i, None )):
return None, "All the field label(s) must be completed."
return True, ''
- def __get_form(self, params):
+ def __get_form(self, **kwd):
+ params = util.Params( kwd )
name = util.restore_text( params.name )
desc = util.restore_text( params.description ) or ""
# set form fields
fields = []
for i in range( len(self.current_form['fields']) ):
- fields.append(self.__get_field(params, i))
+ fields.append(self.__get_field(i, **kwd))
fields = fields
return name, desc, fields
- def __update_current_form(self, params):
- name, desc, fields = self.__get_form(params)
+ def __update_current_form(self, **kwd):
+ name, desc, fields = self.__get_form(**kwd)
self.current_form = {}
self.current_form['name'] = name
self.current_form['desc'] = desc
self.current_form['fields'] = fields
- def __save_form(self, trans, params, fdc_id=None):
+ def __save_form(self, trans, fdc_id=None, **kwd):
'''
This method saves the current form
'''
# check the form for invalid inputs
- flag, msg = self.__validate_form(params)
+ flag, msg = self.__validate_form(**kwd)
if not flag:
return None, msg
fd = trans.app.model.FormDefinition()
- fd.name, fd.desc, fd.fields = self.__get_form(params)
+ fd.name, fd.desc, fd.fields = self.__get_form(**kwd)
if fdc_id: # save changes to the existing form
# change the pointer in the form_definition_current table to point
# to this new record
@@ -302,10 +317,11 @@
def label(self):
return str(self.index)+'.'+self.label
- def __show(self, trans, params, form, msg=None, messagetype='done'):
+ def __show(self, trans, form, msg=None, messagetype='done', **kwd):
'''
This method displays the form and any of the changes made to it
'''
+ params = util.Params( kwd )
# name & description
form_details = [ ( 'Name', TextField('name', 40, self.current_form['name']) ),
( 'Description', TextField('description', 40, self.current_form['desc']) ) ]
diff -r dc5068efc3e7 -r c60fc2075dd5 lib/galaxy/web/controllers/requests.py
--- a/lib/galaxy/web/controllers/requests.py Tue Jul 14 11:33:42 2009 -0400
+++ b/lib/galaxy/web/controllers/requests.py Tue Jul 14 15:49:53 2009 -0400
@@ -6,11 +6,9 @@
from galaxy.util.streamball import StreamBall
import logging, tempfile, zipfile, tarfile, os, sys
from galaxy.web.form_builder import *
+from datetime import datetime, timedelta
log = logging.getLogger( __name__ )
-
-# States for passing messages
-SUCCESS, INFO, WARNING, ERROR = "done", "info", "warning", "error"
class RequestsListGrid( grids.Grid ):
title = "Requests"
@@ -41,8 +39,7 @@
def get_current_item( self, trans ):
return None
def get_request_type(self, trans, request):
- request_type = trans.app.model.RequestType.get(request.request_type_id)
- return request_type.name
+ return request.type.name
def apply_default_filter( self, trans, query ):
return query.filter_by( user=trans.user )
def number_of_samples(self, trans, request):
@@ -83,7 +80,7 @@
return query.filter_by( request_id=self.request.id )
def get_status(self, trans, sample):
all_states = trans.app.model.SampleEvent.filter(trans.app.model.SampleEvent.table.c.sample_id == sample.id).all()
- curr_state = trans.app.model.SampleState.get(all_states[len(all_states)-1].sample_state_id)
+ curr_state = all_states[len(all_states)-1].state
return curr_state.name
class Requests( BaseController ):
@@ -92,6 +89,7 @@
@web.expose
def index( self, trans ):
return trans.fill_template( "requests/index.mako" )
+
def get_authorized_libs(self, trans):
all_libraries = trans.app.model.Library.filter(trans.app.model.Library.table.c.deleted == False).order_by(trans.app.model.Library.name).all()
authorized_libraries = []
@@ -134,9 +132,6 @@
Shows the request details
'''
request = trans.app.model.Request.get(id)
- request_type = trans.app.model.RequestType.get(request.request_type_id)
- request_form = trans.app.model.FormDefinition.get(request_type.request_form_id)
- request_values = trans.app.model.FormValues.get(request.form_values_id)
libraries = self.get_authorized_libs(trans)
# list of widgets to be rendered on the request form
request_details = []
@@ -148,7 +143,7 @@
value=request.desc,
helptext=''))
request_details.append(dict(label='Type',
- value=request_type.name,
+ value=request.type.name,
helptext=''))
request_details.append(dict(label='Date created',
value=request.create_time,
@@ -157,26 +152,26 @@
value=request.create_time,
helptext=''))
request_details.append(dict(label='User',
- value=str(trans.user.email),
+ value=str(request.user.email),
helptext=''))
# library associated
request_details.append(dict(label='Library',
- value=trans.app.model.Library.get(request.library_id).name,
+ value=request.library.name,
helptext='Associated library where the resultant \
dataset will be stored'))
# form fields
- for field in request_form.fields:
+ for index, field in enumerate(request.type.request_form.fields):
if field['required']:
req = 'Required'
else:
req = 'Optional'
request_details.append(dict(label=field['label'],
- value=request_values.content[field['label']],
+ value=request.values.content[index],
helptext=field['helptext']+' ('+req+')'))
return trans.fill_template( '/requests/view_request.mako',
- request_form_id=request_form.id,
+ request_form_id=request.type.request_form.id,
request_details=request_details,
- request_type=request_type)
+ request_type=request.type)
@web.expose
def new(self, trans, **kwd):
params = util.Params( kwd )
@@ -189,49 +184,74 @@
msg=msg,
messagetype=messagetype )
elif params.get('create', False) == 'True':
- request_type_id = int(util.restore_text( params.request_type_id ))
- return self.__show_request_form(trans, params, request_type_id)
+ print >> sys.stderr, '###KWD', kwd
+ return self.__show_request_form(trans=trans,
+ request=None, **kwd)
elif params.get('save', False) == 'True':
- request = self.__save(trans, params)
+ request_type = trans.app.model.RequestType.get(int(params.request_type_id))
+ msg = self.__validate(trans,
+ [('name','Name'), ('library_id','Library')],
+ request_type.request_form.fields,
+ **kwd)
+ if msg:
+ kwd['create'] = 'True'
+ return trans.response.send_redirect( web.url_for( controller='requests',
+ action='new',
+ msg=msg,
+ messagetype='error',
+ **kwd) )
+ request = self.__save_request(trans, None, **kwd)
msg = 'The new request named %s has been created' % request.name
request_type_id = int(util.restore_text( params.request_type_id ))
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
msg=msg ,
messagetype='done') )
- return self.__show_request_form(trans, params, request_type_id, request=request)
- def __save(self, trans, params, request_id=None):
+ def __validate(self, trans, main_fields=[], form_fields=[], **kwd):
'''
- This method save a new request if request_id is None.
+ Validates the request entered by the user
'''
+ params = util.Params( kwd )
+ for field, field_name in main_fields:
+ if not util.restore_text(params.get(field, None)):
+ return 'Please enter the <b>%s</b> of the request' % field_name
+ # check rest of the fields of the form
+ for index, field in enumerate(form_fields):
+ if not util.restore_text(params.get('field_%i' % index, None)) and field['required']:
+ return 'Please enter the <b>%s</b> field of the request' % field['label']
+ return None
+ def __save_request(self, trans, request_id=None, **kwd):
+ '''
+ This method saves a new request if request_id is None.
+ '''
+ params = util.Params( kwd )
if not request_id:
- request_type_id = int(util.restore_text( params.request_type_id ))
- request_form_id = trans.app.model.RequestType.get(request_type_id).request_form_id
- request_form = trans.app.model.FormDefinition.get(request_form_id)
+ request_type = trans.app.model.RequestType.get(int(params.request_type_id ))
else:
- request = trans.app.model.Request.get(request_id)
- form_values = trans.app.model.FormValues.get(request.form_values_id)
- request_form = trans.app.model.FormDefinition.get(form_values.request_form_id)
+ # TODO editing
+ pass
name = util.restore_text(params.get('name', ''))
desc = util.restore_text(params.get('desc', ''))
- library_id = util.restore_text(params.get('library', ''))
- values = {}
- for field in request_form.fields:
- values[field['label']] = util.restore_text(params.get(field['label'], ''))
+ library_id = int(util.restore_text(params.get('library_id', 0)))
+ values = []
+ for index, field in enumerate(request_type.request_form.fields):
+ values.append(util.restore_text(params.get('field_%i' % index, '')))
if not request_id:
- form_values = trans.app.model.FormValues(request_form_id, values)
+ form_values = trans.app.model.FormValues(request_type.request_form.id, values)
form_values.flush()
- request = trans.app.model.Request(name, desc, request_type_id,
+ request = trans.app.model.Request(name, desc, request_type.id,
trans.user.id, form_values.id,
library_id)
request.flush()
else:
- form_values.content = values
- form_values.flush()
+ # TODO editing
+ pass
return request
- def __show_request_form(self, trans, params, request_type_id, request=None):
- request_type = trans.app.model.RequestType.get(request_type_id)
- request_form_id = request_type.request_form_id
+ def __show_request_form(self, trans, request=None, **kwd):
+ params = util.Params( kwd )
+ msg = util.restore_text( params.get( 'msg', '' ) )
+ messagetype = params.get( 'messagetype', 'done' )
+ request_type = trans.app.model.RequestType.get(int(params.request_type_id))
if request:
form_values = trans.app.model.FormValues.get(request.form_values_id)
else:
@@ -239,56 +259,63 @@
# list of widgets to be rendered on the request form
widgets = []
widgets.append(dict(label='Name',
- widget=TextField('name'),
+ widget=TextField('name', 40,
+ util.restore_text( params.get( 'name', '' ) )),
helptext='(Required)'))
widgets.append(dict(label='Description',
- widget=TextField('desc'),
+ widget=TextField('desc', 40,
+ util.restore_text( params.get( 'desc', '' ) )),
helptext='(Optional)'))
- widgets[0]['widget'].set_size(40)
- widgets[1]['widget'].set_size(40)
# libraries selectbox
+ value = int(params.get( 'library_id', 0 ))
libraries = self.get_authorized_libs(trans)
- lib_list = SelectField('library')
+ lib_list = SelectField('library_id')
for lib in libraries:
- lib_list.add_option(lib.name, lib.id)
+ if lib.id == value:
+ lib_list.add_option(lib.name, lib.id, selected=True)
+ else:
+ lib_list.add_option(lib.name, lib.id)
widgets.append(dict(label='Library',
widget=lib_list,
helptext='Associated library where the resultant \
dataset will be stored'))
- widgets = self.__create_form(trans, params, request_form_id, widgets, form_values)
+ widgets = self.__create_form(trans, request_type.request_form_id, widgets, form_values, **kwd)
title = 'Add a new request of type: %s' % request_type.name
return trans.fill_template( '/requests/new_request.mako',
- request_form_id=request_form_id,
+ request_form_id=request_type.request_form_id,
request_type=request_type,
widgets=widgets,
- title=title)
+ title=title,
+ msg=msg,
+ messagetype=messagetype)
- def __create_form(self, trans, params, form_id, widgets=[], form_values=None):
+ def __create_form(self, trans, form_id, widgets=[], form_values=None, **kwd):
+ params = util.Params( kwd )
form = trans.app.model.FormDefinition.get(form_id)
- if not form_values:
- values = {}
- for field in form.fields:
- if field['type'] in ['SelectField' or 'CheckBoxField']:
- values[field['label']] = False
- else:
- values[field['label']] = ''
- else:
- values = form_values.content
# form fields
- for field in form.fields:
- fw = eval(field['type'])(field['label'])
+ for index, field in enumerate(form.fields):
+ # value of the field
+ if field['type'] == 'CheckboxField':
+ value = util.restore_text( params.get( 'field_%i' % index, False ) )
+ else:
+ value = util.restore_text( params.get( 'field_%i' % index, '' ) )
+ # create the field
+ fw = eval(field['type'])('field_%i' % index)
if field['type'] == 'TextField':
fw.set_size(40)
- fw.value = values[field['label']]
+ fw.value = value
elif field['type'] == 'TextArea':
fw.set_size(3, 40)
- fw.value = values[field['label']]
+ fw.value = value
elif field['type'] == 'SelectField':
for option in field['selectlist']:
- fw.add_option(option, option, values[field['label']])
- elif field['type'] == 'CheckBoxField':
- fw.checked = values[field['label']]
-
+ if option == value:
+ fw.add_option(option, option, selected=True)
+ else:
+ fw.add_option(option, option)
+ elif field['type'] == 'CheckboxField':
+ fw.checked = value
+ # require/optional
if field['required']:
req = 'Required'
else:
@@ -302,13 +329,13 @@
params = util.Params( kwd )
msg = util.restore_text( params.get( 'msg', '' ) )
messagetype = params.get( 'messagetype', 'done' )
- request_id = int(util.restore_text( params.get( 'id', '' ) ))
- return self.__show_sample_form(trans, params, request_id)
+ return self.__show_sample_form(trans, sample=None, **kwd)
- def __show_sample_form(self, trans, params, request_id, sample=None):
- request = trans.app.model.Request.get(request_id)
- request_type = trans.app.model.RequestType.get(request.request_type_id)
- sample_form_id = request_type.sample_form_id
+ def __show_sample_form(self, trans, sample=None, **kwd):
+ params = util.Params( kwd )
+ msg = util.restore_text( params.get( 'msg', '' ) )
+ messagetype = params.get( 'messagetype', 'done' )
+ request = trans.app.model.Request.get(int( params.request_id ))
if sample:
form_values = trans.app.model.FormValues.get(sample.form_values_id)
else:
@@ -316,50 +343,63 @@
# list of widgets to be rendered on the request form
widgets = []
widgets.append(dict(label='Name',
- widget=TextField('name'),
+ widget=TextField('name', 40,
+ util.restore_text( params.get( 'name', '' ) )),
helptext='(Required)'))
widgets.append(dict(label='Description',
- widget=TextField('desc'),
+ widget=TextField('desc', 40,
+ util.restore_text( params.get( 'desc', '' ) )),
helptext='(Optional)'))
- widgets[0]['widget'].set_size(40)
- widgets[1]['widget'].set_size(40)
- widgets = self.__create_form(trans, params, sample_form_id, widgets, form_values)
- title = 'Add a new sample to request: %s of type: %s' % (request.name, request_type.name)
+ widgets = self.__create_form(trans, request.type.sample_form_id, widgets, form_values, **kwd)
+ title = 'Add a new sample to request: %s of type: %s' % (request.name, request.type.name)
return trans.fill_template( '/sample/new_sample.mako',
- sample_form_id=sample_form_id,
+ sample_form_id=request.type.sample_form_id,
request_id=request.id,
widgets=widgets,
- title=title)
+ title=title,
+ msg=msg,
+ messagetype=messagetype)
@web.expose
def samples(self, trans, **kwd):
params = util.Params( kwd )
if params.get('save', False) == 'True':
- sample = self.__save_sample(trans, params)
+ request = trans.app.model.Request.get(int(params.request_id ))
+ msg = self.__validate(trans,
+ [('name','Name')],
+ request.type.sample_form.fields,
+ **kwd)
+ if msg:
+ return trans.response.send_redirect( web.url_for( controller='requests',
+ action='add_sample',
+ msg=msg,
+ messagetype='error',
+ **kwd) )
+ sample = self.__save_sample(trans, sample_id=None, **kwd)
+ msg = 'The new sample named %s has been created' % sample.name
return trans.response.send_redirect( web.url_for( controller='requests',
action='list',
operation='samples',
- id=trans.security.encode_id(sample.request_id)) )
- def __save_sample(self, trans, params, sample_id=None):
+ id=trans.security.encode_id(sample.request_id),
+ **kwd) )
+ def __save_sample(self, trans, sample_id=None, **kwd):
+ params = util.Params( kwd )
if not sample_id:
- request = trans.app.model.Request.get(int(util.restore_text( params.request_id )))
- request_type = trans.app.model.RequestType.get(request.request_type_id)
- sample_form = trans.app.model.FormDefinition.get(request_type.sample_form_id)
+ request = trans.app.model.Request.get(int(params.request_id))
else:
- sample = trans.app.model.Sample.get(sample_id)
- form_data = trans.app.model.FormData.get(sample.form_data_id)
- form = trans.app.model.FormDefinition.get(form_data.form_definition_id)
+ #TODO editing
+ pass
name = util.restore_text(params.get('name', ''))
desc = util.restore_text(params.get('desc', ''))
- values = {}
- for field in sample_form.fields:
- values[field['label']] = util.restore_text(params.get(field['label'], ''))
+ values = []
+ for index, field in enumerate(request.type.sample_form.fields):
+ values.append(util.restore_text(params.get('field_%i' % index, '')))
if not sample_id:
- form_values = trans.app.model.FormValues(sample_form.id, values)
+ form_values = trans.app.model.FormValues(request.type.sample_form.id, values)
form_values.flush()
sample = trans.app.model.Sample(name, desc, request.id, form_values.id)
sample.flush()
# set the initial state
- state = trans.app.model.SampleState.filter(trans.app.model.SampleState.table.c.request_type_id == request_type.id).first()
+ state = trans.app.model.SampleState.filter(trans.app.model.SampleState.table.c.request_type_id == request.type.id).first()
event = trans.app.model.SampleEvent(sample.id, state.id)
event.flush()
else:
@@ -371,10 +411,10 @@
Shows the sample details
'''
sample = trans.app.model.Sample.get(sample_id)
- request = trans.app.model.Request.get(sample.request_id)
- request_type = trans.app.model.RequestType.get(request.request_type_id)
- sample_form = trans.app.model.FormDefinition.get(request_type.sample_form_id)
- sample_values = trans.app.model.FormValues.get(sample.form_values_id)
+ request = sample.request
+ request_type = sample.request.type
+ sample_form = sample.request.type.sample_form
+ sample_values = sample.values
# list of widgets to be rendered on the request form
sample_details = []
# main details
@@ -398,31 +438,37 @@
helptext='Name/ID of the request this sample belongs to.'))
# get the current state of the sample
all_states = trans.app.model.SampleEvent.filter(trans.app.model.SampleEvent.table.c.sample_id == sample_id).all()
- curr_state = trans.app.model.SampleState.get(all_states[len(all_states)-1].sample_state_id)
+ curr_state = all_states[len(all_states)-1].state
sample_details.append(dict(label='State',
value=curr_state.name,
helptext=curr_state.desc))
# form fields
- for field in sample_form.fields:
+ for index, field in enumerate(sample_form.fields):
if field['required']:
req = 'Required'
else:
req = 'Optional'
sample_details.append(dict(label=field['label'],
- value=sample_values.content[field['label']],
+ value=sample_values.content[index],
helptext=field['helptext']+' ('+req+')'))
return trans.fill_template( '/sample/view_sample.mako',
sample_details=sample_details)
def show_events(self, trans, sample_id):
sample = trans.app.model.Sample.get(sample_id)
events_list = []
- for event in trans.app.model.SampleEvent.filter(trans.app.model.SampleEvent.table.c.sample_id == sample_id).all():
- state = trans.app.model.SampleState.get(event.sample_state_id)
- events_list.append((state.name, event.update_time, state.desc, event.comment))
+ all_events = trans.app.model.SampleEvent.filter(trans.app.model.SampleEvent.table.c.sample_id == sample_id).all()
+ all_events.reverse()
+ for event in all_events:
+ delta = datetime.utcnow() - event.update_time
+ if delta > timedelta( minutes=60 ):
+ last_update = '%s hours' % int( delta.seconds / 60 / 60 )
+ else:
+ last_update = '%s minutes' % int( delta.seconds / 60 )
+ events_list.append((event.state.name, event.state.desc, last_update, event.comment))
return trans.fill_template( '/sample/sample_events.mako',
events_list=events_list,
sample_name=sample.name,
- request=trans.app.model.Request.get(sample.request_id).name)
+ request=sample.request.name)
diff -r dc5068efc3e7 -r c60fc2075dd5 lib/galaxy/web/controllers/requests_admin.py
--- a/lib/galaxy/web/controllers/requests_admin.py Tue Jul 14 11:33:42 2009 -0400
+++ b/lib/galaxy/web/controllers/requests_admin.py Tue Jul 14 15:49:53 2009 -0400
@@ -146,9 +146,6 @@
Shows the request details
'''
request = trans.app.model.Request.get(id)
- request_type = trans.app.model.RequestType.get(request.request_type_id)
- request_form = trans.app.model.FormDefinition.get(request_type.request_form_id)
- request_values = trans.app.model.FormValues.get(request.form_values_id)
libraries = self.get_authorized_libs(trans)
# list of widgets to be rendered on the request form
request_details = []
@@ -160,7 +157,7 @@
value=request.desc,
helptext=''))
request_details.append(dict(label='Type',
- value=request_type.name,
+ value=request.type.name,
helptext=''))
request_details.append(dict(label='Date created',
value=request.create_time,
@@ -169,7 +166,7 @@
value=request.create_time,
helptext=''))
request_details.append(dict(label='User',
- value=str(trans.user.email),
+ value=str(request.user.email),
helptext=''))
# library associated
request_details.append(dict(label='Library',
@@ -177,18 +174,18 @@
helptext='Associated library where the resultant \
dataset will be stored'))
# form fields
- for field in request_form.fields:
+ for index, field in enumerate(request.type.request_form.fields):
if field['required']:
req = 'Required'
else:
req = 'Optional'
request_details.append(dict(label=field['label'],
- value=request_values.content[field['label']],
+ value=request.values.content[index],
helptext=field['helptext']+' ('+req+')'))
return trans.fill_template( '/admin/requests/view_request.mako',
- request_form_id=request_form.id,
+ request_form_id=request.type.request_form.id,
request_details=request_details,
- request_type=request_type)
+ request_type=request.type)
@web.expose
@web.require_admin
@@ -202,10 +199,10 @@
Shows the sample details
'''
sample = trans.app.model.Sample.get(sample_id)
- request = trans.app.model.Request.get(sample.request_id)
- request_type = trans.app.model.RequestType.get(request.request_type_id)
- sample_form = trans.app.model.FormDefinition.get(request_type.sample_form_id)
- sample_values = trans.app.model.FormValues.get(sample.form_values_id)
+ request = sample.request
+ request_type = sample.request.type
+ sample_form = sample.request.type.sample_form
+ sample_values = sample.values
# list of widgets to be rendered on the request form
sample_details = []
# main details
@@ -229,18 +226,18 @@
helptext='Name/ID of the request this sample belongs to.'))
# get the current state of the sample
all_states = trans.app.model.SampleEvent.filter(trans.app.model.SampleEvent.table.c.sample_id == sample_id).all()
- curr_state = trans.app.model.SampleState.get(all_states[len(all_states)-1].sample_state_id)
+ curr_state = all_states[len(all_states)-1].state
sample_details.append(dict(label='State',
value=curr_state.name,
helptext=curr_state.desc))
# form fields
- for field in sample_form.fields:
+ for index, field in enumerate(sample_form.fields):
if field['required']:
req = 'Required'
else:
req = 'Optional'
sample_details.append(dict(label=field['label'],
- value=sample_values.content[field['label']],
+ value=sample_values.content[index],
helptext=field['helptext']+' ('+req+')'))
return trans.fill_template( '/admin/samples/view_sample.mako',
sample_details=sample_details)
@@ -300,7 +297,9 @@
sample = trans.app.model.Sample.get(sample_id)
request = trans.app.model.Request.get(sample.request_id)
events_list = []
- for event in trans.app.model.SampleEvent.filter(trans.app.model.SampleEvent.table.c.sample_id == sample_id).order_by(trans.app.model.SampleEvent.c.update_time.desc()).all():
+ all_events = trans.app.model.SampleEvent.filter(trans.app.model.SampleEvent.table.c.sample_id == sample_id).all()
+ all_events.reverse()
+ for event in all_events:
state = trans.app.model.SampleState.get(event.sample_state_id)
delta = datetime.utcnow() - event.update_time
if delta > timedelta( minutes=60 ):
diff -r dc5068efc3e7 -r c60fc2075dd5 templates/base.mako
--- a/templates/base.mako Tue Jul 14 11:33:42 2009 -0400
+++ b/templates/base.mako Tue Jul 14 15:49:53 2009 -0400
@@ -58,4 +58,5 @@
$( "#edit_form" ).submit();
}
});
-});
\ No newline at end of file
+});
+</script>
\ No newline at end of file
diff -r dc5068efc3e7 -r c60fc2075dd5 templates/sample/grid.mako
--- a/templates/sample/grid.mako Tue Jul 14 11:33:42 2009 -0400
+++ b/templates/sample/grid.mako Tue Jul 14 15:49:53 2009 -0400
@@ -89,7 +89,7 @@
<ul class="manage-table-actions">
<li>
- <a class="action-button" href="${h.url_for( controller='requests', action='add_sample', id=grid.request.id)}">
+ <a class="action-button" href="${h.url_for( controller='requests', action='add_sample', request_id=grid.request.id)}">
<img src="${h.url_for('/static/images/silk/add.png')}" />
<span>Add sample</span></a>
</li>
diff -r dc5068efc3e7 -r c60fc2075dd5 templates/sample/sample_events.mako
--- a/templates/sample/sample_events.mako Tue Jul 14 11:33:42 2009 -0400
+++ b/templates/sample/sample_events.mako Tue Jul 14 15:49:53 2009 -0400
@@ -14,17 +14,17 @@
<thead>
<tr>
<th>State</th>
+ <th>Description</th>
<th>Updated</th>
- <th>Description</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
- %for state, updated, desc, comments in events_list:
+ %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>${desc}</a></td>
<td><a>${comments}</a></td>
</tr>
%endfor
1
0
15 Jul '09
details: http://www.bx.psu.edu/hg/galaxy/rev/d202e2f4b910
changeset: 2477:d202e2f4b910
user: James Taylor <james(a)jamestaylor.org>
date: Fri Jul 10 18:33:36 2009 -0400
description:
Fix some display problems with the tabs. Sometimes you just have to use tables....
5 file(s) affected in this change:
static/june_2007_style/blue/panel_layout.css
static/june_2007_style/panel_layout.css.tmpl
static/scripts/galaxy.panels.js
static/scripts/packed/galaxy.panels.js
templates/base_panels.mako
diffs (257 lines):
diff -r 14fd033f08eb -r d202e2f4b910 static/june_2007_style/blue/panel_layout.css
--- a/static/june_2007_style/blue/panel_layout.css Fri Jul 10 16:21:19 2009 -0400
+++ b/static/june_2007_style/blue/panel_layout.css Fri Jul 10 18:33:36 2009 -0400
@@ -35,7 +35,6 @@
border-bottom: solid #999 1px;
font-size: 90%;
}
-
#left, #left-border, #center, #right-border, #right
{
@@ -272,16 +271,22 @@
text-decoration: underline;
}
-div.tab-group
+
+.tab-group
{
margin: 0;
padding: 0 10px;
height: 100%;
white-space: nowrap;
+ -moz-user-select: none;
+ -khtml-user-select: none;
+ user-select: none;
+ cursor: default;
}
-div.tab-group span.tab
+.tab-group .tab
{
+ background: #2C3143;
position: relative;
display: block;
float: left;
@@ -292,17 +297,17 @@
text-align: left;
}
-div.tab-group > span.tab:hover > a
+.tab-group .tab:hover > a
{
color: gold !important;
}
-div.tab-group > span.active
+.tab-group .active
{
background: rgb(1,1,1);
}
-div.tab-group span.tab div.submenu {
+.tab-group .tab .submenu {
display: none;
position: absolute;
z-index: 16000;
@@ -318,7 +323,8 @@
-webkit-border-bottom-left-radius: 1em;
}
-div.tab-group span.tab div.submenu ul {
+.tab-group .tab .submenu ul
+{
display: block;
margin: 0;
padding: 0;
@@ -326,7 +332,8 @@
background: #2C3143;
}
-div.tab-group span.tab div.submenu ul li {
+.tab-group .tab .submenu ul li
+{
display: block;
padding: 0 1em;
white-space: nowrap;
diff -r 14fd033f08eb -r d202e2f4b910 static/june_2007_style/panel_layout.css.tmpl
--- a/static/june_2007_style/panel_layout.css.tmpl Fri Jul 10 16:21:19 2009 -0400
+++ b/static/june_2007_style/panel_layout.css.tmpl Fri Jul 10 18:33:36 2009 -0400
@@ -35,7 +35,6 @@
border-bottom: solid #999 1px;
font-size: 90%;
}
-
#left, #left-border, #center, #right-border, #right
{
@@ -274,16 +273,23 @@
text-decoration: underline;
}
-div.tab-group
+## Tabs
+
+.tab-group
{
margin: 0;
padding: 0 10px;
height: 100%;
white-space: nowrap;
+ -moz-user-select: none;
+ -khtml-user-select: none;
+ user-select: none;
+ cursor: default;
}
-div.tab-group span.tab
+.tab-group .tab
{
+ background: ${masthead_bg};
position: relative;
display: block;
float: left;
@@ -294,17 +300,17 @@
text-align: left;
}
-div.tab-group > span.tab:hover > a
+.tab-group .tab:hover > a
{
color: gold !important;
}
-div.tab-group > span.active
+.tab-group .active
{
background: rgb(1,1,1);
}
-div.tab-group span.tab div.submenu {
+.tab-group .tab .submenu {
display: none;
position: absolute;
z-index: 16000;
@@ -320,7 +326,8 @@
-webkit-border-bottom-left-radius: 1em;
}
-div.tab-group span.tab div.submenu ul {
+.tab-group .tab .submenu ul
+{
display: block;
margin: 0;
padding: 0;
@@ -328,7 +335,8 @@
background: ${masthead_bg};
}
-div.tab-group span.tab div.submenu ul li {
+.tab-group .tab .submenu ul li
+{
display: block;
padding: 0 1em;
white-space: nowrap;
diff -r 14fd033f08eb -r d202e2f4b910 static/scripts/galaxy.panels.js
--- a/static/scripts/galaxy.panels.js Fri Jul 10 16:21:19 2009 -0400
+++ b/static/scripts/galaxy.panels.js Fri Jul 10 18:33:36 2009 -0400
@@ -216,8 +216,8 @@
// Tab management
$(function() {
- $("span.tab").each( function() {
- var submenu = $(this).children( "div.submenu" );
+ $(".tab").each( function() {
+ var submenu = $(this).children( ".submenu" );
if ( submenu.length > 0 ) {
if ( $.browser.msie ) {
// Vile IE iframe hack -- even IE7 needs this
diff -r 14fd033f08eb -r d202e2f4b910 static/scripts/packed/galaxy.panels.js
--- a/static/scripts/packed/galaxy.panels.js Fri Jul 10 16:21:19 2009 -0400
+++ b/static/scripts/packed/galaxy.panels.js Fri Jul 10 18:33:36 2009 -0400
@@ -1,1 +1,1 @@
-function ensure_dd_helper(){if($("#DD-helper").length==0){$("<div id='DD-helper'/>").css({background:"white",opacity:0,zIndex:9000,position:"absolute",top:0,left:0,width:"100%",height:"100%"}).appendTo("body").hide()}}function make_left_panel(h,c,e){var g=false;var f=null;var d=function(i){var j=i;if(i<0){i=0}$(h).css("width",i);$(e).css("left",j);$(c).css("left",i+7);if(document.recalc){document.recalc()}};var a=function(){if(g){$(e).removeClass("hover");$(e).animate({left:f},"fast");$(h).css("left",-f).show().animate({left:0},"fast",function(){d(f);$(e).removeClass("hidden")});g=false}else{f=$(e).position().left;$(c).css("left",$(e).innerWidth());if(document.recalc){document.recalc()}$(e).removeClass("hover");$(h).animate({left:-f},"fast");$(e).animate({left:-1},"fast",function(){$(this).addClass("hidden")});g=true}};$(e).hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")}).bind("dragstart",function(i){$("#DD-helper").show()}).bind("dragend
",function(i){$("#DD-helper").hide()}).bind("drag",function(i){x=i.offsetX;x=Math.min(400,Math.max(100,x));if(g){$(h).css("left",0);$(e).removeClass("hidden");g=false}d(x)}).bind("dragclickonly",function(i){a()}).find("div").show();var b=function(i){if((g&&i=="show")||(!g&&i=="hide")){a()}};return{force_panel:b}}function make_right_panel(a,e,h){var j=false;var g=false;var c=null;var d=function(k){$(a).css("width",k);$(e).css("right",k+9);$(h).css("right",k).css("left","");if(document.recalc){document.recalc()}};var i=function(){if(j){$(h).removeClass("hover");$(h).animate({right:c},"fast");$(a).css("right",-c).show().animate({right:0},"fast",function(){d(c);$(h).removeClass("hidden")});j=false}else{c=$(document).width()-$(h).position().left-$(h).outerWidth();$(e).css("right",$(h).innerWidth()+1);if(document.recalc){document.recalc()}$(h).removeClass("hover");$(a).animate({right:-c},"fast");$(h).animate({right:-1},"fast",function(){$(this).addClass("hidden")});j=true}g=false}
;var b=function(k){var l=$(e).width()-(j?c:0);if(l<k){if(!j){i();g=true}}else{if(g){i();g=false}}};$(h).hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")}).bind("dragstart",function(k){$("#DD-helper").show()}).bind("dragend",function(k){$("#DD-helper").hide()}).bind("drag",function(k){x=k.offsetX;w=$(window).width();x=Math.min(w-100,x);x=Math.max(w-400,x);if(j){$(a).css("right",0);$(h).removeClass("hidden");j=false}d(w-x-$(this).outerWidth())}).bind("dragclickonly",function(k){i()}).find("div").show();var f=function(k){if((j&&k=="show")||(!j&&k=="hide")){i()}};return{handle_minwidth_hint:b,force_panel:f}}function hide_modal(){$(".dialog-box-container").fadeOut(function(){$("#overlay").hide();$(".dialog-box").find(".body").children().remove()})}function show_modal(f,c,e,d){if(f){$(".dialog-box").find(".title").html(f);$(".dialog-box").find(".unified-panel-header").show()}else{$(".dialog-box").find(".unified-panel-header").hide()}var a=$(".dia
log-box").find(".buttons").html("");if(e){$.each(e,function(b,g){a.append($("<button/>").text(b).click(g));a.append(" ")});a.show()}else{a.hide()}var a=$(".dialog-box").find(".extra_buttons").html("");if(d){$.each(d,function(b,g){a.append($("<button/>").text(b).click(g));a.append(" ")});a.show()}else{a.hide()}if(c=="progress"){c=$("<img src='../images/yui/rel_interstitial_loading.gif')' />")}$(".dialog-box").find(".body").html(c);if(!$(".dialog-box-container").is(":visible")){$("#overlay").show();$(".dialog-box-container").fadeIn()}}function show_in_overlay(c){var d=c.width||"600";var b=c.height||"400";var a=c.scroll||"auto";$("#overlay-background").bind("click.overlay",function(){hide_modal();$("#overlay-background").unbind("click.overlay")});show_modal(null,$("<div style='margin: -5px;'><iframe style='margin: 0; padding: 0;' src='"+c.url+"' width='"+d+"' height='"+b+"' scrolling='"+a+"' frameborder='0'></iframe></div>"))}$(function(){$("span.tab").each(function(){var a=$(t
his).children("div.submenu");if(a.length>0){if($.browser.msie){a.prepend("<iframe style=\"position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; filter:Alpha(Opacity='0');\"></iframe>")}$(this).hover(function(){a.show()},function(){a.hide()});a.click(function(){a.hide()})}})});function user_changed(a,b){if(a){$(".loggedin-only").show();$(".loggedout-only").hide();$("#user-email").text(a);if(b){$(".admin-only").show()}}else{$(".loggedin-only").hide();$(".loggedout-only").show();$(".admin-only").hide()}};
\ No newline at end of file
+function ensure_dd_helper(){if($("#DD-helper").length==0){$("<div id='DD-helper'/>").css({background:"white",opacity:0,zIndex:9000,position:"absolute",top:0,left:0,width:"100%",height:"100%"}).appendTo("body").hide()}}function make_left_panel(h,c,e){var g=false;var f=null;var d=function(i){var j=i;if(i<0){i=0}$(h).css("width",i);$(e).css("left",j);$(c).css("left",i+7);if(document.recalc){document.recalc()}};var a=function(){if(g){$(e).removeClass("hover");$(e).animate({left:f},"fast");$(h).css("left",-f).show().animate({left:0},"fast",function(){d(f);$(e).removeClass("hidden")});g=false}else{f=$(e).position().left;$(c).css("left",$(e).innerWidth());if(document.recalc){document.recalc()}$(e).removeClass("hover");$(h).animate({left:-f},"fast");$(e).animate({left:-1},"fast",function(){$(this).addClass("hidden")});g=true}};$(e).hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")}).bind("dragstart",function(i){$("#DD-helper").show()}).bind("dragend
",function(i){$("#DD-helper").hide()}).bind("drag",function(i){x=i.offsetX;x=Math.min(400,Math.max(100,x));if(g){$(h).css("left",0);$(e).removeClass("hidden");g=false}d(x)}).bind("dragclickonly",function(i){a()}).find("div").show();var b=function(i){if((g&&i=="show")||(!g&&i=="hide")){a()}};return{force_panel:b}}function make_right_panel(a,e,h){var j=false;var g=false;var c=null;var d=function(k){$(a).css("width",k);$(e).css("right",k+9);$(h).css("right",k).css("left","");if(document.recalc){document.recalc()}};var i=function(){if(j){$(h).removeClass("hover");$(h).animate({right:c},"fast");$(a).css("right",-c).show().animate({right:0},"fast",function(){d(c);$(h).removeClass("hidden")});j=false}else{c=$(document).width()-$(h).position().left-$(h).outerWidth();$(e).css("right",$(h).innerWidth()+1);if(document.recalc){document.recalc()}$(h).removeClass("hover");$(a).animate({right:-c},"fast");$(h).animate({right:-1},"fast",function(){$(this).addClass("hidden")});j=true}g=false}
;var b=function(k){var l=$(e).width()-(j?c:0);if(l<k){if(!j){i();g=true}}else{if(g){i();g=false}}};$(h).hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")}).bind("dragstart",function(k){$("#DD-helper").show()}).bind("dragend",function(k){$("#DD-helper").hide()}).bind("drag",function(k){x=k.offsetX;w=$(window).width();x=Math.min(w-100,x);x=Math.max(w-400,x);if(j){$(a).css("right",0);$(h).removeClass("hidden");j=false}d(w-x-$(this).outerWidth())}).bind("dragclickonly",function(k){i()}).find("div").show();var f=function(k){if((j&&k=="show")||(!j&&k=="hide")){i()}};return{handle_minwidth_hint:b,force_panel:f}}function hide_modal(){$(".dialog-box-container").fadeOut(function(){$("#overlay").hide();$(".dialog-box").find(".body").children().remove()})}function show_modal(f,c,e,d){if(f){$(".dialog-box").find(".title").html(f);$(".dialog-box").find(".unified-panel-header").show()}else{$(".dialog-box").find(".unified-panel-header").hide()}var a=$(".dia
log-box").find(".buttons").html("");if(e){$.each(e,function(b,g){a.append($("<button/>").text(b).click(g));a.append(" ")});a.show()}else{a.hide()}var a=$(".dialog-box").find(".extra_buttons").html("");if(d){$.each(d,function(b,g){a.append($("<button/>").text(b).click(g));a.append(" ")});a.show()}else{a.hide()}if(c=="progress"){c=$("<img src='../images/yui/rel_interstitial_loading.gif')' />")}$(".dialog-box").find(".body").html(c);if(!$(".dialog-box-container").is(":visible")){$("#overlay").show();$(".dialog-box-container").fadeIn()}}function show_in_overlay(c){var d=c.width||"600";var b=c.height||"400";var a=c.scroll||"auto";$("#overlay-background").bind("click.overlay",function(){hide_modal();$("#overlay-background").unbind("click.overlay")});show_modal(null,$("<div style='margin: -5px;'><iframe style='margin: 0; padding: 0;' src='"+c.url+"' width='"+d+"' height='"+b+"' scrolling='"+a+"' frameborder='0'></iframe></div>"))}$(function(){$(".tab").each(function(){var a=$(this)
.children(".submenu");if(a.length>0){if($.browser.msie){a.prepend("<iframe style=\"position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; filter:Alpha(Opacity='0');\"></iframe>")}$(this).hover(function(){a.show()},function(){a.hide()});a.click(function(){a.hide()})}})});function user_changed(a,b){if(a){$(".loggedin-only").show();$(".loggedout-only").hide();$("#user-email").text(a);if(b){$(".admin-only").show()}}else{$(".loggedin-only").hide();$(".loggedout-only").show();$(".admin-only").hide()}};
\ No newline at end of file
diff -r 14fd033f08eb -r d202e2f4b910 templates/base_panels.mako
--- a/templates/base_panels.mako Fri Jul 10 16:21:19 2009 -0400
+++ b/templates/base_panels.mako Fri Jul 10 18:33:36 2009 -0400
@@ -131,8 +131,10 @@
%endif
</div>
- <div style="position: absolute; left: 50%;">
- <div class="tab-group" style="position: relative; left: -50%;">
+ <div style="position: absolute; left: 0; width: 100%; text-align: center;">
+
+ <table class="tab-group" border="0" cellspacing="0" style="margin: auto;">
+ <tr>
<%def name="tab( id, display, href, target='_parent', visible=True, extra_class='' )">
<%
@@ -145,31 +147,31 @@
if not visible:
style = "display: none;"
%>
- <span class="${cls}" style="${style}"><a target="${target}" href="${href}">${display}</a></span>
+ <td class="${cls}" style="${style}"><a target="${target}" href="${href}">${display}</a></td>
</%def>
${tab( "analysis", "Analyze Data", h.url_for( controller='root', action='index' ))}
-
+
${tab( "workflow", "Workflow", h.url_for( controller='workflow', action='index' ))}
-
+
${tab( "libraries", "Libraries", h.url_for( controller='library', action='index' ))}
${tab( "requests", "Requests", h.url_for( controller='requests', action='index' ), visible = (trans.user and trans.request_types)) }
%if app.config.get_bool( 'enable_tracks', False ):
- <span class="tab">
+ <td class="tab">
Visualization
<div class="submenu">
<ul>
<li><a href="${h.url_for( controller='tracks', action='index' )}">Build track browser</a></li>
</ul>
</div>
- </span>
+ </td>
%endif
${tab( "admin", "Admin", h.url_for( controller='admin', action='index' ), extra_class="admin-only", visible=( trans.user and app.config.is_admin_user( trans.user ) ) )}
- <span class="tab">
+ <td class="tab">
<a>Help</a>
<div class="submenu">
<ul>
@@ -178,9 +180,9 @@
<li><a target="_blank" href="${app.config.get( "screencasts_url", "http://g2.trac.bx.psu.edu/wiki/ScreenCasts" )}">Video tutorials (screencasts)</a></li>
</ul>
</div>
- </span>
+ </td>
- <span class="tab">
+ <td class="tab">
<a>User</a>
<%
if trans.user:
@@ -219,9 +221,11 @@
%endif
</ul>
</div>
- </span>
+ </td>
- </div>
+ </tr>
+ </table>
+
</div>
</%def>
1
0