Commit e26e7aaeab869656cb0a42e2e02862a30a9e6e42
1 parent
3a1123c1
Allow for forms to set buttons to the kt_cancel request variable,
allowing for a redirect to a given URL. kt_cancel is expected to be an associative array with a single key/value pair. The redirected URL is the key. For example: <input type="submit" name="kt_cancel[/foo/bar]" value="Cancel" /> This will redirect to /foo/bar directly, without going to the dispatcher named in the action request variable. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4714 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
9 additions
and
0 deletions
lib/dispatcher.inc.php
| ... | ... | @@ -13,6 +13,7 @@ class KTDispatchStandardRedirector { |
| 13 | 13 | |
| 14 | 14 | class KTDispatcher { |
| 15 | 15 | var $event_var = "action"; |
| 16 | + var $cancel_var = "kt_cancel"; | |
| 16 | 17 | var $bAutomaticTransaction = false; |
| 17 | 18 | var $bTransactionStarted = false; |
| 18 | 19 | var $oValidator = null; |
| ... | ... | @@ -23,6 +24,14 @@ class KTDispatcher { |
| 23 | 24 | } |
| 24 | 25 | |
| 25 | 26 | function dispatch () { |
| 27 | + if (array_key_exists($this->cancel_var, $_REQUEST)) { | |
| 28 | + $var = $_REQUEST[$this->cancel_var]; | |
| 29 | + if (is_array($var)) { | |
| 30 | + $keys = array_keys($var); | |
| 31 | + redirect($keys[0]); | |
| 32 | + exit(0); | |
| 33 | + } | |
| 34 | + } | |
| 26 | 35 | $method = 'do_main'; |
| 27 | 36 | if (array_key_exists($this->event_var, $_REQUEST)) { |
| 28 | 37 | $event = $_REQUEST[$this->event_var]; | ... | ... |