@ -33,7 +33,7 @@ class ObjectHelper {
*/
*/
function ObjectHelper() {
function ObjectHelper() {
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
module_load_include('inc', 'islan dora_repository', 'ConnectionHelper');
module_load_include('inc', 'fe dora_repository', 'ConnectionHelper');
$connectionHelper = new ConnectionHelper();
$connectionHelper = new ConnectionHelper();
//$this->fedoraUser = $connectionHelper->getUser();
//$this->fedoraUser = $connectionHelper->getUser();
//$this->fedoraPass = $connectionHelper->getPassword();
//$this->fedoraPass = $connectionHelper->getPassword();
@ -56,7 +56,7 @@ class ObjectHelper {
*/
*/
function makeObject($pid, $dsID, $asAttachment = FALSE, $label = NULL, $filePath=FALSE, $version=NULL, $forceSoap = TRUE) {
function makeObject($pid, $dsID, $asAttachment = FALSE, $label = NULL, $filePath=FALSE, $version=NULL, $forceSoap = TRUE) {
global $user;
global $user;
module_load_include('inc', 'islan dora_repository', 'ContentModel');
module_load_include('inc', 'fe dora_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 ' ';
@ -69,7 +69,7 @@ class ObjectHelper {
return ' ';
return ' ';
}
}
if (!islan dora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) {
if (!fe dora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) {
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 ' ';
@ -91,7 +91,7 @@ class ObjectHelper {
}
}
}
}
module_load_include('inc', 'islan dora_repository', 'api/fedora_item');
module_load_include('inc', 'fe dora_repository', 'api/fedora_item');
$item = new Fedora_Item($pid);
$item = new Fedora_Item($pid);
@ -176,7 +176,7 @@ class ObjectHelper {
* for the mimetype in question.
* for the mimetype in question.
*/
*/
if ($pos === FALSE) {
if ($pos === FALSE) {
module_load_include('inc', 'islan dora_repository', 'MimeClass');
module_load_include('inc', 'fe dora_repository', 'MimeClass');
$mimeclass = new MimeClass();
$mimeclass = new MimeClass();
$ext = $mimeclass->get_extension($mimeType);
$ext = $mimeclass->get_extension($mimeType);
$suggestedFileName = "$label.$ext";
$suggestedFileName = "$label.$ext";
@ -207,7 +207,7 @@ class ObjectHelper {
* @return type
* @return type
*/
*/
function getCollectionInfo($pid, $query = NULL) {
function getCollectionInfo($pid, $query = NULL) {
module_load_include('inc', 'islan dora_repository', 'CollectionClass');
module_load_include('inc', 'fe dora_repository', 'CollectionClass');
$collectionClass = new CollectionClass();
$collectionClass = new CollectionClass();
$results = $collectionClass->getRelatedItems($pid, $query);
$results = $collectionClass->getRelatedItems($pid, $query);
return $results;
return $results;
@ -227,12 +227,12 @@ class ObjectHelper {
drupal_set_message(t('You must specify an object pid and datastream ID.'), 'error');
drupal_set_message(t('You must specify an object pid and datastream ID.'), 'error');
return '';
return '';
}
}
if (!islan dora_repository_access(ObjectHelper :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) {
if (!fe dora_repository_access(ObjectHelper :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) {
drupal_set_message(t('You do not have the appropriate permissions'), 'error');
drupal_set_message(t('You do not have the appropriate permissions'), 'error');
return;
return;
}
}
module_load_include('inc', 'islan dora_repository', 'api/fedora_item');
module_load_include('inc', 'fe dora_repository', 'api/fedora_item');
$item = new fedora_item($pid);
$item = new fedora_item($pid);
$datastream_list = $item->get_datastreams_list_as_SimpleXML();
$datastream_list = $item->get_datastreams_list_as_SimpleXML();
if (!isset($datastream_list)) {
if (!isset($datastream_list)) {
@ -262,12 +262,12 @@ class ObjectHelper {
drupal_set_message(t('You must specify an object pid and datastream ID.'), 'error');
drupal_set_message(t('You must specify an object pid and datastream ID.'), 'error');
return '';
return '';
}
}
if (!islan dora_repository_access(ObjectHelper :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) {
if (!fe dora_repository_access(ObjectHelper :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) {
drupal_set_message(t('You do not have the appropriate permissions'), 'error');
drupal_set_message(t('You do not have the appropriate permissions'), 'error');
return;
return;
}
}
module_load_include('inc', 'islan dora_repository', 'api/fedora_item');
module_load_include('inc', 'fe dora_repository', 'api/fedora_item');
$item = new fedora_item($pid);
$item = new fedora_item($pid);
$datastream_list = $item->get_datastreams_list_as_SimpleXML();
$datastream_list = $item->get_datastreams_list_as_SimpleXML();
if (!isset($datastream_list)) {
if (!isset($datastream_list)) {
@ -291,7 +291,7 @@ class ObjectHelper {
*/
*/
function create_link_for_ds($pid, $dataStreamValue) {
function create_link_for_ds($pid, $dataStreamValue) {
global $base_url;
global $base_url;
$path = drupal_get_path('module', 'islan dora_repository');
$path = drupal_get_path('module', 'fe dora_repository');
require_once($path . '/api/fedora_item.inc');
require_once($path . '/api/fedora_item.inc');
$item = new Fedora_Item($pid);
$item = new Fedora_Item($pid);
@ -359,8 +359,8 @@ class ObjectHelper {
*/
*/
function getFormattedDC($item) {
function getFormattedDC($item) {
global $base_url;
global $base_url;
$path = drupal_get_path('module', 'islan dora_repository');
$path = drupal_get_path('module', 'fe dora_repository');
module_load_include('inc', 'islan dora_repository', 'ConnectionHelper');
module_load_include('inc', 'fe dora_repository', 'ConnectionHelper');
$dsid = array_key_exists('QDC', $item->get_datastreams_list_as_array()) ? 'QDC' : 'DC';
$dsid = array_key_exists('QDC', $item->get_datastreams_list_as_array()) ? 'QDC' : 'DC';
$xmlstr = $item->get_datastream_dissemination($dsid);
$xmlstr = $item->get_datastream_dissemination($dsid);
@ -408,7 +408,7 @@ class ObjectHelper {
$ds_list = $item->get_datastreams_list_as_array();
$ds_list = $item->get_datastreams_list_as_array();
$output = $this->getFormattedDC($item);
$output = $this->getFormattedDC($item);
$dsid = array_key_exists('QDC', $ds_list) ? 'QDC' : 'DC';
$dsid = array_key_exists('QDC', $ds_list) ? 'QDC' : 'DC';
$path = drupal_get_path('module', 'islan dora_repository');
$path = drupal_get_path('module', 'fe dora_repository');
//$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)) {
@ -440,12 +440,12 @@ class ObjectHelper {
*/
*/
function get_formatted_datastream_list($object_pid, $contentModels, & $fedoraItem) {
function get_formatted_datastream_list($object_pid, $contentModels, & $fedoraItem) {
global $fedoraUser, $fedoraPass, $base_url, $user;
global $fedoraUser, $fedoraPass, $base_url, $user;
module_load_include('inc', 'islan dora_repository', 'ConnectionHelper');
module_load_include('inc', 'fe dora_repository', 'ConnectionHelper');
module_load_include('inc', 'islan dora_repository', 'ObjectHelper');
module_load_include('inc', 'fe dora_repository', 'ObjectHelper');
module_load_include('inc', 'islan dora_repository', 'api/fedora_item');
module_load_include('inc', 'fe dora_repository', 'api/fedora_item');
module_load_include('inc', 'islan dora_repository', 'ContentModel');
module_load_include('inc', 'fe dora_repository', 'ContentModel');
$path = drupal_get_path('module', 'islan dora_repository');
$path = drupal_get_path('module', 'fe dora_repository');
$dataStreamBody = '';
$dataStreamBody = '';
$fedoraItem = new Fedora_Item($object_pid);
$fedoraItem = new Fedora_Item($object_pid);
@ -514,7 +514,7 @@ class ObjectHelper {
*
*
*/
*/
function getStream($pid, $dsid, $showError = FALSE) {
function getStream($pid, $dsid, $showError = FALSE) {
module_load_include('inc', 'islan dora_repository', 'ConnectionHelper');
module_load_include('inc', 'fe dora_repository', 'ConnectionHelper');
$soapHelper = new ConnectionHelper();
$soapHelper = new ConnectionHelper();
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'));
@ -548,7 +548,7 @@ class ObjectHelper {
* @return array
* @return array
*/
*/
function get_content_models_list($pid, $include_fedora_system_content_models = FALSE) {
function get_content_models_list($pid, $include_fedora_system_content_models = FALSE) {
module_load_include('inc', 'islan dora_repository', 'CollectionClass');
module_load_include('inc', 'fe dora_repository', 'CollectionClass');
$collectionHelper = new CollectionClass();
$collectionHelper = new CollectionClass();
$pids = array();
$pids = array();
$query = 'select $object from < #ri>
$query = 'select $object from < #ri>
@ -593,7 +593,7 @@ class ObjectHelper {
* @param type $pid
* @param type $pid
* @return type
* @return type
*/
*/
function islan dora_repository_access($op, $pid) {
function fe dora_repository_access($op, $pid) {
global $user;
global $user;
$returnValue = FALSE;
$returnValue = FALSE;
@ -602,7 +602,7 @@ class ObjectHelper {
$namespaceAccess = TRUE;
$namespaceAccess = TRUE;
}
}
if ($pid == NULL) {
if ($pid == NULL) {
$pid = variable_get('islan dora_repository_pid', 'islandora:root');
$pid = variable_get('fe dora_repository_pid', 'islandora:root');
}
}
$nameSpaceAllowed = explode(" ", variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: '));
$nameSpaceAllowed = explode(" ", variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: '));
$pos = NULL;
$pos = NULL;
@ -632,7 +632,7 @@ class ObjectHelper {
* @param $content String
* @param $content String
*/
*/
function parseContent($content, $pid, $dsId, $collection, $pageNumber = NULL) {
function parseContent($content, $pid, $dsId, $collection, $pageNumber = NULL) {
$path = drupal_get_path('module', 'islan dora_repository');
$path = drupal_get_path('module', 'fe dora_repository');
global $base_url;
global $base_url;
$collection_pid = $pid; //we will be changing the pid later maybe
$collection_pid = $pid; //we will be changing the pid later maybe
//module_load_include('php', ''Fedora_Repository'', 'ObjectHelper');
//module_load_include('php', ''Fedora_Repository'', 'ObjectHelper');
@ -790,7 +790,7 @@ class ObjectHelper {
return NULL;
return NULL;
}
}
$output = '';
$output = '';
module_load_include('inc', 'islan dora_repository', 'ContentModel');
module_load_include('inc', 'fe dora_repository', 'ContentModel');
if (($cm = ContentModel :: loadFromModel($contentModel)) !== FALSE & & $cm->validate()) {
if (($cm = ContentModel :: loadFromModel($contentModel)) !== FALSE & & $cm->validate()) {
$output .= $cm->displayExtraFieldset($pid, $page_number);
$output .= $cm->displayExtraFieldset($pid, $page_number);
}
}
@ -810,7 +810,7 @@ class ObjectHelper {
return FALSE;
return FALSE;
}
}
module_load_include('inc', 'islan dora_repository', 'ContentModel');
module_load_include('inc', 'fe dora_repository', 'ContentModel');
if ($dsid != NULL & & $pid != NULL & & ($cm = ContentModel::loadFromObject($pid)) !== FALSE) {
if ($dsid != NULL & & $pid != NULL & & ($cm = ContentModel::loadFromObject($pid)) !== FALSE) {
$cm->execAddDatastreamMethods($dsid, $file);
$cm->execAddDatastreamMethods($dsid, $file);
}
}
@ -826,7 +826,7 @@ class ObjectHelper {
if (!$pid) {
if (!$pid) {
return FALSE;
return FALSE;
}
}
module_load_include('inc', 'islan dora_repository', 'api/fedora_utils');
module_load_include('inc', 'fe dora_repository', 'api/fedora_utils');
// Get title and descriptions for $pid
// Get title and descriptions for $pid
$query_string = 'select $title $desc from < #ri>
$query_string = 'select $title $desc from < #ri>
@ -834,7 +834,7 @@ class ObjectHelper {
and $o < dc:description > $desc
and $o < dc:description > $desc
and $o < mulgara:is > < info:fedora / ' . $ pid . ' > ';
and $o < mulgara:is > < info:fedora / ' . $ pid . ' > ';
$url = variable_get('islan dora_repository_url', 'http://localhost:8080/fedora/risearch');
$url = variable_get('fe dora_repository_url', 'http://localhost:8080/fedora/risearch');
$url .= "?type=tuples&flush=true&format=csv&limit=1000&lang=itql&stream=on&query=";
$url .= "?type=tuples&flush=true&format=csv&limit=1000&lang=itql&stream=on&query=";
$content = do_curl($url . htmlentities(urlencode($query_string)));
$content = do_curl($url . htmlentities(urlencode($query_string)));
@ -868,7 +868,7 @@ class ObjectHelper {
}
}
$query_string = substr($query_string, 0, -3) . ' )';
$query_string = substr($query_string, 0, -3) . ' )';
$url = variable_get('islan dora_repository_url', 'http://localhost:8080/fedora/risearch');
$url = variable_get('fe dora_repository_url', 'http://localhost:8080/fedora/risearch');
$url .= "?type=tuples&flush=true&format=csv&limit=1000&lang=itql&stream=on&query=";
$url .= "?type=tuples&flush=true&format=csv&limit=1000&lang=itql&stream=on&query=";
$url .= htmlentities(urlencode($query_string));
$url .= htmlentities(urlencode($query_string));
$content = $this->doCurl($url);
$content = $this->doCurl($url);
@ -905,7 +905,7 @@ class ObjectHelper {
* @return type
* @return type
*/
*/
function getObject($pid, $context = 'archive', $format = FOXML_11) {
function getObject($pid, $context = 'archive', $format = FOXML_11) {
module_load_include('inc', 'islan dora_repository', 'api/fedora_utils');
module_load_include('inc', 'fe dora_repository', 'api/fedora_utils');
$url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/objects/' . $pid . '/export?context=' . $context . '& format=' . $format;
$url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/objects/' . $pid . '/export?context=' . $context . '& format=' . $format;
$result_data = do_curl($url);
$result_data = do_curl($url);
@ -921,10 +921,10 @@ class ObjectHelper {
* @param type $level
* @param type $level
*/
*/
function getBreadcrumbs($pid, & $breadcrumbs, $level=10) {
function getBreadcrumbs($pid, & $breadcrumbs, $level=10) {
module_load_include('inc', 'islan dora_repository', 'api/fedora_utils');
module_load_include('inc', 'fe dora_repository', 'api/fedora_utils');
// Before executing the query, we hve a base case of accessing the top-level collection
// Before executing the query, we hve a base case of accessing the top-level collection
global $base_url;
global $base_url;
if ($pid == variable_get('islan dora_repository_pid', 'islandora:root')) {
if ($pid == variable_get('fe dora_repository_pid', 'islandora:root')) {
$breadcrumbs[] = l(t('Digital repository'), 'fedora/repository');
$breadcrumbs[] = l(t('Digital repository'), 'fedora/repository');
$breadcrumbs[] = l(t('Home'), $base_url);
$breadcrumbs[] = l(t('Home'), $base_url);
}
}
@ -940,7 +940,7 @@ class ObjectHelper {
order by $title';
order by $title';
$query_string = htmlentities(urlencode($query_string));
$query_string = htmlentities(urlencode($query_string));
$url = variable_get('islan dora_repository_url', 'http://localhost:8080/fedora/risearch');
$url = variable_get('fe dora_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));
@ -950,7 +950,7 @@ class ObjectHelper {
$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('islan dora_repository_pid', 'islandora:root')) {
if ($parent == variable_get('fe dora_repository_pid', 'islandora:root')) {
$breadcrumbs[] = l(t('Digital repository'), 'fedora/repository');
$breadcrumbs[] = l(t('Digital repository'), 'fedora/repository');
$breadcrumbs[] = l(t('Home'), $base_url);
$breadcrumbs[] = l(t('Home'), $base_url);
}
}