Author: david
Date: Mon Sep 28 14:33:21 2009
New Revision: 3569

Log:
Refactor digitalobject/show partial to handle logic for displaying compound 
digital object.  Remove conditional compound digital object logic from isad, 
mods, dc and rad templates.

Modified:
   trunk/apps/qubit/modules/digitalobject/actions/showComponent.class.php
   
trunk/apps/qubit/modules/digitalobject/actions/showCompoundComponent.class.php
   trunk/apps/qubit/modules/digitalobject/templates/_showCompound.php
   trunk/apps/qubit/modules/informationobject/templates/showDcSuccess.php
   trunk/apps/qubit/modules/informationobject/templates/showIsadSuccess.php
   trunk/apps/qubit/modules/informationobject/templates/showModsSuccess.php
   trunk/apps/qubit/modules/informationobject/templates/showRadSuccess.php

Modified: trunk/apps/qubit/modules/digitalobject/actions/showComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/digitalobject/actions/showComponent.class.php      
Mon Sep 28 14:14:06 2009        (r3568)
+++ trunk/apps/qubit/modules/digitalobject/actions/showComponent.class.php      
Mon Sep 28 14:33:21 2009        (r3569)
@@ -49,7 +49,14 @@
       case QubitTerm::IMAGE_ID:
         if ($this->digitalObject->isWebCompatibleImageFormat())
         {
-          $this->showComponent = 'showImage';
+          if 
($this->digitalObject->showAsCompoundDigitalObject($this->usageType))
+          {
+            $this->showComponent = 'showCompound';
+          }
+          else
+          {
+            $this->showComponent = 'showImage';
+          }
         }
         else
         {
@@ -63,7 +70,14 @@
         $this->showComponent = 'showVideo';
         break;
       case QubitTerm::TEXT_ID:
-        $this->showComponent = 'showText';
+        if 
($this->digitalObject->showAsCompoundDigitalObject($this->usageType))
+        {
+          $this->showComponent = 'showCompound';
+        }
+        else
+        {
+          $this->showComponent = 'showText';
+        }
         break;
       default:
         $this->showComponent = 'showDownload';

Modified: 
trunk/apps/qubit/modules/digitalobject/actions/showCompoundComponent.class.php
==============================================================================
--- 
trunk/apps/qubit/modules/digitalobject/actions/showCompoundComponent.class.php  
    Mon Sep 28 14:14:06 2009        (r3568)
+++ 
trunk/apps/qubit/modules/digitalobject/actions/showCompoundComponent.class.php  
    Mon Sep 28 14:33:21 2009        (r3569)
@@ -35,9 +35,10 @@
   public function execute($request)
   {
     // Make sure that this 'display_as_compound_object' is set to yes
-    $displayAsCompoundProp = 
QubitProperty::getOneByObjectIdAndName($this->informationObject->getId(), 
'display_as_compound_object');
+    $displayAsCompoundProp = 
QubitProperty::getOneByObjectIdAndName($this->digitalObject->id, 
'display_as_compound_object');
     $this->isCompoundDigitalObject = (is_null($displayAsCompoundProp)) ? false 
: true;
-    $this->masterDigitalObject = $this->informationObject->getDigitalObject();
+    $this->masterDigitalObject = $this->digitalObject;
+    $this->informationObject = $this->digitalObject->informationObject;
 
     //determine if user has edit priviliges
     $this->editCredentials = false;
@@ -49,7 +50,7 @@
     // Find all digital objects of child info objects
     $criteria = new Criteria;
     $criteria->addJoin(QubitInformationObject::ID, 
QubitDigitalObject::INFORMATION_OBJECT_ID, Criteria::INNER_JOIN);
-    $criteria->add(QubitInformationObject::PARENT_ID, 
$this->informationObject->getId(), Criteria::EQUAL);
+    $criteria->add(QubitInformationObject::PARENT_ID, 
$this->digitalObject->informationObjectId, Criteria::EQUAL);
 
     // Show two results on page with pager
     $this->page = $request->getParameter('page', 1);
@@ -82,7 +83,7 @@
     }
 
     // Link for prev/next page
-    $this->currentObjectRoute = 
'informationobject/show?id='.$this->informationObject->getId();
+    $this->currentObjectRoute = array('module' => 'informationobject', 
'action' => 'show', 'id' => $this->informationObject->id);
 
     $this->pager = $pager;
   }

