Author: peter
Date: Wed Sep  9 16:23:32 2009
New Revision: 3210

Log:
allow for EAD export from information object context menu (DC & MODS to come). 
Clean-up EAD export to reduce validation errors (still in progress).

Modified:
   trunk/apps/qubit/modules/informationobject/templates/_contextMenu.php
   trunk/apps/qubit/modules/informationobject/templates/exportEadSuccess.xml.php

Modified: trunk/apps/qubit/modules/informationobject/templates/_contextMenu.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/_contextMenu.php       
Wed Sep  9 16:23:00 2009        (r3209)
+++ trunk/apps/qubit/modules/informationobject/templates/_contextMenu.php       
Wed Sep  9 16:23:32 2009        (r3210)
@@ -47,5 +47,11 @@
     <?php include_component('physicalobject', 'contextMenu', 
array('physicalObjects' => $physicalObjects, 'informationObject' => 
$informationObject)) ?>
     <?php echo link_to('Edit', array('module' => 'informationobject', 'action' 
=> 'editPhysicalObjects', 'id' => $informationObject->id)) ?>
 
+    <div class="label"><?php echo __('export') ?></div>
+    <ul><li><?php echo link_to(__('Dublin Core 1.1 XML'), array('module' => 
'informationobject', 'action' => 'exportDc', 'id' => $informationObject->id)) 
?></li>
+    <li><?php echo link_to(__('EAD 2002 XML'), array('module' => 
'informationobject', 'action' => 'exportEad', 'id' => $informationObject->id)) 
?></li>
+    <li><?php echo link_to(__('MODS 3.3 XML'), array('module' => 
'informationobject', 'action' => 'exportMods', 'id' => $informationObject->id)) 
?></li>
+    </ul>
+
   </div>
 </div>

Modified: 
trunk/apps/qubit/modules/informationobject/templates/exportEadSuccess.xml.php
==============================================================================
--- 
trunk/apps/qubit/modules/informationobject/templates/exportEadSuccess.xml.php   
    Wed Sep  9 16:23:00 2009        (r3209)
+++ 
trunk/apps/qubit/modules/informationobject/templates/exportEadSuccess.xml.php   
    Wed Sep  9 16:23:32 2009        (r3210)
@@ -6,359 +6,306 @@
 <eadheader langencoding="iso639-2" countryencoding="iso3166-1" 
dateencoding="iso8601" repositoryencoding="iso15511" scriptencoding="iso15924">
 
 <eadid
-      countrycode="<?php if ($informationObject->getRepository()): ?><?php 
echo htmlentities($informationObject->getRepository()->getCountryCode()) 
?><?php endif; ?>"
-      mainagencycode="<?php if ($informationObject->getRepository()): ?> <?php 
echo 
htmlentities($informationObject->getRepository()->getCountryCode().'-'.$informationObject->getRepository()->getIdentifier())
 ?><?php endif; ?>"
+      countrycode="<?php if ($informationObject->getRepository()): ?><?php 
echo $informationObject->getRepository()->getCountryCode() ?><?php endif; ?>"
+      mainagencycode="<?php if ($informationObject->getRepository()): ?> <?php 
echo 
$informationObject->getRepository()->getCountryCode().'-'.$informationObject->getRepository()->getIdentifier()
 ?><?php endif; ?>"
       url="<?php echo 
url_for('informationobject/show?id='.$informationObject->getId(), $absolute = 
true) ?>">
-      <?php echo htmlentities($informationObject->getId().' ('.gmdate('o-m-d 
H:s:e').')') ?>
+      <?php echo $informationObject->getId().' ('.gmdate('o-m-d H:s:e').')' ?>
 </eadid>
 
 <filedesc>
   <titlestmt>
-    <titleproper><?php echo htmlentities(__('Finding Aid').' - 
'.$informationObject->getTitle()) ?>
-    </titleproper>
-    <subtitle></subtitle>
-    <author><?php echo 
htmlentities(($informationObject->getRevisionHistory())) ?></author>
-    <sponsor></sponsor>
+    <?php if (0 < strlen($value = 
$informationObject->getTitle(array('cultureFallback' => true)))): ?>
+    <titleproper><?php echo $value ?></titleproper>
+    <?php endif; ?>
   </titlestmt>
-
+  <?php if (0 < strlen($value = 
$informationObject->getEdition(array('cultureFallback' => true)))): ?>
   <editionstmt>
-    <edition><?php echo htmlentities(($informationObject->getEdition())) 
?></edition>
+    <edition><?php echo $value ?></edition>
   </editionstmt>
-
+  <?php endif; ?>
+  <?php if ($value = $informationObject->getRepository()): ?>
   <publicationstmt>
-    <?php if ($informationObject->getRepository()): ?>
-    <publisher><?php echo 
htmlentities($informationObject->getRepository()->__toString()) ?></publisher>
-    <date></date>
+    <publisher><?php echo $value->__toString() ?></publisher>
+    <?php if ($address = $value->getPrimaryContact()): ?> 
     <address>
-      <addressline><?php echo 
htmlentities($informationObject->getRepository()) ?></addressline>
-      <addressline><?php echo 
htmlentities($informationObject->getRepository()->getPrimaryContact()->getStreetAddress())
 ?></addressline>
-      <addressline><?php echo 
htmlentities($informationObject->getRepository()->getPrimaryContact()->getCity().',
 '.$informationObject->getRepository()->getPrimaryContact()->getRegion()) 
?></addressline>
-      <addressline><?php echo 
htmlentities($informationObject->getRepositoryCountry().'  
'.$informationObject->getRepository()->getPrimaryContact()->getPostalCode()) 
?></addressline>
-      <addressline><?php echo htmlentities(__('telephone').': 
'.$informationObject->getRepository()->getPrimaryContact()->getTelephone()) 
?></addressline>
-      <addressline><?php echo htmlentities(__('fax').': 
'.$informationObject->getRepository()->getPrimaryContact()->getFax()) 
?></addressline>
-      <addressline><?php echo htmlentities(__('email').': 
'.$informationObject->getRepository()->getPrimaryContact()->getEmail()) 
?></addressline>
-      <addressline><?php echo htmlentities(__('website').': 
'.$informationObject->getRepository()->getPrimaryContact()->getWebsite()) 
?></addressline>
-    </address>
-    <?php endif; ?>
-  </publicationstmt>
-
-  <seriesstmt></seriesstmt>
-  <notestmt></notestmt>
+      <?php if (0 < strlen($addressline = $address->getStreetAddress())): ?>   
   
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = $address->getCity())): ?>      
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = $address->getRegion())): ?>      
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = 
$informationObject->getRepositoryCountry())): ?>      
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = $address->getPostalCode())): ?>      
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = $address->getTelephone())): ?>      
+      <addressline><?php echo __('telephone: ').$addressline 
?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = $address->getFax())): ?>      
+      <addressline><?php echo __('fax: ').$addressline ?></addressline><?php 
endif; ?>
+      <?php if (0 < strlen($addressline = $address->getEmail())): ?>      
+      <addressline><?php echo __('email: ').$addressline ?></addressline><?php 
endif; ?>
+      <?php if (0 < strlen($addressline = $address->getWebsite())): ?>      
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+    </address><?php endif; ?>
+  </publicationstmt><?php endif; ?>
 </filedesc>
 
 <profiledesc>
