Revision: 889
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=889&view=rev
Author: mennodekker
Date: 2012-07-31 14:51:22 +0000 (Tue, 31 Jul 2012)
Log Message:
-----------
If (show) not found or allowed, redirect to index (assuming create/edit are clicked from index)
Modified Paths:
--------------
trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php
Modified: trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php
===================================================================
--- trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php 2012-07-31 11:12:12 UTC (rev 888)
+++ trunk/library/classes/Gems/Snippets/ModelFormSnippetAbstract.php 2012-07-31 14:51:22 UTC (rev 889)
@@ -203,4 +203,25 @@
return parent::getTopic($count);
}
}
+
+ /**
+ * If menu item does not exist or is not allowed, redirect to index
+ */
+ public function setAfterSaveRoute()
+ {
+ parent::setAfterSaveRoute();
+
+ if (is_array($this->afterSaveRouteUrl)) {
+ // Make sure controller is set
+ if (!array_key_exists('controller', $this->afterSaveRouteUrl)) {
+ $this->afterSaveRouteUrl['controller'] = $this->request->getControllerName();
+ }
+
+ // If not allowed, redirect to index
+ if (null == $this->menu->find($this->afterSaveRouteUrl)) {
+ $this->afterSaveRouteUrl['action'] = 'index';
+ $this->resetRoute = true;
+ }
+ }
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|