Convert history templates to mako, eliminate some unnecessary templates,

clean up root controller, add decorator for methods that require login.
This commit is contained in:
James Taylor
2008-04-25 19:04:04 +00:00
parent db3db09f86
commit 648c2de5a1
18 changed files with 289 additions and 487 deletions
+1 -1
View File
@@ -2,5 +2,5 @@
The Galaxy web application.
"""
from framework import expose, json, url_for, error, FormBuilder
from framework import expose, json, require_login, url_for, error, FormBuilder
+99 -156
View File
@@ -13,12 +13,7 @@ import urllib
log = logging.getLogger( __name__ )
class Universe( BaseController ):
pref_cookie_name = 'universe_prefs'
@web.expose
def generate_error( self, trans ):
raise Exception( "Fake error!" )
class RootController( BaseController ):
@web.expose
def default(self, trans, target1=None, target2=None, **kwd):
@@ -26,50 +21,32 @@ class Universe( BaseController ):
@web.expose
def index(self, trans, id=None, tool_id=None, mode=None, **kwd):
# if mode:
# trans.set_cookie(name=self.pref_cookie_name, value=mode)
# else:
# mode = trans.get_cookie(name=self.pref_cookie_name)
# trans.ensure_valid_galaxy_session()
# result = trans.fill_template('index_frames.tmpl', mode=mode)
# return [ result ]
if trans.app.config.get( "use_new_layout", "false" ) == "true":
return trans.fill_template( "root/index.tmpl", tool_id=tool_id )
else:
return trans.fill_template( "index_frames.tmpl" )
## ---- Tool related -----------------------------------------------------
@web.expose
def tool_menu( self, trans ):
return trans.fill_template('tool_menu.tmpl', toolbox=self.get_toolbox() )
@web.expose
def last_hid( self, trans ):
"""Returns the largest (last) history id"""
trans.response.set_content_type("text/plain")
history = trans.get_history()
# if history.datasets :
# maxhid = max( [ data.hid for data in history.datasets ] )
# else:
# maxhid = -1
if len( history.datasets ) > 0:
return len( history.datasets ) + 1
def tool_help( self, trans, id ):
"""Return help page for tool identified by 'id' if available"""
toolbox = self.get_toolbox()
tool = toolbox.tools_by_id.get(id, '')
yield "<html><body>"
if not tool:
yield "Unknown tool id '%d'" % id
elif tool.help:
yield tool.help
else:
return -1
return str(maxhid)
@web.expose
def last_dataset_id( self, trans ):
"""Returns the largest (last) dataset id"""
trans.response.set_content_type("text/plain")
history = trans.get_history()
# if history.datasets :
# maxhid = max( [ data.hid for data in history.datasets ] )
# else:
# maxhid = -1
if len( history.datasets ) > 0:
return history.datasets[-1].id
else:
return -1
yield "No additional help available for tool '%s'" % tool.name
yield "</body></html>"
## ---- Root history display ---------------------------------------------
@web.expose
def history( self, trans, as_xml=False ):
@@ -87,8 +64,55 @@ class Universe( BaseController ):
return trans.fill_template_mako( "root/history_as_xml.mako", history=history )
else:
template = "root/history.mako"
mode = trans.get_cookie( name=self.pref_cookie_name )
return trans.fill_template( "root/history.mako", history=history, mode=mode )
return trans.fill_template( "root/history.mako", history=history )
@web.expose
def dataset_state ( self, trans, id=None, stamp=None ):
if id is not None:
try:
data = self.app.model.Dataset.get( id )
except:
return trans.show_error_message( "Unable to check dataset %s." %str( id ) )
trans.response.headers['X-Dataset-State'] = data.state
trans.response.headers['Pragma'] = 'no-cache'
trans.response.headers['Expires'] = '0'
return data.state
else:
return trans.show_error_message( "Must specify a dataset id.")
@web.expose
def dataset_code( self, trans, id=None, hid=None, stamp=None ):
if id is not None:
try:
data = self.app.model.Dataset.get( id )
except:
return trans.show_error_message( "Unable to check dataset %s." %str( id ) )
trans.response.headers['Pragma'] = 'no-cache'
trans.response.headers['Expires'] = '0'
return trans.fill_template("root/history_item.mako", data=data, hid=hid)
else:
return trans.show_error_message( "Must specify a dataset id.")
@web.json
def history_item_updates( self, trans, ids=None, states=None ):
# Avoid caching
trans.response.headers['Pragma'] = 'no-cache'
trans.response.headers['Expires'] = '0'
# Create new HTML for any that have changed
rval = {}
if ids is not None and states is not None:
ids = map( int, ids.split( "," ) )
states = states.split( "," )
for id, state in zip( ids, states ):
data = self.app.model.Dataset.get( id )
if data.state != state:
rval[id] = {
"state": data.state,
"html": trans.fill_template( "root/history_item.mako", data=data, hid=data.hid )
}
return rval
## ---- Dataset display / editing ----------------------------------------
@web.expose
def display(self, trans, id=None, hid=None, tofile=None, toext=".txt"):
@@ -298,10 +322,13 @@ class Universe( BaseController ):
pass # upload tool will cause this since it doesn't have a job
return "OK"
## ---- History management -----------------------------------------------
@web.expose
def history_options( self, trans ):
"""Displays a list of history related actions"""
return trans.fill_template( "history_options.tmpl", history = trans.get_history() )
"""Displays a list of history related actions"""
return trans.fill_template( "/history/options.mako",
user = trans.get_user(), history = trans.get_history() )
@web.expose
def history_delete( self, trans, id=None, **kwd):
@@ -344,45 +371,12 @@ class Universe( BaseController ):
dataset.deleted = True
self.app.model.flush()
trans.log_event( "History id %s cleared" % (str(history.id)) )
trans.response.send_redirect("/index")
@web.expose
def tool_help( self, trans, id ):
"""Return help page for tool identified by 'id' if available"""
toolbox = self.get_toolbox()
tool = toolbox.tools_by_id.get(id, '')
yield "<html><body>"
if not tool:
yield "Unknown tool id '%d'" % id
elif tool.help:
yield tool.help
else:
yield "No additional help available for tool '%s'" % tool.name
yield "</body></html>"
# @web.expose
# def share_history( self, trans, id=None, create=None ):
# """Shares the history"""
# history = trans.get_history()
# if create:
# # create a new history
# history = obj.History()
# history.store()
# history = trans.get_history(id=history.id)
# trans.response.send_redirect("/index")
# elif id:
# # load a previous one
# history = trans.get_history(id=id)
# trans.response.send_redirect("/index")
#
# url = '%s/share_history?id=%s' % (trans.request.base, history.id)
# return trans.fill_template( "share.tmpl", url=url)
trans.response.send_redirect( url_for("/index" ) )
@web.expose
@web.require_login( "share histories with other users" )
def history_share( self, trans, id=None, email=None, **kwd ):
send_to_err = ""
user = trans.get_user()
if not id:
id = trans.get_history().id
if not isinstance( id, list ):
@@ -393,7 +387,7 @@ class Universe( BaseController ):
histories.append( trans.app.model.History.get( hid ) )
history_names.append(histories[-1].name)
if not email:
return trans.fill_template("history_share.tmpl", histories=histories, user=user, email=email, send_to_err=send_to_err)
return trans.fill_template("/history/share.mako", histories=histories, email=email, send_to_err=send_to_err)
send_to_user = trans.app.model.User.get_by( email = email )
if not send_to_user:
@@ -409,20 +403,23 @@ class Universe( BaseController ):
trans.log_event( "History share, id: %s, name: '%s': to new id: %s" % (str(history.id), history.name, str(new_history.id)) )
self.app.model.flush()
return trans.show_message( "History (%s) has been shared with: %s" % (",".join(history_names),email) )
return trans.fill_template("history_share.tmpl", histories=histories, user=user, email=email, send_to_err=send_to_err)
return trans.fill_template( "/history/share.mako", histories=histories, email=email, send_to_err=send_to_err)
@web.expose
@web.require_login( "work with multiple histories" )
def history_available( self, trans, id=None, as_xml=False, **kwd ):
"""
List all available histories
"""
if as_xml:
trans.response.set_content_type('text/xml')
return trans.fill_template( "history_ids.xml" )
return trans.fill_template( "/history/list_as_xml.mako" )
if not isinstance( id, list ):
id = [ id ]
trans.log_event( "History id %s available" % str( id ) )
return trans.fill_template( "history_available.tmpl", ids=id )
return trans.fill_template( "/history/list.mako", ids=id,
user=trans.get_user(),
current_history=trans.get_history() )
@web.expose
def history_import( self, trans, id=None, confirm=False, **kwd ):
@@ -445,7 +442,9 @@ class Universe( BaseController ):
if not user_history.datasets:
trans.set_history( new_history )
trans.log_event( "History imported, id: %s, name: '%s': " % (str(new_history.id) , new_history.name ) )
return trans.fill_template("history_imported.tmpl", history=new_history)
return trans.show_ok_message( """
History "%s" has been imported. Click <a href="%s">here</a>
to begin.""" % ( new_history.name, web.url_for( '/' ) ) )
elif not user_history.datasets or confirm:
new_history = import_history.copy()
new_history.name = "imported: "+new_history.name
@@ -454,59 +453,19 @@ class Universe( BaseController ):
new_history.flush()
trans.set_history( new_history )
trans.log_event( "History imported, id: %s, name: '%s': " % (str(new_history.id) , new_history.name ) )
return trans.fill_template("history_imported.tmpl", history=new_history)
return trans.fill_template("history_import.tmpl", history=import_history)
@web.expose
def dataset_state ( self, trans, id=None, stamp=None ):
if id is not None:
try:
data = self.app.model.Dataset.get( id )
except:
return trans.show_error_message( "Unable to check dataset %s." %str( id ) )
trans.response.headers['X-Dataset-State'] = data.state
trans.response.headers['Pragma'] = 'no-cache'
trans.response.headers['Expires'] = '0'
return data.state
else:
return trans.show_error_message( "Must specify a dataset id.")
@web.expose
def dataset_code( self, trans, id=None, hid=None, stamp=None ):
if id is not None:
try:
data = self.app.model.Dataset.get( id )
except:
return trans.show_error_message( "Unable to check dataset %s." %str( id ) )
trans.response.headers['Pragma'] = 'no-cache'
trans.response.headers['Expires'] = '0'
return trans.fill_template("root/history_item.mako", data=data, hid=hid)
else:
return trans.show_error_message( "Must specify a dataset id.")
@web.json
def history_item_updates( self, trans, ids=None, states=None ):
# Avoid caching
trans.response.headers['Pragma'] = 'no-cache'
trans.response.headers['Expires'] = '0'
# Create new HTML for any that have changed
rval = {}
if ids is not None and states is not None:
ids = map( int, ids.split( "," ) )
states = states.split( "," )
for id, state in zip( ids, states ):
data = self.app.model.Dataset.get( id )
if data.state != state:
rval[id] = {
"state": data.state,
"html": trans.fill_template( "root/history_item.mako", data=data, hid=data.hid )
}
return rval
return trans.show_ok_message( """
History "%s" has been imported. Click <a href="%s">here</a>
to begin.""" % ( new_history.name, web.url_for( '/' ) ) )
return trans.show_warn_message( """
Warning! If you import this history, you will lose your current
history. Click <a href="%s">here</a> to confirm.
""" % web.url_for( id=id, confirm=True ) )
@web.expose
@web.require_login( "switch histories" )
def history_switch( self, trans, id=None ):
if not id:
return trans.fill_template( "history_switch.tmpl" )
return trans.response.send_redirect( web.url_for( action='history_available' ) )
else:
new_history = trans.app.model.History.get( id )
if new_history:
@@ -524,32 +483,12 @@ class Universe( BaseController ):
trans.new_history()
trans.log_event( "Created new History, id: %s." % str(trans.get_history().id) )
return trans.show_message( "New history created", refresh_frames = ['history'] )
@web.expose
def history_store( self, trans, name=None ):
user = trans.get_user()
if not user:
return trans.show_error_message( "Must be logged in to save history" )
history = trans.get_history()
if history.user:
if history.user == user:
return trans.show_error_message( "Current history already stored (name: %s)" % history.name )
else:
return trans.show_error_message( "Current history already associated with a different user" )
if not name:
return trans.fill_template( "history_store.tmpl" )
name = escape(name.replace("\n","").replace("\r",""))
history.name = name
history.user = user
trans.app.model.flush()
trans.log_event( "History stored, id: %s, name: '%s'" % (str(history.id), history.name ) )
return trans.show_message( "Current history stored as %s" % name, refresh_frames=['history'] )
@web.expose
@web.require_login( "renames histories" )
def history_rename( self, trans, id=None, name=None, **kwd ):
user = trans.get_user()
if not user:
return trans.show_error_message( "Must be logged in to rename your history" )
if not isinstance( id, list ):
if id != None:
id = [ id ]
@@ -568,7 +507,7 @@ class Universe( BaseController ):
histories.append(history)
cur_names.append(history.name)
if not name or len(histories)!=len(name):
return trans.fill_template( "history_rename.tmpl",histories=histories )
return trans.fill_template( "/history/rename.mako",histories=histories )
change_msg = ""
for i in range(len(histories)):
if histories[i].user_id == user.id:
@@ -584,7 +523,7 @@ class Universe( BaseController ):
change_msg = change_msg + "<p>You must specify a valid name for History: "+cur_names[i]+"</p>"
else:
change_msg = change_msg + "<p>History: "+cur_names[i]+" does not appear to belong to you.</p>"
return trans.show_message( "<p><h2>Rename history</h2>%s" % change_msg, refresh_frames=['history'] )
return trans.show_message( "<p>%s" % change_msg, refresh_frames=['history'] )
@web.expose
def history_add_to( self, trans, history_id=None, file_data=None, name="Data Added to History",info=None,ext="txt",dbkey="?",**kwd ):
@@ -676,3 +615,7 @@ class Universe( BaseController ):
if isinstance( kwd[k], FieldStorage ):
rval += "-> %s" % kwd[k].file.read()
return rval
@web.expose
def generate_error( self, trans ):
raise Exception( "Fake error!" )
+13 -1
View File
@@ -47,6 +47,18 @@ def json( func ):
decorator._orig = func
decorator.exposed = True
return decorator
def require_login( verb="perform this action" ):
def argcatcher( func ):
def decorator( self, trans, *args, **kwargs ):
if trans.get_user():
return func( self, trans, *args, **kwargs )
else:
return trans.show_error_message(
"You must be <a target='galaxy_main' href='%s'>logged in</a> to %s</div>"
% ( url_for( controller='user', action='login' ), verb ) )
return decorator
return argcatcher
NOT_SET = object()
@@ -338,7 +350,7 @@ class UniverseWebTransaction( base.DefaultWebTransaction ):
"""
Convenience method for displaying an warn message. See `show_message`.
"""
return self.show_message( message, 'warn', refresh_frames )
return self.show_message( message, 'warning', refresh_frames )
def show_form( self, form ):
"""
Convenience method for displaying a simple page with a single HTML
+6
View File
@@ -5,6 +5,7 @@
<title>${self.title()}</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
${self.stylesheets()}
${self.javascripts()}
</head>
<body>
@@ -18,4 +19,9 @@ ${self.stylesheets()}
## Default stylesheets
<%def name="stylesheets()">
<link href="${h.url_for('/static/style/base.css')}" rel="stylesheet" type="text/css" />
</%def>
## Default javascripts
<%def name="javascripts()">
<script type="text/javascript" src="${h.url_for('/static/scripts/jquery.js')}"></script>
</%def>
+75
View File
@@ -0,0 +1,75 @@
<%inherit file="/base.mako"/>
<%def name="title()">Your saved histories</%def>
<%def name="javascripts()">
${parent.javascripts()}
<script type="text/javascript">
jQuery(document).ready( function() {
// Links with confirmation
jQuery( "a[@confirm]" ).click( function() {
return confirm( jQuery(this).attr( "confirm" ) )
})
});
## FIXME: This depends on javascript, could be moved into controller
function OnSubmitForm()
{
if(document.history_actions.operation[0].checked == true)
{
document.history_actions.action = "${h.url_for( action="history_share") }";
}
else if(document.history_actions.operation[1].checked == true)
{
document.history_actions.action = "${h.url_for( action="history_rename") }";
}
else if(document.history_actions.operation[2].checked == true)
{
if (confirm("Are you sure you want to delete these histories?"))
{
document.history_actions.action = "${h.url_for( action="history_delete" )}";
}
}
return true;
}
</script>
</%def>
%if user.histories:
<h1>Stored Histories</h1>
<form name="history_actions" onSubmit="return OnSubmitForm();" method="post" >
<table class="colored" border="0" cellspacing="0" cellpadding="0" width="100%">
<tr class="header" align="center"><td></td><td>Name</td><td>Size</td><td>Last modified</td><td>Actions</td></tr>
%for history in user.histories:
%if not( history.deleted ):
<tr>
<td><input type=checkbox name="id" value="${history.id}"
%if str(history.id) in ids:
checked
%endif
></td><td>${history.name}
%if history.deleted:
(deleted)
%endif
</td>
<td>${len(history.active_datasets)}</td>
<td>${str(history.update_time)[:19]}</td>
<td>
<a href="${h.url_for( action='history_rename', id=history.id )}">rename</a><br />
<a href="${h.url_for( action='history_switch', id=history.id )}">switch to</a><br />
<a href="${h.url_for( action='history_delete', id=history.id )}" confirm="Are you sure you want to delete this history?">delete</a>
</td>
</tr>
%endif
%endfor
<tr><th colspan="100%">Action</th></tr>
<tr><td colspan="100%" align="center"><input type="radio" name="operation" value="1" checked>Share <input type="radio" name="operation" value="2">Rename <input type="radio" name="operation" value="3">Delete </td></tr>
<tr><td colspan="100%" align="center"><input type="submit" name="submit" value="Perform Action"></td></tr>
</table>
</form>
%else:
You have no stored histories
%endif
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<history_ids>
%for i, history in enumerate( t.user.histories ):
<data id="${history.id}" hid="${i+1}" num="${len(history.datasets)}" name="${history.name}" create="${history.create_time}" update="${history.update_time}" >
</data>
%endfor
</history_ids>
+39
View File
@@ -0,0 +1,39 @@
<%inherit file="/base.mako"/>
<%def name="title()">Your saved histories</%def>
<%def name="javascripts()">
${parent.javascripts()}
<script type="text/javascript">
jQuery(document).ready( function() {
// Links with confirmation
jQuery( "a[@confirm]" ).click( function() {
return confirm( jQuery(this).attr( "confirm" ) )
})
});
</script>
</%def>
<h1>History Options</h1>
%if not user:
<div class="infomessage">
<div>You must be <a target="galaxy_main" href="${h.url_for( controller='user', action='login' )}">logged in</a> to store or switch histories.</div>
</div>
%endif
<ul>
%if user:
<li><a href="${h.url_for( action='history_rename', id=history.id )}" target="galaxy_main">Rename</a> current history (stored as "${history.name}")</li>
<li><a href="${h.url_for( action='history_available')}" target="galaxy_main">List</a> previously stored histories</li>
%if len( history.active_datasets ) > 0:
<li><a href="${h.url_for('/history_new')}">Create</a> a new empty history</li>
%endif
%if app.config.enable_beta_features:
<li><a href="${h.url_for( controller='workflow', action='build_from_current_history' )}">Construct workflow</a> from the current history</li>
%endif
<li><a href="${h.url_for( action='history_share' )}" target="galaxy_main">Share</a> current history</div>
%endif
<li><a href="${h.url_for( action='history_delete', id=history.id )}" confirm="Are you sure you want to delete the current history?">Delete</a> current history</div>
</ul>
+19
View File
@@ -0,0 +1,19 @@
<%inherit file="/base.mako"/>
<%def name="title()">Rename History</%def>
<div class="toolForm">
<div class="toolFormTitle">Rename History</div>
<div class="toolFormBody">
<form action="${h.url_for( action='history_rename' )}" method="post" >
<table>
<tr><th>Current Name</th><th>New Name</th></tr>
%for history in histories:
<tr><td>${history.name}<input type="hidden" name="id" value="${history.id}"></td><td><input type="text" name="name" value="${history.name}" size="40"></td></tr>
%endfor
<tr><td colspan="2"><input type="submit" name="history_rename_btn" value="Rename Histories"></td></tr>
</table>
</form>
</div>
</div>
</body>
</html>
+30
View File
@@ -0,0 +1,30 @@
<%inherit file="/base.mako"/>
<%def name="title()">Share histories</%def>
<div class="toolForm">
<div class="toolFormTitle">Share Histories</div>
<table>
<form action="$h.url_for('/history_share')" method="post" >
<tr><th>History Name:</td><th>Number of Datasets:</th><th>Share Link</th></tr>
%for history in histories:
<tr><td align="center">${history.name}<input type="hidden" name="id" value="${history.id}"></td><td align="center">
%if len(history.datasets) < 1:
<div class="warningmark">
This history contains no data.
</div>
%else:
${len(history.datasets)}
%endif
</td>
<td align="center"><a href="${h.url_for( action='history_import', id=history.id )}">copy link to share</a></td>
</tr>
%endfor
<tr><td>Email of User to share with:</td><td><input type="text" name="email" value="${email}" size="40"></td></tr>
%if send_to_err:
<tr><td colspan="100%"><div class="errormessage">${send_to_err}</div></td></tr>
%endif
<tr><td colspan="2" align="right"><input type="submit" name="history_share_btn" value="Submit"></td></tr>
</form>
</table>
</div>
-103
View File
@@ -1,103 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> Available Histories </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">
<script type="text/javascript" src="${h.url_for('/static/scripts/jquery.js')}"></script>
<style>
tr.history_row_deleted td
{
background-color: #EEEEEE;
}
</style>
</head>
<body>
<script type="text/javascript">
jQuery(document).ready( function() {
// Links with confirmation
jQuery( "a[@confirm]" ).click( function() {
return confirm( jQuery(this).attr( "confirm" ) )
})
})
function OnSubmitForm()
{
if(document.history_actions.operation[0].checked == true)
{
document.history_actions.action = "$h.url_for("/history_share")";
}
else if(document.history_actions.operation[1].checked == true)
{
document.history_actions.action = "$h.url_for("/history_rename")";
}
else if(document.history_actions.operation[2].checked == true)
{
if (confirm("Are you sure you want to delete these histories?"))
{
document.history_actions.action = "$h.url_for("/history_delete")";
}
}
return true;
}
</SCRIPT>
#set $user = $t.user
#set $history = $t.history
#if $user
#if $history.user is None and $history.datasets
<div class="warningmessage">
Your current history has not been <a href="$h.url_for('/history_store')">stored</a>
and will be lost if you switch to another history.
</div>
#end if
#if $user.histories
<h1>Stored Histories</h1>
<form name="history_actions" onSubmit="return OnSubmitForm();" method="post" >
<table class="colored" border="0" cellspacing="0" cellpadding="0" width="100%">
<tr class="header" align="center"><td>Name</td><td>Size</td><td>Last modified</td><td>Actions</td></tr>
#for $history in $user.histories
#if not( $history.deleted )
<tr>
<td><input type=checkbox name="id" value="$history.id"
#if $str($history.id) in $ids:
checked
#end if
>$history.name
#if $history.deleted
(deleted)
#end if
</td>
<td>${len(history.active_datasets)}</td>
<td>${str(history.update_time)[:19]}</td>
<td>
<a href="$h.url_for('history_rename', id=$history.id )">rename</a><br />
<a href="$h.url_for('history_switch', id=$history.id )">switch to</a><br />
<a href="$h.url_for('/history_delete', id=$history.id )" confirm="Are you sure you want to delete this history?">delete</a>
</td>
</tr>
#end if
#end for
<tr><th colspan="100%">Action</th></tr>
<tr><td colspan="100%" align="center"><input type="radio" name="operation" value="1" checked>Share <input type="radio" name="operation" value="2">Rename <input type="radio" name="operation" value="3">Delete </td></tr>
<tr><td colspan="100%" align="center"><input type="submit" name="submit" value="Perform Action"></td></tr>
</table>
</form>
#else
You have no stored histories
#end if
#else
<div class="errormessage">
You must be logged in to store and switch histories
</div>
#end if
</body>
</html>
-9
View File
@@ -1,9 +0,0 @@
<?xml version="1.0"?>
<history_ids>
#set $i=1
#for $data in $t.user.histories
<data id="$data.id" hid="$i" num="${len(data.datasets)}" name="$data.name" create="$data.create_time" update="$data.update_time" >
#set $i=$i+1
</data>
#end for
</history_ids>
-15
View File
@@ -1,15 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> Import History </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>
<div class="toolForm">
<div class="toolFormTitle">Import History</div>
<div class="errormessage">
Warning! If you import this history, you will lose your current history. Click <a href="$h.url_for('/history_import', id=$history.id, confirm=True )">here</a> to confirm.
</div>
</body>
</html>
-15
View File
@@ -1,15 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> History Imported </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>
<div class="toolForm">
<div class="toolFormTitle">History Imported</div>
<div class="infomessage">
History "$history.name" has been imported. Click <a href="$h.url_for('/index')">here</a> to begin.
</div>
</body>
</html>
-45
View File
@@ -1,45 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> History Options </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">
<script type="text/javascript" src="$h.url_for('/static/scripts/jquery.js')"></script>
<script type="text/javascript">
q = jQuery.noConflict();
q( "a[@confirm]" ).click( function() {
return confirm( q(this).attr( "confirm" ) )
})
</script>
</head>
<body>
<h1>History Options</h1>
#if not $t.user:
<div class="infomessage">
<div>You must be <a target="galaxy_main" href="$h.url_for('/user/login')">logged in</a> to store or switch histories.</div>
</div>
#end if
<ul>
#if $t.user
#if $history.user
<li><a href="$h.url_for('/history_rename', id=$history.id )" target="galaxy_main">Rename</a> current history (stored as "$history.name")</li>
#else
<li><a href="$h.url_for('/history_store')" target="galaxy_main">Store</a> this history for later</li>
#end if
<li><a href="$h.url_for('/history_available')" target="galaxy_main">View</a> previously stored histories</li>
#if $len( $history.active_datasets ) > 0 and $history.user not in [ None , "" ]:
<li><a href="$h.url_for('/history_new')">Create</a> a new empty history</li>
#end if
#if $app.config.enable_beta_features
<li><a href="${h.url_for( controller='workflow', action='build_from_current_history' )}">Construct workflow</a> from the current history</li>
#end if
<li><a href="$h.url_for('/history_share')" target="galaxy_main">Share</a> current history</div>
#end if
<li><a href="$h.url_for('/history_delete', id=$history.id )" confirm="Are you sure you want to delete the current history?">Delete</a> current history</div>
</ul>
</body>
</html>
-27
View File
@@ -1,27 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Rename History</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>
<div class="toolForm">
<div class="toolFormTitle">Rename History</div>
<div class="toolFormBody">
<form action="$h.url_for('/history_rename')" method="post" >
<table>
<tr><th>Current Name</th><th>New Name</th></tr>
#for $history in $histories:
<tr><td>$history.name<input type="hidden" name="id" value="$history.id"></td><td><input type="text" name="name" value="$history.name" size="40"></td></tr>
#end for
<tr><td colspan="2"><input type="submit" name="history_rename_btn" value="Rename Histories"></td></tr>
</form>
</table>
</div>
</div>
</body>
</html>
-47
View File
@@ -1,47 +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="$h.url_for('/static/style/base.css')" rel="stylesheet" type="text/css">
</head>
<body>
#if $user
<div class="toolForm">
<div class="toolFormTitle">Share Histories</div>
<table>
<form action="$h.url_for('/history_share')" method="post" >
<tr><th>History Name:</td><th>Number of Datasets:</th><th>Share Link</th></tr>
#for $history in $histories:
<tr><td align="center">$history.name<input type="hidden" name="id" value="$history.id"></td><td align="center">
#if $len($history.datasets) < 1:
<div class="warningmessage">
This history contains no data.
</div>
#else:
$len($history.datasets)
#end if
</td>
<td align="center"><a href="$h.url_for('/history_import', id=$history.id )">copy link to share</a></td>
</tr>
#end for
<tr><td>Email of User to share with:</td><td><input type="text" name="email" value="$email" size="40"></td></tr>
#if $send_to_err:
<tr><td colspan="100%"><div class="errormessage">$send_to_err</div></td></tr>
#end if
<tr><td colspan="2" align="right"><input type="submit" name="history_share_btn" value="Submit"></td></tr>
</form>
</table>
#else
<div class="errormessage">
You must be logged in to send histories to other users.
</div>
#end if
</body>
</html>
-23
View File
@@ -1,23 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> User Create </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>
<div class="toolForm">
<div class="toolFormTitle">Store current history</div>
<div class="toolFormBody">
<form action="$h.url_for('/history_store')" method="post" >
<table>
<tr><td>History name:</td><td><input type="text" name="name" value="" size="40"></td></tr>
<tr><td></td><td><input type="submit" value="Store"></td></tr>
</table>
</form>
</div>
</div>
</body>
</html>
-45
View File
@@ -1,45 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> Switch History </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>
#set $user = $t.user
#set $history = $t.history
#if $user
#if $history.user is None and $history.datasets
<div class="warningmessage">
Your current history has not been <a href="$h.url_for('/history_store')">stored</a>
and will be lost if you switch to another history.
</div>
#end if
#if $user.histories
<h1>Stored Histories</h1>
<table class="colored" border="0" cellspacing="0" cellpadding="0" width="100%">
<tr class="header"><td>Name</td><td># datasets<td>created</td><td></td></tr>
#for $history in $user.histories:
#if not( $history.deleted )
<tr><td>$history.name </td><td>${len(history.datasets)}<td>$history.create_time</td><td><a href="$h.url_for('history_switch', id=$history.id )">switch to</a></td></tr>
#end if
#end for
</table>
#else
You have no stored histories
#end if
#else
<div class="errormessage">
You must be logged in to store and switch histories
</div>
#end if
</body>
</html>