-  <creation><date/></creation>
+  <?php if (0 < count($informationObject->languageOfDescription)): ?>
   <langusage>
   <?php foreach ($informationObject->languageOfDescription as $languageCode): 
?>
-    <language langcode="<?php echo ($iso6392 = 
$iso639convertor->getID3($languageCode)) ? strtolower($iso6392) : $languageCode 
?>"><?php echo htmlentities(format_language($languageCode)) ?></language>
+    <language langcode="<?php echo ($iso6392 = 
$iso639convertor->getID3($languageCode)) ? strtolower($iso6392) : $languageCode 
?>"><?php echo format_language($languageCode) ?></language>
   <?php endforeach; ?>
   </langusage>
-  <descrules><?php echo htmlentities($informationObject->getRules()) 
?></descrules>
+  <?php endif; ?>
+  <?php if (0 < strlen($rules = $informationObject->getRules())): ?>
+  <descrules><?php echo $rules ?></descrules>
+  <?php endif; ?>
 </profiledesc>
-
-<revisiondesc></revisiondesc>
-
 </eadheader>
 
-
-
 <frontmatter></frontmatter>
 
-
-
-<archdesc level="<?php echo 
htmlentities($informationObject->getLevelOfDescription()->__toString()) ?>" 
type="">
-
-
-<did>
-
-<origination>
-  <?php foreach ($informationObject->getCreators() as $creator): ?>
+<archdesc <?php if (0 < strlen($level = 
$informationObject->getLevelOfDescription()->__toString())) ?><?php echo 
'level="'.strtolower($level).'"' ?>>
+  <did>
+  <?php if (0 < count($creators = $informationObject->getCreators())): ?>
+  <origination>
+  <?php foreach ($creators as $creator): ?>
     <?php if ($type = $creator->getEntityTypeId()): ?>
       <?php if ($type == QubitTerm::PERSON_ID): ?>
-        <persname><?php echo htmlentities($creator->getAuthorizedFormOfName()) 
?></persname>
-      <?php endif; ?>
+        <persname><?php echo $creator->getAuthorizedFormOfName() 
?></persname><?php endif; ?>
       <?php if ($type == QubitTerm::FAMILY_ID): ?>
-        <famname><?php echo htmlentities($creator->getAuthorizedFormOfName()) 
?></famname>
-      <?php endif; ?>
+        <famname><?php echo $creator->getAuthorizedFormOfName() 
?></famname><?php endif; ?>
       <?php if ($type == QubitTerm::CORPORATE_BODY_ID): ?>
-        <corpname><?php echo htmlentities($creator->getAuthorizedFormOfName()) 
?></corpname>
-      <?php endif; ?>
+        <corpname><?php echo $creator->getAuthorizedFormOfName() 
?></corpname><?php endif; ?>
     <?php else: ?>
-      <name><?php echo htmlentities($creator->getAuthorizedFormOfName()) 
?></name>
-    <?php endif; ?>
+      <name><?php echo $creator->getAuthorizedFormOfName() ?></name><?php 
endif; ?>
   <?php endforeach; ?>
