[hg] galaxy 3787: Fixes for editing tool information and submitt...
details: http://www.bx.psu.edu/hg/galaxy/rev/9ab8480354c7 changeset: 3787:9ab8480354c7 user: Greg Von Kuster <greg@bx.psu.edu> date: Fri May 14 11:25:03 2010 -0400 description: Fixes for editing tool information and submitting a tool for approval in the community space. diffstat: lib/galaxy/webapps/community/controllers/common.py | 13 +++++++++ lib/galaxy/webapps/community/datatypes/__init__.py | 2 +- templates/webapps/community/tool/edit_tool.mako | 30 +++++++++++----------- 3 files changed, 29 insertions(+), 16 deletions(-) diffs (100 lines): diff -r 48432330228e -r 9ab8480354c7 lib/galaxy/webapps/community/controllers/common.py --- a/lib/galaxy/webapps/community/controllers/common.py Fri May 14 10:37:36 2010 -0400 +++ b/lib/galaxy/webapps/community/controllers/common.py Fri May 14 11:25:03 2010 -0400 @@ -43,6 +43,19 @@ message=message, status='done' ) ) elif params.get( 'approval_button', False ): + if params.get( 'in_categories', False ): + in_categories = [ trans.sa_session.query( trans.app.model.Category ).get( x ) for x in util.listify( params.in_categories ) ] + trans.app.security_agent.set_entity_category_associations( tools=[ tool ], categories=in_categories ) + else: + # There must not be any categories associated with the tool + trans.app.security_agent.set_entity_category_associations( tools=[ tool ], categories=[] ) + user_description = util.restore_text( params.get( 'user_description', '' ) ) + if user_description: + tool.user_description = user_description + else: + tool.user_description = '' + trans.sa_session.add( tool ) + trans.sa_session.flush() # Move the state from NEW to WAITING event = trans.app.model.Event( state=trans.app.model.Tool.states.WAITING ) tea = trans.app.model.ToolEventAssociation( tool, event ) diff -r 48432330228e -r 9ab8480354c7 lib/galaxy/webapps/community/datatypes/__init__.py --- a/lib/galaxy/webapps/community/datatypes/__init__.py Fri May 14 10:37:36 2010 -0400 +++ b/lib/galaxy/webapps/community/datatypes/__init__.py Fri May 14 11:25:03 2010 -0400 @@ -122,7 +122,7 @@ raise DatatypeVerificationError( 'Tool XML file does not conform to the specification. Missing required <tool> tag attribute: %s' % e ) rval.description = '' desc_tag = root.find( 'description' ) - if desc_tag: + if desc_tag is not None: description = desc_tag.text if description: rval.description = description.strip() diff -r 48432330228e -r 9ab8480354c7 templates/webapps/community/tool/edit_tool.mako --- a/templates/webapps/community/tool/edit_tool.mako Fri May 14 10:37:36 2010 -0400 +++ b/templates/webapps/community/tool/edit_tool.mako Fri May 14 11:25:03 2010 -0400 @@ -16,6 +16,13 @@ $(function(){ $("input:text:first").focus(); }) + function confirmSubmit() { + if ( confirm( "After you have submitted your tool to be published, you will no longer be able to modify it. Click OK to submit it." ) ) { + return true; + } else { + return false; + } + } </script> </%def> @@ -89,9 +96,6 @@ %endif <div style="clear: both"></div> </div> - <div class="form-row"> - <input type="submit" id="edit_tool_button" name="edit_tool_button" value="Save"> - </div> </div> </div> <p/> @@ -115,29 +119,25 @@ </div> </div> </div> - </form> - <p/> - <div class="toolForm"> + <p/> %if tool.is_new(): - <div class="toolFormTitle">Get approval for publishing</div> - <div class="toolFormBody"> - <form name="get_approval" id="get_approval" action="${h.url_for( controller='common', action='edit_tool' )}" method="post" > - <input type="hidden" name="id" value="${trans.app.security.encode_id( tool.id )}"/> - <input type="hidden" name="cntrller" value="${cntrller}"/> + <div class="toolForm"> + <div class="toolFormTitle">Get approval for publishing</div> + <div class="toolFormBody"> <div class="form-row"> - <input type="submit" name="approval_button" value="Submit for approval"/> + <input type="submit" name="approval_button" id="approval_button" value="Submit for approval" onClick="return confirmSubmit()" /> </div> <div class="form-row"> <div class="toolParamHelp" style="clear: both;"> Tools must be approved before they are made available to others in the community. After you have submitted your tool to be published, you will no longer be able to modify it, so make sure the information above is - correct and and save any changes before submitting for approval. + correct before submitting for approval. </div> </div> - </form> + </div> </div> %endif - </div> + </form> %else: ${render_msg( "You are not allowed to edit this tool", "error" )} %endif
participants (1)
-
Nate Coraor