details: http://www.bx.psu.edu/hg/galaxy/rev/96ec861b4b6e changeset: 3529:96ec861b4b6e user: jeremy goecks <jeremy.goecks@emory.edu> date: Sun Mar 14 11:49:44 2010 -0400 description: Make the login/register/logout sequence more user friendly. Specific changes: (a) use panels so that Galaxy masthead is always available; (b) provide links to guide users past login; (c) enable 'user' to be an active view; (d) updated functional tests. diffstat: lib/galaxy/web/controllers/dataset.py | 4 +- lib/galaxy/web/controllers/user.py | 28 ++- lib/galaxy/web/controllers/visualization.py | 2 +- lib/galaxy/web/controllers/workflow.py | 8 +- lib/galaxy/web/framework/__init__.py | 26 +- templates/base_panels.mako | 14 +- templates/display_base.mako | 12 +- templates/form.mako | 115 ++++++++++------ templates/history/list_published.mako | 2 +- templates/message.mako | 3 +- templates/page/list_published.mako | 2 +- templates/user/register.mako | 162 ++++++++++++---------- templates/visualization/list_published.mako | 2 +- templates/workflow/list.mako | 193 +++++++++++++++------------ templates/workflow/list_published.mako | 2 +- test/base/twilltestcase.py | 11 +- 16 files changed, 329 insertions(+), 257 deletions(-) diffs (900 lines): diff -r 48e83411aa91 -r 96ec861b4b6e lib/galaxy/web/controllers/dataset.py --- a/lib/galaxy/web/controllers/dataset.py Fri Mar 12 16:11:26 2010 -0500 +++ b/lib/galaxy/web/controllers/dataset.py Sun Mar 14 11:49:44 2010 -0400 @@ -436,8 +436,8 @@ # Do import. cur_history = trans.get_history( create=True ) status, message = self._copy_datasets( trans, [ dataset_id ], [ cur_history ] ) - message = message + "<br>You can <a href='%s'>start using the dataset</a> or %s." % ( url_for('/'), referer_message ) - return trans.show_message( message, type=status ) + message = "Dataset imported. <br>You can <a href='%s'>start using the dataset</a> or %s." % ( url_for('/'), referer_message ) + return trans.show_message( message, type=status, use_panels=True ) @web.expose @web.json diff -r 48e83411aa91 -r 96ec861b4b6e lib/galaxy/web/controllers/user.py --- a/lib/galaxy/web/controllers/user.py Fri Mar 12 16:11:26 2010 -0500 +++ b/lib/galaxy/web/controllers/user.py Sun Mar 14 11:49:44 2010 -0400 @@ -115,9 +115,14 @@ you share publicly. Usernames must be at least four characters in length and contain only lowercase letters, numbers, and the '-' character.""" ) ) + @web.expose - def login( self, trans, email='', password='' ): + def login( self, trans, email='', password='', referer='', use_panels='True' ): email_error = password_error = None + + # Convert use_panels to Boolean. + use_panels = use_panels in [ 'True', 'true', 't', 'T' ] + # Attempt login if trans.app.config.require_login: refresh_frames = [ 'masthead', 'history', 'tools' ] @@ -136,21 +141,23 @@ else: trans.handle_user_login( user ) trans.log_event( "User logged in" ) - msg = "Now logged in as " + user.email + "." + msg = "You are now logged in as %s.<br>You can <a href='%s'>go back to the page you were visiting</a> or <a href='%s'>go to the Galaxy homepage</a>." % ( user.email, referer, url_for( '/' ) ) if trans.app.config.require_login: msg += ' <a href="%s">Click here</a> to continue to the front page.' % web.url_for( '/static/welcome.html' ) - return trans.show_ok_message( msg, refresh_frames=refresh_frames ) + return trans.show_ok_message( msg, refresh_frames=refresh_frames, use_panels=use_panels, active_view="user" ) form = web.FormBuilder( web.url_for(), "Login", submit_text="Login" ) \ .add_text( "email", "Email address", value=email, error=email_error ) \ .add_password( "password", "Password", value='', error=password_error, - help="<a href='%s'>Forgot password? Reset here</a>" % web.url_for( action='reset_password' ) ) + help="<a href='%s'>Forgot password? Reset here</a>" % web.url_for( action='reset_password' ) ) \ + .add_input( "hidden", "referer", "referer", value=trans.request.referer, use_label=False ) if trans.app.config.require_login: if trans.app.config.allow_user_creation: - return trans.show_form( form, header = require_login_creation_template % web.url_for( action = 'create' ) ) + return trans.show_form( form, header = require_login_creation_template % web.url_for( action = 'create' ), use_panels=use_panels, active_view="user" ) else: - return trans.show_form( form, header = require_login_nocreation_template ) + return trans.show_form( form, header = require_login_nocreation_template, use_panels=use_panels, active_view="user" ) else: - return trans.show_form( form ) + return trans.show_form( form, use_panels=use_panels, active_view="user" ) + @web.expose def logout( self, trans ): if trans.app.config.require_login: @@ -160,10 +167,11 @@ # Since logging an event requires a session, we'll log prior to ending the session trans.log_event( "User logged out" ) trans.handle_user_logout() - msg = "You are no longer logged in." + msg = "You have been logged out.<br>You can <a href='%s'>go back to the page you were visiting</a> or <a href='%s'>go to the Galaxy homepage</a>." % ( trans.request.referer, url_for( '/' ) ) if trans.app.config.require_login: msg += ' <a href="%s">Click here</a> to return to the login page.' % web.url_for( controller='user', action='login' ) - return trans.show_ok_message( msg, refresh_frames=refresh_frames ) + return trans.show_ok_message( msg, refresh_frames=refresh_frames, use_panels=True, active_view="user" ) + @web.expose def create( self, trans, **kwd ): params = util.Params( kwd ) @@ -217,7 +225,7 @@ trans.log_event( "User created a new account" ) trans.log_event( "User logged in" ) # subscribe user to email list - return trans.show_ok_message( "Now logged in as " + user.email, refresh_frames=refresh_frames ) + return trans.show_ok_message( "Now logged in as %s.<br><a href='%s'>Return to the Galaxy start page.</a>" % ( user.email, url_for( '/' ) ), refresh_frames=refresh_frames, use_panels=True ) else: trans.response.send_redirect( web.url_for( controller='admin', action='users', diff -r 48e83411aa91 -r 96ec861b4b6e lib/galaxy/web/controllers/visualization.py --- a/lib/galaxy/web/controllers/visualization.py Fri Mar 12 16:11:26 2010 -0500 +++ b/lib/galaxy/web/controllers/visualization.py Sun Mar 14 11:49:44 2010 -0400 @@ -75,7 +75,7 @@ return trans.fill_template( "visualization/list_published.mako", grid=grid ) @web.expose - @web.require_login("use Galaxy visualizations") + @web.require_login( "use Galaxy visualizations", use_panels=True ) def list( self, trans, *args, **kwargs ): # Handle operation if 'operation' in kwargs and 'id' in kwargs: diff -r 48e83411aa91 -r 96ec861b4b6e lib/galaxy/web/controllers/workflow.py --- a/lib/galaxy/web/controllers/workflow.py Fri Mar 12 16:11:26 2010 -0500 +++ b/lib/galaxy/web/controllers/workflow.py Sun Mar 14 11:49:44 2010 -0400 @@ -85,7 +85,7 @@ @web.expose def index( self, trans ): - return trans.fill_template( "workflow/index.mako" ) + return self.list( trans ) @web.expose @web.require_login( "use Galaxy workflows" ) @@ -102,7 +102,7 @@ return self.stored_list_grid( trans, **kwargs ) @web.expose - @web.require_login( "use Galaxy workflows" ) + @web.require_login( "use Galaxy workflows", use_panels=True ) def list( self, trans ): """ Render workflow main page (management of existing workflows) @@ -276,7 +276,7 @@ item=stored ) @web.expose - @web.require_login( "use Galaxy workflows" ) + @web.require_login( "to import a workflow", use_panels=True ) def imp( self, trans, id, **kwargs ): # Set referer message. referer = trans.request.referer @@ -284,7 +284,7 @@ referer_message = "<a href='%s'>return to the previous page</a>" % referer else: referer_message = "<a href='%s'>go to Galaxy's start page</a>" % url_for( '/' ) - + # Do import. session = trans.sa_session stored = self.get_stored_workflow( trans, id, check_ownership=False ) diff -r 48e83411aa91 -r 96ec861b4b6e lib/galaxy/web/framework/__init__.py --- a/lib/galaxy/web/framework/__init__.py Fri Mar 12 16:11:26 2010 -0500 +++ b/lib/galaxy/web/framework/__init__.py Sun Mar 14 11:49:44 2010 -0400 @@ -65,15 +65,15 @@ decorator.exposed = True return decorator -def require_login( verb="perform this action" ): +def require_login( verb="perform this action", use_panels=False ): 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 ) ) + "You must be <a target='_top' href='%s'>logged in</a> to %s</div>." + % ( url_for( controller='user', action='login' ), verb ), use_panels=use_panels ) return decorator return argcatcher @@ -561,7 +561,7 @@ context. """ return self.template_context['message'] - def show_message( self, message, type='info', refresh_frames=[], cont=None, use_panels=False ): + def show_message( self, message, type='info', refresh_frames=[], cont=None, use_panels=False, active_view="" ): """ Convenience method for displaying a simple page with a single message. @@ -571,28 +571,28 @@ `refresh_frames`: names of frames in the interface that should be refreshed when the message is displayed """ - return self.fill_template( "message.mako", message_type=type, message=message, refresh_frames=refresh_frames, cont=cont, use_panels=use_panels ) - def show_error_message( self, message, refresh_frames=[], use_panels=False ): + return self.fill_template( "message.mako", message_type=type, message=message, refresh_frames=refresh_frames, cont=cont, use_panels=use_panels, active_view=active_view ) + def show_error_message( self, message, refresh_frames=[], use_panels=False, active_view="" ): """ Convenience method for displaying an error message. See `show_message`. """ - return self.show_message( message, 'error', refresh_frames, use_panels=use_panels ) - def show_ok_message( self, message, refresh_frames=[], use_panels=False ): + return self.show_message( message, 'error', refresh_frames, use_panels=use_panels, active_view=active_view ) + def show_ok_message( self, message, refresh_frames=[], use_panels=False, active_view="" ): """ Convenience method for displaying an ok message. See `show_message`. """ - return self.show_message( message, 'done', refresh_frames, use_panels=use_panels ) - def show_warn_message( self, message, refresh_frames=[], use_panels=False ): + return self.show_message( message, 'done', refresh_frames, use_panels=use_panels, active_view=active_view ) + def show_warn_message( self, message, refresh_frames=[], use_panels=False, active_view="" ): """ Convenience method for displaying an warn message. See `show_message`. """ - return self.show_message( message, 'warning', refresh_frames, use_panels=use_panels ) - def show_form( self, form, header=None, template="form.mako" ): + return self.show_message( message, 'warning', refresh_frames, use_panels=use_panels, active_view=active_view ) + def show_form( self, form, header=None, template="form.mako", use_panels=False, active_view="" ): """ Convenience method for displaying a simple page with a single HTML form. """ - return self.fill_template( template, form=form, header=header ) + return self.fill_template( template, form=form, header=header, use_panels=use_panels, active_view=active_view ) def fill_template(self, filename, **kwargs): """ Fill in a template, putting any keyword arguments on the context. diff -r 48e83411aa91 -r 96ec861b4b6e templates/base_panels.mako --- a/templates/base_panels.mako Fri Mar 12 16:11:26 2010 -0500 +++ b/templates/base_panels.mako Sun Mar 14 11:49:44 2010 -0400 @@ -227,7 +227,13 @@ </div> </td> - <td class="tab"> + ## User tab. + <% + cls = "tab" + if self.active_view == 'user': + cls += " active" + %> + <td class="${cls}"> <a>User</a> <% if trans.user: @@ -241,9 +247,9 @@ %> <div class="submenu"> <ul class="loggedout-only" style="${style1}"> - <li><a target="galaxy_main" href="${h.url_for( controller='/user', action='login' )}">Login</a></li> + <li><a href="${h.url_for( controller='/user', action='login' )}">Login</a></li> %if app.config.allow_user_creation: - <li><a target="galaxy_main" href="${h.url_for( controller='/user', action='create' )}">Register</a></li> + <li><a href="${h.url_for( controller='/user', action='create' )}">Register</a></li> %endif </ul> <ul class="loggedin-only" style="${style2}"> @@ -259,7 +265,7 @@ logout_target = "" logout_url = h.url_for( controller='/root', action='index', m_c='user', m_a='logout' ) else: - logout_target = "galaxy_main" + logout_target = "" logout_url = h.url_for( controller='/user', action='logout' ) %> <li><a target="${logout_target}" href="${logout_url}">Logout</a></li> diff -r 48e83411aa91 -r 96ec861b4b6e templates/display_base.mako --- a/templates/display_base.mako Fri Mar 12 16:11:26 2010 -0500 +++ b/templates/display_base.mako Sun Mar 14 11:49:44 2010 -0400 @@ -216,11 +216,13 @@ %endif </div> ## Individual tags. - <p> - <div> - Yours: - ${render_individual_tagging_element( user=trans.get_user(), tagged_item=item, elt_context='view.mako', use_toggle_link=False, tag_click_fn='community_tag_click' )} - </div> + %if trans.get_user(): + <p> + <div> + Yours: + ${render_individual_tagging_element( user=trans.get_user(), tagged_item=item, elt_context='view.mako', use_toggle_link=False, tag_click_fn='community_tag_click' )} + </div> + %endif </div> </div> </div> diff -r 48e83411aa91 -r 96ec861b4b6e templates/form.mako --- a/templates/form.mako Fri Mar 12 16:11:26 2010 -0500 +++ b/templates/form.mako Sun Mar 14 11:49:44 2010 -0400 @@ -1,54 +1,83 @@ +<%! + def inherit(context): + if context.get('use_panels') is True: + print "here" + return '/base_panels.mako' + else: + return '/base.mako' +%> +<%inherit file="${inherit(context)}"/> <% _=n_ %> -<%inherit file="/base.mako"/> + +<%def name="init()"> +<% + self.has_left_panel=False + self.has_right_panel=False + self.active_view=active_view + self.message_box_visible=False +%> +</%def> + + <%def name="title()">${form.title}</%def> <%def name="javascripts()"> -${parent.javascripts()} -<script type="text/javascript"> -$(function(){ - $("input:text:first").focus(); -}) -</script> + ${parent.javascripts()} + <script type="text/javascript"> + $(function(){ + $("input:text:first").focus(); + }) + </script> </%def> -%if header: - ${header} -%endif +<%def name="center_panel()"> + ${render_form( )} +</%def> -<div class="form"> - <div class="form-title">${form.title}</div> - <div class="form-body"> - <form name="${form.name}" action="${form.action}" method="post" > - %for input in form.inputs: - <% - cls = "form-row" - if input.error: - cls += " form-row-error" - %> - <div class="${cls}"> - %if input.use_label: - <label> - ${_(input.label)}: - </label> - %endif - <div class="form-row-input"> - <input type="${input.type}" name="${input.name}" value="${input.value}" size="40"> - </div> - %if input.error: - <div class="form-row-error-message">${input.error}</div> - %endif - %if input.help: - <div class="toolParamHelp" style="clear: both;"> - ${input.help} - </div> - %endif +<%def name="body()"> + ${render_form( )} +</%def> + +<%def name="render_form()"> + %if header: + ${header} + %endif - <div style="clear: both"></div> + <div class="form" style="margin: 1em"> + <div class="form-title">${form.title}</div> + <div class="form-body"> + <form name="${form.name}" action="${form.action}" method="post" > + %for input in form.inputs: + <% + cls = "form-row" + if input.error: + cls += " form-row-error" + %> + <div class="${cls}"> + %if input.use_label: + <label> + ${_(input.label)}: + </label> + %endif + <div class="form-row-input"> + <input type="${input.type}" name="${input.name}" value="${input.value}" size="40"> + </div> + %if input.error: + <div class="form-row-error-message">${input.error}</div> + %endif + %if input.help: + <div class="toolParamHelp" style="clear: both;"> + ${input.help} + </div> + %endif - </div> - %endfor - <div class="form-row"><input type="submit" value="${form.submit_text}"></div> + <div style="clear: both"></div> - </form> + </div> + %endfor + <div class="form-row"><input type="submit" value="${form.submit_text}"></div> + + </form> + </div> </div> -</div> +</%def> \ No newline at end of file diff -r 48e83411aa91 -r 96ec861b4b6e templates/history/list_published.mako --- a/templates/history/list_published.mako Fri Mar 12 16:11:26 2010 -0500 +++ b/templates/history/list_published.mako Sun Mar 14 11:49:44 2010 -0400 @@ -10,7 +10,7 @@ </%def> <%def name="title()"> - Galaxy :: Published Histories + Galaxy | Published Histories </%def> <%def name="stylesheets()"> diff -r 48e83411aa91 -r 96ec861b4b6e templates/message.mako --- a/templates/message.mako Fri Mar 12 16:11:26 2010 -0500 +++ b/templates/message.mako Sun Mar 14 11:49:44 2010 -0400 @@ -1,6 +1,6 @@ <%! def inherit(context): - if context.get('use_panels'): + if context.get('use_panels') is True: return '/base_panels.mako' else: return '/base.mako' @@ -69,7 +69,6 @@ ${render_large_message( message, message_type )} </%def> -## Render the grid's basic elements. Each of these elements can be subclassed. <%def name="body()"> ${render_large_message( message, message_type )} </%def> diff -r 48e83411aa91 -r 96ec861b4b6e templates/page/list_published.mako --- a/templates/page/list_published.mako Fri Mar 12 16:11:26 2010 -0500 +++ b/templates/page/list_published.mako Sun Mar 14 11:49:44 2010 -0400 @@ -10,7 +10,7 @@ </%def> <%def name="title()"> - Galaxy :: Published Pages + Galaxy | Published Pages </%def> <%def name="stylesheets()"> diff -r 48e83411aa91 -r 96ec861b4b6e templates/user/register.mako --- a/templates/user/register.mako Fri Mar 12 16:11:26 2010 -0500 +++ b/templates/user/register.mako Sun Mar 14 11:49:44 2010 -0400 @@ -1,87 +1,99 @@ -<%inherit file="/base.mako"/> +<%inherit file="/base_panels.mako"/> <%namespace file="/message.mako" import="render_msg" /> +<%def name="init()"> +<% + self.has_left_panel=False + self.has_right_panel=False + self.active_view="user" + self.message_box_visible=False +%> +</%def> -%if msg: - ${render_msg( msg, messagetype )} -%endif - - - -<script type="text/javascript"> -$( function() { - $( "select[refresh_on_change='true']").change( function() { - var refresh = false; - var refresh_on_change_values = $( this )[0].attributes.getNamedItem( 'refresh_on_change_values' ) - if ( refresh_on_change_values ) { - refresh_on_change_values = refresh_on_change_values.value.split( ',' ); - var last_selected_value = $( this )[0].attributes.getNamedItem( 'last_selected_value' ); - for( i= 0; i < refresh_on_change_values.length; i++ ) { - if ( $( this )[0].value == refresh_on_change_values[i] || ( last_selected_value && last_selected_value.value == refresh_on_change_values[i] ) ){ - refresh = true; - break; +<%def name="javascripts()"> + ${parent.javascripts()} + <script type="text/javascript"> + $( function() { + $( "select[refresh_on_change='true']").change( function() { + var refresh = false; + var refresh_on_change_values = $( this )[0].attributes.getNamedItem( 'refresh_on_change_values' ) + if ( refresh_on_change_values ) { + refresh_on_change_values = refresh_on_change_values.value.split( ',' ); + var last_selected_value = $( this )[0].attributes.getNamedItem( 'last_selected_value' ); + for( i= 0; i < refresh_on_change_values.length; i++ ) { + if ( $( this )[0].value == refresh_on_change_values[i] || ( last_selected_value && last_selected_value.value == refresh_on_change_values[i] ) ){ + refresh = true; + break; + } } } - } - else { - refresh = true; - } - if ( refresh ){ - $( "#registration" ).submit(); - } + else { + refresh = true; + } + if ( refresh ){ + $( "#registration" ).submit(); + } + }); }); -}); -</script> + </script> -<div class="toolForm"> - <form name="registration" id="registration" action="${h.url_for( controller='user', action='create', admin_view=admin_view )}" method="post" > - <div class="toolFormTitle">Create account</div> - <div class="form-row"> - <label>Email</label> - ${login_info[ 'Email' ].get_html()} - </div> - <div class="form-row"> - <label>Password</label> - ${login_info[ 'Password' ].get_html()} - </div> - <div class="form-row"> - <label>Confirm</label> - ${login_info[ 'Confirm' ].get_html()} - </div> - <div class="form-row"> - <label>Public Username</label> - ${login_info[ 'Public Username' ].get_html()} - <div class="toolParamHelp" style="clear: both;"> - Optional +</%def> + +<%def name="center_panel()"> + %if msg: + ${render_msg( msg, messagetype )} + %endif + + <div class="toolForm" style="margin: 1em"> + <form name="registration" id="registration" action="${h.url_for( controller='user', action='create', admin_view=admin_view )}" method="post" > + <div class="toolFormTitle">Create account</div> + <div class="form-row"> + <label>Email</label> + ${login_info[ 'Email' ].get_html()} </div> - </div> - <div class="form-row"> - <label>Subscribe To Mailing List</label> - ${login_info[ 'Subscribe To Mailing List' ].get_html()} - </div> - %if user_info_select: <div class="form-row"> - <label>User type</label> - ${user_info_select.get_html()} + <label>Password</label> + ${login_info[ 'Password' ].get_html()} </div> - %endif - %if user_info_form: - %for field in widgets: + <div class="form-row"> + <label>Confirm Password</label> + ${login_info[ 'Confirm' ].get_html()} + </div> + <div class="form-row"> + <label>Public Username</label> + ${login_info[ 'Public Username' ].get_html()} + <div class="toolParamHelp" style="clear: both;"> + When you share or publish items, this name is shown as the author. + </div> + </div> + <div class="form-row"> + <label>Subscribe To Mailing List</label> + ${login_info[ 'Subscribe To Mailing List' ].get_html()} + </div> + %if user_info_select: <div class="form-row"> - <label>${field['label']}</label> - ${field['widget'].get_html()} - <div class="toolParamHelp" style="clear: both;"> - ${field['helptext']} + <label>User type</label> + ${user_info_select.get_html()} + </div> + %endif + %if user_info_form: + %for field in widgets: + <div class="form-row"> + <label>${field['label']}</label> + ${field['widget'].get_html()} + <div class="toolParamHelp" style="clear: both;"> + ${field['helptext']} + </div> + <div style="clear: both"></div> </div> - <div style="clear: both"></div> - </div> - %endfor - %if not user_info_select: - <input type="hidden" name="user_info_select" value="${user_info_form.id}"/> - %endif - %endif - <div class="form-row"> - <input type="submit" name="create_user_button" value="Submit"> - </div> - </form> -</div> \ No newline at end of file + %endfor + %if not user_info_select: + <input type="hidden" name="user_info_select" value="${user_info_form.id}"/> + %endif + %endif + <div class="form-row"> + <input type="submit" name="create_user_button" value="Submit"> + </div> + </form> + </div> +</%def> \ No newline at end of file diff -r 48e83411aa91 -r 96ec861b4b6e templates/visualization/list_published.mako --- a/templates/visualization/list_published.mako Fri Mar 12 16:11:26 2010 -0500 +++ b/templates/visualization/list_published.mako Sun Mar 14 11:49:44 2010 -0400 @@ -10,7 +10,7 @@ </%def> <%def name="title()"> - Galaxy :: Published Visualizations + Galaxy | Published Visualizations </%def> <%def name="stylesheets()"> diff -r 48e83411aa91 -r 96ec861b4b6e templates/workflow/list.mako --- a/templates/workflow/list.mako Fri Mar 12 16:11:26 2010 -0500 +++ b/templates/workflow/list.mako Sun Mar 14 11:49:44 2010 -0400 @@ -1,103 +1,118 @@ -<%inherit file="/base.mako"/> +<%inherit file="/base_panels.mako"/> + +<%def name="init()"> +<% + self.has_left_panel=False + self.has_right_panel=False + self.active_view="workflow" + self.message_box_visible=False +%> +</%def> <%def name="title()">Workflow home</%def> -%if message: -<% - try: - messagetype - except: - messagetype = "done" -%> -<p /> -<div class="${messagetype}message"> - ${message} -</div> -%endif +<%def name="center_panel()"> + <div style="overflow: auto; height: 100%;"> + <div class="page-container" style="padding: 10px;"> + %if message: + <% + try: + messagetype + except: + messagetype = "done" + %> + <p /> + <div class="${messagetype}message"> + ${message} + </div> + %endif -<h2>Your workflows</h2> + <h2>Your workflows</h2> -<ul class="manage-table-actions"> - <li> - <a class="action-button" href="${h.url_for( action='create' )}"> - <img src="${h.url_for('/static/images/silk/add.png')}" /> - <span>Create new workflow</span> - </a> - </li> -</ul> + <ul class="manage-table-actions"> + <li> + <a class="action-button" href="${h.url_for( action='create' )}"> + <img src="${h.url_for('/static/images/silk/add.png')}" /> + <span>Create new workflow</span> + </a> + </li> + </ul> -%if workflows: - <table class="manage-table colored" border="0" cellspacing="0" cellpadding="0" style="width:100%;"> - <tr class="header"> - <th>Name</th> - <th># of Steps</th> - ## <th>Last Updated</th> - <th></th> - </tr> - %for i, workflow in enumerate( workflows ): - <tr> - <td> - <div class="menubutton" style="float: left;" id="wf-${i}-popup"> - ${workflow.name | h} - </div> - </td> - <td>${len(workflow.latest_workflow.steps)}</td> - ## <td>${str(workflow.update_time)[:19]}</td> - <td> - <div popupmenu="wf-${i}-popup"> - <a class="action-button" href="${h.url_for( action='editor', id=trans.security.encode_id(workflow.id) )}" target="_parent">Edit</a> - <a class="action-button" href="${h.url_for( controller='root', action='index', workflow_id=trans.security.encode_id(workflow.id) )}" target="_parent">Run</a> - <a class="action-button" href="${h.url_for( action='sharing', id=trans.security.encode_id(workflow.id) )}">Share or Publish</a> - <a class="action-button" href="${h.url_for( action='clone', id=trans.security.encode_id(workflow.id) )}">Clone</a> - <a class="action-button" href="${h.url_for( action='rename', id=trans.security.encode_id(workflow.id) )}">Rename</a> - <a class="action-button" confirm="Are you sure you want to delete workflow '${workflow.name}'?" href="${h.url_for( action='delete', id=trans.security.encode_id(workflow.id) )}">Delete</a> - </div> - </td> - </tr> - %endfor - </table> -%else: + %if workflows: + <table class="manage-table colored" border="0" cellspacing="0" cellpadding="0" style="width:100%;"> + <tr class="header"> + <th>Name</th> + <th># of Steps</th> + ## <th>Last Updated</th> + <th></th> + </tr> + %for i, workflow in enumerate( workflows ): + <tr> + <td> + <div class="menubutton" style="float: left;" id="wf-${i}-popup"> + ${workflow.name | h} + </div> + </td> + <td>${len(workflow.latest_workflow.steps)}</td> + ## <td>${str(workflow.update_time)[:19]}</td> + <td> + <div popupmenu="wf-${i}-popup"> + <a class="action-button" href="${h.url_for( action='editor', id=trans.security.encode_id(workflow.id) )}" target="_parent">Edit</a> + <a class="action-button" href="${h.url_for( controller='root', action='index', workflow_id=trans.security.encode_id(workflow.id) )}" target="_parent">Run</a> + <a class="action-button" href="${h.url_for( action='sharing', id=trans.security.encode_id(workflow.id) )}">Share or Publish</a> + <a class="action-button" href="${h.url_for( action='clone', id=trans.security.encode_id(workflow.id) )}">Clone</a> + <a class="action-button" href="${h.url_for( action='rename', id=trans.security.encode_id(workflow.id) )}">Rename</a> + <a class="action-button" confirm="Are you sure you want to delete workflow '${workflow.name}'?" href="${h.url_for( action='delete', id=trans.security.encode_id(workflow.id) )}">Delete</a> + </div> + </td> + </tr> + %endfor + </table> + %else: - You have no workflows. + You have no workflows. -%endif + %endif -<h2>Workflows shared with you by others</h2> + <h2>Workflows shared with you by others</h2> -%if shared_by_others: - <table class="colored" border="0" cellspacing="0" cellpadding="0" width="100%"> - <tr class="header"> - <th>Name</th> - <th>Owner</th> - <th># of Steps</th> - <th></th> - </tr> - %for i, association in enumerate( shared_by_others ): - <% workflow = association.stored_workflow %> - <tr> - <td> - <a class="menubutton" id="shared-${i}-popup" href="${h.url_for( action='run', id=trans.security.encode_id(workflow.id) )}">${workflow.name | h}</a> - </td> - <td>${workflow.user.email}</td> - <td>${len(workflow.latest_workflow.steps)}</td> - <td> - <div popupmenu="shared-${i}-popup"> - <a class="action-button" href="${h.url_for( action='display_by_username_and_slug', username=workflow.user.username, slug=workflow.slug)}" target="_top">View</a> - <a class="action-button" href="${h.url_for( action='run', id=trans.security.encode_id(workflow.id) )}">Run</a> - <a class="action-button" href="${h.url_for( action='clone', id=trans.security.encode_id(workflow.id) )}">Clone</a> - </div> - </td> - </tr> - %endfor - </table> -%else: + %if shared_by_others: + <table class="colored" border="0" cellspacing="0" cellpadding="0" width="100%"> + <tr class="header"> + <th>Name</th> + <th>Owner</th> + <th># of Steps</th> + <th></th> + </tr> + %for i, association in enumerate( shared_by_others ): + <% workflow = association.stored_workflow %> + <tr> + <td> + <a class="menubutton" id="shared-${i}-popup" href="${h.url_for( action='run', id=trans.security.encode_id(workflow.id) )}">${workflow.name | h}</a> + </td> + <td>${workflow.user.email}</td> + <td>${len(workflow.latest_workflow.steps)}</td> + <td> + <div popupmenu="shared-${i}-popup"> + <a class="action-button" href="${h.url_for( action='display_by_username_and_slug', username=workflow.user.username, slug=workflow.slug)}" target="_top">View</a> + <a class="action-button" href="${h.url_for( action='run', id=trans.security.encode_id(workflow.id) )}">Run</a> + <a class="action-button" href="${h.url_for( action='clone', id=trans.security.encode_id(workflow.id) )}">Clone</a> + </div> + </td> + </tr> + %endfor + </table> + %else: - No workflows have been shared with you. + No workflows have been shared with you. -%endif + %endif -<h2>Other options</h2> + <h2>Other options</h2> -<a class="action-button" href="${h.url_for( action='configure_menu' )}"> - <span>Configure your workflow menu</span> -</a> \ No newline at end of file + <a class="action-button" href="${h.url_for( action='configure_menu' )}"> + <span>Configure your workflow menu</span> + </a> + </div> + </div> +</%def> \ No newline at end of file diff -r 48e83411aa91 -r 96ec861b4b6e templates/workflow/list_published.mako --- a/templates/workflow/list_published.mako Fri Mar 12 16:11:26 2010 -0500 +++ b/templates/workflow/list_published.mako Sun Mar 14 11:49:44 2010 -0400 @@ -10,7 +10,7 @@ </%def> <%def name="title()"> - Galaxy :: Published Workflows + Galaxy | Published Workflows </%def> <%def name="stylesheets()"> diff -r 48e83411aa91 -r 96ec861b4b6e test/base/twilltestcase.py --- a/test/base/twilltestcase.py Fri Mar 12 16:11:26 2010 -0500 +++ b/test/base/twilltestcase.py Sun Mar 14 11:49:44 2010 -0400 @@ -791,7 +791,7 @@ self.home() # Create user, setting username to email. self.visit_page( "user/create?email=%s&username=%s&password=%s&confirm=%s&create_user_button=Submit" % ( email, email, password, password ) ) - self.check_page_for_string( "Now logged in as %s" %email ) + self.check_page_for_string( "now logged in as %s" %email ) self.home() # Make sure a new private role was created for the user self.visit_page( "user/set_default_permissions" ) @@ -816,7 +816,7 @@ for index, info_value in enumerate(user_info_values): tc.fv( "1", "field_%i" % index, info_value ) tc.submit( "create_user_button" ) - self.check_page_for_string( "Now logged in as %s" % email ) + self.check_page_for_string( "now logged in as %s" % email ) def create_user_with_info_as_admin( self, email, password, username, user_info_forms, user_info_form_id, user_info_values ): ''' This method registers a new user and also provides use info as an admin @@ -906,16 +906,17 @@ self.create( email=email, password=password ) except: self.home() - self.visit_url( "%s/user/login" % self.url ) + # HACK: don't use panels because late_javascripts() messes up the twill browser and it can't find form fields (and hence user can't be logged in). + self.visit_url( "%s/user/login?use_panels=False" % self.url ) tc.fv( '1', 'email', email ) tc.fv( '1', 'password', password ) tc.submit( 'Login' ) - self.check_page_for_string( "Now logged in as %s" %email ) + self.check_page_for_string( "now logged in as %s" %email ) self.home() def logout( self ): self.home() self.visit_page( "user/logout" ) - self.check_page_for_string( "You are no longer logged in" ) + self.check_page_for_string( "You have been logged out" ) self.home() # Functions associated with browsers, cookies, HTML forms and page visits