Modified: trunk/apps/qubit/modules/digitalobject/templates/_showCompound.php
==============================================================================
--- trunk/apps/qubit/modules/digitalobject/templates/_showCompound.php  Mon Sep 
28 14:14:06 2009        (r3568)
+++ trunk/apps/qubit/modules/digitalobject/templates/_showCompound.php  Mon Sep 
28 14:33:21 2009        (r3569)
@@ -7,7 +7,7 @@
       <?php else: ?>
       <?php echo image_tag($rep->getFullPath()) ?>
       <?php endif; ?>
-    <?php endif; ?>  
+    <?php endif; ?>
     </td>
     <td>
     <?php if (null !== $rightObject && $rep = 
$rightObject->getCompoundRepresentation()): ?>
@@ -32,14 +32,14 @@
 <div class="pager compound_digiobj">
   <?php $links = $pager->getLinks(); ?>
   <?php if ($pager->getPage() != $pager->getFirstPage()): ?>
- <?php echo link_to('< '.__('previous'), 
$currentObjectRoute.'&page='.($pager->getPage()-1)) ?>
+ <?php echo link_to('< '.__('previous'), $currentObjectRoute + array('page' => 
($pager->getPage()-1))) ?>
   <?php endif; ?>
   <?php foreach ($links as $page): ?>
-    <?php echo ($page == $pager->getPage()) ? '<strong>'.$page.'</strong>' : 
link_to($page, $currentObjectRoute.'&page='.$page) ?>
+    <?php echo ($page == $pager->getPage()) ? '<strong>'.$page.'</strong>' : 
link_to($page, $currentObjectRoute + array('page' => $page)) ?>
     <?php if ($page != $pager->getCurrentMaxLink()): ?> <?php endif ?>
   <?php endforeach ?>
   <?php if ($pager->getPage() != $pager->getLastPage()): ?>
- <?php echo link_to(__('next').' >', 
$currentObjectRoute.'&page='.($pager->getPage()+1)) ?>
+ <?php echo link_to(__('next').' >', $currentObjectRoute + array('page' => 
($pager->getPage()+1))) ?>
   <?php endif; ?>
 </div>
 <?php endif ?>

Modified: trunk/apps/qubit/modules/informationobject/templates/showDcSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/showDcSuccess.php      
Mon Sep 28 14:14:06 2009        (r3568)
+++ trunk/apps/qubit/modules/informationobject/templates/showDcSuccess.php      
Mon Sep 28 14:33:21 2009        (r3569)
@@ -9,15 +9,7 @@
   </td>
 </tr>
 
-<?php if 
($informationObject->showAsCompoundDigitalObject(QubitTerm::REFERENCE_ID)): ?>
-  <tr>
-    <td colspan="2">
-      <div style="text-align: center">
-      <?php include_component('digitalobject', 'showCompound', 
array('informationObject' => $informationObject)) ?>
-      </div>
-    </td>
-  </tr>
-<?php elseif (0 < count($informationObject->digitalObjects)): ?>
+<?php if (null !== $digitalObject): ?>
   <tr>
     <td colspan="2">
       <div style="text-align: center">
@@ -78,7 +70,7 @@
         <?php echo __('date') ?>
       </th>
       <td>
-        <?php echo date_display($date) ?> 
+        <?php echo date_display($date) ?>
         <div style="margin-left: 10px;">
         <span class="note2"><?php echo __('Type').': '.$date->getType() 
?></span><br />
         <?php if (($date->getActorId()) & ($role = 
$date->getType()->getRole())): ?>

