Author: david
Date: Mon May 14 16:04:49 2012
New Revision: 11677

Log:
Allow linking remote digital objects, even if uploads are disabled or limit is 
exceeded

Modified:
   
trunk/apps/qubit/modules/informationobject/actions/addDigitalObjectAction.class.php
   trunk/apps/qubit/modules/informationobject/templates/_actions.php
   
trunk/apps/qubit/modules/informationobject/templates/addDigitalObjectSuccess.php

Modified: 
trunk/apps/qubit/modules/informationobject/actions/addDigitalObjectAction.class.php
==============================================================================
--- 
trunk/apps/qubit/modules/informationobject/actions/addDigitalObjectAction.class.php
 Mon May 14 15:03:59 2012        (r11676)
+++ 
trunk/apps/qubit/modules/informationobject/actions/addDigitalObjectAction.class.php
 Mon May 14 16:04:49 2012        (r11677)
@@ -54,6 +54,9 @@
 
     $this->resource = $this->getRoute()->resource;
 
+    // Get repository to test upload limits
+    $this->repository = $this->resource->getRepository(array('inherit' => 
true));
+
     // Check that object exists and that it is not the root
     if (!isset($this->resource) || !isset($this->resource->parent))
     {
@@ -72,15 +75,6 @@
       QubitAcl::forwardUnauthorized();
     }
 
-    // Check repository file upload limit
-    $repo = $this->resource->getRepository(array('inherit' => true));
-    if (null !== $repo
-      && $repo->uploadLimit != -1
-      && $repo->getDiskUsage(array('units' => 'G')) >= 
floatval($repo->uploadLimit))
-    {
-      $this->redirect(array($repo, 'module' => 'repository', 'action' => 
'uploadLimitExceeded'));
-    }
-
     // Add form fields
     $this->addFields($request);
 

Modified: trunk/apps/qubit/modules/informationobject/templates/_actions.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/_actions.php   Mon May 
14 15:03:59 2012        (r11676)
+++ trunk/apps/qubit/modules/informationobject/templates/_actions.php   Mon May 
14 16:04:49 2012        (r11677)
@@ -22,14 +22,17 @@
 
         <li><?php echo link_to(__('Move'), array($resource, 'module' => 
'default', 'action' => 'move')) ?></li>
 
-        <?php if (null === $resource->repository || 0 != 
$resource->repository->uploadLimit): ?>
-
           <?php if (0 < count($resource->digitalObjects)): ?>
+
             <li><?php echo link_to(__('Edit digital object'), 
array($resource->digitalObjects[0], 'module' => 'digitalobject', 'action' => 
'edit')) ?></li>
           <?php else: ?>
+
             <li><?php echo link_to(__('Link digital object'), array($resource, 
'module' => 'informationobject', 'action' => 'addDigitalObject')) ?></li>
+
           <?php endif; // has digital object ?>
 
+        <?php if (null === $resource->repository || 0 != 
$resource->repository->uploadLimit): ?>
+
           <li><?php echo link_to(__('Import digital objects'), 
array($resource, 'module' => 'informationobject', 'action' => 
'multiFileUpload')) ?></li>
 
         <?php endif; // upload quota is non-zero ?>

Modified: 
trunk/apps/qubit/modules/informationobject/templates/addDigitalObjectSuccess.php
==============================================================================
--- 
trunk/apps/qubit/modules/informationobject/templates/addDigitalObjectSuccess.php
    Mon May 14 15:03:59 2012        (r11676)
+++ 
trunk/apps/qubit/modules/informationobject/templates/addDigitalObjectSuccess.php
    Mon May 14 16:04:49 2012        (r11677)
@@ -8,13 +8,15 @@
 
   <?php echo $form->renderHiddenFields() ?>
 
-  <fieldset class="collapsible" id="singleFileUpload">
+  <?php if (null == $repository || -1 == $repository->uploadLimit || 
$repository->getDiskUsage(array('units' => 'G')) < 
floatval($repository->uploadLimit)): ?>
+    <fieldset class="collapsible" id="singleFileUpload">
 
-    <legend><?php echo __('Upload a digital object') ?></legend>
+      <legend><?php echo __('Upload a digital object') ?></legend>
 
-    <?php echo $form->file->renderRow() ?>
+      <?php echo $form->file->renderRow() ?>
 
-  </fieldset>
+    </fieldset>
+  <?php endif; // Test upload limit ?>
 
   <fieldset class="collapsible" id="externalFileLink">
 

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