|
|
@ -32,7 +32,7 @@ class ObjectHelper { |
|
|
|
//$this->fedoraPass = $connectionHelper->getPassword(); |
|
|
|
//$this->fedoraPass = $connectionHelper->getPassword(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Grabs a stream from fedora sets the mimetype and returns it. $dsID is the |
|
|
|
* Grabs a stream from fedora sets the mimetype and returns it. $dsID is the |
|
|
|
* datastream id. If $forceSoap is set, the function will always buffer the datastream from fedora. Otherwise, it will |
|
|
|
* datastream id. If $forceSoap is set, the function will always buffer the datastream from fedora. Otherwise, it will |
|
|
|
* try and use a redirect if possible. |
|
|
|
* try and use a redirect if possible. |
|
|
@ -41,7 +41,7 @@ class ObjectHelper { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function makeObject($pid, $dsID, $asAttachment = FALSE, $label = NULL, $filePath=FALSE, $version=NULL, $forceSoap = FALSE) { |
|
|
|
function makeObject($pid, $dsID, $asAttachment = FALSE, $label = NULL, $filePath=FALSE, $version=NULL, $forceSoap = FALSE) { |
|
|
|
global $user; |
|
|
|
global $user; |
|
|
|
module_load_include('inc','fedora_repository','ContentModel'); |
|
|
|
module_load_include('inc', 'fedora_repository', 'ContentModel'); |
|
|
|
if ($pid == NULL || $dsID == NULL) { |
|
|
|
if ($pid == NULL || $dsID == NULL) { |
|
|
|
drupal_set_message(t("no pid or dsid given to create an object with"), 'error'); |
|
|
|
drupal_set_message(t("no pid or dsid given to create an object with"), 'error'); |
|
|
|
return ' '; |
|
|
|
return ' '; |
|
|
@ -58,21 +58,21 @@ class ObjectHelper { |
|
|
|
drupal_set_message(t("You do not have access Fedora objects within the attempted namespace."), 'error'); |
|
|
|
drupal_set_message(t("You do not have access Fedora objects within the attempted namespace."), 'error'); |
|
|
|
drupal_access_denied(); |
|
|
|
drupal_access_denied(); |
|
|
|
return ' '; |
|
|
|
return ' '; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (variable_get('fedora_object_restrict_datastreams', FALSE) == TRUE ) { |
|
|
|
if (variable_get('fedora_object_restrict_datastreams', FALSE) == TRUE) { |
|
|
|
if (($cm = ContentModel::loadFromObject($pid)) == FALSE) { |
|
|
|
if (($cm = ContentModel::loadFromObject($pid)) == FALSE) { |
|
|
|
drupal_set_message(t("You do not have access to objects without an Islandora Content Model."), 'error'); |
|
|
|
drupal_set_message(t("You do not have access to objects without an Islandora Content Model."), 'error'); |
|
|
|
drupal_access_denied(); |
|
|
|
drupal_access_denied(); |
|
|
|
return ' '; |
|
|
|
return ' '; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$cmDatastreams = $cm->listDatastreams(); |
|
|
|
$cmDatastreams = $cm->listDatastreams(); |
|
|
|
if ( !((isset($user) && in_array('administrator',$user->roles)) || in_array($dsID,$cmDatastreams))) { |
|
|
|
if (!((isset($user) && in_array('administrator', $user->roles)) || in_array($dsID, $cmDatastreams))) { |
|
|
|
drupal_set_message(t("You do not have access to the specified datastream."), 'error'); |
|
|
|
drupal_set_message(t("You do not have access to the specified datastream."), 'error'); |
|
|
|
drupal_access_denied(); |
|
|
|
drupal_access_denied(); |
|
|
|
return ' '; |
|
|
|
return ' '; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -81,9 +81,9 @@ class ObjectHelper { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($item->datastreams[$dsID])) { |
|
|
|
if (isset($item->datastreams[$dsID])) { |
|
|
|
$mimeType=$item->datastreams[$dsID]['MIMEType']; |
|
|
|
$mimeType = $item->datastreams[$dsID]['MIMEType']; |
|
|
|
if ($label == NULL) { |
|
|
|
if ($label == NULL) { |
|
|
|
$label = $item->datastreams[$dsID]['label']; |
|
|
|
$label = $item->datastreams[$dsID]['label']; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
drupal_not_found(); |
|
|
|
drupal_not_found(); |
|
|
@ -94,7 +94,7 @@ class ObjectHelper { |
|
|
|
if ((!isset($user)) || $user->uid == 0) { |
|
|
|
if ((!isset($user)) || $user->uid == 0) { |
|
|
|
$fedoraUser = 'anonymous'; |
|
|
|
$fedoraUser = 'anonymous'; |
|
|
|
$fedoraPass = 'anonymous'; |
|
|
|
$fedoraPass = 'anonymous'; |
|
|
|
$contentSize= 0; |
|
|
|
$contentSize = 0; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$fedoraUser = $user->name; |
|
|
|
$fedoraUser = $user->name; |
|
|
|
$fedoraPass = $user->pass; |
|
|
|
$fedoraPass = $user->pass; |
|
|
@ -102,7 +102,7 @@ class ObjectHelper { |
|
|
|
$contentSize = $dataStreamInfo->datastream->size; |
|
|
|
$contentSize = $dataStreamInfo->datastream->size; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (function_exists("curl_init")) { |
|
|
|
if (function_exists("curl_init")) { |
|
|
|
if (!isset($mimeType)) { |
|
|
|
if (!isset($mimeType)) { |
|
|
|
$pid = variable_get('fedora_default_display_pid', 'demo:10'); |
|
|
|
$pid = variable_get('fedora_default_display_pid', 'demo:10'); |
|
|
|
$dsID = variable_get('fedora_default_display_dsid', 'TN'); |
|
|
|
$dsID = variable_get('fedora_default_display_dsid', 'TN'); |
|
|
@ -137,10 +137,10 @@ class ObjectHelper { |
|
|
|
fclose($fp); |
|
|
|
fclose($fp); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
header("Content-type: $mimeType"); |
|
|
|
header("Content-type: $mimeType"); |
|
|
|
if ($contentSize > 0) { |
|
|
|
if ($contentSize > 0) { |
|
|
|
header("Content-length: $contentSize"); |
|
|
|
header("Content-length: $contentSize"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($asAttachment) { |
|
|
|
if ($asAttachment) { |
|
|
|
$suggestedFileName = "$label"; |
|
|
|
$suggestedFileName = "$label"; |
|
|
@ -165,18 +165,18 @@ class ObjectHelper { |
|
|
|
|
|
|
|
|
|
|
|
header('Content-Disposition: attachment; filename="' . $suggestedFileName . '"'); |
|
|
|
header('Content-Disposition: attachment; filename="' . $suggestedFileName . '"'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ( (isset($user) && $user->uid != 0) || $forceSoap || isset($_SERVER['HTTPS'])) { |
|
|
|
if ((isset($user) && $user->uid != 0) || $forceSoap || isset($_SERVER['HTTPS'])) { |
|
|
|
curl_exec($ch); |
|
|
|
curl_exec($ch); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
header('Location: '.$url); |
|
|
|
header('Location: ' . $url); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
curl_close($ch); |
|
|
|
curl_close($ch); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
drupal_set_message(t('No curl support.'), 'error'); |
|
|
|
drupal_set_message(t('No curl support.'), 'error'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Gets collection objects t |
|
|
|
//Gets collection objects t |
|
|
|
function getCollectionInfo($pid, $query = NULL) { |
|
|
|
function getCollectionInfo($pid, $query = NULL) { |
|
|
@ -258,14 +258,14 @@ class ObjectHelper { |
|
|
|
$item = new Fedora_Item($pid); |
|
|
|
$item = new Fedora_Item($pid); |
|
|
|
|
|
|
|
|
|
|
|
if (user_access(ObjectHelper :: $PURGE_FEDORA_OBJECTSANDSTREAMS)) { |
|
|
|
if (user_access(ObjectHelper :: $PURGE_FEDORA_OBJECTSANDSTREAMS)) { |
|
|
|
$allow=TRUE; |
|
|
|
$allow = TRUE; |
|
|
|
if (module_exists('fedora_fesl')) { |
|
|
|
if (module_exists('fedora_fesl')) { |
|
|
|
$allow= fedora_fesl_check_roles($pid,'write'); |
|
|
|
$allow = fedora_fesl_check_roles($pid, 'write'); |
|
|
|
} |
|
|
|
} |
|
|
|
if ($allow) { |
|
|
|
if ($allow) { |
|
|
|
$purgeImage = '<a title="purge datastream ' . $dataStreamValue->label . '" href="' . $base_url . '/fedora/repository/purgeStream/' . |
|
|
|
$purgeImage = '<a title="purge datastream ' . $dataStreamValue->label . '" href="' . $base_url . '/fedora/repository/purgeStream/' . |
|
|
|
$pid . '/' . $dataStreamValue->ID . '/' . $dataStreamValue->label . '"><img src="' . $base_url . '/' . $path . |
|
|
|
$pid . '/' . $dataStreamValue->ID . '/' . $dataStreamValue->label . '"><img src="' . $base_url . '/' . $path . |
|
|
|
'/images/purge.gif" alt="purge datastream" /></a>'; |
|
|
|
'/images/purge.gif" alt="purge datastream" /></a>'; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$purgeImage = ' '; |
|
|
|
$purgeImage = ' '; |
|
|
@ -274,16 +274,16 @@ class ObjectHelper { |
|
|
|
|
|
|
|
|
|
|
|
// Add an icon to replace a datastream |
|
|
|
// Add an icon to replace a datastream |
|
|
|
// @TODO Note: using l(theme_image(..), ...); for these image links (and other links) may remove the need to have clean urls enabled. |
|
|
|
// @TODO Note: using l(theme_image(..), ...); for these image links (and other links) may remove the need to have clean urls enabled. |
|
|
|
$replaceImage= ' '; |
|
|
|
$replaceImage = ' '; |
|
|
|
if (user_access(ObjectHelper :: $ADD_FEDORA_STREAMS)) { |
|
|
|
if (user_access(ObjectHelper :: $ADD_FEDORA_STREAMS)) { |
|
|
|
$allow=TRUE; |
|
|
|
$allow = TRUE; |
|
|
|
if (module_exists('fedora_fesl')) { |
|
|
|
if (module_exists('fedora_fesl')) { |
|
|
|
$allow= fedora_fesl_check_roles($pid,'write'); |
|
|
|
$allow = fedora_fesl_check_roles($pid, 'write'); |
|
|
|
} |
|
|
|
} |
|
|
|
if ($allow) { |
|
|
|
if ($allow) { |
|
|
|
$replaceImage = '<a title="' . t("Replace datastream") . " " . $dataStreamValue->label . '" href="' . $base_url . '/fedora/repository/replaceStream/' . $pid . '/' . $dataStreamValue->ID . '/' . $dataStreamValue->label . '"><img src="' . $base_url . '/' . $path . '/images/replace.png" alt="replace datastream" /></a>'; |
|
|
|
$replaceImage = '<a title="' . t("Replace datastream") . " " . $dataStreamValue->label . '" href="' . $base_url . '/fedora/repository/replaceStream/' . $pid . '/' . $dataStreamValue->ID . '/' . $dataStreamValue->label . '"><img src="' . $base_url . '/' . $path . '/images/replace.png" alt="replace datastream" /></a>'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$content = ''; |
|
|
|
$content = ''; |
|
|
|
$id = $dataStreamValue->ID; |
|
|
|
$id = $dataStreamValue->ID; |
|
|
@ -292,7 +292,7 @@ class ObjectHelper { |
|
|
|
$mimeType = $dataStreamValue->MIMEType; |
|
|
|
$mimeType = $dataStreamValue->MIMEType; |
|
|
|
|
|
|
|
|
|
|
|
$view = '<a href="' . $base_url . '/fedora/repository/' . drupal_urlencode($pid) . '/' . $id . '/' . drupal_urlencode($label) . |
|
|
|
$view = '<a href="' . $base_url . '/fedora/repository/' . drupal_urlencode($pid) . '/' . $id . '/' . drupal_urlencode($label) . |
|
|
|
'" target="_blank" >' . t('View') . '</a>'; |
|
|
|
'" target="_blank" >' . t('View') . '</a>'; |
|
|
|
$action = "$base_url/fedora/repository/object_download/" . drupal_urlencode($pid) . '/' . $id . '/' . drupal_urlencode(preg_replace('/\//i', '${1}_', $label)); // Necessary to handle the case of Datastream labels that contain slashes. Ugh. |
|
|
|
$action = "$base_url/fedora/repository/object_download/" . drupal_urlencode($pid) . '/' . $id . '/' . drupal_urlencode(preg_replace('/\//i', '${1}_', $label)); // Necessary to handle the case of Datastream labels that contain slashes. Ugh. |
|
|
|
$downloadVersion = '<form method="GET" action="' . $action . '"><input type="submit" value="' . t('Download') . '"></form>'; |
|
|
|
$downloadVersion = '<form method="GET" action="' . $action . '"><input type="submit" value="' . t('Download') . '"></form>'; |
|
|
|
if (user_access(ObjectHelper :: $EDIT_FEDORA_METADATA)) { |
|
|
|
if (user_access(ObjectHelper :: $EDIT_FEDORA_METADATA)) { |
|
|
@ -331,25 +331,25 @@ class ObjectHelper { |
|
|
|
|
|
|
|
|
|
|
|
$dsId = 'QDC'; |
|
|
|
$dsId = 'QDC'; |
|
|
|
$params = array( |
|
|
|
$params = array( |
|
|
|
'pid' => "$pid", |
|
|
|
'pid' => "$pid", |
|
|
|
'dsID' => "$dsId", |
|
|
|
'dsID' => "$dsId", |
|
|
|
'asOfDateTime' => "" |
|
|
|
'asOfDateTime' => "" |
|
|
|
); |
|
|
|
); |
|
|
|
try { |
|
|
|
try { |
|
|
|
$object = $client->__soapCAll('getDatastreamDissemination', array( |
|
|
|
$object = $client->__soapCAll('getDatastreamDissemination', array( |
|
|
|
'parameters' => $params |
|
|
|
'parameters' => $params |
|
|
|
)); |
|
|
|
)); |
|
|
|
} catch (Exception $e) { |
|
|
|
} catch (Exception $e) { |
|
|
|
try { //probably no QDC so we will try for the DC stream. |
|
|
|
try { //probably no QDC so we will try for the DC stream. |
|
|
|
$dsId = 'DC'; |
|
|
|
$dsId = 'DC'; |
|
|
|
$params = array( |
|
|
|
$params = array( |
|
|
|
'pid' => "$pid", |
|
|
|
'pid' => "$pid", |
|
|
|
'dsID' => "$dsId", |
|
|
|
'dsID' => "$dsId", |
|
|
|
'asOfDateTime' => "" |
|
|
|
'asOfDateTime' => "" |
|
|
|
); |
|
|
|
); |
|
|
|
$object = $client->__soapCAll('getDatastreamDissemination', array( |
|
|
|
$object = $client->__soapCAll('getDatastreamDissemination', array( |
|
|
|
'parameters' => $params |
|
|
|
'parameters' => $params |
|
|
|
)); |
|
|
|
)); |
|
|
|
} catch (exception $e2) { |
|
|
|
} catch (exception $e2) { |
|
|
|
drupal_set_message($e2->getMessage(), 'error'); |
|
|
|
drupal_set_message($e2->getMessage(), 'error'); |
|
|
|
return; |
|
|
|
return; |
|
|
@ -380,13 +380,13 @@ class ObjectHelper { |
|
|
|
$baseUrl = base_path(); |
|
|
|
$baseUrl = base_path(); |
|
|
|
//$baseUrl=substr($baseUrl, 0, (strpos($baseUrl, "/")-1)); |
|
|
|
//$baseUrl=substr($baseUrl, 0, (strpos($baseUrl, "/")-1)); |
|
|
|
if (user_access(ObjectHelper :: $EDIT_FEDORA_METADATA)) { |
|
|
|
if (user_access(ObjectHelper :: $EDIT_FEDORA_METADATA)) { |
|
|
|
$allow=TRUE; |
|
|
|
$allow = TRUE; |
|
|
|
if (module_exists('fedora_fesl')) { |
|
|
|
if (module_exists('fedora_fesl')) { |
|
|
|
$allow= fedora_fesl_check_roles($pid,'write'); |
|
|
|
$allow = fedora_fesl_check_roles($pid, 'write'); |
|
|
|
} |
|
|
|
} |
|
|
|
if ($allow) { |
|
|
|
if ($allow) { |
|
|
|
$output .= '<br /><a title = "' . t('Edit Meta Data') . '" href="' . $base_url . '/fedora/repository/' . 'editmetadata/' . $pid . '/' . |
|
|
|
$output .= '<br /><a title = "' . t('Edit Meta Data') . '" href="' . $base_url . '/fedora/repository/' . 'editmetadata/' . $pid . '/' . |
|
|
|
$dsId . '"><img src="' . $base_url . '/' . $path . '/images/edit.gif" alt="' . t('Edit Meta Data') . '" /></a>'; |
|
|
|
$dsId . '"><img src="' . $base_url . '/' . $path . '/images/edit.gif" alt="' . t('Edit Meta Data') . '" /></a>'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return $output; |
|
|
|
return $output; |
|
|
@ -411,7 +411,7 @@ class ObjectHelper { |
|
|
|
module_load_include('inc', 'fedora_repository', 'ObjectHelper'); |
|
|
|
module_load_include('inc', 'fedora_repository', 'ObjectHelper'); |
|
|
|
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); |
|
|
|
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); |
|
|
|
module_load_include('inc', 'fedora_repository', 'ContentModel'); |
|
|
|
module_load_include('inc', 'fedora_repository', 'ContentModel'); |
|
|
|
|
|
|
|
|
|
|
|
$path = drupal_get_path('module', 'fedora_repository'); |
|
|
|
$path = drupal_get_path('module', 'fedora_repository'); |
|
|
|
$dataStreamBody = ''; |
|
|
|
$dataStreamBody = ''; |
|
|
|
$fedoraItem = new Fedora_Item($object_pid); |
|
|
|
$fedoraItem = new Fedora_Item($object_pid); |
|
|
@ -428,47 +428,47 @@ class ObjectHelper { |
|
|
|
$hasOBJStream = NULL; |
|
|
|
$hasOBJStream = NULL; |
|
|
|
$hasTNStream = FALSE; |
|
|
|
$hasTNStream = FALSE; |
|
|
|
$dataStreamBody = "<br /><table>\n"; |
|
|
|
$dataStreamBody = "<br /><table>\n"; |
|
|
|
|
|
|
|
|
|
|
|
$cmDatastreams = array(); |
|
|
|
$cmDatastreams = array(); |
|
|
|
if (variable_get('fedora_object_restrict_datastreams', FALSE) == TRUE && ($cm = ContentModel::loadFromObject($object_pid)) !== FALSE) { |
|
|
|
if (variable_get('fedora_object_restrict_datastreams', FALSE) == TRUE && ($cm = ContentModel::loadFromObject($object_pid)) !== FALSE) { |
|
|
|
$cmDatastreams = $cm->listDatastreams(); |
|
|
|
$cmDatastreams = $cm->listDatastreams(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$dataStreamBody .= $this->get_parent_objects_asHTML($object_pid); |
|
|
|
$dataStreamBody .= $this->get_parent_objects_asHTML($object_pid); |
|
|
|
$dataStreamBody .= '<tr><th colspan="4"><h3>' . t("!text", array('!text' => $availableDataStreamsText)) . '</h3></th></tr>'; |
|
|
|
$dataStreamBody .= '<tr><th colspan="4"><h3>' . t("!text", array('!text' => $availableDataStreamsText)) . '</h3></th></tr>'; |
|
|
|
foreach ($object as $datastream) { |
|
|
|
foreach ($object as $datastream) { |
|
|
|
foreach ($datastream as $datastreamValue) { |
|
|
|
foreach ($datastream as $datastreamValue) { |
|
|
|
|
|
|
|
|
|
|
|
if (variable_get('fedora_object_restrict_datastreams', FALSE) == FALSE || ((isset($user) && in_array('administrator',$user->roles)) || in_array($datastreamValue->ID,$cmDatastreams))) { |
|
|
|
if (variable_get('fedora_object_restrict_datastreams', FALSE) == FALSE || ((isset($user) && in_array('administrator', $user->roles)) || in_array($datastreamValue->ID, $cmDatastreams))) { |
|
|
|
if ($datastreamValue->ID == 'OBJ') { |
|
|
|
if ($datastreamValue->ID == 'OBJ') { |
|
|
|
$hasOBJStream = '1'; |
|
|
|
$hasOBJStream = '1'; |
|
|
|
$mainStreamLabel = $datastreamValue->label; |
|
|
|
$mainStreamLabel = $datastreamValue->label; |
|
|
|
$mainStreamLabel = str_replace("_", " ", $mainStreamLabel); |
|
|
|
$mainStreamLabel = str_replace("_", " ", $mainStreamLabel); |
|
|
|
} |
|
|
|
} |
|
|
|
if ($datastreamValue->ID == 'TN') { |
|
|
|
if ($datastreamValue->ID == 'TN') { |
|
|
|
$hasTNStream = TRUE; |
|
|
|
$hasTNStream = TRUE; |
|
|
|
} |
|
|
|
} |
|
|
|
//create the links to each datastream |
|
|
|
//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 .= $this->create_link_for_ds($object_pid, $datastreamValue); //"<tr><td><b>$key :</b></td><td>$value</td></tr>\n"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
$dataStreamBody .= "</table>\n"; |
|
|
|
$dataStreamBody .= "</table>\n"; |
|
|
|
//if they have access let them add a datastream |
|
|
|
//if they have access let them add a datastream |
|
|
|
if (user_access(ObjectHelper :: $ADD_FEDORA_STREAMS)) { |
|
|
|
if (user_access(ObjectHelper :: $ADD_FEDORA_STREAMS)) { |
|
|
|
$allow=TRUE; |
|
|
|
$allow = TRUE; |
|
|
|
if (module_exists('fedora_fesl')) { |
|
|
|
if (module_exists('fedora_fesl')) { |
|
|
|
$allow= fedora_fesl_check_roles($object_pid,'write'); |
|
|
|
$allow = fedora_fesl_check_roles($object_pid, 'write'); |
|
|
|
} |
|
|
|
} |
|
|
|
if ($allow) { |
|
|
|
if ($allow) { |
|
|
|
$dataStreamBody .= drupal_get_form('add_stream_form', $object_pid); |
|
|
|
$dataStreamBody .= drupal_get_form('add_stream_form', $object_pid); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
$fieldset = array( |
|
|
|
$fieldset = array( |
|
|
|
'#title' => t("!text", array('!text' => $availableDataStreamsText)), |
|
|
|
'#title' => t("!text", array('!text' => $availableDataStreamsText)), |
|
|
|
'#collapsible' => TRUE, |
|
|
|
'#collapsible' => TRUE, |
|
|
|
'#collapsed' => TRUE, |
|
|
|
'#collapsed' => TRUE, |
|
|
|
'#value' => $dataStreamBody |
|
|
|
'#value' => $dataStreamBody |
|
|
|
); |
|
|
|
); |
|
|
|
$dataStreamBody = '<div class = "fedora_detailed_list">' . theme('fieldset', $fieldset) . '</div>'; |
|
|
|
$dataStreamBody = '<div class = "fedora_detailed_list">' . theme('fieldset', $fieldset) . '</div>'; |
|
|
|
} |
|
|
|
} |
|
|
@ -493,15 +493,15 @@ class ObjectHelper { |
|
|
|
$content .= $dataStreamBody; |
|
|
|
$content .= $dataStreamBody; |
|
|
|
|
|
|
|
|
|
|
|
if (user_access(ObjectHelper :: $PURGE_FEDORA_OBJECTSANDSTREAMS)) { |
|
|
|
if (user_access(ObjectHelper :: $PURGE_FEDORA_OBJECTSANDSTREAMS)) { |
|
|
|
$allow=TRUE; |
|
|
|
$allow = TRUE; |
|
|
|
if (module_exists('fedora_fesl')) { |
|
|
|
if (module_exists('fedora_fesl')) { |
|
|
|
$allow= fedora_fesl_check_roles($object_pid,'write'); |
|
|
|
$allow = fedora_fesl_check_roles($object_pid, 'write'); |
|
|
|
} |
|
|
|
} |
|
|
|
if ($allow) { |
|
|
|
if ($allow) { |
|
|
|
//$purgeObject = '<a title="' . t('Purge Object ') . $object_pid . '" href="' . base_path() . 'fedora/repository/purgeObject/' . |
|
|
|
//$purgeObject = '<a title="' . t('Purge Object ') . $object_pid . '" href="' . base_path() . 'fedora/repository/purgeObject/' . |
|
|
|
//$object_pid . '"><img src="' . $base_url . '/' . $path . '/images/purge_big.png" alt="' . t('Purge Object') . '" class="icon">' . t('Purge Object') . '</a>'; |
|
|
|
//$object_pid . '"><img src="' . $base_url . '/' . $path . '/images/purge_big.png" alt="' . t('Purge Object') . '" class="icon">' . t('Purge Object') . '</a>'; |
|
|
|
$purgeObject = drupal_get_form('fedora_repository_purge_object_form', $object_pid, check_plain(substr(request_uri(), strlen(base_path())))); |
|
|
|
$purgeObject = drupal_get_form('fedora_repository_purge_object_form', $object_pid, check_plain(substr(request_uri(), strlen(base_path())))); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$purgeObject = ' '; |
|
|
|
$purgeObject = ' '; |
|
|
|
} |
|
|
|
} |
|
|
@ -540,9 +540,9 @@ class ObjectHelper { |
|
|
|
try { |
|
|
|
try { |
|
|
|
$client = $soapHelper->getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); |
|
|
|
$client = $soapHelper->getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); |
|
|
|
$params = array( |
|
|
|
$params = array( |
|
|
|
'pid' => "$pid", |
|
|
|
'pid' => "$pid", |
|
|
|
'dsID' => "$dsid", |
|
|
|
'dsID' => "$dsid", |
|
|
|
'asOfDateTime' => "" |
|
|
|
'asOfDateTime' => "" |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (!isset($client)) { |
|
|
|
if (!isset($client)) { |
|
|
@ -602,20 +602,21 @@ class ObjectHelper { |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* determines whether we can see the object or not |
|
|
|
* determines whether we can see the object or not |
|
|
|
|
|
|
|
* checks PID namespace permissions, and user permissions |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
function fedora_repository_access($op, $pid) { |
|
|
|
function fedora_repository_access($op, $pid) { |
|
|
|
global $user; |
|
|
|
global $user; |
|
|
|
|
|
|
|
|
|
|
|
$returnValue = FALSE; |
|
|
|
$returnValue = FALSE; |
|
|
|
$isRestricted = variable_get('fedora_namespace_restriction_enforced',TRUE); |
|
|
|
$isRestricted = variable_get('fedora_namespace_restriction_enforced', TRUE); |
|
|
|
if(!$isRestricted){ |
|
|
|
if (!$isRestricted) { |
|
|
|
return TRUE; |
|
|
|
$returnValue = TRUE; |
|
|
|
} |
|
|
|
} |
|
|
|
if ($pid == NULL) { |
|
|
|
if ($pid == NULL) { |
|
|
|
$pid = variable_get('fedora_repository_pid', 'islandora:top'); |
|
|
|
$pid = variable_get('fedora_repository_pid', 'islandora:top'); |
|
|
|
} |
|
|
|
} |
|
|
|
$nameSpaceAllowed = explode(" ", variable_get('fedora_pids_allowed', 'default: demo: changeme: Islandora: ilives: ')); |
|
|
|
$nameSpaceAllowed = explode(" ", variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: ')); |
|
|
|
$pos = NULL; |
|
|
|
$pos = NULL; |
|
|
|
foreach ($nameSpaceAllowed as $nameSpace) { |
|
|
|
foreach ($nameSpaceAllowed as $nameSpace) { |
|
|
|
$pos = stripos($pid, $nameSpace); |
|
|
|
$pos = stripos($pid, $nameSpace); |
|
|
@ -729,19 +730,18 @@ class ObjectHelper { |
|
|
|
$collectionPolicyExists = $objectHelper->getMimeType($pid, CollectionPolicy::getDefaultDSID()); |
|
|
|
$collectionPolicyExists = $objectHelper->getMimeType($pid, CollectionPolicy::getDefaultDSID()); |
|
|
|
if (user_access(ObjectHelper :: $INGEST_FEDORA_OBJECTS) && $collectionPolicyExists) { |
|
|
|
if (user_access(ObjectHelper :: $INGEST_FEDORA_OBJECTS) && $collectionPolicyExists) { |
|
|
|
if (!empty($collectionPolicyExists)) { |
|
|
|
if (!empty($collectionPolicyExists)) { |
|
|
|
$allow=TRUE; |
|
|
|
$allow = TRUE; |
|
|
|
if (module_exists('fedora_fesl')) { |
|
|
|
if (module_exists('fedora_fesl')) { |
|
|
|
$allow= fedora_fesl_check_roles($pid,'write'); |
|
|
|
$allow = fedora_fesl_check_roles($pid, 'write'); |
|
|
|
} |
|
|
|
} |
|
|
|
if ($allow) { |
|
|
|
if ($allow) { |
|
|
|
// $ingestObject = '<a title="'. t('Ingest a New object into ') . $collectionName . ' '. $collection_pid . '" href="'. base_path() . |
|
|
|
// $ingestObject = '<a title="'. t('Ingest a New object into ') . $collectionName . ' '. $collection_pid . '" href="'. base_path() . |
|
|
|
$ingestObject = '<a title="' . t('Ingest a New object into !collection_name PID !collection_pid', array('!collection_name' => $collectionName, '!collection_pid' => $collection_pid)) . '" href="' . base_path() . |
|
|
|
$ingestObject = '<a title="' . t('Ingest a New object into !collection_name PID !collection_pid', array('!collection_name' => $collectionName, '!collection_pid' => $collection_pid)) . '" href="' . base_path() . |
|
|
|
'fedora/ingestObject/' . $collection_pid . '/' . $collectionName . '"><img src="' . $base_url . '/' . $path . |
|
|
|
'fedora/ingestObject/' . $collection_pid . '/' . $collectionName . '"><img src="' . $base_url . '/' . $path . |
|
|
|
'/images/ingest.png" alt="' . t('Add a New Object') . '" class="icon"></a>' . t(' Add to this Collection'); |
|
|
|
'/images/ingest.png" alt="' . t('Add a New Object') . '" class="icon"></a>' . t(' Add to this Collection'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
else { |
|
|
|
|
|
|
|
$ingestObject = ' '; |
|
|
|
$ingestObject = ' '; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -751,20 +751,20 @@ class ObjectHelper { |
|
|
|
$objectListOut = ''; |
|
|
|
$objectListOut = ''; |
|
|
|
if (isset($objectList)) { |
|
|
|
if (isset($objectList)) { |
|
|
|
$object_list_fieldset = array( |
|
|
|
$object_list_fieldset = array( |
|
|
|
'#title' => t('Items in this collection'), |
|
|
|
'#title' => t('Items in this collection'), |
|
|
|
'#collapsible' => TRUE, |
|
|
|
'#collapsible' => TRUE, |
|
|
|
'#collapsed' => FALSE, |
|
|
|
'#collapsed' => FALSE, |
|
|
|
'#value' => (isset($objectList) ? $objectList : ''), //collection list |
|
|
|
'#value' => (isset($objectList) ? $objectList : ''), //collection list |
|
|
|
); |
|
|
|
); |
|
|
|
$objectListOut = theme('fieldset', $object_list_fieldset); |
|
|
|
$objectListOut = theme('fieldset', $object_list_fieldset); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
//$collectionName=''; |
|
|
|
//$collectionName=''; |
|
|
|
$collection_fieldset = array( |
|
|
|
$collection_fieldset = array( |
|
|
|
'#title' => "", |
|
|
|
'#title' => "", |
|
|
|
'#collapsible' => TRUE, |
|
|
|
'#collapsible' => TRUE, |
|
|
|
'#collapsed' => FALSE, |
|
|
|
'#collapsed' => FALSE, |
|
|
|
'#value' => $datastreams, |
|
|
|
'#value' => $datastreams, |
|
|
|
); |
|
|
|
); |
|
|
|
$objectListOut = ''; //no collection objects to show so don't show field set |
|
|
|
$objectListOut = ''; //no collection objects to show so don't show field set |
|
|
|
} |
|
|
|
} |
|
|
@ -805,10 +805,10 @@ class ObjectHelper { |
|
|
|
$metaDataText = t('Description'); |
|
|
|
$metaDataText = t('Description'); |
|
|
|
$body = $this->getQDC($pid); |
|
|
|
$body = $this->getQDC($pid); |
|
|
|
$fieldset = array( |
|
|
|
$fieldset = array( |
|
|
|
'#title' => t("!metaDataText", array('!metaDataText' => $metaDataText)), |
|
|
|
'#title' => t("!metaDataText", array('!metaDataText' => $metaDataText)), |
|
|
|
'#collapsible' => TRUE, |
|
|
|
'#collapsible' => TRUE, |
|
|
|
'#collapsed' => TRUE, |
|
|
|
'#collapsed' => TRUE, |
|
|
|
'#value' => $body |
|
|
|
'#value' => $body |
|
|
|
); |
|
|
|
); |
|
|
|
$output .= theme('fieldset', $fieldset); |
|
|
|
$output .= theme('fieldset', $fieldset); |
|
|
|
} |
|
|
|
} |
|
|
@ -949,10 +949,10 @@ class ObjectHelper { |
|
|
|
// Get pid, title and description for children of object $pid |
|
|
|
// Get pid, title and description for children of object $pid |
|
|
|
$query_string = 'select $o $title from <#ri> ' . |
|
|
|
$query_string = 'select $o $title from <#ri> ' . |
|
|
|
// $query_string = 'select $o $title $desc from <#ri> '. |
|
|
|
// $query_string = 'select $o $title $desc from <#ri> '. |
|
|
|
'where $s <info:fedora/fedora-system:def/relations-external#hasMember> $o ' . |
|
|
|
'where $s <info:fedora/fedora-system:def/relations-external#hasMember> $o ' . |
|
|
|
'and $o <dc:title> $title ' . |
|
|
|
'and $o <dc:title> $title ' . |
|
|
|
// 'and $o <dc:description> $desc '. |
|
|
|
// 'and $o <dc:description> $desc '. |
|
|
|
'and ( '; |
|
|
|
'and ( '; |
|
|
|
|
|
|
|
|
|
|
|
foreach ($pids as $pid) { |
|
|
|
foreach ($pids as $pid) { |
|
|
|
$query_string .= '$s <mulgara:is> <info:fedora/' . $pid . '> or '; |
|
|
|
$query_string .= '$s <mulgara:is> <info:fedora/' . $pid . '> or '; |
|
|
@ -1017,11 +1017,11 @@ class ObjectHelper { |
|
|
|
|
|
|
|
|
|
|
|
$url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); |
|
|
|
$url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); |
|
|
|
$url .= "?type=tuples&flush=TRUE&format=CSV&limit=1&offset=0&lang=itql&stream=on&query=" . $query_string; |
|
|
|
$url .= "?type=tuples&flush=TRUE&format=CSV&limit=1&offset=0&lang=itql&stream=on&query=" . $query_string; |
|
|
|
$result = preg_split('/[\r\n]+/',do_curl($url)); |
|
|
|
$result = preg_split('/[\r\n]+/', do_curl($url)); |
|
|
|
array_shift($result); // throw away first line |
|
|
|
array_shift($result); // throw away first line |
|
|
|
$matches =str_getcsv(join("\n",$result)); |
|
|
|
$matches = str_getcsv(join("\n", $result)); |
|
|
|
if ($matches !== NULL) { |
|
|
|
if ($matches !== NULL) { |
|
|
|
$parent = preg_replace('/^info:fedora\//','',$matches[0]); |
|
|
|
$parent = preg_replace('/^info:fedora\//', '', $matches[0]); |
|
|
|
$breadcrumbs[] = l($matches[1], 'fedora/repository/' . $pid); |
|
|
|
$breadcrumbs[] = l($matches[1], 'fedora/repository/' . $pid); |
|
|
|
if ($parent == variable_get('fedora_repository_pid', 'islandora:top')) { |
|
|
|
if ($parent == variable_get('fedora_repository_pid', 'islandora:top')) { |
|
|
|
$breadcrumbs[] = l(t('Home'), ''); // l(t('Digital repository'), 'fedora/repository'); |
|
|
|
$breadcrumbs[] = l(t('Home'), ''); // l(t('Digital repository'), 'fedora/repository'); |
|
|
@ -1033,9 +1033,9 @@ class ObjectHelper { |
|
|
|
|
|
|
|
|
|
|
|
function warnIfMisconfigured($app) { |
|
|
|
function warnIfMisconfigured($app) { |
|
|
|
$messMap = array( |
|
|
|
$messMap = array( |
|
|
|
'Kakadu' => 'Full installation instructions for Kakadu can be found |
|
|
|
'Kakadu' => 'Full installation instructions for Kakadu can be found |
|
|
|
<a href=http://www.kakadusoftware.com/index.php?option=com_content&task=view&id=27&Itemid=23>Here</a>', |
|
|
|
<a href=http://www.kakadusoftware.com/index.php?option=com_content&task=view&id=27&Itemid=23>Here</a>', |
|
|
|
'ImageMagick' => 'Check the path settings in the configuration of your <b>imageapi</b> module.<br/> |
|
|
|
'ImageMagick' => 'Check the path settings in the configuration of your <b>imageapi</b> module.<br/> |
|
|
|
Further details can be found <a href=http://www.imagemagick.org/script/install-source.php>Here</a>', |
|
|
|
Further details can be found <a href=http://www.imagemagick.org/script/install-source.php>Here</a>', |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|