Author: sevein
Date: Thu Sep 29 18:10:35 2011
New Revision: 9879

Log:
Inherit upper rights for archival descriptions. Fixes issue 2097.

Modified:
   trunk/apps/qubit/modules/right/actions/relatedRightsComponent.class.php
   trunk/apps/qubit/modules/right/templates/_relatedRights.php

Modified: 
trunk/apps/qubit/modules/right/actions/relatedRightsComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/right/actions/relatedRightsComponent.class.php     
Thu Sep 29 16:39:45 2011        (r9878)
+++ trunk/apps/qubit/modules/right/actions/relatedRightsComponent.class.php     
Thu Sep 29 18:10:35 2011        (r9879)
@@ -23,13 +23,7 @@
   {
     if ($this->resource instanceof QubitInformationObject)
     {
-      foreach ($this->resource->ancestors->andSelf()->orderBy('rgt') as 
$this->ancestor)
-      {
-        if (0 < count($this->ancestor->getRights()))
-        {
-          break;
-        }
-      }
+      $this->ancestors = $this->resource->ancestors->andSelf()->orderBy('rgt');
     }
     else if ($this->resource instanceof QubitAccession)
     {

Modified: trunk/apps/qubit/modules/right/templates/_relatedRights.php
==============================================================================
--- trunk/apps/qubit/modules/right/templates/_relatedRights.php Thu Sep 29 
16:39:45 2011        (r9878)
+++ trunk/apps/qubit/modules/right/templates/_relatedRights.php Thu Sep 29 
18:10:35 2011        (r9879)
@@ -1,8 +1,27 @@
-<?php foreach ($ancestor->getRights() as $item): ?>
+<?php if ($resource instanceof QubitInformationObject): ?>
 
-  <?php echo get_partial('right/right',
-    array(
-      'resource' => $item->object,
-      'inherit' => 0 == count($resource->getRights()) ? $resource : null)) ?>
+  <?php foreach ($ancestors as $item): ?>
 
-<?php endforeach; ?>
+    <?php foreach ($item->getRights() as $right): ?>
+
+      <?php echo get_partial('right/right',
+        array(
+          'resource' => $right->object,
+          'inherit' => $item != $resource ? $item : null)) ?>
+
+    <?php endforeach; ?>
+
+  <?php endforeach; ?>
+
+<?php elseif ($resource instanceof QubitAccession): ?>
+
+  <?php foreach ($ancestor->getRights() as $item): ?>
+
+    <?php echo get_partial('right/right',
+      array(
+        'resource' => $item->object,
+        'inherit' => 0 == count($resource->getRights()) ? $resource : null)) ?>
+
+  <?php endforeach; ?>
+
+<?php endif; ?>

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