-</origination>
-
-<unittitle><?php echo htmlentities($informationObject->getTitle()) 
?></unittitle>
-
-<unitid <?php if ($informationObject->getRepository()): ?>
-repositorycode="<?php echo 
htmlentities($informationObject->getRepository()->getIdentifier()) ?>"
-countrycode="<?php echo 
htmlentities($informationObject->getRepository()->getCountryCode()) ?>"
-<?php endif; ?>
-><?php echo htmlentities($informationObject->getIdentifier()) ?></unitid>
-
-<?php foreach ($informationObject->getCreationEvents() as $event): ?>
-<unitdate type="" datechar="<?php echo 
htmlentities($event->getType()->__toString()) ?>" normal="<?php echo 
htmlentities($event->getStartDate()) ?><?php if ($event->getEndDate()): 
?>/<?php echo htmlentities($event->getEndDate()) ?><?php endif; ?>">
-<?php echo htmlentities($event->getDateDisplay()) ?>
-</unitdate>
-<?php endforeach; ?>
-
-<physdesc>
-  <extent><?php echo htmlentities($informationObject->getExtentAndMedium()) 
?></extent>
-  <phystech><?php echo 
htmlentities($informationObject->getPhysicalCharacteristics()) ?></phystech>
-</physdesc>
-
-<repository>
-  <?php if ($informationObject->getRepository()): ?>
-  <corpname><?php echo htmlentities($informationObject->getRepository()) 
?></corpname>
+  </origination><?php endif; ?>
+  <?php if (0 < strlen($value = $informationObject->getTitle())): ?>
+  <unittitle><?php echo $value ?></unittitle><?php endif; ?>
+  <unitid <?php if ($informationObject->getRepository()): ?><?php if 
($repocode = $informationObject->getRepository()->getIdentifier()): ?><?php 
echo 'repositorycode="'.$repocode.'" ' ?><?php endif; ?>
+  <?php if ($countrycode = 
$informationObject->getRepository()->getCountryCode()): ?><?php echo 
'countrycode="'.$countrycode.'"' ?><?php endif;?><?php endif; ?>><?php echo 
$informationObject->getIdentifier() ?></unitid>
+  <?php foreach ($informationObject->getDates() as $date): ?> 
+  <unitdate <?php if ($datechar = $date->getType()->__toString()): ?><?php 
echo 'datechar="'.strtolower($datechar).'" ' ?><?php endif; ?><?php if 
($startdate = $date->getStartDate()): ?><?php echo 'normal="'?><?php echo 
collapse_date($startdate) ?><?php if ($enddate = $date->getEndDate()): ?><?php 
echo '/'?><?php echo collapse_date($enddate) ?><?php endif; ?><?php echo '"' 
?><?php endif; ?>><?php echo date_display($date) ?></unitdate><?php endforeach; 
?>
+  <?php if (0 < strlen($extent = $informationObject->getExtentAndMedium())): ?>
+  <physdesc><extent><?php echo $extent ?></extent></physdesc><?php endif; ?>
+  <?php if (0 < strlen($phystech = 
$informationObject->getPhysicalCharacteristics())): ?>
+  <phystech><p><?php echo $phystech ?></p></phystech><?php endif; ?>
+  <?php if ($value = $informationObject->getRepository()): ?>
+  <repository>
+    <corpname><?php echo $value->__toString() ?></corpname>
+    <?php if ($address = $value->getPrimaryContact()): ?> 
     <address>
-      <addressline><?php echo 
htmlentities($informationObject->getRepository()) ?></addressline>
-      <addressline><?php echo 
htmlentities($informationObject->getRepository()->getPrimaryContact()->getStreetAddress())
 ?></addressline>
