Author: sevein
Date: Wed Jun 29 16:48:17 2011
New Revision: 9229

Log:
Delete actions, accession module

Added:
   
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/actions/deleteAction.class.php
   
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/actions/deleteDeaccession.class.php
   
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/deleteDeaccessionSuccess.php
   
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/deleteSuccess.php
Modified:
   
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/editDeaccessionSuccess.php
   
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/indexDeaccessionSuccess.php
   
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/indexSuccess.php

Added: 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/actions/deleteAction.class.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/actions/deleteAction.class.php
    Wed Jun 29 16:48:17 2011        (r9229)
@@ -0,0 +1,41 @@
+<?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 qtAccessionPluginDeleteAction extends sfAction
+{
+  public function execute($request)
+  {
+    $this->form = new sfForm;
+
+    $this->resource = $this->getRoute()->resource;
+
+    // Check user authorization
+    if (!QubitAcl::check($this->resource, 'delete'))
+    {
+      QubitAcl::forwardUnauthorized();
+    }
+
+    if ($request->isMethod('delete'))
+    {
+      $this->resource->delete();
+
+      $this->redirect(array('module' => 'accession', 'action' => 'list'));
+    }
+  }
+}

Added: 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/actions/deleteDeaccession.class.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/actions/deleteDeaccession.class.php
       Wed Jun 29 16:48:17 2011        (r9229)
@@ -0,0 +1,41 @@
+<?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 qtAccessionPluginDeleteDeaccessionAction extends sfAction
+{
+  public function execute($request)
+  {
+    $this->form = new sfForm;
+
+    $this->resource = $this->getRoute()->resource;
+
+    // Check user authorization
+    if (!QubitAcl::check($this->resource, 'delete'))
+    {
+      QubitAcl::forwardUnauthorized();
+    }
+
+    if ($request->isMethod('delete'))
+    {
+      $this->resource->delete();
+
+      $this->redirect(array('module' => 'accession', 'action' => 'list'));
+    }
+  }
+}

Added: 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/deleteDeaccessionSuccess.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/deleteDeaccessionSuccess.php
    Wed Jun 29 16:48:17 2011        (r9229)
@@ -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' => 
'accession', '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' => 
'accession')) ?></li>
+        <li><input class="form-submit" type="submit" value="<?php echo 
__('Confirm') ?>"/></li>
+      </ul>
+    </div>
+
+  </div>
+
+</form>

Added: 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/deleteSuccess.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/deleteSuccess.php
       Wed Jun 29 16:48:17 2011        (r9229)
@@ -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' => 
'accession', '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' => 
'accession')) ?></li>
+        <li><input class="form-submit" type="submit" value="<?php echo 
__('Confirm') ?>"/></li>
+      </ul>
+    </div>
+
+  </div>
+
+</form>

Modified: 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/editDeaccessionSuccess.php
==============================================================================
--- 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/editDeaccessionSuccess.php
      Wed Jun 29 16:47:31 2011        (r9228)
+++ 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/editDeaccessionSuccess.php
      Wed Jun 29 16:48:17 2011        (r9229)
@@ -30,10 +30,10 @@
       <ul class="clearfix links">
 
         <?php if (isset($resource->id)): ?>
-          <li><?php echo link_to(__('Cancel'), array($resource, 'module' => 
'accession')) ?></li>
+          <li><?php echo link_to(__('Cancel'), array($resource, 'module' => 
'deaccession')) ?></li>
           <li><input class="form-submit" type="submit" value="<?php echo 
__('Save') ?>"/></li>
         <?php else: ?>
-          <li><?php echo link_to(__('Cancel'), array('module' => 'accession', 
'action' => 'list')) ?></li>
+          <li><?php echo link_to(__('Cancel'), array('module' => 'accession', 
'action' => 'index')) ?></li>
           <li><input class="form-submit" type="submit" value="<?php echo 
