comanage-dev - [comanage-dev] r434 - registry/trunk/app/Controller
Subject: COmanage Developers List
List archive
- From:
- To:
- Subject: [comanage-dev] r434 - registry/trunk/app/Controller
- Date: Tue, 5 Feb 2013 05:21:00 -0500
Author: marie
Date: 2013-02-05 05:21:00 -0500 (Tue, 05 Feb 2013)
New Revision: 434
Modified:
registry/trunk/app/Controller/AddressesController.php
registry/trunk/app/Controller/AppController.php
registry/trunk/app/Controller/EmailAddressesController.php
registry/trunk/app/Controller/IdentifiersController.php
registry/trunk/app/Controller/TelephoneNumbersController.php
Log:
co477 refactor redirects
Modified: registry/trunk/app/Controller/AddressesController.php
===================================================================
--- registry/trunk/app/Controller/AddressesController.php 2013-02-01
04:34:07 UTC (rev 433)
+++ registry/trunk/app/Controller/AddressesController.php 2013-02-05
10:21:00 UTC (rev 434)
@@ -37,37 +37,20 @@
);
/**
- * Add an Address Object.
- * - precondition: Model specific attributes in $this->request->data
(optional)
- * - postcondition: On success, new Object created
- * - postcondition: Session flash message updated (HTML) or HTTP status
returned (REST)
- * - postcondition: $<object>_id or $invalid_fields set (REST)
+ * Callback to set relevant tab to open when redirecting to another page
+ * - precondition:
+ * - postcondition: Auth component is configured
+ * - postcondition:
*
- * @since COmanage Registry v0.1
+ * @since COmanage Registry v0.8
*/
-
- function add() {
- $this->redirectTab = 'address';
- parent::add();
- }
-
- /**
- * Delete an Address Object
- * - precondition: <id> must exist
- * - postcondition: Session flash message updated (HTML) or HTTP status
returned (REST)
- * - postcondition: On success, all related data (any table with an
<object>_id column) is deleted
- *
- * @since COmanage Registry v0.7
- * @param integer Object identifier (eg: cm_co_groups:id) representing
object to be deleted
- */
-
- function delete($id) {
+ function beforeFilter() {
$this->redirectTab = 'address';
- parent::delete($id);
+ parent::beforeFilter();
}
-
+
/**
* Authorization for this Controller, called by Auth component
* - precondition: Session.Auth holds data used for authz decisions
@@ -159,17 +142,4 @@
$this->set('permissions', $p);
return $p[$this->action];
}
-
- /**
- * Perform a redirect back to the controller's default view.
- * - postcondition: Redirect generated
- *
- * @since COmanage Registry v0.7
- */
-
- function performRedirect() {
- $this->redirectTab = 'address';
-
- parent::performRedirect();
- }
}
Modified: registry/trunk/app/Controller/AppController.php
===================================================================
--- registry/trunk/app/Controller/AppController.php 2013-02-01 04:34:07
UTC (rev 433)
+++ registry/trunk/app/Controller/AppController.php 2013-02-05 10:21:00
UTC (rev 434)
@@ -58,6 +58,9 @@
// Determine if controller requires a Person ID to be provided
public $requires_person = false;
+ // Tab to flip to for pages with tabs
+ public $redirectTab = null;
+
/**
* Determine which plugins of a given type are available. This is a static
function suitable for use
* before AppController is instantiated.
Modified: registry/trunk/app/Controller/EmailAddressesController.php
===================================================================
--- registry/trunk/app/Controller/EmailAddressesController.php 2013-02-01
04:34:07 UTC (rev 433)
+++ registry/trunk/app/Controller/EmailAddressesController.php 2013-02-05
10:21:00 UTC (rev 434)
@@ -37,18 +37,18 @@
);
/**
- * Delete an Email Address Object
- * - precondition: <id> must exist
- * - postcondition: Session flash message updated (HTML) or HTTP status
returned (REST)
- * - postcondition: On success, all related data (any table with an
<object>_id column) is deleted
+ * Callback to set relevant tab to open when redirecting to another page
+ * - precondition:
+ * - postcondition: Auth component is configured
+ * - postcondition:
*
- * @since COmanage Registry v0.7
- * @param integer Object identifier (eg: cm_co_groups:id) representing
object to be deleted
- */
- function delete($id) {
+ * @since COmanage Registry v0.8
+ */
+
+ function beforeFilter() {
$this->redirectTab = 'email';
- parent::delete($id);
+ parent::beforeFilter();
}
/**
@@ -143,16 +143,4 @@
return $p[$this->action];
}
- /**
- * Perform a redirect back to the controller's default view.
- * - postcondition: Redirect generated
- *
- * @since COmanage Registry v0.7
- */
-
- function performRedirect() {
- $this->redirectTab = 'email';
-
- parent::performRedirect();
- }
}
Modified: registry/trunk/app/Controller/IdentifiersController.php
===================================================================
--- registry/trunk/app/Controller/IdentifiersController.php 2013-02-01
04:34:07 UTC (rev 433)
+++ registry/trunk/app/Controller/IdentifiersController.php 2013-02-05
10:21:00 UTC (rev 434)
@@ -152,6 +152,10 @@
// in order for the views to render properly.
$this->set('identifier_types',
$this->Identifier->types($this->cur_co['Co']['id']));
+
+ // Sets tab to open for redirects
+ $this->redirectTab = 'id';
+
}
/**
@@ -221,21 +225,6 @@
}
/**
- * Delete an Identifiers Object
- * - precondition: <id> must exist
- * - postcondition: Session flash message updated (HTML) or HTTP status
returned (REST)
- * - postcondition: On success, all related data (any table with an
<object>_id column) is deleted
- *
- * @since COmanage Registry v0.7
- * @param integer Object identifier (eg: cm_co_groups:id) representing
object to be deleted
- */
- function delete($id) {
- $this->redirectTab = 'id';
-
- parent::delete($id);
- }
-
- /**
* Authorization for this Controller, called by Auth component
* - precondition: Session.Auth holds data used for authz decisions
* - postcondition: $permissions set with calculated permissions
@@ -320,16 +309,4 @@
return $p[$this->action];
}
- /**
- * Perform a redirect back to the controller's default view.
- * - postcondition: Redirect generated
- *
- * @since COmanage Registry v0.7
- */
-
- function performRedirect() {
- $this->redirectTab = 'id';
-
- parent::performRedirect();
- }
}
Modified: registry/trunk/app/Controller/TelephoneNumbersController.php
===================================================================
--- registry/trunk/app/Controller/TelephoneNumbersController.php
2013-02-01 04:34:07 UTC (rev 433)
+++ registry/trunk/app/Controller/TelephoneNumbersController.php
2013-02-05 10:21:00 UTC (rev 434)
@@ -37,36 +37,20 @@
);
/**
- * Add a Telephone Number Object.
- * - precondition: Model specific attributes in $this->request->data
(optional)
- * - postcondition: On success, new Object created
- * - postcondition: Session flash message updated (HTML) or HTTP status
returned (REST)
- * - postcondition: $<object>_id or $invalid_fields set (REST)
+ * Callback to set relevant tab to open when redirecting to another page
+ * - precondition:
+ * - postcondition: Auth component is configured
+ * - postcondition:
*
- * @since COmanage Registry v0.1
+ * @since COmanage Registry v0.8
*/
-
- function add() {
- $this->redirectTab = 'phone';
- parent::add();
- }
-
- /**
- * Delete an Telephone Number Object
- * - precondition: <id> must exist
- * - postcondition: Session flash message updated (HTML) or HTTP status
returned (REST)
- * - postcondition: On success, all related data (any table with an
<object>_id column) is deleted
- *
- * @since COmanage Registry v0.7
- * @param integer Object identifier (eg: cm_co_groups:id) representing
object to be deleted
- */
- function delete($id) {
+ function beforeFilter() {
$this->redirectTab = 'phone';
- parent::delete($id);
+ parent::beforeFilter();
}
-
+
/**
* Authorization for this Controller, called by Auth component
* - precondition: Session.Auth holds data used for authz decisions
@@ -158,17 +142,4 @@
$this->set('permissions', $p);
return $p[$this->action];
}
-
- /**
- * Perform a redirect back to the controller's default view.
- * - postcondition: Redirect generated
- *
- * @since COmanage Registry v0.7
- */
-
- function performRedirect() {
- $this->redirectTab = 'phone';
-
- parent::performRedirect();
- }
-}
\ No newline at end of file
+}
- [comanage-dev] r434 - registry/trunk/app/Controller, svnlog, 02/05/2013
Archive powered by MHonArc 2.6.16.