Author: peter
Date: Wed Sep  9 18:45:07 2009
New Revision: 3213

Log:
complete EAD export cleanup to eliminate all EAD DTD validation errors

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

Modified: 
trunk/apps/qubit/modules/informationobject/templates/exportEadSuccess.xml.php
==============================================================================
--- 
trunk/apps/qubit/modules/informationobject/templates/exportEadSuccess.xml.php   
    Wed Sep  9 17:37:31 2009        (r3212)
+++ 
trunk/apps/qubit/modules/informationobject/templates/exportEadSuccess.xml.php   
    Wed Sep  9 18:45:07 2009        (r3213)
@@ -68,6 +68,12 @@
 
 <archdesc <?php if (0 < strlen($level = 
$informationObject->getLevelOfDescription()->__toString())) ?><?php echo 
'level="'.strtolower($level).'"' ?>>
   <did>
+  <?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 < count($creators = $informationObject->getCreators())): ?>
   <origination>
   <?php foreach ($creators as $creator): ?>
@@ -82,16 +88,8 @@
       <name><?php echo $creator->getAuthorizedFormOfName() ?></name><?php 
endif; ?>
   <?php endforeach; ?>
   </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>
@@ -127,11 +125,15 @@
   </did>
   <?php foreach ($informationObject->getCreators() as $creator): ?>
     <?php if ($bioghist = $creator->getHistory()): ?>
-  <bioghist><?php echo $bioghist ?></bioghist><?php endif; ?><?php endforeach; 
?>
+  <bioghist><p><?php echo $bioghist ?></p></bioghist><?php endif; ?><?php 
endforeach; ?>
   <?php if (0 < strlen($value = $informationObject->getScopeAndContent())): ?>
-  <scopecontent><?php echo $value ?></scopecontent><?php endif; ?>
+  <scopecontent><p><?php echo $value ?></p></scopecontent><?php endif; ?>
   <?php if (0 < strlen($value = $informationObject->getArrangement())): ?>  
-  <arrangement><?php echo $value ?></arrangement><?php endif; ?>
+  <arrangement><p><?php echo $value ?></p></arrangement><?php endif; ?>
+  <?php if ((0 < count($materialtypes = 
$informationObject->getMaterialTypes())) ||
+            (0 < count($subjects = 
$informationObject->getSubjectAccessPoints())) ||
+            (0 < count($places = $informationObject->getPlaceAccessPoints())) 
|| 
+            (0 < count($informationObject->getActors()))): ?>
   <controlaccess>
   <?php foreach ($informationObject->getActorEvents() as $event): ?>
     <?php if ($event->getActor()->getEntityTypeId() == QubitTerm::PERSON_ID): 
?>
@@ -142,38 +144,41 @@
     <corpname role="<?php echo $event->getType()->getRole() ?>"><?php echo 
render_title($event->getActor()) ?> </corpname>
     <?php endif; ?>
   <?php endforeach; ?>
-  <?php foreach ($informationObject->getMaterialTypes() as $materialtype): ?>
+  <?php foreach ($materialtypes as $materialtype): ?>
     <genreform><?php echo $materialtype->getTerm() ?></genreform>
   <?php endforeach; ?>
-  <?php foreach ($informationObject->getSubjectAccessPoints() as $subject): ?>
+  <?php foreach ($subjects as $subject): ?>
     <subject><?php echo $subject->getTerm() ?></subject>
   <?php endforeach; ?>
-  <?php foreach ($informationObject->getPlaceAccessPoints() as $place): ?>
+  <?php foreach ($places as $place): ?>
     <geogname><?php echo $place->getTerm() ?></geogname>
   <?php endforeach; ?>
   </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 endif; ?>
+  <?php if (0 < strlen($phystech = 
$informationObject->getPhysicalCharacteristics())): ?>
+  <phystech><p><?php echo $phystech ?></p></phystech><?php endif; ?>
   <?php if (0 < strlen($value = $informationObject->getAppraisal())): ?>
