Author: sevein
Date: Tue Jul 24 12:36:29 2012
New Revision: 11972

Log:
Add visibility checks, fixes issue 1931

Modified:
   trunk/apps/qubit/modules/digitalobject/templates/_metadata.php
   trunk/apps/qubit/modules/informationobject/templates/_contextMenu.php
   trunk/apps/qubit/modules/settings/templates/visibleElementsSuccess.php
   trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/indexSuccess.php
   trunk/plugins/sfRadPlugin/modules/sfRadPlugin/templates/indexSuccess.php

Modified: trunk/apps/qubit/modules/digitalobject/templates/_metadata.php
==============================================================================
--- trunk/apps/qubit/modules/digitalobject/templates/_metadata.php      Tue Jul 
24 12:35:14 2012        (r11971)
+++ trunk/apps/qubit/modules/digitalobject/templates/_metadata.php      Tue Jul 
24 12:36:29 2012        (r11972)
@@ -10,22 +10,35 @@
 
   <?php if (QubitAcl::check($resource->informationObject, 'readMaster')): ?>
     <?php if (QubitTerm::EXTERNAL_URI_ID == $resource->usageId): ?>
-      <?php echo render_show(__('URL'), render_value($resource->path)) ?>
+      <?php if 
(check_field_visibility('app_element_visibility_digital_object_url')): ?>
+        <?php echo render_show(__('URL'), render_value($resource->path)) ?>
+      <?php endif; ?>
     <?php else: ?>
-      <?php echo render_show(__('Filename'), $resource->name) ?>
+      <?php if 
(check_field_visibility('app_element_visibility_digital_object_file_name')): ?>
+        <?php echo render_show(__('Filename'), $resource->name) ?>
+      <?php endif; ?>
     <?php endif; ?>
   <?php endif; ?>
 
-  <?php echo render_show(__('Media type'), $resource->mediaType) ?>
-
-  <?php echo render_show(__('Mime-type'), $resource->mimeType) ?>
+  <?php if 
(check_field_visibility('app_element_visibility_digital_object_media_type')): ?>
+    <?php echo render_show(__('Media type'), $resource->mediaType) ?>
+  <?php endif; ?>
 
-  <?php echo render_show(__('Filesize'), hr_filesize($resource->byteSize)) ?>
+  <?php if 
(check_field_visibility('app_element_visibility_digital_object_mime_type')): ?>
+    <?php echo render_show(__('Mime-type'), $resource->mimeType) ?>
+  <?php endif; ?>
 
-  <?php echo render_show(__('Uploaded'), format_date($resource->createdAt, 
'f')) ?>
+  <?php if 
(check_field_visibility('app_element_visibility_digital_object_file_size')): ?>
+    <?php echo render_show(__('Filesize'), hr_filesize($resource->byteSize)) ?>
+  <?php endif; ?>
 
-  <?php echo render_show(__('Object UUID'), 
$resource->informationObject->objectUUID) ?>
+  <?php if 
(check_field_visibility('app_element_visibility_digital_object_uploaded')): ?>
+    <?php echo render_show(__('Uploaded'), format_date($resource->createdAt, 
'f')) ?>
+  <?php endif; ?>
 
-  <?php echo render_show(__('AIP UUID'), 
$resource->informationObject->aipUUID) ?>
+  <?php if ($sf_user->isAuthenticated()): ?>
+    <?php echo render_show(__('Object UUID'), 
$resource->informationObject->objectUUID) ?>
+    <?php echo render_show(__('AIP UUID'), 
$resource->informationObject->aipUUID) ?>
+  <?php endif; ?>
 
 </div>

Modified: trunk/apps/qubit/modules/informationobject/templates/_contextMenu.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/_contextMenu.php       
Tue Jul 24 12:35:14 2012        (r11971)
+++ trunk/apps/qubit/modules/informationobject/templates/_contextMenu.php       
Tue Jul 24 12:36:29 2012        (r11972)
@@ -21,4 +21,6 @@
 
 <?php echo get_partial('informationobject/format', array('resource' => 
$resource)) ?>
 
-<?php echo get_component('physicalobject', 'contextMenu', array('resource' => 
$resource)) ?>
+<?php if (check_field_visibility('app_element_visibility_physical_storage')): 
?>
+  <?php echo get_component('physicalobject', 'contextMenu', array('resource' 
=> $resource)) ?>
+<?php endif; ?>

