Browse Source

switched to islandora_repository

pull/43/head
Ben Woodhead 13 years ago
parent
commit
fae0efb144
  1. 20
      BatchIngest.inc
  2. 42
      CollectionClass.inc
  3. 24
      CollectionManagement.inc
  4. 18
      CollectionPolicy.inc
  5. 50
      ContentModel.inc
  6. 68
      ObjectHelper.inc
  7. 30
      SearchClass.inc
  8. 2
      SecurityClass.inc
  9. 8
      XMLDatastream.inc
  10. 78
      formClass.inc
  11. 175
      islandora_repository.solutionpacks.inc

20
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 " ";

42
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);

24
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 <type> $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();

18
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) {

50
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 <fedora-model:state> <info:fedora/fedora-system:def/model#Active>)
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'),

68
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 <dc:description> $desc
and $o <mulgara:is> <info:fedora/' . $pid . '>';
$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);
}

30
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 = '<Strong>Quick Search</strong><br /><table class="table-form"><tr>' . drupal_get_form('fedora_repository_quick_search_form') . '</tr></table>';
$output = '<Strong>Quick Search</strong><br /><table class="table-form"><tr>' . drupal_get_form('islandora_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', '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]);

2
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);

8
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 = '<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: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);

78
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);

175
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:') . '&nbsp;</strong>',
'#suffix' => '&nbsp;',
);
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);
}
Loading…
Cancel
Save