All forms now use the tool form style. Cleaned up the edit attributes page.

Metadata elements can be created with "visible=False" in which case they are not display to the user on the edit attributes page.
This commit is contained in:
James Taylor
2007-09-20 19:14:42 +00:00
parent b7ac41fbb5
commit 74d224ef71
8 changed files with 147 additions and 101 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ class Interval( Tabular ):
MetadataElement( name="startCol", desc="Start column", param=metadata.ColumnParameter )
MetadataElement( name="endCol", desc="End column", param=metadata.ColumnParameter )
MetadataElement( name="strandCol", desc="Strand column (click box & select)", param=metadata.ColumnParameter, optional=True, no_value=0 )
MetadataElement( name="columns", default=3, desc="Number of columns", readonly=True )
MetadataElement( name="columns", default=3, desc="Number of columns", readonly=True, visible=False )
def __init__(self, **kwd):
+2 -1
View File
@@ -113,12 +113,13 @@ class MetadataElementSpec( object ):
is a MetadataSpecCollection) of datatype.
'''
def __init__( self, datatype, name=None, desc=None, param=MetadataParameter, default=None, no_value = None, **kwargs ):
def __init__( self, datatype, name=None, desc=None, param=MetadataParameter, default=None, no_value = None, visible=True, **kwargs ):
self.name = name
self.desc = desc or name
self.param = param
self.default = default
self.no_value = no_value
self.visible = visible
# Catch-all, allows for extra attributes to be set
self.__dict__.update(kwargs)
datatype.metadata_spec.append( self )
+2 -2
View File
@@ -20,8 +20,8 @@ class Tabular( data.Text ):
"""Tab delimited data"""
"""Add metadata elements"""
MetadataElement( name="columns", default=0, desc="Number of columns", readonly=True )
MetadataElement( name="column_types", default=[], desc="Column types", readonly=True )
MetadataElement( name="columns", default=0, desc="Number of columns", readonly=True, visible=False )
MetadataElement( name="column_types", default=[], desc="Column types", readonly=True, visible=False )
def init_meta( self, dataset, copy_from=None ):
data.Text.init_meta( self, dataset, copy_from=copy_from )
+2 -1
View File
@@ -223,7 +223,8 @@ class Universe( BaseController ):
metadata = list()
# a list of MetadataParemeters
for name, spec in data.datatype.metadata_spec.items():
metadata.append( spec.wrap( data.metadata.get(name), data ) )
if spec.visible:
metadata.append( spec.wrap( data.metadata.get(name), data ) )
datatypes = [x for x in trans.app.datatypes_registry.datatypes_by_extension.iterkeys()]
trans.log_event( "Opened edit view on dataset %s" % str(id) )
+5
View File
@@ -51,6 +51,11 @@ div.toolParamHelp
color: #666;
}
div.toolParamHelp a
{
color: #666;
}
div.toolFormBody
{
background: $form_body_bg_bottom;
+5
View File
@@ -51,6 +51,11 @@ div.toolParamHelp
color: #666;
}
div.toolParamHelp a
{
color: #666;
}
div.toolFormBody
{
background: #FFFFFF;
+97 -82
View File
@@ -15,15 +15,6 @@
<p></p>
#end if
#def do_metadata( $metadata, $data )
#for $element in $metadata
<tr>
<td width="30%" align="right">$element.spec.desc</td>
<td width="50%" align="left">$element.get_html()</td>
</tr>
#end for
#end def
#def datatype( $dataset, $datatypes )
<select name="datatype">
#$datatypes.sort()
@@ -37,87 +28,111 @@
</select>
#end def
<div class="toolForm">
<div class="toolFormTitle">Edit Attributes</div>
<div class="toolFormBody">
<form name="convert_data" action="$h.url_for( action='edit' )" method="post">
<input type="hidden" name="id" value="$data.id">
<div class="form-row">
<label>
Name:
</label>
<div style="float: left; width: 250px; margin-right: 10px;">
<input type="text" name="name" value="$data.name" size="40">
</div>
<div style="clear: both"></div>
</div>
<div class="form-row">
<label>
Info:
</label>
<div style="float: left; width: 250px; margin-right: 10px;">
<input type="text" name="info" value="$data.info" size="40">
</div>
<div style="clear: both"></div>
</div>
#for $element in $metadata
<div class="form-row">
<label>
${element.spec.desc}:
</label>
<div style="float: left; width: 250px; margin-right: 10px;">
$element.get_html()
</div>
<div style="clear: both"></div>
</div>
#end for
<div class="form-row">
<input type="submit" name="save" value="Save">
</div>
</form>
</div>
</div>
<p />
#set $converters = $data.get_converter_types()
<table border="1" width="100%">
#if $len($converters) > 0
<tr>
<td>
<div class="toolFormBody">
<form name="convert_data" action="$h.url_for( action='edit' )" method="post">
<table width="100%" border="0">
<tr>
<td width="30%" align="right">Convert data format</td>
<td width="50%" align="left">
<input type="hidden" name="id" value="$data.id">
#if len( $converters ) > 0:
<div class="toolForm">
<div class="toolFormTitle">Convert to new format</div>
<div class="toolFormBody">
<form name="convert_data" action="$h.url_for( action='edit' )" method="post">
<input type="hidden" name="id" value="$data.id">
<div class="form-row">
<label>
Convert to:
</label>
<div style="float: left; width: 250px; margin-right: 10px;">
<select name="target_type">
#for $key, $value in $converters.items():
<option value="$key">$value.name[8:]</option>
#end for
</select>
</td>
<td width="20%" align="left" valign="center">
<input type="submit" name="convert_data" value="Convert">
</td>
</tr>
</table>
</form>
</div>
</td>
</tr>
#end if
<tr>
<td>
<div class="toolFormBody">
<form name="datatype" action="$h.url_for( action='edit' )" method="post">
<table width="100%" border="0">
<tr>
<td width="30%" align="right">Set data type</td>
<td width="50%" align="left">
<input type="hidden" name="id" value="$data.id">
$datatype( $data, $datatypes )
</td>
<td width="20%" align="left" valign="center">
<input type="submit" name="change" value="Save">
</td>
</tr>
</table>
</form>
</div>
</td>
</tr>
<tr>
<td>
<div class="toolFormBody">
<form name="tool_form" action="$h.url_for( action='edit' )" method="post">
<input type="hidden" name="id" value="$data.id">
<table width="100%" border="0">
<tr><td align="center" colspan="3"><b>Set other attributes</b></td></tr>
<tr>
<td width="30%" align="right">Name:</td>
<td width="50%" align="left"><input type="text" name="name" value="$data.name" size="40"></td>
<td width="20%" align="left" valign="center" rowspan="8"><input type="submit" name="save" value="Save"></td>
</tr>
<tr>
<td width="30%" align="right">Info:</td>
<td width="50%" align="left">
<input type="text" name="info" value="$data.info" size="40">
<input type="hidden" name="id" value="$data.id">
</td>
</tr>
$do_metadata( $metadata, $data )
</table>
</form>
</div>
</td>
</tr>
</table>
</div>
<div class="toolHelp">
<div class="toolHelpBody">
</div>
<div class="toolParamHelp" style="clear: both;">
This will create a new dataset with the contents of this
dataset converted to a new format.
</div>
<div style="clear: both"></div>
</div>
<div class="form-row">
<input type="submit" name="convert_data" value="Convert">
</div>
</form>
</div>
</div>
<p />
#end if
<div class="toolForm">
<div class="toolFormTitle">Change data type</div>
<div class="toolFormBody">
<form name="convert_data" action="$h.url_for( action='edit' )" method="post">
<input type="hidden" name="id" value="$data.id">
<div class="form-row">
<label>
New Type:
</label>
<div style="float: left; width: 250px; margin-right: 10px;">
$datatype( $data, $datatypes )
</div>
<div class="toolParamHelp" style="clear: both;">
This will change the datatype of the existing dataset
but <i>not</i> modify its contents. Use this if Galaxy
has incorrectly guessed the type of your dataset.
</div>
<div style="clear: both"></div>
</div>
<div class="form-row">
<input type="submit" name="change" value="Save">
</div>
</form>
</div>
</div>
</body>
</html>
+33 -14
View File
@@ -8,20 +8,39 @@
<body onload="document.forms[0].email.focus()">
<div class="toolForm">
<div class="toolFormTitle">$form.title</div>
<div class="toolFormBody">
<form name="$form.name" action="$h.url_for($form.action)" method="post" >
<table>
#for input in $form.inputs
<tr><td>$input.label:</td><td><input type="$input.type" name="$input.name" value="$input.value" size="40"></td></tr>
#if $input.error:
<tr valign="top"><td></td><td><div class="errormark">$input.error</div></td></tr>
#end if
#if $input.help
<tr valign="top"><td></td><td><div class="toolParamHelp">$input.help</div></td></tr>
#end if
#end for
<tr><td></td><td><input type="submit" value="$form.submit_text">
<div class="toolFormTitle">$form.title</div>
<div class="toolFormBody">
<form name="$form.name" action="$h.url_for($form.action)" method="post" >
#for input in $form.inputs
#if $input.error:
#set cls = "form-row form-row-error"
#else
#set cls = "form-row"
#end if
<div class="$cls">
<label>
${input.label}:
</label>
<div style="float: left; width: 250px; margin-right: 10px;">
<input type="$input.type" name="$input.name" value="$input.value" size="40">
</div>
#if $input.error:
<div style="float: left; color: red; font-weight: bold; padding-top: 1px; padding-bottom: 3px;">
<div style="width: 300px;"><img style="vertical-align: middle;" src="$h.url_for('/static/style/error_small.png')">&nbsp;<span style="vertical-align: middle;">$input.error</span></div>
</div>
#end if
#if $input.help
<div class="toolParamHelp" style="clear: both;">
$input.help
</div>
#end if
<div style="clear: both"></div>
</div>
#end for
<tr><td></td><td><input type="submit" value="$form.submit_text">
</table>
</form>
</div>