-  <appraisal><?php echo $value ?></appraisal><?php endif; ?>
+  <appraisal><p><?php echo $value ?></p></appraisal><?php endif; ?>
+  <?php if (0 < strlen($value = $informationObject->getAcquisition())): ?>
+  <acqinfo><p><?php echo $value ?></p></acqinfo><?php endif; ?>
+  <?php if (0 < strlen($value = $informationObject->getAccruals())): ?>
+  <accruals><p><?php echo $value ?></p></accruals><?php endif; ?>
   <?php if (0 < strlen($value = $informationObject->getArchivalHistory())): ?>
-  <custodhist><?php echo $value ?></custodhist><?php endif; ?>
+  <custodhist><p><?php echo $value ?></p></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; ?>
+  <processinfo><p><?php echo $value ?></p></processinfo><?php endif; ?>
   <?php if (0 < strlen($value = 
$informationObject->getLocationOfOriginals())): ?>
-  <originalsloc><?php echo $value ?></originalsloc><?php endif; ?>
+  <originalsloc><p><?php echo $value ?></p></originalsloc><?php endif; ?>
+  <?php if (0 < strlen($value = $informationObject->getLocationOfCopies())): ?>
+  <altformavail><p><?php echo $value ?></p></altformavail><?php endif; ?>
   <?php if (0 < strlen($value = 
$informationObject->getRelatedUnitsOfDescription())): ?>
-  <relatedmaterial><?php echo $value ?></relatedmaterial><?php endif; ?>
+  <relatedmaterial><p><?php echo $value ?></p></relatedmaterial><?php endif; ?>
+  <?php if (0 < strlen($value = $informationObject->getAccessConditions())): ?>
+  <accessrestrict><p><?php echo $value ?></p></accessrestrict><?php endif; ?>  
+  <?php if (0 < strlen($value = 
$informationObject->getReproductionConditions())): ?>
+  <userestrict><p><?php echo $value  ?></p></userestrict><?php endif; ?>
   <?php if (0 < strlen($value = $informationObject->getFindingAids())): ?>
-  <otherfindaid><?php echo $value ?></otherfindaid><?php endif; ?>
+  <otherfindaid><p><?php echo $value ?></p></otherfindaid><?php endif; ?>
 
     <dsc type="combined"><?php $nestedRgt = array() ?><?php foreach 
($informationObject->getDescendants()->orderBy('lft') as $descendant): ?>
     <c level="<?php echo strtolower($descendant->getLevelOfDescription()) ?>">
@@ -181,9 +186,15 @@
     <?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; ?>
+    <container type="<?php echo str_replace(' ', '', 
$physicalObject->getType()) ?>"><?php echo $physicalObject->getName() 
?></container><?php endif; ?>
     <?php endforeach; ?>
 
+    <?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 < count($creators = $descendant->getCreators())): ?>
     <origination>
     <?php foreach ($creators as $creator): ?>
@@ -198,16 +209,8 @@
       <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>
@@ -241,14 +244,19 @@
     <?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 if (0 < strlen($phystech = 
$descendant->getPhysicalCharacteristics())): ?>
+    <phystech><p><?php echo $phystech ?></p></phystech><?php endif; ?>
     <?php foreach ($descendant->getCreators() as $creator): ?>
     <?php if ($bioghist = $creator->getHistory()): ?>
-    <bioghist><?php echo $bioghist ?></bioghist><?php endif; ?><?php 
endforeach; ?>
+    <bioghist><p><?php echo $bioghist ?></p></bioghist><?php endif; ?><?php 
endforeach; ?>
     <?php if (0 < strlen($value = $descendant->getScopeAndContent())): ?>
-    <scopecontent><?php echo $value ?></scopecontent><?php endif; ?>
+    <scopecontent><p><?php echo $value ?></p></scopecontent><?php endif; ?>
     <?php if (0 < strlen($value = $descendant->getArrangement())): ?>  
