Author: david
Date: Wed Sep 23 13:38:02 2009
New Revision: 3479

Log:
Fix redirect behvaiour when deleting digital object or representations. Fixes 
issue #995.

Modified:
   trunk/apps/qubit/modules/digitalobject/actions/deleteAction.class.php

Modified: trunk/apps/qubit/modules/digitalobject/actions/deleteAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/digitalobject/actions/deleteAction.class.php       
Wed Sep 23 13:05:57 2009        (r3478)
+++ trunk/apps/qubit/modules/digitalobject/actions/deleteAction.class.php       
Wed Sep 23 13:38:02 2009        (r3479)
@@ -33,13 +33,24 @@
     $this->forward404Unless($digitalObject);
 
     // Get related information object by first grabbing top-level digital 
object
-    $informationObject = 
$digitalObject->getTopAncestorOrSelf()->getInformationObject();
-    $this->forward404Unless($informationObject);
+    $parent = $digitalObject->getParent();
+    if (null == $parent)
+    {
+      $informationObject = $digitalObject->getInformationObject();
+      $this->forward404Unless($informationObject);
+    }
 
     //delete the digital object record from the database
     $digitalObject->delete();
 
     // Redirect to edit page for parent Info Object
-    $this->redirect('informationobject/edit?id='.$informationObject->getId());
+    if (null !== $parent)
+    {
+      $this->redirect(array('module' => 'digitalobject', 'action' => 'edit', 
'id' => $parent->id));
+    }
+    else
+    {
+      $this->redirect(array('module' => 'informationobject', 'action' => 
'show', 'id' => $informationObject->id));
+    }
   }
 }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to