Author: sevein
Date: Mon Aug  8 17:37:11 2011
New Revision: 9470

Log:
Add delete action/tmpl to rightsholder

Added:
   trunk/apps/qubit/modules/rightsholder/actions/deleteAction.class.php
   trunk/apps/qubit/modules/rightsholder/templates/deleteSuccess.php

Added: trunk/apps/qubit/modules/rightsholder/actions/deleteAction.class.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/apps/qubit/modules/rightsholder/actions/deleteAction.class.php        
Mon Aug  8 17:37:11 2011        (r9470)
@@ -0,0 +1,40 @@
+<?php
+
+/*
+ * This file is part of Qubit Toolkit.
+ *
+ * Qubit Toolkit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Qubit Toolkit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Qubit Toolkit.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+class RightsHolderDeleteAction extends sfAction
+{
+  public function execute($request)
+  {
+    $this->form = new sfForm;
+
+    $this->resource = $this->getRoute()->resource;
+
+    if ($request->isMethod('delete'))
+    {
+      foreach (QubitRelation::getBySubjectOrObjectId($this->resource->id) as 
$item)
+      {
+        $item->delete();
+      }
+
+      $this->resource->delete();
+
+      $this->redirect(array('module' => 'rightsholder', 'action' => 'browse'));
+    }
+  }
+}

Added: trunk/apps/qubit/modules/rightsholder/templates/deleteSuccess.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/apps/qubit/modules/rightsholder/templates/deleteSuccess.php   Mon Aug 
 8 17:37:11 2011        (r9470)
@@ -0,0 +1,18 @@
+<h1><?php echo __('Are you sure you want to delete %1%?', array('%1%' => 
render_title($resource))) ?></h1>
+
+<?php echo $form->renderFormTag(url_for(array($resource, 'module' => 
'rightsholder', 'action' => 'delete')), array('method' => 'delete')) ?>
+
+  <div class="actions section">
+
+    <h2 class="element-invisible"><?php echo __('Actions') ?></h2>
+
+    <div class="content">
+      <ul class="clearfix links">
+        <li><?php echo link_to(__('Cancel'), array($resource, 'module' => 
'rightsholder')) ?></li>
+        <li><input class="form-submit" type="submit" value="<?php echo 
__('Confirm') ?>"/></li>
+      </ul>
+    </div>
+
+  </div>
+
+</form>

-- 
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.com/group/qubit-commits?hl=en.

Reply via email to