-    <arrangement><?php echo $value ?></arrangement><?php endif; ?>
+    <arrangement><p><?php echo $value ?></p></arrangement><?php endif; ?>
+    <?php if ((0 < count($materialtypes = $descendant->getMaterialTypes())) ||
+            (0 < count($subjects = $descendant->getSubjectAccessPoints())) ||
+            (0 < count($places = $descendant->getPlaceAccessPoints())) || 
+            (0 < count($descendant->getActors()))): ?>
     <controlaccess>
     <?php foreach ($descendant->getActorEvents() as $event): ?>
       <?php if ($event->getActor()->getEntityTypeId() == 
QubitTerm::PERSON_ID): ?>
@@ -258,39 +266,41 @@
       <?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 endforeach; ?>
+      <?php foreach ($materialtypes as $materialtype): ?>
+        <genreform><?php echo $materialtype->getTerm() ?></genreform>
+      <?php endforeach; ?>
+      <?php foreach ($subjects as $subject): ?>
+        <subject><?php echo $subject->getTerm() ?></subject>
+      <?php endforeach; ?>
+      <?php foreach ($places as $place): ?>
+        <geogname><?php echo $place->getTerm() ?></geogname>
+      <?php endforeach; ?>
+    </controlaccess><?php endif; ?>
+    <?php if (0 < strlen($phystech = 
$descendant->getPhysicalCharacteristics())): ?>
+    <phystech><p><?php echo $phystech ?></p></phystech><?php endif; ?>
     <?php if (0 < strlen($value = $descendant->getAppraisal())): ?>
-    <appraisal><?php echo $value ?></appraisal><?php endif; ?>
+    <appraisal><p><?php echo $value ?></p></appraisal><?php endif; ?>
+    <?php if (0 < strlen($value = $descendant->getAcquisition())): ?>
+    <acqinfo><p><?php echo $value ?></p></acqinfo><?php endif; ?>
+    <?php if (0 < strlen($value = $descendant->getAccruals())): ?>
+    <accruals><p><?php echo $value ?></p></accruals><?php endif; ?>
     <?php if (0 < strlen($value = $descendant->getArchivalHistory())): ?>
-    <custodhist><?php echo $value ?></custodhist><?php endif; ?>
+    <custodhist><p><?php echo $value ?></p></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; ?>
+    <processinfo><p><?php echo $value ?></p></processinfo><?php endif; ?>
     <?php if (0 < strlen($value = $descendant->getLocationOfOriginals())): ?>
-    <originalsloc><?php echo $value ?></originalsloc><?php endif; ?>
+    <originalsloc><p><?php echo $value ?></p></originalsloc><?php endif; ?>
+    <?php if (0 < strlen($value = $descendant->getLocationOfCopies())): ?>
+    <altformavail><p><?php echo $value ?></p></altformavail><?php endif; ?>
     <?php if (0 < strlen($value = 
$descendant->getRelatedUnitsOfDescription())): ?>
-    <relatedmaterial><?php echo $value ?></relatedmaterial><?php endif; ?>
+    <relatedmaterial><p><?php echo $value ?></p></relatedmaterial><?php endif; 
?>
+    <?php if (0 < strlen($value = $descendant->getAccessConditions())): ?>
+    <accessrestrict><p><?php echo $value ?></p></accessrestrict><?php endif; 
?>  
+    <?php if (0 < strlen($value = $descendant->getReproductionConditions())): 
?>
+    <userestrict><p><?php echo $value  ?></p></userestrict><?php endif; ?>
     <?php if (0 < strlen($value = $descendant->getFindingAids())): ?>
-    <otherfindaid><?php echo $value ?></otherfindaid><?php endif; ?>
+    <otherfindaid><p><?php echo $value ?></p></otherfindaid><?php endif; ?>
 
   <?php if ($descendant->getRgt() == $descendant->getLft() + 1): ?>
   </c>

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