[phpwebapp-commits] CVS: web_app/session func.GoTo.js,1.4,1.5
Brought to you by:
dashohoxha
From: Dashamir H. <das...@us...> - 2004-09-16 07:43:04
|
Update of /cvsroot/phpwebapp/web_app/session In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27680/session Modified Files: func.GoTo.js Log Message: GoTo() can have a second optional parameter which specifies the action where the form is to be submitted. Default is the previous action. If it is 'index' then the filename will be removed from the previous action (ant the action will become in fact index.php in the path). Index: func.GoTo.js =================================================================== RCS file: /cvsroot/phpwebapp/web_app/session/func.GoTo.js,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** func.GoTo.js 25 Aug 2003 13:18:31 -0000 1.4 --- func.GoTo.js 16 Sep 2004 07:42:55 -0000 1.5 *************** *** 82,94 **** * Submits the form of the page to the 'target' specified as parameter * by taking care to serialize and transmit the session vars as well. */ ! function GoTo(target) { var idx, target_page, event; ! var form; //debug if (debug_GoTo==true) alert("GoTo('"+target+"')"); //the 'target' parameter is something like this: //"page1.html?event=list.add(event_args)" --- 82,111 ---- * Submits the form of the page to the 'target' specified as parameter * by taking care to serialize and transmit the session vars as well. + * + * @param target is something like this: + * "page1.html?event=list.add(event_args)" + * target_page and event are separated by '?'; + * if target_page is 'thisPage' then the target + * is the same as the source. + * @param action (optional) is the action to which the form is submitted; + * if missing, then it is the same as the current url; + * if 'index' then the file part is removed from the current url; */ ! function GoTo(target, action) { var idx, target_page, event; ! var form, href, app_href; //debug if (debug_GoTo==true) alert("GoTo('"+target+"')"); + //set the action of the form + if (action==null) action = location.href; + if (action=='index') + { + href = location.href; + action = href.replace(/[^\/\?]+(\?.*)?$/, ''); + } + //the 'target' parameter is something like this: //"page1.html?event=list.add(event_args)" *************** *** 120,123 **** --- 137,141 ---- //now submit the form + form.action = action; form.submit(); } |