-      <addressline><?php echo 
htmlentities($informationObject->getRepository()->getPrimaryContact()->getCity().',
 '.$informationObject->getRepository()->getPrimaryContact()->getRegion()) 
?></addressline>
-      <addressline><?php echo 
htmlentities($informationObject->getRepositoryCountry().'  
'.$informationObject->getRepository()->getPrimaryContact()->getPostalCode()) 
?></addressline>
-      <addressline><?php echo htmlentities(__('telephone').': 
'.$informationObject->getRepository()->getPrimaryContact()->getTelephone()) 
?></addressline>
-      <addressline><?php echo htmlentities(__('fax').': 
'.$informationObject->getRepository()->getPrimaryContact()->getFax()) 
?></addressline>
-      <addressline><?php echo htmlentities(__('email').': 
'.$informationObject->getRepository()->getPrimaryContact()->getEmail()) 
?></addressline>
-      <addressline><?php echo htmlentities(__('website').': 
'.$informationObject->getRepository()->getPrimaryContact()->getWebsite()) 
?></addressline>
-    </address>
-  <?php endif; ?>
-</repository>
-
-<langmaterial>
-  <?php foreach ($informationObject->language as $languageCode): ?>
-    <language langcode="<?php echo ($iso6392 = 
$iso639convertor->getID3($languageCode)) ? strtolower($iso6392) : $languageCode 
?>"><?php echo htmlentities(format_language($languageCode)) ?></language>
-  <?php endforeach; ?>
-</langmaterial>
-
-<materialspec />
-
-<?php foreach ($informationObject->getNotes() as $note): ?>
-  <note type="<?php echo htmlentities($note->getType()) ?>"><?php echo 
htmlentities($note->getContent()) ?></note>
-<?php endforeach; ?>
-
-
-</did>
-
-
-<?php foreach ($informationObject->getCreators() as $creator): ?>
-  <?php if ($creator->getHistory()): ?>
-  <bioghist>
-    <?php echo htmlentities($creator->getHistory()) ?>
-  </bioghist>
-  <?php endif; ?>
-<?php endforeach; ?>
-
-<scopecontent><?php echo 
htmlentities($informationObject->getScopeAndContent()) ?></scopecontent>
-
-<arrangement><?php echo htmlentities($informationObject->getArrangement()) 
?></arrangement>
-
-<controlaccess>
+      <?php if (0 < strlen($addressline = $address->getStreetAddress())): ?>   
   
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = $address->getCity())): ?>      
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = $address->getRegion())): ?>      
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = 
$informationObject->getRepositoryCountry())): ?>      
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = $address->getPostalCode())): ?>      
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = $address->getTelephone())): ?>      
+      <addressline><?php echo __('telephone: ').$addressline 
?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = $address->getFax())): ?>      
+      <addressline><?php echo __('fax: ').$addressline ?></addressline><?php 
endif; ?>
+      <?php if (0 < strlen($addressline = $address->getEmail())): ?>      
+      <addressline><?php echo __('email: ').$addressline ?></addressline><?php 
endif; ?>
+      <?php if (0 < strlen($addressline = $address->getWebsite())): ?>      
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+    </address><?php endif; ?>
+  </repository><?php endif; ?>
+  <?php if (0 < count($langmaterial = $informationObject->language)): ?>
+  <langmaterial>
+  <?php foreach ($langmaterial as $languageCode): ?>
+    <language langcode="<?php echo ($iso6392 = 
$iso639convertor->getID3($languageCode)) ? strtolower($iso6392) : $languageCode 
?>"><?php echo format_language($languageCode) ?></language><?php endforeach; ?>
+  </langmaterial><?php endif; ?>
+  <?php if (0 < count($notes = $informationObject->getNotes())): ?><?php 
foreach ($notes as $note): ?>
+  <note type="<?php echo $note->getType() ?>"><p><?php echo 
$note->getContent() ?></p></note><?php endforeach; ?><?php endif; ?>
+  </did>
+  <?php foreach ($informationObject->getCreators() as $creator): ?>
+    <?php if ($bioghist = $creator->getHistory()): ?>
+  <bioghist><?php echo $bioghist ?></bioghist><?php endif; ?><?php endforeach; 
?>
+  <?php if (0 < strlen($value = $informationObject->getScopeAndContent())): ?>
+  <scopecontent><?php echo $value ?></scopecontent><?php endif; ?>
+  <?php if (0 < strlen($value = $informationObject->getArrangement())): ?>  
+  <arrangement><?php echo $value ?></arrangement><?php endif; ?>
+  <controlaccess>
   <?php foreach ($informationObject->getActorEvents() as $event): ?>
     <?php if ($event->getActor()->getEntityTypeId() == QubitTerm::PERSON_ID): 
?>
-      <persname role="<?php echo htmlentities($event->getType()->getRole()) 
?>"><?php echo htmlentities(render_title($event->getActor())) ?> </persname>
+    <persname role="<?php echo $event->getType()->getRole() ?>"><?php echo 
render_title($event->getActor()) ?> </persname>
      <?php elseif ($event->getActor()->getEntityTypeId() == 
QubitTerm::FAMILY_ID): ?>
-      <famname role="<?php echo htmlentities($event->getType()->getRole()) 
?>"><?php echo htmlentities(render_title($event->getActor())) ?> </famname>
+    <famname role="<?php echo $event->getType()->getRole() ?>"><?php echo 
render_title($event->getActor()) ?> </famname>
     <?php else: ?>
-      <corpname role="<?php echo htmlentities($event->getType()->getRole()) 
?>"><?php echo htmlentities(render_title($event->getActor())) ?> </corpname>
+    <corpname role="<?php echo $event->getType()->getRole() ?>"><?php echo 
render_title($event->getActor()) ?> </corpname>
     <?php endif; ?>
   <?php endforeach; ?>
   <?php foreach ($informationObject->getMaterialTypes() as $materialtype): ?>
-    <genreform><?php echo htmlentities($materialtype->getTerm()) ?></genreform>
+    <genreform><?php echo $materialtype->getTerm() ?></genreform>
   <?php endforeach; ?>
   <?php foreach ($informationObject->getSubjectAccessPoints() as $subject): ?>
-    <subject><?php echo htmlentities($subject->getTerm()) ?></subject>
+    <subject><?php echo $subject->getTerm() ?></subject>
   <?php endforeach; ?>
   <?php foreach ($informationObject->getPlaceAccessPoints() as $place): ?>
-    <geogname><?php echo htmlentities($place->getTerm()) ?></geogname>
+    <geogname><?php echo $place->getTerm() ?></geogname>
   <?php endforeach; ?>
