How to add a launch page » History » Revision 8
Revision 7 (Amber Herold, 08/15/2012 11:05 AM) → Revision 8/16 (Amber Herold, 08/15/2012 11:07 AM)
h1. How to add a job launch page to the Appion pipeline # *Add a php page with the basic appion template* Most of our launch pages are php files with at leat 2 functions, one to create a form for the user to fill out, and another to build a job command when the user submits the form. You can copy an existing PHP file such as runSimple.php to create your new launch page. To give your page the Appion processing page look and feel with the header and side menu, be sure the functions processing_header($title,$heading,$javascript) and processing_footer() are called. # *Add a link to your page in the menuprocessing.php file or from another page* The menuprocessing file is a bit tricky to work with. # *Create a new form class for your package specific parameters* You can copy simpleParamsForm.inc as a template for your own form parameters. There are 2 primary functions to define. ## Define the constructor This is where all your parameters are listed. Values passed into the constructor become default values. Validations can be added to any of the parameters. ## Define the generateForm() function This function outputs html. There are many predefined parameter fields that can be used to build your form. # *Add pop-up help messages to help.js* Located at myami/myamiweb/processing/js/help.js. ## Add a new namespace for your form, you can copy the 'simple' section. Don't forget any commas. ## add a help string for each of the parameter keys in your form ## make sure $javascript .= writeJavaPopupFunctions(); is in your createForm() function in your php launch page prior to the processing header function. # *Add a publication reference for the package you are using* ## Edit /myami/myamiweb/processing/inc/publicationList.inc to include an entry for any references you need to add to your launch page. ## publications can be added to a page with the following code: <pre> $pub = new Publication('appion'); echo $pub->getHtmlTable(); //returns the html reference to the "appion" publication </pre> # *Use your new form class in your launch page* ## Modify the launch page *createForm()* createForm() function The create form function outputs the html needed for your form. The myami/myamiweb/processing/inc/forms directory holds reusable form classes based on the basicForm.inc class. Any combination of these can be used to add parameters to your form with little knowlege of html. You may also create a new form class to define the parameters specific to your job command. More on that later. ### Add a call to your form class generateForm() function, adding default values in the constructor. <pre> $simpleParamsForm = new SimpleParamsForm('','','','CHECKED','','','10','30','','20','100','2','2','10','','0.8','40','3','3'); echo $simpleParamsForm->generateForm(); </pre> ### Add a reference to your publication <pre> $pub = new Publication('appion'); echo $pub->getHtmlTable(); </pre> ## Modify the launch page *createCommand()* createCommand() function ### instantiate and validate your form parameters <pre> $simpleParamsForm = new SimpleParamsForm(); $errorMsg .= $simpleParamsForm->validate( $_POST ); </pre> ### Create your new command <pre> /* ******************* PART 2: Create program command ******************** */ $command = "runSimpleCluster.py "; // add run parameters $command .= $runParametersForm->buildCommand( $_POST ); // add simple parameters $command .= $simpleParamsForm->buildCommand( $_POST ); </pre> ### Add a reference to your publication in the header info ### Change the jobtype passed in showOrSubmitCommand()