# HG changeset patch -- Bitbucket.org # Project galaxy-dist # URL http://bitbucket.org/galaxy/galaxy-dist/overview # User jeremy goecks <jeremy.goecks@emory.edu> # Date 1287773333 14400 # Node ID f72f73aa68da51e0b5aebc063b11fa7f0b78a261 # Parent 8c1b6b3f706134b1e4ba21637f6a3b8ca5e00b67 Enable FormBuilder to accept and use parameter 'use_panels' in order to show panels. This enables forms built with FormBuilder to include Galaxy header. Use this new functionality to show headers for all workflow forms: create, rename, and import/upload. --- a/lib/galaxy/web/controllers/workflow.py +++ b/lib/galaxy/web/controllers/workflow.py @@ -391,7 +391,8 @@ class WorkflowController( BaseController #message = "Workflow renamed to '%s'." % new_name #return self.list_grid( trans, message=message, status='done' ) else: - return form( url_for( action='rename', id=trans.security.encode_id(stored.id) ), "Rename workflow", submit_text="Rename" ) \ + return form( url_for( action='rename', id=trans.security.encode_id(stored.id) ), + "Rename workflow", submit_text="Rename", use_panels=True ) \ .add_text( "new_name", "Workflow Name", value=to_unicode( stored.name ) ) @web.expose @@ -638,7 +639,7 @@ class WorkflowController( BaseController trans.set_message( "Workflow '%s' created" % stored_workflow.name ) return self.list( trans ) else: - return form( url_for(), "Create New Workflow", submit_text="Create" ) \ + return form( url_for(), "Create New Workflow", submit_text="Create", use_panels=True ) \ .add_text( "workflow_name", "Workflow Name", value="Unnamed workflow" ) \ .add_text( "workflow_annotation", "Workflow Annotation", value="", help="A description of the workflow; annotation is shown alongside shared or published workflows." ) @@ -1056,7 +1057,7 @@ class WorkflowController( BaseController @web.expose def import_workflow( self, trans, workflow_text=None, url=None ): if workflow_text is None and url is None: - return form( url_for(), "Import Workflow", submit_text="Import" ) \ + return form( url_for(), "Import Workflow", submit_text="Import", use_panels=True ) \ .add_text( "url", "URL to load workflow from", "" ) \ .add_input( "textarea", "Encoded workflow (as generated by export workflow)", "workflow_text", "" ) if url: --- a/lib/galaxy/web/framework/__init__.py +++ b/lib/galaxy/web/framework/__init__.py @@ -631,8 +631,9 @@ class GalaxyWebTransaction( base.Default """ Convenience method for displaying a simple page with a single HTML form. - """ - return self.fill_template( template, form=form, header=header, use_panels=use_panels, active_view=active_view ) + """ + return self.fill_template( template, form=form, header=header, use_panels=( form.use_panels or use_panels ), + active_view=active_view ) def fill_template(self, filename, **kwargs): """ Fill in a template, putting any keyword arguments on the context. @@ -725,12 +726,13 @@ class FormBuilder( object ): """ Simple class describing an HTML form """ - def __init__( self, action="", title="", name="form", submit_text="submit" ): + def __init__( self, action="", title="", name="form", submit_text="submit", use_panels=False ): self.title = title self.name = name self.action = action self.submit_text = submit_text self.inputs = [] + self.use_panels = use_panels def add_input( self, type, name, label, value=None, error=None, help=None, use_label=True ): self.inputs.append( FormInput( type, label, name, value, error, help, use_label ) ) return self