-  <occupation />
-  <function />
-  <title />
-</controlaccess>
-
-<accessrestrict><?php echo 
htmlentities($informationObject->getAccessConditions()) ?></accessrestrict>
-
-<accruals><?php echo htmlentities($informationObject->getAccruals()) 
?></accruals>
-
-<acqinfo><?php echo htmlentities($informationObject->getAcquisition()) 
?></acqinfo>
-
-<altformavail><?php echo 
htmlentities($informationObject->getLocationOfCopies()) ?></altformavail>
-
-<appraisal><?php echo htmlentities($informationObject->getAppraisal()) 
?></appraisal>
-
-<custodhist><?php echo htmlentities($informationObject->getArchivalHistory()) 
?></custodhist>
-
-<processinfo><?php echo htmlentities($informationObject->getRevisionHistory()) 
?></processinfo>
-
-<userestrict><?php echo 
htmlentities($informationObject->getReproductionConditions()) ?></userestrict>
-
-<originalsloc><?php echo 
htmlentities($informationObject->getLocationOfOriginals()) ?></originalsloc>
-
-<relatedmaterial><?php echo 
htmlentities($informationObject->getRelatedUnitsOfDescription()) 
?></relatedmaterial>
-
-<separatedmaterial/>
-
-<otherfindaid><?php echo htmlentities($informationObject->getFindingAids()) 
?></otherfindaid>
-
-
-<dsc type="combined">
-<?php $nestedRgt = array() ?>
-<?php foreach ($informationObject->getDescendants()->orderBy('lft') as 
$descendant): ?>
-<c level="<?php echo htmlentities($descendant->getLevelOfDescription()) ?>">
-
-<did>
-
-<?php foreach ($descendant->getPhysicalObjects() as $physicalObject): ?>
-<?php if ($physicalObject->getLocation()): ?>
-  <physloc><?php echo $physicalObject->getLocation() ?></physloc>
-<?php endif; ?>
-<?php if ($physicalObject->getName()): ?>
-  <container type="<?php echo $physicalObject->getType() ?>"><?php echo 
$physicalObject->getName() ?></container>
-<?php endif; ?>
-<?php endforeach; ?>
-
-<origination>
-  <?php foreach ($descendant->getCreators() as $creator): ?>
+  </controlaccess>
+  <?php if (0 < strlen($value = $informationObject->getAccessConditions())): ?>
+  <accessrestrict><?php echo $value ?></accessrestrict><?php endif; ?>
+  <?php if (0 < strlen($value = $informationObject->getAccruals())): ?>
+  <accruals><?php echo $value ?></accruals><?php endif; ?>
+  <?php if (0 < strlen($value = $informationObject->getAcquisition())): ?>
+  <acqinfo><?php echo $value ?></acqinfo><?php endif; ?>
+  <?php if (0 < strlen($value = $informationObject->getLocationOfCopies())): ?>
+  <altformavail><?php echo $value ?></altformavail><?php endif; ?>  
+  <?php if (0 < strlen($value = $informationObject->getAppraisal())): ?>
+  <appraisal><?php echo $value ?></appraisal><?php endif; ?>
+  <?php if (0 < strlen($value = $informationObject->getArchivalHistory())): ?>
+  <custodhist><?php echo $value ?></custodhist><?php endif; ?>
+  <?php if (0 < strlen($value = $informationObject->getRevisionHistory())): ?> 
 
+  <processinfo><?php echo $value ?></processinfo><?php endif; ?>
+  <?php if (0 < strlen($value = 
$informationObject->getReproductionConditions())): ?>
+  <userestrict><?php echo $value  ?></userestrict><?php endif; ?>
+  <?php if (0 < strlen($value = 
$informationObject->getLocationOfOriginals())): ?>
+  <originalsloc><?php echo $value ?></originalsloc><?php endif; ?>
+  <?php if (0 < strlen($value = 
$informationObject->getRelatedUnitsOfDescription())): ?>
+  <relatedmaterial><?php echo $value ?></relatedmaterial><?php endif; ?>
+  <?php if (0 < strlen($value = $informationObject->getFindingAids())): ?>
+  <otherfindaid><?php echo $value ?></otherfindaid><?php endif; ?>
+
+    <dsc type="combined"><?php $nestedRgt = array() ?><?php foreach 
($informationObject->getDescendants()->orderBy('lft') as $descendant): ?>
+    <c level="<?php echo strtolower($descendant->getLevelOfDescription()) ?>">
+    <did>
+    <?php foreach ($descendant->getPhysicalObjects() as $physicalObject): 
?><?php if ($physicalObject->getLocation()): ?>
+    <physloc><?php echo $physicalObject->getLocation() ?></physloc><?php 
endif; ?>
+    <?php if ($physicalObject->getName()): ?>
+    <container type="<?php echo $physicalObject->getType() ?>"><?php echo 
$physicalObject->getName() ?></container><?php endif; ?>
+    <?php endforeach; ?>
+
+    <?php if (0 < count($creators = $descendant->getCreators())): ?>
+    <origination>
+    <?php foreach ($creators as $creator): ?>
     <?php if ($type = $creator->getEntityTypeId()): ?>
       <?php if ($type == QubitTerm::PERSON_ID): ?>
-        <persname><?php echo htmlentities($creator->getAuthorizedFormOfName()) 
?></persname>
-      <?php endif; ?>
+      <persname><?php echo $creator->getAuthorizedFormOfName() 
?></persname><?php endif; ?>
       <?php if ($type == QubitTerm::FAMILY_ID): ?>
-        <famname><?php echo htmlentities($creator->getAuthorizedFormOfName()) 
?></famname>
-      <?php endif; ?>
+      <famname><?php echo $creator->getAuthorizedFormOfName() 
?></famname><?php endif; ?>
       <?php if ($type == QubitTerm::CORPORATE_BODY_ID): ?>
-        <corpname><?php echo htmlentities($creator->getAuthorizedFormOfName()) 
?></corpname>
-      <?php endif; ?>
+      <corpname><?php echo $creator->getAuthorizedFormOfName() 
?></corpname><?php endif; ?>
     <?php else: ?>
