Convert tool menu and edit attributes to mako.

This commit is contained in:
James Taylor
2008-04-25 20:33:37 +00:00
parent e561151b0c
commit 77baf424e8
6 changed files with 241 additions and 313 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ class RootController( BaseController ):
@web.expose
def tool_menu( self, trans ):
return trans.fill_template('tool_menu.tmpl', toolbox=self.get_toolbox() )
return trans.fill_template('/root/tool_menu.mako', toolbox=self.get_toolbox() )
@web.expose
def tool_help( self, trans, id ):
@@ -265,7 +265,7 @@ class RootController( BaseController ):
ldatatypes = [x for x in trans.app.datatypes_registry.datatypes_by_extension.iterkeys()]
ldatatypes.sort()
trans.log_event( "Opened edit view on dataset %s" % str(id) )
return trans.fill_template( "edit_data.tmpl", data=data, metadata=metadata,
return trans.fill_template( "/dataset/edit_attributes.mako", data=data, metadata=metadata,
datatypes=ldatatypes, err=None )
@web.expose
+132
View File
@@ -0,0 +1,132 @@
<%inherit file="/base.mako"/>
<%def name="title()">Your saved histories</%def>
<%def name="datatype( dataset, datatypes )">
<select name="datatype">
## $datatypes.sort()
%for ext in datatypes:
%if dataset.ext == ext:
<option value="${ext}" selected="yes">${ext}</option>
%else:
<option value="${ext}">${ext}</option>
%endif
%endfor
</select>
</%def>
<div class="toolForm">
<div class="toolFormTitle">Edit Attributes</div>
<div class="toolFormBody">
<form name="edit_attributes" 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>
%endfor
<div class="form-row">
<input type="submit" name="save" value="Save">
</div>
</form>
<form name="auto_detect" action="${h.url_for( action='edit' )}" method="post">
<input type="hidden" name="id" value="${data.id}">
<div style="float: left; width: 250px; margin-right: 10px;">
<input type="submit" name="detect" value="Auto-detect">
</div>
<div class="toolParamHelp" style="clear: both;">
This will inspect the dataset and attempt to correct the above column values
if they are not accurate.
</div>
</form>
</div>
</div>
<p />
<% converters = data.get_converter_types() %>
%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>
%endfor
</select>
</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 />
%endif
<div class="toolForm">
<div class="toolFormTitle">Change data type</div>
<div class="toolFormBody">
<form name="change_datatype" 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>
-148
View File
@@ -1,148 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
#from galaxy.util.expressions import ExpressionContext
<html>
<head>
<title>Galaxy</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="$h.url_for('/static/style/base.css')" rel="stylesheet" type="text/css" />
</head>
<body>
#if $getVar( 'error_message', None )
<div class="errormessagesmall">$error_message</div>
<p></p>
#end if
#def datatype( $dataset, $datatypes )
<select name="datatype">
#$datatypes.sort()
#for $ext in $datatypes:
#if $dataset.ext == $ext
<option value="$ext" selected="yes">$ext</option>
#else
<option value="$ext">$ext</option>
#end if
#end for
</select>
#end def
<div class="toolForm">
<div class="toolFormTitle">Edit Attributes</div>
<div class="toolFormBody">
<form name="edit_attributes" 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>
<form name="auto_detect" action="$h.url_for( action='edit' )" method="post">
<input type="hidden" name="id" value="$data.id">
<div style="float: left; width: 250px; margin-right: 10px;">
<input type="submit" name="detect" value="Auto-detect">
</div>
<div class="toolParamHelp" style="clear: both;">
This will inspect the dataset and attempt to correct the above column values
if they are not accurate.
</div>
</form>
</div>
</div>
<p />
#set $converters = $data.get_converter_types()
#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>
</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="change_datatype" 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>
+107
View File
@@ -0,0 +1,107 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Galaxy Tools</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="${h.url_for('/static/style/base.css')}" rel="stylesheet" type="text/css" />
<link href="${h.url_for('/static/style/tool_menu.css')}" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${h.url_for('/static/scripts/jquery.js')}"></script>
<script type="text/javascript">
var q = jQuery.noConflict();
q(document).ready(function() {
q( "div.toolSectionBody" ).hide();
q( "div.toolSectionTitle > span" ).wrap( "<a href='#'></a>" )
var last_expanded = null;
q( "div.toolSectionTitle" ).each( function() {
var body = q(this).next( "div.toolSectionBody" );
q(this).click( function() {
if ( body.is( ":hidden" ) ) {
if ( last_expanded ) last_expanded.slideUp( "fast" );
last_expanded = body;
body.slideDown( "fast" );
}
else {
body.slideUp( "fast" );
last_expanded = null;
}
});
});
q( "a[@minsizehint]" ).click( function() {
if ( parent.handle_minwidth_hint ) {
parent.handle_minwidth_hint( q(this).attr( "minsizehint" ) );
}
});
});
</script>
</head>
<body class="toolMenuPage">
<div class="toolMenu">
<div class="toolSectionList">
%for i, section in enumerate( toolbox.sections ):
%if i > 0:
<div class="toolSectionPad"></div>
%endif
<div class="toolSectionTitle" id="title_${section.id}">
<span>${section.name}</span>
</div>
<div id="${section.id}" class="toolSectionBody">
<div class="toolSectionBg">
%for tool in section.tools:
%if not tool.hidden:
<div class="toolTitle">
<%
if tool.input_required:
link = h.url_for( 'tool_runner', tool_id=tool.id )
else:
link = h.url_for( tool.action, ** tool.get_static_param_values( t ) )
%>
## FIXME: This doesn't look right
## %if "[[" in tool.description and "]]" in tool.description:
## ${tool.description.replace( '[[', '<a href="link" target="galaxy_main">' % $tool.id ).replace( "]]", "</a>" )
%if tool.name:
<a id="link-${tool.id}" href="${link}" target="galaxy_main" minsizehint="${tool.uihints.get( 'minwidth', -1 )}">${tool.name}</a> ${tool.description}
%else:
<a id="link-${tool.id}" href="${link}" target="galaxy_main" minsizehint="${tool.uihints.get( 'minwidth', -1 )}">${tool.description}</a>
%endif
</div>
%endif
%endfor
</div>
</div>
%endfor
## Link to workflow management. The location of this may change, but eventually
## at least some workflows will appear here (the user should be able to
## configure which of their stored workflows appear in the tools menu).
%if app.config.enable_beta_features:
<div class="toolSectionPad"></div>
<div class="toolSectionPad"></div>
<div class="toolSectionTitle" id="title_XXinternalXXworkflow">
<span>Workflow <i>(beta)</i></span>
</div>
<div id="XXinternalXXworkflow" class="toolSectionBody">
<div class="toolSectionBg">
<div class="toolTitle">
<a href="${h.url_for( controller='workflow', action='index' )}" target="galaxy_main">Manage</a> workflows
</div>
</div>
</div>
%endif
</div>
</div>
<div style="height: 20px"></div>
</body>
</html>
-29
View File
@@ -1,29 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Share History</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="/static/style/base.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h2 align="center">Share history</h2>
<p align="center">
The link below can be used to the current history.
</p>
<p align="center">
<b><a href="$url" target="_top"> $url</a></b>
</p>
<p>
Send this link to others (right-click + copy link location) or bookmark it for further reference.
</p>
<p>
You may also create a new history by <b><a target="_top" href="$url&create=yes">clicking here</a></b>
</p>
</body>
</html>
-134
View File
@@ -1,134 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Galaxy Tools</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="$h.url_for('/static/style/base.css')" rel="stylesheet" type="text/css" />
<link href="$h.url_for('/static/style/tool_menu.css')" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="$h.url_for('/static/scripts/jquery.js')"></script>
<script type="text/javascript">
var q = jQuery.noConflict();
q(document).ready(function() {
q( "div.toolSectionBody" ).hide();
q( "div.toolSectionTitle > span" ).wrap( "<a href='#'></a>" )
var last_expanded = null;
q( "div.toolSectionTitle" ).each( function() {
var body = q(this).next( "div.toolSectionBody" );
q(this).click( function() {
if ( body.is( ":hidden" ) ) {
if ( last_expanded ) last_expanded.slideUp( "fast" );
last_expanded = body;
body.slideDown( "fast" );
}
else {
body.slideUp( "fast" );
last_expanded = null;
}
});
});
q( "a[@minsizehint]" ).click( function() {
if ( parent.handle_minwidth_hint ) {
parent.handle_minwidth_hint( q(this).attr( "minsizehint" ) );
}
});
});
</script>
<style type="text/css">
#footer {
/* Netscape 4, IE 4.x-5.0/Win and other lesser browsers will use this */
position: absolute; left: 0px; bottom: 0px;
}
body > div#footer {
/* used by Opera 5+, Netscape6+/Mozilla, Konqueror, Safari, OmniWeb 4.5+, iCab, ICEbrowser */
position: fixed;
}
</style>
<!--[if gte IE 5.5]>
<![if lt IE 7]>
<style type="text/css">
div#footer {
/* IE5.5+/Win - this is more specific than the IE 5.0 version */
width:110%;
left: auto; bottom: auto;
left:0px;
lefta: expression( ( -0 - footer.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
top: expression( ( - footer.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
}
</style>
<![endif]>
<![endif]-->
</head>
<body class="toolMenuPage">
<div class="toolMenu">
<div class="toolSectionList">
#for $i, $section in enumerate( $toolbox.sections )
#if $i > 0
<div class="toolSectionPad"></div>
#end if
<div class="toolSectionTitle" id="title_$section.id">
<span>$section.name</span>
</div>
<div id="$section.id" class="toolSectionBody">
<div class="toolSectionBg">
#for $tool in $section.tools
#if not $tool.hidden:
<div class="toolTitle">
#if $tool.input_required
#set $link = $h.url_for( 'tool_runner', tool_id=$tool.id )
#else
#set $link = $h.url_for( $tool.action, ** $tool.get_static_param_values( $t ) )
#end if
#if "[[" in $tool.description and "]]" in $tool.description
$tool.description.replace( '[[', '<a href="$link" target="galaxy_main">' % $tool.id ).replace( "]]", "</a>" )
#elif $tool.name
<a id="link-$tool.id" href="$link" target="galaxy_main" minsizehint="$tool.uihints.get( 'minwidth', -1 )">$tool.name</a> $tool.description
#else
<a id="link-$tool.id" href="$link" target="galaxy_main" minsizehint="$tool.uihints.get( 'minwidth', -1 )">$tool.description</a>
#end if
</div>
#end if
#end for
</div>
</div>
#end for
## Link to workflow management. The location of this may change, but eventually
## at least some workflows will appear here (the user should be able to
## configure which of their stored workflows appear in the tools menu).
#if $app.config.enable_beta_features
<div class="toolSectionPad"></div>
<div class="toolSectionPad"></div>
<div class="toolSectionTitle" id="title_XXinternalXXworkflow">
<span>Workflow <i>(beta)</i></span>
</div>
<div id="XXinternalXXworkflow" class="toolSectionBody">
<div class="toolSectionBg">
<div class="toolTitle">
<a href="${h.url_for( controller='workflow', action='index' )}" target="galaxy_main">Manage</a> workflows
</div>
</div>
</div>
#end if
</div>
</div>
<div style="height: 20px"></div>
<div id="footer">
<div class="footerheader"><b>Tools</b></div>
</div>
</body>
</html>