__('Create') ?>"/></li>
         <?php endif; ?>
 

Modified: 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/indexDeaccessionSuccess.php
==============================================================================
--- 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/indexDeaccessionSuccess.php
     Wed Jun 29 16:47:31 2011        (r9228)
+++ 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/indexDeaccessionSuccess.php
     Wed Jun 29 16:48:17 2011        (r9229)
@@ -12,8 +12,23 @@
   </div>
 <?php endif; ?>
 
+<div class="field">
+  <h3>Accession record</h3>
+  <div class="value">
+    <?php echo link_to($resource->accession->__toString(), 
array($resource->accession, 'module' => 'accession')) ?>
+  </div>
+</div>
+
 <?php echo render_show(__('Identifier'), render_value($resource->identifier)) 
?>
 
+<?php echo render_show(__('Scope'), render_value($resource->scope)) ?>
+
+<?php echo render_show(__('Description'), 
render_value($resource->description)) ?>
+
+<?php echo render_show(__('Extent'), render_value($resource->extent)) ?>
+
+<?php echo render_show(__('Reason'), render_value($resource->reason)) ?>
+
 <div class="actions section">
 
   <h2 class="element-invisible"><?php echo __('Actions') ?></h2>
@@ -21,7 +36,13 @@
   <div class="content">
     <ul class="clearfix links">
 
-        <li><?php echo link_to(__('Edit'), array($resource, 'module' => 
'deaccession', 'action' => 'editDeaccession')) ?></li>
+      <?php if (QubitAcl::check($resource, 'update') || 
(QubitAcl::check($resource, 'translate'))): ?>
+        <li><?php echo link_to(__('Edit'), array($resource, 'module' => 
'deaccession', 'action' => 'edit')) ?></li>
+      <?php endif; ?>
+
+      <?php if (QubitAcl::check($resource, 'delete')): ?>
+        <li><?php echo link_to(__('Delete'), array($resource, 'module' => 
'deaccession', 'action' => 'delete')) ?></li>
+      <?php endif; ?>
 
     </ul>
   </div>

Modified: 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/indexSuccess.php
==============================================================================
--- 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/indexSuccess.php
        Wed Jun 29 16:47:31 2011        (r9228)
+++ 
trunk/plugins/qtAccessionPlugin/modules/qtAccessionPlugin/templates/indexSuccess.php
        Wed Jun 29 16:48:17 2011        (r9229)
@@ -82,11 +82,17 @@
   <div class="content">
     <ul class="clearfix links">
 
+      <?php if (QubitAcl::check($resource, 'update') || 
(QubitAcl::check($resource, 'translate'))): ?>
         <li><?php echo link_to(__('Edit'), array($resource, 'module' => 
'accession', 'action' => 'edit')) ?></li>
+      <?php endif; ?>
 
-        <li><?php echo link_to(__('Deaccession'), array('module' => 
'deaccession', 'action' => 'add', 'accessionId' => $resource->id)) ?></li>
+      <?php if (QubitAcl::check($resource, 'delete')): ?>
+        <li><?php echo link_to(__('Delete'), array($resource, 'module' => 
'qtAccessionPlugin', 'action' => 'delete')) ?></li>
+      <?php endif; ?>
 
-        <li><?php echo link_to(__('Create %1%', array('%1%' => 
sfConfig::get('app_ui_label_informationobject'))), array('module' => 
'informationobject', 'action' => 'add', 'accessionId' => $resource->id)) ?></li>
+      <li><?php echo link_to(__('Deaccession'), array('module' => 
'deaccession', 'action' => 'add', 'accessionId' => $resource->id)) ?></li>
+
+      <li><?php echo link_to(__('Create %1%', array('%1%' => 
sfConfig::get('app_ui_label_informationobject'))), array('module' => 
'informationobject', 'action' => 'add', 'accessionId' => $resource->id)) ?></li>
 
     </ul>
   </div>

-- 
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