-      <name><?php echo htmlentities($creator->getAuthorizedFormOfName()) 
?></name>
-    <?php endif; ?>
-  <?php endforeach; ?>
-</origination>
-
-<unittitle><?php echo htmlentities($descendant->getTitle()) ?></unittitle>
-
-<unitid
-<?php if ($descendant->getRepository()): ?>
-repositorycode="<?php echo 
htmlentities($descendant->getRepository()->getIdentifier()) ?>"
-countrycode="<?php echo 
htmlentities($descendant->getRepository()->getCountryCode()) ?>"
-<?php endif; ?>
-><?php echo htmlentities($descendant->getIdentifier()) ?></unitid>
-
-<?php foreach ($descendant->getCreationEvents() as $event): ?>
-<unitdate type="" datechar="<?php echo htmlentities($event->getType()) ?>" 
normal="<?php echo htmlentities($event->getStartDate()) ?><?php if 
($event->getEndDate()): ?>/<?php echo htmlentities($event->getEndDate()) 
?><?php endif; ?>">
-<?php echo htmlentities($event->getDateDisplay()) ?>
-</unitdate>
-<?php endforeach; ?>
-
-<physdesc>
-  <extent><?php echo htmlentities($descendant->getExtentAndMedium()) 
?></extent>
-  <phystech><?php echo htmlentities($descendant->getPhysicalCharacteristics()) 
?></phystech>
-</physdesc>
-
-<repository>
-  <?php if ($descendant->getRepository()): ?>
-  <corpname><?php echo htmlentities($descendant->getRepository()) ?></corpname>
-    <address>
-      <addressline><?php echo htmlentities($descendant->getRepository()) 
?></addressline>
-      <addressline><?php echo 
htmlentities($descendant->getRepository()->getPrimaryContact()->getStreetAddress())
 ?></addressline>
