From fae0efb144f7edc8635df821e38dfda567240229 Mon Sep 17 00:00:00 2001 From: Ben Woodhead Date: Tue, 11 Oct 2011 10:20:35 -0300 Subject: [PATCH 1/6] switched to islandora_repository --- BatchIngest.inc | 20 +-- CollectionClass.inc | 42 +++--- CollectionManagement.inc | 24 ++-- CollectionPolicy.inc | 18 +-- ContentModel.inc | 50 +++---- ObjectHelper.inc | 68 +++++----- SearchClass.inc | 30 ++--- SecurityClass.inc | 2 +- XMLDatastream.inc | 8 +- formClass.inc | 78 +++++------ islandora_repository.solutionpacks.inc | 175 +++++++++++++++++++++++++ 11 files changed, 345 insertions(+), 170 deletions(-) create mode 100644 islandora_repository.solutionpacks.inc diff --git a/BatchIngest.inc b/BatchIngest.inc index 31daa608..f3d63cc0 100644 --- a/BatchIngest.inc +++ b/BatchIngest.inc @@ -9,8 +9,8 @@ * @param array $content_models */ function batch_creation_form(&$form_state, $collection_pid, $content_models) { - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'CollectionPolicy'); $cm_options = array(); $name_mappings = array(); foreach ($content_models as $content_model) { @@ -95,8 +95,8 @@ function batch_creation_form_validate($form, &$form_state) { } function batch_creation_form_submit($form, &$form_state) { - module_load_include('inc', 'fedora_repository', 'ContentModel'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'ContentModel'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); global $user; $namespace_mappings = array(); $content_model = $form_state['values']['content_model']; @@ -150,7 +150,7 @@ function batch_creation_form_submit($form, &$form_state) { $batch = array( 'title' => 'Ingesting Objects', 'operations' => array(), - 'file' => drupal_get_path('module', 'fedora_repository') . '/BatchIngest.inc', + 'file' => drupal_get_path('module', 'islandora_repository') . '/BatchIngest.inc', ); @@ -176,8 +176,8 @@ function batch_creation_form_submit($form, &$form_state) { function create_batch_objects($label, $content_model, $object_files, $collection_pid, $namespace, $metadata) { - module_load_include('inc', 'fedora_repository', 'ContentModel'); - module_load_include('inc', 'fedora_repository', 'MimeClass'); + module_load_include('inc', 'islandora_repository', 'ContentModel'); + module_load_include('inc', 'islandora_repository', 'MimeClass'); $cm = ContentModel::loadFromModel($content_model, 'ISLANDORACM'); $allowedMimeTypes = $cm->getMimetypes(); $mime_helper = new MimeClass(); @@ -227,9 +227,9 @@ function create_batch_objects($label, $content_model, $object_files, $collection function batch_create_dc_from_mods($mods_xml) { - $path = drupal_get_path('module', 'fedora_repository'); - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - module_load_include('inc', 'fedora_repository', 'CollectionClass'); + $path = drupal_get_path('module', 'islandora_repository'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'CollectionClass'); if ($xmlstr == NULL || strlen($xmlstr) < 5) { return " "; diff --git a/CollectionClass.inc b/CollectionClass.inc index 4251eea4..df438aca 100644 --- a/CollectionClass.inc +++ b/CollectionClass.inc @@ -29,7 +29,7 @@ class CollectionClass { */ function __construct($pid = NULL) { if (!empty($pid)) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); $this->collectionObject = new ObjectHelper($pid); $this->pid = $pid; } @@ -45,7 +45,7 @@ class CollectionClass { * @return type */ function getRelatedObjects($pid, $limit, $offset, $itqlquery=NULL) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); $objectHelper = new ObjectHelper(); if (!isset($itqlquery)) { // $query_string = $objectHelper->getStream($pid, 'QUERY', 0); @@ -65,8 +65,8 @@ class CollectionClass { * @return type */ function getRelatedItems($pid, $itqlquery = NULL, $limit = NULL, $offset = NULL) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); if (!isset($limit)) { $limit = 1000; } @@ -74,7 +74,7 @@ class CollectionClass { $offset = 0; } global $user; - if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + if (!islandora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied."), 'error'); return ' '; } @@ -101,7 +101,7 @@ class CollectionClass { $query_string = htmlentities(urlencode($query_string)); $content = ''; - $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); + $url = variable_get('islandora_repository_url', 'http://localhost:8080/fedora/risearch'); $url .= "?type=tuples&flush=TRUE&format=Sparql&limit=$limit&offset=$offset&lang=itql&stream=on&query=" . $query_string; $content .= do_curl($url); @@ -156,7 +156,7 @@ class CollectionClass { * @return type */ function getStream($pid, $dsid, $showError = 1) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $item = new fedora_item($pid); return isset($item->datastreams[$dsid]) ? $item->get_datastream_dissemination($dsid) : NULL; } @@ -223,7 +223,7 @@ class CollectionClass { module_load_include('inc', 'Fedora_Repository', 'ConnectionHelper'); $pidNameSpace = $this->getPidNameSpace($pid, $dsid); $pname = substr($pidNameSpace, 0, strpos($pidNameSpace, ":")); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); return Fedora_Item::get_next_pid_in_namespace($pname); } @@ -339,7 +339,7 @@ class CollectionClass { } } // module_load_include( $phpFile, 'Fedora_Repository', ' '); - require_once(drupal_get_path('module', 'fedora_repository') . '/' . $phpFile); + require_once(drupal_get_path('module', 'islandora_repository') . '/' . $phpFile); $thisClass = new $phpClass (); $returnValue = $thisClass->$phpMethod($parametersArray, $dsid, $file, $file_ext); if (!$returnValue) { @@ -409,7 +409,7 @@ class CollectionClass { $ingest_form = $xml->ingest_form; //should only be one $drupal_module = strip_tags($ingest_form->form_builder_method->module->asXML()); if (empty($drupal_module)) { - $drupal_module = 'fedora_repository'; + $drupal_module = 'islandora_repository'; } $phpFile = strip_tags($ingest_form->form_builder_method->file->asXML()); $phpClass = strip_tags($ingest_form->form_builder_method->class_name->asXML()); @@ -437,11 +437,11 @@ class CollectionClass { 'name' => variable_get('fedora_admin_user', 'fedoraAdmin') ); $admin_user = user_load($username); - module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); + module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); $connectionHelper = new ConnectionHelper(); try { $soapClient = $connectionHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); - $pidNameSpace = variable_get('fedora_repository_pid', 'vre:'); + $pidNameSpace = variable_get('islandora_repository_pid', 'vre:'); $pidNameSpace = substr($pidNameSpace, 0, strpos($pidNameSpace, ":")); $params = array( 'numPIDs' => '', @@ -460,7 +460,7 @@ class CollectionClass { $personal_collection_pid = array( 'fedora_personal_pid' => $pid ); - module_load_include('inc', 'fedora_repository', 'plugins/PersonalCollectionClass'); + module_load_include('inc', 'islandora_repository', 'plugins/PersonalCollectionClass'); $personalCollectionClass = new PersonalCollectionClass(); if (!$personalCollectionClass->createCollection($user, $pid, $soapClient)) { drupal_set_message("Did not create a personal collection object for !u", array('!u' => $user->name)); @@ -480,7 +480,7 @@ class CollectionClass { * @return type */ function getXslContent($pid, $path, $canUseDefault = TRUE) { - module_load_include('inc', 'fedora_repository', 'CollectionClass'); + module_load_include('inc', 'islandora_repository', 'CollectionClass'); $collectionClass = new CollectionClass(); $xslContent = $collectionClass->getCollectionViewStream($pid); if (!$xslContent && $canUseDefault) { //no xslt so we will use the default sent with the module @@ -497,9 +497,9 @@ class CollectionClass { * @return string */ function showFieldSets($page_number) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'CollectionManagement'); - module_load_include('inc', 'fedora_repository', 'BatchIngest'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'CollectionManagement'); + module_load_include('inc', 'islandora_repository', 'BatchIngest'); global $base_url; $tabset = array(); global $user; @@ -514,7 +514,7 @@ class CollectionClass { $collection_items = $this->renderCollection($results, $this->pid, NULL, NULL, $page_number); $collection_item = new Fedora_Item($this->pid); // Check the form post to see if we are in the middle of an ingest operation. - $show_ingest_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_ingest_form'); + $show_ingest_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'islandora_repository_ingest_form'); $add_to_collection = $this->getIngestInterface(); $show_batch_tab = TRUE; @@ -586,7 +586,7 @@ class CollectionClass { $allow = fedora_fesl_check_roles($this->pid, 'write'); } if ($allow) { - $ingestObject = drupal_get_form('fedora_repository_ingest_form', $this->pid); + $ingestObject = drupal_get_form('islandora_repository_ingest_form', $this->pid); } } } @@ -608,7 +608,7 @@ class CollectionClass { * @return type */ function renderCollection($content, $pid, $dsId, $collection, $pageNumber = NULL) { - $path = drupal_get_path('module', 'fedora_repository'); + $path = drupal_get_path('module', 'islandora_repository'); global $base_url; $collection_pid = $pid; //we will be changing the pid later maybe $objectHelper = new ObjectHelper(); @@ -628,7 +628,7 @@ class CollectionClass { } if (!isset($collectionName)) { - $collectionName = variable_get('fedora_repository_name', 'Collection'); + $collectionName = variable_get('islandora_repository_name', 'Collection'); } $xslContent = $this->getXslContent($pid, $path); diff --git a/CollectionManagement.inc b/CollectionManagement.inc index 83bb9952..bb89a9fd 100644 --- a/CollectionManagement.inc +++ b/CollectionManagement.inc @@ -8,7 +8,7 @@ * @return array */ function collection_management_form(&$form_state, $this_collection_pid, $content_models) { - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); $restricted = FALSE; if (variable_get('fedora_namespace_restriction_enforced', true)) { $restricted = true; @@ -20,8 +20,8 @@ function collection_management_form(&$form_state, $this_collection_pid, $content } } } - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'CollectionPolicy'); $item = new Fedora_Item($this_collection_pid); $collection_name = $item->objectProfile->objLabel; $new_content_models = get_content_models_as_option_array(); @@ -224,8 +224,8 @@ function collection_management_form(&$form_state, $this_collection_pid, $content */ function collection_management_form_validate($form, &$form_state) { if ($form_state['clicked_button']['#id'] == 'create_class') { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); $pid = $form_state['values']['new_collection_pid']; $item = new fedora_item($pid); if ($item->exists()) { @@ -252,14 +252,14 @@ function collection_management_form_validate($form, &$form_state) { * @param type $form_state */ function collection_management_form_submit($form, &$form_state) { - module_load_include('inc', 'fedora_repository', 'api/fedora_collection'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'api/dublin_core'); + module_load_include('inc', 'islandora_repository', 'api/fedora_collection'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/dublin_core'); global $user; $collection_pid = $form_state['values']['parent_collection']; $policy = CollectionPolicy::loadFromCollection($collection_pid, TRUE); if ($form_state['clicked_button']['#id'] == 'create_class') { - $module_path = drupal_get_path('module', 'fedora_repository'); + $module_path = drupal_get_path('module', 'islandora_repository'); $thumbnail = drupal_get_path('module', 'Fedora_Repository') . '/images/Crystal_Clear_filesystem_folder_grey.png'; $new_collection_pid = $form_state['values']['new_collection_pid']; $new_collection_label = $form_state['values']['collection_name']; @@ -345,7 +345,7 @@ function collection_management_form_submit($form, &$form_state) { $query = htmlentities(urlencode($query)); $content = ''; - $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); + $url = variable_get('islandora_repository_url', 'http://localhost:8080/fedora/risearch'); $url .= "?type=tuples&flush=TRUE&format=csv&limit=$limit&offset=$offset&lang=itql&stream=on&query=" . $query; $content .= do_curl($url); $results = explode("\n", $content); @@ -370,7 +370,7 @@ function collection_management_form_submit($form, &$form_state) { $batch = array( 'title' => "Deleting Objects from $name", 'operations' => array(), - 'file' => drupal_get_path('module', 'fedora_repository') . '/CollectionManagement.inc', + 'file' => drupal_get_path('module', 'islandora_repository') . '/CollectionManagement.inc', ); @@ -389,7 +389,7 @@ function collection_management_form_submit($form, &$form_state) { * @param $pid */ function delete_objects_as_batch($pid) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $name = $user->name; $item_to_delete = new Fedora_Item($pid); $models = $item_to_delete->get_models(); diff --git a/CollectionPolicy.inc b/CollectionPolicy.inc index b801eaff..0612a733 100644 --- a/CollectionPolicy.inc +++ b/CollectionPolicy.inc @@ -4,7 +4,7 @@ * @file * Collection Policy Class */ -module_load_include('inc', 'fedora_repository', 'XMLDatastream'); +module_load_include('inc', 'islandora_repository', 'XMLDatastream'); /** * Collection Policy class ?? @@ -36,7 +36,7 @@ class CollectionPolicy extends XMLDatastream { */ static function loadFromCollection($pid, $preFetch=TRUE) { $ret = FALSE; - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); try { if (self::valid_pid($pid)) { @@ -80,7 +80,7 @@ class CollectionPolicy extends XMLDatastream { $rootEl = $cp->xml->getElementsByTagName('collection_policy')->item(0); $rootEl->setAttribute('name', $name); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $fedoraItem = new Fedora_Item($pid); $fedoraItem->add_datastream_from_string($cp->dumpXml(), $cpDsid, $name, 'text/xml', 'X'); $ret = $cp; @@ -110,7 +110,7 @@ class CollectionPolicy extends XMLDatastream { $cp = new CollectionPolicy($newDom, $pid, $cpDsid); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $fedoraItem = new Fedora_Item($pid); $fedoraItem->add_datastream_from_string($cp->dumpXml(), $cpDsid, $name, 'text/xml', 'X'); $ret = $cp; @@ -137,7 +137,7 @@ class CollectionPolicy extends XMLDatastream { public static function ingestBlankPolicy($pid, $name, $policyDsid, $model_pid, $model_namespace, $relationship, $searchField, $searchValue) { $ret = FALSE; if (($cp = self::loadFromCollection($pid)) === FALSE) { //removed second, non-existant variable - module_load_include('inc', 'fedora_repository', 'ContentModel'); + module_load_include('inc', 'islandora_repository', 'ContentModel'); if (($cm = ContentModel::loadFromModel($model_pid)) !== FALSE && $cm->validate()) { $newDom = new DOMDocument('1.0', 'utf-8'); $newDom->formatOutput = TRUE; @@ -171,7 +171,7 @@ class CollectionPolicy extends XMLDatastream { $cp = new CollectionPolicy($newDom, $pid, $policyDsid); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $fedoraItem = new Fedora_Item($pid); @@ -299,7 +299,7 @@ class CollectionPolicy extends XMLDatastream { $this->staging_area = trim($stagingEl->item(0)->nodeValue); } elseif ($recurse) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $item = new Fedora_Item($this->pid); $rels = $item->get_relationships(); if (count($rels) > 0) { @@ -373,7 +373,7 @@ class CollectionPolicy extends XMLDatastream { $pname = substr($namespace, 0, strpos($namespace, ":")); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $ret = Fedora_Item::get_next_pid_in_namespace($pname); } return $ret; @@ -443,7 +443,7 @@ class CollectionPolicy extends XMLDatastream { if ($recurse && count($ret) == 0) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $item = new Fedora_Item($this->pid); $rels = $item->get_relationships(); if (count($rels) > 0) { diff --git a/ContentModel.inc b/ContentModel.inc index b1f28074..66bd9569 100644 --- a/ContentModel.inc +++ b/ContentModel.inc @@ -8,7 +8,7 @@ * @file * Content Model Class */ -module_load_include('inc', 'fedora_repository', 'XMLDatastream'); +module_load_include('inc', 'islandora_repository', 'XMLDatastream'); /** * Conent Model ?? @@ -41,7 +41,7 @@ class ContentModel extends XMLDatastream { public static function loadFromObject($pid) { $ret = FALSE; if (self::valid_pid($pid)) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); $objectHelper = new ObjectHelper(); $content_models = $objectHelper->get_content_models_list($pid); @@ -73,7 +73,7 @@ class ContentModel extends XMLDatastream { $rootEl = $cm->xml->getElementsByTagName('content_model')->item(0); $rootEl->setAttribute('name', $name); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $fedoraItem = new Fedora_Item($pid); $fedoraItem->add_datastream_from_string($cm->dumpXml(), $modelDsid, $name, 'text/xml', 'X'); $ret = $cm; @@ -102,7 +102,7 @@ class ContentModel extends XMLDatastream { $cm = new ContentModel($newDom, $pid, $modelDsid); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $fedoraItem = new Fedora_Item($pid); $fedoraItem->add_datastream_from_string($cm->dumpXml(), $modelDsid, $name, 'text/xml', 'X'); $ret = $cm; @@ -172,7 +172,7 @@ class ContentModel extends XMLDatastream { $cm = new ContentModel($newDom, $pid, $modelDsid); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $fedoraItem = new Fedora_Item($pid); $fedoraItem->add_datastream_from_string($cm->dumpXml(), $modelDsid, $name, 'text/xml', 'X'); $ret = $cm; @@ -199,7 +199,7 @@ class ContentModel extends XMLDatastream { */ public static function loadFromModel($pid, $dsid = NULL, $pid_namespace = NULL, $name = NULL) { $ret = FALSE; - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); try { if (self::valid_pid($pid)) { $fedoraItem = new Fedora_Item($pid); @@ -436,7 +436,7 @@ class ContentModel extends XMLDatastream { and $object ) order by $title'; - module_load_include('inc', 'fedora_repository', 'CollectionClass'); + module_load_include('inc', 'islandora_repository', 'CollectionClass'); $collectionHelper = new CollectionClass(); $xml = simplexml_load_string($collectionHelper->getRelatedItems($this->pid, $query)); @@ -1070,7 +1070,7 @@ class ContentModel extends XMLDatastream { $method = $ingest_form->getElementsByTagName('form_builder_method')->item(0); $module = $method->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); + $path = drupal_get_path('module', !empty($module) ? $module : 'islandora_repository') . '/' . $method->getAttribute('file'); if (!file_exists($path)) { self::$errors[] = 'Build Ingest Form: file \'' . $path . '\' does not exist.'; } @@ -1110,7 +1110,7 @@ class ContentModel extends XMLDatastream { if ($method->length > 0 && $method->item(0)->getAttribute('dsid') == $dsid) { $method = $method->item(0); $module = $method->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); + $path = drupal_get_path('module', !empty($module) ? $module : 'islandora_repository') . '/' . $method->getAttribute('file'); if (!file_exists($path)) { self::$errors[] = 'Build Edit Metadata Form: file \'' . $path . '\' does not exist.'; } @@ -1153,7 +1153,7 @@ class ContentModel extends XMLDatastream { if ($method->length > 0) { $method = $method->item(0); $module = $method->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); + $path = drupal_get_path('module', !empty($module) ? $module : 'islandora_repository') . '/' . $method->getAttribute('file'); if (!file_exists($path)) { self::$errors[] = 'Handle Edit Metadata Form: file \'' . $path . '\' does not exist.'; } @@ -1177,7 +1177,7 @@ class ContentModel extends XMLDatastream { } else { // Assume DC form if none is specified. - module_load_include('inc', 'fedora_repository', 'formClass'); + module_load_include('inc', 'islandora_repository', 'formClass'); $metaDataForm = new formClass(); $ret = $metaDataForm->updateMetaData($form_state['values']['form_id'], $form_state['values'], $soap_client); $form_state['storage'] = NULL; @@ -1198,7 +1198,7 @@ class ContentModel extends XMLDatastream { $method = $this->xml->getElementsByTagName('content_model')->item(0)->getElementsByTagName('edit_metadata_method'); if ($method->length > 0) { $method = $method->item(0); - $ret = array('module' => $method->getAttribute('module') == '' ? 'fedora_repository' : $method->getAttribute('module'), + $ret = array('module' => $method->getAttribute('module') == '' ? 'islandora_repository' : $method->getAttribute('module'), 'file' => $method->getAttribute('file'), 'class' => $method->getAttribute('class'), 'method' => $method->getAttribute('method'), @@ -1282,7 +1282,7 @@ class ContentModel extends XMLDatastream { } } $module = $addMethod->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $addMethod->getAttribute('file'); + $path = drupal_get_path('module', !empty($module) ? $module : 'islandora_repository') . '/' . $addMethod->getAttribute('file'); if (!file_exists($path)) { self::$errors[] = 'Execute Add Datastream Methods: file \'' . $path . '\' does not exist.'; } @@ -1351,9 +1351,9 @@ class ContentModel extends XMLDatastream { if (!$preview || isset($param_array['preview'])) { $module = $method->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); + $path = drupal_get_path('module', !empty($module) ? $module : 'islandora_repository') . '/' . $method->getAttribute('file'); - if (!file_exists($path) || substr_compare($path, 'fedora_repository/', -strlen('fedora_repository/'), strlen('fedora_repository/')) === 0) { + if (!file_exists($path) || substr_compare($path, 'islandora_repository/', -strlen('islandora_repository/'), strlen('islandora_repository/')) === 0) { self::$errors[] = 'Execute Ingest Rules: file \'' . $path . '\' does not exist.'; $ret = FALSE; } @@ -1399,7 +1399,7 @@ class ContentModel extends XMLDatastream { if ($this->validate()) { $method = $this->xml->getElementsByTagName('ingest_form')->item(0)->getElementsByTagName('form_builder_method')->item(0); $module = $method->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); + $path = drupal_get_path('module', !empty($module) ? $module : 'islandora_repository') . '/' . $method->getAttribute('file'); if (!file_exists($path)) { self::$errors[] = 'Execute Form Handler: file \'' . $path . '\' does not exist.'; } @@ -1469,7 +1469,7 @@ class ContentModel extends XMLDatastream { for ($j = 0; $j < $dispMethods->length; $j++) { $method = $dispMethods->item($j); $module = $method->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); + $path = drupal_get_path('module', !empty($module) ? $module : 'islandora_repository') . '/' . $method->getAttribute('file'); if (!file_exists($path)) { self::$errors[] = 'Execute Form Handler: file \'' . $path . '\' does not exist.'; } @@ -1588,7 +1588,7 @@ class ContentModel extends XMLDatastream { $ret = array(); $dispMethods = $ds->getElementsByTagName('display_method'); for ($i = 0; $i < $dispMethods->length; $i++) { - $ret[] = array('module' => $dispMethods->item($i)->getAttribute('module') == '' ? 'fedora_repository' : $dispMethods->item($i)->getAttribute('module'), + $ret[] = array('module' => $dispMethods->item($i)->getAttribute('module') == '' ? 'islandora_repository' : $dispMethods->item($i)->getAttribute('module'), 'file' => $dispMethods->item($i)->getAttribute('file'), 'class' => $dispMethods->item($i)->getAttribute('class'), 'method' => $dispMethods->item($i)->getAttribute('method'), @@ -1694,7 +1694,7 @@ class ContentModel extends XMLDatastream { $found = FALSE; $dispMethods = $ds->getElementsByTagName('display_method'); for ($i = 0; !$found && $i < $dispMethods->length; $i++) { - if ($module == ($dispMethods->item($i)->getAttribute('module') == '' ? 'fedora_repository' : $dispMethods->item($i)->getAttribute('module')) && + if ($module == ($dispMethods->item($i)->getAttribute('module') == '' ? 'islandora_repository' : $dispMethods->item($i)->getAttribute('module')) && $file == $dispMethods->item($i)->getAttribute('file') && $class == $dispMethods->item($i)->getAttribute('class') && $method == $dispMethods->item($i)->getAttribute('method')) { @@ -1732,7 +1732,7 @@ class ContentModel extends XMLDatastream { $found = FALSE; $dispMethods = $ds->getElementsByTagName('display_method'); for ($i = 0; !$found && $i < $dispMethods->length; $i++) { - if ($module == ($dispMethods->item($i)->getAttribute('module') == '' ? 'fedora_repository' : $dispMethods->item($i)->getAttribute('module') == '') && + if ($module == ($dispMethods->item($i)->getAttribute('module') == '' ? 'islandora_repository' : $dispMethods->item($i)->getAttribute('module') == '') && $file == $dispMethods->item($i)->getAttribute('file') && $class == $dispMethods->item($i)->getAttribute('class') && $method == $dispMethods->item($i)->getAttribute('method')) { @@ -1785,7 +1785,7 @@ class ContentModel extends XMLDatastream { if (($ds = $this->getDSModel($ds)) !== FALSE) { $addDsMethod = $ds->getElementsByTagName('add_datastream_method'); if ($addDsMethod !== FALSE && $addDsMethod->length > 0) { - $ret = array('module' => $addDsMethod->item(0)->getAttribute('module') == '' ? 'fedora_repository' : $addDsMethod->item(0)->getAttribute('module'), + $ret = array('module' => $addDsMethod->item(0)->getAttribute('module') == '' ? 'islandora_repository' : $addDsMethod->item(0)->getAttribute('module'), 'file' => $addDsMethod->item(0)->getAttribute('file'), 'class' => $addDsMethod->item(0)->getAttribute('class'), 'method' => $addDsMethod->item(0)->getAttribute('method'), @@ -1936,7 +1936,7 @@ class ContentModel extends XMLDatastream { $methods = $rule->getElementsByTagName('ingest_methods')->item(0)->getElementsByTagName('ingest_method'); $found = FALSE; for ($i = 0; $found === FALSE && $i < $methods->length; $i++) { - if (($methods->item($i)->getAttribute('module') == '' ? 'fedora_repository' : $methods->item($i)->getAttribute('module')) == $module && + if (($methods->item($i)->getAttribute('module') == '' ? 'islandora_repository' : $methods->item($i)->getAttribute('module')) == $module && $methods->item($i)->getAttribute('file') == $file && $methods->item($i)->getAttribute('class') == $class && $methods->item($i)->getAttribute('method') == $method) { @@ -1989,7 +1989,7 @@ class ContentModel extends XMLDatastream { $methodsEl = $rule->getElementsByTagName('ingest_methods')->item(0); $methods = $methodsEl->getElementsByTagName('ingest_method'); for ($i = 0; !$found && $i < $methods->length; $i++) { - if (( trim($methods->item($i)->getAttribute('module')) == $module || (trim($methods->item($i)->getAttribute('module')) == '' && $module == 'fedora_repository')) && trim($methods->item($i)->getAttribute('file')) == $file && trim($methods->item($i)->getAttribute('class')) == $class && trim($methods->item($i)->getAttribute('method')) == $method) { + if (( trim($methods->item($i)->getAttribute('module')) == $module || (trim($methods->item($i)->getAttribute('module')) == '' && $module == 'islandora_repository')) && trim($methods->item($i)->getAttribute('file')) == $file && trim($methods->item($i)->getAttribute('class')) == $class && trim($methods->item($i)->getAttribute('method')) == $method) { $found = $methods->item($i); } } @@ -2077,7 +2077,7 @@ class ContentModel extends XMLDatastream { $methods = $rules->item($i)->getElementsByTagName('ingest_methods')->item(0)->getElementsByTagName('ingest_method'); for ($j = 0; $j < $methods->length; $j++) { - $method = array('module' => $methods->item($j)->getAttribute('module') == '' ? 'fedora_repository' : $methods->item($j)->getAttribute('module'), + $method = array('module' => $methods->item($j)->getAttribute('module') == '' ? 'islandora_repository' : $methods->item($j)->getAttribute('module'), 'file' => $methods->item($j)->getAttribute('file'), 'class' => $methods->item($j)->getAttribute('class'), 'method' => $methods->item($j)->getAttribute('method'), @@ -2157,7 +2157,7 @@ class ContentModel extends XMLDatastream { $ret = FALSE; if ($this->validate()) { $method = $this->xml->getElementsByTagName('ingest_form')->item(0)->getElementsByTagName('form_builder_method')->item(0); - $ret = array('module' => ($method->getAttribute('module') == '' ? 'fedora_repository' : $method->getAttribute('module')), + $ret = array('module' => ($method->getAttribute('module') == '' ? 'islandora_repository' : $method->getAttribute('module')), 'file' => $method->getAttribute('file'), 'class' => $method->getAttribute('class'), 'method' => $method->getAttribute('method'), diff --git a/ObjectHelper.inc b/ObjectHelper.inc index 9e9995b7..da56852b 100644 --- a/ObjectHelper.inc +++ b/ObjectHelper.inc @@ -33,7 +33,7 @@ class ObjectHelper { */ function ObjectHelper() { drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); - module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); + module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); $connectionHelper = new ConnectionHelper(); //$this->fedoraUser = $connectionHelper->getUser(); //$this->fedoraPass = $connectionHelper->getPassword(); @@ -56,7 +56,7 @@ class ObjectHelper { */ function makeObject($pid, $dsID, $asAttachment = FALSE, $label = NULL, $filePath=FALSE, $version=NULL, $forceSoap = TRUE) { global $user; - module_load_include('inc', 'fedora_repository', 'ContentModel'); + module_load_include('inc', 'islandora_repository', 'ContentModel'); if ($pid == NULL || $dsID == NULL) { drupal_set_message(t("no pid or dsid given to create an object with"), 'error'); return ' '; @@ -69,7 +69,7 @@ class ObjectHelper { return ' '; } - if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + if (!islandora_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_access_denied(); return ' '; @@ -91,7 +91,7 @@ class ObjectHelper { } } - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $item = new Fedora_Item($pid); @@ -176,7 +176,7 @@ class ObjectHelper { * for the mimetype in question. */ if ($pos === FALSE) { - module_load_include('inc', 'fedora_repository', 'MimeClass'); + module_load_include('inc', 'islandora_repository', 'MimeClass'); $mimeclass = new MimeClass(); $ext = $mimeclass->get_extension($mimeType); $suggestedFileName = "$label.$ext"; @@ -207,7 +207,7 @@ class ObjectHelper { * @return type */ function getCollectionInfo($pid, $query = NULL) { - module_load_include('inc', 'fedora_repository', 'CollectionClass'); + module_load_include('inc', 'islandora_repository', 'CollectionClass'); $collectionClass = new CollectionClass(); $results = $collectionClass->getRelatedItems($pid, $query); return $results; @@ -227,12 +227,12 @@ class ObjectHelper { drupal_set_message(t('You must specify an object pid and datastream ID.'), 'error'); return ''; } - if (!fedora_repository_access(ObjectHelper :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + if (!islandora_repository_access(ObjectHelper :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { drupal_set_message(t('You do not have the appropriate permissions'), 'error'); return; } - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $item = new fedora_item($pid); $datastream_list = $item->get_datastreams_list_as_SimpleXML(); if (!isset($datastream_list)) { @@ -262,12 +262,12 @@ class ObjectHelper { drupal_set_message(t('You must specify an object pid and datastream ID.'), 'error'); return ''; } - if (!fedora_repository_access(ObjectHelper :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + if (!islandora_repository_access(ObjectHelper :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { drupal_set_message(t('You do not have the appropriate permissions'), 'error'); return; } - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $item = new fedora_item($pid); $datastream_list = $item->get_datastreams_list_as_SimpleXML(); if (!isset($datastream_list)) { @@ -291,7 +291,7 @@ class ObjectHelper { */ function create_link_for_ds($pid, $dataStreamValue) { global $base_url; - $path = drupal_get_path('module', 'fedora_repository'); + $path = drupal_get_path('module', 'islandora_repository'); require_once($path . '/api/fedora_item.inc'); $item = new Fedora_Item($pid); @@ -359,8 +359,8 @@ class ObjectHelper { */ function getFormattedDC($item) { global $base_url; - $path = drupal_get_path('module', 'fedora_repository'); - module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); + $path = drupal_get_path('module', 'islandora_repository'); + module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); $dsid = array_key_exists('QDC', $item->get_datastreams_list_as_array()) ? 'QDC' : 'DC'; $xmlstr = $item->get_datastream_dissemination($dsid); @@ -408,7 +408,7 @@ class ObjectHelper { $ds_list = $item->get_datastreams_list_as_array(); $output = $this->getFormattedDC($item); $dsid = array_key_exists('QDC', $ds_list) ? 'QDC' : 'DC'; - $path = drupal_get_path('module', 'fedora_repository'); + $path = drupal_get_path('module', 'islandora_repository'); //$baseUrl=substr($baseUrl, 0, (strpos($baseUrl, "/")-1)); if (user_access(ObjectHelper :: $EDIT_FEDORA_METADATA)) { @@ -440,12 +440,12 @@ class ObjectHelper { */ function get_formatted_datastream_list($object_pid, $contentModels, &$fedoraItem) { 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'); + module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'ContentModel'); - $path = drupal_get_path('module', 'fedora_repository'); + $path = drupal_get_path('module', 'islandora_repository'); $dataStreamBody = ''; $fedoraItem = new Fedora_Item($object_pid); @@ -514,7 +514,7 @@ class ObjectHelper { * */ function getStream($pid, $dsid, $showError = FALSE) { - module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); + module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); $soapHelper = new ConnectionHelper(); try { $client = $soapHelper->getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); @@ -548,7 +548,7 @@ class ObjectHelper { * @return array */ function get_content_models_list($pid, $include_fedora_system_content_models = FALSE) { - module_load_include('inc', 'fedora_repository', 'CollectionClass'); + module_load_include('inc', 'islandora_repository', 'CollectionClass'); $collectionHelper = new CollectionClass(); $pids = array(); $query = 'select $object from <#ri> @@ -593,7 +593,7 @@ class ObjectHelper { * @param type $pid * @return type */ - function fedora_repository_access($op, $pid) { + function islandora_repository_access($op, $pid) { global $user; $returnValue = FALSE; @@ -602,7 +602,7 @@ class ObjectHelper { $namespaceAccess = TRUE; } if ($pid == NULL) { - $pid = variable_get('fedora_repository_pid', 'islandora:root'); + $pid = variable_get('islandora_repository_pid', 'islandora:root'); } $nameSpaceAllowed = explode(" ", variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); $pos = NULL; @@ -632,7 +632,7 @@ class ObjectHelper { * @param $content String */ function parseContent($content, $pid, $dsId, $collection, $pageNumber = NULL) { - $path = drupal_get_path('module', 'fedora_repository'); + $path = drupal_get_path('module', 'islandora_repository'); global $base_url; $collection_pid = $pid; //we will be changing the pid later maybe //module_load_include('php', ''Fedora_Repository'', 'ObjectHelper'); @@ -790,7 +790,7 @@ class ObjectHelper { return NULL; } $output = ''; - module_load_include('inc', 'fedora_repository', 'ContentModel'); + module_load_include('inc', 'islandora_repository', 'ContentModel'); if (($cm = ContentModel :: loadFromModel($contentModel)) !== FALSE && $cm->validate()) { $output .= $cm->displayExtraFieldset($pid, $page_number); } @@ -810,7 +810,7 @@ class ObjectHelper { return FALSE; } - module_load_include('inc', 'fedora_repository', 'ContentModel'); + module_load_include('inc', 'islandora_repository', 'ContentModel'); if ($dsid != NULL && $pid != NULL && ($cm = ContentModel::loadFromObject($pid)) !== FALSE) { $cm->execAddDatastreamMethods($dsid, $file); } @@ -826,7 +826,7 @@ class ObjectHelper { if (!$pid) { return FALSE; } - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); // Get title and descriptions for $pid $query_string = 'select $title $desc from <#ri> @@ -834,7 +834,7 @@ class ObjectHelper { and $o $desc and $o '; - $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); + $url = variable_get('islandora_repository_url', 'http://localhost:8080/fedora/risearch'); $url .= "?type=tuples&flush=true&format=csv&limit=1000&lang=itql&stream=on&query="; $content = do_curl($url . htmlentities(urlencode($query_string))); @@ -868,7 +868,7 @@ class ObjectHelper { } $query_string = substr($query_string, 0, -3) . ' )'; - $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); + $url = variable_get('islandora_repository_url', 'http://localhost:8080/fedora/risearch'); $url .= "?type=tuples&flush=true&format=csv&limit=1000&lang=itql&stream=on&query="; $url .= htmlentities(urlencode($query_string)); $content = $this->doCurl($url); @@ -905,7 +905,7 @@ class ObjectHelper { * @return type */ function getObject($pid, $context = 'archive', $format = FOXML_11) { - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); $url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/objects/' . $pid . '/export?context=' . $context . '&format=' . $format; $result_data = do_curl($url); @@ -921,10 +921,10 @@ class ObjectHelper { * @param type $level */ function getBreadcrumbs($pid, &$breadcrumbs, $level=10) { - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); // Before executing the query, we hve a base case of accessing the top-level collection global $base_url; - if ($pid == variable_get('fedora_repository_pid', 'islandora:root')) { + if ($pid == variable_get('islandora_repository_pid', 'islandora:root')) { $breadcrumbs[] = l(t('Digital repository'), 'fedora/repository'); $breadcrumbs[] = l(t('Home'), $base_url); } @@ -940,7 +940,7 @@ class ObjectHelper { order by $title'; $query_string = htmlentities(urlencode($query_string)); - $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); + $url = variable_get('islandora_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; $result = preg_split('/[\r\n]+/', do_curl($url)); @@ -950,7 +950,7 @@ class ObjectHelper { $parent = preg_replace('/^info:fedora\//', '', $matches[0]); $breadcrumbs[] = l($matches[1], 'fedora/repository/' . $pid); - if ($parent == variable_get('fedora_repository_pid', 'islandora:root')) { + if ($parent == variable_get('islandora_repository_pid', 'islandora:root')) { $breadcrumbs[] = l(t('Digital repository'), 'fedora/repository'); $breadcrumbs[] = l(t('Home'), $base_url); } diff --git a/SearchClass.inc b/SearchClass.inc index 3f1c78d5..794d292a 100644 --- a/SearchClass.inc +++ b/SearchClass.inc @@ -25,14 +25,14 @@ class SearchClass { function solr_search($query, $startPage=1, $fq = NULL, $dismax = NULL) { $solrFile = trim(variable_get('islandora_solr_search_block_handler_file', 'plugins/SolrResults.inc')); - // Don't let us bust out of fedora_repository modules directory when looking for a handler + // Don't let us bust out of islandora_repository modules directory when looking for a handler if (strpos($solrField, '../')) { drupal_set_message(t('You have illegal characters in your solr handler function in the Islandora solr block config.'), 'error'); } $solrClass = trim(variable_get('islandora_solr_search_block_handler_class', 'SolrResults')); $solrFunction = trim(variable_get('islandora_solr_search_block_handler_function', 'SearchAndDisplay')); - require_once(drupal_get_path('module', 'fedora_repository') . '/' . $solrFile); + require_once(drupal_get_path('module', 'islandora_repository') . '/' . $solrFile); try { $implementation = new $solrClass(); } catch (Exception $e) { @@ -185,8 +185,8 @@ class SearchClass { * @return type */ function quickSearch($type, $query, $showForm = 1, $orderBy = 0, & $userArray) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); if (user_access('view fedora collection')) { $numberOfHistPerPage = '5000'; //hack for IR they do not want next button $luceneQuery = NULL; @@ -222,7 +222,7 @@ class SearchClass { } } if ($showForm) { - $output = 'Quick Search
' . drupal_get_form('fedora_repository_quick_search_form') . '
'; + $output = 'Quick Search
' . drupal_get_form('islandora_repository_quick_search_form') . '
'; } $output .= $this->applyXSLT($resultData, $orderBy); return $output; @@ -237,8 +237,8 @@ class SearchClass { * @return type */ function getTerms($fieldName, $startTerm, $displayName = NULL) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); $indexName = variable_get('fedora_index_name', 'DemoOnLucene'); $searchUrl = variable_get('fedora_fgsearch_url', 'http://localhost:8080/fedoragsearch/rest'); if ($startTerm == NULL) { @@ -269,8 +269,8 @@ class SearchClass { * @return type */ function custom_search($query, $startPage=1, $xslt= '/xsl/advanced_search_results.xsl', $numberOfHistPerPage = 50) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); if (user_access('view fedora collection')) { //$numberOfHistPerPage = '50';//hack for IR they do not want next button @@ -322,7 +322,7 @@ class SearchClass { return ' '; } - //$proc->setParameter('', 'searchUrl', url('search') . '/fedora_repository'); //needed in our xsl + //$proc->setParameter('', 'searchUrl', url('search') . '/islandora_repository'); //needed in our xsl $proc->setParameter('', 'objectsPage', base_path()); $proc->setParameter('', 'userID', $user->uid); if (isset($displayName)) { @@ -390,8 +390,8 @@ class SearchClass { //inject into xsl stylesheet global $user; $proc->setParameter('', 'userID', $user->uid); - $proc->setParameter('', 'searchToken', drupal_get_token('fedora_repository_advanced_search')); //token generated by Drupal, keeps tack of what tab etc we are on - $proc->setParameter('', 'searchUrl', url('search') . '/fedora_repository'); //needed in our xsl + $proc->setParameter('', 'searchToken', drupal_get_token('islandora_repository_advanced_search')); //token generated by Drupal, keeps tack of what tab etc we are on + $proc->setParameter('', 'searchUrl', url('search') . '/islandora_repository'); //needed in our xsl $proc->setParameter('', 'objectsPage', base_path()); $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); $proc->setParameter('', 'hitPageStart', $startPage); @@ -441,7 +441,7 @@ class SearchClass { //inject into xsl stylesheet //$proc->setParameter('', 'searchToken', drupal_get_token('search_form')); //token generated by Drupal, keeps tack of what tab etc we are on $proc->setParameter('', 'userID', $user->uid); - $proc->setParameter('', 'searchUrl', url('search') . '/fedora_repository'); //needed in our xsl + $proc->setParameter('', 'searchUrl', url('search') . '/islandora_repository'); //needed in our xsl $proc->setParameter('', 'objectsPage', base_path()); $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); $proc->setParameter('', 'orderBy', $orderBy); @@ -475,7 +475,7 @@ class SearchClass { */ function theme_advanced_search_form($form, $repeat=NULL) { if (!isset($repeat)) { - $repeat = variable_get('fedora_repository_advanced_block_repeat', t('3')); + $repeat = variable_get('islandora_repository_advanced_block_repeat', t('3')); } $output = drupal_render($form['search_type']['type1']); @@ -515,7 +515,7 @@ class SearchClass { $form = array(); if (!isset($repeat)) { - $repeat = variable_get('fedora_repository_advanced_block_repeat', t('3')); + $repeat = variable_get('islandora_repository_advanced_block_repeat', t('3')); } $var0 = explode(':', $queryArray[0]); $var1 = explode(':', $queryArray[1]); diff --git a/SecurityClass.inc b/SecurityClass.inc index 0cdb2cbe..fbc6d3b8 100644 --- a/SecurityClass.inc +++ b/SecurityClass.inc @@ -30,7 +30,7 @@ class SecurityClass { */ function canIngestHere($collection_pid) { global $user; - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); $objectHelper = new ObjectHelper(); // get the childsecurity policy from the collection. $policyStream = $objectHelper->getStream($collection_pid, SECURITYCLASS :: $SECURITY_CLASS_SECURITY_STREAM, FALSE); diff --git a/XMLDatastream.inc b/XMLDatastream.inc index d3afed09..9376aa83 100644 --- a/XMLDatastream.inc +++ b/XMLDatastream.inc @@ -168,7 +168,7 @@ abstract class XMLDatastream { //$tmpname = substr($this->pid, strpos($this->pid, ':') + 1); $tmpname = user_password(10); $this->convertFromOldSchema(); - drupal_add_js("fedora_repository_print_new_schema_$tmpname = function(tagID) { + drupal_add_js("islandora_repository_print_new_schema_$tmpname = function(tagID) { var target = document.getElementById(tagID); var content = target.innerHTML; var text = 'Title' + @@ -179,7 +179,7 @@ abstract class XMLDatastream { }", 'inline'); if (user_access('administer site configuration')) { - drupal_set_message('<span id="new_schema_' . $tmpname . '" style="display: none;">' . htmlentities($this->xml->saveXML()) . '</span>Warning: XMLDatastream performed conversion of \'' . $this->getIdentifier() . '\' from old schema. Please update the datastream. The new datastream contents are <a href="javascript:fedora_repository_print_new_schema_' . $tmpname . '(\'new_schema_' . $tmpname . '\')">here.</a> '); + drupal_set_message('<span id="new_schema_' . $tmpname . '" style="display: none;">' . htmlentities($this->xml->saveXML()) . '</span>Warning: XMLDatastream performed conversion of \'' . $this->getIdentifier() . '\' from old schema. Please update the datastream. The new datastream contents are <a href="javascript:islandora_repository_print_new_schema_' . $tmpname . '(\'new_schema_' . $tmpname . '\')">here.</a> '); } $rootEl = $this->xml->firstChild; @@ -246,7 +246,7 @@ abstract class XMLDatastream { * @return boolean $valid */ public function purgeVersions($start_date, $end_date = NULL) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $fedora_item = new Fedora_Item($this->pid); return $fedora_item->purge_datastream($this->dsid, $start_date, $end_date); } @@ -258,7 +258,7 @@ abstract class XMLDatastream { * @return string[] $ret */ public function getHistory() { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $fedora_item = new Fedora_Item($this->pid); $history = $fedora_item->get_datastream_history($this->dsid); diff --git a/formClass.inc b/formClass.inc index 762f1252..93b68316 100644 --- a/formClass.inc +++ b/formClass.inc @@ -24,15 +24,15 @@ class formClass { function createMenu() { $items = array(); - $items['admin/settings/fedora_repository'] = array( + $items['admin/settings/islandora_repository'] = array( 'title' => t('Configure Islandora'), 'description' => t('Enter the Islandora Collection information here'), 'page callback' => 'drupal_get_form', - 'page arguments' => array('fedora_repository_admin'), + 'page arguments' => array('islandora_repository_admin'), 'access arguments' => array('administer site configuration'), 'type' => MENU_NORMAL_ITEM, ); - $items['admin/settings/fedora_repository/collection'] = array( + $items['admin/settings/islandora_repository/collection'] = array( 'title' => t('Collection list'), 'description' => t('Enter the Islandora collection information here.'), 'access arguments' => array('administer site configuration'), @@ -40,18 +40,18 @@ class formClass { 'weight' => 0, ); - $items['admin/settings/fedora_repository/demoobjects'] = array( + $items['admin/settings/islandora_repository/demoobjects'] = array( 'title' => t('Solution Packs'), 'description' => t('Install content models and collections required by installed solution packs.'), - 'page callback' => 'fedora_repository_solution_packs_page', + 'page callback' => 'islandora_repository_solution_packs_page', 'access arguments' => array('add fedora datastreams'), - 'file' => 'fedora_repository.solutionpacks.inc', + 'file' => 'islandora_repository.solutionpacks.inc', 'type' => MENU_LOCAL_TASK, ); $items['islandoracm.xsd'] = array( 'title' => t('Islandora Content Model XML Schema Definition'), - 'page callback' => 'fedora_repository_display_schema', + 'page callback' => 'islandora_repository_display_schema', 'page arguments' => array('islandoracm.xsd'), 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection'), @@ -59,7 +59,7 @@ class formClass { $items['collection_policy.xsd'] = array( 'title' => t('Islandora Content Model XML Schema Definition'), - 'page callback' => 'fedora_repository_display_schema', + 'page callback' => 'islandora_repository_display_schema', 'page arguments' => array('collection_policy.xsd'), 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection'), @@ -70,7 +70,7 @@ class formClass { 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection'), ); - $repository_title = variable_get('fedora_repository_title', 'Digital repository'); + $repository_title = variable_get('islandora_repository_title', 'Digital repository'); if (trim($repository_title) != '') { $respository_title = t($repository_title); } @@ -100,7 +100,7 @@ class formClass { $items['fedora/repository/editmetadata'] = array( 'title' => t('Edit metadata'), - 'page callback' => 'fedora_repository_edit_qdc_page', + 'page callback' => 'islandora_repository_edit_qdc_page', // 'page arguments' => array(1), //'type' => MENU_LOCAL_TASK, 'type' => MENU_CALLBACK, @@ -109,21 +109,21 @@ class formClass { $items['fedora/repository/purgeStream'] = array( 'title' => t('Purge data stream'), - 'page callback' => 'fedora_repository_purge_stream', + 'page callback' => 'islandora_repository_purge_stream', 'type' => MENU_CALLBACK, 'access arguments' => array('purge objects and datastreams') ); $items['fedora/repository/replaceStream'] = array( 'title' => t('Replace Stream'), - 'page callback' => 'fedora_repository_replace_stream', + 'page callback' => 'islandora_repository_replace_stream', 'type' => MENU_CALLBACK, 'access arguments' => array('add fedora datastreams'), ); $items['fedora/repository/purgeObject'] = array( 'title' => t('Purge object'), - 'page callback' => 'fedora_repository_purge_object', + 'page callback' => 'islandora_repository_purge_object', // 'type' => MENU_LOCAL_TASK, 'type' => MENU_CALLBACK, 'access arguments' => array('purge objects and datastreams') @@ -147,21 +147,21 @@ class formClass { //new for mnpl****************************************** $items['fedora/repository/mnpl_advanced_search'] = array( 'title' => t('Repository advanced search'), - 'page callback' => 'fedora_repository_mnpl_advanced_search', + 'page callback' => 'islandora_repository_mnpl_advanced_search', 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection') ); $items['fedora/ingestObject'] = array( 'title' => t('Ingest object'), - 'page callback' => 'fedora_repository_ingest_object', + 'page callback' => 'islandora_repository_ingest_object', 'type' => MENU_CALLBACK, 'access arguments' => array('add fedora datastreams') ); $items['fedora/repository/list_terms'] = array( 'title' => t('List terms'), - 'page callback' => 'fedora_repository_list_terms', + 'page callback' => 'islandora_repository_list_terms', 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection') ); @@ -170,25 +170,25 @@ class formClass { $items['fedora/basket'] = array( 'title' => t('Fedora Basket'), 'description' => t('View and download objects added to your basket'), - 'page callback' => 'fedora_repository_basket', + 'page callback' => 'islandora_repository_basket', 'access arguments' => array('view fedora collection'), 'type' => MENU_CALLBACK, ); $items['fedora/repository/addToBasket'] = array( - 'page callback' => 'fedora_repository_add_to_basket', + 'page callback' => 'islandora_repository_add_to_basket', 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection'), ); $items['fedora/repository/removeFromBasket'] = array( - 'page callback' => 'fedora_repository_remove_from_basket', + 'page callback' => 'islandora_repository_remove_from_basket', 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection'), ); $items['fedora/repository/add_search_results_to_basket'] = array( - 'page callback' => 'fedora_repository_add_search_results_to_basket', + 'page callback' => 'islandora_repository_add_search_results_to_basket', 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection'), ); @@ -205,21 +205,21 @@ class formClass { drupal_set_message(t('You must be a site administrator to edit the Fedora collecitons list.'), 'error'); return; } - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); $form = array(); - $form['fedora_repository_name'] = array( + $form['islandora_repository_name'] = array( '#type' => 'textfield', '#title' => t('Root Collection Name'), - '#default_value' => variable_get('fedora_repository_name', 'Islandora demos collection'), + '#default_value' => variable_get('islandora_repository_name', 'Islandora demos collection'), '#description' => t('The Name of the Root Collection Object'), '#required' => TRUE, '#weight' => -20 ); - $form['fedora_repository_pid'] = array( + $form['islandora_repository_pid'] = array( '#type' => 'textfield', '#title' => t('Root Collection PID'), - '#default_value' => variable_get('fedora_repository_pid', 'islandora:root'), + '#default_value' => variable_get('islandora_repository_pid', 'islandora:root'), '#description' => t('The PID of the Root Collection Object'), '#required' => TRUE, '#weight' => -18 @@ -235,10 +235,10 @@ class formClass { ); - $form['fedora_repository_url'] = array( + $form['islandora_repository_url'] = array( '#type' => 'textfield', '#title' => t('Fedora RISearch URL'), - '#default_value' => variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'), + '#default_value' => variable_get('islandora_repository_url', 'http://localhost:8080/fedora/risearch'), '#description' => t('The url of the Fedora server'), '#required' => TRUE, '#weight' => -14 ); @@ -296,10 +296,10 @@ class formClass { '#weight' => 0 ); } - $form['fedora_repository_title'] = array( + $form['islandora_repository_title'] = array( '#type' => 'textfield', '#title' => t('Digital Repository Title'), - '#default_value' => variable_get('fedora_repository_title', 'Digital Repository'), + '#default_value' => variable_get('islandora_repository_title', 'Digital Repository'), '#description' => t('The title displayed when viewing collections and objects in /fedora/repository. Leave blank to display no title. Note that the menus must be rebuilt after changing this variable.'), ); $form['advanced'] = array( @@ -432,7 +432,7 @@ class formClass { * @return type */ function can_ingest_here($collection_pid) { - module_load_include('inc', 'fedora_repository', 'SecurityClass'); + module_load_include('inc', 'islandora_repository', 'SecurityClass'); $securityClass = new SecurityClass(); return $securityClass->canIngestHere($collection_pid); } @@ -447,7 +447,7 @@ class formClass { drupal_set_message(t('You do not have permission to ingest.'), 'error'); return FALSE; } - module_load_include('inc', 'fedora_repository', 'SecurityClass'); + module_load_include('inc', 'islandora_repository', 'SecurityClass'); $security_class = new SecurityClass(); if (!$security_class->canIngestHere($collection_pid)) { // Queries the collection object for a child security datastream and if found parses it @@ -507,7 +507,7 @@ class formClass { ), 'submit' => array( '#type' => 'submit', - '#submit' => array('fedora_repository_ingest_form_submit'), + '#submit' => array('islandora_repository_ingest_form_submit'), '#value' => t('Next') ), ); @@ -523,7 +523,7 @@ class formClass { * @return array */ function createQDCIngestFormPageTwo($collection_pid, $collection_label, array &$form_state) { - module_load_include('inc', 'fedora_repository', 'ContentModel'); + module_load_include('inc', 'islandora_repository', 'ContentModel'); $form = array(); $content_model_pid = ContentModel::getPidFromIdentifier($form_state['values']['models']); $content_model_dsid = ContentModel::getDSIDFromIdentifier($form_state['values']['models']); @@ -541,7 +541,7 @@ class formClass { ); $form['submit'] = array( '#type' => 'submit', - '#submit' => array('fedora_repository_ingest_form_submit'), + '#submit' => array('islandora_repository_ingest_form_submit'), '#value' => t('Ingest') ); } @@ -558,7 +558,7 @@ class formClass { * @return array */ function createQDCIngestForm($collection_pid, $collection_label, array &$form_state) { - module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); + module_load_include('inc', 'islandora_repository', 'CollectionPolicy'); $form_state['storage']['step'] = empty($form_state['storage']['step']) ? 1 : $form_state['storage']['step']; if ($form_state['storage']['step'] == 1) { return $this->createQDCIngestFormPageOne($collection_pid, $collection_label, $form_state); @@ -603,9 +603,9 @@ class formClass { //dump_vars($form_state); // Populate the list of datastream IDs. - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - module_load_include('inc', 'fedora_repository', 'ContentModel'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'ContentModel'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $obj_helper = new ObjectHelper(); $content_models = $obj_helper->get_content_models_list($pid); diff --git a/islandora_repository.solutionpacks.inc b/islandora_repository.solutionpacks.inc new file mode 100644 index 00000000..633d28fe --- /dev/null +++ b/islandora_repository.solutionpacks.inc @@ -0,0 +1,175 @@ +<?php + +/** + * @file + * Invokes a hook to any dependent modules asking them if their installations require + * any fedora objects to be present. Modules implementing this hook should return an array + * of arrays of the form: + * + * array( 'pid', 'path-to-foxml-file', 'dsid', 'path-to-datastream-file', int dsversion) + * + * where the last three options are optional. A module can either point to a simple + * foxml file to install, or can specify a datastreamstream to check for, with a + * path to load the datastream from if it isn't there. Optionally a version number + * can be included, to enable updating of content model or collection policy streams + * that may have been updated. THis is a simple whole number that should be incremented + * when changed. This value appears in as an attribute of the topmost element of the stream, + * e.g.,: + * + * <?xml version="1.0" encoding="utf-8"?> <content_model name="Collection" version="2" ... + * + * Datastreams which don't have this element are assumed to be at version 0. + */ +function islandora_repository_solution_packs_page() { + $enabled_solution_packs = module_invoke_all('required_fedora_objects'); + $output = ''; + foreach ($enabled_solution_packs as $solution_pack_module => $solution_pack_info) { + $objects = array(); + foreach ($solution_pack_info as $field => $value) { + switch ($field) { + case 'title': + $solution_pack_name = $value; + break; + case 'objects': + $objects = $value; + break; + } + } + $output .= drupal_get_form('islandora_repository_solution_pack_form_' . $solution_pack_module, $solution_pack_module, $solution_pack_name, $objects); + } + + return $output; +} + +/** + * Check for installed objects and add a 'Update' or 'Install' button if some objects are missing. + * @param array $solution_pack + */ +function islandora_repository_solution_pack_form(&$form_state, $solution_pack_module, $solution_pack_name, $objects = array()) { + // Check each object to see if it is in the repository. + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + global $base_path; + $needs_update = FALSE; + $needs_install = FALSE; + $form = array(); + $form['solution_pack_module'] = array( + '#type' => 'hidden', + '#value' => $solution_pack_module, + ); + + if (!$form_state['submitted']) { + $form['soluction_pack_name'] = array( + '#type' => 'markup', + '#value' => t($solution_pack_name), + '#prefix' => '<h3>', + '#suffix' => '</h3>', + ); + $form['objects'] = array( + '#type' => 'fieldset', + '#title' => "Objects", + '#weight' => 10, + '#attributes' => array('class' => 'collapsed'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + $table_header = array('PID', 'Status'); + $table_rows = array(); + + + foreach ($objects as $object) { + $datastreams = NULL; + if (isset($object['pid'])) { + $pid = $object['pid']; + + $item = new Fedora_Item($pid); + $table_row = array($object['pid']); + $object_status = t('Up-to-date'); + if (!$item->exists()) { + $object_status = 'Missing'; + $needs_install = TRUE; + } + else { + if (isset($object['dsid']) && isset($object['datastream_file']) && isset($object['dsversion'])) { + $datastreams = array( + array( + 'dsid' => $object['dsid'], + 'datastream_file' => $object['datastream_file'], + 'dsversion' => $object['dsversion'], + ), + ); + } + elseif (!empty($object['datastreams'])) { + $datastreams = $object['datastreams']; + } + if (!empty($datastreams) && is_array($datastreams)) { + foreach ($datastreams as $ds) { + $ds_list = $item->get_datastreams_list_as_array(); + if (!array_key_exists($ds['dsid'], $ds_list)) { + $needs_update = TRUE; + $object_status = 'Missing datastream'; + break; + } + if (isset($ds['dsversion'])) { + // Check if the datastream is versioned and needs updating. + $installed_version = islandora_repository_get_islandora_datastream_version($item, $ds['dsid']); + $available_version = islandora_repository_get_islandora_datastream_version(NULL, NULL, $ds['datastream_file']); + if ($available_version > $installed_version) { + $needs_update = TRUE; + $object_status = 'Out of date'; + break; + } + } + } + } + } + array_push($table_row, $object_status); + $table_rows[] = $table_row; + } + } + $form['objects']['table'] = array( + '#type' => 'markup', + '#value' => theme_table($table_header, $table_rows), + ); + } + + $form['install_status'] = array( + '#type' => 'markup', + '#prefix' => '<strong>' . t('Object status:') . ' </strong>', + '#suffix' => ' ', + ); + if (!$needs_install && !$needs_update) { + $form['install_status']['#value'] = theme_image('misc/watchdog-ok.png') . t('All required objects are installed and up-to-date.'); + } + else { + $form['install_status']['#value'] = theme_image('misc/watchdog-warning.png') . t('Some objects must be re-ingested. See Objects list for details.'); + } + $form['submit'] = array( + '#value' => t('Install'), + '#disabled' => !$needs_install && !$needs_update, + '#type' => 'submit', + '#name' => $solution_pack_module, + ); + + $form['#submit'] = array( + 'islandora_repository_solution_pack_form_submit', + ); + return $form; +} + +function islandora_repository_solution_pack_form_submit($form, &$form_state) { + $what = $form_state; + $module_name = $form_state['values']['solution_pack_module']; + $solution_pack_info = call_user_func($module_name . '_required_fedora_objects'); + $batch = array( + 'title' => t('Installing / updating solution pack objects'), + 'file' => drupal_get_path('module', 'islandora_repository') . '/islandora_repository.module', + 'operations' => array(), + ); + + + foreach ($solution_pack_info[$module_name]['objects'] as $object) { + // Add this object to the batch job queue. + $batch['operations'][] = array('islandora_repository_batch_reingest_object', array($object)); + } + batch_set($batch); +} From ab131a672fa427db1fbeb9476488e5bc60b7bf0e Mon Sep 17 00:00:00 2001 From: Ben Woodhead <bwoodhead@upei.ca> Date: Tue, 11 Oct 2011 10:21:27 -0300 Subject: [PATCH 2/6] switched to islandora repository --- api/fedora_collection.inc | 14 +- api/fedora_export.inc | 4 +- api/fedora_item.inc | 10 +- api/fedora_utils.inc | 12 +- islandora_repository.info | 9 + islandora_repository.install | 107 ++ islandora_repository.module | 2251 +++++++++++++++++++++++ islandoracm.xsd | 10 +- plugins/CollectionFormBuilder.inc | 4 +- plugins/DarwinCore.inc | 8 +- plugins/DemoFormBuilder.inc | 6 +- plugins/DocumentConverter.inc | 2 +- plugins/Exiftool.inc | 2 +- plugins/FedoraObjectDetailedContent.inc | 12 +- plugins/Flv.inc | 2 +- plugins/FlvFormBuilder.inc | 6 +- plugins/FormBuilder.inc | 8 +- plugins/ImageManipulation.inc | 2 +- plugins/ModsFormBuilder.inc | 16 +- plugins/PersonalCollectionClass.inc | 2 +- plugins/QtFormBuilder.php | 4 +- plugins/Refworks.inc | 12 +- plugins/ShowStreamsInFieldSets.inc | 18 +- plugins/herbarium.inc | 28 +- plugins/islandora_imageapi.info | 7 + plugins/islandora_imageapi.module | 116 ++ plugins/map_viewer.inc | 10 +- plugins/qt_viewer.inc | 6 +- plugins/slide_viewer.inc | 6 +- plugins/tagging_form.inc | 22 +- tests/README_TESTING.txt | 2 +- tests/fedora_repository.test | 20 +- 32 files changed, 2614 insertions(+), 124 deletions(-) create mode 100644 islandora_repository.info create mode 100644 islandora_repository.install create mode 100644 islandora_repository.module create mode 100644 plugins/islandora_imageapi.info create mode 100644 plugins/islandora_imageapi.module diff --git a/api/fedora_collection.inc b/api/fedora_collection.inc index b8afc5c4..2efd2acb 100644 --- a/api/fedora_collection.inc +++ b/api/fedora_collection.inc @@ -4,10 +4,10 @@ * @file * Operations that affect a Fedora repository at a collection level. */ -module_load_include('inc', 'fedora_repository', 'CollectionClass'); -module_load_include('inc', 'fedora_repository', 'api/fedora_item'); -module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); -module_load_include('module', 'fedora_repository'); +module_load_include('inc', 'islandora_repository', 'CollectionClass'); +module_load_include('inc', 'islandora_repository', 'api/fedora_item'); +module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); +module_load_include('module', 'islandora_repository'); /** * Exports a fedora collection object and all of its children in a format @@ -68,10 +68,10 @@ function export_collection($collection_pid, $relationship = 'isMemberOfCollectio * @param <type> $query_format R */ function get_related_items_as_xml($collection_pid, $relationship = array('isMemberOfCollection'), $limit = 10000, $offset = 0, $active_objects_only = TRUE, $cmodel = NULL, $orderby = '$title') { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); global $user; - if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + if (!islandora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied."), 'error'); return array(); } @@ -111,7 +111,7 @@ function get_related_items_as_xml($collection_pid, $relationship = array('isMemb $content = ''; - $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); + $url = variable_get('islandora_repository_url', 'http://localhost:8080/fedora/risearch'); $url .= "?type=tuples&flush=TRUE&format=Sparql&limit=$limit&offset=$offset&lang=itql&stream=on&query=" . $query_string; $content .= do_curl($url); diff --git a/api/fedora_export.inc b/api/fedora_export.inc index e1ed3cbd..bc4fd00f 100644 --- a/api/fedora_export.inc +++ b/api/fedora_export.inc @@ -41,7 +41,7 @@ function export_to_export_area($pid, $foxml_dir, $ob_dir, &$log = array()) { * @return string */ function export_objects_for_pid($pid, $dir, &$log) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $item = new Fedora_Item($pid); if (!$object = $item->get_datastreams_list_as_SimpleXML($pid)) { $log[] = log_line(t("Failed to get datastream %dsid for pid %pid", array('%dsid' => $ds->ID, '%pid' => $pid)), 'error'); @@ -85,7 +85,7 @@ function export_objects_for_pid($pid, $dir, &$log) { * @return type */ function export_foxml_for_pid($pid, $dir, $paths, &$log, $format = FOXML_11, $remove_islandora = FALSE) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); $ob_helper = new ObjectHelper(); if (!$object_xml = $ob_helper->getObject($pid, 'migrate', $format)) { $log[] = log_line(t("Failed to get foxml for %pid", array('%pid' => $pid)), 'error'); diff --git a/api/fedora_item.inc b/api/fedora_item.inc index 4dacca8c..fdf7074c 100644 --- a/api/fedora_item.inc +++ b/api/fedora_item.inc @@ -28,8 +28,8 @@ class Fedora_Item { */ function __construct($pid) { drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); - module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); $this->pid = $pid; if (isset(Fedora_Item::$instantiated_pids[$pid])) { @@ -75,7 +75,7 @@ class Fedora_Item { * @return type */ function add_datastream_from_file($datastream_file, $datastream_id, $datastream_label = NULL, $datastream_mimetype = '', $controlGroup = 'M', $logMessage = NULL) { - module_load_include('inc', 'fedora_repository', 'MimeClass'); + module_load_include('inc', 'islandora_repository', 'MimeClass'); if (!is_file($datastream_file)) { drupal_set_message("$datastream_file not found<br />", 'warning'); return; @@ -285,7 +285,7 @@ class Fedora_Item { * @return Array of pid => title pairs that match the results */ static function find_objects_by_pattern($pattern = '*', $field = 'pid', $max_results = 100, $resultFields = array()) { - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); $pattern = drupal_urlencode($pattern); $done = FALSE; @@ -848,7 +848,7 @@ class Fedora_Item { */ static function soap_call($function_name, $params_array, $quiet = FALSE) { if (!self::$connection_helper) { - module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); + module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); self::$connection_helper = new ConnectionHelper(); } switch ($function_name) { diff --git a/api/fedora_utils.inc b/api/fedora_utils.inc index c8ce7d0e..91a8f05f 100644 --- a/api/fedora_utils.inc +++ b/api/fedora_utils.inc @@ -158,7 +158,7 @@ function fedora_available() { */ function risearch_available() { - $response = do_curl_ext(variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch')); + $response = do_curl_ext(variable_get('islandora_repository_url', 'http://localhost:8080/fedora/risearch')); return ($response != NULL) ? ($response[1] == 0): FALSE; } @@ -238,13 +238,13 @@ function fix_dsid($dsid) { * @return array */ function get_collections_as_option_array() { - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); $query = 'select $object $title from <#ri> where ($object <dc:title> $title and $object <info:fedora/fedora-system:def/model#hasModel> <info:fedora/islandora:collectionCModel> and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>) order by $title'; - $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); + $url = variable_get('islandora_repository_url', 'http://localhost:8080/fedora/risearch'); $url .= "?type=tuples&flush=true&format=csv&limit=1000&lang=itql&stream=on&query="; $content = do_curl($url . htmlentities(urlencode($query))); $list = explode("\n", $content); @@ -269,8 +269,8 @@ function get_collections_as_option_array() { * @return array */ function get_content_models_as_option_array() { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); $restricted = variable_get('fedora_namespace_restriction_enforced', true); $allowed_string = variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora:'); $namespaces = explode(':', $allowed_string); @@ -286,7 +286,7 @@ function get_content_models_as_option_array() { and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>) order by $title'; - $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); + $url = variable_get('islandora_repository_url', 'http://localhost:8080/fedora/risearch'); $url .= "?type=tuples&flush=true&format=csv&limit=1000&lang=itql&stream=on&query="; $content = do_curl($url . htmlentities(urlencode($query))); $list = explode("\n", $content); diff --git a/islandora_repository.info b/islandora_repository.info new file mode 100644 index 00000000..6fcf223f --- /dev/null +++ b/islandora_repository.info @@ -0,0 +1,9 @@ +; $Id$ +name = Islandora Repository +dependencies[] = imageapi +dependencies[] = tabs +dependencies[] = islandora_content_model_forms +description = Shows a list of items in a fedora collection. +package = Islandora +version = 11.2.beta2 +core = 6.x diff --git a/islandora_repository.install b/islandora_repository.install new file mode 100644 index 00000000..e8e26ad2 --- /dev/null +++ b/islandora_repository.install @@ -0,0 +1,107 @@ +<?php + +/** + * @file islandora_repository.install + */ + +/** + * Implementation of hook_enable(). + */ +function fedora_collections_enable() { + //nothing to do as we do not currently touch the drupal database. + //other than the variables table +} + +/** + * Implementation of hook_requirements(). + * + * @return + * An array describing the status of the site regarding available updates. + * If there is no update data, only one record will be returned, indicating + * that the status of core can't be determined. If data is available, there + * will be two records: one for core, and another for all of contrib + * (assuming there are any contributed modules or themes enabled on the + * site). In addition to the fields expected by hook_requirements ('value', + * 'severity', and optionally 'description'), this array will contain a + * 'reason' attribute, which is an integer constant to indicate why the + * given status is being returned (UPDATE_NOT_SECURE, UPDATE_NOT_CURRENT, or + * UPDATE_UNKNOWN). This is used for generating the appropriate e-mail + * notification messages during update_cron(), and might be useful for other + * modules that invoke update_requirements() to find out if the site is up + * to date or not. + * + * @see _update_message_text() + * @see _update_cron_notify() + */ +function islandora_repository_requirements($phase) { + global $base_url; + + $requirements = array(); + + if ($phase == 'install') { + + // Test for SOAP + $requirements['fedora-soap']['title'] = t("PHP SOAP extension library"); + if (!class_exists('SoapClient')) { + $requirements['fedora-soap']['value'] = t("Not installed"); + $requirements['fedora-soap']['severity'] = REQUIREMENT_ERROR; + $requirements['fedora-soap']['description'] = t('Ensure that the PHP SOAP extension is installed.'); + } + else { + $requirements['fedora-soap']['value'] = t("Installed"); + $requirements['fedora-soap']['severity'] = REQUIREMENT_OK; + } + + // Test for Curl + $requirements['curl']['title'] = "PHP Curl extension library"; + if (!function_exists('curl_init')) { + $requirements['curl']['value'] = t("Not installed"); + $requirements['curl']['severity'] = REQUIREMENT_ERROR; + $requirements['curl']['description'] = t("Ensure that the PHP Curl extension is installed."); + } + else { + $requirements['curl']['value'] = t("Installed"); + $requirements['curl']['severity'] = REQUIREMENT_OK; + } + + // Test for DOM + $requirements['dom']['title'] = "PHP DOM XML extension library"; + if (!method_exists('DOMDocument', 'loadHTML')) { + $requirements['dom']['value'] = t("Not installed"); + $requirements['dom']['severity'] = REQUIREMENT_ERROR; + $requirements['dom']['description'] = t("Ensure that the PHP DOM XML extension is installed."); + } + else { + $requirements['dom']['value'] = t("Installed"); + $requirements['dom']['severity'] = REQUIREMENT_OK; + } + + // Test for XSLT + $requirements['xsl']['title'] = "PHP XSL extension library"; + if (!class_exists('XSLTProcessor')) { + $requirements['xslt']['value'] = t("Not installed"); + $requirements['xslt']['severity'] = REQUIREMENT_ERROR; + $requirements['xslt']['description'] = t("Ensure that the PHP XSL extension is installed."); + } + else { + $requirements['xslt']['value'] = t("Installed"); + $requirements['xslt']['severity'] = REQUIREMENT_OK; + } + } + elseif ($phase == 'runtime') { + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + + $requirements['fedora-repository']['title'] = t("Fedora server"); + if (!fedora_available()) { + $requirements['fedora-repository']['value'] = t("Not available"); + $requirements['fedora-repository']['severity'] = REQUIREMENT_ERROR; + $requirements['fedora-repository']['description'] = t('Ensure that Fedora is running and that the <a href="@collection-settings">collection settings</a> are correct.', array('@collection-settings' => $base_url . '/admin/settings/islandora_repository')); + } + else { + $requirements['fedora-repository']['value'] = t("Available"); + $requirements['fedora-repository']['severity'] = REQUIREMENT_OK; + } + } + + return $requirements; +} diff --git a/islandora_repository.module b/islandora_repository.module new file mode 100644 index 00000000..6fa13988 --- /dev/null +++ b/islandora_repository.module @@ -0,0 +1,2251 @@ +<?php + +/** + * Drupal hook for admin form + * islandora_repository_name is the name of the top level collection this module will query + * islandora_repository_pid is the name of the top level pid. + * Stores this info in the drupal variables table. + * the name and pid can also be passed as url parameters + */ +function islandora_repository_admin() { + module_load_include('inc', 'islandora_repository', 'formClass'); + $adminForm = new formClass(); + return $adminForm->createAdminForm(); +} + +/** + * drupal hook + * calls the islandora_repositorys_admin form + */ +function islandora_repository_menu() { + module_load_include('inc', 'islandora_repository', 'formClass'); + $adminMenu = new formClass(); + return $adminMenu->createMenu(); +} + +/** + * drupal hook to show help + * + * @param type $path + * @param type $arg + * @return type + */ +function islandora_repository_help($path, $arg) { + switch ($path) { + case 'admin/modules#description' : + return t('Grabs a list of items from a collection in Drupal that are presented on the home page.'); + case 'node/add#islandora_repository' : + return t('Use this page to grab a list of items from a Fedora collection.'); + } +} + +/** + * fedora repository purge object + * @param type $pid + * @param type $name + * @return type + */ +function islandora_repository_purge_object($pid = NULL, $name = NULL) { + if (!user_access('purge objects and datastreams')) { + drupal_set_message(t('You do not have access to add a datastream to this object.'), 'error'); + return ''; + } + if ($pid == NULL) { + drupal_set_message(t('You must specify an object pid to purge an object.'), 'error'); + return ''; + } + $output = t('Are you sure you wish to purge object %name %pid!<br /><b>This cannot be undone</b><br />', + array( + '%name' => $name, + '%pid' => $pid) + ); + + $output .= drupal_get_form('islandora_repository_purge_object_form', $pid); + return $output; +} + +/** + * fedora repository collection view + * @global type $user + * @param type $pid + * @param type $collection + * @param type $pageNumber + * @return type + */ +function islandora_repository_collection_view($pid = NULL, $collection = NULL, $pageNumber = NULL) { + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + global $user; + if (!islandora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied."), 'error'); + return ' '; + } + + $objectHelper = new ObjectHelper(); + if ($pid == NULL) { + $pid = variable_get('islandora_repository_pid', 'islandora:root'); + } + + $content = ''; + + module_load_include('inc', 'islandora_repository', 'CollectionClass'); + $collectionClass = new CollectionClass(); + $results = $collectionClass->getRelatedItems($pid, NULL); + $content .= $objectHelper->parseContent($results, $pid, $dsId, $collection, $pageNumber); + + return $content; +} + +/** + * fedora repository ingest object + * @param type $collection_pid + * @param type $collection_label + * @param type $content_model + * @return type + */ +function islandora_repository_ingest_object($collection_pid=NULL, $collection_label = NULL, $content_model = NULL) { + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + if (!user_access('ingest new fedora objects')) { + drupal_set_message(t('You do not have permission to ingest.'), 'error'); + return ''; + } + + if (!valid_pid($collection_pid)) { + if (valid_pid(urldecode($collection_pid))) { + $collection_pid = urldecode($collection_pid); + } + else { + drupal_set_message(t("This collection PID $collection_pid is not valid"), 'error'); + return ' '; + } + } + + if ($collection_pid == NULL) { + drupal_set_message(t('You must specify a collection object pid to ingest an object.'), 'error'); + return ''; + } + $output = drupal_get_form('islandora_repository_ingest_form', $collection_pid, $collection_label, $content_model); + + $breadcrumbs = array(); + $objectHelper = new ObjectHelper(); + $objectHelper->getBreadcrumbs($collection_pid, $breadcrumbs); + drupal_set_breadcrumb(array_reverse($breadcrumbs)); + + return $output; +} + +/** + * fedora repository ingest form submit + * @global type $base_url + * @global type $user + * @param array $form + * @param array $form_state + */ +function islandora_repository_ingest_form_submit(array $form, array &$form_state) { +//only validate the form if the submit button was pressed (other buttons may be used for AHAH + if ($form_state['storage']['xml']) { + if (module_exists('islandora_content_model_forms')) { + module_load_include('inc', 'islandora_content_model_forms', 'IngestObjectMetadataForm'); + $xml_form = new IngestObjectMetadataForm(); + $xml_form->submit($form, $form_state); + } + } + else if ($form_state['clicked_button']['#id'] == 'edit-submit') { + global $base_url; + module_load_include('inc', 'islandora_repository', 'CollectionClass'); + module_load_include('inc', 'islandora_repository', 'CollectionPolicy'); + module_load_include('inc', 'islandora_repository', 'ContentModel'); + + $contentModelPid = ContentModel::getPidFromIdentifier($form_state['values']['models']); + $contentModelDsid = ContentModel::getDSIDFromIdentifier($form_state['values']['models']); + $err = TRUE; + $redirect = TRUE; + if (($cp = CollectionPolicy::loadFromCollection($form_state['values']['collection_pid'])) !== FALSE) { + $relationship = $cp->getRelationship(); + + if (($cm = ContentModel::loadFromModel($contentModelPid, $contentModelDsid)) !== FALSE) { + $pid = $cp->getNextPid($contentModelDsid); + global $user; + $form_state['values']['user_id'] = $user->name; + $form_state['values']['pid'] = $pid; + $form_state['values']['content_model_pid'] = $contentModelPid; + $form_state['values']['relationship'] = $relationship; + + $err = (!$cm->execFormHandler($form_state['values'], $form_state)); + + $_SESSION['fedora_ingest_files'] = ''; //empty this variable + + $attr = $cm->getIngestFormAttributes(); + $redirect = $attr['redirect']; + + if ($redirect) { + $form_state['storage'] = NULL; + } + } + } + + if ($redirect) { + $form_state['redirect'] = ($err) ? ' ' : $base_url . "/fedora/repository/{$form_state['values']['collection_pid']}"; + } + } +} + +/** + * fedora repository ingest form validate + * @param type $form + * @param type $form_state + * @return type + */ +function islandora_repository_ingest_form_validate($form, &$form_state) { +//only validate the form if the submit button was pressed (other buttons may be used for AHAH + if ($form_state['clicked_button']['#id'] == 'edit-submit') { + switch ($form_state['storage']['step']) { + case 1: + $form_state['storage']['step']++; + $form_state['rebuild'] = TRUE; + break; + + case 2: +// XML based form. + if ($form_state['storage']['xml']) { + module_load_include('inc', 'xml_form_api', 'XMLForm'); + $xml_form = new XMLForm($form_state); + $xml_form->validate($form, $form_state); + } +// Get the uploaded file. + $validators = array(); + + if (!empty($_FILES['files']['name']['ingest-file-location'])) { + $fileObject = file_save_upload('ingest-file-location', $validators); + + file_move($fileObject->filepath, 0, 'FILE_EXISTS_RENAME'); + $form_state['values']['ingest-file-location'] = $fileObject->filepath; + } + + if (isset($form_state['values']['ingest-file-location']) && file_exists($form_state['values']['ingest-file-location'])) { + module_load_include('inc', 'islandora_repository', 'ContentModel'); + module_load_include('inc', 'islandora_repository', 'MimeClass'); + + $file = $form_state['values']['ingest-file-location']; + + $contentModelPid = ContentModel::getPidFromIdentifier($form_state['values']['models']); + $contentModelDsid = ContentModel::getDSIDFromIdentifier($form_state['values']['models']); + + if (($cm = ContentModel::loadFromModel($contentModelPid, $contentModelDsid)) !== FALSE) { + $allowedMimeTypes = $cm->getMimetypes(); + + $mimetype = new MimeClass(); + $dformat = $mimetype->getType($file); + + if (!empty($file)) { + if (!in_array($dformat, $allowedMimeTypes)) { + form_set_error('ingest-file-location', t('The uploaded file\'s mimetype (' . $dformat . ') is not associated with this Content Model. The allowed types are ' . + implode(' ', $allowedMimeTypes))); + file_delete($file); + return; + } + elseif (!$cm->execIngestRules($file, $dformat)) { + drupal_set_message(t('Error following Content Model Rules'), 'error'); + foreach (ContentModel::$errors as $err) { + drupal_set_message($err, 'error'); + } + } + } + } + } + $form_state['rebuild'] = FALSE; + break; + } + } +} + +/** + * fedora repository ingest form + * @param type $form_state + * @param type $collection_pid + * @param type $collection_label + * @param type $content_model + * @return type + */ +function islandora_repository_ingest_form(&$form_state, $collection_pid, $collection_label = NULL, $content_model = NULL) { + module_load_include('inc', 'islandora_repository', 'formClass'); +// For the sake of easily maintaining the module in different core versions create our own form_values variable. + if (empty($form_state['storage']['step'])) { + $form_state['storage']['step'] = 1; + } + $ingestForm = new formClass(); + $form_state['storage']['content_model'] = $content_model; + $form_state['storage']['collection_pid'] = $collection_pid; + return $ingestForm->createIngestForm($collection_pid, $collection_label, $form_state); +} + +/** + * fedora repository purge object form + * @global type $base_url + * @param type $form_state + * @param type $pid + * @param type $referrer + * @return type + */ +function islandora_repository_purge_object_form(&$form_state, $pid, $referrer = NULL) { + global $base_url; + if (!user_access('purge objects and datastreams')) { + return NULL; + } + if ($pid == NULL) { + return NULL; + } + $form['pid'] = array( + '#type' => 'hidden', + '#value' => "$pid" + ); + if (!strstr(drupal_get_destination(), urlencode('fedora/repository'))) { + $form['referrer'] = array( + '#type' => 'hidden', + '#value' => $referrer, + ); + } + if (!isset($form_state['storage']['confirm'])) { +// do your normal $form definition here + + + $form['submit'] = array( + '#type' => 'image_button', + '#src' => drupal_get_path('module', 'islandora_repository') . '/images/purge_big.png', + '#value' => t('Purge'), + '#suffix' => 'Purge this object', + ); + if (!empty($collectionPid)) { + $collectionPid = $_SESSION['fedora_collection']; + } +//$form['#redirect'] = $referrer; + + return $form; + } + else { +// ALSO do $form definition here. Your final submit handler (after user clicks Yes, I Confirm) will only see $form_state info defined here. Form you create here passed as param1 to confirm_form + + return confirm_form($form, 'Confirm Purge Object', $referrer, 'Are you sure you want to delete this object? This action cannot be undone.', 'Delete', 'Cancel'); //Had better luck leaving off last param 'name' + } + return $form; +} + +/** + * add stream + * @param type $collection_pid + * @param type $collectionName + * @return type + */ +function add_stream($collection_pid=NULL, $collectionName=NULL) { + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + if (!valid_pid($collection_pid)) { + drupal_set_message(t("This PID is not valid!"), 'error'); + return ' '; + } + if (!user_access('ingest new fedora objects')) { + drupal_set_message(t('You do not have permission to ingest.'), 'error'); + return ''; + } + if ($collection_pid == NULL) { + drupal_set_message(t('You must specify an collection object pid to ingest an object.'), 'error'); + return ''; + } + $output .= drupal_get_form('islandora_repository_add_stream_form', $pid); + + return $output; +} + +/** + * add stream form submit + * @global type $base_url + * @param type $form + * @param type $form_state + * @return type + */ +function add_stream_form_submit($form, &$form_state) { + global $base_url; + if (!empty($form_state['submit']) && $form_state['submit'] == 'OK') { + $form_state['rebuild'] = TRUE; + return; + } + module_load_include('inc', 'islandora_repository', 'MimeClass'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + $pathToModule = drupal_get_path('module', 'islandora_repository'); + + $file = $form_state['values']['add-stream-file-location']; + + $pid = $form_state['values']['pid']; + $dsid = $form_state['values']['stream_id']; + $dsLabel = $form_state['values']['stream_label'] . substr($file, strrpos($file, '.')); // Add the file extention to the end of the label.; + $file_basename = basename($file); + $file_directory = dirname($file); + $streamUrl = $base_url . '/' . $file_directory . '/' . drupal_urlencode($file_basename); + + /* ----------------------------------------------------------------- + * need a better way to get mimetypes + */ + $mimetype = new MimeClass(); + $dformat = $mimetype->getType($file); + $controlGroup = "M"; + if ($dformat == 'text/xml') { + $controlGroup = 'X'; + } + try { + $item = new Fedora_Item($pid); + $item->add_datastream_from_url($streamUrl, $dsid, $dsLabel, $dformat, $controlGroup); + + $object_helper = new ObjectHelper(); + $object_helper->get_and_do_datastream_rules($pid, $dsid, $file); + + file_delete($file); + } catch (exception $e) { + drupal_set_message(t($e->getMessage()), 'error'); + return; + } + $form_state['rebuild'] = TRUE; +} + +/** + * add stream form + * @param type $form_state + * @param type $pid + * @return type + */ +function add_stream_form(&$form_state, $pid) { + module_load_include('inc', 'islandora_repository', 'formClass'); + $addDataStreamForm = new formClass(); + return $addDataStreamForm->createAddDataStreamForm($pid, $form_state); +} + +/** + * add stream form validate + * @param type $form + * @param type $form_state + * @return type + */ +function add_stream_form_validate($form, &$form_state) { + if ($form_state['clicked_button']['#value'] == 'OK') { + $form_state['rebuild'] = TRUE; + return; + } + $dsid = $form_state['values']['stream_id']; + $dsLabel = $form_state['values']['stream_label']; + if (strlen($dsid) > 64) { + form_set_error('', t('Data stream ID cannot be more than 64 characters.')); + return FALSE; + } + if (!(preg_match("/^[a-zA-Z]/", $dsid))) { + form_set_error('', t("Data stream ID ($dsid) has to start with a letter.")); + return FALSE; + } + if (strlen($dsLabel) > 64) { + form_set_error('', t('Data stream Label cannot be more than 64 characters.')); + return FALSE; + } + if (strpos($dsLabel, '/')) { + form_set_error('', t('Data stream Label cannot contain a "/".')); + return FALSE; + } + $validators = array( + // 'file_validate_is_image' => array(), + // 'file_validate_image_resolution' => array('85x85'), + // 'file_validate_size' => array(30 * 1024), + ); + + $fileObject = file_save_upload('add-stream-file-location', $validators); + +// Move the uploaded file to Drupal's files directory. + file_move($fileObject->filepath, 0, 'FILE_EXISTS_RENAME'); + $form_state['values']['add-stream-file-location'] = $fileObject->filepath; +// TODO: Add error checking here. + $form_state['rebuild'] = FALSE; +} + +/** + * fedora repository purge stream + * @global type $user + * @param type $pid + * @param type $dsId + * @param type $name + * @return type + */ +function islandora_repository_purge_stream($pid = NULL, $dsId = NULL, $name = NULL) { + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + global $user; + if ($pid == NULL || $dsId == NULL) { + drupal_set_message(t('You must specify an object pid and DataStream ID to purge a datastream'), 'error'); + return ' '; + } + if (!islandora_repository_access(OBJECTHELPER :: $PURGE_FEDORA_OBJECTSANDSTREAMS, $pid, $user)) { + drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or you do not have permission to purge objects."), 'error'); + return ' '; + } + + $output = t('Are you sure you wish to purge this datastream %name<br />', + array( + '%name' => $name) + ); + $output .= drupal_get_form('islandora_repository_purge_stream_form', $pid, $dsId); + return $output; +} + +/** + * fedora repository purge object form submit + * @param type $form + * @param type $form_state + * @return type + */ +function islandora_repository_purge_object_form_submit($form, &$form_state) { + module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); + $pid = $form_state['values']['pid']; + if (!isset($form_state['storage']['confirm'])) { + $form_state['storage']['confirm'] = TRUE; // this will cause the form to be rebuilt, entering the confirm part of the form + $form_state['rebuild'] = TRUE; // along with this + } + else { +// this is where you do your processing after they have pressed the confirm button + $params = array( + "pid" => $pid, + "logMessage" => "Purged", + "force" => "" + ); + try { + $soapHelper = new ConnectionHelper(); + $client = $soapHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); + $object = $client->__soapCall('purgeObject', array($params)); + unset($form_state['storage']['confirm']); + } catch (exception $e) { + if (preg_match('/org\.fcrepo\.server\.security\.xacml\.pep\.AuthzDeniedException/', $e->getMessage())) { + drupal_set_message(t('Error: Insufficient permissions to purge object.'), 'error'); + } + else { + drupal_set_message(t($e->getMessage()), 'error'); + } + return; + } + if (!empty($form_state['values']['referrer'])) { + $form_state['redirect'] = $form_state['values']['referrer']; + } + elseif (empty($collectionPid) && !empty($_SESSION['fedora_collection']) && $_SESSION['fedora_collection'] != $pid) { + $collectionPid = $_SESSION['fedora_collection']; + + $form_state['redirect'] = "fedora/repository/$collectionPid/"; + } + else { + $form_state['redirect'] = 'fedora/repository/'; + } + } +} + +/** + * fedora repository purge stream form + * @param type $form_state + * @param type $pid + * @param type $dsId + * @return type + */ +function islandora_repository_purge_stream_form(&$form_state, $pid, $dsId) { + $form['pid'] = array( + '#type' => 'hidden', + '#value' => "$pid" + ); + $form['dsid'] = array( + '#type' => 'hidden', + '#value' => "$dsId" + ); + $form['submit'] = array( + '#type' => 'submit', + '#value' => t('Purge') + ); + + return $form; +} + +/** + * fedora repository purge stream form submit + * @global type $base_url + * @param type $form + * @param array $form_state + */ +function islandora_repository_purge_stream_form_submit($form, &$form_state) { + global $base_url; + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); +//$client = getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); + $pid = $form_state['values']['pid']; + $item = new Fedora_Item($pid); + $dsid = $form_state['values']['dsid']; + try { + $item->purge_datastream($dsid); + } catch (exception $e) { + drupal_set_message(t($e->getMessage()), 'error'); + } + $form_state['redirect'] = $base_url . "/fedora/repository/$pid"; +} + +/** + * fedora repository replace stream + * @param type $pid + * @param type $dsId + * @param type $dsLabel + * @param type $collectionName + * @return type + */ +function islandora_repository_replace_stream($pid, $dsId, $dsLabel, $collectionName = NULL) { + if ($pid == NULL || $dsId == NULL) { + drupal_set_message(t('You must specify an pid and dsId to replace.'), 'error'); + return ''; + } + $output = drupal_get_form('islandora_repository_replace_stream_form', $pid, $dsId, $dsLabel); + + return $output; +} + +/** + * fedora repository replace stream form + * @param type $form_state + * @param type $pid + * @param type $dsId + * @param type $dsLabel + * @return type + */ +function islandora_repository_replace_stream_form(&$form_state, $pid, $dsId, $dsLabel) { +//module_load_module_load_include('hp', ''Fedora_Repository'', 'config', 'islandora_repository', ''); + module_load_include('inc', 'Fedora_Repository', 'formClass'); +//$client = getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); + $replaceDataStreamForm = new formClass(); + return $replaceDataStreamForm->createReplaceDataStreamForm($pid, $dsId, $dsLabel, $form_state); +} + +/** + * fedora repository replace stream form validate + * @param type $form + * @param type $form_state + * @return type + */ +function islandora_repository_replace_stream_form_validate($form, &$form_state) { +// If a file was uploaded, process it. + if (isset($_FILES['files']) && is_uploaded_file($_FILES['files']['tmp_name']['file'])) { + +// attempt to save the uploaded file + $file = file_save_upload('file', array(), file_directory_path()); + +// set error is file was not uploaded + if (!$file) { + form_set_error('file', 'Error uploading file.'); + return; + } + + $doc = new DOMDocument(); + module_load_include('inc', 'Fedora_Repository', 'MimeClass'); + $mime = new MimeClass(); + if ($mime->getType($file->filepath) == 'text/xml' && !$doc->load($file->filepath)) { + form_set_error('file', 'Invalid XML format.'); + return; + } + +// set files to form_state, to process when form is submitted + $form_state['values']['file'] = $file; + } +} + +/** + * fedora repository replace stream form submit + * @global type $base_url + * @param type $form + * @param array $form_state + */ +function islandora_repository_replace_stream_form_submit($form, &$form_state) { + global $base_url; + $file = $form_state['values']['file']; + $pid = $form_state['values']['pid']; + $dsid = $form_state['values']['dsId']; + $dsLabel = $form_state['values']['dsLabel']; + // Remove the original file extension from the label and add the new one + $indexOfDot = strrpos($dsLabel, '.'); //use strrpos to get the last dot + if ($indexOfDot !== FALSE) { + $dsLabel = substr($dsLabel, 0, $indexOfDot); + $dsLabel .= substr($file->filename, strrpos($file->filename, '.')); // Add the file extention to the end of the label.; + } + module_load_include('inc', 'Fedora_Repository', 'MimeClass'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + + $file_basename = basename($file->filepath); + $file_directory = dirname($file->filepath); + $streamUrl = $base_url . '/' . $file_directory . '/' . urlencode($file_basename); + + /* ----------------------------------------------------------------- + * TODO: need a better way to get mimetypes + */ + $mimetype = new MimeClass(); + $dformat = $mimetype->getType($file->filepath); + + $item = new Fedora_Item($pid); + + $item->modify_datastream_by_reference($streamUrl, $dsid, $dsLabel, $dformat); + + $form_state['redirect'] = 'fedora/repository/' . $pid; +} + +/** + * fedora repository edit qdc page + * @global type $user + * @param type $pid + * @param type $dsId + * @return type + */ +function islandora_repository_edit_qdc_page($pid = NULL, $dsId = NULL) { + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + global $user; + if ($pid == NULL || $dsId == NULL) { + drupal_set_message(t('You must specify an object pid and a Dublin Core DataStream ID to edit metadata'), 'error'); + return ' '; + } + if (!islandora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $pid, $user)) { + drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or you do not have permission to edit meta data for this object."), 'error'); + return ' '; + } + $output = drupal_get_form('islandora_repository_edit_qdc_form', $pid, $dsId); + + return $output; +} + +/** + * fedora repository edit qdc form + * @global type $user + * @param type $form_state + * @param type $pid + * @param type $dsId + * @return type + */ +function islandora_repository_edit_qdc_form(&$form_state, $pid, $dsId = NULL) { + module_load_include('inc', 'islandora_repository', 'ContentModel'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + if ($pid == NULL) { + drupal_set_message(t('You must specify an object pid!'), 'error'); + } + global $user; + if (!islandora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $pid, $user)) { + drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or you do not have permission to edit meta data for this object."), 'error'); + return ' '; + } + + module_load_include('inc', 'islandora_repository', 'formClass'); + module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); + $soapHelper = new ConnectionHelper(); + $client = $soapHelper->getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); +// Check if there is a custom edit metadata function defined in the content model. + + $breadcrumbs = array(); + $objectHelper = new ObjectHelper(); + $objectHelper->getBreadcrumbs($pid, $breadcrumbs); + drupal_set_breadcrumb(array_reverse($breadcrumbs)); + + + $output = ''; + if (($cm = ContentModel::loadFromObject($pid)) !== FALSE) { + $output = $cm->buildEditMetadataForm($pid, $dsId); + } + + if (empty($output)) { +// There is no custom function, so just load the standard QDC form. + $metaDataForm = new formClass(); +//currently we only edit the dc metadata. If you defined a custom form with a custom handler you are sol for now. + return $metaDataForm->createMetaDataForm($pid, $dsId, $client, $form_state); + } + return $output; +} + +/** + * fedora repository edit qdc form validate + * @param type $form + * @param boolean $form_state + */ +function islandora_repository_edit_qdc_form_validate($form, &$form_state) { + if ($form_state['storage']['xml']) { + if ($form_state['storage']['step'] == 1) { + $form_state['storage']['step']++; + $form_state['rebuild'] = TRUE; + } + module_load_include('inc', 'xml_form_api', 'XMLForm'); + $xml_form = new XMLForm($form_state); + $xml_form->validate($form, $form_state); + } +} + +/** + * Check if there is a custom edit metadata function defined in the content model. If so, + * call it, if not do the submit action for the standard QDC metadata. Custom forms will + * need to implement their own equivalent to the FormClass->updateMetaData function + * + * @param array $form + * @param array $form_state + * @return + */ +function islandora_repository_edit_qdc_form_submit($form, &$form_state) { + if ($form_state['storage']['xml']) { + module_load_include('inc', 'islandora_content_model_forms', 'EditObjectMetadataForm'); + $xml_form = new EditObjectMetadataForm($form_state); + $xml_form->submit($form, $form_state); + } + else { + module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); + global $base_url; + if (strstr($form_state['clicked_button']['#id'], 'edit-submit')) { + +//$client = getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); + $soap_helper = new ConnectionHelper(); + $client = $soap_helper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); + +// Check the content model for a custom edit metadata form submit function. + if (isset($form_state['values']['pid'])) { + module_load_include('inc', 'islandora_repository', 'ContentModel'); + if (($cm = ContentModel::loadFromObject($form_state['values']['pid'])) !== FALSE) { + return $cm->handleEditMetadataForm($form_state['values']['form_id'], $form_state, $client); + } + } + + module_load_include('inc', 'islandora_repository', 'formClass'); + $metaDataForm = new formClass(); + $return_value = $metaDataForm->updateMetaData($form_state['values']['form_id'], $form_state['values'], $client); + $form_state['storage'] = NULL; + $form_state['redirect'] = $base_url . '/fedora/repository/' . $form_state['values']['pid']; + + return $return_value; + } + } +} + +/** + * drupal hook + * creates a new permission than can be assigned to roles + */ +function islandora_repository_perm() { + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + return array( + OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, + OBJECTHELPER::$EDIT_FEDORA_METADATA, + OBJECTHELPER::$PURGE_FEDORA_OBJECTSANDSTREAMS, + OBJECTHELPER::$ADD_FEDORA_STREAMS, + OBJECTHELPER::$INGEST_FEDORA_OBJECTS, + OBJECTHELPER::$EDIT_TAGS_DATASTREAM, + OBJECTHELPER::$VIEW_DETAILED_CONTENT_LIST, + OBJECTHELPER::$MANAGE_COLLECTIONS, + OBJECTHELPER::$DELETE_ENTIRE_COLLECTIONS, + OBJECTHELPER::$CREATE_BATCH_PROCESS, + ); +} + +/** + * drupal hook + * determines if a user has access to what they are asking for + * + * @param type $op + * @param type $node + * @param type $account + * @return type + */ +function islandora_repository_access($op, $node, $account) { + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + $objectHelper = new ObjectHelper(); + return $objectHelper->islandora_repository_access($op, $node, $account); +} + +/** + * Grabs a stream from fedora sets the mimetype and returns it. $dsID is the + * datastream id. + * @param $pid String + * @param $dsID String + */ +function makeObject($pid, $dsID) { + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + if (!valid_pid($pid)) { + drupal_set_message(t("Invalid PID!"), 'error'); + return ' '; + } + + if (!valid_dsid($dsID)) { + drupal_set_message(t("Invalid dsID!"), 'error'); + return ' '; + } + + if ($pid == NULL || $dsID == NULL) { + drupal_set_message(t("No pid or dsid given to create an object with.")); + return ' '; + } + global $user; + if (!islandora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + drupal_access_denied(); + return; + drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace."), 'error'); + return ' '; + } + + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + $objectHelper = new ObjectHelper(); + $objectHelper->makeObject($pid, $dsID); +} + +/** + * Sends an ITQL query to the Fedora Resource index (can only communicate with Kowari or mulgara) + * Reads the pid and datastream id as url parameters. Queries the collection object for the query + * if there is no query datastream falls back to the query shipped with the module. + * + * @global type $user + * @param type $pid + * @param type $dsId + * @param type $collection + * @param type $page_number + * @param type $limit + * @return type + */ +function islandora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NULL, $page_number = NULL, $limit = NULL) { + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + global $user; + + if (!fedora_available()) { + drupal_set_message(t('The Fedora repository server is currently unavailable. Please contact the site administrator.'), 'warning', FALSE); + return ''; + } + + if (!risearch_available()) { + drupal_set_message(t('The Fedora resource index search is currently unavailable. Please contact the site administrator.'), 'warning', FALSE); + return ''; + } + + if ($pid == NULL) { + $pid = variable_get('islandora_repository_pid', 'islandora:root'); + } + + $item = new fedora_item($pid); + if (!$item->exists()) { + drupal_not_found(); + exit(); + } + + if ($pid & !valid_pid($pid)) { + drupal_set_message(t("Invalid PID!"), 'error'); + return ' '; + } + + if ($dsId & !valid_dsid($dsId)) { + drupal_set_message(t("Invalid dsID!"), 'error'); + return ' '; + } + if (!islandora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + if (user_access('access administration pages')) { + drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed !here", array('!here' => l('here', 'admin/settings/islandora_repository'))), 'warning'); + } + drupal_access_denied(); + exit; + return ' '; + } + + $objectHelper = new ObjectHelper(); + if ($pid == NULL) { + $pid = variable_get('islandora_repository_pid', 'islandora:root'); + } + $headers = module_invoke_all('file_download', "/fedora/repository/$pid"); + if (in_array(-1, $headers)) { + drupal_access_denied(); + exit; + return ' '; + } + if ($dsId != NULL && $dsId != '-') { //if we have a dsID return the stream otherwise query for a collection of objects +//probably should check pid as well here. + return makeObject($pid, $dsId); + } + + $content = '<div id="content-fedora">'; + + module_load_include('inc', 'islandora_repository', 'CollectionClass'); + $collectionClass = new CollectionClass(); + module_load_include('inc', 'islandora_repository', 'ContentModel'); + module_load_include('inc', 'islandora_repository', 'plugins/FedoraObjectDetailedContent'); + $breadcrumbs = array(); + $objectHelper->getBreadcrumbs($pid, $breadcrumbs); + drupal_set_breadcrumb(array_reverse($breadcrumbs)); + + $offset = $limit * $page_number; + $content_models = $objectHelper->get_content_models_list($pid); +// Each content model may return either a tabset array or plain HTML. If it's HTML, stick it in a tab. + $cmodels_tabs = array( + '#type' => 'tabset', + ); + foreach ($content_models as $content_model) { + $content_model_fieldset = $content_model->displayExtraFieldset($pid, $page_number); + if (is_array($content_model_fieldset)) { + $cmodels_tabs = array_merge($cmodels_tabs, $content_model_fieldset); + } + else { + $cmodels_tabs[$content_model->pid] = array( + '#type' => 'tabpage', + '#title' => $content_model->name, + '#content' => $content_model_fieldset, + ); + } + } +// Add a 'manage object' tab for all objects, where detailed list of content is shown. + $obj = new FedoraObjectDetailedContent($pid); + $object_details = $obj->showFieldSets(); + if ($object_details['fedora_object_details']['#selected'] == true){ + foreach($cmodels_tabs as $cmodel_tab){ + if (is_array($cmodel_tab)){ + $cmodel_tab['#selected'] = FALSE; + } + + } + } + $cmodels_tabs = array_merge($cmodels_tabs, $object_details); + + + return tabs_render($cmodels_tabs); +} + +/** + * fedora repository urlencode string + * @param type $str + * @return type + */ +function islandora_repository_urlencode_string($str) { + return htmlentities($str); +} + +/** + * Uses makeobject to get a stream. Sets the Content Disposition in the header so it suggests a filename + * and sends it as an attachment. This should prompt for a download of the object. + * + * @global type $user + * @param type $pid + * @param type $dsId + * @param type $label + * @param type $version + * @return type + */ +function fedora_object_as_attachment($pid, $dsId, $label=NULL, $version=NULL) { + global $user; + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + + if ($pid == NULL || $dsId == NULL) { + drupal_set_message(t("no pid or dsid given to create an object with!")); + return ' '; + } + + $objectHelper = new ObjectHelper(); + $objectHelper->makeObject($pid, $dsId, 1, $label, FALSE, $version); +} + +/** + * repository page + * @param type $pid + * @param type $dsId + * @param type $collection + * @param type $pageNumber + * @return type + */ +function repository_page($pid = NULL, $dsId = NULL, $collection = NULL, $pageNumber = NULL) { +//do security check at islandora_repository_get_items function as it has to be called there in case +//someone trys to come in a back door. + return islandora_repository_get_items($pid, $dsId, $collection, $pageNumber); +} + +/** + * repository service + * @global type $user + * @param type $pid + * @param type $servicePid + * @param type $serviceMethod + * @return type + */ +function repository_service($pid = NULL, $servicePid = NULL, $serviceMethod = NULL) { + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + global $user; + + if (!islandora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { +//drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied"), 'error'); + drupal_access_denied(); + if (user_access('access administration pages')) { + drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed !here", array('!here' => l('here', 'admin/settings/islandora_repository'))), 'error'); + } + return ' '; + } + if ($pid == NULL) { + $pid = variable_get('islandora_repository_pid', 'islandora:root'); + } + $headers = module_invoke_all('file_download', "/fedora/repository/$pid"); + if (in_array(-1, $headers)) { + drupal_access_denied(); + exit; + return ' '; + } + + + $item = new Fedora_Item($pid); + if ($item !== FALSE) { + echo $item->get_dissemination($servicePid, $serviceMethod); + } + + exit(); +} + +//Search Stuff ******************************************************************** + +/** + * Implementation of hook_search(). + * sends a search query to fedora fgsearch which is backed by Lucene + * In our implementation of Fedora we have api-a and api-m locked down + * to authorized users but at the object level. We can query Lucene and the + * RI index to get a list of results without authorization but to view any + * datastreams users must be authorized. + * + * @param type $op + * @param type $keys + * @return array + */ +function islandora_repository_search($op = 'search', $keys = NULL) { + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + + switch ($op) { + case 'name': + if (user_access('view fedora collection')) { + return t('Digital Repository', array('-9')); + } + case 'search': + if (user_access('view fedora collection')) { +//demo search string ?operation=gfindObjects&indexName=DemoOnLucene&query=fgs.DS.first.text%3Achristmas&hitPageStart=11&hitPageSize=10 + $resultData = NULL; + $numberOfHitsPerPage = NULL; + $index = strpos($keys, '.'); + $test = substr($keys, 0, $index + 1); + $type = NULL; + if ($index > 0) { + $index = strpos($keys, ':'); + $type = substr($keys, 0, $index); + $keys = substr($keys, $index + 1); + } + + $index = strpos($keys, ':'); + $startPage = substr($keys, 0, $index); + if ($index > 1) { + $keys = substr($keys, $index + 1); + } + + if (!$startPage) { + $startPage = 1; + } + + $xmlDoc = NULL; + + $path = drupal_get_path('module', 'islandora_repository'); + $xmlDoc = new DomDocument(); + $xmlDoc->load($path . '/searchTerms.xml'); + $nodeList = $xmlDoc->getElementsByTagName('default'); + if (!$type) { +//$type = 'dc.description'; + $type = $nodeList->item(0)->nodeValue; + } + $nodeList = $xmlDoc->getElementsByTagName('number_of_results'); + $numberOfHitsPerPage = $nodeList->item(0)->nodeValue; + + $indexName = variable_get('fedora_index_name', 'DemoOnLucene'); + $keys = htmlentities(urlencode($keys)); + $searchQuery = NULL; + if (isset($type) && strcmp($type, ':')) { + $searchQuery = $type . ':' . $keys; + } + else { + $searchQuery = $keys; + } +//$searchQuery.=" AND (PID:vre OR PID:vre:ref OR PID:demo OR PID:changeme)"; + + $searchUrl = variable_get('fedora_fgsearch_url', 'http://localhost:8080/fedoragsearch/rest'); + $searchString = '?operation=gfindObjects&indexName=' . $indexName . '&restXslt=copyXml&query=' . $searchQuery; + $searchString .= '&hitPageSize=' . $numberOfHitsPerPage . '&hitPageStart=' . $startPage; +//$searchString = htmlentities(urlencode($searchString)); + $searchUrl .= $searchString; + $objectHelper = new ObjectHelper(); + $resultData = do_curl($searchUrl); + + $results[] = array( + array( + 'data' => $resultData, + 'colspan' => 2 + ) + ); + return $results; + } + } // switch ($op) +} + +/** + * Implementation of hook_search_page(). + * Display the search results + * + * @param type $resultData + * @return array + */ +function islandora_repository_search_page($resultData) { + $path = drupal_get_path('module', 'islandora_repository'); + $isRestricted = variable_get('fedora_namespace_restriction_enforced', TRUE); + $proc = NULL; + if (!$resultData[0][0]['data']) { + return ''; //no results + } + $text = utf8_encode($resultData[0][0]['data']); + + try { + $proc = new XsltProcessor(); + } catch (Exception $e) { + $out[] = array( + array( + 'data' => $e->getMessage(), + 'colspan' => 2 + ) + ); + return $out; + } + +//inject into xsl stylesheet + $proc->setParameter('', 'searchToken', drupal_get_token('search_form')); //token generated by Drupal, keeps tack of what tab etc we are on + $proc->setParameter('', 'searchUrl', url('search') . '/islandora_repository'); //needed in our xsl + $proc->setParameter('', 'objectsPage', base_path()); + $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); + $proc->registerPHPFunctions(); + $xsl = new DomDocument(); + if ($isRestricted) { + $xsl->load($path . '/xsl/results.xsl'); + } + else { + $xsl->load($path . '/xsl/unfilteredresults.xsl'); + } + + $input = new DomDocument(); + $didLoadOk = $input->loadXML(utf8_encode($resultData[0][0]['data'])); + + if (!$didLoadOk) { + $results[] = array( + array( + 'data' => 'Error parsing results', + 'colspan' => 2 + ) + ); + } + else { + $xsl = $proc->importStylesheet($xsl); + $newdom = $proc->transformToDoc($input); + + $results[] = array( + array( + 'data' => $newdom->saveHTML(), + 'colspan' => 2 + ) + ); + } + + $header = array( + array( + 'data' => t('Collection results'), + NULL, + ), + (NULL) + ); + + $output .= theme('table', $header, $results); + return $output; +} + +/** + * Implementation of hook_form_alter(). + * allows the advanced search form in drupal + * + * @param type $form + * @param type $form_state + * @param type $form_id + */ +function islandora_repository_form_alter(&$form, &$form_state, $form_id) { +// Advanced node search form + module_load_include('inc', 'islandora_repository', 'SearchClass'); + $path = drupal_get_path('module', 'islandora_repository'); + if ($form_id == 'search_form' && arg(1) == 'islandora_repository' && user_access('use advanced search')) { + $default_value = $form['basic']['inline']['keys']['#default_value']; + $index = strpos($default_value, '.'); + $test = substr($default_value, 0, $index + 1); + $type = NULL; + if ($index > 0) { + $index = strpos($default_value, ':'); + $type = substr($default_value, 0, $index); + $default_value = substr($default_value, $index + 1); + } + $form['basic']['inline']['keys']['#default_value'] = $default_value; +// Keyword boxes: + $form['advanced'] = array( + '#type' => 'fieldset', + '#title' => t('Advanced search'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + '#attributes' => array( + 'class' => 'search-advanced' + ), + ); + $form['advanced']['keywords'] = array( + '#prefix' => '<div class="criterion">', + '#suffix' => '</div>', + ); + $xmlDoc = new DomDocument(); + $xmlDoc->load($path . '/searchTerms.xml'); + $nodeList = $xmlDoc->getElementsByTagName('term'); + $searchClass = new SearchClass(); + $types = $searchClass->get_search_terms_array(); + + $form['advanced']['type'] = array( + '#type' => 'select', + '#title' => t('Choose a field to search'), + '#prefix' => '<div class="criterion">', '#suffix' => '</div>', '#options' => $types, + '#default_value' => $type, + ); + $form['advanced']['submit'] = array( + '#type' => 'submit', + '#value' => t('Advanced search'), + '#prefix' => '<div class="action clear-block">', '#suffix' => '</div>', + ); + $form['#validate'][] = 'islandora_repository_search_validate'; + } +} + +/** + * Implementation of hook_search_validate() + * + * @param type $form + * @param type $form_state + */ +function islandora_repository_search_validate($form, &$form_state) { +// Initialise using any existing basic search keywords. + $keys = $form_state['values']['processed_keys']; + + if (isset($form_state['values']['type'])) { + $type = $form_state['values']['type']; + if ($type) { + $keys = $type . ':' . $keys; + } + } + + if (!empty($keys)) { + form_set_value($form['basic']['inline']['processed_keys'], trim($keys), $form_state); //set the form string + } +} + +/** + * fedora repository theme + * @return type + */ +function islandora_repository_theme() { + return array( + 'islandora_repository_mnpl_advanced_search_form' => array( + 'arguments' => array( + 'form' => NULL, + ), + ), + 'islandora_repository_time' => array( + 'arguments' => array( + 'element' => NULL + ), + 'islandora_repository_solution_packs_list' => array( + 'arguments' => array( + 'solution_packs' => NULL, + ), + ), + ), + ); +} + +/** + * Get a list of terms from a lucene index + * + * @param type $field + * @param type $startTerm + * @param type $displayName + * @return type + */ +function islandora_repository_list_terms($field, $startTerm = NULL, $displayName = NULL) { + module_load_include('inc', 'islandora_repository', 'SearchClass'); + $searchClass = new SearchClass(); + return $searchClass->getTerms($field, $startTerm, $displayName); +} + +/** + * fedora repository mnpl advanced search form + * @return type + */ +function islandora_repository_mnpl_advanced_search_form() { + module_load_include('inc', 'islandora_repository', 'SearchClass'); + $searchClass = new SearchClass(); + return $searchClass->build_advanced_search_form(); +} + +/** + * theme fedora repository mnpl advanced search form + * @param type $form + * @return type + */ +function theme_islandora_repository_mnpl_advanced_search_form($form) { + module_load_include('inc', 'islandora_repository', 'SearchClass'); + $advanced_search_form = new SearchClass(); + return $advanced_search_form->theme_advanced_search_form($form); +} + +/** + * fedora repository mnpl advanced search + * @param type $query + * @param type $startPage + * @return type + */ +function islandora_repository_mnpl_advanced_search($query, $startPage = 1) { + module_load_include('inc', 'islandora_repository', 'SearchClass'); + $searchClass = new SearchClass(); + $retVal = $searchClass->custom_search($query, $startPage); + return $searchClass->custom_search($query, $startPage); +} + +/** + * fedora repository mnpl_advanced search form submit + * @param type $form + * @param type $form_state + */ +function islandora_repository_mnpl_advanced_search_form_submit($form, &$form_state) { + $type_id = $form_state['values']['type']; + $repeat = variable_get('islandora_repository_advanced_block_repeat', t('3')); + $searchString = $form_state['values']['type1'] . ':' . $form_state['values']['fedora_terms1']; + if ($form_state['values']['fedora_terms2'] != '') { + $searchString .=' +' . $form_state['values']['andor1'] . '+' . $form_state['values']['type2'] . ':' . $form_state['values']['fedora_terms2']; + } + if ($repeat > 2 && $repeat < 9) { + for ($i = 3; $i < $repeat + 1; $i++) { + $t = $i - 1; + if ($form_state['values']["fedora_terms$i"] != '') { + $searchString .= '+' . $form_state['values']["andor$t"] . '+' . $form_state['values']["type$i"] . ':' . $form_state['values']["fedora_terms$i"]; + } + } + } + drupal_goto("fedora/repository/mnpl_advanced_search/$searchString"); +} + +/** + * fedora repository install demo page + * @return type + */ +function islandora_repository_install_demos_page() { + $output = drupal_get_form('islandora_repository_demo_objects_form'); + return $output; +} + +/** + * fedora repository demo objects form + * @return string + */ +function islandora_repository_demo_objects_form() { + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + $form = array(); + $existing_demos = array(); + + $form['install_demos'] = array( + '#title' => t('Islandora Demo Collections'), + '#type' => 'fieldset', + '#description' => t('Install demo image and document collections and content models.'), + ); + $demo_objects = array(); +// Check if the top-level islandora collection exists. If not, display a button to ingest. + + $form['install_demos']['demo_collections'] = array( + '#type' => 'checkboxes', + '#title' => t('Collections to ingest'), + '#options' => array(), + '#description' => t('Choose which demo collections you would like ingested into the repository.'), + ); + + foreach (array( + 'islandora:collectionCModel' => 'Islandora default content models', + 'islandora:root' => 'Islandora top-level collection', + 'islandora:demos' => 'Islandora demos collection', + 'islandora:largeimages' => 'Sample large image content model (requires <a href="http://sourceforge.net/projects/djatoka/">Djatoka</a> and <a href="http://www.kakadusoftware.com/index.php?option=com_content&task=view&id=26&Itemid=22">Kakadu</a>.)', + ) + as $available_demo => $available_demo_desc) { + try { + $demo_objects[$available_demo] = new Fedora_Item($available_demo); + } catch (exception $e) { + + } + + if (empty($demo_objects[$available_demo]->objectProfile)) { +//The demo objects collection does not exist in the repository, display a button to ingest them. + $form['install_demos']['demo_collections']['#options'][$available_demo] = $available_demo_desc; + } + else { + array_push($existing_demos, $demo_objects[$available_demo]); + } + } + +// Check if the SmileyStuff collectoin exists, and if it has a COLLECTION_VIEW datastream. If it doesn't then we can add it. + + $smiley_stuff = new Fedora_Item('demo:SmileyStuff'); + if (!empty($smiley_stuff->objectProfile)) { + $datastreams_list = $smiley_stuff->get_datastreams_list_as_array(); + if (empty($datastreams_list['COLLECTION_VIEW'])) { + $form['install_demos']['demo_collections']['#options']['demo:SmileyStuff'] = 'Add Islandora Collection View to Fedora Smiley Stuff Collection'; + } + else { + $demo_objects['demo:SmileyStuff'] = $smiley_stuff; + } + } + else { + $form['install_demos']['smileynote'] = array( + '#value' => '<p>If you install the ' . l('fedora demo objects', 'https://wiki.duraspace.org/display/FCR30/Demonstration+Objects') . ' Islandora can display them as a collection.</p>' + ); + } + + $form['install_demos']['ingest'] = array( + '#type' => 'submit', + '#name' => 'install_demos', + '#value' => 'Install Selected Demos', + '#disabled' => (empty($form['install_demos']['demo_collections']['#options'])) ? TRUE : FALSE, + ); + + $form['existing_demos'] = array( + '#prefix' => '<p>Demo collections already installed in this repository:</p><ul>', + '#suffix' => '</ul>', + ); + + if (!empty($existing_demos)) { + foreach ($existing_demos as $pid => $demo_object) { + + $form['existing_demos'][$demo_object->pid] = array( + '#prefix' => '<li>', + '#value' => l($demo_object->pid, $demo_object->url()), + '#suffix' => '</li>', + ); + } + } + + return $form; +} + +/** + * fedora repository demo objects form submit + * @global type $base_url + * @param type $form + * @param type $form_state + */ +function islandora_repository_demo_objects_form_submit($form, &$form_state) { + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/dublin_core'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + global $base_url; + if ($form_state['clicked_button']['#name'] == 'install_demos') { + if (!empty($form_state['values']['demo_collections']['islandora:collectionCModel'])) { + try { + $collectioncm = Fedora_Item::ingest_new_item('islandora:collectionCModel', 'A', 'Islandora Collection Content Model'); + $collectioncm->add_relationship('hasModel', 'fedora-system:ContentModel-3.0', FEDORA_MODEL_URI); + $collectioncm->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/content_models/COLLECTIONCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); + } catch (exception $e) { + + } + try { + $strictpdfcm = Fedora_Item::ingest_new_item('islandora:strict_pdf', 'A', 'Strict PDF Content Model'); + $strictpdfcm->add_relationship('hasModel', 'fedora-system:ContentModel-3.0', FEDORA_MODEL_URI); + $strictpdfcm->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/content_models/STRICT_PDFCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); + } catch (exception $e) { + + } + +// Install a collection object that points to all content model objects + try { + $cmodel_collection_xml = Fedora_Item::create_object_FOXML('islandora:ContentModelCollection'); + $cmodel_collection = Fedora_Item::ingest_from_FOXML($cmodel_collection_xml); + +//$dc = new Dublin_Core(new Fedora_Item('islandora:ContentModelCollection')); + $dc = new Dublin_Core($cmodel_collection); + $dc->set_element('dc:title', array('Installed Content Model')); + $dc->save(); + $cmodel_collection->add_datastream_from_string('select $object $title from <#ri> + where ($object <dc:title> $title + and ($object <fedora-model:hasModel> <info:fedora/fedora-system:ContentModel-3.0> + or $object <fedora-rels-ext:isMemberOfCollection> <info:fedora/islandora:ContentModelsCollection>) + and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>) + order by $title', 'QUERY', 'Content Model Collection Query', 'text/plain'); + $cmodel_collection->add_relationship('isMemberOfCollection', 'islandora:root'); + $cmodel_collection->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); + $cmodel_collection->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/collection_views/simple_list_view.xml', 'COLLECTION_VIEW', 'Collection View', 'text/xml', 'X'); + $cmodel_collection->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/images/contentModel.jpg', 'TN', 'Thumbnail', 'image/jpg', 'M'); + drupal_set_message(t("Successfully installed <a href=\"" . $base_url . "/fedora/repository/islandora:ContentModelCollection\">islandora:ContentModelCollection</a>."), 'message'); + } catch (exception $e) { + + } + } + + if (!empty($form_state['values']['demo_collections']['islandora:root'])) { + $new_item = Fedora_Item::ingest_new_item('islandora:root', 'A', 'Islandora Top-level Collection'); + $new_item->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); + $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/collection_policies/COLLECTION-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); + try { + $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); + drupal_set_message(t("Successfully installed <a href=\"" . $base_url . "/fedora/repository/islandora:root\">islandora:root</a>."), 'message'); + } catch (exception $e) { + + } + } + + if (!empty($form_state['values']['demo_collections']['islandora:demos'])) { + $new_item = fedora_item::ingest_new_item('islandora:demos', 'A', 'Islandora Demo Collection'); + $new_item->add_relationship('isMemberOfCollection', 'islandora:root'); + $new_item->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); + $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/collection_policies/COLLECTION-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); + +// $cv = $new_item->add_datastream_from_file( drupal_get_path('module', 'islandora_repository') . '/collection_views/COLLECTION_VIEW.xml', 'COLLECTION_VIEW', 'Collection View.xml', 'text/xml', 'X'); + $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); + try { + $new_item = Fedora_Item::ingest_new_item('islandora:pdf_collection', 'A', 'PDF Collection'); + $new_item->add_relationship('isMemberOfCollection', 'islandora:demos'); + $new_item->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); + $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/collection_policies/PDF-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); + $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/images/Crystal_Clear_mimetype_pdf.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); + drupal_set_message(t("Successfully installed <a href=\"" . $base_url . "/fedora/repository/islandora:demos\">islandora:demos</a>."), 'message'); + } catch (exception $e) { + + } + } + + if (!empty($form_state['values']['demo_collections']['demo:SmileyStuff'])) { + $smiley_stuff = new Fedora_Item('demo:SmileyStuff'); + $new_item = $smiley_stuff->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/collection_views/SmileyStuff-COLLECTION_VIEW.xml', 'COLLECTION_VIEW', 'Collection View', 'text/xml', 'X'); + $smiley_stuff->add_relationship('isMemberOfCollection', 'info:fedora/islandora:demos'); + $tn = $smiley_stuff->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/images/smileytn.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); + $cp = $smiley_stuff->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/collection_policies/JPG-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy.xml', 'application/xml', 'X'); + + $cm = new Fedora_Item('demo:DualResImage'); + try { + $cmstream = $cm->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/content_models/STANDARD JPG.xml', 'ISLANDORACM', 'Content Model.xml', 'application/xml', 'X'); + } catch (exception $e) { + + } + $dual_res_image_collection_cmodel = new Fedora_Item('demo:DualResImageCollection'); + try { + $cmstream = $dual_res_image_collection_cmodel->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/content_models/COLLECTIONCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); + drupal_set_message(t("Successfully installed <a href=\"" . $base_url . "/fedora/repository/demo:SmileyStuff\">demo:SmileyStuff</a> collection view."), 'message'); + } catch (exception $e) { + + } + } + + if (!empty($form_state['values']['demo_collections']['islandora:largeimages'])) { + $error = ''; + foreach (array('islandora_jp2Sdep-slideCModel.xml', 'islandora_mods2htmlSdef.xml', 'islandora_mods2htmlSdep.xml', + 'islandora_slideCModel.xml', 'islandora_viewerSdep-slideCModel.xml', 'ilives_jp2Sdef.xml', 'ilives_viewerSdef.xml') as $foxml_file) { + try { + $item = Fedora_Item::ingest_from_FOXML_file(drupal_get_path('module', 'islandora_repository') . '/content_models/' . $foxml_file); + } catch (exception $e) { + $error .= " - Problem ingesting $foxml_file"; + } + } + try { + $item = Fedora_Item::ingest_from_FOXML_file(drupal_get_path('module', 'islandora_repository') . '/content_models/islandora_largeimages.xml'); + $tn = $item->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); + drupal_set_message(t("Successfully installed <a href=\"" . $base_url . "/fedora/repository/islandora:largeimages\">islandora:largeimages</a>."), 'message'); + } catch (exception $e) { + $error .= " - Problem ingesting islandora:largeimages collection"; + } + } + + if (!empty($error)) { + drupal_set_message(t('Some problems occurred: ' . $error)); + } + } +} + +/** + * fedora repository required fedora objects + * @return type + */ +function islandora_repository_required_fedora_objects() { +// array( 'path-to-foxml-file', 'pid', 'dsid', 'path-to-datastream-file', int dsversion, boolean required) + $module_path = drupal_get_path('module', 'islandora_repository'); + return array( + 'islandora_repository' => array( + 'module' => 'islandora_repository', + 'title' => 'Islandora Core', + 'objects' => array( + array( + 'pid' => 'islandora:collectionCModel', + 'label' => 'Islandora Collection Content Model', + 'dsid' => 'ISLANDORACM', + 'datastream_file' => "$module_path/content_models/COLLECTIONCM.xml", + 'dsversion' => 2, + 'cmodel' => 'fedora-system:ContentModel-3.0', + ), + + array( + 'pid' => 'islandora:root', + 'label' => 'Islandora Top-level Collection', + 'cmodel' => 'islandora:collectionCModel', + 'datastreams' => array( + array( + 'dsid' => 'COLLECTION_POLICY', + 'datastream_file' => "$module_path/collection_policies/COLLECTION-COLLECTION POLICY.xml", + ), + array( + 'dsid' => 'TN', + 'datastream_file' => "$module_path/images/Gnome-emblem-photos.png", + 'mimetype' => 'image/png', + ), + ), + ), + ), + ), + ); +} + +/** + * Functions to create a time selector form element type. + */ +function islandora_repository_elements() { + $type['islandora_repository_time'] = array( + "#input" => TRUE, + "#process" => array("islandora_repository_expand_time"), + ); + + return $type; +} + +/** + * fedora repository expand time + * @param type $element + * @return string + */ +function islandora_repository_expand_time($element) { +// Default to current time, check default_value but set value so that if +// default value is present it will override value + if (empty($element['#default_value'])) { + $element['#value'] = array( + 'hour' => intval(format_date(time(), 'custom', 'h')), + 'minute' => intval(format_date(time(), 'custom', 'i')), + ); + } + + $element['#tree'] = TRUE; + + foreach ($element['#value'] as $type => $value) { + switch ($type) { + case 'hour': + $options = drupal_map_assoc(range(1, 24)); + break; + case 'minute': + $options = range(0, 59); + break; + } + + if ($type != 'meridiem') { + foreach ($options as $option) { + strlen($option) <= 1 ? $options[$option] = 0 . $option : ''; + } + } + + $element[$type] = array( + '#type' => 'select', + '#default_value' => $element['#value'][$type], + '#options' => $options, + ); + } + + return $element; +} + +/** + * fedora repository time + * @param type $element + * @return type + */ +function islandora_repository_time($element) { + $output = '<div class="container-inline">' . $element['#children'] . '</div>'; + return theme('form_element', $element, $output); +} + +/** + * theme fedora repository time + * @param type $element + * @return type + */ +function theme_islandora_repository_time($element) { + $output = '<div class="container-inline">' . $element['#children'] . '</div>'; + return theme('form_element', $element, $output); +} + +/* Export (basket) functionality */ + +/** + * fedora repository remove item from basket + * @param type $pid + */ +function islandora_repository_remove_item_from_basket($pid) { + + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + $pids = empty($_SESSION['basket']['processed']) ? array() : $_SESSION['basket']['processed']; + + $objectHelper = new ObjectHelper(); +// getting child PIDs if any + $cpids = $objectHelper->get_child_pids(array($pid)); + + if (array_key_exists($pid, $pids)) { +// remove item from basket + unset($_SESSION['basket']['processed'][$pid]); + } + if (!empty($cpids)) { // there are children + foreach ($cpids as $child_pid => $value) { +// remove child item from basket recursively + islandora_repository_remove_item_from_basket($child_pid); + } + } +} + +/** + * fedora repository basket + * @return type + */ +function islandora_repository_basket() { + $pids = _islandora_repository_get_basket_pids(); + $output = drupal_get_form('islandora_repository_basket_form', $pids); + + return $output; +} + +function islandora_repository_basket_form($form_state, $pids) { + $form = array(); + + if (!empty($pids)) { + $form['pid'] = array(); + $form['title'] = array(); + $form['desc'] = array(); + } + else { + return; + } + + ksort($pids); + foreach ($pids as $pid => $arr) { + $cbs[$pid] = ''; + + $form['pid'][$pid] = array('#value' => l($pid, "fedora/repository/$pid")); + $form['title'][$pid] = array('#value' => $arr['title']); + $form['desc'][$pid] = array('#value' => $arr['desc']); + } + + $form['remove'] = array( + '#type' => 'checkboxes', + '#options' => $cbs, + ); + + $form['remove_submit'] = array( + '#type' => 'submit', + '#value' => t('Remove selected'), + ); + + $form['remove_all'] = array( + '#type' => 'submit', + '#value' => t('Empty basket'), + ); + + $form['submit'] = array( + '#type' => 'submit', + '#value' => t('Export selected'), + ); + + $form['submit_all'] = array( + '#type' => 'submit', + '#value' => t('Export all'), + ); + + return $form; +} + +/** + * theme fedora repository basket form + * @param type $form + * @return string + */ +function theme_islandora_repository_basket_form($form) { + $header = array( + theme('table_select_header_cell'), + t('PID'), + t('Title'), + t('Description'), + ); + + if (isset($form['pid']) && is_array($form['pid'])) { + foreach (element_children($form['pid']) as $key) { + $rows[] = array( + drupal_render($form['remove'][$key]), + drupal_render($form['pid'][$key]), + drupal_render($form['title'][$key]), + drupal_render($form['desc'][$key]), + ); + } + } + else { + $rows[] = array(array('data' => t('Your basket is empty.'), 'colspan' => '4')); + } + + $output = theme('table', $header, $rows); + + $frm = drupal_render($form); + $output = $frm . $output . $frm; + + return $output; +} + +/** + * fedora repository basket form validate + * @param type $form + * @param type $form_state + */ +function islandora_repository_basket_form_validate($form, &$form_state) { + +} + +/** + * fedora repository basket form submit + * @global type $user + * @param type $form + * @param type $form_state + * @return type + */ +function islandora_repository_basket_form_submit($form, &$form_state) { + if ($form_state['values']['op'] == $form_state['values']['remove_submit']) { + $pids = $form_state['clicked_button']['#post']['remove']; + + if (isset($pids)) { + foreach ($pids as $pid) { + islandora_repository_remove_from_basket($pid); + } + drupal_set_message(t("Selected objects removed")); + return; + } + } + + if ($form_state['values']['op'] == $form_state['values']['remove_all']) { + _islandora_repository_empty_basket(); + drupal_set_message(t("Basket emptied")); + return; + } + + if ($form_state['values']['op'] == $form_state['values']['submit_all']) { + $msg = t("All objects exported to staging area"); + $pids = _islandora_repository_get_basket_pids(); + } + elseif ($form_state['values']['op'] == $form_state['values']['submit']) { + $msg = t("Selected objects exported to staging area"); + $pids = array_filter($form_state['values']['remove']); + } + + if (!empty($pids)) { + global $user; + $log = array(); + $success = TRUE; + $export_dir = variable_get('export_area', file_directory_path() . '/fedora_export_area') . '/' . $user->name . '/' . date("Ymd-His"); + $foxml_dir = $export_dir . '/foxml'; + + if (!file_exists($foxml_dir) && !@mkdir($foxml_dir, 0775, TRUE)) { + drupal_set_message(t("Failed to create foxml dir %dir. Check that export dir exsits and has correct permissions", array('%dir' => $foxml_dir)), 'error'); + return FALSE; + } + + module_load_include('inc', 'islandora_repository', 'api/fedora_export'); + foreach ($pids as $pid => $arr) { + + $objects_dir = $export_dir . '/objects/' . $pid; + if (!file_exists($objects_dir) && !@mkdir($objects_dir, 0775, TRUE)) { + drupal_set_message(t("Failed to create objects dir %dir. Check that export dir exsits and has correct permissions", array('%dir' => $objects_dir)), 'error'); + return FALSE; + } + + if (!export_to_export_area($pid, $foxml_dir, $objects_dir, $log)) { + $success = FALSE; + } + } + $msg = $success ? $msg : t("Failed to export objects to staging area"); + $msg .= ":<br/>" . implode("<br/>", $log); + + drupal_set_message($msg, $success ? 'info' : 'error'); +//_islandora_repository_empty_basket(); + } + else { + drupal_set_message(t("No objects selected or basket empty"), 'error'); + } + + return; +} + +/** + * Get all pids saved to the basket. + * + * @return type + */ +function _islandora_repository_get_basket_pids() { + +// Set empty defaults if basket elements are missing + $_SESSION['basket'] = isset($_SESSION['basket']) ? $_SESSION['basket'] : array('processed' => array(), 'unprocessed' => array()); + $_SESSION['basket']['processed'] = isset($_SESSION['basket']['processed']) ? $_SESSION['basket']['processed'] : array(); + $_SESSION['basket']['unprocessed'] = isset($_SESSION['basket']['unprocessed']) ? $_SESSION['basket']['unprocessed'] : array(); + + $pids = empty($_SESSION['basket']['processed']) ? array() : $_SESSION['basket']['processed']; + + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + $ob = new ObjectHelper(); + foreach ($_SESSION['basket']['unprocessed'] as $pid) { +// Check if the pid already exists in the tree + if (array_key_exists($pid, $pids)) { + continue; + } + + $pids += $ob->get_all_related_pids($pid); +// $pids += array($pid); + } + + $_SESSION['basket']['processed'] = $pids; + $_SESSION['basket']['unprocessed'] = array(); + + return $pids; +} + +/** + * fedora repository empty basket + */ +function _islandora_repository_empty_basket() { + unset($_SESSION['basket']); +} + +/** + * fedora repository add to basket + * @param type $pid + * @param type $warn + * @param type $searchResultsFlag + */ +function islandora_repository_add_to_basket($pid, $warn = TRUE, $searchResultsFlag = FALSE) { + if ($warn && _is_added_to_basket($pid)) { + drupal_set_message(t("Object already in basket")); + } + + if (!isset($_SESSION['basket'])) { + $_SESSION['basket'] = array(); + $_SESSION['basket']['unprocessed'] = array($pid => $pid); + } + else { + $_SESSION['basket']['unprocessed'][$pid] = $pid; + } + + if (!$searchResultsFlag) { + drupal_goto('fedora/basket'); + } +} + +/** + * fedora repository remove from basket + * @param type $pid + * @return type + */ +function islandora_repository_remove_from_basket($pid) { + if (isset($_SESSION['basket']['unprocessed'][$pid])) { + unset($_SESSION['basket']['unprocessed'][$pid]); + } + + if (isset($_SESSION['basket']['processed'][$pid])) { + unset($_SESSION['basket']['processed'][$pid]); + } + return; +} + +/** + * theme add to basket link + * @param type $pid + * @param type $type + * @return type + */ +function theme_add_to_basket_link($pid, $type = 'object') { + $object = t($type); + $path = drupal_urlencode($pid); + + $save = "export_big.png"; + $saved = "exported_big.png"; +// $path = drupal_get_path('module', 'Fedora_Repository').'/images/'.$save ; + /* + var_dump($path); + var_dump(theme('image',drupal_get_path('module', 'Fedora_Repository').'/images/'.$save)); + die(); + */ + if (!_is_added_to_basket($pid)) { + return l( + theme('image', drupal_get_path('module', 'Fedora_Repository') . '/images/' . $save, t("Add to basket"), t("Add this @object to my basket", array('@object' => $object))), + "fedora/repository/addToBasket/" . $path, + array('html' => TRUE) + ); + } + + return theme('image', drupal_get_path('module', 'Fedora_Repository') . '/images/' . $saved, t("In basket"), t("This @object is already in your basket", array('@object' => $object))); +} + +/** + * is added to basket + * @param type $pid + * @param type $account + * @return type + */ +function _is_added_to_basket($pid, $account = NULL) { + return isset($_SESSION['basket']['unprocessed'][$pid]) || isset($_SESSION['basket']['processed'][$pid]); +// return db_result(db_query("SELECT uid FROM {repository_basket} WHERE uid = %d AND pid = '%s'", $account->uid, $pid)); +} + +/** + * fedora repository display schema + * @param type $file + * @return type + */ +function islandora_repository_display_schema($file) { + $path = drupal_get_path('module', 'islandora_repository'); + if (strtolower(substr($file, -3)) == 'xsd' && file_exists($path . '/' . $file)) { + drupal_goto($path . '/' . $file); + } + else { + drupal_goto(); + } + return; +} + +/** + * fedora repository batch reingest object + * @param type $object + * @param type $context + * @return type + */ +function islandora_repository_batch_reingest_object($object, &$context) { + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + if (!empty($object) && is_array($object)) { + $pid = $object['pid']; + if (!valid_pid($pid)) { + return NULL; + } +// Does the object exist? If so, purge it. + $item = new Fedora_Item($pid); + if ($item->exists()) { + $item->purge(t('Remove during re-install batch job')); + } + +// Ingest the object from the source file. + if (!empty($object['foxml_file'])) { + $foxml_file = $object['foxml_file']; + $new_item = Fedora_Item::ingest_from_FOXML_file($foxml_file); + if ($new_item->exists()) { +// Batch operation was successful. + $context['message'][] = "$new_item->pid installed."; + } + } + if (!empty($object['dsid']) && !empty($object['datastream_file'])) { + $datastreams = array( + array( + 'dsid' => $object['dsid'], + 'datastream_file' => $object['datastream_file'], + ) + ); + } + elseif (!empty($object['datastreams'])) { + $datastreams = $object['datastreams']; + } + + if (!empty($datastreams) && is_array($datastreams)) { + $label = !empty($object['label']) ? $object['label'] : ''; + if (empty($object['foxml_file']) && !isset($new_item)) { + $new_item = Fedora_Item::ingest_new_item($object['pid'], 'A', $label); + } + if (!empty($object['cmodel'])) { + $new_item->add_relationship('hasModel', $object['cmodel'], FEDORA_MODEL_URI); + } + if (!empty($object['parent'])) { + $new_item->add_relationship('isMemberOfCollection', $object['parent']); + } + foreach ($datastreams as $ds) { + if ($ds['dsid'] == 'DC') { + $new_item->modify_datastream_by_value(file_get_contents($ds['datastream_file']), $ds['dsid'], $ds['label'], 'text/xml'); + } + else { + $new_item->add_datastream_from_file($ds['datastream_file'], $ds['dsid'], !empty($ds['label']) ? $ds['label'] : '', !empty($ds['mimetype']) ? $ds['mimetype'] : 'text/xml'); + } + } + } + } +} + +/** + * Content model, collection view and collection policy datastreams may now optionally define a version + * number in their top-level XML element as an attribute, as in: + * <content_model name="Collection" version="2" ... + * + * @param Fedora_Item $item + * @param string $dsid + * @param string $datastream_file + * @return int, or NULL if no version attribute was found. + */ +function islandora_repository_get_islandora_datastream_version($item = NULL, $dsid = NULL, $datastream_file = NULL) { + $return = NULL; + if (isset($item)) { + $doc = simplexml_load_string($item->get_datastream_dissemination($dsid)); + } + elseif (isset($datastream_file)) { + $doc = simplexml_load_file($datastream_file); + } + + if (!empty($doc)) { + $attrs = $doc->attributes(); + foreach ($attrs as $name => $value) { + if ($name == 'version') { + $return = (int) $value; + break; + } + } + } + return $return; +} + +/** + * theme fedora repository solution pack list + * @param type $solution_packs + * @return string + */ +function theme_islandora_repository_solution_packs_list($solution_packs) { + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + $output = ''; + $header = array(); + $rows = array(); + + + + + drupal_add_css(drupal_get_path('module', 'update') . '/update.css'); + return $output; +} + +/** + * Implementation of hook_forms() + * @param string $form_id + * @return array + */ +function islandora_repository_forms($form_id) { + $forms = array(); + if (strpos($form_id, 'islandora_repository_solution_pack_form_') === 0) { + $forms[$form_id] = array( + 'callback' => 'islandora_repository_solution_pack_form', + ); + } + return $forms; +} diff --git a/islandoracm.xsd b/islandoracm.xsd index bce83136..21ab6661 100644 --- a/islandoracm.xsd +++ b/islandoracm.xsd @@ -48,14 +48,14 @@ </xsd:complexType> <xsd:complexType name="form_builder_methodType"> <xsd:attribute name="file" type="xsd:normalizedString" use="required"/> - <xsd:attribute name="module" type="xsd:normalizedString" default="fedora_repository"/> + <xsd:attribute name="module" type="xsd:normalizedString" default="islandora_repository"/> <xsd:attribute name="class" type="xsd:normalizedString" use="required"/> <xsd:attribute name="method" type="xsd:normalizedString" use="required"/> <xsd:attribute name="handler" type="xsd:normalizedString" use="required"/> </xsd:complexType> <xsd:complexType name="edit_metadata_methodType"> <xsd:attribute name="file" type="xsd:normalizedString" use="required"/> - <xsd:attribute name="module" type="xsd:normalizedString" default="fedora_repository"/> + <xsd:attribute name="module" type="xsd:normalizedString" default="islandora_repository"/> <xsd:attribute name="class" type="xsd:normalizedString" use="required"/> <xsd:attribute name="method" type="xsd:normalizedString" use="required"/> <xsd:attribute name="handler" type="xsd:normalizedString" use="required"/> @@ -118,7 +118,7 @@ </xsd:all> <xsd:attribute name="file" type="xsd:normalizedString" use="required"/> - <xsd:attribute name="module" type="xsd:normalizedString" default="fedora_repository"/> + <xsd:attribute name="module" type="xsd:normalizedString" default="islandora_repository"/> <xsd:attribute name="class" type="xsd:normalizedString" use="required"/> <xsd:attribute name="method" type="xsd:normalizedString" use="required"/> <xsd:attribute name="dsid" type="xsd:normalizedString" use="required"/> @@ -149,7 +149,7 @@ <xsd:element name="parameters" type="parametersType" minOccurs="0"/> </xsd:all> <xsd:attribute name="file" type="xsd:normalizedString" use="required"/> - <xsd:attribute name="module" type="xsd:normalizedString" default="fedora_repository"/> + <xsd:attribute name="module" type="xsd:normalizedString" default="islandora_repository"/> <xsd:attribute name="class" type="xsd:normalizedString" use="required"/> <xsd:attribute name="method" type="xsd:normalizedString" use="required"/> <xsd:attribute name="dsid" type="xsd:normalizedString" use="required"/> @@ -171,7 +171,7 @@ <xsd:complexContent> <xsd:restriction base="xsd:anyType"> <xsd:attribute name="file" type="xsd:normalizedString" use="required"/> - <xsd:attribute name="module" type="xsd:normalizedString" default="fedora_repository"/> + <xsd:attribute name="module" type="xsd:normalizedString" default="islandora_repository"/> <xsd:attribute name="class" type="xsd:normalizedString" use="required"/> <xsd:attribute name="method" type="xsd:normalizedString" use="required"/> <xsd:attribute name="default" type="xsd:boolean" default="false"/> diff --git a/plugins/CollectionFormBuilder.inc b/plugins/CollectionFormBuilder.inc index a385aa26..6d901b21 100644 --- a/plugins/CollectionFormBuilder.inc +++ b/plugins/CollectionFormBuilder.inc @@ -7,7 +7,7 @@ * Collection Form Builder */ -module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder'); +module_load_include('inc', 'islandora_repository', 'plugins/FormBuilder'); /** * implements methods from content model ingest form xml @@ -32,7 +32,7 @@ class CollectionFormBuilder extends FormBuilder { * @param type $rootElement */ function createFedoraDataStreams($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'fedora_repository', 'MimeClass'); + module_load_include('inc', 'islandora_repository', 'MimeClass'); global $base_url; $mimetype = new MimeClass(); diff --git a/plugins/DarwinCore.inc b/plugins/DarwinCore.inc index 5ab525b6..814e9dfb 100644 --- a/plugins/DarwinCore.inc +++ b/plugins/DarwinCore.inc @@ -21,7 +21,7 @@ class DarwinCore { * @param type $item */ function __construct($item = NULL) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); if (!empty($item)) { $this->owner = $item; if (array_key_exists('DARWIN_CORE', $item->get_datastreams_list_as_array())) { @@ -200,7 +200,7 @@ class DarwinCore { * @param type $form_values */ public function handleForm($form_values) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); global $user; //$new_item = Fedora_Item::ingest_new_item($form_values['pid'], 'A', $form_values['dwc:institutionCode'].':'.$form_values['dwc:collectionCode'].':'.$form_values['dwc:catalogNumber'], $user->name); //$new_item->add_datastream_from_string($this->darwinCoreXML, 'DARWIN_CORE', 'Darwin Core Metadata', 'text/xml', 'X'); @@ -248,8 +248,8 @@ class DarwinCore { */ public function asHTML() { $path = drupal_get_path('module', 'Fedora_Repository'); - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - module_load_include('inc', 'fedora_repository', 'CollectionClass'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'CollectionClass'); $xmlstr = $this->darwinCoreXML; html_entity_decode($xmlstr); diff --git a/plugins/DemoFormBuilder.inc b/plugins/DemoFormBuilder.inc index ccc74ba2..d2d7f738 100644 --- a/plugins/DemoFormBuilder.inc +++ b/plugins/DemoFormBuilder.inc @@ -6,7 +6,7 @@ * @file * */ -module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder'); +module_load_include('inc', 'islandora_repository', 'plugins/FormBuilder'); /** * implements methods from content model ingest form xml @@ -19,7 +19,7 @@ class DemoFormBuilder extends FormBuilder { * Constructor */ function DemoFormBuilder() { - module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder'); + module_load_include('inc', 'islandora_repository', 'plugins/FormBuilder'); drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); } @@ -31,7 +31,7 @@ class DemoFormBuilder extends FormBuilder { * @param type $rootElement */ function createFedoraDataStreams($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'fedora_repository', 'MimeClass'); + module_load_include('inc', 'islandora_repository', 'MimeClass'); global $base_url; $mimetype = new MimeClass(); $server = NULL; diff --git a/plugins/DocumentConverter.inc b/plugins/DocumentConverter.inc index f258441a..e64517c6 100644 --- a/plugins/DocumentConverter.inc +++ b/plugins/DocumentConverter.inc @@ -32,7 +32,7 @@ class DocumentConverter { * @return string */ function convert($parameterArray = NULL, $dsid, $file, $output_ext) { - module_load_include('inc', 'fedora_repository', 'MimeClass'); + module_load_include('inc', 'islandora_repository', 'MimeClass'); #debug: #drupal_set_message("Sending $file to ". $this->converter_service_url ." for convertsion to $output_ext", 'status'); diff --git a/plugins/Exiftool.inc b/plugins/Exiftool.inc index c0b98981..5db3d600 100644 --- a/plugins/Exiftool.inc +++ b/plugins/Exiftool.inc @@ -22,7 +22,7 @@ class Exiftool { function __construct($pid) { //drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); $this->pid = $pid; - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $this->item = new Fedora_Item($this->pid); } diff --git a/plugins/FedoraObjectDetailedContent.inc b/plugins/FedoraObjectDetailedContent.inc index 855d508c..de8d10a7 100644 --- a/plugins/FedoraObjectDetailedContent.inc +++ b/plugins/FedoraObjectDetailedContent.inc @@ -19,7 +19,7 @@ class FedoraObjectDetailedContent { * @param type $pid */ function __construct($pid = '') { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); if (!empty($pid)) { $this->pid = $pid; @@ -36,9 +36,9 @@ class FedoraObjectDetailedContent { global $user; $objectHelper = new ObjectHelper(); $tabset = array(); - $show_purge_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_purge_object_form'); - $show_edit_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_edit_qdc_form'); - $purge_form = drupal_get_form('fedora_repository_purge_object_form', $this->pid, check_plain(substr(request_uri(), strlen(base_path())))); + $show_purge_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'islandora_repository_purge_object_form'); + $show_edit_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'islandora_repository_edit_qdc_form'); + $purge_form = drupal_get_form('islandora_repository_purge_object_form', $this->pid, check_plain(substr(request_uri(), strlen(base_path())))); $tabset['fedora_object_details'] = array( '#type' => 'tabpage', @@ -59,8 +59,8 @@ class FedoraObjectDetailedContent { '#content' => $dc_html . $ds_list . $purge_form, ); - if (fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { - $editform = drupal_get_form('fedora_repository_edit_qdc_form', $this->pid, 'DC'); + if (islandora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { + $editform = drupal_get_form('islandora_repository_edit_qdc_form', $this->pid, 'DC'); $tabset['fedora_object_details']['tabset']['edit'] = array( '#type' => 'tabpage', '#title' => t('Edit'), diff --git a/plugins/Flv.inc b/plugins/Flv.inc index d8f2b06b..d1dc03d3 100644 --- a/plugins/Flv.inc +++ b/plugins/Flv.inc @@ -138,7 +138,7 @@ class FormBuilder { * @param type $rootElement */ function createFedoraDataStreams($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'fedora_repository', 'MimeClass'); + module_load_include('inc', 'islandora_repository', 'MimeClass'); $mimetype = new MimeClass(); $server = NULL; $file = $form_values['ingest-file-location']; diff --git a/plugins/FlvFormBuilder.inc b/plugins/FlvFormBuilder.inc index c259328c..f9d13e56 100644 --- a/plugins/FlvFormBuilder.inc +++ b/plugins/FlvFormBuilder.inc @@ -6,7 +6,7 @@ * @file * FLVFormBuilder */ -module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder'); +module_load_include('inc', 'islandora_repository', 'plugins/FormBuilder'); /** * implements methods from content model ingest form xml @@ -19,7 +19,7 @@ class FlvFormBuilder extends FormBuilder { * Constructor */ function FlvFormBuilder() { - module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder'); + module_load_include('inc', 'islandora_repository', 'plugins/FormBuilder'); drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); } @@ -32,7 +32,7 @@ class FlvFormBuilder extends FormBuilder { */ function createFedoraDataStreams($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'fedora_repository', 'MimeClass'); + module_load_include('inc', 'islandora_repository', 'MimeClass'); global $base_url; $mimetype = new MimeClass(); $server = NULL; diff --git a/plugins/FormBuilder.inc b/plugins/FormBuilder.inc index 382733b4..695fa2c6 100644 --- a/plugins/FormBuilder.inc +++ b/plugins/FormBuilder.inc @@ -84,7 +84,7 @@ class FormBuilder { * @return type */ function createPolicy($collectionPid, &$dom, &$rootElement) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); $objectHelper = new ObjectHelper(); $dsid = 'CHILD_SECURITY'; @@ -135,8 +135,8 @@ class FormBuilder { * @return type */ function handleQDCForm($form_values) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'CollectionPolicy'); $dom = new DomDocument("1.0", "UTF-8"); $dom->formatOutput = TRUE; @@ -196,7 +196,7 @@ class FormBuilder { * @param type $rootElement */ function createFedoraDataStreams($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'fedora_repository', 'MimeClass'); + module_load_include('inc', 'islandora_repository', 'MimeClass'); global $base_url; $mimetype = new MimeClass(); $server = NULL; diff --git a/plugins/ImageManipulation.inc b/plugins/ImageManipulation.inc index 8f97ab94..c67e4911 100644 --- a/plugins/ImageManipulation.inc +++ b/plugins/ImageManipulation.inc @@ -16,7 +16,7 @@ class ImageManipulation { * Constructor */ function ImageManipulation() { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); } /** diff --git a/plugins/ModsFormBuilder.inc b/plugins/ModsFormBuilder.inc index d49869e2..26662cf2 100644 --- a/plugins/ModsFormBuilder.inc +++ b/plugins/ModsFormBuilder.inc @@ -6,7 +6,7 @@ * @file * ModsFormBuilder class */ -module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder'); +module_load_include('inc', 'islandora_repository', 'plugins/FormBuilder'); /** * ModsFormBuilder class ??? @@ -25,8 +25,8 @@ class ModsFormBuilder extends FormBuilder { function __construct($pid=NULL) { parent::__construct(); if ($pid !== NULL) { - module_load_include('inc', 'fedora_repository', 'ContentModel'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'ContentModel'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $this->pid = $pid; $this->cm = ContentModel::loadFromObject($pid); @@ -241,7 +241,7 @@ class ModsFormBuilder extends FormBuilder { $form['submit'] = array( '#type' => 'submit', - '#submit' => array('fedora_repository_edit_qdc_form_submit'), + '#submit' => array('islandora_repository_edit_qdc_form_submit'), '#value' => 'Save Metadata' ); @@ -256,8 +256,8 @@ class ModsFormBuilder extends FormBuilder { * @param &$form_state */ function handleModsForm(&$form_values, &$form_state) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'CollectionPolicy'); $form_state['storage']['people'] = NULL; //clears out old entities for the next run of the formbuilder. @@ -329,7 +329,7 @@ class ModsFormBuilder extends FormBuilder { * @param &$rootElement */ function createCollectionPolicy($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $model = new fedora_item($form_values['content_model_pid']); $ds_list = $model->get_datastreams_list_as_array(); if (isset($ds_list['COLLECTION_POLICY_TMPL'])) { @@ -364,7 +364,7 @@ class ModsFormBuilder extends FormBuilder { * @param &$rootElement */ function createWorkflowStream($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $model = new fedora_item($form_values['content_model_pid']); $ds_list = $model->get_datastreams_list_as_array(); if (isset($ds_list['WORKFLOW_TMPL'])) { diff --git a/plugins/PersonalCollectionClass.inc b/plugins/PersonalCollectionClass.inc index 68ae5528..b4742711 100644 --- a/plugins/PersonalCollectionClass.inc +++ b/plugins/PersonalCollectionClass.inc @@ -120,7 +120,7 @@ class PersonalCollectionClass { * @return type */ function createPolicyStream($user, $dom, $rootElement) { - module_load_include('inc', 'fedora_repository', 'SecurityClass'); + module_load_include('inc', 'islandora_repository', 'SecurityClass'); $securityClass = new SecurityClass(); $policyStreamDoc = $securityClass->createPersonalPolicy($user); diff --git a/plugins/QtFormBuilder.php b/plugins/QtFormBuilder.php index 28645d6b..954f28e4 100644 --- a/plugins/QtFormBuilder.php +++ b/plugins/QtFormBuilder.php @@ -6,7 +6,7 @@ * @file * QTFormBuilder class */ -module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder'); +module_load_include('inc', 'islandora_repository', 'plugins/FormBuilder'); /** * Implements methods from content model ingest form xml @@ -30,7 +30,7 @@ class QtFormBuilder extends FormBuilder { * @param type $rootElement */ function createFedoraDataStreams($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'fedora_repository', 'MimeClass'); + module_load_include('inc', 'islandora_repository', 'MimeClass'); global $base_url; $mimetype = new MimeClass(); $server = null; diff --git a/plugins/Refworks.inc b/plugins/Refworks.inc index 592a7e99..4f0d6fc3 100644 --- a/plugins/Refworks.inc +++ b/plugins/Refworks.inc @@ -7,7 +7,7 @@ * Refworks class */ -module_load_include('inc', 'fedora_repository', 'SecurityClass'); +module_load_include('inc', 'islandora_repository', 'SecurityClass'); /** * Refworks class ??? @@ -222,9 +222,9 @@ class Refworks { */ function handleForm(&$form_values) { $errorMessage = NULL; - module_load_include('inc', 'fedora_repository', 'CollectionClass'); - module_load_include('inc', 'fedora_repository', 'ContentModel'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'CollectionClass'); + module_load_include('inc', 'islandora_repository', 'ContentModel'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $contentModelPid = ContentModel::getPidFromIdentifier($form_values['models']); $contentModelDsid = ContentModel::getDSIDFromIdentifier($form_values['models']); $collectionHelper = new CollectionClass(); @@ -238,7 +238,7 @@ class Refworks { $collection_item = new Fedora_Item($collection_pid); $this->collectionPolicyStream = $collection_item->get_datastream_dissemination('CHILD_SECURITY'); if (empty($this->collectionPolicyStream)) { - $this->collectionPolicyStream = file_get_contents(drupal_get_path('module', 'fedora_repository') . '/policies/noObjectEditPolicy.xml'); + $this->collectionPolicyStream = file_get_contents(drupal_get_path('module', 'islandora_repository') . '/policies/noObjectEditPolicy.xml'); } $success = 0; $errors = 0; @@ -388,7 +388,7 @@ class Refworks { */ function createFedoraDataStreams($form_values, &$dom, &$rootElement, $reference) { global $base_url; - module_load_include('inc', 'fedora_repository', 'MimeClass'); + module_load_include('inc', 'islandora_repository', 'MimeClass'); $mimetype = new MimeClass(); $server = NULL; $this->createRomeoDataStream($dom, $rootElement); diff --git a/plugins/ShowStreamsInFieldSets.inc b/plugins/ShowStreamsInFieldSets.inc index 77eada60..efa1ab7e 100644 --- a/plugins/ShowStreamsInFieldSets.inc +++ b/plugins/ShowStreamsInFieldSets.inc @@ -87,7 +87,7 @@ class ShowStreamsInFieldSets { global $base_url; global $base_path; global $user; - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $tabset = array(); @@ -105,7 +105,7 @@ class ShowStreamsInFieldSets { $tn_url = $base_url . '/fedora/repository/' . $item->pid . '/TN'; } else { - $tn_url = $base_path . drupal_get_path('module', 'fedora_repository') . '/images/Crystal_Clear_app_download_manager.png'; + $tn_url = $base_path . drupal_get_path('module', 'islandora_repository') . '/images/Crystal_Clear_app_download_manager.png'; } $dc_html = $objectHelper->getFormattedDC($item); @@ -117,8 +117,8 @@ class ShowStreamsInFieldSets { '#content' => $dl_link . $dc_html, ); - if (fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { - $editform = drupal_get_form('fedora_repository_edit_qdc_form', $this->pid, 'DC'); + if (islandora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { + $editform = drupal_get_form('islandora_repository_edit_qdc_form', $this->pid, 'DC'); $tabset['first_tab']['tabs']['edit'] = array( '#type' => 'tabpage', '#title' => t('Edit'), @@ -142,7 +142,7 @@ class ShowStreamsInFieldSets { * @return type */ function showQdc() { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); $objectHelper = new ObjectHelper(); $content = $objectHelper->getQDC($this->pid); $collection_fieldset = array( @@ -161,7 +161,7 @@ class ShowStreamsInFieldSets { */ function showOBJLink() { global $base_url; - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $item = new Fedora_Item($this->pid); $streams = $item->get_datastreams_list_as_array(); return "<a href='" . $base_url . "/fedora/repository/" . $this->pid . "/OBJ/" . $streams['OBJ']['label'] . "'>" . $streams['OBJ']['label'] . "</a>"; @@ -172,8 +172,8 @@ class ShowStreamsInFieldSets { * @return type */ function showRefworks() { - $path = drupal_get_path('module', 'fedora_repository'); - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + $path = drupal_get_path('module', 'islandora_repository'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); $collectionHelper = new CollectionClass(); $xmlstr = $collectionHelper->getStream($this->pid, "refworks"); html_entity_decode($xmlstr); @@ -226,7 +226,7 @@ class ShowStreamsInFieldSets { */ function showRomeo($collapsed = FALSE) { $path = drupal_get_path('module', 'Fedora_Repository'); - module_load_include('inc', 'fedora_repository', 'CollectionClass'); + module_load_include('inc', 'islandora_repository', 'CollectionClass'); $collectionHelper = new CollectionClass(); $xmlstr = $collectionHelper->getStream($this->pid, "ROMEO", 0); diff --git a/plugins/herbarium.inc b/plugins/herbarium.inc index f7a6d685..f831bc59 100644 --- a/plugins/herbarium.inc +++ b/plugins/herbarium.inc @@ -16,7 +16,7 @@ class Herbarium { function __construct($pid = '') { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); if (!empty($pid)) { $this->pid = $pid; $this->item = new Fedora_Item($pid); @@ -32,7 +32,7 @@ class Herbarium { public function buildDrupalForm($form = array(), $form_state = array()) { // We don't need to add anything beyond the standard Darwin Core form so just pass this through // If we wanted to we could add other fields. - module_load_include('inc', 'fedora_repository', 'plugins/DarwinCore'); + module_load_include('inc', 'islandora_repository', 'plugins/DarwinCore'); $dwc = new DarwinCore($this->item); return $dwc->buildDrupalForm($form); @@ -73,9 +73,9 @@ class Herbarium { * Process the metadata form * Update the datastreams */ - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'plugins/DarwinCore'); - module_load_include('inc', 'fedora_repository', 'MimeClass'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'plugins/DarwinCore'); + module_load_include('inc', 'islandora_repository', 'MimeClass'); global $user; $mimetype = new MimeClass(); $dwc = new DarwinCore($this->item); @@ -97,9 +97,9 @@ class Herbarium { * Create fedora object * Add the datastreams */ - module_load_include('inc', 'fedora_repository', 'MimeClass'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'plugins/DarwinCore'); + module_load_include('inc', 'islandora_repository', 'MimeClass'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'plugins/DarwinCore'); global $user; $mimetype = new MimeClass(); $dwc = new DarwinCore(); @@ -141,8 +141,8 @@ class Herbarium { * @return string */ public function showFieldSets() { - module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); - module_load_include('inc', 'fedora_repository', 'plugins/DarwinCore'); + module_load_include('inc', 'islandora_repository', 'plugins/tagging_form'); + module_load_include('inc', 'islandora_repository', 'plugins/DarwinCore'); global $base_url; $tabset = array(); @@ -167,7 +167,7 @@ class Herbarium { '#title' => t('View'), // This will be the content of the tab. '#content' => '<a href="' . $base_url . '/fedora/repository/' . $this->pid . '/FULL_JPG/"><img src="' . $base_url . '/fedora/imageapi/' . - $this->pid . '/JPG/JPG.jpg' . '" /></a>' . '<p>' . drupal_get_form('fedora_repository_image_tagging_form', $this->pid) . '</p>', + $this->pid . '/JPG/JPG.jpg' . '" /></a>' . '<p>' . drupal_get_form('islandora_repository_image_tagging_form', $this->pid) . '</p>', ); $dwc = new DarwinCore($this->item); @@ -184,10 +184,10 @@ class Herbarium { '#title' => t('Darwin Core'), '#content' => $dwc->asHTML(), ); - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'islandora_repository', 'ObjectHelper'); $obj = new ObjectHelper(); - if (fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { - $editform = drupal_get_form('fedora_repository_edit_qdc_form', $this->pid, 'DARWIN_CORE'); + if (islandora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { + $editform = drupal_get_form('islandora_repository_edit_qdc_form', $this->pid, 'DARWIN_CORE'); $tabset['third_tab']['tabset']['edit'] = array( '#type' => 'tabpage', '#title' => t('Edit'), diff --git a/plugins/islandora_imageapi.info b/plugins/islandora_imageapi.info new file mode 100644 index 00000000..5519ad85 --- /dev/null +++ b/plugins/islandora_imageapi.info @@ -0,0 +1,7 @@ +name = Fedora ImageAPI +description = Adds image manipulation support through a REST interface +package = Islandora Dependencies +dependencies[] = islandora_repository +dependencies[] = imageapi +version = 11.2.beta2 +core = 6.x diff --git a/plugins/islandora_imageapi.module b/plugins/islandora_imageapi.module new file mode 100644 index 00000000..cbe6225d --- /dev/null +++ b/plugins/islandora_imageapi.module @@ -0,0 +1,116 @@ +<?php + + + +function fedora_imageapi_menu() { + $items = array(); + $items['fedora/imageapi'] = array( + 'title' => t('Image manipulation functions'), + 'page callback' => 'islandora_repository_image_manip', + 'type' => MENU_CALLBACK, + 'access arguments' => array('view fedora collection'), + ); + return $items; +} + +/** + * Call out to the Drupal ImageAPI module and return the resulting image as a stream. + * + * @param string $pid + * @param string $dsid + * @param string $op + * @param string $params + */ +function islandora_repository_image_manip($pid = '', $dsid = '', $op = '', $params = '') { + module_load_include('inc', 'Fedora_Repository', 'ObjectHelper'); + module_load_include('module', 'imageapi'); + $obj = new ObjectHelper(); + $mimetype = $obj->getMimeType($pid, $dsid); + $ext = substr(strstr($mimetype, '/'), 1); + $op = (!empty($_GET['op']) ? $_GET['op'] : ''); + $safe_pid = str_replace(':', '_', $pid); + + $cache_key = 'islandora_repository_image_manip_' . md5($safe_pid . '_' . $dsid . '_' . $ext . '_' . $op . (isset($_GET['width']) ? '_' . $_GET['width'] : '') . (isset($_GET['height']) ? '_' . $_GET['height'] : '')); + if (($file = cache_get($cache_key)) === 0) { + //added the slash as sys_get_temp_dir in linux does not seem to include the slash + $tmp_file_name = sys_get_temp_dir() . '/' . $safe_pid . '_' . $dsid . '.' . $ext; + $handle = fopen($tmp_file_name, "w"); + $numbytes = fwrite($handle, $obj->getStream($pid, $dsid)); + fclose($handle); + if ($numbytes == 0) { + return; + } + + + $image = imageapi_image_open($tmp_file_name); + + switch ($op) { + case 'scale': + if (!empty($_GET['height']) || !empty($_GET['width'])) { + imageapi_image_scale($image, $_GET['width'], $_GET['height']); + } + case 'centerscale': + if (!empty($_GET['height']) && !empty($_GET['width'])) { + imageapi_image_scale_and_crop($image, $_GET['width'], $_GET['height']); + } + } + imageapi_image_close($image); + $file = file_get_contents($tmp_file_name); + cache_set($cache_key, $file, 'cache', time() + variable_get('fedora_image_blocks_cache_time', 3600)); + file_delete($tmp_file_name); + } + else { + $file = $file->data; + } + + + header("Content-type: $mimetype"); + header('Content-Disposition: attachment; filename="' . $dsid . '.' . $ext . '"'); + echo $file; + + +// return "$numbytes bytes written to ".sys_get_temp_dir()."$pid_$dsid.$ext\n"; +} + +/** + * Implementation of hook_form_alter + * + * @param unknown_type $form + * @param unknown_type $form_state + * @param unknown_type $form_id + */ +/* + function fedora_imageapi_form_alter( &$form, $form_state, $form_id) { + + switch ( $form_id ) { + case 'islandora_repository_admin': + + $fedora_base_url = $form['fedora_base_url']['#default_value']; + + $fedora_server_url = substr($fedora_base_url,0,strpos($fedora_base_url,'/',7)); + // Add the Djatoka server location. Set it to default to the same server as fedora. + $form['djatoka_server_url'] = array ( + '#type' => 'textfield', + '#title' => '<h3>'.t('Fedora Image API Module').'</h3><br />'.t('aDORe Djatoka image server resolver URL'), + '#default_value' => variable_get('djatoka_server_url', $fedora_server_url.'/adore-djatoka/resolver' ), + '#description' => t('The location of your <a href="http://african.lanl.gov/aDORe/projects/djatoka/" title="aDORe Djatoka Home Page">aDORe Djatoka</a> image server, if you have one installed.'), + '#weight' => 1, + ); + $form['openlayers_server_url'] = array( + '#type' => 'textfield', + '#title' => t('OpenLayers servlet URL'), + '#default_value' => variable_get('openlayers_server_url', $fedora_server_url.'/islandora/OpenLayers'), + '#description' => t('URL of your installation of the <a href="http://openlayers.org/">OpenLayers</a> servlet, if you have one.'), + '#weight' => 1, + ); + $form['buttons']['#weight'] = 2; + break; + } + } + + function show_openlayers_viewer() { + $output = 'Hi.'; + + return $output; + } + */ diff --git a/plugins/map_viewer.inc b/plugins/map_viewer.inc index 3e9bcfb6..2ad56c0a 100644 --- a/plugins/map_viewer.inc +++ b/plugins/map_viewer.inc @@ -29,9 +29,9 @@ class ShowMapStreamsInFieldSets { * @return type */ function showJPG() { - module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); - module_load_include('inc', 'fedora_repository', 'plugins/ShowStreamsInFieldSets'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'plugins/tagging_form'); + module_load_include('inc', 'islandora_repository', 'plugins/ShowStreamsInFieldSets'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); global $base_url; @@ -51,8 +51,8 @@ class ShowMapStreamsInFieldSets { $html = '<iframe src="' . $viewer_url . '" scrolling="no" frameborder="0" style="width: 100%; height: 800px;">Errors: unable to load viewer</iframe>'; drupal_add_css(path_to_theme() . '/header-viewer.css', 'theme'); - drupal_add_css(drupal_get_path('module', 'fedora_repository') . '/js/iiv/css/jquery-ui/smoothness/jquery-ui-1.7.2.custom.css'); - drupal_add_css(drupal_get_path('module', 'fedora_repository') . '/js/iiv/css/iiv.css'); + drupal_add_css(drupal_get_path('module', 'islandora_repository') . '/js/iiv/css/jquery-ui/smoothness/jquery-ui-1.7.2.custom.css'); + drupal_add_css(drupal_get_path('module', 'islandora_repository') . '/js/iiv/css/iiv.css'); $tabset['my_tabset']['second_tab'] = array( diff --git a/plugins/qt_viewer.inc b/plugins/qt_viewer.inc index ec321ca1..09d24cca 100644 --- a/plugins/qt_viewer.inc +++ b/plugins/qt_viewer.inc @@ -112,9 +112,9 @@ class ShowQtStreamsInFieldSets { * @return type */ function showQt() { - module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); - module_load_include('inc', 'fedora_repository', 'plugins/ShowStreamsInFieldSets'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'plugins/tagging_form'); + module_load_include('inc', 'islandora_repository', 'plugins/ShowStreamsInFieldSets'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); $info = $this->technicalMetadata(array('width' => 640, 'height' => 480)); $width = $info['width']; diff --git a/plugins/slide_viewer.inc b/plugins/slide_viewer.inc index 1d23b227..ef569487 100644 --- a/plugins/slide_viewer.inc +++ b/plugins/slide_viewer.inc @@ -30,8 +30,8 @@ class ShowSlideStreamsInFieldSets { * @return type */ function showJPG() { - module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); - module_load_include('inc', 'fedora_repository', 'plugins/ShowStreamsInFieldSets'); + module_load_include('inc', 'islandora_repository', 'plugins/tagging_form'); + module_load_include('inc', 'islandora_repository', 'plugins/ShowStreamsInFieldSets'); global $base_url; global $user; @@ -58,7 +58,7 @@ class ShowSlideStreamsInFieldSets { '#title' => t('View'), // This will be the content of the tab. '#content' => '<img src="' . $base_url . - '/fedora/imageapi/' . $this->pid . '/JPG/JPG.jpg' . '" />' . '<p>' . drupal_get_form('fedora_repository_image_tagging_form', $this->pid) . '</p>', + '/fedora/imageapi/' . $this->pid . '/JPG/JPG.jpg' . '" />' . '<p>' . drupal_get_form('islandora_repository_image_tagging_form', $this->pid) . '</p>', ); return $tabset; diff --git a/plugins/tagging_form.inc b/plugins/tagging_form.inc index 0a421105..ca32ecd5 100644 --- a/plugins/tagging_form.inc +++ b/plugins/tagging_form.inc @@ -13,9 +13,9 @@ * @return string */ function _show_subject_tags($pid) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'api/dublin_core'); - module_load_include('inc', 'fedora_repository', 'api/tagging'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/dublin_core'); + module_load_include('inc', 'islandora_repository', 'api/tagging'); $obj = new Fedora_Item($pid); $tags = new TagSet($obj); if (!empty($tags->tags)) { @@ -35,10 +35,10 @@ function _show_subject_tags($pid) { * @param type $pid * @return type */ -function fedora_repository_image_tagging_form($form_state, $pid) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'api/dublin_core'); - module_load_include('inc', 'fedora_repository', 'api/tagging'); +function islandora_repository_image_tagging_form($form_state, $pid) { + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/dublin_core'); + module_load_include('inc', 'islandora_repository', 'api/tagging'); global $base_url; if (!empty($form_state['post']['pid'])) { @@ -71,7 +71,7 @@ function fedora_repository_image_tagging_form($form_state, $pid) { // Delete button for each existing tag. $form['tags-wrapper']['tags'][$tag['name']]['delete'] = array( '#type' => 'imagebutton', - '#image' => $base_url . '/' . drupal_get_path('module', 'fedora_repository') . '/images/remove_icon.png', + '#image' => $base_url . '/' . drupal_get_path('module', 'islandora_repository') . '/images/remove_icon.png', '#default_value' => $tag['name'], '#title' => t('Delete this tag'), ); @@ -122,9 +122,9 @@ function hook_imagebutton_process($form) { * @param type $form * @param type $form_state */ -function fedora_repository_image_tagging_form_submit($form, &$form_state) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'api/tagging'); +function islandora_repository_image_tagging_form_submit($form, &$form_state) { + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/tagging'); global $user; $item = new Fedora_Item($form_state['values']['pid']); diff --git a/tests/README_TESTING.txt b/tests/README_TESTING.txt index bd69c57e..a88a244c 100644 --- a/tests/README_TESTING.txt +++ b/tests/README_TESTING.txt @@ -21,7 +21,7 @@ $FEDORA_HOME/server/config/fedora-users.xml: </attribute> </user> -If you look in the fedora_repository.test file we see that we are creating +If you look in the islandora_repository.test file we see that we are creating a user with a password set to 'simpletestpass'. Fedora requires the hashed version of this password to do a servlet filter-based authentication. diff --git a/tests/fedora_repository.test b/tests/fedora_repository.test index 91d91b61..2bfab51f 100644 --- a/tests/fedora_repository.test +++ b/tests/fedora_repository.test @@ -16,9 +16,9 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { } function setUp() { - parent::setUp('tabs', 'fedora_repository'); + parent::setUp('tabs', 'islandora_repository'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'islandora_repository', 'api/fedora_item'); // Create and login user. $repository_user = $this->drupalCreateFedoraUser(array('add fedora datastreams', @@ -57,11 +57,11 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { $ingest_form_step_2['dc:title'] = $this->randomName(32); $ingest_form_step_2['dc:description'] = $this->randomName(256); - $ingest_form_step_2['files[ingest-file-location]'] = realpath(drupal_get_path('module', 'fedora_repository') . '/tests/test_files/lorem_ipsum.pdf'); + $ingest_form_step_2['files[ingest-file-location]'] = realpath(drupal_get_path('module', 'islandora_repository') . '/tests/test_files/lorem_ipsum.pdf'); $this->drupalPost(NULL, $ingest_form_step_2, 'Ingest'); $this->assertText('mimetype (application/pdf) is not associated with this Content Model', 'PDF mime type not accepted in collection content model.', 'message'); - $this->outputScreenContents('Initial ingest form submit step 2', 'fedora_repository'); + $this->outputScreenContents('Initial ingest form submit step 2', 'islandora_repository'); // Now try ingesting a proper collection policy. $ingest_form = array(); @@ -72,9 +72,9 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { $ingest_form_step_2 = array(); $ingest_form_step_2['dc:title'] = $this->randomName(32); $ingest_form_step_2['dc:description'] = $this->randomName(256); - $ingest_form_step_2['files[ingest-file-location]'] = realpath(drupal_get_path('module', 'fedora_repository') . '/collection_policies/PDF-COLLECTION POLICY.xml'); + $ingest_form_step_2['files[ingest-file-location]'] = realpath(drupal_get_path('module', 'islandora_repository') . '/collection_policies/PDF-COLLECTION POLICY.xml'); $this->drupalPost(NULL, $ingest_form_step_2, 'Ingest'); - //$this->outputScreenContents('Initial ingest form submit step 2 - PDF collection', 'fedora_repository'); + //$this->outputScreenContents('Initial ingest form submit step 2 - PDF collection', 'islandora_repository'); $this->assertPattern('/Item .* created successfully./', "Verified item created."); $pid = $this->getIngestedPid(); @@ -88,7 +88,7 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { $ingest_form_step_2 = array(); $ingest_form_step_2['dc:title'] = "Lorem Ipsum"; $ingest_form_step_2['dc:description'] = $this->randomName(256); - $ingest_form_step_2['files[ingest-file-location]'] = realpath(drupal_get_path('module', 'fedora_repository') . '/tests/test_files/lorem_ipsum.pdf'); + $ingest_form_step_2['files[ingest-file-location]'] = realpath(drupal_get_path('module', 'islandora_repository') . '/tests/test_files/lorem_ipsum.pdf'); $this->drupalPost(NULL, $ingest_form_step_2, 'Ingest'); $pid = $this->getIngestedPid(); $pid_list[] = $pid; @@ -104,7 +104,7 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { $admin_tester = $this->drupalCreateUser(array('administer site configuration', 'view fedora collection')); $this->drupalLogin($admin_tester); - $pageContent = $this->drupalGet('admin/settings/fedora_repository'); + $pageContent = $this->drupalGet('admin/settings/islandora_repository'); $hasOption = preg_match('/Enforce namespace restrictions/', $pageContent); @@ -115,13 +115,13 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { $this->pass('Removal of namespace restrictions is enabled'); $inVal['fedora_namespace_restriction_enforced'] = TRUE; $inVal['fedora_pids_allowed'] = 'simpletest:'; - $this->drupalPost('admin/settings/fedora_repository', $inVal, 'Save configuration'); + $this->drupalPost('admin/settings/islandora_repository', $inVal, 'Save configuration'); $this->assertPattern('/The configuration options have been saved./', 'The configuration options have been saved.'); $this->drupalGet('fedora/repository/islandora:largeimages/'); $this->assertPattern('/Access denied/', 'No access to Large image Collection Collection'); $inVal['fedora_namespace_restriction_enforced'] = 0; - $this->drupalPost('admin/settings/fedora_repository', $inVal, 'Save configuration'); + $this->drupalPost('admin/settings/islandora_repository', $inVal, 'Save configuration'); $this->assertPattern('/The configuration options have been saved./', 'The configuration options have been saved.'); $this->drupalLogin($this->repository_user); $this->drupalGet('fedora/repository/islandora:largeimages/'); From 0a45be6b3d78af6daeaaae342e23851f0dfbc15e Mon Sep 17 00:00:00 2001 From: Ben Woodhead <bwoodhead@upei.ca> Date: Tue, 11 Oct 2011 10:22:44 -0300 Subject: [PATCH 3/6] Renamed the files --- digital_repository.info | 9 - digital_repository.install | 107 -- digital_repository.module | 2251 -------------------------- digital_repository.solutionpacks.inc | 175 -- plugins/fedora_imageapi.info | 7 - plugins/fedora_imageapi.module | 116 -- 6 files changed, 2665 deletions(-) delete mode 100644 digital_repository.info delete mode 100644 digital_repository.install delete mode 100644 digital_repository.module delete mode 100644 digital_repository.solutionpacks.inc delete mode 100644 plugins/fedora_imageapi.info delete mode 100644 plugins/fedora_imageapi.module diff --git a/digital_repository.info b/digital_repository.info deleted file mode 100644 index 20ff4d30..00000000 --- a/digital_repository.info +++ /dev/null @@ -1,9 +0,0 @@ -; $Id$ -name = Digital Repository -dependencies[] = imageapi -dependencies[] = tabs -dependencies[] = islandora_content_model_forms -description = Shows a list of items in a fedora collection. -package = Islandora -version = 11.2.beta1 -core = 6.x diff --git a/digital_repository.install b/digital_repository.install deleted file mode 100644 index 164ce02e..00000000 --- a/digital_repository.install +++ /dev/null @@ -1,107 +0,0 @@ -<?php - -/** - * @file fedora_repository.install - */ - -/** - * Implementation of hook_enable(). - */ -function fedora_collections_enable() { - //nothing to do as we do not currently touch the drupal database. - //other than the variables table -} - -/** - * Implementation of hook_requirements(). - * - * @return - * An array describing the status of the site regarding available updates. - * If there is no update data, only one record will be returned, indicating - * that the status of core can't be determined. If data is available, there - * will be two records: one for core, and another for all of contrib - * (assuming there are any contributed modules or themes enabled on the - * site). In addition to the fields expected by hook_requirements ('value', - * 'severity', and optionally 'description'), this array will contain a - * 'reason' attribute, which is an integer constant to indicate why the - * given status is being returned (UPDATE_NOT_SECURE, UPDATE_NOT_CURRENT, or - * UPDATE_UNKNOWN). This is used for generating the appropriate e-mail - * notification messages during update_cron(), and might be useful for other - * modules that invoke update_requirements() to find out if the site is up - * to date or not. - * - * @see _update_message_text() - * @see _update_cron_notify() - */ -function fedora_repository_requirements($phase) { - global $base_url; - - $requirements = array(); - - if ($phase == 'install') { - - // Test for SOAP - $requirements['fedora-soap']['title'] = t("PHP SOAP extension library"); - if (!class_exists('SoapClient')) { - $requirements['fedora-soap']['value'] = t("Not installed"); - $requirements['fedora-soap']['severity'] = REQUIREMENT_ERROR; - $requirements['fedora-soap']['description'] = t('Ensure that the PHP SOAP extension is installed.'); - } - else { - $requirements['fedora-soap']['value'] = t("Installed"); - $requirements['fedora-soap']['severity'] = REQUIREMENT_OK; - } - - // Test for Curl - $requirements['curl']['title'] = "PHP Curl extension library"; - if (!function_exists('curl_init')) { - $requirements['curl']['value'] = t("Not installed"); - $requirements['curl']['severity'] = REQUIREMENT_ERROR; - $requirements['curl']['description'] = t("Ensure that the PHP Curl extension is installed."); - } - else { - $requirements['curl']['value'] = t("Installed"); - $requirements['curl']['severity'] = REQUIREMENT_OK; - } - - // Test for DOM - $requirements['dom']['title'] = "PHP DOM XML extension library"; - if (!method_exists('DOMDocument', 'loadHTML')) { - $requirements['dom']['value'] = t("Not installed"); - $requirements['dom']['severity'] = REQUIREMENT_ERROR; - $requirements['dom']['description'] = t("Ensure that the PHP DOM XML extension is installed."); - } - else { - $requirements['dom']['value'] = t("Installed"); - $requirements['dom']['severity'] = REQUIREMENT_OK; - } - - // Test for XSLT - $requirements['xsl']['title'] = "PHP XSL extension library"; - if (!class_exists('XSLTProcessor')) { - $requirements['xslt']['value'] = t("Not installed"); - $requirements['xslt']['severity'] = REQUIREMENT_ERROR; - $requirements['xslt']['description'] = t("Ensure that the PHP XSL extension is installed."); - } - else { - $requirements['xslt']['value'] = t("Installed"); - $requirements['xslt']['severity'] = REQUIREMENT_OK; - } - } - elseif ($phase == 'runtime') { - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - - $requirements['fedora-repository']['title'] = t("Fedora server"); - if (!fedora_available()) { - $requirements['fedora-repository']['value'] = t("Not available"); - $requirements['fedora-repository']['severity'] = REQUIREMENT_ERROR; - $requirements['fedora-repository']['description'] = t('Ensure that Fedora is running and that the <a href="@collection-settings">collection settings</a> are correct.', array('@collection-settings' => $base_url . '/admin/settings/fedora_repository')); - } - else { - $requirements['fedora-repository']['value'] = t("Available"); - $requirements['fedora-repository']['severity'] = REQUIREMENT_OK; - } - } - - return $requirements; -} diff --git a/digital_repository.module b/digital_repository.module deleted file mode 100644 index ea1c15c5..00000000 --- a/digital_repository.module +++ /dev/null @@ -1,2251 +0,0 @@ -<?php - -/** - * Drupal hook for admin form - * fedora_repository_name is the name of the top level collection this module will query - * fedora_repository_pid is the name of the top level pid. - * Stores this info in the drupal variables table. - * the name and pid can also be passed as url parameters - */ -function fedora_repository_admin() { - module_load_include('inc', 'fedora_repository', 'formClass'); - $adminForm = new formClass(); - return $adminForm->createAdminForm(); -} - -/** - * drupal hook - * calls the fedora_repositorys_admin form - */ -function fedora_repository_menu() { - module_load_include('inc', 'fedora_repository', 'formClass'); - $adminMenu = new formClass(); - return $adminMenu->createMenu(); -} - -/** - * drupal hook to show help - * - * @param type $path - * @param type $arg - * @return type - */ -function fedora_repository_help($path, $arg) { - switch ($path) { - case 'admin/modules#description' : - return t('Grabs a list of items from a collection in Drupal that are presented on the home page.'); - case 'node/add#fedora_repository' : - return t('Use this page to grab a list of items from a Fedora collection.'); - } -} - -/** - * fedora repository purge object - * @param type $pid - * @param type $name - * @return type - */ -function fedora_repository_purge_object($pid = NULL, $name = NULL) { - if (!user_access('purge objects and datastreams')) { - drupal_set_message(t('You do not have access to add a datastream to this object.'), 'error'); - return ''; - } - if ($pid == NULL) { - drupal_set_message(t('You must specify an object pid to purge an object.'), 'error'); - return ''; - } - $output = t('Are you sure you wish to purge object %name %pid!<br /><b>This cannot be undone</b><br />', - array( - '%name' => $name, - '%pid' => $pid) - ); - - $output .= drupal_get_form('fedora_repository_purge_object_form', $pid); - return $output; -} - -/** - * fedora repository collection view - * @global type $user - * @param type $pid - * @param type $collection - * @param type $pageNumber - * @return type - */ -function fedora_repository_collection_view($pid = NULL, $collection = NULL, $pageNumber = NULL) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - global $user; - if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { - drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied."), 'error'); - return ' '; - } - - $objectHelper = new ObjectHelper(); - if ($pid == NULL) { - $pid = variable_get('fedora_repository_pid', 'islandora:root'); - } - - $content = ''; - - module_load_include('inc', 'fedora_repository', 'CollectionClass'); - $collectionClass = new CollectionClass(); - $results = $collectionClass->getRelatedItems($pid, NULL); - $content .= $objectHelper->parseContent($results, $pid, $dsId, $collection, $pageNumber); - - return $content; -} - -/** - * fedora repository ingest object - * @param type $collection_pid - * @param type $collection_label - * @param type $content_model - * @return type - */ -function fedora_repository_ingest_object($collection_pid=NULL, $collection_label = NULL, $content_model = NULL) { - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - if (!user_access('ingest new fedora objects')) { - drupal_set_message(t('You do not have permission to ingest.'), 'error'); - return ''; - } - - if (!valid_pid($collection_pid)) { - if (valid_pid(urldecode($collection_pid))) { - $collection_pid = urldecode($collection_pid); - } - else { - drupal_set_message(t("This collection PID $collection_pid is not valid"), 'error'); - return ' '; - } - } - - if ($collection_pid == NULL) { - drupal_set_message(t('You must specify a collection object pid to ingest an object.'), 'error'); - return ''; - } - $output = drupal_get_form('fedora_repository_ingest_form', $collection_pid, $collection_label, $content_model); - - $breadcrumbs = array(); - $objectHelper = new ObjectHelper(); - $objectHelper->getBreadcrumbs($collection_pid, $breadcrumbs); - drupal_set_breadcrumb(array_reverse($breadcrumbs)); - - return $output; -} - -/** - * fedora repository ingest form submit - * @global type $base_url - * @global type $user - * @param array $form - * @param array $form_state - */ -function fedora_repository_ingest_form_submit(array $form, array &$form_state) { -//only validate the form if the submit button was pressed (other buttons may be used for AHAH - if ($form_state['storage']['xml']) { - if (module_exists('islandora_content_model_forms')) { - module_load_include('inc', 'islandora_content_model_forms', 'IngestObjectMetadataForm'); - $xml_form = new IngestObjectMetadataForm(); - $xml_form->submit($form, $form_state); - } - } - else if ($form_state['clicked_button']['#id'] == 'edit-submit') { - global $base_url; - module_load_include('inc', 'fedora_repository', 'CollectionClass'); - module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); - module_load_include('inc', 'fedora_repository', 'ContentModel'); - - $contentModelPid = ContentModel::getPidFromIdentifier($form_state['values']['models']); - $contentModelDsid = ContentModel::getDSIDFromIdentifier($form_state['values']['models']); - $err = TRUE; - $redirect = TRUE; - if (($cp = CollectionPolicy::loadFromCollection($form_state['values']['collection_pid'])) !== FALSE) { - $relationship = $cp->getRelationship(); - - if (($cm = ContentModel::loadFromModel($contentModelPid, $contentModelDsid)) !== FALSE) { - $pid = $cp->getNextPid($contentModelDsid); - global $user; - $form_state['values']['user_id'] = $user->name; - $form_state['values']['pid'] = $pid; - $form_state['values']['content_model_pid'] = $contentModelPid; - $form_state['values']['relationship'] = $relationship; - - $err = (!$cm->execFormHandler($form_state['values'], $form_state)); - - $_SESSION['fedora_ingest_files'] = ''; //empty this variable - - $attr = $cm->getIngestFormAttributes(); - $redirect = $attr['redirect']; - - if ($redirect) { - $form_state['storage'] = NULL; - } - } - } - - if ($redirect) { - $form_state['redirect'] = ($err) ? ' ' : $base_url . "/fedora/repository/{$form_state['values']['collection_pid']}"; - } - } -} - -/** - * fedora repository ingest form validate - * @param type $form - * @param type $form_state - * @return type - */ -function fedora_repository_ingest_form_validate($form, &$form_state) { -//only validate the form if the submit button was pressed (other buttons may be used for AHAH - if ($form_state['clicked_button']['#id'] == 'edit-submit') { - switch ($form_state['storage']['step']) { - case 1: - $form_state['storage']['step']++; - $form_state['rebuild'] = TRUE; - break; - - case 2: -// XML based form. - if ($form_state['storage']['xml']) { - module_load_include('inc', 'xml_form_api', 'XMLForm'); - $xml_form = new XMLForm($form_state); - $xml_form->validate($form, $form_state); - } -// Get the uploaded file. - $validators = array(); - - if (!empty($_FILES['files']['name']['ingest-file-location'])) { - $fileObject = file_save_upload('ingest-file-location', $validators); - - file_move($fileObject->filepath, 0, 'FILE_EXISTS_RENAME'); - $form_state['values']['ingest-file-location'] = $fileObject->filepath; - } - - if (isset($form_state['values']['ingest-file-location']) && file_exists($form_state['values']['ingest-file-location'])) { - module_load_include('inc', 'fedora_repository', 'ContentModel'); - module_load_include('inc', 'fedora_repository', 'MimeClass'); - - $file = $form_state['values']['ingest-file-location']; - - $contentModelPid = ContentModel::getPidFromIdentifier($form_state['values']['models']); - $contentModelDsid = ContentModel::getDSIDFromIdentifier($form_state['values']['models']); - - if (($cm = ContentModel::loadFromModel($contentModelPid, $contentModelDsid)) !== FALSE) { - $allowedMimeTypes = $cm->getMimetypes(); - - $mimetype = new MimeClass(); - $dformat = $mimetype->getType($file); - - if (!empty($file)) { - if (!in_array($dformat, $allowedMimeTypes)) { - form_set_error('ingest-file-location', t('The uploaded file\'s mimetype (' . $dformat . ') is not associated with this Content Model. The allowed types are ' . - implode(' ', $allowedMimeTypes))); - file_delete($file); - return; - } - elseif (!$cm->execIngestRules($file, $dformat)) { - drupal_set_message(t('Error following Content Model Rules'), 'error'); - foreach (ContentModel::$errors as $err) { - drupal_set_message($err, 'error'); - } - } - } - } - } - $form_state['rebuild'] = FALSE; - break; - } - } -} - -/** - * fedora repository ingest form - * @param type $form_state - * @param type $collection_pid - * @param type $collection_label - * @param type $content_model - * @return type - */ -function fedora_repository_ingest_form(&$form_state, $collection_pid, $collection_label = NULL, $content_model = NULL) { - module_load_include('inc', 'fedora_repository', 'formClass'); -// For the sake of easily maintaining the module in different core versions create our own form_values variable. - if (empty($form_state['storage']['step'])) { - $form_state['storage']['step'] = 1; - } - $ingestForm = new formClass(); - $form_state['storage']['content_model'] = $content_model; - $form_state['storage']['collection_pid'] = $collection_pid; - return $ingestForm->createIngestForm($collection_pid, $collection_label, $form_state); -} - -/** - * fedora repository purge object form - * @global type $base_url - * @param type $form_state - * @param type $pid - * @param type $referrer - * @return type - */ -function fedora_repository_purge_object_form(&$form_state, $pid, $referrer = NULL) { - global $base_url; - if (!user_access('purge objects and datastreams')) { - return NULL; - } - if ($pid == NULL) { - return NULL; - } - $form['pid'] = array( - '#type' => 'hidden', - '#value' => "$pid" - ); - if (!strstr(drupal_get_destination(), urlencode('fedora/repository'))) { - $form['referrer'] = array( - '#type' => 'hidden', - '#value' => $referrer, - ); - } - if (!isset($form_state['storage']['confirm'])) { -// do your normal $form definition here - - - $form['submit'] = array( - '#type' => 'image_button', - '#src' => drupal_get_path('module', 'fedora_repository') . '/images/purge_big.png', - '#value' => t('Purge'), - '#suffix' => 'Purge this object', - ); - if (!empty($collectionPid)) { - $collectionPid = $_SESSION['fedora_collection']; - } -//$form['#redirect'] = $referrer; - - return $form; - } - else { -// ALSO do $form definition here. Your final submit handler (after user clicks Yes, I Confirm) will only see $form_state info defined here. Form you create here passed as param1 to confirm_form - - return confirm_form($form, 'Confirm Purge Object', $referrer, 'Are you sure you want to delete this object? This action cannot be undone.', 'Delete', 'Cancel'); //Had better luck leaving off last param 'name' - } - return $form; -} - -/** - * add stream - * @param type $collection_pid - * @param type $collectionName - * @return type - */ -function add_stream($collection_pid=NULL, $collectionName=NULL) { - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - if (!valid_pid($collection_pid)) { - drupal_set_message(t("This PID is not valid!"), 'error'); - return ' '; - } - if (!user_access('ingest new fedora objects')) { - drupal_set_message(t('You do not have permission to ingest.'), 'error'); - return ''; - } - if ($collection_pid == NULL) { - drupal_set_message(t('You must specify an collection object pid to ingest an object.'), 'error'); - return ''; - } - $output .= drupal_get_form('fedora_repository_add_stream_form', $pid); - - return $output; -} - -/** - * add stream form submit - * @global type $base_url - * @param type $form - * @param type $form_state - * @return type - */ -function add_stream_form_submit($form, &$form_state) { - global $base_url; - if (!empty($form_state['submit']) && $form_state['submit'] == 'OK') { - $form_state['rebuild'] = TRUE; - return; - } - module_load_include('inc', 'fedora_repository', 'MimeClass'); - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $pathToModule = drupal_get_path('module', 'fedora_repository'); - - $file = $form_state['values']['add-stream-file-location']; - - $pid = $form_state['values']['pid']; - $dsid = $form_state['values']['stream_id']; - $dsLabel = $form_state['values']['stream_label'] . substr($file, strrpos($file, '.')); // Add the file extention to the end of the label.; - $file_basename = basename($file); - $file_directory = dirname($file); - $streamUrl = $base_url . '/' . $file_directory . '/' . drupal_urlencode($file_basename); - - /* ----------------------------------------------------------------- - * need a better way to get mimetypes - */ - $mimetype = new MimeClass(); - $dformat = $mimetype->getType($file); - $controlGroup = "M"; - if ($dformat == 'text/xml') { - $controlGroup = 'X'; - } - try { - $item = new Fedora_Item($pid); - $item->add_datastream_from_url($streamUrl, $dsid, $dsLabel, $dformat, $controlGroup); - - $object_helper = new ObjectHelper(); - $object_helper->get_and_do_datastream_rules($pid, $dsid, $file); - - file_delete($file); - } catch (exception $e) { - drupal_set_message(t($e->getMessage()), 'error'); - return; - } - $form_state['rebuild'] = TRUE; -} - -/** - * add stream form - * @param type $form_state - * @param type $pid - * @return type - */ -function add_stream_form(&$form_state, $pid) { - module_load_include('inc', 'fedora_repository', 'formClass'); - $addDataStreamForm = new formClass(); - return $addDataStreamForm->createAddDataStreamForm($pid, $form_state); -} - -/** - * add stream form validate - * @param type $form - * @param type $form_state - * @return type - */ -function add_stream_form_validate($form, &$form_state) { - if ($form_state['clicked_button']['#value'] == 'OK') { - $form_state['rebuild'] = TRUE; - return; - } - $dsid = $form_state['values']['stream_id']; - $dsLabel = $form_state['values']['stream_label']; - if (strlen($dsid) > 64) { - form_set_error('', t('Data stream ID cannot be more than 64 characters.')); - return FALSE; - } - if (!(preg_match("/^[a-zA-Z]/", $dsid))) { - form_set_error('', t("Data stream ID ($dsid) has to start with a letter.")); - return FALSE; - } - if (strlen($dsLabel) > 64) { - form_set_error('', t('Data stream Label cannot be more than 64 characters.')); - return FALSE; - } - if (strpos($dsLabel, '/')) { - form_set_error('', t('Data stream Label cannot contain a "/".')); - return FALSE; - } - $validators = array( - // 'file_validate_is_image' => array(), - // 'file_validate_image_resolution' => array('85x85'), - // 'file_validate_size' => array(30 * 1024), - ); - - $fileObject = file_save_upload('add-stream-file-location', $validators); - -// Move the uploaded file to Drupal's files directory. - file_move($fileObject->filepath, 0, 'FILE_EXISTS_RENAME'); - $form_state['values']['add-stream-file-location'] = $fileObject->filepath; -// TODO: Add error checking here. - $form_state['rebuild'] = FALSE; -} - -/** - * fedora repository purge stream - * @global type $user - * @param type $pid - * @param type $dsId - * @param type $name - * @return type - */ -function fedora_repository_purge_stream($pid = NULL, $dsId = NULL, $name = NULL) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - global $user; - if ($pid == NULL || $dsId == NULL) { - drupal_set_message(t('You must specify an object pid and DataStream ID to purge a datastream'), 'error'); - return ' '; - } - if (!fedora_repository_access(OBJECTHELPER :: $PURGE_FEDORA_OBJECTSANDSTREAMS, $pid, $user)) { - drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or you do not have permission to purge objects."), 'error'); - return ' '; - } - - $output = t('Are you sure you wish to purge this datastream %name<br />', - array( - '%name' => $name) - ); - $output .= drupal_get_form('fedora_repository_purge_stream_form', $pid, $dsId); - return $output; -} - -/** - * fedora repository purge object form submit - * @param type $form - * @param type $form_state - * @return type - */ -function fedora_repository_purge_object_form_submit($form, &$form_state) { - module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); - $pid = $form_state['values']['pid']; - if (!isset($form_state['storage']['confirm'])) { - $form_state['storage']['confirm'] = TRUE; // this will cause the form to be rebuilt, entering the confirm part of the form - $form_state['rebuild'] = TRUE; // along with this - } - else { -// this is where you do your processing after they have pressed the confirm button - $params = array( - "pid" => $pid, - "logMessage" => "Purged", - "force" => "" - ); - try { - $soapHelper = new ConnectionHelper(); - $client = $soapHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); - $object = $client->__soapCall('purgeObject', array($params)); - unset($form_state['storage']['confirm']); - } catch (exception $e) { - if (preg_match('/org\.fcrepo\.server\.security\.xacml\.pep\.AuthzDeniedException/', $e->getMessage())) { - drupal_set_message(t('Error: Insufficient permissions to purge object.'), 'error'); - } - else { - drupal_set_message(t($e->getMessage()), 'error'); - } - return; - } - if (!empty($form_state['values']['referrer'])) { - $form_state['redirect'] = $form_state['values']['referrer']; - } - elseif (empty($collectionPid) && !empty($_SESSION['fedora_collection']) && $_SESSION['fedora_collection'] != $pid) { - $collectionPid = $_SESSION['fedora_collection']; - - $form_state['redirect'] = "fedora/repository/$collectionPid/"; - } - else { - $form_state['redirect'] = 'fedora/repository/'; - } - } -} - -/** - * fedora repository purge stream form - * @param type $form_state - * @param type $pid - * @param type $dsId - * @return type - */ -function fedora_repository_purge_stream_form(&$form_state, $pid, $dsId) { - $form['pid'] = array( - '#type' => 'hidden', - '#value' => "$pid" - ); - $form['dsid'] = array( - '#type' => 'hidden', - '#value' => "$dsId" - ); - $form['submit'] = array( - '#type' => 'submit', - '#value' => t('Purge') - ); - - return $form; -} - -/** - * fedora repository purge stream form submit - * @global type $base_url - * @param type $form - * @param array $form_state - */ -function fedora_repository_purge_stream_form_submit($form, &$form_state) { - global $base_url; - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); -//$client = getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); - $pid = $form_state['values']['pid']; - $item = new Fedora_Item($pid); - $dsid = $form_state['values']['dsid']; - try { - $item->purge_datastream($dsid); - } catch (exception $e) { - drupal_set_message(t($e->getMessage()), 'error'); - } - $form_state['redirect'] = $base_url . "/fedora/repository/$pid"; -} - -/** - * fedora repository replace stream - * @param type $pid - * @param type $dsId - * @param type $dsLabel - * @param type $collectionName - * @return type - */ -function fedora_repository_replace_stream($pid, $dsId, $dsLabel, $collectionName = NULL) { - if ($pid == NULL || $dsId == NULL) { - drupal_set_message(t('You must specify an pid and dsId to replace.'), 'error'); - return ''; - } - $output = drupal_get_form('fedora_repository_replace_stream_form', $pid, $dsId, $dsLabel); - - return $output; -} - -/** - * fedora repository replace stream form - * @param type $form_state - * @param type $pid - * @param type $dsId - * @param type $dsLabel - * @return type - */ -function fedora_repository_replace_stream_form(&$form_state, $pid, $dsId, $dsLabel) { -//module_load_module_load_include('hp', ''Fedora_Repository'', 'config', 'fedora_repository', ''); - module_load_include('inc', 'Fedora_Repository', 'formClass'); -//$client = getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); - $replaceDataStreamForm = new formClass(); - return $replaceDataStreamForm->createReplaceDataStreamForm($pid, $dsId, $dsLabel, $form_state); -} - -/** - * fedora repository replace stream form validate - * @param type $form - * @param type $form_state - * @return type - */ -function fedora_repository_replace_stream_form_validate($form, &$form_state) { -// If a file was uploaded, process it. - if (isset($_FILES['files']) && is_uploaded_file($_FILES['files']['tmp_name']['file'])) { - -// attempt to save the uploaded file - $file = file_save_upload('file', array(), file_directory_path()); - -// set error is file was not uploaded - if (!$file) { - form_set_error('file', 'Error uploading file.'); - return; - } - - $doc = new DOMDocument(); - module_load_include('inc', 'Fedora_Repository', 'MimeClass'); - $mime = new MimeClass(); - if ($mime->getType($file->filepath) == 'text/xml' && !$doc->load($file->filepath)) { - form_set_error('file', 'Invalid XML format.'); - return; - } - -// set files to form_state, to process when form is submitted - $form_state['values']['file'] = $file; - } -} - -/** - * fedora repository replace stream form submit - * @global type $base_url - * @param type $form - * @param array $form_state - */ -function fedora_repository_replace_stream_form_submit($form, &$form_state) { - global $base_url; - $file = $form_state['values']['file']; - $pid = $form_state['values']['pid']; - $dsid = $form_state['values']['dsId']; - $dsLabel = $form_state['values']['dsLabel']; - // Remove the original file extension from the label and add the new one - $indexOfDot = strrpos($dsLabel, '.'); //use strrpos to get the last dot - if ($indexOfDot !== FALSE) { - $dsLabel = substr($dsLabel, 0, $indexOfDot); - $dsLabel .= substr($file->filename, strrpos($file->filename, '.')); // Add the file extention to the end of the label.; - } - module_load_include('inc', 'Fedora_Repository', 'MimeClass'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - - $file_basename = basename($file->filepath); - $file_directory = dirname($file->filepath); - $streamUrl = $base_url . '/' . $file_directory . '/' . urlencode($file_basename); - - /* ----------------------------------------------------------------- - * TODO: need a better way to get mimetypes - */ - $mimetype = new MimeClass(); - $dformat = $mimetype->getType($file->filepath); - - $item = new Fedora_Item($pid); - - $item->modify_datastream_by_reference($streamUrl, $dsid, $dsLabel, $dformat); - - $form_state['redirect'] = 'fedora/repository/' . $pid; -} - -/** - * fedora repository edit qdc page - * @global type $user - * @param type $pid - * @param type $dsId - * @return type - */ -function fedora_repository_edit_qdc_page($pid = NULL, $dsId = NULL) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - global $user; - if ($pid == NULL || $dsId == NULL) { - drupal_set_message(t('You must specify an object pid and a Dublin Core DataStream ID to edit metadata'), 'error'); - return ' '; - } - if (!fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $pid, $user)) { - drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or you do not have permission to edit meta data for this object."), 'error'); - return ' '; - } - $output = drupal_get_form('fedora_repository_edit_qdc_form', $pid, $dsId); - - return $output; -} - -/** - * fedora repository edit qdc form - * @global type $user - * @param type $form_state - * @param type $pid - * @param type $dsId - * @return type - */ -function fedora_repository_edit_qdc_form(&$form_state, $pid, $dsId = NULL) { - module_load_include('inc', 'fedora_repository', 'ContentModel'); - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - if ($pid == NULL) { - drupal_set_message(t('You must specify an object pid!'), 'error'); - } - global $user; - if (!fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $pid, $user)) { - drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or you do not have permission to edit meta data for this object."), 'error'); - return ' '; - } - - module_load_include('inc', 'fedora_repository', 'formClass'); - module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); - $soapHelper = new ConnectionHelper(); - $client = $soapHelper->getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); -// Check if there is a custom edit metadata function defined in the content model. - - $breadcrumbs = array(); - $objectHelper = new ObjectHelper(); - $objectHelper->getBreadcrumbs($pid, $breadcrumbs); - drupal_set_breadcrumb(array_reverse($breadcrumbs)); - - - $output = ''; - if (($cm = ContentModel::loadFromObject($pid)) !== FALSE) { - $output = $cm->buildEditMetadataForm($pid, $dsId); - } - - if (empty($output)) { -// There is no custom function, so just load the standard QDC form. - $metaDataForm = new formClass(); -//currently we only edit the dc metadata. If you defined a custom form with a custom handler you are sol for now. - return $metaDataForm->createMetaDataForm($pid, $dsId, $client, $form_state); - } - return $output; -} - -/** - * fedora repository edit qdc form validate - * @param type $form - * @param boolean $form_state - */ -function fedora_repository_edit_qdc_form_validate($form, &$form_state) { - if ($form_state['storage']['xml']) { - if ($form_state['storage']['step'] == 1) { - $form_state['storage']['step']++; - $form_state['rebuild'] = TRUE; - } - module_load_include('inc', 'xml_form_api', 'XMLForm'); - $xml_form = new XMLForm($form_state); - $xml_form->validate($form, $form_state); - } -} - -/** - * Check if there is a custom edit metadata function defined in the content model. If so, - * call it, if not do the submit action for the standard QDC metadata. Custom forms will - * need to implement their own equivalent to the FormClass->updateMetaData function - * - * @param array $form - * @param array $form_state - * @return - */ -function fedora_repository_edit_qdc_form_submit($form, &$form_state) { - if ($form_state['storage']['xml']) { - module_load_include('inc', 'islandora_content_model_forms', 'EditObjectMetadataForm'); - $xml_form = new EditObjectMetadataForm($form_state); - $xml_form->submit($form, $form_state); - } - else { - module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); - global $base_url; - if (strstr($form_state['clicked_button']['#id'], 'edit-submit')) { - -//$client = getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); - $soap_helper = new ConnectionHelper(); - $client = $soap_helper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); - -// Check the content model for a custom edit metadata form submit function. - if (isset($form_state['values']['pid'])) { - module_load_include('inc', 'fedora_repository', 'ContentModel'); - if (($cm = ContentModel::loadFromObject($form_state['values']['pid'])) !== FALSE) { - return $cm->handleEditMetadataForm($form_state['values']['form_id'], $form_state, $client); - } - } - - module_load_include('inc', 'fedora_repository', 'formClass'); - $metaDataForm = new formClass(); - $return_value = $metaDataForm->updateMetaData($form_state['values']['form_id'], $form_state['values'], $client); - $form_state['storage'] = NULL; - $form_state['redirect'] = $base_url . '/fedora/repository/' . $form_state['values']['pid']; - - return $return_value; - } - } -} - -/** - * drupal hook - * creates a new permission than can be assigned to roles - */ -function fedora_repository_perm() { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - return array( - OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, - OBJECTHELPER::$EDIT_FEDORA_METADATA, - OBJECTHELPER::$PURGE_FEDORA_OBJECTSANDSTREAMS, - OBJECTHELPER::$ADD_FEDORA_STREAMS, - OBJECTHELPER::$INGEST_FEDORA_OBJECTS, - OBJECTHELPER::$EDIT_TAGS_DATASTREAM, - OBJECTHELPER::$VIEW_DETAILED_CONTENT_LIST, - OBJECTHELPER::$MANAGE_COLLECTIONS, - OBJECTHELPER::$DELETE_ENTIRE_COLLECTIONS, - OBJECTHELPER::$CREATE_BATCH_PROCESS, - ); -} - -/** - * drupal hook - * determines if a user has access to what they are asking for - * - * @param type $op - * @param type $node - * @param type $account - * @return type - */ -function fedora_repository_access($op, $node, $account) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - $objectHelper = new ObjectHelper(); - return $objectHelper->fedora_repository_access($op, $node, $account); -} - -/** - * Grabs a stream from fedora sets the mimetype and returns it. $dsID is the - * datastream id. - * @param $pid String - * @param $dsID String - */ -function makeObject($pid, $dsID) { - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - if (!valid_pid($pid)) { - drupal_set_message(t("Invalid PID!"), 'error'); - return ' '; - } - - if (!valid_dsid($dsID)) { - drupal_set_message(t("Invalid dsID!"), 'error'); - return ' '; - } - - if ($pid == NULL || $dsID == NULL) { - drupal_set_message(t("No pid or dsid given to create an object with.")); - return ' '; - } - global $user; - if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { - drupal_access_denied(); - return; - drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace."), 'error'); - return ' '; - } - - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - $objectHelper = new ObjectHelper(); - $objectHelper->makeObject($pid, $dsID); -} - -/** - * Sends an ITQL query to the Fedora Resource index (can only communicate with Kowari or mulgara) - * Reads the pid and datastream id as url parameters. Queries the collection object for the query - * if there is no query datastream falls back to the query shipped with the module. - * - * @global type $user - * @param type $pid - * @param type $dsId - * @param type $collection - * @param type $page_number - * @param type $limit - * @return type - */ -function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NULL, $page_number = NULL, $limit = NULL) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - global $user; - - if (!fedora_available()) { - drupal_set_message(t('The Fedora repository server is currently unavailable. Please contact the site administrator.'), 'warning', FALSE); - return ''; - } - - if (!risearch_available()) { - drupal_set_message(t('The Fedora resource index search is currently unavailable. Please contact the site administrator.'), 'warning', FALSE); - return ''; - } - - if ($pid == NULL) { - $pid = variable_get('fedora_repository_pid', 'islandora:root'); - } - - $item = new fedora_item($pid); - if (!$item->exists()) { - drupal_not_found(); - exit(); - } - - if ($pid & !valid_pid($pid)) { - drupal_set_message(t("Invalid PID!"), 'error'); - return ' '; - } - - if ($dsId & !valid_dsid($dsId)) { - drupal_set_message(t("Invalid dsID!"), 'error'); - return ' '; - } - if (!fedora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { - if (user_access('access administration pages')) { - drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed !here", array('!here' => l('here', 'admin/settings/fedora_repository'))), 'warning'); - } - drupal_access_denied(); - exit; - return ' '; - } - - $objectHelper = new ObjectHelper(); - if ($pid == NULL) { - $pid = variable_get('fedora_repository_pid', 'islandora:root'); - } - $headers = module_invoke_all('file_download', "/fedora/repository/$pid"); - if (in_array(-1, $headers)) { - drupal_access_denied(); - exit; - return ' '; - } - if ($dsId != NULL && $dsId != '-') { //if we have a dsID return the stream otherwise query for a collection of objects -//probably should check pid as well here. - return makeObject($pid, $dsId); - } - - $content = '<div id="content-fedora">'; - - module_load_include('inc', 'fedora_repository', 'CollectionClass'); - $collectionClass = new CollectionClass(); - module_load_include('inc', 'fedora_repository', 'ContentModel'); - module_load_include('inc', 'fedora_repository', 'plugins/FedoraObjectDetailedContent'); - $breadcrumbs = array(); - $objectHelper->getBreadcrumbs($pid, $breadcrumbs); - drupal_set_breadcrumb(array_reverse($breadcrumbs)); - - $offset = $limit * $page_number; - $content_models = $objectHelper->get_content_models_list($pid); -// Each content model may return either a tabset array or plain HTML. If it's HTML, stick it in a tab. - $cmodels_tabs = array( - '#type' => 'tabset', - ); - foreach ($content_models as $content_model) { - $content_model_fieldset = $content_model->displayExtraFieldset($pid, $page_number); - if (is_array($content_model_fieldset)) { - $cmodels_tabs = array_merge($cmodels_tabs, $content_model_fieldset); - } - else { - $cmodels_tabs[$content_model->pid] = array( - '#type' => 'tabpage', - '#title' => $content_model->name, - '#content' => $content_model_fieldset, - ); - } - } -// Add a 'manage object' tab for all objects, where detailed list of content is shown. - $obj = new FedoraObjectDetailedContent($pid); - $object_details = $obj->showFieldSets(); - if ($object_details['fedora_object_details']['#selected'] == true){ - foreach($cmodels_tabs as $cmodel_tab){ - if (is_array($cmodel_tab)){ - $cmodel_tab['#selected'] = FALSE; - } - - } - } - $cmodels_tabs = array_merge($cmodels_tabs, $object_details); - - - return tabs_render($cmodels_tabs); -} - -/** - * fedora repository urlencode string - * @param type $str - * @return type - */ -function fedora_repository_urlencode_string($str) { - return htmlentities($str); -} - -/** - * Uses makeobject to get a stream. Sets the Content Disposition in the header so it suggests a filename - * and sends it as an attachment. This should prompt for a download of the object. - * - * @global type $user - * @param type $pid - * @param type $dsId - * @param type $label - * @param type $version - * @return type - */ -function fedora_object_as_attachment($pid, $dsId, $label=NULL, $version=NULL) { - global $user; - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - - if ($pid == NULL || $dsId == NULL) { - drupal_set_message(t("no pid or dsid given to create an object with!")); - return ' '; - } - - $objectHelper = new ObjectHelper(); - $objectHelper->makeObject($pid, $dsId, 1, $label, FALSE, $version); -} - -/** - * repository page - * @param type $pid - * @param type $dsId - * @param type $collection - * @param type $pageNumber - * @return type - */ -function repository_page($pid = NULL, $dsId = NULL, $collection = NULL, $pageNumber = NULL) { -//do security check at fedora_repository_get_items function as it has to be called there in case -//someone trys to come in a back door. - return fedora_repository_get_items($pid, $dsId, $collection, $pageNumber); -} - -/** - * repository service - * @global type $user - * @param type $pid - * @param type $servicePid - * @param type $serviceMethod - * @return type - */ -function repository_service($pid = NULL, $servicePid = NULL, $serviceMethod = NULL) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - global $user; - - if (!fedora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { -//drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied"), 'error'); - drupal_access_denied(); - if (user_access('access administration pages')) { - drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed !here", array('!here' => l('here', 'admin/settings/fedora_repository'))), 'error'); - } - return ' '; - } - if ($pid == NULL) { - $pid = variable_get('fedora_repository_pid', 'islandora:root'); - } - $headers = module_invoke_all('file_download', "/fedora/repository/$pid"); - if (in_array(-1, $headers)) { - drupal_access_denied(); - exit; - return ' '; - } - - - $item = new Fedora_Item($pid); - if ($item !== FALSE) { - echo $item->get_dissemination($servicePid, $serviceMethod); - } - - exit(); -} - -//Search Stuff ******************************************************************** - -/** - * Implementation of hook_search(). - * sends a search query to fedora fgsearch which is backed by Lucene - * In our implementation of Fedora we have api-a and api-m locked down - * to authorized users but at the object level. We can query Lucene and the - * RI index to get a list of results without authorization but to view any - * datastreams users must be authorized. - * - * @param type $op - * @param type $keys - * @return array - */ -function fedora_repository_search($op = 'search', $keys = NULL) { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - - switch ($op) { - case 'name': - if (user_access('view fedora collection')) { - return t('Digital Repository', array('-9')); - } - case 'search': - if (user_access('view fedora collection')) { -//demo search string ?operation=gfindObjects&indexName=DemoOnLucene&query=fgs.DS.first.text%3Achristmas&hitPageStart=11&hitPageSize=10 - $resultData = NULL; - $numberOfHitsPerPage = NULL; - $index = strpos($keys, '.'); - $test = substr($keys, 0, $index + 1); - $type = NULL; - if ($index > 0) { - $index = strpos($keys, ':'); - $type = substr($keys, 0, $index); - $keys = substr($keys, $index + 1); - } - - $index = strpos($keys, ':'); - $startPage = substr($keys, 0, $index); - if ($index > 1) { - $keys = substr($keys, $index + 1); - } - - if (!$startPage) { - $startPage = 1; - } - - $xmlDoc = NULL; - - $path = drupal_get_path('module', 'fedora_repository'); - $xmlDoc = new DomDocument(); - $xmlDoc->load($path . '/searchTerms.xml'); - $nodeList = $xmlDoc->getElementsByTagName('default'); - if (!$type) { -//$type = 'dc.description'; - $type = $nodeList->item(0)->nodeValue; - } - $nodeList = $xmlDoc->getElementsByTagName('number_of_results'); - $numberOfHitsPerPage = $nodeList->item(0)->nodeValue; - - $indexName = variable_get('fedora_index_name', 'DemoOnLucene'); - $keys = htmlentities(urlencode($keys)); - $searchQuery = NULL; - if (isset($type) && strcmp($type, ':')) { - $searchQuery = $type . ':' . $keys; - } - else { - $searchQuery = $keys; - } -//$searchQuery.=" AND (PID:vre OR PID:vre:ref OR PID:demo OR PID:changeme)"; - - $searchUrl = variable_get('fedora_fgsearch_url', 'http://localhost:8080/fedoragsearch/rest'); - $searchString = '?operation=gfindObjects&indexName=' . $indexName . '&restXslt=copyXml&query=' . $searchQuery; - $searchString .= '&hitPageSize=' . $numberOfHitsPerPage . '&hitPageStart=' . $startPage; -//$searchString = htmlentities(urlencode($searchString)); - $searchUrl .= $searchString; - $objectHelper = new ObjectHelper(); - $resultData = do_curl($searchUrl); - - $results[] = array( - array( - 'data' => $resultData, - 'colspan' => 2 - ) - ); - return $results; - } - } // switch ($op) -} - -/** - * Implementation of hook_search_page(). - * Display the search results - * - * @param type $resultData - * @return array - */ -function fedora_repository_search_page($resultData) { - $path = drupal_get_path('module', 'fedora_repository'); - $isRestricted = variable_get('fedora_namespace_restriction_enforced', TRUE); - $proc = NULL; - if (!$resultData[0][0]['data']) { - return ''; //no results - } - $text = utf8_encode($resultData[0][0]['data']); - - try { - $proc = new XsltProcessor(); - } catch (Exception $e) { - $out[] = array( - array( - 'data' => $e->getMessage(), - 'colspan' => 2 - ) - ); - return $out; - } - -//inject into xsl stylesheet - $proc->setParameter('', 'searchToken', drupal_get_token('search_form')); //token generated by Drupal, keeps tack of what tab etc we are on - $proc->setParameter('', 'searchUrl', url('search') . '/fedora_repository'); //needed in our xsl - $proc->setParameter('', 'objectsPage', base_path()); - $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); - $proc->registerPHPFunctions(); - $xsl = new DomDocument(); - if ($isRestricted) { - $xsl->load($path . '/xsl/results.xsl'); - } - else { - $xsl->load($path . '/xsl/unfilteredresults.xsl'); - } - - $input = new DomDocument(); - $didLoadOk = $input->loadXML(utf8_encode($resultData[0][0]['data'])); - - if (!$didLoadOk) { - $results[] = array( - array( - 'data' => 'Error parsing results', - 'colspan' => 2 - ) - ); - } - else { - $xsl = $proc->importStylesheet($xsl); - $newdom = $proc->transformToDoc($input); - - $results[] = array( - array( - 'data' => $newdom->saveHTML(), - 'colspan' => 2 - ) - ); - } - - $header = array( - array( - 'data' => t('Collection results'), - NULL, - ), - (NULL) - ); - - $output .= theme('table', $header, $results); - return $output; -} - -/** - * Implementation of hook_form_alter(). - * allows the advanced search form in drupal - * - * @param type $form - * @param type $form_state - * @param type $form_id - */ -function fedora_repository_form_alter(&$form, &$form_state, $form_id) { -// Advanced node search form - module_load_include('inc', 'fedora_repository', 'SearchClass'); - $path = drupal_get_path('module', 'fedora_repository'); - if ($form_id == 'search_form' && arg(1) == 'fedora_repository' && user_access('use advanced search')) { - $default_value = $form['basic']['inline']['keys']['#default_value']; - $index = strpos($default_value, '.'); - $test = substr($default_value, 0, $index + 1); - $type = NULL; - if ($index > 0) { - $index = strpos($default_value, ':'); - $type = substr($default_value, 0, $index); - $default_value = substr($default_value, $index + 1); - } - $form['basic']['inline']['keys']['#default_value'] = $default_value; -// Keyword boxes: - $form['advanced'] = array( - '#type' => 'fieldset', - '#title' => t('Advanced search'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - '#attributes' => array( - 'class' => 'search-advanced' - ), - ); - $form['advanced']['keywords'] = array( - '#prefix' => '<div class="criterion">', - '#suffix' => '</div>', - ); - $xmlDoc = new DomDocument(); - $xmlDoc->load($path . '/searchTerms.xml'); - $nodeList = $xmlDoc->getElementsByTagName('term'); - $searchClass = new SearchClass(); - $types = $searchClass->get_search_terms_array(); - - $form['advanced']['type'] = array( - '#type' => 'select', - '#title' => t('Choose a field to search'), - '#prefix' => '<div class="criterion">', '#suffix' => '</div>', '#options' => $types, - '#default_value' => $type, - ); - $form['advanced']['submit'] = array( - '#type' => 'submit', - '#value' => t('Advanced search'), - '#prefix' => '<div class="action clear-block">', '#suffix' => '</div>', - ); - $form['#validate'][] = 'fedora_repository_search_validate'; - } -} - -/** - * Implementation of hook_search_validate() - * - * @param type $form - * @param type $form_state - */ -function fedora_repository_search_validate($form, &$form_state) { -// Initialise using any existing basic search keywords. - $keys = $form_state['values']['processed_keys']; - - if (isset($form_state['values']['type'])) { - $type = $form_state['values']['type']; - if ($type) { - $keys = $type . ':' . $keys; - } - } - - if (!empty($keys)) { - form_set_value($form['basic']['inline']['processed_keys'], trim($keys), $form_state); //set the form string - } -} - -/** - * fedora repository theme - * @return type - */ -function fedora_repository_theme() { - return array( - 'fedora_repository_mnpl_advanced_search_form' => array( - 'arguments' => array( - 'form' => NULL, - ), - ), - 'fedora_repository_time' => array( - 'arguments' => array( - 'element' => NULL - ), - 'fedora_repository_solution_packs_list' => array( - 'arguments' => array( - 'solution_packs' => NULL, - ), - ), - ), - ); -} - -/** - * Get a list of terms from a lucene index - * - * @param type $field - * @param type $startTerm - * @param type $displayName - * @return type - */ -function fedora_repository_list_terms($field, $startTerm = NULL, $displayName = NULL) { - module_load_include('inc', 'fedora_repository', 'SearchClass'); - $searchClass = new SearchClass(); - return $searchClass->getTerms($field, $startTerm, $displayName); -} - -/** - * fedora repository mnpl advanced search form - * @return type - */ -function fedora_repository_mnpl_advanced_search_form() { - module_load_include('inc', 'fedora_repository', 'SearchClass'); - $searchClass = new SearchClass(); - return $searchClass->build_advanced_search_form(); -} - -/** - * theme fedora repository mnpl advanced search form - * @param type $form - * @return type - */ -function theme_fedora_repository_mnpl_advanced_search_form($form) { - module_load_include('inc', 'fedora_repository', 'SearchClass'); - $advanced_search_form = new SearchClass(); - return $advanced_search_form->theme_advanced_search_form($form); -} - -/** - * fedora repository mnpl advanced search - * @param type $query - * @param type $startPage - * @return type - */ -function fedora_repository_mnpl_advanced_search($query, $startPage = 1) { - module_load_include('inc', 'fedora_repository', 'SearchClass'); - $searchClass = new SearchClass(); - $retVal = $searchClass->custom_search($query, $startPage); - return $searchClass->custom_search($query, $startPage); -} - -/** - * fedora repository mnpl_advanced search form submit - * @param type $form - * @param type $form_state - */ -function fedora_repository_mnpl_advanced_search_form_submit($form, &$form_state) { - $type_id = $form_state['values']['type']; - $repeat = variable_get('fedora_repository_advanced_block_repeat', t('3')); - $searchString = $form_state['values']['type1'] . ':' . $form_state['values']['fedora_terms1']; - if ($form_state['values']['fedora_terms2'] != '') { - $searchString .=' +' . $form_state['values']['andor1'] . '+' . $form_state['values']['type2'] . ':' . $form_state['values']['fedora_terms2']; - } - if ($repeat > 2 && $repeat < 9) { - for ($i = 3; $i < $repeat + 1; $i++) { - $t = $i - 1; - if ($form_state['values']["fedora_terms$i"] != '') { - $searchString .= '+' . $form_state['values']["andor$t"] . '+' . $form_state['values']["type$i"] . ':' . $form_state['values']["fedora_terms$i"]; - } - } - } - drupal_goto("fedora/repository/mnpl_advanced_search/$searchString"); -} - -/** - * fedora repository install demo page - * @return type - */ -function fedora_repository_install_demos_page() { - $output = drupal_get_form('fedora_repository_demo_objects_form'); - return $output; -} - -/** - * fedora repository demo objects form - * @return string - */ -function fedora_repository_demo_objects_form() { - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $form = array(); - $existing_demos = array(); - - $form['install_demos'] = array( - '#title' => t('Islandora Demo Collections'), - '#type' => 'fieldset', - '#description' => t('Install demo image and document collections and content models.'), - ); - $demo_objects = array(); -// Check if the top-level islandora collection exists. If not, display a button to ingest. - - $form['install_demos']['demo_collections'] = array( - '#type' => 'checkboxes', - '#title' => t('Collections to ingest'), - '#options' => array(), - '#description' => t('Choose which demo collections you would like ingested into the repository.'), - ); - - foreach (array( - 'islandora:collectionCModel' => 'Islandora default content models', - 'islandora:root' => 'Islandora top-level collection', - 'islandora:demos' => 'Islandora demos collection', - 'islandora:largeimages' => 'Sample large image content model (requires <a href="http://sourceforge.net/projects/djatoka/">Djatoka</a> and <a href="http://www.kakadusoftware.com/index.php?option=com_content&task=view&id=26&Itemid=22">Kakadu</a>.)', - ) - as $available_demo => $available_demo_desc) { - try { - $demo_objects[$available_demo] = new Fedora_Item($available_demo); - } catch (exception $e) { - - } - - if (empty($demo_objects[$available_demo]->objectProfile)) { -//The demo objects collection does not exist in the repository, display a button to ingest them. - $form['install_demos']['demo_collections']['#options'][$available_demo] = $available_demo_desc; - } - else { - array_push($existing_demos, $demo_objects[$available_demo]); - } - } - -// Check if the SmileyStuff collectoin exists, and if it has a COLLECTION_VIEW datastream. If it doesn't then we can add it. - - $smiley_stuff = new Fedora_Item('demo:SmileyStuff'); - if (!empty($smiley_stuff->objectProfile)) { - $datastreams_list = $smiley_stuff->get_datastreams_list_as_array(); - if (empty($datastreams_list['COLLECTION_VIEW'])) { - $form['install_demos']['demo_collections']['#options']['demo:SmileyStuff'] = 'Add Islandora Collection View to Fedora Smiley Stuff Collection'; - } - else { - $demo_objects['demo:SmileyStuff'] = $smiley_stuff; - } - } - else { - $form['install_demos']['smileynote'] = array( - '#value' => '<p>If you install the ' . l('fedora demo objects', 'https://wiki.duraspace.org/display/FCR30/Demonstration+Objects') . ' Islandora can display them as a collection.</p>' - ); - } - - $form['install_demos']['ingest'] = array( - '#type' => 'submit', - '#name' => 'install_demos', - '#value' => 'Install Selected Demos', - '#disabled' => (empty($form['install_demos']['demo_collections']['#options'])) ? TRUE : FALSE, - ); - - $form['existing_demos'] = array( - '#prefix' => '<p>Demo collections already installed in this repository:</p><ul>', - '#suffix' => '</ul>', - ); - - if (!empty($existing_demos)) { - foreach ($existing_demos as $pid => $demo_object) { - - $form['existing_demos'][$demo_object->pid] = array( - '#prefix' => '<li>', - '#value' => l($demo_object->pid, $demo_object->url()), - '#suffix' => '</li>', - ); - } - } - - return $form; -} - -/** - * fedora repository demo objects form submit - * @global type $base_url - * @param type $form - * @param type $form_state - */ -function fedora_repository_demo_objects_form_submit($form, &$form_state) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'api/dublin_core'); - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - global $base_url; - if ($form_state['clicked_button']['#name'] == 'install_demos') { - if (!empty($form_state['values']['demo_collections']['islandora:collectionCModel'])) { - try { - $collectioncm = Fedora_Item::ingest_new_item('islandora:collectionCModel', 'A', 'Islandora Collection Content Model'); - $collectioncm->add_relationship('hasModel', 'fedora-system:ContentModel-3.0', FEDORA_MODEL_URI); - $collectioncm->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/content_models/COLLECTIONCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); - } catch (exception $e) { - - } - try { - $strictpdfcm = Fedora_Item::ingest_new_item('islandora:strict_pdf', 'A', 'Strict PDF Content Model'); - $strictpdfcm->add_relationship('hasModel', 'fedora-system:ContentModel-3.0', FEDORA_MODEL_URI); - $strictpdfcm->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/content_models/STRICT_PDFCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); - } catch (exception $e) { - - } - -// Install a collection object that points to all content model objects - try { - $cmodel_collection_xml = Fedora_Item::create_object_FOXML('islandora:ContentModelCollection'); - $cmodel_collection = Fedora_Item::ingest_from_FOXML($cmodel_collection_xml); - -//$dc = new Dublin_Core(new Fedora_Item('islandora:ContentModelCollection')); - $dc = new Dublin_Core($cmodel_collection); - $dc->set_element('dc:title', array('Installed Content Model')); - $dc->save(); - $cmodel_collection->add_datastream_from_string('select $object $title from <#ri> - where ($object <dc:title> $title - and ($object <fedora-model:hasModel> <info:fedora/fedora-system:ContentModel-3.0> - or $object <fedora-rels-ext:isMemberOfCollection> <info:fedora/islandora:ContentModelsCollection>) - and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>) - order by $title', 'QUERY', 'Content Model Collection Query', 'text/plain'); - $cmodel_collection->add_relationship('isMemberOfCollection', 'islandora:root'); - $cmodel_collection->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); - $cmodel_collection->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_views/simple_list_view.xml', 'COLLECTION_VIEW', 'Collection View', 'text/xml', 'X'); - $cmodel_collection->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/contentModel.jpg', 'TN', 'Thumbnail', 'image/jpg', 'M'); - drupal_set_message(t("Successfully installed <a href=\"" . $base_url . "/fedora/repository/islandora:ContentModelCollection\">islandora:ContentModelCollection</a>."), 'message'); - } catch (exception $e) { - - } - } - - if (!empty($form_state['values']['demo_collections']['islandora:root'])) { - $new_item = Fedora_Item::ingest_new_item('islandora:root', 'A', 'Islandora Top-level Collection'); - $new_item->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); - $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_policies/COLLECTION-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); - try { - $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); - drupal_set_message(t("Successfully installed <a href=\"" . $base_url . "/fedora/repository/islandora:root\">islandora:root</a>."), 'message'); - } catch (exception $e) { - - } - } - - if (!empty($form_state['values']['demo_collections']['islandora:demos'])) { - $new_item = fedora_item::ingest_new_item('islandora:demos', 'A', 'Islandora Demo Collection'); - $new_item->add_relationship('isMemberOfCollection', 'islandora:root'); - $new_item->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); - $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_policies/COLLECTION-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); - -// $cv = $new_item->add_datastream_from_file( drupal_get_path('module', 'fedora_repository') . '/collection_views/COLLECTION_VIEW.xml', 'COLLECTION_VIEW', 'Collection View.xml', 'text/xml', 'X'); - $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); - try { - $new_item = Fedora_Item::ingest_new_item('islandora:pdf_collection', 'A', 'PDF Collection'); - $new_item->add_relationship('isMemberOfCollection', 'islandora:demos'); - $new_item->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); - $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_policies/PDF-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); - $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Crystal_Clear_mimetype_pdf.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); - drupal_set_message(t("Successfully installed <a href=\"" . $base_url . "/fedora/repository/islandora:demos\">islandora:demos</a>."), 'message'); - } catch (exception $e) { - - } - } - - if (!empty($form_state['values']['demo_collections']['demo:SmileyStuff'])) { - $smiley_stuff = new Fedora_Item('demo:SmileyStuff'); - $new_item = $smiley_stuff->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_views/SmileyStuff-COLLECTION_VIEW.xml', 'COLLECTION_VIEW', 'Collection View', 'text/xml', 'X'); - $smiley_stuff->add_relationship('isMemberOfCollection', 'info:fedora/islandora:demos'); - $tn = $smiley_stuff->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/smileytn.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); - $cp = $smiley_stuff->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_policies/JPG-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy.xml', 'application/xml', 'X'); - - $cm = new Fedora_Item('demo:DualResImage'); - try { - $cmstream = $cm->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/content_models/STANDARD JPG.xml', 'ISLANDORACM', 'Content Model.xml', 'application/xml', 'X'); - } catch (exception $e) { - - } - $dual_res_image_collection_cmodel = new Fedora_Item('demo:DualResImageCollection'); - try { - $cmstream = $dual_res_image_collection_cmodel->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/content_models/COLLECTIONCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); - drupal_set_message(t("Successfully installed <a href=\"" . $base_url . "/fedora/repository/demo:SmileyStuff\">demo:SmileyStuff</a> collection view."), 'message'); - } catch (exception $e) { - - } - } - - if (!empty($form_state['values']['demo_collections']['islandora:largeimages'])) { - $error = ''; - foreach (array('islandora_jp2Sdep-slideCModel.xml', 'islandora_mods2htmlSdef.xml', 'islandora_mods2htmlSdep.xml', - 'islandora_slideCModel.xml', 'islandora_viewerSdep-slideCModel.xml', 'ilives_jp2Sdef.xml', 'ilives_viewerSdef.xml') as $foxml_file) { - try { - $item = Fedora_Item::ingest_from_FOXML_file(drupal_get_path('module', 'fedora_repository') . '/content_models/' . $foxml_file); - } catch (exception $e) { - $error .= " - Problem ingesting $foxml_file"; - } - } - try { - $item = Fedora_Item::ingest_from_FOXML_file(drupal_get_path('module', 'fedora_repository') . '/content_models/islandora_largeimages.xml'); - $tn = $item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); - drupal_set_message(t("Successfully installed <a href=\"" . $base_url . "/fedora/repository/islandora:largeimages\">islandora:largeimages</a>."), 'message'); - } catch (exception $e) { - $error .= " - Problem ingesting islandora:largeimages collection"; - } - } - - if (!empty($error)) { - drupal_set_message(t('Some problems occurred: ' . $error)); - } - } -} - -/** - * fedora repository required fedora objects - * @return type - */ -function fedora_repository_required_fedora_objects() { -// array( 'path-to-foxml-file', 'pid', 'dsid', 'path-to-datastream-file', int dsversion, boolean required) - $module_path = drupal_get_path('module', 'fedora_repository'); - return array( - 'fedora_repository' => array( - 'module' => 'fedora_repository', - 'title' => 'Islandora Core', - 'objects' => array( - array( - 'pid' => 'islandora:collectionCModel', - 'label' => 'Islandora Collection Content Model', - 'dsid' => 'ISLANDORACM', - 'datastream_file' => "$module_path/content_models/COLLECTIONCM.xml", - 'dsversion' => 2, - 'cmodel' => 'fedora-system:ContentModel-3.0', - ), - - array( - 'pid' => 'islandora:root', - 'label' => 'Islandora Top-level Collection', - 'cmodel' => 'islandora:collectionCModel', - 'datastreams' => array( - array( - 'dsid' => 'COLLECTION_POLICY', - 'datastream_file' => "$module_path/collection_policies/COLLECTION-COLLECTION POLICY.xml", - ), - array( - 'dsid' => 'TN', - 'datastream_file' => "$module_path/images/Gnome-emblem-photos.png", - 'mimetype' => 'image/png', - ), - ), - ), - ), - ), - ); -} - -/** - * Functions to create a time selector form element type. - */ -function fedora_repository_elements() { - $type['fedora_repository_time'] = array( - "#input" => TRUE, - "#process" => array("fedora_repository_expand_time"), - ); - - return $type; -} - -/** - * fedora repository expand time - * @param type $element - * @return string - */ -function fedora_repository_expand_time($element) { -// Default to current time, check default_value but set value so that if -// default value is present it will override value - if (empty($element['#default_value'])) { - $element['#value'] = array( - 'hour' => intval(format_date(time(), 'custom', 'h')), - 'minute' => intval(format_date(time(), 'custom', 'i')), - ); - } - - $element['#tree'] = TRUE; - - foreach ($element['#value'] as $type => $value) { - switch ($type) { - case 'hour': - $options = drupal_map_assoc(range(1, 24)); - break; - case 'minute': - $options = range(0, 59); - break; - } - - if ($type != 'meridiem') { - foreach ($options as $option) { - strlen($option) <= 1 ? $options[$option] = 0 . $option : ''; - } - } - - $element[$type] = array( - '#type' => 'select', - '#default_value' => $element['#value'][$type], - '#options' => $options, - ); - } - - return $element; -} - -/** - * fedora repository time - * @param type $element - * @return type - */ -function fedora_repository_time($element) { - $output = '<div class="container-inline">' . $element['#children'] . '</div>'; - return theme('form_element', $element, $output); -} - -/** - * theme fedora repository time - * @param type $element - * @return type - */ -function theme_fedora_repository_time($element) { - $output = '<div class="container-inline">' . $element['#children'] . '</div>'; - return theme('form_element', $element, $output); -} - -/* Export (basket) functionality */ - -/** - * fedora repository remove item from basket - * @param type $pid - */ -function fedora_repository_remove_item_from_basket($pid) { - - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - $pids = empty($_SESSION['basket']['processed']) ? array() : $_SESSION['basket']['processed']; - - $objectHelper = new ObjectHelper(); -// getting child PIDs if any - $cpids = $objectHelper->get_child_pids(array($pid)); - - if (array_key_exists($pid, $pids)) { -// remove item from basket - unset($_SESSION['basket']['processed'][$pid]); - } - if (!empty($cpids)) { // there are children - foreach ($cpids as $child_pid => $value) { -// remove child item from basket recursively - fedora_repository_remove_item_from_basket($child_pid); - } - } -} - -/** - * fedora repository basket - * @return type - */ -function fedora_repository_basket() { - $pids = _fedora_repository_get_basket_pids(); - $output = drupal_get_form('fedora_repository_basket_form', $pids); - - return $output; -} - -function fedora_repository_basket_form($form_state, $pids) { - $form = array(); - - if (!empty($pids)) { - $form['pid'] = array(); - $form['title'] = array(); - $form['desc'] = array(); - } - else { - return; - } - - ksort($pids); - foreach ($pids as $pid => $arr) { - $cbs[$pid] = ''; - - $form['pid'][$pid] = array('#value' => l($pid, "fedora/repository/$pid")); - $form['title'][$pid] = array('#value' => $arr['title']); - $form['desc'][$pid] = array('#value' => $arr['desc']); - } - - $form['remove'] = array( - '#type' => 'checkboxes', - '#options' => $cbs, - ); - - $form['remove_submit'] = array( - '#type' => 'submit', - '#value' => t('Remove selected'), - ); - - $form['remove_all'] = array( - '#type' => 'submit', - '#value' => t('Empty basket'), - ); - - $form['submit'] = array( - '#type' => 'submit', - '#value' => t('Export selected'), - ); - - $form['submit_all'] = array( - '#type' => 'submit', - '#value' => t('Export all'), - ); - - return $form; -} - -/** - * theme fedora repository basket form - * @param type $form - * @return string - */ -function theme_fedora_repository_basket_form($form) { - $header = array( - theme('table_select_header_cell'), - t('PID'), - t('Title'), - t('Description'), - ); - - if (isset($form['pid']) && is_array($form['pid'])) { - foreach (element_children($form['pid']) as $key) { - $rows[] = array( - drupal_render($form['remove'][$key]), - drupal_render($form['pid'][$key]), - drupal_render($form['title'][$key]), - drupal_render($form['desc'][$key]), - ); - } - } - else { - $rows[] = array(array('data' => t('Your basket is empty.'), 'colspan' => '4')); - } - - $output = theme('table', $header, $rows); - - $frm = drupal_render($form); - $output = $frm . $output . $frm; - - return $output; -} - -/** - * fedora repository basket form validate - * @param type $form - * @param type $form_state - */ -function fedora_repository_basket_form_validate($form, &$form_state) { - -} - -/** - * fedora repository basket form submit - * @global type $user - * @param type $form - * @param type $form_state - * @return type - */ -function fedora_repository_basket_form_submit($form, &$form_state) { - if ($form_state['values']['op'] == $form_state['values']['remove_submit']) { - $pids = $form_state['clicked_button']['#post']['remove']; - - if (isset($pids)) { - foreach ($pids as $pid) { - fedora_repository_remove_from_basket($pid); - } - drupal_set_message(t("Selected objects removed")); - return; - } - } - - if ($form_state['values']['op'] == $form_state['values']['remove_all']) { - _fedora_repository_empty_basket(); - drupal_set_message(t("Basket emptied")); - return; - } - - if ($form_state['values']['op'] == $form_state['values']['submit_all']) { - $msg = t("All objects exported to staging area"); - $pids = _fedora_repository_get_basket_pids(); - } - elseif ($form_state['values']['op'] == $form_state['values']['submit']) { - $msg = t("Selected objects exported to staging area"); - $pids = array_filter($form_state['values']['remove']); - } - - if (!empty($pids)) { - global $user; - $log = array(); - $success = TRUE; - $export_dir = variable_get('export_area', file_directory_path() . '/fedora_export_area') . '/' . $user->name . '/' . date("Ymd-His"); - $foxml_dir = $export_dir . '/foxml'; - - if (!file_exists($foxml_dir) && !@mkdir($foxml_dir, 0775, TRUE)) { - drupal_set_message(t("Failed to create foxml dir %dir. Check that export dir exsits and has correct permissions", array('%dir' => $foxml_dir)), 'error'); - return FALSE; - } - - module_load_include('inc', 'fedora_repository', 'api/fedora_export'); - foreach ($pids as $pid => $arr) { - - $objects_dir = $export_dir . '/objects/' . $pid; - if (!file_exists($objects_dir) && !@mkdir($objects_dir, 0775, TRUE)) { - drupal_set_message(t("Failed to create objects dir %dir. Check that export dir exsits and has correct permissions", array('%dir' => $objects_dir)), 'error'); - return FALSE; - } - - if (!export_to_export_area($pid, $foxml_dir, $objects_dir, $log)) { - $success = FALSE; - } - } - $msg = $success ? $msg : t("Failed to export objects to staging area"); - $msg .= ":<br/>" . implode("<br/>", $log); - - drupal_set_message($msg, $success ? 'info' : 'error'); -//_fedora_repository_empty_basket(); - } - else { - drupal_set_message(t("No objects selected or basket empty"), 'error'); - } - - return; -} - -/** - * Get all pids saved to the basket. - * - * @return type - */ -function _fedora_repository_get_basket_pids() { - -// Set empty defaults if basket elements are missing - $_SESSION['basket'] = isset($_SESSION['basket']) ? $_SESSION['basket'] : array('processed' => array(), 'unprocessed' => array()); - $_SESSION['basket']['processed'] = isset($_SESSION['basket']['processed']) ? $_SESSION['basket']['processed'] : array(); - $_SESSION['basket']['unprocessed'] = isset($_SESSION['basket']['unprocessed']) ? $_SESSION['basket']['unprocessed'] : array(); - - $pids = empty($_SESSION['basket']['processed']) ? array() : $_SESSION['basket']['processed']; - - module_load_include('inc', 'fedora_repository', 'ObjectHelper'); - $ob = new ObjectHelper(); - foreach ($_SESSION['basket']['unprocessed'] as $pid) { -// Check if the pid already exists in the tree - if (array_key_exists($pid, $pids)) { - continue; - } - - $pids += $ob->get_all_related_pids($pid); -// $pids += array($pid); - } - - $_SESSION['basket']['processed'] = $pids; - $_SESSION['basket']['unprocessed'] = array(); - - return $pids; -} - -/** - * fedora repository empty basket - */ -function _fedora_repository_empty_basket() { - unset($_SESSION['basket']); -} - -/** - * fedora repository add to basket - * @param type $pid - * @param type $warn - * @param type $searchResultsFlag - */ -function fedora_repository_add_to_basket($pid, $warn = TRUE, $searchResultsFlag = FALSE) { - if ($warn && _is_added_to_basket($pid)) { - drupal_set_message(t("Object already in basket")); - } - - if (!isset($_SESSION['basket'])) { - $_SESSION['basket'] = array(); - $_SESSION['basket']['unprocessed'] = array($pid => $pid); - } - else { - $_SESSION['basket']['unprocessed'][$pid] = $pid; - } - - if (!$searchResultsFlag) { - drupal_goto('fedora/basket'); - } -} - -/** - * fedora repository remove from basket - * @param type $pid - * @return type - */ -function fedora_repository_remove_from_basket($pid) { - if (isset($_SESSION['basket']['unprocessed'][$pid])) { - unset($_SESSION['basket']['unprocessed'][$pid]); - } - - if (isset($_SESSION['basket']['processed'][$pid])) { - unset($_SESSION['basket']['processed'][$pid]); - } - return; -} - -/** - * theme add to basket link - * @param type $pid - * @param type $type - * @return type - */ -function theme_add_to_basket_link($pid, $type = 'object') { - $object = t($type); - $path = drupal_urlencode($pid); - - $save = "export_big.png"; - $saved = "exported_big.png"; -// $path = drupal_get_path('module', 'Fedora_Repository').'/images/'.$save ; - /* - var_dump($path); - var_dump(theme('image',drupal_get_path('module', 'Fedora_Repository').'/images/'.$save)); - die(); - */ - if (!_is_added_to_basket($pid)) { - return l( - theme('image', drupal_get_path('module', 'Fedora_Repository') . '/images/' . $save, t("Add to basket"), t("Add this @object to my basket", array('@object' => $object))), - "fedora/repository/addToBasket/" . $path, - array('html' => TRUE) - ); - } - - return theme('image', drupal_get_path('module', 'Fedora_Repository') . '/images/' . $saved, t("In basket"), t("This @object is already in your basket", array('@object' => $object))); -} - -/** - * is added to basket - * @param type $pid - * @param type $account - * @return type - */ -function _is_added_to_basket($pid, $account = NULL) { - return isset($_SESSION['basket']['unprocessed'][$pid]) || isset($_SESSION['basket']['processed'][$pid]); -// return db_result(db_query("SELECT uid FROM {repository_basket} WHERE uid = %d AND pid = '%s'", $account->uid, $pid)); -} - -/** - * fedora repository display schema - * @param type $file - * @return type - */ -function fedora_repository_display_schema($file) { - $path = drupal_get_path('module', 'fedora_repository'); - if (strtolower(substr($file, -3)) == 'xsd' && file_exists($path . '/' . $file)) { - drupal_goto($path . '/' . $file); - } - else { - drupal_goto(); - } - return; -} - -/** - * fedora repository batch reingest object - * @param type $object - * @param type $context - * @return type - */ -function fedora_repository_batch_reingest_object($object, &$context) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - if (!empty($object) && is_array($object)) { - $pid = $object['pid']; - if (!valid_pid($pid)) { - return NULL; - } -// Does the object exist? If so, purge it. - $item = new Fedora_Item($pid); - if ($item->exists()) { - $item->purge(t('Remove during re-install batch job')); - } - -// Ingest the object from the source file. - if (!empty($object['foxml_file'])) { - $foxml_file = $object['foxml_file']; - $new_item = Fedora_Item::ingest_from_FOXML_file($foxml_file); - if ($new_item->exists()) { -// Batch operation was successful. - $context['message'][] = "$new_item->pid installed."; - } - } - if (!empty($object['dsid']) && !empty($object['datastream_file'])) { - $datastreams = array( - array( - 'dsid' => $object['dsid'], - 'datastream_file' => $object['datastream_file'], - ) - ); - } - elseif (!empty($object['datastreams'])) { - $datastreams = $object['datastreams']; - } - - if (!empty($datastreams) && is_array($datastreams)) { - $label = !empty($object['label']) ? $object['label'] : ''; - if (empty($object['foxml_file']) && !isset($new_item)) { - $new_item = Fedora_Item::ingest_new_item($object['pid'], 'A', $label); - } - if (!empty($object['cmodel'])) { - $new_item->add_relationship('hasModel', $object['cmodel'], FEDORA_MODEL_URI); - } - if (!empty($object['parent'])) { - $new_item->add_relationship('isMemberOfCollection', $object['parent']); - } - foreach ($datastreams as $ds) { - if ($ds['dsid'] == 'DC') { - $new_item->modify_datastream_by_value(file_get_contents($ds['datastream_file']), $ds['dsid'], $ds['label'], 'text/xml'); - } - else { - $new_item->add_datastream_from_file($ds['datastream_file'], $ds['dsid'], !empty($ds['label']) ? $ds['label'] : '', !empty($ds['mimetype']) ? $ds['mimetype'] : 'text/xml'); - } - } - } - } -} - -/** - * Content model, collection view and collection policy datastreams may now optionally define a version - * number in their top-level XML element as an attribute, as in: - * <content_model name="Collection" version="2" ... - * - * @param Fedora_Item $item - * @param string $dsid - * @param string $datastream_file - * @return int, or NULL if no version attribute was found. - */ -function fedora_repository_get_islandora_datastream_version($item = NULL, $dsid = NULL, $datastream_file = NULL) { - $return = NULL; - if (isset($item)) { - $doc = simplexml_load_string($item->get_datastream_dissemination($dsid)); - } - elseif (isset($datastream_file)) { - $doc = simplexml_load_file($datastream_file); - } - - if (!empty($doc)) { - $attrs = $doc->attributes(); - foreach ($attrs as $name => $value) { - if ($name == 'version') { - $return = (int) $value; - break; - } - } - } - return $return; -} - -/** - * theme fedora repository solution pack list - * @param type $solution_packs - * @return string - */ -function theme_fedora_repository_solution_packs_list($solution_packs) { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - $output = ''; - $header = array(); - $rows = array(); - - - - - drupal_add_css(drupal_get_path('module', 'update') . '/update.css'); - return $output; -} - -/** - * Implementation of hook_forms() - * @param string $form_id - * @return array - */ -function fedora_repository_forms($form_id) { - $forms = array(); - if (strpos($form_id, 'fedora_repository_solution_pack_form_') === 0) { - $forms[$form_id] = array( - 'callback' => 'fedora_repository_solution_pack_form', - ); - } - return $forms; -} diff --git a/digital_repository.solutionpacks.inc b/digital_repository.solutionpacks.inc deleted file mode 100644 index de4ce137..00000000 --- a/digital_repository.solutionpacks.inc +++ /dev/null @@ -1,175 +0,0 @@ -<?php - -/** - * @file - * Invokes a hook to any dependent modules asking them if their installations require - * any fedora objects to be present. Modules implementing this hook should return an array - * of arrays of the form: - * - * array( 'pid', 'path-to-foxml-file', 'dsid', 'path-to-datastream-file', int dsversion) - * - * where the last three options are optional. A module can either point to a simple - * foxml file to install, or can specify a datastreamstream to check for, with a - * path to load the datastream from if it isn't there. Optionally a version number - * can be included, to enable updating of content model or collection policy streams - * that may have been updated. THis is a simple whole number that should be incremented - * when changed. This value appears in as an attribute of the topmost element of the stream, - * e.g.,: - * - * <?xml version="1.0" encoding="utf-8"?> <content_model name="Collection" version="2" ... - * - * Datastreams which don't have this element are assumed to be at version 0. - */ -function fedora_repository_solution_packs_page() { - $enabled_solution_packs = module_invoke_all('required_fedora_objects'); - $output = ''; - foreach ($enabled_solution_packs as $solution_pack_module => $solution_pack_info) { - $objects = array(); - foreach ($solution_pack_info as $field => $value) { - switch ($field) { - case 'title': - $solution_pack_name = $value; - break; - case 'objects': - $objects = $value; - break; - } - } - $output .= drupal_get_form('fedora_repository_solution_pack_form_' . $solution_pack_module, $solution_pack_module, $solution_pack_name, $objects); - } - - return $output; -} - -/** - * Check for installed objects and add a 'Update' or 'Install' button if some objects are missing. - * @param array $solution_pack - */ -function fedora_repository_solution_pack_form(&$form_state, $solution_pack_module, $solution_pack_name, $objects = array()) { - // Check each object to see if it is in the repository. - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - global $base_path; - $needs_update = FALSE; - $needs_install = FALSE; - $form = array(); - $form['solution_pack_module'] = array( - '#type' => 'hidden', - '#value' => $solution_pack_module, - ); - - if (!$form_state['submitted']) { - $form['soluction_pack_name'] = array( - '#type' => 'markup', - '#value' => t($solution_pack_name), - '#prefix' => '<h3>', - '#suffix' => '</h3>', - ); - $form['objects'] = array( - '#type' => 'fieldset', - '#title' => "Objects", - '#weight' => 10, - '#attributes' => array('class' => 'collapsed'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - ); - $table_header = array('PID', 'Status'); - $table_rows = array(); - - - foreach ($objects as $object) { - $datastreams = NULL; - if (isset($object['pid'])) { - $pid = $object['pid']; - - $item = new Fedora_Item($pid); - $table_row = array($object['pid']); - $object_status = t('Up-to-date'); - if (!$item->exists()) { - $object_status = 'Missing'; - $needs_install = TRUE; - } - else { - if (isset($object['dsid']) && isset($object['datastream_file']) && isset($object['dsversion'])) { - $datastreams = array( - array( - 'dsid' => $object['dsid'], - 'datastream_file' => $object['datastream_file'], - 'dsversion' => $object['dsversion'], - ), - ); - } - elseif (!empty($object['datastreams'])) { - $datastreams = $object['datastreams']; - } - if (!empty($datastreams) && is_array($datastreams)) { - foreach ($datastreams as $ds) { - $ds_list = $item->get_datastreams_list_as_array(); - if (!array_key_exists($ds['dsid'], $ds_list)) { - $needs_update = TRUE; - $object_status = 'Missing datastream'; - break; - } - if (isset($ds['dsversion'])) { - // Check if the datastream is versioned and needs updating. - $installed_version = fedora_repository_get_islandora_datastream_version($item, $ds['dsid']); - $available_version = fedora_repository_get_islandora_datastream_version(NULL, NULL, $ds['datastream_file']); - if ($available_version > $installed_version) { - $needs_update = TRUE; - $object_status = 'Out of date'; - break; - } - } - } - } - } - array_push($table_row, $object_status); - $table_rows[] = $table_row; - } - } - $form['objects']['table'] = array( - '#type' => 'markup', - '#value' => theme_table($table_header, $table_rows), - ); - } - - $form['install_status'] = array( - '#type' => 'markup', - '#prefix' => '<strong>' . t('Object status:') . ' </strong>', - '#suffix' => ' ', - ); - if (!$needs_install && !$needs_update) { - $form['install_status']['#value'] = theme_image('misc/watchdog-ok.png') . t('All required objects are installed and up-to-date.'); - } - else { - $form['install_status']['#value'] = theme_image('misc/watchdog-warning.png') . t('Some objects must be re-ingested. See Objects list for details.'); - } - $form['submit'] = array( - '#value' => t('Install'), - '#disabled' => !$needs_install && !$needs_update, - '#type' => 'submit', - '#name' => $solution_pack_module, - ); - - $form['#submit'] = array( - 'fedora_repository_solution_pack_form_submit', - ); - return $form; -} - -function fedora_repository_solution_pack_form_submit($form, &$form_state) { - $what = $form_state; - $module_name = $form_state['values']['solution_pack_module']; - $solution_pack_info = call_user_func($module_name . '_required_fedora_objects'); - $batch = array( - 'title' => t('Installing / updating solution pack objects'), - 'file' => drupal_get_path('module', 'fedora_repository') . '/fedora_repository.module', - 'operations' => array(), - ); - - - foreach ($solution_pack_info[$module_name]['objects'] as $object) { - // Add this object to the batch job queue. - $batch['operations'][] = array('fedora_repository_batch_reingest_object', array($object)); - } - batch_set($batch); -} diff --git a/plugins/fedora_imageapi.info b/plugins/fedora_imageapi.info deleted file mode 100644 index e54e3f05..00000000 --- a/plugins/fedora_imageapi.info +++ /dev/null @@ -1,7 +0,0 @@ -name = Fedora ImageAPI -description = Adds image manipulation support through a REST interface -package = Islandora Dependencies -dependencies[] = fedora_repository -dependencies[] = imageapi -version = 11.2.beta1 -core = 6.x diff --git a/plugins/fedora_imageapi.module b/plugins/fedora_imageapi.module deleted file mode 100644 index f3bd4481..00000000 --- a/plugins/fedora_imageapi.module +++ /dev/null @@ -1,116 +0,0 @@ -<?php - - - -function fedora_imageapi_menu() { - $items = array(); - $items['fedora/imageapi'] = array( - 'title' => t('Image manipulation functions'), - 'page callback' => 'fedora_repository_image_manip', - 'type' => MENU_CALLBACK, - 'access arguments' => array('view fedora collection'), - ); - return $items; -} - -/** - * Call out to the Drupal ImageAPI module and return the resulting image as a stream. - * - * @param string $pid - * @param string $dsid - * @param string $op - * @param string $params - */ -function fedora_repository_image_manip($pid = '', $dsid = '', $op = '', $params = '') { - module_load_include('inc', 'Fedora_Repository', 'ObjectHelper'); - module_load_include('module', 'imageapi'); - $obj = new ObjectHelper(); - $mimetype = $obj->getMimeType($pid, $dsid); - $ext = substr(strstr($mimetype, '/'), 1); - $op = (!empty($_GET['op']) ? $_GET['op'] : ''); - $safe_pid = str_replace(':', '_', $pid); - - $cache_key = 'fedora_repository_image_manip_' . md5($safe_pid . '_' . $dsid . '_' . $ext . '_' . $op . (isset($_GET['width']) ? '_' . $_GET['width'] : '') . (isset($_GET['height']) ? '_' . $_GET['height'] : '')); - if (($file = cache_get($cache_key)) === 0) { - //added the slash as sys_get_temp_dir in linux does not seem to include the slash - $tmp_file_name = sys_get_temp_dir() . '/' . $safe_pid . '_' . $dsid . '.' . $ext; - $handle = fopen($tmp_file_name, "w"); - $numbytes = fwrite($handle, $obj->getStream($pid, $dsid)); - fclose($handle); - if ($numbytes == 0) { - return; - } - - - $image = imageapi_image_open($tmp_file_name); - - switch ($op) { - case 'scale': - if (!empty($_GET['height']) || !empty($_GET['width'])) { - imageapi_image_scale($image, $_GET['width'], $_GET['height']); - } - case 'centerscale': - if (!empty($_GET['height']) && !empty($_GET['width'])) { - imageapi_image_scale_and_crop($image, $_GET['width'], $_GET['height']); - } - } - imageapi_image_close($image); - $file = file_get_contents($tmp_file_name); - cache_set($cache_key, $file, 'cache', time() + variable_get('fedora_image_blocks_cache_time', 3600)); - file_delete($tmp_file_name); - } - else { - $file = $file->data; - } - - - header("Content-type: $mimetype"); - header('Content-Disposition: attachment; filename="' . $dsid . '.' . $ext . '"'); - echo $file; - - -// return "$numbytes bytes written to ".sys_get_temp_dir()."$pid_$dsid.$ext\n"; -} - -/** - * Implementation of hook_form_alter - * - * @param unknown_type $form - * @param unknown_type $form_state - * @param unknown_type $form_id - */ -/* - function fedora_imageapi_form_alter( &$form, $form_state, $form_id) { - - switch ( $form_id ) { - case 'fedora_repository_admin': - - $fedora_base_url = $form['fedora_base_url']['#default_value']; - - $fedora_server_url = substr($fedora_base_url,0,strpos($fedora_base_url,'/',7)); - // Add the Djatoka server location. Set it to default to the same server as fedora. - $form['djatoka_server_url'] = array ( - '#type' => 'textfield', - '#title' => '<h3>'.t('Fedora Image API Module').'</h3><br />'.t('aDORe Djatoka image server resolver URL'), - '#default_value' => variable_get('djatoka_server_url', $fedora_server_url.'/adore-djatoka/resolver' ), - '#description' => t('The location of your <a href="http://african.lanl.gov/aDORe/projects/djatoka/" title="aDORe Djatoka Home Page">aDORe Djatoka</a> image server, if you have one installed.'), - '#weight' => 1, - ); - $form['openlayers_server_url'] = array( - '#type' => 'textfield', - '#title' => t('OpenLayers servlet URL'), - '#default_value' => variable_get('openlayers_server_url', $fedora_server_url.'/islandora/OpenLayers'), - '#description' => t('URL of your installation of the <a href="http://openlayers.org/">OpenLayers</a> servlet, if you have one.'), - '#weight' => 1, - ); - $form['buttons']['#weight'] = 2; - break; - } - } - - function show_openlayers_viewer() { - $output = 'Hi.'; - - return $output; - } - */ From e6e30cb5014d502d957a5d98138dc23e6c7ae6e0 Mon Sep 17 00:00:00 2001 From: Ben Woodhead <bwoodhead@upei.ca> Date: Tue, 11 Oct 2011 11:04:17 -0300 Subject: [PATCH 4/6] Changed the configuration name --- formClass.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/formClass.inc b/formClass.inc index 93b68316..a7abe947 100644 --- a/formClass.inc +++ b/formClass.inc @@ -25,7 +25,7 @@ class formClass { $items = array(); $items['admin/settings/islandora_repository'] = array( - 'title' => t('Configure Islandora'), + 'title' => t('Islandora Configure'), 'description' => t('Enter the Islandora Collection information here'), 'page callback' => 'drupal_get_form', 'page arguments' => array('islandora_repository_admin'), From 2f8563224a220329f5d1d2dfeacb466df67a1546 Mon Sep 17 00:00:00 2001 From: Ben Woodhead <bwoodhead@upei.ca> Date: Tue, 11 Oct 2011 11:09:19 -0300 Subject: [PATCH 5/6] Changed from islandora top to islandora root --- .../foxml/{islandora-top.xml => islandora-root.xml} | 8 ++++---- tests/README_TESTING.txt | 2 +- tests/fedora_repository.test | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) rename installer_files/foxml/{islandora-top.xml => islandora-root.xml} (97%) diff --git a/installer_files/foxml/islandora-top.xml b/installer_files/foxml/islandora-root.xml similarity index 97% rename from installer_files/foxml/islandora-top.xml rename to installer_files/foxml/islandora-root.xml index 5d8c69b3..8c7fa1ac 100644 --- a/installer_files/foxml/islandora-top.xml +++ b/installer_files/foxml/islandora-root.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<foxml:digitalObject PID="islandora:top" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#" +<foxml:digitalObject PID="islandora:root" VERSION="1.1" xmlns:foxml="info:fedora/fedora-system:def/foxml#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd"> <foxml:objectProperties> <foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/> @@ -97,7 +97,7 @@ xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd"> <dc:title>Islandora Top-Level Collection</dc:title> - <dc:identifier>islandora:top</dc:identifier> + <dc:identifier>islandora:root</dc:identifier> </oai_dc:dc> </foxml:xmlContent> </foxml:datastreamVersion> @@ -107,7 +107,7 @@ ID="RELS-EXT.0" LABEL="RDF Statements about this object" MIMETYPE="application/rdf+xml" SIZE="314"> <foxml:xmlContent> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> - <rdf:Description rdf:about="info:fedora/islandora:top"> + <rdf:Description rdf:about="info:fedora/islandora:root"> <hasModel rdf:resource="info:fedora/islandora:collectionCModel" xmlns="info:fedora/fedora-system:def/model#"/> </rdf:Description> </rdf:RDF> @@ -144,7 +144,7 @@ </foxml:datastream> <foxml:datastream CONTROL_GROUP="M" ID="TN" STATE="A" VERSIONABLE="true"> <foxml:datastreamVersion CREATED="2010-10-11T23:08:15.373Z" ID="TN.0" LABEL="Thumbnail.png" MIMETYPE="image/png" SIZE="16243"> - <foxml:contentLocation REF="http://localhost:8080/fedora/get/islandora:top/TN/2010-10-11T23:08:15.373Z" TYPE="INTERNAL_ID"/> + <foxml:contentLocation REF="http://localhost:8080/fedora/get/islandora:root/TN/2010-10-11T23:08:15.373Z" TYPE="INTERNAL_ID"/> </foxml:datastreamVersion> </foxml:datastream> </foxml:digitalObject> diff --git a/tests/README_TESTING.txt b/tests/README_TESTING.txt index a88a244c..f38af855 100644 --- a/tests/README_TESTING.txt +++ b/tests/README_TESTING.txt @@ -5,7 +5,7 @@ Fedora Installation The test sets up the islandora module with the default server settings. This means it will expect a Fedora server to be running on localhost:8080 with the usual defaults. The tests also expect the Islandora demo objects, i.e., -islandora:top, islandora:demos collections, etc. to be installed. (Go to +islandora:root, islandora:demos collections, etc. to be installed. (Go to Administer -> Site Configuration -> Fedora Colleciton List and click the Install Demos tab and follow the instructions.) diff --git a/tests/fedora_repository.test b/tests/fedora_repository.test index 2bfab51f..d5e59bc8 100644 --- a/tests/fedora_repository.test +++ b/tests/fedora_repository.test @@ -45,11 +45,11 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { $pid_list = array(); // Create a collection for ingesting PDF content model objects. - //$this->drupalGet('fedora/ingestObject/islandora:top/Islandora%20Top-Level%20Collection'); + //$this->drupalGet('fedora/ingestObject/islandora:root/Islandora%20Top-Level%20Collection'); $ingest_form = array(); $ingest_form['models'] = 'islandora:collectionCModel/ISLANDORACM'; - $this->drupalPost('fedora/ingestObject/islandora:top/Islandora%20Top-Level%20Collection', $ingest_form, 'Next'); + $this->drupalPost('fedora/ingestObject/islandora:root/Islandora%20Top-Level%20Collection', $ingest_form, 'Next'); // Add a sample PDF object via the web ingest form. // Required fields are file location, dc:title and dc:description @@ -67,7 +67,7 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { $ingest_form = array(); $ingest_form['models'] = 'islandora:collectionCModel/ISLANDORACM'; - $this->drupalPost('fedora/ingestObject/islandora:top/Islandora%20Top-Level%20Collection', $ingest_form, 'Next'); + $this->drupalPost('fedora/ingestObject/islandora:root/Islandora%20Top-Level%20Collection', $ingest_form, 'Next'); // Required fields are file location, dc:title and dc:description $ingest_form_step_2 = array(); $ingest_form_step_2['dc:title'] = $this->randomName(32); From 27d9520519e3ab8115cd97247ef43e106a87084b Mon Sep 17 00:00:00 2001 From: Ben Woodhead <bwoodhead@upei.ca> Date: Tue, 11 Oct 2011 13:34:45 -0300 Subject: [PATCH 6/6] Swiched back to fedora_repository --- BatchIngest.inc | 20 +- CollectionClass.inc | 42 +- CollectionManagement.inc | 24 +- CollectionPolicy.inc | 18 +- ContentModel.inc | 50 +-- ObjectHelper.inc | 68 +-- SearchClass.inc | 30 +- SecurityClass.inc | 2 +- XMLDatastream.inc | 8 +- api/fedora_collection.inc | 14 +- api/fedora_export.inc | 4 +- api/fedora_item.inc | 10 +- api/fedora_utils.inc | 12 +- ..._repository.info => fedora_repository.info | 0 ...itory.install => fedora_repository.install | 8 +- ...ository.module => fedora_repository.module | 388 +++++++++--------- ...inc => fedora_repository.solutionpacks.inc | 20 +- formClass.inc | 78 ++-- islandoracm.xsd | 10 +- plugins/CollectionFormBuilder.inc | 4 +- plugins/DarwinCore.inc | 8 +- plugins/DemoFormBuilder.inc | 6 +- plugins/DocumentConverter.inc | 2 +- plugins/Exiftool.inc | 2 +- plugins/FedoraObjectDetailedContent.inc | 12 +- plugins/Flv.inc | 2 +- plugins/FlvFormBuilder.inc | 6 +- plugins/FormBuilder.inc | 8 +- plugins/ImageManipulation.inc | 2 +- plugins/ModsFormBuilder.inc | 16 +- plugins/PersonalCollectionClass.inc | 2 +- plugins/QtFormBuilder.php | 4 +- plugins/Refworks.inc | 12 +- plugins/ShowStreamsInFieldSets.inc | 18 +- ...ora_imageapi.info => fedora_imageapi.info} | 2 +- ...imageapi.module => fedora_imageapi.module} | 8 +- plugins/herbarium.inc | 28 +- plugins/map_viewer.inc | 10 +- plugins/qt_viewer.inc | 6 +- plugins/slide_viewer.inc | 6 +- plugins/tagging_form.inc | 22 +- tests/README_TESTING.txt | 2 +- tests/fedora_repository.test | 20 +- 43 files changed, 507 insertions(+), 507 deletions(-) rename islandora_repository.info => fedora_repository.info (100%) rename islandora_repository.install => fedora_repository.install (92%) rename islandora_repository.module => fedora_repository.module (81%) rename islandora_repository.solutionpacks.inc => fedora_repository.solutionpacks.inc (84%) rename plugins/{islandora_imageapi.info => fedora_imageapi.info} (82%) rename plugins/{islandora_imageapi.module => fedora_imageapi.module} (89%) diff --git a/BatchIngest.inc b/BatchIngest.inc index f3d63cc0..31daa608 100644 --- a/BatchIngest.inc +++ b/BatchIngest.inc @@ -9,8 +9,8 @@ * @param array $content_models */ function batch_creation_form(&$form_state, $collection_pid, $content_models) { - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); - module_load_include('inc', 'islandora_repository', 'CollectionPolicy'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); $cm_options = array(); $name_mappings = array(); foreach ($content_models as $content_model) { @@ -95,8 +95,8 @@ function batch_creation_form_validate($form, &$form_state) { } function batch_creation_form_submit($form, &$form_state) { - module_load_include('inc', 'islandora_repository', 'ContentModel'); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); global $user; $namespace_mappings = array(); $content_model = $form_state['values']['content_model']; @@ -150,7 +150,7 @@ function batch_creation_form_submit($form, &$form_state) { $batch = array( 'title' => 'Ingesting Objects', 'operations' => array(), - 'file' => drupal_get_path('module', 'islandora_repository') . '/BatchIngest.inc', + 'file' => drupal_get_path('module', 'fedora_repository') . '/BatchIngest.inc', ); @@ -176,8 +176,8 @@ function batch_creation_form_submit($form, &$form_state) { function create_batch_objects($label, $content_model, $object_files, $collection_pid, $namespace, $metadata) { - module_load_include('inc', 'islandora_repository', 'ContentModel'); - module_load_include('inc', 'islandora_repository', 'MimeClass'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'MimeClass'); $cm = ContentModel::loadFromModel($content_model, 'ISLANDORACM'); $allowedMimeTypes = $cm->getMimetypes(); $mime_helper = new MimeClass(); @@ -227,9 +227,9 @@ function create_batch_objects($label, $content_model, $object_files, $collection function batch_create_dc_from_mods($mods_xml) { - $path = drupal_get_path('module', 'islandora_repository'); - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); - module_load_include('inc', 'islandora_repository', 'CollectionClass'); + $path = drupal_get_path('module', 'fedora_repository'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'CollectionClass'); if ($xmlstr == NULL || strlen($xmlstr) < 5) { return " "; diff --git a/CollectionClass.inc b/CollectionClass.inc index df438aca..4251eea4 100644 --- a/CollectionClass.inc +++ b/CollectionClass.inc @@ -29,7 +29,7 @@ class CollectionClass { */ function __construct($pid = NULL) { if (!empty($pid)) { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $this->collectionObject = new ObjectHelper($pid); $this->pid = $pid; } @@ -45,7 +45,7 @@ class CollectionClass { * @return type */ function getRelatedObjects($pid, $limit, $offset, $itqlquery=NULL) { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $objectHelper = new ObjectHelper(); if (!isset($itqlquery)) { // $query_string = $objectHelper->getStream($pid, 'QUERY', 0); @@ -65,8 +65,8 @@ class CollectionClass { * @return type */ function getRelatedItems($pid, $itqlquery = NULL, $limit = NULL, $offset = NULL) { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); if (!isset($limit)) { $limit = 1000; } @@ -74,7 +74,7 @@ class CollectionClass { $offset = 0; } global $user; - if (!islandora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied."), 'error'); return ' '; } @@ -101,7 +101,7 @@ class CollectionClass { $query_string = htmlentities(urlencode($query_string)); $content = ''; - $url = variable_get('islandora_repository_url', 'http://localhost:8080/fedora/risearch'); + $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); $url .= "?type=tuples&flush=TRUE&format=Sparql&limit=$limit&offset=$offset&lang=itql&stream=on&query=" . $query_string; $content .= do_curl($url); @@ -156,7 +156,7 @@ class CollectionClass { * @return type */ function getStream($pid, $dsid, $showError = 1) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $item = new fedora_item($pid); return isset($item->datastreams[$dsid]) ? $item->get_datastream_dissemination($dsid) : NULL; } @@ -223,7 +223,7 @@ class CollectionClass { module_load_include('inc', 'Fedora_Repository', 'ConnectionHelper'); $pidNameSpace = $this->getPidNameSpace($pid, $dsid); $pname = substr($pidNameSpace, 0, strpos($pidNameSpace, ":")); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); return Fedora_Item::get_next_pid_in_namespace($pname); } @@ -339,7 +339,7 @@ class CollectionClass { } } // module_load_include( $phpFile, 'Fedora_Repository', ' '); - require_once(drupal_get_path('module', 'islandora_repository') . '/' . $phpFile); + require_once(drupal_get_path('module', 'fedora_repository') . '/' . $phpFile); $thisClass = new $phpClass (); $returnValue = $thisClass->$phpMethod($parametersArray, $dsid, $file, $file_ext); if (!$returnValue) { @@ -409,7 +409,7 @@ class CollectionClass { $ingest_form = $xml->ingest_form; //should only be one $drupal_module = strip_tags($ingest_form->form_builder_method->module->asXML()); if (empty($drupal_module)) { - $drupal_module = 'islandora_repository'; + $drupal_module = 'fedora_repository'; } $phpFile = strip_tags($ingest_form->form_builder_method->file->asXML()); $phpClass = strip_tags($ingest_form->form_builder_method->class_name->asXML()); @@ -437,11 +437,11 @@ class CollectionClass { 'name' => variable_get('fedora_admin_user', 'fedoraAdmin') ); $admin_user = user_load($username); - module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); + module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); $connectionHelper = new ConnectionHelper(); try { $soapClient = $connectionHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); - $pidNameSpace = variable_get('islandora_repository_pid', 'vre:'); + $pidNameSpace = variable_get('fedora_repository_pid', 'vre:'); $pidNameSpace = substr($pidNameSpace, 0, strpos($pidNameSpace, ":")); $params = array( 'numPIDs' => '', @@ -460,7 +460,7 @@ class CollectionClass { $personal_collection_pid = array( 'fedora_personal_pid' => $pid ); - module_load_include('inc', 'islandora_repository', 'plugins/PersonalCollectionClass'); + module_load_include('inc', 'fedora_repository', 'plugins/PersonalCollectionClass'); $personalCollectionClass = new PersonalCollectionClass(); if (!$personalCollectionClass->createCollection($user, $pid, $soapClient)) { drupal_set_message("Did not create a personal collection object for !u", array('!u' => $user->name)); @@ -480,7 +480,7 @@ class CollectionClass { * @return type */ function getXslContent($pid, $path, $canUseDefault = TRUE) { - module_load_include('inc', 'islandora_repository', 'CollectionClass'); + module_load_include('inc', 'fedora_repository', 'CollectionClass'); $collectionClass = new CollectionClass(); $xslContent = $collectionClass->getCollectionViewStream($pid); if (!$xslContent && $canUseDefault) { //no xslt so we will use the default sent with the module @@ -497,9 +497,9 @@ class CollectionClass { * @return string */ function showFieldSets($page_number) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - module_load_include('inc', 'islandora_repository', 'CollectionManagement'); - module_load_include('inc', 'islandora_repository', 'BatchIngest'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'CollectionManagement'); + module_load_include('inc', 'fedora_repository', 'BatchIngest'); global $base_url; $tabset = array(); global $user; @@ -514,7 +514,7 @@ class CollectionClass { $collection_items = $this->renderCollection($results, $this->pid, NULL, NULL, $page_number); $collection_item = new Fedora_Item($this->pid); // Check the form post to see if we are in the middle of an ingest operation. - $show_ingest_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'islandora_repository_ingest_form'); + $show_ingest_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_ingest_form'); $add_to_collection = $this->getIngestInterface(); $show_batch_tab = TRUE; @@ -586,7 +586,7 @@ class CollectionClass { $allow = fedora_fesl_check_roles($this->pid, 'write'); } if ($allow) { - $ingestObject = drupal_get_form('islandora_repository_ingest_form', $this->pid); + $ingestObject = drupal_get_form('fedora_repository_ingest_form', $this->pid); } } } @@ -608,7 +608,7 @@ class CollectionClass { * @return type */ function renderCollection($content, $pid, $dsId, $collection, $pageNumber = NULL) { - $path = drupal_get_path('module', 'islandora_repository'); + $path = drupal_get_path('module', 'fedora_repository'); global $base_url; $collection_pid = $pid; //we will be changing the pid later maybe $objectHelper = new ObjectHelper(); @@ -628,7 +628,7 @@ class CollectionClass { } if (!isset($collectionName)) { - $collectionName = variable_get('islandora_repository_name', 'Collection'); + $collectionName = variable_get('fedora_repository_name', 'Collection'); } $xslContent = $this->getXslContent($pid, $path); diff --git a/CollectionManagement.inc b/CollectionManagement.inc index bb89a9fd..83bb9952 100644 --- a/CollectionManagement.inc +++ b/CollectionManagement.inc @@ -8,7 +8,7 @@ * @return array */ function collection_management_form(&$form_state, $this_collection_pid, $content_models) { - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); $restricted = FALSE; if (variable_get('fedora_namespace_restriction_enforced', true)) { $restricted = true; @@ -20,8 +20,8 @@ function collection_management_form(&$form_state, $this_collection_pid, $content } } } - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); - module_load_include('inc', 'islandora_repository', 'CollectionPolicy'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); $item = new Fedora_Item($this_collection_pid); $collection_name = $item->objectProfile->objLabel; $new_content_models = get_content_models_as_option_array(); @@ -224,8 +224,8 @@ function collection_management_form(&$form_state, $this_collection_pid, $content */ function collection_management_form_validate($form, &$form_state) { if ($form_state['clicked_button']['#id'] == 'create_class') { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); $pid = $form_state['values']['new_collection_pid']; $item = new fedora_item($pid); if ($item->exists()) { @@ -252,14 +252,14 @@ function collection_management_form_validate($form, &$form_state) { * @param type $form_state */ function collection_management_form_submit($form, &$form_state) { - module_load_include('inc', 'islandora_repository', 'api/fedora_collection'); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - module_load_include('inc', 'islandora_repository', 'api/dublin_core'); + module_load_include('inc', 'fedora_repository', 'api/fedora_collection'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/dublin_core'); global $user; $collection_pid = $form_state['values']['parent_collection']; $policy = CollectionPolicy::loadFromCollection($collection_pid, TRUE); if ($form_state['clicked_button']['#id'] == 'create_class') { - $module_path = drupal_get_path('module', 'islandora_repository'); + $module_path = drupal_get_path('module', 'fedora_repository'); $thumbnail = drupal_get_path('module', 'Fedora_Repository') . '/images/Crystal_Clear_filesystem_folder_grey.png'; $new_collection_pid = $form_state['values']['new_collection_pid']; $new_collection_label = $form_state['values']['collection_name']; @@ -345,7 +345,7 @@ function collection_management_form_submit($form, &$form_state) { $query = htmlentities(urlencode($query)); $content = ''; - $url = variable_get('islandora_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=$limit&offset=$offset&lang=itql&stream=on&query=" . $query; $content .= do_curl($url); $results = explode("\n", $content); @@ -370,7 +370,7 @@ function collection_management_form_submit($form, &$form_state) { $batch = array( 'title' => "Deleting Objects from $name", 'operations' => array(), - 'file' => drupal_get_path('module', 'islandora_repository') . '/CollectionManagement.inc', + 'file' => drupal_get_path('module', 'fedora_repository') . '/CollectionManagement.inc', ); @@ -389,7 +389,7 @@ function collection_management_form_submit($form, &$form_state) { * @param <type> $pid */ function delete_objects_as_batch($pid) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $name = $user->name; $item_to_delete = new Fedora_Item($pid); $models = $item_to_delete->get_models(); diff --git a/CollectionPolicy.inc b/CollectionPolicy.inc index 0612a733..b801eaff 100644 --- a/CollectionPolicy.inc +++ b/CollectionPolicy.inc @@ -4,7 +4,7 @@ * @file * Collection Policy Class */ -module_load_include('inc', 'islandora_repository', 'XMLDatastream'); +module_load_include('inc', 'fedora_repository', 'XMLDatastream'); /** * Collection Policy class ?? @@ -36,7 +36,7 @@ class CollectionPolicy extends XMLDatastream { */ static function loadFromCollection($pid, $preFetch=TRUE) { $ret = FALSE; - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); try { if (self::valid_pid($pid)) { @@ -80,7 +80,7 @@ class CollectionPolicy extends XMLDatastream { $rootEl = $cp->xml->getElementsByTagName('collection_policy')->item(0); $rootEl->setAttribute('name', $name); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $fedoraItem = new Fedora_Item($pid); $fedoraItem->add_datastream_from_string($cp->dumpXml(), $cpDsid, $name, 'text/xml', 'X'); $ret = $cp; @@ -110,7 +110,7 @@ class CollectionPolicy extends XMLDatastream { $cp = new CollectionPolicy($newDom, $pid, $cpDsid); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $fedoraItem = new Fedora_Item($pid); $fedoraItem->add_datastream_from_string($cp->dumpXml(), $cpDsid, $name, 'text/xml', 'X'); $ret = $cp; @@ -137,7 +137,7 @@ class CollectionPolicy extends XMLDatastream { public static function ingestBlankPolicy($pid, $name, $policyDsid, $model_pid, $model_namespace, $relationship, $searchField, $searchValue) { $ret = FALSE; if (($cp = self::loadFromCollection($pid)) === FALSE) { //removed second, non-existant variable - module_load_include('inc', 'islandora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); if (($cm = ContentModel::loadFromModel($model_pid)) !== FALSE && $cm->validate()) { $newDom = new DOMDocument('1.0', 'utf-8'); $newDom->formatOutput = TRUE; @@ -171,7 +171,7 @@ class CollectionPolicy extends XMLDatastream { $cp = new CollectionPolicy($newDom, $pid, $policyDsid); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $fedoraItem = new Fedora_Item($pid); @@ -299,7 +299,7 @@ class CollectionPolicy extends XMLDatastream { $this->staging_area = trim($stagingEl->item(0)->nodeValue); } elseif ($recurse) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $item = new Fedora_Item($this->pid); $rels = $item->get_relationships(); if (count($rels) > 0) { @@ -373,7 +373,7 @@ class CollectionPolicy extends XMLDatastream { $pname = substr($namespace, 0, strpos($namespace, ":")); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $ret = Fedora_Item::get_next_pid_in_namespace($pname); } return $ret; @@ -443,7 +443,7 @@ class CollectionPolicy extends XMLDatastream { if ($recurse && count($ret) == 0) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $item = new Fedora_Item($this->pid); $rels = $item->get_relationships(); if (count($rels) > 0) { diff --git a/ContentModel.inc b/ContentModel.inc index 66bd9569..b1f28074 100644 --- a/ContentModel.inc +++ b/ContentModel.inc @@ -8,7 +8,7 @@ * @file * Content Model Class */ -module_load_include('inc', 'islandora_repository', 'XMLDatastream'); +module_load_include('inc', 'fedora_repository', 'XMLDatastream'); /** * Conent Model ?? @@ -41,7 +41,7 @@ class ContentModel extends XMLDatastream { public static function loadFromObject($pid) { $ret = FALSE; if (self::valid_pid($pid)) { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $objectHelper = new ObjectHelper(); $content_models = $objectHelper->get_content_models_list($pid); @@ -73,7 +73,7 @@ class ContentModel extends XMLDatastream { $rootEl = $cm->xml->getElementsByTagName('content_model')->item(0); $rootEl->setAttribute('name', $name); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $fedoraItem = new Fedora_Item($pid); $fedoraItem->add_datastream_from_string($cm->dumpXml(), $modelDsid, $name, 'text/xml', 'X'); $ret = $cm; @@ -102,7 +102,7 @@ class ContentModel extends XMLDatastream { $cm = new ContentModel($newDom, $pid, $modelDsid); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $fedoraItem = new Fedora_Item($pid); $fedoraItem->add_datastream_from_string($cm->dumpXml(), $modelDsid, $name, 'text/xml', 'X'); $ret = $cm; @@ -172,7 +172,7 @@ class ContentModel extends XMLDatastream { $cm = new ContentModel($newDom, $pid, $modelDsid); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $fedoraItem = new Fedora_Item($pid); $fedoraItem->add_datastream_from_string($cm->dumpXml(), $modelDsid, $name, 'text/xml', 'X'); $ret = $cm; @@ -199,7 +199,7 @@ class ContentModel extends XMLDatastream { */ public static function loadFromModel($pid, $dsid = NULL, $pid_namespace = NULL, $name = NULL) { $ret = FALSE; - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); try { if (self::valid_pid($pid)) { $fedoraItem = new Fedora_Item($pid); @@ -436,7 +436,7 @@ class ContentModel extends XMLDatastream { and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>) order by $title'; - module_load_include('inc', 'islandora_repository', 'CollectionClass'); + module_load_include('inc', 'fedora_repository', 'CollectionClass'); $collectionHelper = new CollectionClass(); $xml = simplexml_load_string($collectionHelper->getRelatedItems($this->pid, $query)); @@ -1070,7 +1070,7 @@ class ContentModel extends XMLDatastream { $method = $ingest_form->getElementsByTagName('form_builder_method')->item(0); $module = $method->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'islandora_repository') . '/' . $method->getAttribute('file'); + $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); if (!file_exists($path)) { self::$errors[] = 'Build Ingest Form: file \'' . $path . '\' does not exist.'; } @@ -1110,7 +1110,7 @@ class ContentModel extends XMLDatastream { if ($method->length > 0 && $method->item(0)->getAttribute('dsid') == $dsid) { $method = $method->item(0); $module = $method->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'islandora_repository') . '/' . $method->getAttribute('file'); + $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); if (!file_exists($path)) { self::$errors[] = 'Build Edit Metadata Form: file \'' . $path . '\' does not exist.'; } @@ -1153,7 +1153,7 @@ class ContentModel extends XMLDatastream { if ($method->length > 0) { $method = $method->item(0); $module = $method->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'islandora_repository') . '/' . $method->getAttribute('file'); + $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); if (!file_exists($path)) { self::$errors[] = 'Handle Edit Metadata Form: file \'' . $path . '\' does not exist.'; } @@ -1177,7 +1177,7 @@ class ContentModel extends XMLDatastream { } else { // Assume DC form if none is specified. - module_load_include('inc', 'islandora_repository', 'formClass'); + module_load_include('inc', 'fedora_repository', 'formClass'); $metaDataForm = new formClass(); $ret = $metaDataForm->updateMetaData($form_state['values']['form_id'], $form_state['values'], $soap_client); $form_state['storage'] = NULL; @@ -1198,7 +1198,7 @@ class ContentModel extends XMLDatastream { $method = $this->xml->getElementsByTagName('content_model')->item(0)->getElementsByTagName('edit_metadata_method'); if ($method->length > 0) { $method = $method->item(0); - $ret = array('module' => $method->getAttribute('module') == '' ? 'islandora_repository' : $method->getAttribute('module'), + $ret = array('module' => $method->getAttribute('module') == '' ? 'fedora_repository' : $method->getAttribute('module'), 'file' => $method->getAttribute('file'), 'class' => $method->getAttribute('class'), 'method' => $method->getAttribute('method'), @@ -1282,7 +1282,7 @@ class ContentModel extends XMLDatastream { } } $module = $addMethod->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'islandora_repository') . '/' . $addMethod->getAttribute('file'); + $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $addMethod->getAttribute('file'); if (!file_exists($path)) { self::$errors[] = 'Execute Add Datastream Methods: file \'' . $path . '\' does not exist.'; } @@ -1351,9 +1351,9 @@ class ContentModel extends XMLDatastream { if (!$preview || isset($param_array['preview'])) { $module = $method->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'islandora_repository') . '/' . $method->getAttribute('file'); + $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); - if (!file_exists($path) || substr_compare($path, 'islandora_repository/', -strlen('islandora_repository/'), strlen('islandora_repository/')) === 0) { + if (!file_exists($path) || substr_compare($path, 'fedora_repository/', -strlen('fedora_repository/'), strlen('fedora_repository/')) === 0) { self::$errors[] = 'Execute Ingest Rules: file \'' . $path . '\' does not exist.'; $ret = FALSE; } @@ -1399,7 +1399,7 @@ class ContentModel extends XMLDatastream { if ($this->validate()) { $method = $this->xml->getElementsByTagName('ingest_form')->item(0)->getElementsByTagName('form_builder_method')->item(0); $module = $method->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'islandora_repository') . '/' . $method->getAttribute('file'); + $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); if (!file_exists($path)) { self::$errors[] = 'Execute Form Handler: file \'' . $path . '\' does not exist.'; } @@ -1469,7 +1469,7 @@ class ContentModel extends XMLDatastream { for ($j = 0; $j < $dispMethods->length; $j++) { $method = $dispMethods->item($j); $module = $method->getAttribute('module'); - $path = drupal_get_path('module', !empty($module) ? $module : 'islandora_repository') . '/' . $method->getAttribute('file'); + $path = drupal_get_path('module', !empty($module) ? $module : 'fedora_repository') . '/' . $method->getAttribute('file'); if (!file_exists($path)) { self::$errors[] = 'Execute Form Handler: file \'' . $path . '\' does not exist.'; } @@ -1588,7 +1588,7 @@ class ContentModel extends XMLDatastream { $ret = array(); $dispMethods = $ds->getElementsByTagName('display_method'); for ($i = 0; $i < $dispMethods->length; $i++) { - $ret[] = array('module' => $dispMethods->item($i)->getAttribute('module') == '' ? 'islandora_repository' : $dispMethods->item($i)->getAttribute('module'), + $ret[] = array('module' => $dispMethods->item($i)->getAttribute('module') == '' ? 'fedora_repository' : $dispMethods->item($i)->getAttribute('module'), 'file' => $dispMethods->item($i)->getAttribute('file'), 'class' => $dispMethods->item($i)->getAttribute('class'), 'method' => $dispMethods->item($i)->getAttribute('method'), @@ -1694,7 +1694,7 @@ class ContentModel extends XMLDatastream { $found = FALSE; $dispMethods = $ds->getElementsByTagName('display_method'); for ($i = 0; !$found && $i < $dispMethods->length; $i++) { - if ($module == ($dispMethods->item($i)->getAttribute('module') == '' ? 'islandora_repository' : $dispMethods->item($i)->getAttribute('module')) && + if ($module == ($dispMethods->item($i)->getAttribute('module') == '' ? 'fedora_repository' : $dispMethods->item($i)->getAttribute('module')) && $file == $dispMethods->item($i)->getAttribute('file') && $class == $dispMethods->item($i)->getAttribute('class') && $method == $dispMethods->item($i)->getAttribute('method')) { @@ -1732,7 +1732,7 @@ class ContentModel extends XMLDatastream { $found = FALSE; $dispMethods = $ds->getElementsByTagName('display_method'); for ($i = 0; !$found && $i < $dispMethods->length; $i++) { - if ($module == ($dispMethods->item($i)->getAttribute('module') == '' ? 'islandora_repository' : $dispMethods->item($i)->getAttribute('module') == '') && + if ($module == ($dispMethods->item($i)->getAttribute('module') == '' ? 'fedora_repository' : $dispMethods->item($i)->getAttribute('module') == '') && $file == $dispMethods->item($i)->getAttribute('file') && $class == $dispMethods->item($i)->getAttribute('class') && $method == $dispMethods->item($i)->getAttribute('method')) { @@ -1785,7 +1785,7 @@ class ContentModel extends XMLDatastream { if (($ds = $this->getDSModel($ds)) !== FALSE) { $addDsMethod = $ds->getElementsByTagName('add_datastream_method'); if ($addDsMethod !== FALSE && $addDsMethod->length > 0) { - $ret = array('module' => $addDsMethod->item(0)->getAttribute('module') == '' ? 'islandora_repository' : $addDsMethod->item(0)->getAttribute('module'), + $ret = array('module' => $addDsMethod->item(0)->getAttribute('module') == '' ? 'fedora_repository' : $addDsMethod->item(0)->getAttribute('module'), 'file' => $addDsMethod->item(0)->getAttribute('file'), 'class' => $addDsMethod->item(0)->getAttribute('class'), 'method' => $addDsMethod->item(0)->getAttribute('method'), @@ -1936,7 +1936,7 @@ class ContentModel extends XMLDatastream { $methods = $rule->getElementsByTagName('ingest_methods')->item(0)->getElementsByTagName('ingest_method'); $found = FALSE; for ($i = 0; $found === FALSE && $i < $methods->length; $i++) { - if (($methods->item($i)->getAttribute('module') == '' ? 'islandora_repository' : $methods->item($i)->getAttribute('module')) == $module && + if (($methods->item($i)->getAttribute('module') == '' ? 'fedora_repository' : $methods->item($i)->getAttribute('module')) == $module && $methods->item($i)->getAttribute('file') == $file && $methods->item($i)->getAttribute('class') == $class && $methods->item($i)->getAttribute('method') == $method) { @@ -1989,7 +1989,7 @@ class ContentModel extends XMLDatastream { $methodsEl = $rule->getElementsByTagName('ingest_methods')->item(0); $methods = $methodsEl->getElementsByTagName('ingest_method'); for ($i = 0; !$found && $i < $methods->length; $i++) { - if (( trim($methods->item($i)->getAttribute('module')) == $module || (trim($methods->item($i)->getAttribute('module')) == '' && $module == 'islandora_repository')) && trim($methods->item($i)->getAttribute('file')) == $file && trim($methods->item($i)->getAttribute('class')) == $class && trim($methods->item($i)->getAttribute('method')) == $method) { + if (( trim($methods->item($i)->getAttribute('module')) == $module || (trim($methods->item($i)->getAttribute('module')) == '' && $module == 'fedora_repository')) && trim($methods->item($i)->getAttribute('file')) == $file && trim($methods->item($i)->getAttribute('class')) == $class && trim($methods->item($i)->getAttribute('method')) == $method) { $found = $methods->item($i); } } @@ -2077,7 +2077,7 @@ class ContentModel extends XMLDatastream { $methods = $rules->item($i)->getElementsByTagName('ingest_methods')->item(0)->getElementsByTagName('ingest_method'); for ($j = 0; $j < $methods->length; $j++) { - $method = array('module' => $methods->item($j)->getAttribute('module') == '' ? 'islandora_repository' : $methods->item($j)->getAttribute('module'), + $method = array('module' => $methods->item($j)->getAttribute('module') == '' ? 'fedora_repository' : $methods->item($j)->getAttribute('module'), 'file' => $methods->item($j)->getAttribute('file'), 'class' => $methods->item($j)->getAttribute('class'), 'method' => $methods->item($j)->getAttribute('method'), @@ -2157,7 +2157,7 @@ class ContentModel extends XMLDatastream { $ret = FALSE; if ($this->validate()) { $method = $this->xml->getElementsByTagName('ingest_form')->item(0)->getElementsByTagName('form_builder_method')->item(0); - $ret = array('module' => ($method->getAttribute('module') == '' ? 'islandora_repository' : $method->getAttribute('module')), + $ret = array('module' => ($method->getAttribute('module') == '' ? 'fedora_repository' : $method->getAttribute('module')), 'file' => $method->getAttribute('file'), 'class' => $method->getAttribute('class'), 'method' => $method->getAttribute('method'), diff --git a/ObjectHelper.inc b/ObjectHelper.inc index da56852b..9e9995b7 100644 --- a/ObjectHelper.inc +++ b/ObjectHelper.inc @@ -33,7 +33,7 @@ class ObjectHelper { */ function ObjectHelper() { drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); - module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); + module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); $connectionHelper = new ConnectionHelper(); //$this->fedoraUser = $connectionHelper->getUser(); //$this->fedoraPass = $connectionHelper->getPassword(); @@ -56,7 +56,7 @@ class ObjectHelper { */ function makeObject($pid, $dsID, $asAttachment = FALSE, $label = NULL, $filePath=FALSE, $version=NULL, $forceSoap = TRUE) { global $user; - module_load_include('inc', 'islandora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); if ($pid == NULL || $dsID == NULL) { drupal_set_message(t("no pid or dsid given to create an object with"), 'error'); return ' '; @@ -69,7 +69,7 @@ class ObjectHelper { return ' '; } - if (!islandora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + if (!fedora_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_access_denied(); return ' '; @@ -91,7 +91,7 @@ class ObjectHelper { } } - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $item = new Fedora_Item($pid); @@ -176,7 +176,7 @@ class ObjectHelper { * for the mimetype in question. */ if ($pos === FALSE) { - module_load_include('inc', 'islandora_repository', 'MimeClass'); + module_load_include('inc', 'fedora_repository', 'MimeClass'); $mimeclass = new MimeClass(); $ext = $mimeclass->get_extension($mimeType); $suggestedFileName = "$label.$ext"; @@ -207,7 +207,7 @@ class ObjectHelper { * @return type */ function getCollectionInfo($pid, $query = NULL) { - module_load_include('inc', 'islandora_repository', 'CollectionClass'); + module_load_include('inc', 'fedora_repository', 'CollectionClass'); $collectionClass = new CollectionClass(); $results = $collectionClass->getRelatedItems($pid, $query); return $results; @@ -227,12 +227,12 @@ class ObjectHelper { drupal_set_message(t('You must specify an object pid and datastream ID.'), 'error'); return ''; } - if (!islandora_repository_access(ObjectHelper :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + if (!fedora_repository_access(ObjectHelper :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { drupal_set_message(t('You do not have the appropriate permissions'), 'error'); return; } - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $item = new fedora_item($pid); $datastream_list = $item->get_datastreams_list_as_SimpleXML(); if (!isset($datastream_list)) { @@ -262,12 +262,12 @@ class ObjectHelper { drupal_set_message(t('You must specify an object pid and datastream ID.'), 'error'); return ''; } - if (!islandora_repository_access(ObjectHelper :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + if (!fedora_repository_access(ObjectHelper :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { drupal_set_message(t('You do not have the appropriate permissions'), 'error'); return; } - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $item = new fedora_item($pid); $datastream_list = $item->get_datastreams_list_as_SimpleXML(); if (!isset($datastream_list)) { @@ -291,7 +291,7 @@ class ObjectHelper { */ function create_link_for_ds($pid, $dataStreamValue) { global $base_url; - $path = drupal_get_path('module', 'islandora_repository'); + $path = drupal_get_path('module', 'fedora_repository'); require_once($path . '/api/fedora_item.inc'); $item = new Fedora_Item($pid); @@ -359,8 +359,8 @@ class ObjectHelper { */ function getFormattedDC($item) { global $base_url; - $path = drupal_get_path('module', 'islandora_repository'); - module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); + $path = drupal_get_path('module', 'fedora_repository'); + module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); $dsid = array_key_exists('QDC', $item->get_datastreams_list_as_array()) ? 'QDC' : 'DC'; $xmlstr = $item->get_datastream_dissemination($dsid); @@ -408,7 +408,7 @@ class ObjectHelper { $ds_list = $item->get_datastreams_list_as_array(); $output = $this->getFormattedDC($item); $dsid = array_key_exists('QDC', $ds_list) ? 'QDC' : 'DC'; - $path = drupal_get_path('module', 'islandora_repository'); + $path = drupal_get_path('module', 'fedora_repository'); //$baseUrl=substr($baseUrl, 0, (strpos($baseUrl, "/")-1)); if (user_access(ObjectHelper :: $EDIT_FEDORA_METADATA)) { @@ -440,12 +440,12 @@ class ObjectHelper { */ function get_formatted_datastream_list($object_pid, $contentModels, &$fedoraItem) { global $fedoraUser, $fedoraPass, $base_url, $user; - module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - module_load_include('inc', 'islandora_repository', 'ContentModel'); + 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', 'islandora_repository'); + $path = drupal_get_path('module', 'fedora_repository'); $dataStreamBody = ''; $fedoraItem = new Fedora_Item($object_pid); @@ -514,7 +514,7 @@ class ObjectHelper { * */ function getStream($pid, $dsid, $showError = FALSE) { - module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); + module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); $soapHelper = new ConnectionHelper(); try { $client = $soapHelper->getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); @@ -548,7 +548,7 @@ class ObjectHelper { * @return array */ function get_content_models_list($pid, $include_fedora_system_content_models = FALSE) { - module_load_include('inc', 'islandora_repository', 'CollectionClass'); + module_load_include('inc', 'fedora_repository', 'CollectionClass'); $collectionHelper = new CollectionClass(); $pids = array(); $query = 'select $object from <#ri> @@ -593,7 +593,7 @@ class ObjectHelper { * @param type $pid * @return type */ - function islandora_repository_access($op, $pid) { + function fedora_repository_access($op, $pid) { global $user; $returnValue = FALSE; @@ -602,7 +602,7 @@ class ObjectHelper { $namespaceAccess = TRUE; } if ($pid == NULL) { - $pid = variable_get('islandora_repository_pid', 'islandora:root'); + $pid = variable_get('fedora_repository_pid', 'islandora:root'); } $nameSpaceAllowed = explode(" ", variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); $pos = NULL; @@ -632,7 +632,7 @@ class ObjectHelper { * @param $content String */ function parseContent($content, $pid, $dsId, $collection, $pageNumber = NULL) { - $path = drupal_get_path('module', 'islandora_repository'); + $path = drupal_get_path('module', 'fedora_repository'); global $base_url; $collection_pid = $pid; //we will be changing the pid later maybe //module_load_include('php', ''Fedora_Repository'', 'ObjectHelper'); @@ -790,7 +790,7 @@ class ObjectHelper { return NULL; } $output = ''; - module_load_include('inc', 'islandora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); if (($cm = ContentModel :: loadFromModel($contentModel)) !== FALSE && $cm->validate()) { $output .= $cm->displayExtraFieldset($pid, $page_number); } @@ -810,7 +810,7 @@ class ObjectHelper { return FALSE; } - module_load_include('inc', 'islandora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); if ($dsid != NULL && $pid != NULL && ($cm = ContentModel::loadFromObject($pid)) !== FALSE) { $cm->execAddDatastreamMethods($dsid, $file); } @@ -826,7 +826,7 @@ class ObjectHelper { if (!$pid) { return FALSE; } - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); // Get title and descriptions for $pid $query_string = 'select $title $desc from <#ri> @@ -834,7 +834,7 @@ class ObjectHelper { and $o <dc:description> $desc and $o <mulgara:is> <info:fedora/' . $pid . '>'; - $url = variable_get('islandora_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=1000&lang=itql&stream=on&query="; $content = do_curl($url . htmlentities(urlencode($query_string))); @@ -868,7 +868,7 @@ class ObjectHelper { } $query_string = substr($query_string, 0, -3) . ' )'; - $url = variable_get('islandora_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=1000&lang=itql&stream=on&query="; $url .= htmlentities(urlencode($query_string)); $content = $this->doCurl($url); @@ -905,7 +905,7 @@ class ObjectHelper { * @return type */ function getObject($pid, $context = 'archive', $format = FOXML_11) { - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); $url = variable_get('fedora_base_url', 'http://localhost:8080/fedora') . '/objects/' . $pid . '/export?context=' . $context . '&format=' . $format; $result_data = do_curl($url); @@ -921,10 +921,10 @@ class ObjectHelper { * @param type $level */ function getBreadcrumbs($pid, &$breadcrumbs, $level=10) { - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); // Before executing the query, we hve a base case of accessing the top-level collection global $base_url; - if ($pid == variable_get('islandora_repository_pid', 'islandora:root')) { + if ($pid == variable_get('fedora_repository_pid', 'islandora:root')) { $breadcrumbs[] = l(t('Digital repository'), 'fedora/repository'); $breadcrumbs[] = l(t('Home'), $base_url); } @@ -940,7 +940,7 @@ class ObjectHelper { order by $title'; $query_string = htmlentities(urlencode($query_string)); - $url = variable_get('islandora_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; $result = preg_split('/[\r\n]+/', do_curl($url)); @@ -950,7 +950,7 @@ class ObjectHelper { $parent = preg_replace('/^info:fedora\//', '', $matches[0]); $breadcrumbs[] = l($matches[1], 'fedora/repository/' . $pid); - if ($parent == variable_get('islandora_repository_pid', 'islandora:root')) { + if ($parent == variable_get('fedora_repository_pid', 'islandora:root')) { $breadcrumbs[] = l(t('Digital repository'), 'fedora/repository'); $breadcrumbs[] = l(t('Home'), $base_url); } diff --git a/SearchClass.inc b/SearchClass.inc index 794d292a..3f1c78d5 100644 --- a/SearchClass.inc +++ b/SearchClass.inc @@ -25,14 +25,14 @@ class SearchClass { function solr_search($query, $startPage=1, $fq = NULL, $dismax = NULL) { $solrFile = trim(variable_get('islandora_solr_search_block_handler_file', 'plugins/SolrResults.inc')); - // Don't let us bust out of islandora_repository modules directory when looking for a handler + // Don't let us bust out of fedora_repository modules directory when looking for a handler if (strpos($solrField, '../')) { drupal_set_message(t('You have illegal characters in your solr handler function in the Islandora solr block config.'), 'error'); } $solrClass = trim(variable_get('islandora_solr_search_block_handler_class', 'SolrResults')); $solrFunction = trim(variable_get('islandora_solr_search_block_handler_function', 'SearchAndDisplay')); - require_once(drupal_get_path('module', 'islandora_repository') . '/' . $solrFile); + require_once(drupal_get_path('module', 'fedora_repository') . '/' . $solrFile); try { $implementation = new $solrClass(); } catch (Exception $e) { @@ -185,8 +185,8 @@ class SearchClass { * @return type */ function quickSearch($type, $query, $showForm = 1, $orderBy = 0, & $userArray) { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); if (user_access('view fedora collection')) { $numberOfHistPerPage = '5000'; //hack for IR they do not want next button $luceneQuery = NULL; @@ -222,7 +222,7 @@ class SearchClass { } } if ($showForm) { - $output = '<Strong>Quick Search</strong><br /><table class="table-form"><tr>' . drupal_get_form('islandora_repository_quick_search_form') . '</tr></table>'; + $output = '<Strong>Quick Search</strong><br /><table class="table-form"><tr>' . drupal_get_form('fedora_repository_quick_search_form') . '</tr></table>'; } $output .= $this->applyXSLT($resultData, $orderBy); return $output; @@ -237,8 +237,8 @@ class SearchClass { * @return type */ function getTerms($fieldName, $startTerm, $displayName = NULL) { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); $indexName = variable_get('fedora_index_name', 'DemoOnLucene'); $searchUrl = variable_get('fedora_fgsearch_url', 'http://localhost:8080/fedoragsearch/rest'); if ($startTerm == NULL) { @@ -269,8 +269,8 @@ class SearchClass { * @return type */ function custom_search($query, $startPage=1, $xslt= '/xsl/advanced_search_results.xsl', $numberOfHistPerPage = 50) { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); if (user_access('view fedora collection')) { //$numberOfHistPerPage = '50';//hack for IR they do not want next button @@ -322,7 +322,7 @@ class SearchClass { return ' '; } - //$proc->setParameter('', 'searchUrl', url('search') . '/islandora_repository'); //needed in our xsl + //$proc->setParameter('', 'searchUrl', url('search') . '/fedora_repository'); //needed in our xsl $proc->setParameter('', 'objectsPage', base_path()); $proc->setParameter('', 'userID', $user->uid); if (isset($displayName)) { @@ -390,8 +390,8 @@ class SearchClass { //inject into xsl stylesheet global $user; $proc->setParameter('', 'userID', $user->uid); - $proc->setParameter('', 'searchToken', drupal_get_token('islandora_repository_advanced_search')); //token generated by Drupal, keeps tack of what tab etc we are on - $proc->setParameter('', 'searchUrl', url('search') . '/islandora_repository'); //needed in our xsl + $proc->setParameter('', 'searchToken', drupal_get_token('fedora_repository_advanced_search')); //token generated by Drupal, keeps tack of what tab etc we are on + $proc->setParameter('', 'searchUrl', url('search') . '/fedora_repository'); //needed in our xsl $proc->setParameter('', 'objectsPage', base_path()); $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); $proc->setParameter('', 'hitPageStart', $startPage); @@ -441,7 +441,7 @@ class SearchClass { //inject into xsl stylesheet //$proc->setParameter('', 'searchToken', drupal_get_token('search_form')); //token generated by Drupal, keeps tack of what tab etc we are on $proc->setParameter('', 'userID', $user->uid); - $proc->setParameter('', 'searchUrl', url('search') . '/islandora_repository'); //needed in our xsl + $proc->setParameter('', 'searchUrl', url('search') . '/fedora_repository'); //needed in our xsl $proc->setParameter('', 'objectsPage', base_path()); $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); $proc->setParameter('', 'orderBy', $orderBy); @@ -475,7 +475,7 @@ class SearchClass { */ function theme_advanced_search_form($form, $repeat=NULL) { if (!isset($repeat)) { - $repeat = variable_get('islandora_repository_advanced_block_repeat', t('3')); + $repeat = variable_get('fedora_repository_advanced_block_repeat', t('3')); } $output = drupal_render($form['search_type']['type1']); @@ -515,7 +515,7 @@ class SearchClass { $form = array(); if (!isset($repeat)) { - $repeat = variable_get('islandora_repository_advanced_block_repeat', t('3')); + $repeat = variable_get('fedora_repository_advanced_block_repeat', t('3')); } $var0 = explode(':', $queryArray[0]); $var1 = explode(':', $queryArray[1]); diff --git a/SecurityClass.inc b/SecurityClass.inc index fbc6d3b8..0cdb2cbe 100644 --- a/SecurityClass.inc +++ b/SecurityClass.inc @@ -30,7 +30,7 @@ class SecurityClass { */ function canIngestHere($collection_pid) { global $user; - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $objectHelper = new ObjectHelper(); // get the childsecurity policy from the collection. $policyStream = $objectHelper->getStream($collection_pid, SECURITYCLASS :: $SECURITY_CLASS_SECURITY_STREAM, FALSE); diff --git a/XMLDatastream.inc b/XMLDatastream.inc index 9376aa83..d3afed09 100644 --- a/XMLDatastream.inc +++ b/XMLDatastream.inc @@ -168,7 +168,7 @@ abstract class XMLDatastream { //$tmpname = substr($this->pid, strpos($this->pid, ':') + 1); $tmpname = user_password(10); $this->convertFromOldSchema(); - drupal_add_js("islandora_repository_print_new_schema_$tmpname = function(tagID) { + drupal_add_js("fedora_repository_print_new_schema_$tmpname = function(tagID) { var target = document.getElementById(tagID); var content = target.innerHTML; var text = '<html><head><title>Title' + @@ -179,7 +179,7 @@ abstract class XMLDatastream { }", 'inline'); if (user_access('administer site configuration')) { - drupal_set_message('<span id="new_schema_' . $tmpname . '" style="display: none;">' . htmlentities($this->xml->saveXML()) . '</span>Warning: XMLDatastream performed conversion of \'' . $this->getIdentifier() . '\' from old schema. Please update the datastream. The new datastream contents are <a href="javascript:islandora_repository_print_new_schema_' . $tmpname . '(\'new_schema_' . $tmpname . '\')">here.</a> '); + drupal_set_message('<span id="new_schema_' . $tmpname . '" style="display: none;">' . htmlentities($this->xml->saveXML()) . '</span>Warning: XMLDatastream performed conversion of \'' . $this->getIdentifier() . '\' from old schema. Please update the datastream. The new datastream contents are <a href="javascript:fedora_repository_print_new_schema_' . $tmpname . '(\'new_schema_' . $tmpname . '\')">here.</a> '); } $rootEl = $this->xml->firstChild; @@ -246,7 +246,7 @@ abstract class XMLDatastream { * @return boolean $valid */ public function purgeVersions($start_date, $end_date = NULL) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $fedora_item = new Fedora_Item($this->pid); return $fedora_item->purge_datastream($this->dsid, $start_date, $end_date); } @@ -258,7 +258,7 @@ abstract class XMLDatastream { * @return string[] $ret */ public function getHistory() { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $fedora_item = new Fedora_Item($this->pid); $history = $fedora_item->get_datastream_history($this->dsid); diff --git a/api/fedora_collection.inc b/api/fedora_collection.inc index 2efd2acb..b8afc5c4 100644 --- a/api/fedora_collection.inc +++ b/api/fedora_collection.inc @@ -4,10 +4,10 @@ * @file * Operations that affect a Fedora repository at a collection level. */ -module_load_include('inc', 'islandora_repository', 'CollectionClass'); -module_load_include('inc', 'islandora_repository', 'api/fedora_item'); -module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); -module_load_include('module', 'islandora_repository'); +module_load_include('inc', 'fedora_repository', 'CollectionClass'); +module_load_include('inc', 'fedora_repository', 'api/fedora_item'); +module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); +module_load_include('module', 'fedora_repository'); /** * Exports a fedora collection object and all of its children in a format @@ -68,10 +68,10 @@ function export_collection($collection_pid, $relationship = 'isMemberOfCollectio * @param <type> $query_format R */ function get_related_items_as_xml($collection_pid, $relationship = array('isMemberOfCollection'), $limit = 10000, $offset = 0, $active_objects_only = TRUE, $cmodel = NULL, $orderby = '$title') { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); global $user; - if (!islandora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied."), 'error'); return array(); } @@ -111,7 +111,7 @@ function get_related_items_as_xml($collection_pid, $relationship = array('isMemb $content = ''; - $url = variable_get('islandora_repository_url', 'http://localhost:8080/fedora/risearch'); + $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); $url .= "?type=tuples&flush=TRUE&format=Sparql&limit=$limit&offset=$offset&lang=itql&stream=on&query=" . $query_string; $content .= do_curl($url); diff --git a/api/fedora_export.inc b/api/fedora_export.inc index bc4fd00f..e1ed3cbd 100644 --- a/api/fedora_export.inc +++ b/api/fedora_export.inc @@ -41,7 +41,7 @@ function export_to_export_area($pid, $foxml_dir, $ob_dir, &$log = array()) { * @return string */ function export_objects_for_pid($pid, $dir, &$log) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $item = new Fedora_Item($pid); if (!$object = $item->get_datastreams_list_as_SimpleXML($pid)) { $log[] = log_line(t("Failed to get datastream %dsid for pid %pid", array('%dsid' => $ds->ID, '%pid' => $pid)), 'error'); @@ -85,7 +85,7 @@ function export_objects_for_pid($pid, $dir, &$log) { * @return type */ function export_foxml_for_pid($pid, $dir, $paths, &$log, $format = FOXML_11, $remove_islandora = FALSE) { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $ob_helper = new ObjectHelper(); if (!$object_xml = $ob_helper->getObject($pid, 'migrate', $format)) { $log[] = log_line(t("Failed to get foxml for %pid", array('%pid' => $pid)), 'error'); diff --git a/api/fedora_item.inc b/api/fedora_item.inc index fdf7074c..4dacca8c 100644 --- a/api/fedora_item.inc +++ b/api/fedora_item.inc @@ -28,8 +28,8 @@ class Fedora_Item { */ function __construct($pid) { drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); - module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); $this->pid = $pid; if (isset(Fedora_Item::$instantiated_pids[$pid])) { @@ -75,7 +75,7 @@ class Fedora_Item { * @return type */ function add_datastream_from_file($datastream_file, $datastream_id, $datastream_label = NULL, $datastream_mimetype = '', $controlGroup = 'M', $logMessage = NULL) { - module_load_include('inc', 'islandora_repository', 'MimeClass'); + module_load_include('inc', 'fedora_repository', 'MimeClass'); if (!is_file($datastream_file)) { drupal_set_message("$datastream_file not found<br />", 'warning'); return; @@ -285,7 +285,7 @@ class Fedora_Item { * @return Array of pid => title pairs that match the results */ static function find_objects_by_pattern($pattern = '*', $field = 'pid', $max_results = 100, $resultFields = array()) { - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); $pattern = drupal_urlencode($pattern); $done = FALSE; @@ -848,7 +848,7 @@ class Fedora_Item { */ static function soap_call($function_name, $params_array, $quiet = FALSE) { if (!self::$connection_helper) { - module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); + module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); self::$connection_helper = new ConnectionHelper(); } switch ($function_name) { diff --git a/api/fedora_utils.inc b/api/fedora_utils.inc index 91a8f05f..c8ce7d0e 100644 --- a/api/fedora_utils.inc +++ b/api/fedora_utils.inc @@ -158,7 +158,7 @@ function fedora_available() { */ function risearch_available() { - $response = do_curl_ext(variable_get('islandora_repository_url', 'http://localhost:8080/fedora/risearch')); + $response = do_curl_ext(variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch')); return ($response != NULL) ? ($response[1] == 0): FALSE; } @@ -238,13 +238,13 @@ function fix_dsid($dsid) { * @return array */ function get_collections_as_option_array() { - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); $query = 'select $object $title from <#ri> where ($object <dc:title> $title and $object <info:fedora/fedora-system:def/model#hasModel> <info:fedora/islandora:collectionCModel> and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>) order by $title'; - $url = variable_get('islandora_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=1000&lang=itql&stream=on&query="; $content = do_curl($url . htmlentities(urlencode($query))); $list = explode("\n", $content); @@ -269,8 +269,8 @@ function get_collections_as_option_array() { * @return array */ function get_content_models_as_option_array() { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); $restricted = variable_get('fedora_namespace_restriction_enforced', true); $allowed_string = variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora:'); $namespaces = explode(':', $allowed_string); @@ -286,7 +286,7 @@ function get_content_models_as_option_array() { and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>) order by $title'; - $url = variable_get('islandora_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=1000&lang=itql&stream=on&query="; $content = do_curl($url . htmlentities(urlencode($query))); $list = explode("\n", $content); diff --git a/islandora_repository.info b/fedora_repository.info similarity index 100% rename from islandora_repository.info rename to fedora_repository.info diff --git a/islandora_repository.install b/fedora_repository.install similarity index 92% rename from islandora_repository.install rename to fedora_repository.install index e8e26ad2..164ce02e 100644 --- a/islandora_repository.install +++ b/fedora_repository.install @@ -1,7 +1,7 @@ <?php /** - * @file islandora_repository.install + * @file fedora_repository.install */ /** @@ -33,7 +33,7 @@ function fedora_collections_enable() { * @see _update_message_text() * @see _update_cron_notify() */ -function islandora_repository_requirements($phase) { +function fedora_repository_requirements($phase) { global $base_url; $requirements = array(); @@ -89,13 +89,13 @@ function islandora_repository_requirements($phase) { } } elseif ($phase == 'runtime') { - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); $requirements['fedora-repository']['title'] = t("Fedora server"); if (!fedora_available()) { $requirements['fedora-repository']['value'] = t("Not available"); $requirements['fedora-repository']['severity'] = REQUIREMENT_ERROR; - $requirements['fedora-repository']['description'] = t('Ensure that Fedora is running and that the <a href="@collection-settings">collection settings</a> are correct.', array('@collection-settings' => $base_url . '/admin/settings/islandora_repository')); + $requirements['fedora-repository']['description'] = t('Ensure that Fedora is running and that the <a href="@collection-settings">collection settings</a> are correct.', array('@collection-settings' => $base_url . '/admin/settings/fedora_repository')); } else { $requirements['fedora-repository']['value'] = t("Available"); diff --git a/islandora_repository.module b/fedora_repository.module similarity index 81% rename from islandora_repository.module rename to fedora_repository.module index 6fa13988..ea1c15c5 100644 --- a/islandora_repository.module +++ b/fedora_repository.module @@ -2,23 +2,23 @@ /** * Drupal hook for admin form - * islandora_repository_name is the name of the top level collection this module will query - * islandora_repository_pid is the name of the top level pid. + * fedora_repository_name is the name of the top level collection this module will query + * fedora_repository_pid is the name of the top level pid. * Stores this info in the drupal variables table. * the name and pid can also be passed as url parameters */ -function islandora_repository_admin() { - module_load_include('inc', 'islandora_repository', 'formClass'); +function fedora_repository_admin() { + module_load_include('inc', 'fedora_repository', 'formClass'); $adminForm = new formClass(); return $adminForm->createAdminForm(); } /** * drupal hook - * calls the islandora_repositorys_admin form + * calls the fedora_repositorys_admin form */ -function islandora_repository_menu() { - module_load_include('inc', 'islandora_repository', 'formClass'); +function fedora_repository_menu() { + module_load_include('inc', 'fedora_repository', 'formClass'); $adminMenu = new formClass(); return $adminMenu->createMenu(); } @@ -30,11 +30,11 @@ function islandora_repository_menu() { * @param type $arg * @return type */ -function islandora_repository_help($path, $arg) { +function fedora_repository_help($path, $arg) { switch ($path) { case 'admin/modules#description' : return t('Grabs a list of items from a collection in Drupal that are presented on the home page.'); - case 'node/add#islandora_repository' : + case 'node/add#fedora_repository' : return t('Use this page to grab a list of items from a Fedora collection.'); } } @@ -45,7 +45,7 @@ function islandora_repository_help($path, $arg) { * @param type $name * @return type */ -function islandora_repository_purge_object($pid = NULL, $name = NULL) { +function fedora_repository_purge_object($pid = NULL, $name = NULL) { if (!user_access('purge objects and datastreams')) { drupal_set_message(t('You do not have access to add a datastream to this object.'), 'error'); return ''; @@ -60,7 +60,7 @@ function islandora_repository_purge_object($pid = NULL, $name = NULL) { '%pid' => $pid) ); - $output .= drupal_get_form('islandora_repository_purge_object_form', $pid); + $output .= drupal_get_form('fedora_repository_purge_object_form', $pid); return $output; } @@ -72,22 +72,22 @@ function islandora_repository_purge_object($pid = NULL, $name = NULL) { * @param type $pageNumber * @return type */ -function islandora_repository_collection_view($pid = NULL, $collection = NULL, $pageNumber = NULL) { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); +function fedora_repository_collection_view($pid = NULL, $collection = NULL, $pageNumber = NULL) { + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); global $user; - if (!islandora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied."), 'error'); return ' '; } $objectHelper = new ObjectHelper(); if ($pid == NULL) { - $pid = variable_get('islandora_repository_pid', 'islandora:root'); + $pid = variable_get('fedora_repository_pid', 'islandora:root'); } $content = ''; - module_load_include('inc', 'islandora_repository', 'CollectionClass'); + module_load_include('inc', 'fedora_repository', 'CollectionClass'); $collectionClass = new CollectionClass(); $results = $collectionClass->getRelatedItems($pid, NULL); $content .= $objectHelper->parseContent($results, $pid, $dsId, $collection, $pageNumber); @@ -102,9 +102,9 @@ function islandora_repository_collection_view($pid = NULL, $collection = NULL, $ * @param type $content_model * @return type */ -function islandora_repository_ingest_object($collection_pid=NULL, $collection_label = NULL, $content_model = NULL) { - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); +function fedora_repository_ingest_object($collection_pid=NULL, $collection_label = NULL, $content_model = NULL) { + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); if (!user_access('ingest new fedora objects')) { drupal_set_message(t('You do not have permission to ingest.'), 'error'); return ''; @@ -124,7 +124,7 @@ function islandora_repository_ingest_object($collection_pid=NULL, $collection_la drupal_set_message(t('You must specify a collection object pid to ingest an object.'), 'error'); return ''; } - $output = drupal_get_form('islandora_repository_ingest_form', $collection_pid, $collection_label, $content_model); + $output = drupal_get_form('fedora_repository_ingest_form', $collection_pid, $collection_label, $content_model); $breadcrumbs = array(); $objectHelper = new ObjectHelper(); @@ -141,7 +141,7 @@ function islandora_repository_ingest_object($collection_pid=NULL, $collection_la * @param array $form * @param array $form_state */ -function islandora_repository_ingest_form_submit(array $form, array &$form_state) { +function fedora_repository_ingest_form_submit(array $form, array &$form_state) { //only validate the form if the submit button was pressed (other buttons may be used for AHAH if ($form_state['storage']['xml']) { if (module_exists('islandora_content_model_forms')) { @@ -152,9 +152,9 @@ function islandora_repository_ingest_form_submit(array $form, array &$form_state } else if ($form_state['clicked_button']['#id'] == 'edit-submit') { global $base_url; - module_load_include('inc', 'islandora_repository', 'CollectionClass'); - module_load_include('inc', 'islandora_repository', 'CollectionPolicy'); - module_load_include('inc', 'islandora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'CollectionClass'); + module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); $contentModelPid = ContentModel::getPidFromIdentifier($form_state['values']['models']); $contentModelDsid = ContentModel::getDSIDFromIdentifier($form_state['values']['models']); @@ -196,7 +196,7 @@ function islandora_repository_ingest_form_submit(array $form, array &$form_state * @param type $form_state * @return type */ -function islandora_repository_ingest_form_validate($form, &$form_state) { +function fedora_repository_ingest_form_validate($form, &$form_state) { //only validate the form if the submit button was pressed (other buttons may be used for AHAH if ($form_state['clicked_button']['#id'] == 'edit-submit') { switch ($form_state['storage']['step']) { @@ -223,8 +223,8 @@ function islandora_repository_ingest_form_validate($form, &$form_state) { } if (isset($form_state['values']['ingest-file-location']) && file_exists($form_state['values']['ingest-file-location'])) { - module_load_include('inc', 'islandora_repository', 'ContentModel'); - module_load_include('inc', 'islandora_repository', 'MimeClass'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'MimeClass'); $file = $form_state['values']['ingest-file-location']; @@ -267,8 +267,8 @@ function islandora_repository_ingest_form_validate($form, &$form_state) { * @param type $content_model * @return type */ -function islandora_repository_ingest_form(&$form_state, $collection_pid, $collection_label = NULL, $content_model = NULL) { - module_load_include('inc', 'islandora_repository', 'formClass'); +function fedora_repository_ingest_form(&$form_state, $collection_pid, $collection_label = NULL, $content_model = NULL) { + module_load_include('inc', 'fedora_repository', 'formClass'); // For the sake of easily maintaining the module in different core versions create our own form_values variable. if (empty($form_state['storage']['step'])) { $form_state['storage']['step'] = 1; @@ -287,7 +287,7 @@ function islandora_repository_ingest_form(&$form_state, $collection_pid, $collec * @param type $referrer * @return type */ -function islandora_repository_purge_object_form(&$form_state, $pid, $referrer = NULL) { +function fedora_repository_purge_object_form(&$form_state, $pid, $referrer = NULL) { global $base_url; if (!user_access('purge objects and datastreams')) { return NULL; @@ -311,7 +311,7 @@ function islandora_repository_purge_object_form(&$form_state, $pid, $referrer = $form['submit'] = array( '#type' => 'image_button', - '#src' => drupal_get_path('module', 'islandora_repository') . '/images/purge_big.png', + '#src' => drupal_get_path('module', 'fedora_repository') . '/images/purge_big.png', '#value' => t('Purge'), '#suffix' => 'Purge this object', ); @@ -337,7 +337,7 @@ function islandora_repository_purge_object_form(&$form_state, $pid, $referrer = * @return type */ function add_stream($collection_pid=NULL, $collectionName=NULL) { - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); if (!valid_pid($collection_pid)) { drupal_set_message(t("This PID is not valid!"), 'error'); return ' '; @@ -350,7 +350,7 @@ function add_stream($collection_pid=NULL, $collectionName=NULL) { drupal_set_message(t('You must specify an collection object pid to ingest an object.'), 'error'); return ''; } - $output .= drupal_get_form('islandora_repository_add_stream_form', $pid); + $output .= drupal_get_form('fedora_repository_add_stream_form', $pid); return $output; } @@ -368,10 +368,10 @@ function add_stream_form_submit($form, &$form_state) { $form_state['rebuild'] = TRUE; return; } - module_load_include('inc', 'islandora_repository', 'MimeClass'); - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - $pathToModule = drupal_get_path('module', 'islandora_repository'); + module_load_include('inc', 'fedora_repository', 'MimeClass'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + $pathToModule = drupal_get_path('module', 'fedora_repository'); $file = $form_state['values']['add-stream-file-location']; @@ -413,7 +413,7 @@ function add_stream_form_submit($form, &$form_state) { * @return type */ function add_stream_form(&$form_state, $pid) { - module_load_include('inc', 'islandora_repository', 'formClass'); + module_load_include('inc', 'fedora_repository', 'formClass'); $addDataStreamForm = new formClass(); return $addDataStreamForm->createAddDataStreamForm($pid, $form_state); } @@ -470,14 +470,14 @@ function add_stream_form_validate($form, &$form_state) { * @param type $name * @return type */ -function islandora_repository_purge_stream($pid = NULL, $dsId = NULL, $name = NULL) { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); +function fedora_repository_purge_stream($pid = NULL, $dsId = NULL, $name = NULL) { + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); global $user; if ($pid == NULL || $dsId == NULL) { drupal_set_message(t('You must specify an object pid and DataStream ID to purge a datastream'), 'error'); return ' '; } - if (!islandora_repository_access(OBJECTHELPER :: $PURGE_FEDORA_OBJECTSANDSTREAMS, $pid, $user)) { + if (!fedora_repository_access(OBJECTHELPER :: $PURGE_FEDORA_OBJECTSANDSTREAMS, $pid, $user)) { drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or you do not have permission to purge objects."), 'error'); return ' '; } @@ -486,7 +486,7 @@ function islandora_repository_purge_stream($pid = NULL, $dsId = NULL, $name = NU array( '%name' => $name) ); - $output .= drupal_get_form('islandora_repository_purge_stream_form', $pid, $dsId); + $output .= drupal_get_form('fedora_repository_purge_stream_form', $pid, $dsId); return $output; } @@ -496,8 +496,8 @@ function islandora_repository_purge_stream($pid = NULL, $dsId = NULL, $name = NU * @param type $form_state * @return type */ -function islandora_repository_purge_object_form_submit($form, &$form_state) { - module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); +function fedora_repository_purge_object_form_submit($form, &$form_state) { + module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); $pid = $form_state['values']['pid']; if (!isset($form_state['storage']['confirm'])) { $form_state['storage']['confirm'] = TRUE; // this will cause the form to be rebuilt, entering the confirm part of the form @@ -545,7 +545,7 @@ function islandora_repository_purge_object_form_submit($form, &$form_state) { * @param type $dsId * @return type */ -function islandora_repository_purge_stream_form(&$form_state, $pid, $dsId) { +function fedora_repository_purge_stream_form(&$form_state, $pid, $dsId) { $form['pid'] = array( '#type' => 'hidden', '#value' => "$pid" @@ -568,9 +568,9 @@ function islandora_repository_purge_stream_form(&$form_state, $pid, $dsId) { * @param type $form * @param array $form_state */ -function islandora_repository_purge_stream_form_submit($form, &$form_state) { +function fedora_repository_purge_stream_form_submit($form, &$form_state) { global $base_url; - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); //$client = getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); $pid = $form_state['values']['pid']; $item = new Fedora_Item($pid); @@ -591,12 +591,12 @@ function islandora_repository_purge_stream_form_submit($form, &$form_state) { * @param type $collectionName * @return type */ -function islandora_repository_replace_stream($pid, $dsId, $dsLabel, $collectionName = NULL) { +function fedora_repository_replace_stream($pid, $dsId, $dsLabel, $collectionName = NULL) { if ($pid == NULL || $dsId == NULL) { drupal_set_message(t('You must specify an pid and dsId to replace.'), 'error'); return ''; } - $output = drupal_get_form('islandora_repository_replace_stream_form', $pid, $dsId, $dsLabel); + $output = drupal_get_form('fedora_repository_replace_stream_form', $pid, $dsId, $dsLabel); return $output; } @@ -609,8 +609,8 @@ function islandora_repository_replace_stream($pid, $dsId, $dsLabel, $collectionN * @param type $dsLabel * @return type */ -function islandora_repository_replace_stream_form(&$form_state, $pid, $dsId, $dsLabel) { -//module_load_module_load_include('hp', ''Fedora_Repository'', 'config', 'islandora_repository', ''); +function fedora_repository_replace_stream_form(&$form_state, $pid, $dsId, $dsLabel) { +//module_load_module_load_include('hp', ''Fedora_Repository'', 'config', 'fedora_repository', ''); module_load_include('inc', 'Fedora_Repository', 'formClass'); //$client = getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl')); $replaceDataStreamForm = new formClass(); @@ -623,7 +623,7 @@ function islandora_repository_replace_stream_form(&$form_state, $pid, $dsId, $ds * @param type $form_state * @return type */ -function islandora_repository_replace_stream_form_validate($form, &$form_state) { +function fedora_repository_replace_stream_form_validate($form, &$form_state) { // If a file was uploaded, process it. if (isset($_FILES['files']) && is_uploaded_file($_FILES['files']['tmp_name']['file'])) { @@ -655,7 +655,7 @@ function islandora_repository_replace_stream_form_validate($form, &$form_state) * @param type $form * @param array $form_state */ -function islandora_repository_replace_stream_form_submit($form, &$form_state) { +function fedora_repository_replace_stream_form_submit($form, &$form_state) { global $base_url; $file = $form_state['values']['file']; $pid = $form_state['values']['pid']; @@ -668,7 +668,7 @@ function islandora_repository_replace_stream_form_submit($form, &$form_state) { $dsLabel .= substr($file->filename, strrpos($file->filename, '.')); // Add the file extention to the end of the label.; } module_load_include('inc', 'Fedora_Repository', 'MimeClass'); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $file_basename = basename($file->filepath); $file_directory = dirname($file->filepath); @@ -694,18 +694,18 @@ function islandora_repository_replace_stream_form_submit($form, &$form_state) { * @param type $dsId * @return type */ -function islandora_repository_edit_qdc_page($pid = NULL, $dsId = NULL) { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); +function fedora_repository_edit_qdc_page($pid = NULL, $dsId = NULL) { + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); global $user; if ($pid == NULL || $dsId == NULL) { drupal_set_message(t('You must specify an object pid and a Dublin Core DataStream ID to edit metadata'), 'error'); return ' '; } - if (!islandora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $pid, $user)) { + if (!fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $pid, $user)) { drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or you do not have permission to edit meta data for this object."), 'error'); return ' '; } - $output = drupal_get_form('islandora_repository_edit_qdc_form', $pid, $dsId); + $output = drupal_get_form('fedora_repository_edit_qdc_form', $pid, $dsId); return $output; } @@ -718,20 +718,20 @@ function islandora_repository_edit_qdc_page($pid = NULL, $dsId = NULL) { * @param type $dsId * @return type */ -function islandora_repository_edit_qdc_form(&$form_state, $pid, $dsId = NULL) { - module_load_include('inc', 'islandora_repository', 'ContentModel'); - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); +function fedora_repository_edit_qdc_form(&$form_state, $pid, $dsId = NULL) { + module_load_include('inc', 'fedora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); if ($pid == NULL) { drupal_set_message(t('You must specify an object pid!'), 'error'); } global $user; - if (!islandora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $pid, $user)) { + if (!fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $pid, $user)) { drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or you do not have permission to edit meta data for this object."), 'error'); return ' '; } - module_load_include('inc', 'islandora_repository', 'formClass'); - module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); + module_load_include('inc', 'fedora_repository', 'formClass'); + module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); $soapHelper = new ConnectionHelper(); $client = $soapHelper->getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); // Check if there is a custom edit metadata function defined in the content model. @@ -761,7 +761,7 @@ function islandora_repository_edit_qdc_form(&$form_state, $pid, $dsId = NULL) { * @param type $form * @param boolean $form_state */ -function islandora_repository_edit_qdc_form_validate($form, &$form_state) { +function fedora_repository_edit_qdc_form_validate($form, &$form_state) { if ($form_state['storage']['xml']) { if ($form_state['storage']['step'] == 1) { $form_state['storage']['step']++; @@ -782,14 +782,14 @@ function islandora_repository_edit_qdc_form_validate($form, &$form_state) { * @param array $form_state * @return */ -function islandora_repository_edit_qdc_form_submit($form, &$form_state) { +function fedora_repository_edit_qdc_form_submit($form, &$form_state) { if ($form_state['storage']['xml']) { module_load_include('inc', 'islandora_content_model_forms', 'EditObjectMetadataForm'); $xml_form = new EditObjectMetadataForm($form_state); $xml_form->submit($form, $form_state); } else { - module_load_include('inc', 'islandora_repository', 'ConnectionHelper'); + module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); global $base_url; if (strstr($form_state['clicked_button']['#id'], 'edit-submit')) { @@ -799,13 +799,13 @@ function islandora_repository_edit_qdc_form_submit($form, &$form_state) { // Check the content model for a custom edit metadata form submit function. if (isset($form_state['values']['pid'])) { - module_load_include('inc', 'islandora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); if (($cm = ContentModel::loadFromObject($form_state['values']['pid'])) !== FALSE) { return $cm->handleEditMetadataForm($form_state['values']['form_id'], $form_state, $client); } } - module_load_include('inc', 'islandora_repository', 'formClass'); + module_load_include('inc', 'fedora_repository', 'formClass'); $metaDataForm = new formClass(); $return_value = $metaDataForm->updateMetaData($form_state['values']['form_id'], $form_state['values'], $client); $form_state['storage'] = NULL; @@ -820,8 +820,8 @@ function islandora_repository_edit_qdc_form_submit($form, &$form_state) { * drupal hook * creates a new permission than can be assigned to roles */ -function islandora_repository_perm() { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); +function fedora_repository_perm() { + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); return array( OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, OBJECTHELPER::$EDIT_FEDORA_METADATA, @@ -845,10 +845,10 @@ function islandora_repository_perm() { * @param type $account * @return type */ -function islandora_repository_access($op, $node, $account) { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); +function fedora_repository_access($op, $node, $account) { + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $objectHelper = new ObjectHelper(); - return $objectHelper->islandora_repository_access($op, $node, $account); + return $objectHelper->fedora_repository_access($op, $node, $account); } /** @@ -858,7 +858,7 @@ function islandora_repository_access($op, $node, $account) { * @param $dsID String */ function makeObject($pid, $dsID) { - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); if (!valid_pid($pid)) { drupal_set_message(t("Invalid PID!"), 'error'); return ' '; @@ -874,14 +874,14 @@ function makeObject($pid, $dsID) { return ' '; } global $user; - if (!islandora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { drupal_access_denied(); return; drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace."), 'error'); return ' '; } - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $objectHelper = new ObjectHelper(); $objectHelper->makeObject($pid, $dsID); } @@ -899,10 +899,10 @@ function makeObject($pid, $dsID) { * @param type $limit * @return type */ -function islandora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NULL, $page_number = NULL, $limit = NULL) { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); +function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NULL, $page_number = NULL, $limit = NULL) { + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); global $user; if (!fedora_available()) { @@ -916,7 +916,7 @@ function islandora_repository_get_items($pid = NULL, $dsId = NULL, $collection = } if ($pid == NULL) { - $pid = variable_get('islandora_repository_pid', 'islandora:root'); + $pid = variable_get('fedora_repository_pid', 'islandora:root'); } $item = new fedora_item($pid); @@ -934,9 +934,9 @@ function islandora_repository_get_items($pid = NULL, $dsId = NULL, $collection = drupal_set_message(t("Invalid dsID!"), 'error'); return ' '; } - if (!islandora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + if (!fedora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { if (user_access('access administration pages')) { - drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed !here", array('!here' => l('here', 'admin/settings/islandora_repository'))), 'warning'); + drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed !here", array('!here' => l('here', 'admin/settings/fedora_repository'))), 'warning'); } drupal_access_denied(); exit; @@ -945,7 +945,7 @@ function islandora_repository_get_items($pid = NULL, $dsId = NULL, $collection = $objectHelper = new ObjectHelper(); if ($pid == NULL) { - $pid = variable_get('islandora_repository_pid', 'islandora:root'); + $pid = variable_get('fedora_repository_pid', 'islandora:root'); } $headers = module_invoke_all('file_download', "/fedora/repository/$pid"); if (in_array(-1, $headers)) { @@ -960,10 +960,10 @@ function islandora_repository_get_items($pid = NULL, $dsId = NULL, $collection = $content = '<div id="content-fedora">'; - module_load_include('inc', 'islandora_repository', 'CollectionClass'); + module_load_include('inc', 'fedora_repository', 'CollectionClass'); $collectionClass = new CollectionClass(); - module_load_include('inc', 'islandora_repository', 'ContentModel'); - module_load_include('inc', 'islandora_repository', 'plugins/FedoraObjectDetailedContent'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'plugins/FedoraObjectDetailedContent'); $breadcrumbs = array(); $objectHelper->getBreadcrumbs($pid, $breadcrumbs); drupal_set_breadcrumb(array_reverse($breadcrumbs)); @@ -1009,7 +1009,7 @@ function islandora_repository_get_items($pid = NULL, $dsId = NULL, $collection = * @param type $str * @return type */ -function islandora_repository_urlencode_string($str) { +function fedora_repository_urlencode_string($str) { return htmlentities($str); } @@ -1026,7 +1026,7 @@ function islandora_repository_urlencode_string($str) { */ function fedora_object_as_attachment($pid, $dsId, $label=NULL, $version=NULL) { global $user; - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); if ($pid == NULL || $dsId == NULL) { drupal_set_message(t("no pid or dsid given to create an object with!")); @@ -1046,9 +1046,9 @@ function fedora_object_as_attachment($pid, $dsId, $label=NULL, $version=NULL) { * @return type */ function repository_page($pid = NULL, $dsId = NULL, $collection = NULL, $pageNumber = NULL) { -//do security check at islandora_repository_get_items function as it has to be called there in case +//do security check at fedora_repository_get_items function as it has to be called there in case //someone trys to come in a back door. - return islandora_repository_get_items($pid, $dsId, $collection, $pageNumber); + return fedora_repository_get_items($pid, $dsId, $collection, $pageNumber); } /** @@ -1060,20 +1060,20 @@ function repository_page($pid = NULL, $dsId = NULL, $collection = NULL, $pageNum * @return type */ function repository_service($pid = NULL, $servicePid = NULL, $serviceMethod = NULL) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); global $user; - if (!islandora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { + if (!fedora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { //drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied"), 'error'); drupal_access_denied(); if (user_access('access administration pages')) { - drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed !here", array('!here' => l('here', 'admin/settings/islandora_repository'))), 'error'); + drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed !here", array('!here' => l('here', 'admin/settings/fedora_repository'))), 'error'); } return ' '; } if ($pid == NULL) { - $pid = variable_get('islandora_repository_pid', 'islandora:root'); + $pid = variable_get('fedora_repository_pid', 'islandora:root'); } $headers = module_invoke_all('file_download', "/fedora/repository/$pid"); if (in_array(-1, $headers)) { @@ -1105,9 +1105,9 @@ function repository_service($pid = NULL, $servicePid = NULL, $serviceMethod = NU * @param type $keys * @return array */ -function islandora_repository_search($op = 'search', $keys = NULL) { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); +function fedora_repository_search($op = 'search', $keys = NULL) { + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); switch ($op) { case 'name': @@ -1140,7 +1140,7 @@ function islandora_repository_search($op = 'search', $keys = NULL) { $xmlDoc = NULL; - $path = drupal_get_path('module', 'islandora_repository'); + $path = drupal_get_path('module', 'fedora_repository'); $xmlDoc = new DomDocument(); $xmlDoc->load($path . '/searchTerms.xml'); $nodeList = $xmlDoc->getElementsByTagName('default'); @@ -1188,8 +1188,8 @@ function islandora_repository_search($op = 'search', $keys = NULL) { * @param type $resultData * @return array */ -function islandora_repository_search_page($resultData) { - $path = drupal_get_path('module', 'islandora_repository'); +function fedora_repository_search_page($resultData) { + $path = drupal_get_path('module', 'fedora_repository'); $isRestricted = variable_get('fedora_namespace_restriction_enforced', TRUE); $proc = NULL; if (!$resultData[0][0]['data']) { @@ -1211,7 +1211,7 @@ function islandora_repository_search_page($resultData) { //inject into xsl stylesheet $proc->setParameter('', 'searchToken', drupal_get_token('search_form')); //token generated by Drupal, keeps tack of what tab etc we are on - $proc->setParameter('', 'searchUrl', url('search') . '/islandora_repository'); //needed in our xsl + $proc->setParameter('', 'searchUrl', url('search') . '/fedora_repository'); //needed in our xsl $proc->setParameter('', 'objectsPage', base_path()); $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); $proc->registerPHPFunctions(); @@ -1266,11 +1266,11 @@ function islandora_repository_search_page($resultData) { * @param type $form_state * @param type $form_id */ -function islandora_repository_form_alter(&$form, &$form_state, $form_id) { +function fedora_repository_form_alter(&$form, &$form_state, $form_id) { // Advanced node search form - module_load_include('inc', 'islandora_repository', 'SearchClass'); - $path = drupal_get_path('module', 'islandora_repository'); - if ($form_id == 'search_form' && arg(1) == 'islandora_repository' && user_access('use advanced search')) { + module_load_include('inc', 'fedora_repository', 'SearchClass'); + $path = drupal_get_path('module', 'fedora_repository'); + if ($form_id == 'search_form' && arg(1) == 'fedora_repository' && user_access('use advanced search')) { $default_value = $form['basic']['inline']['keys']['#default_value']; $index = strpos($default_value, '.'); $test = substr($default_value, 0, $index + 1); @@ -1312,7 +1312,7 @@ function islandora_repository_form_alter(&$form, &$form_state, $form_id) { '#value' => t('Advanced search'), '#prefix' => '<div class="action clear-block">', '#suffix' => '</div>', ); - $form['#validate'][] = 'islandora_repository_search_validate'; + $form['#validate'][] = 'fedora_repository_search_validate'; } } @@ -1322,7 +1322,7 @@ function islandora_repository_form_alter(&$form, &$form_state, $form_id) { * @param type $form * @param type $form_state */ -function islandora_repository_search_validate($form, &$form_state) { +function fedora_repository_search_validate($form, &$form_state) { // Initialise using any existing basic search keywords. $keys = $form_state['values']['processed_keys']; @@ -1342,18 +1342,18 @@ function islandora_repository_search_validate($form, &$form_state) { * fedora repository theme * @return type */ -function islandora_repository_theme() { +function fedora_repository_theme() { return array( - 'islandora_repository_mnpl_advanced_search_form' => array( + 'fedora_repository_mnpl_advanced_search_form' => array( 'arguments' => array( 'form' => NULL, ), ), - 'islandora_repository_time' => array( + 'fedora_repository_time' => array( 'arguments' => array( 'element' => NULL ), - 'islandora_repository_solution_packs_list' => array( + 'fedora_repository_solution_packs_list' => array( 'arguments' => array( 'solution_packs' => NULL, ), @@ -1370,8 +1370,8 @@ function islandora_repository_theme() { * @param type $displayName * @return type */ -function islandora_repository_list_terms($field, $startTerm = NULL, $displayName = NULL) { - module_load_include('inc', 'islandora_repository', 'SearchClass'); +function fedora_repository_list_terms($field, $startTerm = NULL, $displayName = NULL) { + module_load_include('inc', 'fedora_repository', 'SearchClass'); $searchClass = new SearchClass(); return $searchClass->getTerms($field, $startTerm, $displayName); } @@ -1380,8 +1380,8 @@ function islandora_repository_list_terms($field, $startTerm = NULL, $displayName * fedora repository mnpl advanced search form * @return type */ -function islandora_repository_mnpl_advanced_search_form() { - module_load_include('inc', 'islandora_repository', 'SearchClass'); +function fedora_repository_mnpl_advanced_search_form() { + module_load_include('inc', 'fedora_repository', 'SearchClass'); $searchClass = new SearchClass(); return $searchClass->build_advanced_search_form(); } @@ -1391,8 +1391,8 @@ function islandora_repository_mnpl_advanced_search_form() { * @param type $form * @return type */ -function theme_islandora_repository_mnpl_advanced_search_form($form) { - module_load_include('inc', 'islandora_repository', 'SearchClass'); +function theme_fedora_repository_mnpl_advanced_search_form($form) { + module_load_include('inc', 'fedora_repository', 'SearchClass'); $advanced_search_form = new SearchClass(); return $advanced_search_form->theme_advanced_search_form($form); } @@ -1403,8 +1403,8 @@ function theme_islandora_repository_mnpl_advanced_search_form($form) { * @param type $startPage * @return type */ -function islandora_repository_mnpl_advanced_search($query, $startPage = 1) { - module_load_include('inc', 'islandora_repository', 'SearchClass'); +function fedora_repository_mnpl_advanced_search($query, $startPage = 1) { + module_load_include('inc', 'fedora_repository', 'SearchClass'); $searchClass = new SearchClass(); $retVal = $searchClass->custom_search($query, $startPage); return $searchClass->custom_search($query, $startPage); @@ -1415,9 +1415,9 @@ function islandora_repository_mnpl_advanced_search($query, $startPage = 1) { * @param type $form * @param type $form_state */ -function islandora_repository_mnpl_advanced_search_form_submit($form, &$form_state) { +function fedora_repository_mnpl_advanced_search_form_submit($form, &$form_state) { $type_id = $form_state['values']['type']; - $repeat = variable_get('islandora_repository_advanced_block_repeat', t('3')); + $repeat = variable_get('fedora_repository_advanced_block_repeat', t('3')); $searchString = $form_state['values']['type1'] . ':' . $form_state['values']['fedora_terms1']; if ($form_state['values']['fedora_terms2'] != '') { $searchString .=' +' . $form_state['values']['andor1'] . '+' . $form_state['values']['type2'] . ':' . $form_state['values']['fedora_terms2']; @@ -1437,8 +1437,8 @@ function islandora_repository_mnpl_advanced_search_form_submit($form, &$form_sta * fedora repository install demo page * @return type */ -function islandora_repository_install_demos_page() { - $output = drupal_get_form('islandora_repository_demo_objects_form'); +function fedora_repository_install_demos_page() { + $output = drupal_get_form('fedora_repository_demo_objects_form'); return $output; } @@ -1446,9 +1446,9 @@ function islandora_repository_install_demos_page() { * fedora repository demo objects form * @return string */ -function islandora_repository_demo_objects_form() { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); +function fedora_repository_demo_objects_form() { + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $form = array(); $existing_demos = array(); @@ -1539,24 +1539,24 @@ function islandora_repository_demo_objects_form() { * @param type $form * @param type $form_state */ -function islandora_repository_demo_objects_form_submit($form, &$form_state) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - module_load_include('inc', 'islandora_repository', 'api/dublin_core'); - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); +function fedora_repository_demo_objects_form_submit($form, &$form_state) { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/dublin_core'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); global $base_url; if ($form_state['clicked_button']['#name'] == 'install_demos') { if (!empty($form_state['values']['demo_collections']['islandora:collectionCModel'])) { try { $collectioncm = Fedora_Item::ingest_new_item('islandora:collectionCModel', 'A', 'Islandora Collection Content Model'); $collectioncm->add_relationship('hasModel', 'fedora-system:ContentModel-3.0', FEDORA_MODEL_URI); - $collectioncm->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/content_models/COLLECTIONCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); + $collectioncm->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/content_models/COLLECTIONCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); } catch (exception $e) { } try { $strictpdfcm = Fedora_Item::ingest_new_item('islandora:strict_pdf', 'A', 'Strict PDF Content Model'); $strictpdfcm->add_relationship('hasModel', 'fedora-system:ContentModel-3.0', FEDORA_MODEL_URI); - $strictpdfcm->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/content_models/STRICT_PDFCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); + $strictpdfcm->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/content_models/STRICT_PDFCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); } catch (exception $e) { } @@ -1578,8 +1578,8 @@ function islandora_repository_demo_objects_form_submit($form, &$form_state) { order by $title', 'QUERY', 'Content Model Collection Query', 'text/plain'); $cmodel_collection->add_relationship('isMemberOfCollection', 'islandora:root'); $cmodel_collection->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); - $cmodel_collection->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/collection_views/simple_list_view.xml', 'COLLECTION_VIEW', 'Collection View', 'text/xml', 'X'); - $cmodel_collection->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/images/contentModel.jpg', 'TN', 'Thumbnail', 'image/jpg', 'M'); + $cmodel_collection->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_views/simple_list_view.xml', 'COLLECTION_VIEW', 'Collection View', 'text/xml', 'X'); + $cmodel_collection->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/contentModel.jpg', 'TN', 'Thumbnail', 'image/jpg', 'M'); drupal_set_message(t("Successfully installed <a href=\"" . $base_url . "/fedora/repository/islandora:ContentModelCollection\">islandora:ContentModelCollection</a>."), 'message'); } catch (exception $e) { @@ -1589,9 +1589,9 @@ function islandora_repository_demo_objects_form_submit($form, &$form_state) { if (!empty($form_state['values']['demo_collections']['islandora:root'])) { $new_item = Fedora_Item::ingest_new_item('islandora:root', 'A', 'Islandora Top-level Collection'); $new_item->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); - $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/collection_policies/COLLECTION-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); + $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_policies/COLLECTION-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); try { - $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); + $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); drupal_set_message(t("Successfully installed <a href=\"" . $base_url . "/fedora/repository/islandora:root\">islandora:root</a>."), 'message'); } catch (exception $e) { @@ -1602,16 +1602,16 @@ function islandora_repository_demo_objects_form_submit($form, &$form_state) { $new_item = fedora_item::ingest_new_item('islandora:demos', 'A', 'Islandora Demo Collection'); $new_item->add_relationship('isMemberOfCollection', 'islandora:root'); $new_item->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); - $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/collection_policies/COLLECTION-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); + $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_policies/COLLECTION-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); -// $cv = $new_item->add_datastream_from_file( drupal_get_path('module', 'islandora_repository') . '/collection_views/COLLECTION_VIEW.xml', 'COLLECTION_VIEW', 'Collection View.xml', 'text/xml', 'X'); - $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); +// $cv = $new_item->add_datastream_from_file( drupal_get_path('module', 'fedora_repository') . '/collection_views/COLLECTION_VIEW.xml', 'COLLECTION_VIEW', 'Collection View.xml', 'text/xml', 'X'); + $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); try { $new_item = Fedora_Item::ingest_new_item('islandora:pdf_collection', 'A', 'PDF Collection'); $new_item->add_relationship('isMemberOfCollection', 'islandora:demos'); $new_item->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI); - $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/collection_policies/PDF-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); - $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/images/Crystal_Clear_mimetype_pdf.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); + $cp = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_policies/PDF-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy', 'text/xml', 'X'); + $tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Crystal_Clear_mimetype_pdf.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); drupal_set_message(t("Successfully installed <a href=\"" . $base_url . "/fedora/repository/islandora:demos\">islandora:demos</a>."), 'message'); } catch (exception $e) { @@ -1620,20 +1620,20 @@ function islandora_repository_demo_objects_form_submit($form, &$form_state) { if (!empty($form_state['values']['demo_collections']['demo:SmileyStuff'])) { $smiley_stuff = new Fedora_Item('demo:SmileyStuff'); - $new_item = $smiley_stuff->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/collection_views/SmileyStuff-COLLECTION_VIEW.xml', 'COLLECTION_VIEW', 'Collection View', 'text/xml', 'X'); + $new_item = $smiley_stuff->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_views/SmileyStuff-COLLECTION_VIEW.xml', 'COLLECTION_VIEW', 'Collection View', 'text/xml', 'X'); $smiley_stuff->add_relationship('isMemberOfCollection', 'info:fedora/islandora:demos'); - $tn = $smiley_stuff->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/images/smileytn.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); - $cp = $smiley_stuff->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/collection_policies/JPG-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy.xml', 'application/xml', 'X'); + $tn = $smiley_stuff->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/smileytn.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); + $cp = $smiley_stuff->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/collection_policies/JPG-COLLECTION POLICY.xml', 'COLLECTION_POLICY', 'Collection Policy.xml', 'application/xml', 'X'); $cm = new Fedora_Item('demo:DualResImage'); try { - $cmstream = $cm->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/content_models/STANDARD JPG.xml', 'ISLANDORACM', 'Content Model.xml', 'application/xml', 'X'); + $cmstream = $cm->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/content_models/STANDARD JPG.xml', 'ISLANDORACM', 'Content Model.xml', 'application/xml', 'X'); } catch (exception $e) { } $dual_res_image_collection_cmodel = new Fedora_Item('demo:DualResImageCollection'); try { - $cmstream = $dual_res_image_collection_cmodel->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/content_models/COLLECTIONCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); + $cmstream = $dual_res_image_collection_cmodel->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/content_models/COLLECTIONCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); drupal_set_message(t("Successfully installed <a href=\"" . $base_url . "/fedora/repository/demo:SmileyStuff\">demo:SmileyStuff</a> collection view."), 'message'); } catch (exception $e) { @@ -1645,14 +1645,14 @@ function islandora_repository_demo_objects_form_submit($form, &$form_state) { foreach (array('islandora_jp2Sdep-slideCModel.xml', 'islandora_mods2htmlSdef.xml', 'islandora_mods2htmlSdep.xml', 'islandora_slideCModel.xml', 'islandora_viewerSdep-slideCModel.xml', 'ilives_jp2Sdef.xml', 'ilives_viewerSdef.xml') as $foxml_file) { try { - $item = Fedora_Item::ingest_from_FOXML_file(drupal_get_path('module', 'islandora_repository') . '/content_models/' . $foxml_file); + $item = Fedora_Item::ingest_from_FOXML_file(drupal_get_path('module', 'fedora_repository') . '/content_models/' . $foxml_file); } catch (exception $e) { $error .= " - Problem ingesting $foxml_file"; } } try { - $item = Fedora_Item::ingest_from_FOXML_file(drupal_get_path('module', 'islandora_repository') . '/content_models/islandora_largeimages.xml'); - $tn = $item->add_datastream_from_file(drupal_get_path('module', 'islandora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); + $item = Fedora_Item::ingest_from_FOXML_file(drupal_get_path('module', 'fedora_repository') . '/content_models/islandora_largeimages.xml'); + $tn = $item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Gnome-emblem-photos.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); drupal_set_message(t("Successfully installed <a href=\"" . $base_url . "/fedora/repository/islandora:largeimages\">islandora:largeimages</a>."), 'message'); } catch (exception $e) { $error .= " - Problem ingesting islandora:largeimages collection"; @@ -1669,12 +1669,12 @@ function islandora_repository_demo_objects_form_submit($form, &$form_state) { * fedora repository required fedora objects * @return type */ -function islandora_repository_required_fedora_objects() { +function fedora_repository_required_fedora_objects() { // array( 'path-to-foxml-file', 'pid', 'dsid', 'path-to-datastream-file', int dsversion, boolean required) - $module_path = drupal_get_path('module', 'islandora_repository'); + $module_path = drupal_get_path('module', 'fedora_repository'); return array( - 'islandora_repository' => array( - 'module' => 'islandora_repository', + 'fedora_repository' => array( + 'module' => 'fedora_repository', 'title' => 'Islandora Core', 'objects' => array( array( @@ -1710,10 +1710,10 @@ function islandora_repository_required_fedora_objects() { /** * Functions to create a time selector form element type. */ -function islandora_repository_elements() { - $type['islandora_repository_time'] = array( +function fedora_repository_elements() { + $type['fedora_repository_time'] = array( "#input" => TRUE, - "#process" => array("islandora_repository_expand_time"), + "#process" => array("fedora_repository_expand_time"), ); return $type; @@ -1724,7 +1724,7 @@ function islandora_repository_elements() { * @param type $element * @return string */ -function islandora_repository_expand_time($element) { +function fedora_repository_expand_time($element) { // Default to current time, check default_value but set value so that if // default value is present it will override value if (empty($element['#default_value'])) { @@ -1767,7 +1767,7 @@ function islandora_repository_expand_time($element) { * @param type $element * @return type */ -function islandora_repository_time($element) { +function fedora_repository_time($element) { $output = '<div class="container-inline">' . $element['#children'] . '</div>'; return theme('form_element', $element, $output); } @@ -1777,7 +1777,7 @@ function islandora_repository_time($element) { * @param type $element * @return type */ -function theme_islandora_repository_time($element) { +function theme_fedora_repository_time($element) { $output = '<div class="container-inline">' . $element['#children'] . '</div>'; return theme('form_element', $element, $output); } @@ -1788,9 +1788,9 @@ function theme_islandora_repository_time($element) { * fedora repository remove item from basket * @param type $pid */ -function islandora_repository_remove_item_from_basket($pid) { +function fedora_repository_remove_item_from_basket($pid) { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $pids = empty($_SESSION['basket']['processed']) ? array() : $_SESSION['basket']['processed']; $objectHelper = new ObjectHelper(); @@ -1804,7 +1804,7 @@ function islandora_repository_remove_item_from_basket($pid) { if (!empty($cpids)) { // there are children foreach ($cpids as $child_pid => $value) { // remove child item from basket recursively - islandora_repository_remove_item_from_basket($child_pid); + fedora_repository_remove_item_from_basket($child_pid); } } } @@ -1813,14 +1813,14 @@ function islandora_repository_remove_item_from_basket($pid) { * fedora repository basket * @return type */ -function islandora_repository_basket() { - $pids = _islandora_repository_get_basket_pids(); - $output = drupal_get_form('islandora_repository_basket_form', $pids); +function fedora_repository_basket() { + $pids = _fedora_repository_get_basket_pids(); + $output = drupal_get_form('fedora_repository_basket_form', $pids); return $output; } -function islandora_repository_basket_form($form_state, $pids) { +function fedora_repository_basket_form($form_state, $pids) { $form = array(); if (!empty($pids)) { @@ -1874,7 +1874,7 @@ function islandora_repository_basket_form($form_state, $pids) { * @param type $form * @return string */ -function theme_islandora_repository_basket_form($form) { +function theme_fedora_repository_basket_form($form) { $header = array( theme('table_select_header_cell'), t('PID'), @@ -1909,7 +1909,7 @@ function theme_islandora_repository_basket_form($form) { * @param type $form * @param type $form_state */ -function islandora_repository_basket_form_validate($form, &$form_state) { +function fedora_repository_basket_form_validate($form, &$form_state) { } @@ -1920,13 +1920,13 @@ function islandora_repository_basket_form_validate($form, &$form_state) { * @param type $form_state * @return type */ -function islandora_repository_basket_form_submit($form, &$form_state) { +function fedora_repository_basket_form_submit($form, &$form_state) { if ($form_state['values']['op'] == $form_state['values']['remove_submit']) { $pids = $form_state['clicked_button']['#post']['remove']; if (isset($pids)) { foreach ($pids as $pid) { - islandora_repository_remove_from_basket($pid); + fedora_repository_remove_from_basket($pid); } drupal_set_message(t("Selected objects removed")); return; @@ -1934,14 +1934,14 @@ function islandora_repository_basket_form_submit($form, &$form_state) { } if ($form_state['values']['op'] == $form_state['values']['remove_all']) { - _islandora_repository_empty_basket(); + _fedora_repository_empty_basket(); drupal_set_message(t("Basket emptied")); return; } if ($form_state['values']['op'] == $form_state['values']['submit_all']) { $msg = t("All objects exported to staging area"); - $pids = _islandora_repository_get_basket_pids(); + $pids = _fedora_repository_get_basket_pids(); } elseif ($form_state['values']['op'] == $form_state['values']['submit']) { $msg = t("Selected objects exported to staging area"); @@ -1960,7 +1960,7 @@ function islandora_repository_basket_form_submit($form, &$form_state) { return FALSE; } - module_load_include('inc', 'islandora_repository', 'api/fedora_export'); + module_load_include('inc', 'fedora_repository', 'api/fedora_export'); foreach ($pids as $pid => $arr) { $objects_dir = $export_dir . '/objects/' . $pid; @@ -1977,7 +1977,7 @@ function islandora_repository_basket_form_submit($form, &$form_state) { $msg .= ":<br/>" . implode("<br/>", $log); drupal_set_message($msg, $success ? 'info' : 'error'); -//_islandora_repository_empty_basket(); +//_fedora_repository_empty_basket(); } else { drupal_set_message(t("No objects selected or basket empty"), 'error'); @@ -1991,7 +1991,7 @@ function islandora_repository_basket_form_submit($form, &$form_state) { * * @return type */ -function _islandora_repository_get_basket_pids() { +function _fedora_repository_get_basket_pids() { // Set empty defaults if basket elements are missing $_SESSION['basket'] = isset($_SESSION['basket']) ? $_SESSION['basket'] : array('processed' => array(), 'unprocessed' => array()); @@ -2000,7 +2000,7 @@ function _islandora_repository_get_basket_pids() { $pids = empty($_SESSION['basket']['processed']) ? array() : $_SESSION['basket']['processed']; - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $ob = new ObjectHelper(); foreach ($_SESSION['basket']['unprocessed'] as $pid) { // Check if the pid already exists in the tree @@ -2021,7 +2021,7 @@ function _islandora_repository_get_basket_pids() { /** * fedora repository empty basket */ -function _islandora_repository_empty_basket() { +function _fedora_repository_empty_basket() { unset($_SESSION['basket']); } @@ -2031,7 +2031,7 @@ function _islandora_repository_empty_basket() { * @param type $warn * @param type $searchResultsFlag */ -function islandora_repository_add_to_basket($pid, $warn = TRUE, $searchResultsFlag = FALSE) { +function fedora_repository_add_to_basket($pid, $warn = TRUE, $searchResultsFlag = FALSE) { if ($warn && _is_added_to_basket($pid)) { drupal_set_message(t("Object already in basket")); } @@ -2054,7 +2054,7 @@ function islandora_repository_add_to_basket($pid, $warn = TRUE, $searchResultsFl * @param type $pid * @return type */ -function islandora_repository_remove_from_basket($pid) { +function fedora_repository_remove_from_basket($pid) { if (isset($_SESSION['basket']['unprocessed'][$pid])) { unset($_SESSION['basket']['unprocessed'][$pid]); } @@ -2110,8 +2110,8 @@ function _is_added_to_basket($pid, $account = NULL) { * @param type $file * @return type */ -function islandora_repository_display_schema($file) { - $path = drupal_get_path('module', 'islandora_repository'); +function fedora_repository_display_schema($file) { + $path = drupal_get_path('module', 'fedora_repository'); if (strtolower(substr($file, -3)) == 'xsd' && file_exists($path . '/' . $file)) { drupal_goto($path . '/' . $file); } @@ -2127,9 +2127,9 @@ function islandora_repository_display_schema($file) { * @param type $context * @return type */ -function islandora_repository_batch_reingest_object($object, &$context) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); +function fedora_repository_batch_reingest_object($object, &$context) { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); if (!empty($object) && is_array($object)) { $pid = $object['pid']; if (!valid_pid($pid)) { @@ -2195,7 +2195,7 @@ function islandora_repository_batch_reingest_object($object, &$context) { * @param string $datastream_file * @return int, or NULL if no version attribute was found. */ -function islandora_repository_get_islandora_datastream_version($item = NULL, $dsid = NULL, $datastream_file = NULL) { +function fedora_repository_get_islandora_datastream_version($item = NULL, $dsid = NULL, $datastream_file = NULL) { $return = NULL; if (isset($item)) { $doc = simplexml_load_string($item->get_datastream_dissemination($dsid)); @@ -2221,9 +2221,9 @@ function islandora_repository_get_islandora_datastream_version($item = NULL, $ds * @param type $solution_packs * @return string */ -function theme_islandora_repository_solution_packs_list($solution_packs) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); +function theme_fedora_repository_solution_packs_list($solution_packs) { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); $output = ''; $header = array(); $rows = array(); @@ -2240,11 +2240,11 @@ function theme_islandora_repository_solution_packs_list($solution_packs) { * @param string $form_id * @return array */ -function islandora_repository_forms($form_id) { +function fedora_repository_forms($form_id) { $forms = array(); - if (strpos($form_id, 'islandora_repository_solution_pack_form_') === 0) { + if (strpos($form_id, 'fedora_repository_solution_pack_form_') === 0) { $forms[$form_id] = array( - 'callback' => 'islandora_repository_solution_pack_form', + 'callback' => 'fedora_repository_solution_pack_form', ); } return $forms; diff --git a/islandora_repository.solutionpacks.inc b/fedora_repository.solutionpacks.inc similarity index 84% rename from islandora_repository.solutionpacks.inc rename to fedora_repository.solutionpacks.inc index 633d28fe..de4ce137 100644 --- a/islandora_repository.solutionpacks.inc +++ b/fedora_repository.solutionpacks.inc @@ -20,7 +20,7 @@ * * Datastreams which don't have this element are assumed to be at version 0. */ -function islandora_repository_solution_packs_page() { +function fedora_repository_solution_packs_page() { $enabled_solution_packs = module_invoke_all('required_fedora_objects'); $output = ''; foreach ($enabled_solution_packs as $solution_pack_module => $solution_pack_info) { @@ -35,7 +35,7 @@ function islandora_repository_solution_packs_page() { break; } } - $output .= drupal_get_form('islandora_repository_solution_pack_form_' . $solution_pack_module, $solution_pack_module, $solution_pack_name, $objects); + $output .= drupal_get_form('fedora_repository_solution_pack_form_' . $solution_pack_module, $solution_pack_module, $solution_pack_name, $objects); } return $output; @@ -45,9 +45,9 @@ function islandora_repository_solution_packs_page() { * Check for installed objects and add a 'Update' or 'Install' button if some objects are missing. * @param array $solution_pack */ -function islandora_repository_solution_pack_form(&$form_state, $solution_pack_module, $solution_pack_name, $objects = array()) { +function fedora_repository_solution_pack_form(&$form_state, $solution_pack_module, $solution_pack_name, $objects = array()) { // Check each object to see if it is in the repository. - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); global $base_path; $needs_update = FALSE; $needs_install = FALSE; @@ -111,8 +111,8 @@ function islandora_repository_solution_pack_form(&$form_state, $solution_pack_mo } if (isset($ds['dsversion'])) { // Check if the datastream is versioned and needs updating. - $installed_version = islandora_repository_get_islandora_datastream_version($item, $ds['dsid']); - $available_version = islandora_repository_get_islandora_datastream_version(NULL, NULL, $ds['datastream_file']); + $installed_version = fedora_repository_get_islandora_datastream_version($item, $ds['dsid']); + $available_version = fedora_repository_get_islandora_datastream_version(NULL, NULL, $ds['datastream_file']); if ($available_version > $installed_version) { $needs_update = TRUE; $object_status = 'Out of date'; @@ -151,25 +151,25 @@ function islandora_repository_solution_pack_form(&$form_state, $solution_pack_mo ); $form['#submit'] = array( - 'islandora_repository_solution_pack_form_submit', + 'fedora_repository_solution_pack_form_submit', ); return $form; } -function islandora_repository_solution_pack_form_submit($form, &$form_state) { +function fedora_repository_solution_pack_form_submit($form, &$form_state) { $what = $form_state; $module_name = $form_state['values']['solution_pack_module']; $solution_pack_info = call_user_func($module_name . '_required_fedora_objects'); $batch = array( 'title' => t('Installing / updating solution pack objects'), - 'file' => drupal_get_path('module', 'islandora_repository') . '/islandora_repository.module', + 'file' => drupal_get_path('module', 'fedora_repository') . '/fedora_repository.module', 'operations' => array(), ); foreach ($solution_pack_info[$module_name]['objects'] as $object) { // Add this object to the batch job queue. - $batch['operations'][] = array('islandora_repository_batch_reingest_object', array($object)); + $batch['operations'][] = array('fedora_repository_batch_reingest_object', array($object)); } batch_set($batch); } diff --git a/formClass.inc b/formClass.inc index a7abe947..af0dc218 100644 --- a/formClass.inc +++ b/formClass.inc @@ -24,15 +24,15 @@ class formClass { function createMenu() { $items = array(); - $items['admin/settings/islandora_repository'] = array( + $items['admin/settings/fedora_repository'] = array( 'title' => t('Islandora Configure'), 'description' => t('Enter the Islandora Collection information here'), 'page callback' => 'drupal_get_form', - 'page arguments' => array('islandora_repository_admin'), + 'page arguments' => array('fedora_repository_admin'), 'access arguments' => array('administer site configuration'), 'type' => MENU_NORMAL_ITEM, ); - $items['admin/settings/islandora_repository/collection'] = array( + $items['admin/settings/fedora_repository/collection'] = array( 'title' => t('Collection list'), 'description' => t('Enter the Islandora collection information here.'), 'access arguments' => array('administer site configuration'), @@ -40,18 +40,18 @@ class formClass { 'weight' => 0, ); - $items['admin/settings/islandora_repository/demoobjects'] = array( + $items['admin/settings/fedora_repository/demoobjects'] = array( 'title' => t('Solution Packs'), 'description' => t('Install content models and collections required by installed solution packs.'), - 'page callback' => 'islandora_repository_solution_packs_page', + 'page callback' => 'fedora_repository_solution_packs_page', 'access arguments' => array('add fedora datastreams'), - 'file' => 'islandora_repository.solutionpacks.inc', + 'file' => 'fedora_repository.solutionpacks.inc', 'type' => MENU_LOCAL_TASK, ); $items['islandoracm.xsd'] = array( 'title' => t('Islandora Content Model XML Schema Definition'), - 'page callback' => 'islandora_repository_display_schema', + 'page callback' => 'fedora_repository_display_schema', 'page arguments' => array('islandoracm.xsd'), 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection'), @@ -59,7 +59,7 @@ class formClass { $items['collection_policy.xsd'] = array( 'title' => t('Islandora Content Model XML Schema Definition'), - 'page callback' => 'islandora_repository_display_schema', + 'page callback' => 'fedora_repository_display_schema', 'page arguments' => array('collection_policy.xsd'), 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection'), @@ -70,7 +70,7 @@ class formClass { 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection'), ); - $repository_title = variable_get('islandora_repository_title', 'Digital repository'); + $repository_title = variable_get('fedora_repository_title', 'Digital repository'); if (trim($repository_title) != '') { $respository_title = t($repository_title); } @@ -100,7 +100,7 @@ class formClass { $items['fedora/repository/editmetadata'] = array( 'title' => t('Edit metadata'), - 'page callback' => 'islandora_repository_edit_qdc_page', + 'page callback' => 'fedora_repository_edit_qdc_page', // 'page arguments' => array(1), //'type' => MENU_LOCAL_TASK, 'type' => MENU_CALLBACK, @@ -109,21 +109,21 @@ class formClass { $items['fedora/repository/purgeStream'] = array( 'title' => t('Purge data stream'), - 'page callback' => 'islandora_repository_purge_stream', + 'page callback' => 'fedora_repository_purge_stream', 'type' => MENU_CALLBACK, 'access arguments' => array('purge objects and datastreams') ); $items['fedora/repository/replaceStream'] = array( 'title' => t('Replace Stream'), - 'page callback' => 'islandora_repository_replace_stream', + 'page callback' => 'fedora_repository_replace_stream', 'type' => MENU_CALLBACK, 'access arguments' => array('add fedora datastreams'), ); $items['fedora/repository/purgeObject'] = array( 'title' => t('Purge object'), - 'page callback' => 'islandora_repository_purge_object', + 'page callback' => 'fedora_repository_purge_object', // 'type' => MENU_LOCAL_TASK, 'type' => MENU_CALLBACK, 'access arguments' => array('purge objects and datastreams') @@ -147,21 +147,21 @@ class formClass { //new for mnpl****************************************** $items['fedora/repository/mnpl_advanced_search'] = array( 'title' => t('Repository advanced search'), - 'page callback' => 'islandora_repository_mnpl_advanced_search', + 'page callback' => 'fedora_repository_mnpl_advanced_search', 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection') ); $items['fedora/ingestObject'] = array( 'title' => t('Ingest object'), - 'page callback' => 'islandora_repository_ingest_object', + 'page callback' => 'fedora_repository_ingest_object', 'type' => MENU_CALLBACK, 'access arguments' => array('add fedora datastreams') ); $items['fedora/repository/list_terms'] = array( 'title' => t('List terms'), - 'page callback' => 'islandora_repository_list_terms', + 'page callback' => 'fedora_repository_list_terms', 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection') ); @@ -170,25 +170,25 @@ class formClass { $items['fedora/basket'] = array( 'title' => t('Fedora Basket'), 'description' => t('View and download objects added to your basket'), - 'page callback' => 'islandora_repository_basket', + 'page callback' => 'fedora_repository_basket', 'access arguments' => array('view fedora collection'), 'type' => MENU_CALLBACK, ); $items['fedora/repository/addToBasket'] = array( - 'page callback' => 'islandora_repository_add_to_basket', + 'page callback' => 'fedora_repository_add_to_basket', 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection'), ); $items['fedora/repository/removeFromBasket'] = array( - 'page callback' => 'islandora_repository_remove_from_basket', + 'page callback' => 'fedora_repository_remove_from_basket', 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection'), ); $items['fedora/repository/add_search_results_to_basket'] = array( - 'page callback' => 'islandora_repository_add_search_results_to_basket', + 'page callback' => 'fedora_repository_add_search_results_to_basket', 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection'), ); @@ -205,21 +205,21 @@ class formClass { drupal_set_message(t('You must be a site administrator to edit the Fedora collecitons list.'), 'error'); return; } - module_load_include('inc', 'islandora_repository', 'api/fedora_utils'); - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $form = array(); - $form['islandora_repository_name'] = array( + $form['fedora_repository_name'] = array( '#type' => 'textfield', '#title' => t('Root Collection Name'), - '#default_value' => variable_get('islandora_repository_name', 'Islandora demos collection'), + '#default_value' => variable_get('fedora_repository_name', 'Islandora demos collection'), '#description' => t('The Name of the Root Collection Object'), '#required' => TRUE, '#weight' => -20 ); - $form['islandora_repository_pid'] = array( + $form['fedora_repository_pid'] = array( '#type' => 'textfield', '#title' => t('Root Collection PID'), - '#default_value' => variable_get('islandora_repository_pid', 'islandora:root'), + '#default_value' => variable_get('fedora_repository_pid', 'islandora:root'), '#description' => t('The PID of the Root Collection Object'), '#required' => TRUE, '#weight' => -18 @@ -235,10 +235,10 @@ class formClass { ); - $form['islandora_repository_url'] = array( + $form['fedora_repository_url'] = array( '#type' => 'textfield', '#title' => t('Fedora RISearch URL'), - '#default_value' => variable_get('islandora_repository_url', 'http://localhost:8080/fedora/risearch'), + '#default_value' => variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'), '#description' => t('The url of the Fedora server'), '#required' => TRUE, '#weight' => -14 ); @@ -296,10 +296,10 @@ class formClass { '#weight' => 0 ); } - $form['islandora_repository_title'] = array( + $form['fedora_repository_title'] = array( '#type' => 'textfield', '#title' => t('Digital Repository Title'), - '#default_value' => variable_get('islandora_repository_title', 'Digital Repository'), + '#default_value' => variable_get('fedora_repository_title', 'Digital Repository'), '#description' => t('The title displayed when viewing collections and objects in /fedora/repository. Leave blank to display no title. Note that the menus must be rebuilt after changing this variable.'), ); $form['advanced'] = array( @@ -432,7 +432,7 @@ class formClass { * @return type */ function can_ingest_here($collection_pid) { - module_load_include('inc', 'islandora_repository', 'SecurityClass'); + module_load_include('inc', 'fedora_repository', 'SecurityClass'); $securityClass = new SecurityClass(); return $securityClass->canIngestHere($collection_pid); } @@ -447,7 +447,7 @@ class formClass { drupal_set_message(t('You do not have permission to ingest.'), 'error'); return FALSE; } - module_load_include('inc', 'islandora_repository', 'SecurityClass'); + module_load_include('inc', 'fedora_repository', 'SecurityClass'); $security_class = new SecurityClass(); if (!$security_class->canIngestHere($collection_pid)) { // Queries the collection object for a child security datastream and if found parses it @@ -507,7 +507,7 @@ class formClass { ), 'submit' => array( '#type' => 'submit', - '#submit' => array('islandora_repository_ingest_form_submit'), + '#submit' => array('fedora_repository_ingest_form_submit'), '#value' => t('Next') ), ); @@ -523,7 +523,7 @@ class formClass { * @return array */ function createQDCIngestFormPageTwo($collection_pid, $collection_label, array &$form_state) { - module_load_include('inc', 'islandora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); $form = array(); $content_model_pid = ContentModel::getPidFromIdentifier($form_state['values']['models']); $content_model_dsid = ContentModel::getDSIDFromIdentifier($form_state['values']['models']); @@ -541,7 +541,7 @@ class formClass { ); $form['submit'] = array( '#type' => 'submit', - '#submit' => array('islandora_repository_ingest_form_submit'), + '#submit' => array('fedora_repository_ingest_form_submit'), '#value' => t('Ingest') ); } @@ -558,7 +558,7 @@ class formClass { * @return array */ function createQDCIngestForm($collection_pid, $collection_label, array &$form_state) { - module_load_include('inc', 'islandora_repository', 'CollectionPolicy'); + module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); $form_state['storage']['step'] = empty($form_state['storage']['step']) ? 1 : $form_state['storage']['step']; if ($form_state['storage']['step'] == 1) { return $this->createQDCIngestFormPageOne($collection_pid, $collection_label, $form_state); @@ -603,9 +603,9 @@ class formClass { //dump_vars($form_state); // Populate the list of datastream IDs. - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); - module_load_include('inc', 'islandora_repository', 'ContentModel'); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $obj_helper = new ObjectHelper(); $content_models = $obj_helper->get_content_models_list($pid); diff --git a/islandoracm.xsd b/islandoracm.xsd index 21ab6661..bce83136 100644 --- a/islandoracm.xsd +++ b/islandoracm.xsd @@ -48,14 +48,14 @@ </xsd:complexType> <xsd:complexType name="form_builder_methodType"> <xsd:attribute name="file" type="xsd:normalizedString" use="required"/> - <xsd:attribute name="module" type="xsd:normalizedString" default="islandora_repository"/> + <xsd:attribute name="module" type="xsd:normalizedString" default="fedora_repository"/> <xsd:attribute name="class" type="xsd:normalizedString" use="required"/> <xsd:attribute name="method" type="xsd:normalizedString" use="required"/> <xsd:attribute name="handler" type="xsd:normalizedString" use="required"/> </xsd:complexType> <xsd:complexType name="edit_metadata_methodType"> <xsd:attribute name="file" type="xsd:normalizedString" use="required"/> - <xsd:attribute name="module" type="xsd:normalizedString" default="islandora_repository"/> + <xsd:attribute name="module" type="xsd:normalizedString" default="fedora_repository"/> <xsd:attribute name="class" type="xsd:normalizedString" use="required"/> <xsd:attribute name="method" type="xsd:normalizedString" use="required"/> <xsd:attribute name="handler" type="xsd:normalizedString" use="required"/> @@ -118,7 +118,7 @@ </xsd:all> <xsd:attribute name="file" type="xsd:normalizedString" use="required"/> - <xsd:attribute name="module" type="xsd:normalizedString" default="islandora_repository"/> + <xsd:attribute name="module" type="xsd:normalizedString" default="fedora_repository"/> <xsd:attribute name="class" type="xsd:normalizedString" use="required"/> <xsd:attribute name="method" type="xsd:normalizedString" use="required"/> <xsd:attribute name="dsid" type="xsd:normalizedString" use="required"/> @@ -149,7 +149,7 @@ <xsd:element name="parameters" type="parametersType" minOccurs="0"/> </xsd:all> <xsd:attribute name="file" type="xsd:normalizedString" use="required"/> - <xsd:attribute name="module" type="xsd:normalizedString" default="islandora_repository"/> + <xsd:attribute name="module" type="xsd:normalizedString" default="fedora_repository"/> <xsd:attribute name="class" type="xsd:normalizedString" use="required"/> <xsd:attribute name="method" type="xsd:normalizedString" use="required"/> <xsd:attribute name="dsid" type="xsd:normalizedString" use="required"/> @@ -171,7 +171,7 @@ <xsd:complexContent> <xsd:restriction base="xsd:anyType"> <xsd:attribute name="file" type="xsd:normalizedString" use="required"/> - <xsd:attribute name="module" type="xsd:normalizedString" default="islandora_repository"/> + <xsd:attribute name="module" type="xsd:normalizedString" default="fedora_repository"/> <xsd:attribute name="class" type="xsd:normalizedString" use="required"/> <xsd:attribute name="method" type="xsd:normalizedString" use="required"/> <xsd:attribute name="default" type="xsd:boolean" default="false"/> diff --git a/plugins/CollectionFormBuilder.inc b/plugins/CollectionFormBuilder.inc index 6d901b21..a385aa26 100644 --- a/plugins/CollectionFormBuilder.inc +++ b/plugins/CollectionFormBuilder.inc @@ -7,7 +7,7 @@ * Collection Form Builder */ -module_load_include('inc', 'islandora_repository', 'plugins/FormBuilder'); +module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder'); /** * implements methods from content model ingest form xml @@ -32,7 +32,7 @@ class CollectionFormBuilder extends FormBuilder { * @param type $rootElement */ function createFedoraDataStreams($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'islandora_repository', 'MimeClass'); + module_load_include('inc', 'fedora_repository', 'MimeClass'); global $base_url; $mimetype = new MimeClass(); diff --git a/plugins/DarwinCore.inc b/plugins/DarwinCore.inc index 814e9dfb..5ab525b6 100644 --- a/plugins/DarwinCore.inc +++ b/plugins/DarwinCore.inc @@ -21,7 +21,7 @@ class DarwinCore { * @param type $item */ function __construct($item = NULL) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); if (!empty($item)) { $this->owner = $item; if (array_key_exists('DARWIN_CORE', $item->get_datastreams_list_as_array())) { @@ -200,7 +200,7 @@ class DarwinCore { * @param type $form_values */ public function handleForm($form_values) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); global $user; //$new_item = Fedora_Item::ingest_new_item($form_values['pid'], 'A', $form_values['dwc:institutionCode'].':'.$form_values['dwc:collectionCode'].':'.$form_values['dwc:catalogNumber'], $user->name); //$new_item->add_datastream_from_string($this->darwinCoreXML, 'DARWIN_CORE', 'Darwin Core Metadata', 'text/xml', 'X'); @@ -248,8 +248,8 @@ class DarwinCore { */ public function asHTML() { $path = drupal_get_path('module', 'Fedora_Repository'); - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); - module_load_include('inc', 'islandora_repository', 'CollectionClass'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'CollectionClass'); $xmlstr = $this->darwinCoreXML; html_entity_decode($xmlstr); diff --git a/plugins/DemoFormBuilder.inc b/plugins/DemoFormBuilder.inc index d2d7f738..ccc74ba2 100644 --- a/plugins/DemoFormBuilder.inc +++ b/plugins/DemoFormBuilder.inc @@ -6,7 +6,7 @@ * @file * */ -module_load_include('inc', 'islandora_repository', 'plugins/FormBuilder'); +module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder'); /** * implements methods from content model ingest form xml @@ -19,7 +19,7 @@ class DemoFormBuilder extends FormBuilder { * Constructor */ function DemoFormBuilder() { - module_load_include('inc', 'islandora_repository', 'plugins/FormBuilder'); + module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder'); drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); } @@ -31,7 +31,7 @@ class DemoFormBuilder extends FormBuilder { * @param type $rootElement */ function createFedoraDataStreams($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'islandora_repository', 'MimeClass'); + module_load_include('inc', 'fedora_repository', 'MimeClass'); global $base_url; $mimetype = new MimeClass(); $server = NULL; diff --git a/plugins/DocumentConverter.inc b/plugins/DocumentConverter.inc index e64517c6..f258441a 100644 --- a/plugins/DocumentConverter.inc +++ b/plugins/DocumentConverter.inc @@ -32,7 +32,7 @@ class DocumentConverter { * @return string */ function convert($parameterArray = NULL, $dsid, $file, $output_ext) { - module_load_include('inc', 'islandora_repository', 'MimeClass'); + module_load_include('inc', 'fedora_repository', 'MimeClass'); #debug: #drupal_set_message("Sending $file to ". $this->converter_service_url ." for convertsion to $output_ext", 'status'); diff --git a/plugins/Exiftool.inc b/plugins/Exiftool.inc index 5db3d600..c0b98981 100644 --- a/plugins/Exiftool.inc +++ b/plugins/Exiftool.inc @@ -22,7 +22,7 @@ class Exiftool { function __construct($pid) { //drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); $this->pid = $pid; - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $this->item = new Fedora_Item($this->pid); } diff --git a/plugins/FedoraObjectDetailedContent.inc b/plugins/FedoraObjectDetailedContent.inc index de8d10a7..855d508c 100644 --- a/plugins/FedoraObjectDetailedContent.inc +++ b/plugins/FedoraObjectDetailedContent.inc @@ -19,7 +19,7 @@ class FedoraObjectDetailedContent { * @param type $pid */ function __construct($pid = '') { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); if (!empty($pid)) { $this->pid = $pid; @@ -36,9 +36,9 @@ class FedoraObjectDetailedContent { global $user; $objectHelper = new ObjectHelper(); $tabset = array(); - $show_purge_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'islandora_repository_purge_object_form'); - $show_edit_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'islandora_repository_edit_qdc_form'); - $purge_form = drupal_get_form('islandora_repository_purge_object_form', $this->pid, check_plain(substr(request_uri(), strlen(base_path())))); + $show_purge_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_purge_object_form'); + $show_edit_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_edit_qdc_form'); + $purge_form = drupal_get_form('fedora_repository_purge_object_form', $this->pid, check_plain(substr(request_uri(), strlen(base_path())))); $tabset['fedora_object_details'] = array( '#type' => 'tabpage', @@ -59,8 +59,8 @@ class FedoraObjectDetailedContent { '#content' => $dc_html . $ds_list . $purge_form, ); - if (islandora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { - $editform = drupal_get_form('islandora_repository_edit_qdc_form', $this->pid, 'DC'); + if (fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { + $editform = drupal_get_form('fedora_repository_edit_qdc_form', $this->pid, 'DC'); $tabset['fedora_object_details']['tabset']['edit'] = array( '#type' => 'tabpage', '#title' => t('Edit'), diff --git a/plugins/Flv.inc b/plugins/Flv.inc index d1dc03d3..d8f2b06b 100644 --- a/plugins/Flv.inc +++ b/plugins/Flv.inc @@ -138,7 +138,7 @@ class FormBuilder { * @param type $rootElement */ function createFedoraDataStreams($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'islandora_repository', 'MimeClass'); + module_load_include('inc', 'fedora_repository', 'MimeClass'); $mimetype = new MimeClass(); $server = NULL; $file = $form_values['ingest-file-location']; diff --git a/plugins/FlvFormBuilder.inc b/plugins/FlvFormBuilder.inc index f9d13e56..c259328c 100644 --- a/plugins/FlvFormBuilder.inc +++ b/plugins/FlvFormBuilder.inc @@ -6,7 +6,7 @@ * @file * FLVFormBuilder */ -module_load_include('inc', 'islandora_repository', 'plugins/FormBuilder'); +module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder'); /** * implements methods from content model ingest form xml @@ -19,7 +19,7 @@ class FlvFormBuilder extends FormBuilder { * Constructor */ function FlvFormBuilder() { - module_load_include('inc', 'islandora_repository', 'plugins/FormBuilder'); + module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder'); drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); } @@ -32,7 +32,7 @@ class FlvFormBuilder extends FormBuilder { */ function createFedoraDataStreams($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'islandora_repository', 'MimeClass'); + module_load_include('inc', 'fedora_repository', 'MimeClass'); global $base_url; $mimetype = new MimeClass(); $server = NULL; diff --git a/plugins/FormBuilder.inc b/plugins/FormBuilder.inc index 695fa2c6..382733b4 100644 --- a/plugins/FormBuilder.inc +++ b/plugins/FormBuilder.inc @@ -84,7 +84,7 @@ class FormBuilder { * @return type */ function createPolicy($collectionPid, &$dom, &$rootElement) { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $objectHelper = new ObjectHelper(); $dsid = 'CHILD_SECURITY'; @@ -135,8 +135,8 @@ class FormBuilder { * @return type */ function handleQDCForm($form_values) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - module_load_include('inc', 'islandora_repository', 'CollectionPolicy'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); $dom = new DomDocument("1.0", "UTF-8"); $dom->formatOutput = TRUE; @@ -196,7 +196,7 @@ class FormBuilder { * @param type $rootElement */ function createFedoraDataStreams($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'islandora_repository', 'MimeClass'); + module_load_include('inc', 'fedora_repository', 'MimeClass'); global $base_url; $mimetype = new MimeClass(); $server = NULL; diff --git a/plugins/ImageManipulation.inc b/plugins/ImageManipulation.inc index c67e4911..8f97ab94 100644 --- a/plugins/ImageManipulation.inc +++ b/plugins/ImageManipulation.inc @@ -16,7 +16,7 @@ class ImageManipulation { * Constructor */ function ImageManipulation() { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); } /** diff --git a/plugins/ModsFormBuilder.inc b/plugins/ModsFormBuilder.inc index 26662cf2..d49869e2 100644 --- a/plugins/ModsFormBuilder.inc +++ b/plugins/ModsFormBuilder.inc @@ -6,7 +6,7 @@ * @file * ModsFormBuilder class */ -module_load_include('inc', 'islandora_repository', 'plugins/FormBuilder'); +module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder'); /** * ModsFormBuilder class ??? @@ -25,8 +25,8 @@ class ModsFormBuilder extends FormBuilder { function __construct($pid=NULL) { parent::__construct(); if ($pid !== NULL) { - module_load_include('inc', 'islandora_repository', 'ContentModel'); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $this->pid = $pid; $this->cm = ContentModel::loadFromObject($pid); @@ -241,7 +241,7 @@ class ModsFormBuilder extends FormBuilder { $form['submit'] = array( '#type' => 'submit', - '#submit' => array('islandora_repository_edit_qdc_form_submit'), + '#submit' => array('fedora_repository_edit_qdc_form_submit'), '#value' => 'Save Metadata' ); @@ -256,8 +256,8 @@ class ModsFormBuilder extends FormBuilder { * @param &$form_state */ function handleModsForm(&$form_values, &$form_state) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - module_load_include('inc', 'islandora_repository', 'CollectionPolicy'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'CollectionPolicy'); $form_state['storage']['people'] = NULL; //clears out old entities for the next run of the formbuilder. @@ -329,7 +329,7 @@ class ModsFormBuilder extends FormBuilder { * @param &$rootElement */ function createCollectionPolicy($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $model = new fedora_item($form_values['content_model_pid']); $ds_list = $model->get_datastreams_list_as_array(); if (isset($ds_list['COLLECTION_POLICY_TMPL'])) { @@ -364,7 +364,7 @@ class ModsFormBuilder extends FormBuilder { * @param &$rootElement */ function createWorkflowStream($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $model = new fedora_item($form_values['content_model_pid']); $ds_list = $model->get_datastreams_list_as_array(); if (isset($ds_list['WORKFLOW_TMPL'])) { diff --git a/plugins/PersonalCollectionClass.inc b/plugins/PersonalCollectionClass.inc index b4742711..68ae5528 100644 --- a/plugins/PersonalCollectionClass.inc +++ b/plugins/PersonalCollectionClass.inc @@ -120,7 +120,7 @@ class PersonalCollectionClass { * @return type */ function createPolicyStream($user, $dom, $rootElement) { - module_load_include('inc', 'islandora_repository', 'SecurityClass'); + module_load_include('inc', 'fedora_repository', 'SecurityClass'); $securityClass = new SecurityClass(); $policyStreamDoc = $securityClass->createPersonalPolicy($user); diff --git a/plugins/QtFormBuilder.php b/plugins/QtFormBuilder.php index 954f28e4..28645d6b 100644 --- a/plugins/QtFormBuilder.php +++ b/plugins/QtFormBuilder.php @@ -6,7 +6,7 @@ * @file * QTFormBuilder class */ -module_load_include('inc', 'islandora_repository', 'plugins/FormBuilder'); +module_load_include('inc', 'fedora_repository', 'plugins/FormBuilder'); /** * Implements methods from content model ingest form xml @@ -30,7 +30,7 @@ class QtFormBuilder extends FormBuilder { * @param type $rootElement */ function createFedoraDataStreams($form_values, &$dom, &$rootElement) { - module_load_include('inc', 'islandora_repository', 'MimeClass'); + module_load_include('inc', 'fedora_repository', 'MimeClass'); global $base_url; $mimetype = new MimeClass(); $server = null; diff --git a/plugins/Refworks.inc b/plugins/Refworks.inc index 4f0d6fc3..592a7e99 100644 --- a/plugins/Refworks.inc +++ b/plugins/Refworks.inc @@ -7,7 +7,7 @@ * Refworks class */ -module_load_include('inc', 'islandora_repository', 'SecurityClass'); +module_load_include('inc', 'fedora_repository', 'SecurityClass'); /** * Refworks class ??? @@ -222,9 +222,9 @@ class Refworks { */ function handleForm(&$form_values) { $errorMessage = NULL; - module_load_include('inc', 'islandora_repository', 'CollectionClass'); - module_load_include('inc', 'islandora_repository', 'ContentModel'); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'CollectionClass'); + module_load_include('inc', 'fedora_repository', 'ContentModel'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $contentModelPid = ContentModel::getPidFromIdentifier($form_values['models']); $contentModelDsid = ContentModel::getDSIDFromIdentifier($form_values['models']); $collectionHelper = new CollectionClass(); @@ -238,7 +238,7 @@ class Refworks { $collection_item = new Fedora_Item($collection_pid); $this->collectionPolicyStream = $collection_item->get_datastream_dissemination('CHILD_SECURITY'); if (empty($this->collectionPolicyStream)) { - $this->collectionPolicyStream = file_get_contents(drupal_get_path('module', 'islandora_repository') . '/policies/noObjectEditPolicy.xml'); + $this->collectionPolicyStream = file_get_contents(drupal_get_path('module', 'fedora_repository') . '/policies/noObjectEditPolicy.xml'); } $success = 0; $errors = 0; @@ -388,7 +388,7 @@ class Refworks { */ function createFedoraDataStreams($form_values, &$dom, &$rootElement, $reference) { global $base_url; - module_load_include('inc', 'islandora_repository', 'MimeClass'); + module_load_include('inc', 'fedora_repository', 'MimeClass'); $mimetype = new MimeClass(); $server = NULL; $this->createRomeoDataStream($dom, $rootElement); diff --git a/plugins/ShowStreamsInFieldSets.inc b/plugins/ShowStreamsInFieldSets.inc index efa1ab7e..77eada60 100644 --- a/plugins/ShowStreamsInFieldSets.inc +++ b/plugins/ShowStreamsInFieldSets.inc @@ -87,7 +87,7 @@ class ShowStreamsInFieldSets { global $base_url; global $base_path; global $user; - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $tabset = array(); @@ -105,7 +105,7 @@ class ShowStreamsInFieldSets { $tn_url = $base_url . '/fedora/repository/' . $item->pid . '/TN'; } else { - $tn_url = $base_path . drupal_get_path('module', 'islandora_repository') . '/images/Crystal_Clear_app_download_manager.png'; + $tn_url = $base_path . drupal_get_path('module', 'fedora_repository') . '/images/Crystal_Clear_app_download_manager.png'; } $dc_html = $objectHelper->getFormattedDC($item); @@ -117,8 +117,8 @@ class ShowStreamsInFieldSets { '#content' => $dl_link . $dc_html, ); - if (islandora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { - $editform = drupal_get_form('islandora_repository_edit_qdc_form', $this->pid, 'DC'); + if (fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { + $editform = drupal_get_form('fedora_repository_edit_qdc_form', $this->pid, 'DC'); $tabset['first_tab']['tabs']['edit'] = array( '#type' => 'tabpage', '#title' => t('Edit'), @@ -142,7 +142,7 @@ class ShowStreamsInFieldSets { * @return type */ function showQdc() { - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $objectHelper = new ObjectHelper(); $content = $objectHelper->getQDC($this->pid); $collection_fieldset = array( @@ -161,7 +161,7 @@ class ShowStreamsInFieldSets { */ function showOBJLink() { global $base_url; - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $item = new Fedora_Item($this->pid); $streams = $item->get_datastreams_list_as_array(); return "<a href='" . $base_url . "/fedora/repository/" . $this->pid . "/OBJ/" . $streams['OBJ']['label'] . "'>" . $streams['OBJ']['label'] . "</a>"; @@ -172,8 +172,8 @@ class ShowStreamsInFieldSets { * @return type */ function showRefworks() { - $path = drupal_get_path('module', 'islandora_repository'); - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + $path = drupal_get_path('module', 'fedora_repository'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $collectionHelper = new CollectionClass(); $xmlstr = $collectionHelper->getStream($this->pid, "refworks"); html_entity_decode($xmlstr); @@ -226,7 +226,7 @@ class ShowStreamsInFieldSets { */ function showRomeo($collapsed = FALSE) { $path = drupal_get_path('module', 'Fedora_Repository'); - module_load_include('inc', 'islandora_repository', 'CollectionClass'); + module_load_include('inc', 'fedora_repository', 'CollectionClass'); $collectionHelper = new CollectionClass(); $xmlstr = $collectionHelper->getStream($this->pid, "ROMEO", 0); diff --git a/plugins/islandora_imageapi.info b/plugins/fedora_imageapi.info similarity index 82% rename from plugins/islandora_imageapi.info rename to plugins/fedora_imageapi.info index 5519ad85..6a465a04 100644 --- a/plugins/islandora_imageapi.info +++ b/plugins/fedora_imageapi.info @@ -1,7 +1,7 @@ name = Fedora ImageAPI description = Adds image manipulation support through a REST interface package = Islandora Dependencies -dependencies[] = islandora_repository +dependencies[] = fedora_repository dependencies[] = imageapi version = 11.2.beta2 core = 6.x diff --git a/plugins/islandora_imageapi.module b/plugins/fedora_imageapi.module similarity index 89% rename from plugins/islandora_imageapi.module rename to plugins/fedora_imageapi.module index cbe6225d..f3bd4481 100644 --- a/plugins/islandora_imageapi.module +++ b/plugins/fedora_imageapi.module @@ -6,7 +6,7 @@ function fedora_imageapi_menu() { $items = array(); $items['fedora/imageapi'] = array( 'title' => t('Image manipulation functions'), - 'page callback' => 'islandora_repository_image_manip', + 'page callback' => 'fedora_repository_image_manip', 'type' => MENU_CALLBACK, 'access arguments' => array('view fedora collection'), ); @@ -21,7 +21,7 @@ function fedora_imageapi_menu() { * @param string $op * @param string $params */ -function islandora_repository_image_manip($pid = '', $dsid = '', $op = '', $params = '') { +function fedora_repository_image_manip($pid = '', $dsid = '', $op = '', $params = '') { module_load_include('inc', 'Fedora_Repository', 'ObjectHelper'); module_load_include('module', 'imageapi'); $obj = new ObjectHelper(); @@ -30,7 +30,7 @@ function islandora_repository_image_manip($pid = '', $dsid = '', $op = '', $para $op = (!empty($_GET['op']) ? $_GET['op'] : ''); $safe_pid = str_replace(':', '_', $pid); - $cache_key = 'islandora_repository_image_manip_' . md5($safe_pid . '_' . $dsid . '_' . $ext . '_' . $op . (isset($_GET['width']) ? '_' . $_GET['width'] : '') . (isset($_GET['height']) ? '_' . $_GET['height'] : '')); + $cache_key = 'fedora_repository_image_manip_' . md5($safe_pid . '_' . $dsid . '_' . $ext . '_' . $op . (isset($_GET['width']) ? '_' . $_GET['width'] : '') . (isset($_GET['height']) ? '_' . $_GET['height'] : '')); if (($file = cache_get($cache_key)) === 0) { //added the slash as sys_get_temp_dir in linux does not seem to include the slash $tmp_file_name = sys_get_temp_dir() . '/' . $safe_pid . '_' . $dsid . '.' . $ext; @@ -83,7 +83,7 @@ function islandora_repository_image_manip($pid = '', $dsid = '', $op = '', $para function fedora_imageapi_form_alter( &$form, $form_state, $form_id) { switch ( $form_id ) { - case 'islandora_repository_admin': + case 'fedora_repository_admin': $fedora_base_url = $form['fedora_base_url']['#default_value']; diff --git a/plugins/herbarium.inc b/plugins/herbarium.inc index f831bc59..f7a6d685 100644 --- a/plugins/herbarium.inc +++ b/plugins/herbarium.inc @@ -16,7 +16,7 @@ class Herbarium { function __construct($pid = '') { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); if (!empty($pid)) { $this->pid = $pid; $this->item = new Fedora_Item($pid); @@ -32,7 +32,7 @@ class Herbarium { public function buildDrupalForm($form = array(), $form_state = array()) { // We don't need to add anything beyond the standard Darwin Core form so just pass this through // If we wanted to we could add other fields. - module_load_include('inc', 'islandora_repository', 'plugins/DarwinCore'); + module_load_include('inc', 'fedora_repository', 'plugins/DarwinCore'); $dwc = new DarwinCore($this->item); return $dwc->buildDrupalForm($form); @@ -73,9 +73,9 @@ class Herbarium { * Process the metadata form * Update the datastreams */ - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - module_load_include('inc', 'islandora_repository', 'plugins/DarwinCore'); - module_load_include('inc', 'islandora_repository', 'MimeClass'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'plugins/DarwinCore'); + module_load_include('inc', 'fedora_repository', 'MimeClass'); global $user; $mimetype = new MimeClass(); $dwc = new DarwinCore($this->item); @@ -97,9 +97,9 @@ class Herbarium { * Create fedora object * Add the datastreams */ - module_load_include('inc', 'islandora_repository', 'MimeClass'); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - module_load_include('inc', 'islandora_repository', 'plugins/DarwinCore'); + module_load_include('inc', 'fedora_repository', 'MimeClass'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'plugins/DarwinCore'); global $user; $mimetype = new MimeClass(); $dwc = new DarwinCore(); @@ -141,8 +141,8 @@ class Herbarium { * @return string */ public function showFieldSets() { - module_load_include('inc', 'islandora_repository', 'plugins/tagging_form'); - module_load_include('inc', 'islandora_repository', 'plugins/DarwinCore'); + module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); + module_load_include('inc', 'fedora_repository', 'plugins/DarwinCore'); global $base_url; $tabset = array(); @@ -167,7 +167,7 @@ class Herbarium { '#title' => t('View'), // This will be the content of the tab. '#content' => '<a href="' . $base_url . '/fedora/repository/' . $this->pid . '/FULL_JPG/"><img src="' . $base_url . '/fedora/imageapi/' . - $this->pid . '/JPG/JPG.jpg' . '" /></a>' . '<p>' . drupal_get_form('islandora_repository_image_tagging_form', $this->pid) . '</p>', + $this->pid . '/JPG/JPG.jpg' . '" /></a>' . '<p>' . drupal_get_form('fedora_repository_image_tagging_form', $this->pid) . '</p>', ); $dwc = new DarwinCore($this->item); @@ -184,10 +184,10 @@ class Herbarium { '#title' => t('Darwin Core'), '#content' => $dwc->asHTML(), ); - module_load_include('inc', 'islandora_repository', 'ObjectHelper'); + module_load_include('inc', 'fedora_repository', 'ObjectHelper'); $obj = new ObjectHelper(); - if (islandora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { - $editform = drupal_get_form('islandora_repository_edit_qdc_form', $this->pid, 'DARWIN_CORE'); + if (fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) { + $editform = drupal_get_form('fedora_repository_edit_qdc_form', $this->pid, 'DARWIN_CORE'); $tabset['third_tab']['tabset']['edit'] = array( '#type' => 'tabpage', '#title' => t('Edit'), diff --git a/plugins/map_viewer.inc b/plugins/map_viewer.inc index 2ad56c0a..3e9bcfb6 100644 --- a/plugins/map_viewer.inc +++ b/plugins/map_viewer.inc @@ -29,9 +29,9 @@ class ShowMapStreamsInFieldSets { * @return type */ function showJPG() { - module_load_include('inc', 'islandora_repository', 'plugins/tagging_form'); - module_load_include('inc', 'islandora_repository', 'plugins/ShowStreamsInFieldSets'); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); + module_load_include('inc', 'fedora_repository', 'plugins/ShowStreamsInFieldSets'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); global $base_url; @@ -51,8 +51,8 @@ class ShowMapStreamsInFieldSets { $html = '<iframe src="' . $viewer_url . '" scrolling="no" frameborder="0" style="width: 100%; height: 800px;">Errors: unable to load viewer</iframe>'; drupal_add_css(path_to_theme() . '/header-viewer.css', 'theme'); - drupal_add_css(drupal_get_path('module', 'islandora_repository') . '/js/iiv/css/jquery-ui/smoothness/jquery-ui-1.7.2.custom.css'); - drupal_add_css(drupal_get_path('module', 'islandora_repository') . '/js/iiv/css/iiv.css'); + drupal_add_css(drupal_get_path('module', 'fedora_repository') . '/js/iiv/css/jquery-ui/smoothness/jquery-ui-1.7.2.custom.css'); + drupal_add_css(drupal_get_path('module', 'fedora_repository') . '/js/iiv/css/iiv.css'); $tabset['my_tabset']['second_tab'] = array( diff --git a/plugins/qt_viewer.inc b/plugins/qt_viewer.inc index 09d24cca..ec321ca1 100644 --- a/plugins/qt_viewer.inc +++ b/plugins/qt_viewer.inc @@ -112,9 +112,9 @@ class ShowQtStreamsInFieldSets { * @return type */ function showQt() { - module_load_include('inc', 'islandora_repository', 'plugins/tagging_form'); - module_load_include('inc', 'islandora_repository', 'plugins/ShowStreamsInFieldSets'); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); + module_load_include('inc', 'fedora_repository', 'plugins/ShowStreamsInFieldSets'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $info = $this->technicalMetadata(array('width' => 640, 'height' => 480)); $width = $info['width']; diff --git a/plugins/slide_viewer.inc b/plugins/slide_viewer.inc index ef569487..1d23b227 100644 --- a/plugins/slide_viewer.inc +++ b/plugins/slide_viewer.inc @@ -30,8 +30,8 @@ class ShowSlideStreamsInFieldSets { * @return type */ function showJPG() { - module_load_include('inc', 'islandora_repository', 'plugins/tagging_form'); - module_load_include('inc', 'islandora_repository', 'plugins/ShowStreamsInFieldSets'); + module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); + module_load_include('inc', 'fedora_repository', 'plugins/ShowStreamsInFieldSets'); global $base_url; global $user; @@ -58,7 +58,7 @@ class ShowSlideStreamsInFieldSets { '#title' => t('View'), // This will be the content of the tab. '#content' => '<img src="' . $base_url . - '/fedora/imageapi/' . $this->pid . '/JPG/JPG.jpg' . '" />' . '<p>' . drupal_get_form('islandora_repository_image_tagging_form', $this->pid) . '</p>', + '/fedora/imageapi/' . $this->pid . '/JPG/JPG.jpg' . '" />' . '<p>' . drupal_get_form('fedora_repository_image_tagging_form', $this->pid) . '</p>', ); return $tabset; diff --git a/plugins/tagging_form.inc b/plugins/tagging_form.inc index ca32ecd5..0a421105 100644 --- a/plugins/tagging_form.inc +++ b/plugins/tagging_form.inc @@ -13,9 +13,9 @@ * @return string */ function _show_subject_tags($pid) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - module_load_include('inc', 'islandora_repository', 'api/dublin_core'); - module_load_include('inc', 'islandora_repository', 'api/tagging'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/dublin_core'); + module_load_include('inc', 'fedora_repository', 'api/tagging'); $obj = new Fedora_Item($pid); $tags = new TagSet($obj); if (!empty($tags->tags)) { @@ -35,10 +35,10 @@ function _show_subject_tags($pid) { * @param type $pid * @return type */ -function islandora_repository_image_tagging_form($form_state, $pid) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - module_load_include('inc', 'islandora_repository', 'api/dublin_core'); - module_load_include('inc', 'islandora_repository', 'api/tagging'); +function fedora_repository_image_tagging_form($form_state, $pid) { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/dublin_core'); + module_load_include('inc', 'fedora_repository', 'api/tagging'); global $base_url; if (!empty($form_state['post']['pid'])) { @@ -71,7 +71,7 @@ function islandora_repository_image_tagging_form($form_state, $pid) { // Delete button for each existing tag. $form['tags-wrapper']['tags'][$tag['name']]['delete'] = array( '#type' => 'imagebutton', - '#image' => $base_url . '/' . drupal_get_path('module', 'islandora_repository') . '/images/remove_icon.png', + '#image' => $base_url . '/' . drupal_get_path('module', 'fedora_repository') . '/images/remove_icon.png', '#default_value' => $tag['name'], '#title' => t('Delete this tag'), ); @@ -122,9 +122,9 @@ function hook_imagebutton_process($form) { * @param type $form * @param type $form_state */ -function islandora_repository_image_tagging_form_submit($form, &$form_state) { - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); - module_load_include('inc', 'islandora_repository', 'api/tagging'); +function fedora_repository_image_tagging_form_submit($form, &$form_state) { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/tagging'); global $user; $item = new Fedora_Item($form_state['values']['pid']); diff --git a/tests/README_TESTING.txt b/tests/README_TESTING.txt index f38af855..c9dde164 100644 --- a/tests/README_TESTING.txt +++ b/tests/README_TESTING.txt @@ -21,7 +21,7 @@ $FEDORA_HOME/server/config/fedora-users.xml: </attribute> </user> -If you look in the islandora_repository.test file we see that we are creating +If you look in the fedora_repository.test file we see that we are creating a user with a password set to 'simpletestpass'. Fedora requires the hashed version of this password to do a servlet filter-based authentication. diff --git a/tests/fedora_repository.test b/tests/fedora_repository.test index d5e59bc8..bbad2569 100644 --- a/tests/fedora_repository.test +++ b/tests/fedora_repository.test @@ -16,9 +16,9 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { } function setUp() { - parent::setUp('tabs', 'islandora_repository'); + parent::setUp('tabs', 'fedora_repository'); - module_load_include('inc', 'islandora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); // Create and login user. $repository_user = $this->drupalCreateFedoraUser(array('add fedora datastreams', @@ -57,11 +57,11 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { $ingest_form_step_2['dc:title'] = $this->randomName(32); $ingest_form_step_2['dc:description'] = $this->randomName(256); - $ingest_form_step_2['files[ingest-file-location]'] = realpath(drupal_get_path('module', 'islandora_repository') . '/tests/test_files/lorem_ipsum.pdf'); + $ingest_form_step_2['files[ingest-file-location]'] = realpath(drupal_get_path('module', 'fedora_repository') . '/tests/test_files/lorem_ipsum.pdf'); $this->drupalPost(NULL, $ingest_form_step_2, 'Ingest'); $this->assertText('mimetype (application/pdf) is not associated with this Content Model', 'PDF mime type not accepted in collection content model.', 'message'); - $this->outputScreenContents('Initial ingest form submit step 2', 'islandora_repository'); + $this->outputScreenContents('Initial ingest form submit step 2', 'fedora_repository'); // Now try ingesting a proper collection policy. $ingest_form = array(); @@ -72,9 +72,9 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { $ingest_form_step_2 = array(); $ingest_form_step_2['dc:title'] = $this->randomName(32); $ingest_form_step_2['dc:description'] = $this->randomName(256); - $ingest_form_step_2['files[ingest-file-location]'] = realpath(drupal_get_path('module', 'islandora_repository') . '/collection_policies/PDF-COLLECTION POLICY.xml'); + $ingest_form_step_2['files[ingest-file-location]'] = realpath(drupal_get_path('module', 'fedora_repository') . '/collection_policies/PDF-COLLECTION POLICY.xml'); $this->drupalPost(NULL, $ingest_form_step_2, 'Ingest'); - //$this->outputScreenContents('Initial ingest form submit step 2 - PDF collection', 'islandora_repository'); + //$this->outputScreenContents('Initial ingest form submit step 2 - PDF collection', 'fedora_repository'); $this->assertPattern('/Item .* created successfully./', "Verified item created."); $pid = $this->getIngestedPid(); @@ -88,7 +88,7 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { $ingest_form_step_2 = array(); $ingest_form_step_2['dc:title'] = "Lorem Ipsum"; $ingest_form_step_2['dc:description'] = $this->randomName(256); - $ingest_form_step_2['files[ingest-file-location]'] = realpath(drupal_get_path('module', 'islandora_repository') . '/tests/test_files/lorem_ipsum.pdf'); + $ingest_form_step_2['files[ingest-file-location]'] = realpath(drupal_get_path('module', 'fedora_repository') . '/tests/test_files/lorem_ipsum.pdf'); $this->drupalPost(NULL, $ingest_form_step_2, 'Ingest'); $pid = $this->getIngestedPid(); $pid_list[] = $pid; @@ -104,7 +104,7 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { $admin_tester = $this->drupalCreateUser(array('administer site configuration', 'view fedora collection')); $this->drupalLogin($admin_tester); - $pageContent = $this->drupalGet('admin/settings/islandora_repository'); + $pageContent = $this->drupalGet('admin/settings/fedora_repository'); $hasOption = preg_match('/Enforce namespace restrictions/', $pageContent); @@ -115,13 +115,13 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase { $this->pass('Removal of namespace restrictions is enabled'); $inVal['fedora_namespace_restriction_enforced'] = TRUE; $inVal['fedora_pids_allowed'] = 'simpletest:'; - $this->drupalPost('admin/settings/islandora_repository', $inVal, 'Save configuration'); + $this->drupalPost('admin/settings/fedora_repository', $inVal, 'Save configuration'); $this->assertPattern('/The configuration options have been saved./', 'The configuration options have been saved.'); $this->drupalGet('fedora/repository/islandora:largeimages/'); $this->assertPattern('/Access denied/', 'No access to Large image Collection Collection'); $inVal['fedora_namespace_restriction_enforced'] = 0; - $this->drupalPost('admin/settings/islandora_repository', $inVal, 'Save configuration'); + $this->drupalPost('admin/settings/fedora_repository', $inVal, 'Save configuration'); $this->assertPattern('/The configuration options have been saved./', 'The configuration options have been saved.'); $this->drupalLogin($this->repository_user); $this->drupalGet('fedora/repository/islandora:largeimages/');