Fixed bug which was kicking us out of the dev/sandbox when editing a customer. Actually, seems like more of a workaround for a CakePHP bug, but it's not certain.
git-svn-id: file:///svn-source/pmgr/branches/v0.2_work@945 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -32,15 +32,22 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function sandbox() {
|
||||
$r = Router::requestRoute();
|
||||
return !empty($r[3]['sand_route']);
|
||||
function _box($type) {
|
||||
static $box = array('type' => null, 'test' => array());
|
||||
if (!isset($box['type']) && !isset($box['test'][$type])) {
|
||||
$r = Router::requestRoute();
|
||||
/* if (!preg_match("/gridData/", $_SERVER['REQUEST_URI'])) { */
|
||||
/* print("<PRE>Route:\n");print_r($r);print("\n</PRE>\n"); */
|
||||
/* } */
|
||||
$box['test'][$type] = !empty($r[3]["${type}_route"]);
|
||||
if ($box['test'][$type])
|
||||
$box['type'] = $type;
|
||||
}
|
||||
return $box['type'] == $type;
|
||||
}
|
||||
|
||||
function devbox() {
|
||||
$r = Router::requestRoute();
|
||||
return !empty($r[3]['dev_route']);
|
||||
}
|
||||
function sandbox() { return _box('sand'); }
|
||||
function devbox() { return _box('dev'); }
|
||||
|
||||
function server_request_var($var) {
|
||||
if (preg_match("/^HTTP_ACCEPT|REMOTE_PORT/", $var))
|
||||
|
||||
@@ -43,6 +43,16 @@ Router::connect('/sand',
|
||||
array('sand_route' => true) + $default_path);
|
||||
Router::connect('/sand/:controller/:action/*',
|
||||
array('sand_route' => true, 'action' => null));
|
||||
/* Unfortunately, for some reason we need an extra route to solve
|
||||
* a bug with form generation. When $this->data is set by the
|
||||
* controller, and a URL is generated by the FormHelper, this
|
||||
* route is required to ensure the form action is correct. An
|
||||
* example of a broken page is for /customers/edit/XX. It appears
|
||||
* the page location uses the route above, it's only URL generation
|
||||
* that seems to be broken.
|
||||
*/
|
||||
Router::connect('/sand/:controller/:action/:id/*',
|
||||
array('sand_route' => true,'action' => null, 'id'=>null));
|
||||
|
||||
/*
|
||||
* Route for developement functionality
|
||||
@@ -51,5 +61,15 @@ Router::connect('/dev',
|
||||
array('dev_route' => true) + $default_path);
|
||||
Router::connect('/dev/:controller/:action/*',
|
||||
array('dev_route' => true, 'action' => null));
|
||||
/* Unfortunately, for some reason we need an extra route to solve
|
||||
* a bug with form generation. When $this->data is set by the
|
||||
* controller, and a URL is generated by the FormHelper, this
|
||||
* route is required to ensure the form action is correct. An
|
||||
* example of a broken page is for /customers/edit/XX. It appears
|
||||
* the page location uses the route above, it's only URL generation
|
||||
* that seems to be broken.
|
||||
*/
|
||||
Router::connect('/dev/:controller/:action/:id/*',
|
||||
array('dev_route' => true,'action' => null, 'id'=>null));
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user