-      <addressline><?php echo 
htmlentities($descendant->getRepository()->getPrimaryContact()->getCity().', 
'.$descendant->getRepository()->getPrimaryContact()->getRegion()) 
?></addressline>
-      <addressline><?php echo 
htmlentities($descendant->getRepositoryCountry().'  
'.$descendant->getRepository()->getPrimaryContact()->getPostalCode()) 
?></addressline>
-      <addressline><?php echo htmlentities(__('telephone').': 
'.$descendant->getRepository()->getPrimaryContact()->getTelephone()) 
?></addressline>
-      <addressline><?php echo htmlentities(__('fax').': 
'.$descendant->getRepository()->getPrimaryContact()->getFax()) ?></addressline>
-      <addressline><?php echo htmlentities(__('email').': 
'.$descendant->getRepository()->getPrimaryContact()->getEmail()) 
?></addressline>
-      <addressline><?php echo htmlentities(__('website').': 
'.$descendant->getRepository()->getPrimaryContact()->getWebsite()) 
?></addressline>
-    </address>
-  <?php endif; ?>
-</repository>
-
-<langmaterial>
-  <?php foreach ($informationObject->language as $languageCode): ?>
-    <language langcode="<?php echo ($iso6392 = 
$iso639convertor->getID3($languageCode)) ? strtolower($iso6392) : $languageCode 
?>"><?php echo htmlentities(format_language($languageCode)) ?></language>
-  <?php endforeach; ?>
-</langmaterial>
-
-<materialspec />
-
-<?php foreach ($descendant->getNotes() as $note): ?>
-  <note type="<?php echo htmlentities($note->getType()) ?>"><?php echo 
htmlentities($note->getContent()) ?></note>
-<?php endforeach; ?>
-
-</did>
-
-
-<?php foreach ($descendant->getCreators() as $creator): ?>
-  <?php if ($creator->getHistory()): ?>
-  <bioghist>
-    <?php echo htmlentities($creator->getHistory()) ?>
-  </bioghist>
+      <name><?php echo $creator->getAuthorizedFormOfName() ?></name><?php 
endif; ?>
+    <?php endforeach; ?>
+    </origination><?php endif; ?>
+    <?php if (0 < strlen($value = $descendant->getTitle())): ?>
+    <unittitle><?php echo $value ?></unittitle><?php endif; ?>
+    <unitid <?php if ($descendant->getRepository()): ?><?php if ($repocode = 
$descendant->getRepository()->getIdentifier()): ?><?php echo 
'repositorycode="'.$repocode.'" ' ?><?php endif; ?>
+    <?php if ($countrycode = $descendant->getRepository()->getCountryCode()): 
?><?php echo 'countrycode="'.$countrycode.'"' ?><?php endif;?><?php endif; 
?>><?php echo $descendant->getIdentifier() ?></unitid>
+    <?php foreach ($descendant->getDates() as $date): ?> 
+    <unitdate <?php if ($datechar = $date->getType()->__toString()): ?><?php 
echo 'datechar="'.strtolower($datechar).'" ' ?><?php endif; ?><?php if 
($startdate = $date->getStartDate()): ?><?php echo 'normal="'?><?php echo 
collapse_date($startdate) ?><?php if ($enddate = $date->getEndDate()): ?><?php 
echo '/'?><?php echo collapse_date($enddate) ?><?php endif; ?><?php echo '"' 
?><?php endif; ?>><?php echo date_display($date) ?></unitdate><?php endforeach; 
?>
+    <?php if (0 < strlen($extent = $descendant->getExtentAndMedium())): ?>
+    <physdesc><extent><?php echo $extent ?></extent></physdesc><?php endif; ?>
+    <?php if (0 < strlen($phystech = 
$descendant->getPhysicalCharacteristics())): ?>
+    <phystech><p><?php echo $phystech ?></p></phystech><?php endif; ?>
+    <?php if ($value = $descendant->getRepository()): ?>
+    <repository>
+      <corpname><?php echo $value->__toString() ?></corpname>
+      <?php if ($address = $value->getPrimaryContact()): ?> 
+      <address>
+      <?php if (0 < strlen($addressline = $address->getStreetAddress())): ?>   
   
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = $address->getCity())): ?>      
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = $address->getRegion())): ?>      
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = 
$informationObject->getRepositoryCountry())): ?>      
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = $address->getPostalCode())): ?>      
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = $address->getTelephone())): ?>      
+      <addressline><?php echo __('telephone: ').$addressline 
?></addressline><?php endif; ?>
+      <?php if (0 < strlen($addressline = $address->getFax())): ?>      
+      <addressline><?php echo __('fax: ').$addressline ?></addressline><?php 
endif; ?>
+      <?php if (0 < strlen($addressline = $address->getEmail())): ?>      
+      <addressline><?php echo __('email: ').$addressline ?></addressline><?php 
endif; ?>
+      <?php if (0 < strlen($addressline = $address->getWebsite())): ?>      
+      <addressline><?php echo $addressline ?></addressline><?php endif; ?>
+      </address><?php endif; ?>
+    </repository><?php endif; ?>
+    <?php if (0 < count($langmaterial = $descendant->language)): ?>
+    <langmaterial>
+    <?php foreach ($langmaterial as $languageCode): ?>
+      <language langcode="<?php echo ($iso6392 = 
$iso639convertor->getID3($languageCode)) ? strtolower($iso6392) : $languageCode 
?>"><?php echo format_language($languageCode) ?></language><?php endforeach; ?>
+    </langmaterial><?php endif; ?>
+    <?php if (0 < count($notes = $descendant->getNotes())): ?><?php foreach 
($notes as $note): ?>
+    <note type="<?php echo $note->getType() ?>"><p><?php echo 
$note->getContent() ?></p></note><?php endforeach; ?><?php endif; ?>
+    </did>
+
+    <?php foreach ($descendant->getCreators() as $creator): ?>
+    <?php if ($bioghist = $creator->getHistory()): ?>
+    <bioghist><?php echo $bioghist ?></bioghist><?php endif; ?><?php 
endforeach; ?>
+    <?php if (0 < strlen($value = $descendant->getScopeAndContent())): ?>
+    <scopecontent><?php echo $value ?></scopecontent><?php endif; ?>
+    <?php if (0 < strlen($value = $descendant->getArrangement())): ?>  
+    <arrangement><?php echo $value ?></arrangement><?php endif; ?>
+    <controlaccess>
+    <?php foreach ($descendant->getActorEvents() as $event): ?>
+      <?php if ($event->getActor()->getEntityTypeId() == 
QubitTerm::PERSON_ID): ?>
+      <persname role="<?php echo $event->getType()->getRole() ?>"><?php echo 
render_title($event->getActor()) ?> </persname>
+      <?php elseif ($event->getActor()->getEntityTypeId() == 
QubitTerm::FAMILY_ID): ?>
+      <famname role="<?php echo $event->getType()->getRole() ?>"><?php echo 
render_title($event->getActor()) ?> </famname>
+      <?php else: ?>
+      <corpname role="<?php echo $event->getType()->getRole() ?>"><?php echo 
render_title($event->getActor()) ?> </corpname>
+      <?php endif; ?>
+    <?php endforeach; ?>
+    <?php foreach ($descendant->getMaterialTypes() as $materialtype): ?>
+    <genreform><?php echo $materialtype->getTerm() ?></genreform>
+    <?php endforeach; ?>
+    <?php foreach ($descendant->getSubjectAccessPoints() as $subject): ?>
+    <subject><?php echo $subject->getTerm() ?></subject>
+    <?php endforeach; ?>
+    <?php foreach ($descendant->getPlaceAccessPoints() as $place): ?>
+    <geogname><?php echo $place->getTerm() ?></geogname>
+    <?php endforeach; ?>
+    </controlaccess>
+    <?php if (0 < strlen($value = $descendant->getAccessConditions())): ?>
+    <accessrestrict><?php echo $value ?></accessrestrict><?php endif; ?>
+    <?php if (0 < strlen($value = $descendant->getAccruals())): ?>
+    <accruals><?php echo $value ?></accruals><?php endif; ?>
+    <?php if (0 < strlen($value = $descendant->getAcquisition())): ?>
+    <acqinfo><?php echo $value ?></acqinfo><?php endif; ?>
+    <?php if (0 < strlen($value = $descendant->getLocationOfCopies())): ?>
+    <altformavail><?php echo $value ?></altformavail><?php endif; ?>  
+    <?php if (0 < strlen($value = $descendant->getAppraisal())): ?>
+    <appraisal><?php echo $value ?></appraisal><?php endif; ?>
+    <?php if (0 < strlen($value = $descendant->getArchivalHistory())): ?>
+    <custodhist><?php echo $value ?></custodhist><?php endif; ?>
+    <?php if (0 < strlen($value = $descendant->getRevisionHistory())): ?>  
+    <processinfo><?php echo $value ?></processinfo><?php endif; ?>
+    <?php if (0 < strlen($value = $descendant->getReproductionConditions())): 
?>
+    <userestrict><?php echo $value  ?></userestrict><?php endif; ?>
+    <?php if (0 < strlen($value = $descendant->getLocationOfOriginals())): ?>
+    <originalsloc><?php echo $value ?></originalsloc><?php endif; ?>
+    <?php if (0 < strlen($value = 
$descendant->getRelatedUnitsOfDescription())): ?>
+    <relatedmaterial><?php echo $value ?></relatedmaterial><?php endif; ?>
+    <?php if (0 < strlen($value = $descendant->getFindingAids())): ?>
+    <otherfindaid><?php echo $value ?></otherfindaid><?php endif; ?>
+
+  <?php if ($descendant->getRgt() == $descendant->getLft() + 1): ?>
+  </c>
+  <?php else: ?>
+  <?php array_push($nestedRgt, $descendant->getRgt()) ?>
   <?php endif; ?>