Modified: trunk/apps/qubit/modules/settings/templates/visibleElementsSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/settings/templates/visibleElementsSuccess.php      
Tue Jul 24 12:35:14 2012        (r11971)
+++ trunk/apps/qubit/modules/settings/templates/visibleElementsSuccess.php      
Tue Jul 24 12:36:29 2012        (r11972)
@@ -44,10 +44,10 @@
     <legend><?php echo __('RAD template') ?></legend>
 
     <?php foreach (array(
-      'rad_general_note' => __('General note'),
-      'rad_conservation' => __('Conservation'),
       'rad_physical_condition' => __('Physical condition'),
       'rad_immediate_source' => __('Immediate source of acquisition'),
+      'rad_general_notes' => __('General note(s)'),
+      'rad_conservation_notes' => __('Conservation note(s)'),
       'rad_control_description_identifier' => __('Description identifier'),
       'rad_control_institution_identifier' => __('Institution identifier'),
       'rad_control_rules_conventions' => __('Rules or conventions'),

Modified: 
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/indexSuccess.php
==============================================================================
--- trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/indexSuccess.php  
Tue Jul 24 12:35:14 2012        (r11971)
+++ trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/indexSuccess.php  
Tue Jul 24 12:36:29 2012        (r11972)
@@ -74,7 +74,9 @@
 
   <?php echo render_show(__('Archival history'), 
render_value($resource->getArchivalHistory(array('cultureFallback' => true)))) 
?>
 
-  <?php echo render_show(__('Immediate source of acquisition or transfer'), 
render_value($resource->getAcquisition(array('cultureFallback' => true)))) ?>
+  <?php if 
(check_field_visibility('app_element_visibility_isad_immediate_source')): ?>
+    <?php echo render_show(__('Immediate source of acquisition or transfer'), 
render_value($resource->getAcquisition(array('cultureFallback' => true)))) ?>
+  <?php endif; ?>
 
 </div> <!-- /.section#contextArea -->
 
@@ -84,7 +86,9 @@
 
   <?php echo render_show(__('Scope and content'), 
render_value($resource->getScopeAndContent(array('cultureFallback' => true)))) 
?>
 
-  <?php echo render_show(__('Appraisal, destruction and scheduling'), 
render_value($resource->getAppraisal(array('cultureFallback' => true)))) ?>
+  <?php if 
(check_field_visibility('app_element_visibility_isad_appraisal_destruction')): 
?>
+    <?php echo render_show(__('Appraisal, destruction and scheduling'), 
render_value($resource->getAppraisal(array('cultureFallback' => true)))) ?>
+  <?php endif; ?>
 
   <?php echo render_show(__('Accruals'), 
render_value($resource->getAccruals(array('cultureFallback' => true)))) ?>
 
@@ -126,7 +130,9 @@
     <?php echo render_show(__('Language and script note'), 
render_value($item->getContent(array('cultureFallback' => true)))) ?>
   <?php endforeach; ?>
 
-  <?php echo render_show(__('Physical characteristics and technical 
requirements'), 
render_value($resource->getPhysicalCharacteristics(array('cultureFallback' => 
true)))) ?>
+  <?php if 
(check_field_visibility('app_element_visibility_isad_physical_condition')): ?>
+    <?php echo render_show(__('Physical characteristics and technical 
requirements'), 
render_value($resource->getPhysicalCharacteristics(array('cultureFallback' => 
true)))) ?>
+  <?php endif; ?>
 
   <?php echo render_show(__('Finding aids'), 
render_value($resource->getFindingAids(array('cultureFallback' => true)))) ?>
 
@@ -152,9 +158,11 @@
 
   <?php echo link_to_if(SecurityPriviliges::editCredentials($sf_user, 
'informationObject'), '<h2>'.__('Notes area').'</h2>', array($resource, 
'module' => 'informationobject', 'action' => 'edit'), array('anchor' => 
'notesArea', 'title' => __('Edit notes area'))) ?>
 
-  <?php foreach ($resource->getNotesByType(array('noteTypeId' => 
QubitTerm::GENERAL_NOTE_ID)) as $item): ?>
-    <?php echo render_show(__('Note'), 
render_value($item->getContent(array('cultureFallback' => true)))) ?>
-  <?php endforeach; ?>
+  <?php if (check_field_visibility('app_element_visibility_isad_notes')): ?>
+    <?php foreach ($resource->getNotesByType(array('noteTypeId' => 
QubitTerm::GENERAL_NOTE_ID)) as $item): ?>
+      <?php echo render_show(__('Note'), 
render_value($item->getContent(array('cultureFallback' => true)))) ?>
+    <?php endforeach; ?>
+  <?php endif; ?>
 
 </div> <!-- /.section#notesArea -->
 
@@ -174,45 +182,65 @@
 
   <?php echo link_to_if(SecurityPriviliges::editCredentials($sf_user, 
'informationObject'), '<h2>'.__('Description control area').'</h2>', 
array($resource, 'module' => 'informationobject', 'action' => 'edit'), 
array('anchor' => 'descriptionControlArea', 'title' => __('Edit description 
control area'))) ?>
 
-  <?php echo render_show(__('Description identifier'), 
render_value($resource->getDescriptionIdentifier(array('cultureFallback' => 
true)))) ?>
-
-  <?php echo render_show(__('Institution identifier'), 
render_value($resource->getInstitutionResponsibleIdentifier(array('cultureFallback'
 => true)))) ?>
-
-  <?php echo render_show(__('Rules and/or conventions used'), 
render_value($resource->getRules(array('cultureFallback' => true)))) ?>
-
-  <?php echo render_show(__('Status'), 
render_value($resource->descriptionStatus)) ?>
-
-  <?php echo render_show(__('Level of detail'), 
render_value($resource->descriptionDetail)) ?>
-
-  <?php echo render_show(__('Dates of creation revision deletion'), 
render_value($resource->getRevisionHistory(array('cultureFallback' => true)))) 
?>
-
-  <div class="field">
-    <h3><?php echo __('Language(s)') ?></h3>
-    <div>
-      <ul>
-        <?php foreach ($resource->languageOfDescription as $code): ?>
-          <li><?php echo format_language($code) ?></li>
-        <?php endforeach; ?>
-      </ul>
+  <?php if 
(check_field_visibility('app_element_visibility_isad_control_description_identifier')):
 ?>
+    <?php echo render_show(__('Description identifier'), 
render_value($resource->getDescriptionIdentifier(array('cultureFallback' => 
true)))) ?>
+  <?php endif; ?>
+
+  <?php if 
(check_field_visibility('app_element_visibility_isad_control_institution_identifier')):
 ?>
+    <?php echo render_show(__('Institution identifier'), 
render_value($resource->getInstitutionResponsibleIdentifier(array('cultureFallback'
 => true)))) ?>
+  <?php endif; ?>
+
+  <?php if 
(check_field_visibility('app_element_visibility_isad_control_rules_conventions')):
 ?>
+    <?php echo render_show(__('Rules and/or conventions used'), 
render_value($resource->getRules(array('cultureFallback' => true)))) ?>
+  <?php endif; ?>
+
+  <?php if 
(check_field_visibility('app_element_visibility_isad_control_status')): ?>
+    <?php echo render_show(__('Status'), 
render_value($resource->descriptionStatus)) ?>
+  <?php endif; ?>
+
+  <?php if 
(check_field_visibility('app_element_visibility_isad_control_level_of_detail')):
 ?>
+    <?php echo render_show(__('Level of detail'), 
render_value($resource->descriptionDetail)) ?>
+  <?php endif; ?>
+
+  <?php if 
(check_field_visibility('app_element_visibility_isad_control_dates')): ?>
+    <?php echo render_show(__('Dates of creation revision deletion'), 
render_value($resource->getRevisionHistory(array('cultureFallback' => true)))) 
?>
+  <?php endif; ?>
+
+  <?php if 
(check_field_visibility('app_element_visibility_isad_control_languages')): ?>
+    <div class="field">
+      <h3><?php echo __('Language(s)') ?></h3>
+      <div>
+        <ul>
+          <?php foreach ($resource->languageOfDescription as $code): ?>
+            <li><?php echo format_language($code) ?></li>
+          <?php endforeach; ?>
+        </ul>
+      </div>
     </div>
-  </div>
+  <?php endif; ?>
 
-  <div class="field">
-    <h3><?php echo __('Script(s)') ?></h3>
-    <div>
-      <ul>
-        <?php foreach ($resource->scriptOfDescription as $code): ?>
-          <li><?php echo format_script($code) ?></li>
-        <?php endforeach; ?>
-      </ul>
+  <?php if 
(check_field_visibility('app_element_visibility_isad_control_scripts')): ?>
+    <div class="field">
+      <h3><?php echo __('Script(s)') ?></h3>
+      <div>
+        <ul>
+          <?php foreach ($resource->scriptOfDescription as $code): ?>
+            <li><?php echo format_script($code) ?></li>
+          <?php endforeach; ?>
+        </ul>
+      </div>
     </div>
-  </div>
+  <?php endif; ?>
 
-  <?php echo render_show(__('Sources'), 
render_value($resource->getSources(array('cultureFallback' => true)))) ?>
-
-  <?php foreach ($resource->getNotesByType(array('noteTypeId' => 
QubitTerm::ARCHIVIST_NOTE_ID)) as $item): ?>
-    <?php echo render_show(__('Archivist\'s note'), 
render_value($item->getContent(array('cultureFallback' => true)))) ?>
-  <?php endforeach; ?>
+  <?php if 
(check_field_visibility('app_element_visibility_isad_control_sources')): ?>
+    <?php echo render_show(__('Sources'), 
render_value($resource->getSources(array('cultureFallback' => true)))) ?>
+  <?php endif; ?>
+
+  <?php if 
(check_field_visibility('app_element_visibility_isad_control_archivists_notes')):
 ?>
+    <?php foreach ($resource->getNotesByType(array('noteTypeId' => 
QubitTerm::ARCHIVIST_NOTE_ID)) as $item): ?>
+      <?php echo render_show(__('Archivist\'s note'), 
render_value($item->getContent(array('cultureFallback' => true)))) ?>
+    <?php endforeach; ?>
+  <?php endif; ?>
 
 </div> <!-- /.section#descriptionControlArea -->
 

Modified: 
trunk/plugins/sfRadPlugin/modules/sfRadPlugin/templates/indexSuccess.php
==============================================================================
--- trunk/plugins/sfRadPlugin/modules/sfRadPlugin/templates/indexSuccess.php    
Tue Jul 24 12:35:14 2012        (r11971)
+++ trunk/plugins/sfRadPlugin/modules/sfRadPlugin/templates/indexSuccess.php    
Tue Jul 24 12:36:29 2012        (r11972)
@@ -143,9 +143,13 @@
 
   <?php echo link_to_if(SecurityPriviliges::editCredentials($sf_user, 
'informationObject'), '<h2>'.__('Notes area').'</h2>', array($resource, 
'module' => 'informationobject', 'action' => 'edit'), array('anchor' => 
'notesArea', 'title' => __('Edit notes area'))) ?>
 
-  <?php echo render_show(__('Physical condition'), 
render_value($resource->getPhysicalCharacteristics(array('cultureFallback' => 
true)))) ?>
-
-  <?php echo render_show(__('Immediate source of acquisition'), 
render_value($resource->getAcquisition(array('cultureFallback' => true)))) ?>
+  <?php if 
(check_field_visibility('app_element_visibility_rad_physical_condition')): ?>
+    <?php echo render_show(__('Physical condition'), 
render_value($resource->getPhysicalCharacteristics(array('cultureFallback' => 
true)))) ?>
+  <?php endif; ?>
+
+  <?php if 
(check_field_visibility('app_element_visibility_rad_immediate_source')): ?>
+    <?php echo render_show(__('Immediate source of acquisition'), 
render_value($resource->getAcquisition(array('cultureFallback' => true)))) ?>
+  <?php endif; ?>
 
   <?php echo render_show(__('Arrangement'), 
render_value($resource->getArrangement(array('cultureFallback' => true)))) ?>
 
@@ -194,7 +198,19 @@
     <div>
       <ul>
         <?php foreach ($resource->getNotesByTaxonomy(array('taxonomyId' => 
QubitTaxonomy::RAD_NOTE_ID)) as $item): ?>
+
+          <?php $type = $item->getType(array('sourceCulture' => true)) ?>
+
+          <?php if ('General note' == $type && 
check_field_visibility('app_element_visibility_rad_general_notes')): ?>
+            <?php continue; ?>
+          <?php endif; ?>
+
+          <?php if ('Conservation' == $type && 
check_field_visibility('app_element_visibility_rad_conservation_notes')): ?>
+            <?php continue; ?>
+          <?php endif; ?>
+
           <li><?php echo $item->type ?>: <?php echo 
render_value($item->getContent(array('cultureFallback' => true))) ?></li>
+
         <?php endforeach; ?>
       </ul>
     </div>
@@ -226,41 +242,59 @@
 
   <?php echo link_to_if(SecurityPriviliges::editCredentials($sf_user, 
'informationObject'), '<h2>'.__('Control area').'</h2>', array($resource, 
'module' => 'informationobject', 'action' => 'edit'), array('anchor' => 
'descriptionControlArea', 'title' => __('Edit control area'))) ?>
 
-  <?php echo render_show(__('Description record identifier'), 
render_value($resource->descriptionIdentifier)) ?>
-
-  <?php echo render_show(__('Institution identifier'), 
render_value($resource->getInstitutionResponsibleIdentifier(array('cultureFallback'
 => true)))) ?>
-
-  <?php echo render_show(__('Rules or conventions'), 
render_value($resource->getRules(array('cultureFallback' => true)))) ?>
-
-  <?php echo render_show(__('Status'), 
render_value($resource->descriptionStatus)) ?>
-
-  <?php echo render_show(__('Level of detail'), 
render_value($resource->descriptionDetail)) ?>
-
-  <?php echo render_show(__('Dates of creation, revision and deletion'), 
render_value($resource->getRevisionHistory(array('cultureFallback' => true)))) 
?>
-
-  <div class="field">
-    <h3><?php echo __('Language of description') ?></h3>
-    <div>
-      <ul>
-        <?php foreach ($resource->languageOfDescription as $code): ?>
-          <li><?php echo format_language($code) ?></li>
-        <?php endforeach; ?>
-      </ul>
+  <?php if 
(check_field_visibility('app_element_visibility_rad_control_description_identifier')):
 ?>
+    <?php echo render_show(__('Description record identifier'), 
render_value($resource->descriptionIdentifier)) ?>
+  <?php endif; ?>
+
+  <?php if 
(check_field_visibility('app_element_visibility_rad_control_institution_identifier')):
 ?>
+    <?php echo render_show(__('Institution identifier'), 
render_value($resource->getInstitutionResponsibleIdentifier(array('cultureFallback'
 => true)))) ?>
+  <?php endif; ?>
+
+  <?php if 
(check_field_visibility('app_element_visibility_rad_control_rules_conventions')):
 ?>
+    <?php echo render_show(__('Rules or conventions'), 
render_value($resource->getRules(array('cultureFallback' => true)))) ?>
+  <?php endif; ?>
+
+  <?php if 
(check_field_visibility('app_element_visibility_rad_control_status')): ?>
+    <?php echo render_show(__('Status'), 
render_value($resource->descriptionStatus)) ?>
+  <?php endif; ?>
+
+  <?php if 
(check_field_visibility('app_element_visibility_rad_control_level_of_detail')): 
?>
+    <?php echo render_show(__('Level of detail'), 
render_value($resource->descriptionDetail)) ?>
+  <?php endif; ?>
+
+  <?php if 
(check_field_visibility('app_element_visibility_rad_control_dates')): ?>
+    <?php echo render_show(__('Dates of creation, revision and deletion'), 
render_value($resource->getRevisionHistory(array('cultureFallback' => true)))) 
?>
+  <?php endif; ?>
+
+  <?php if 
(check_field_visibility('app_element_visibility_rad_control_language')): ?>
+    <div class="field">
+      <h3><?php echo __('Language of description') ?></h3>
+      <div>
+        <ul>
+          <?php foreach ($resource->languageOfDescription as $code): ?>
+            <li><?php echo format_language($code) ?></li>
+          <?php endforeach; ?>
+        </ul>
+      </div>
     </div>
-  </div>
+  <?php endif; ?>
 
-  <div class="field">
-    <h3><?php echo __('Script of description') ?></h3>
-    <div>
-      <ul>
-        <?php foreach ($resource->scriptOfDescription as $code): ?>
-          <li><?php echo format_script($code) ?></li>
-        <?php endforeach; ?>
-      </ul>
+  <?php if 
(check_field_visibility('app_element_visibility_rad_control_script')): ?>
+    <div class="field">
+      <h3><?php echo __('Script of description') ?></h3>
+      <div>
+        <ul>
+          <?php foreach ($resource->scriptOfDescription as $code): ?>
+            <li><?php echo format_script($code) ?></li>
+          <?php endforeach; ?>
+        </ul>
+      </div>
     </div>
-  </div>
+  <?php endif; ?>
 
-  <?php echo render_show(__('Sources'), 
render_value($resource->getSources(array('cultureFallback' => true)))) ?>
+  <?php if 
(check_field_visibility('app_element_visibility_rad_control_sources')): ?>
+    <?php echo render_show(__('Sources'), 
render_value($resource->getSources(array('cultureFallback' => true)))) ?>
+  <?php endif; ?>
 
 </div> <!-- /.section -->
 

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