Browse Source

Updated to only list datastreams that are in the Islandora Content Model in the detailed list of content. This can also be disabled with the 'Restrict Access to Fedora Object Datastreams' option in the fedora collection list settings page. All datastreams are listed for administrators.

pull/105/head
root 14 years ago
parent
commit
28a408978e
  1. 33
      ObjectHelper.inc

33
ObjectHelper.inc

@ -406,11 +406,12 @@ class ObjectHelper {
*
*/
function get_formatted_datastream_list($object_pid, $contentModels, &$fedoraItem) {
global $fedoraUser, $fedoraPass, $base_url;
global $fedoraUser, $fedoraPass, $base_url, $user;
module_load_include('inc', 'fedora_repository', 'ConnectionHelper');
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'ContentModel');
$path = drupal_get_path('module', 'fedora_repository');
$dataStreamBody = '';
$fedoraItem = new Fedora_Item($object_pid);
@ -427,21 +428,29 @@ class ObjectHelper {
$hasOBJStream = NULL;
$hasTNStream = FALSE;
$dataStreamBody = "<br /><table>\n";
$cmDatastreams = array();
if (variable_get('fedora_object_restrict_datastreams', TRUE) == TRUE && ($cm = ContentModel::loadFromObject($object_pid)) !== FALSE) {
$cmDatastreams = $cm->listDatastreams();
}
$dataStreamBody .= $this->get_parent_objects_asHTML($object_pid);
$dataStreamBody .= '<tr><th colspan="4"><h3>' . t("!text", array('!text' => $availableDataStreamsText)) . '</h3></th></tr>';
foreach ($object as $datastream) {
foreach ($datastream as $datastreamValue) {
if ($datastreamValue->ID == 'OBJ') {
$hasOBJStream = '1';
$mainStreamLabel = $datastreamValue->label;
$mainStreamLabel = str_replace("_", " ", $mainStreamLabel);
}
if ($datastreamValue->ID == 'TN') {
$hasTNStream = TRUE;
}
//create the links to each datastream
$dataStreamBody .= $this->create_link_for_ds($object_pid, $datastreamValue); //"<tr><td><b>$key :</b></td><td>$value</td></tr>\n";
if (variable_get('fedora_object_restrict_datastreams', TRUE) == FALSE || ((isset($user) && in_array('administrator',$user->roles)) || in_array($datastreamValue->ID,$cmDatastreams))) {
if ($datastreamValue->ID == 'OBJ') {
$hasOBJStream = '1';
$mainStreamLabel = $datastreamValue->label;
$mainStreamLabel = str_replace("_", " ", $mainStreamLabel);
}
if ($datastreamValue->ID == 'TN') {
$hasTNStream = TRUE;
}
//create the links to each datastream
$dataStreamBody .= $this->create_link_for_ds($object_pid, $datastreamValue); //"<tr><td><b>$key :</b></td><td>$value</td></tr>\n";
}
}
}
$dataStreamBody .= "</table>\n";

Loading…
Cancel
Save