Modified: 
trunk/apps/qubit/modules/informationobject/templates/showIsadSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/showIsadSuccess.php    
Mon Sep 28 14:14:06 2009        (r3568)
+++ trunk/apps/qubit/modules/informationobject/templates/showIsadSuccess.php    
Mon Sep 28 14:33:21 2009        (r3569)
@@ -10,15 +10,6 @@
 </tr>
 
 <?php if (null !== $digitalObject): ?>
-<?php if 
($digitalObject->showAsCompoundDigitalObject(QubitTerm::REFERENCE_ID)): ?>
-  <tr>
-    <td colspan="2">
-      <div style="text-align: center">
-      <?php include_component('digitalobject', 'showCompound', 
array('informationObject' => $informationObject)) ?>
-      </div>
-    </td>
-  </tr>
-<?php else: ?>
   <tr>
     <td colspan="2">
       <div style="text-align: center">
@@ -28,7 +19,6 @@
     </td>
   </tr>
 <?php endif; ?>
-<?php endif; ?>
 
 <!-- ******************************************** -->
 <!--   START IDENTITY AREA                         -->

Modified: 
trunk/apps/qubit/modules/informationobject/templates/showModsSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/showModsSuccess.php    
Mon Sep 28 14:14:06 2009        (r3568)
+++ trunk/apps/qubit/modules/informationobject/templates/showModsSuccess.php    
Mon Sep 28 14:33:21 2009        (r3569)
@@ -9,15 +9,7 @@
   </td>
 </tr>
 
-<?php if 
($informationObject->showAsCompoundDigitalObject(QubitTerm::REFERENCE_ID)): ?>
-  <tr>
-    <td colspan="2">
-      <div style="text-align: center">
-      <?php include_component('digitalobject', 'showCompound', 
array('informationObject' => $informationObject)) ?>
-      </div>
-    </td>
-  </tr>
-<?php elseif (0 < count($informationObject->digitalObjects)): ?>
+<?php if (null !== $digitalObject): ?>
   <tr>
     <td colspan="2">
       <div style="text-align: center">
@@ -61,7 +53,7 @@
         <?php echo __('date') ?>
       </th>
       <td>
-        <?php echo date_display($date) ?> 
+        <?php echo date_display($date) ?>
         <div style="margin-left: 10px;">
         <span class="note2"><?php echo __('Type').': '.$date->getType() 
?></span><br />
         <?php if (($date->getActorId()) & ($role = 
$date->getType()->getRole())): ?>

Modified: 
trunk/apps/qubit/modules/informationobject/templates/showRadSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/showRadSuccess.php     
Mon Sep 28 14:14:06 2009        (r3568)
+++ trunk/apps/qubit/modules/informationobject/templates/showRadSuccess.php     
Mon Sep 28 14:33:21 2009        (r3569)
@@ -10,15 +10,7 @@
 </tr>
 
 <!-- Digital Object reference representation -->
-<?php if 
($informationObject->showAsCompoundDigitalObject(QubitTerm::REFERENCE_ID)): ?>
-  <tr>
-    <td colspan="2">
-      <div style="text-align: center">
-      <?php include_component('digitalobject', 'showCompound', 
array('informationObject' => $informationObject)) ?>
-      </div>
-    </td>
-  </tr>
-<?php elseif (0 < count($informationObject->digitalObjects)): ?>
+<?php if (null !== $digitalObject): ?>
   <tr>
     <td colspan="2">
       <div style="text-align: center">
@@ -114,7 +106,7 @@
         <?php echo __('date') ?>
       </th>
       <td>
-        <?php echo date_display($date) ?> 
+        <?php echo date_display($date) ?>
         <div style="margin-left: 10px;">
         <span class="note2"><?php echo __('Type').': '.$date->getType() 
?></span><br />
         <?php if (($date->getActorId()) & ($role = 
$date->getType()->getRole())): ?>

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