-<?php endforeach; ?>
-
-<scopecontent><?php echo htmlentities($descendant->getScopeAndContent()) 
?></scopecontent>
-
-<arrangement><?php echo htmlentities($descendant->getArrangement()) 
?></arrangement>
 
-<controlaccess>
-  <?php foreach ($descendant->getActorEvents() as $event): ?>
-    <?php if ($event->getActor()->getEntityTypeId() == QubitTerm::PERSON_ID): 
?>
-      <persname role="<?php echo htmlentities($event->getType()->getRole()) 
?>"><?php echo htmlentities(render_title($event->getActor())) ?> </persname>
-     <?php elseif ($event->getActor()->getEntityTypeId() == 
QubitTerm::FAMILY_ID): ?>
-      <famname role="<?php echo htmlentities($event->getType()->getRole()) 
?>"><?php echo htmlentities(render_title($event->getActor())) ?> </famname>
-    <?php else: ?>
-      <corpname role="<?php echo htmlentities($event->getType()->getRole()) 
?>"><?php echo htmlentities(render_title($event->getActor())) ?> </corpname>
-    <?php endif; ?>
-  <?php endforeach; ?>
-  <?php foreach ($descendant->getMaterialTypes() as $materialtype): ?>
-    <genreform><?php echo htmlentities($materialtype->getTerm()) ?></genreform>
-  <?php endforeach; ?>
-  <?php foreach ($descendant->getSubjectAccessPoints() as $subject): ?>
-    <subject><?php echo htmlentities($subject->getTerm()) ?></subject>
+  <?php // close <c> tag when we reach end of child list ?>
+  <?php $rgt = $descendant->getRgt() ?>
+  <?php while (count($nestedRgt) > 0 && $rgt + 1 == 
$nestedRgt[count($nestedRgt) - 1]): ?>
+  <?php $rgt = array_pop($nestedRgt); ?>
+  </c>
+  <?php endwhile; ?>
   <?php endforeach; ?>
-  <?php foreach ($descendant->getPlaceAccessPoints() as $place): ?>
-    <geogname><?php echo htmlentities($place->getTerm()) ?></geogname>
-  <?php endforeach; ?>
-  <occupation />
-  <function />
-  <title />
-</controlaccess>
-
-<accessrestrict><?php echo htmlentities($descendant->getAccessConditions()) 
?></accessrestrict>
-
-<accruals><?php echo htmlentities($descendant->getAccruals()) ?></accruals>
-
-<acqinfo><?php echo htmlentities($descendant->getAcquisition()) ?></acqinfo>
-
-<altformavail><?php echo htmlentities($descendant->getLocationOfCopies()) 
?></altformavail>
-
-<appraisal><?php echo htmlentities($descendant->getAppraisal()) ?></appraisal>
-
-<custodhist><?php echo htmlentities($descendant->getArchivalHistory()) 
?></custodhist>
-
-<processinfo><?php echo htmlentities($descendant->getRevisionHistory()) 
?></processinfo>
-
-<userestrict><?php echo htmlentities($descendant->getReproductionConditions()) 
?></userestrict>
-
-<originalsloc><?php echo htmlentities($descendant->getLocationOfOriginals()) 
?></originalsloc>
-
-<relatedmaterial><?php echo 
htmlentities($descendant->getRelatedUnitsOfDescription()) ?></relatedmaterial>
-
-<separatedmaterial/>
-
-<otherfindaid><?php echo htmlentities($descendant->getFindingAids()) 
?></otherfindaid>
-
-<?php if ($descendant->getRgt() == $descendant->getLft() + 1): ?>
-</c>
-<?php else: ?>
-<?php array_push($nestedRgt, $descendant->getRgt()) ?>
-<?php endif; ?>
 
-<?php // close <c> tag when we reach end of child list ?>
-<?php $rgt = $descendant->getRgt() ?>
-<?php while (count($nestedRgt) > 0 && $rgt + 1 == $nestedRgt[count($nestedRgt) 
- 1]): ?>
-<?php $rgt = array_pop($nestedRgt); ?>
-</c>
-<?php endwhile; ?>
-<?php endforeach; ?>
-</dsc>
+  </dsc>
 </archdesc>
 </ead>

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