Browse Source

Merge branch '6.x' of github.com:Islandora/islandora into ISLANDORA-164

pull/64/head
Nigel Banks 13 years ago
parent
commit
de93bc958d
  1. 273
      BatchIngest.inc
  2. 46
      CollectionClass.inc
  3. 401
      CollectionManagement.inc
  4. 21
      CollectionPolicy.inc
  5. 6
      ConnectionHelper.inc
  6. 54
      ContentModel.inc
  7. 2
      MimeClass.inc
  8. 26
      ObjectHelper.inc
  9. 2
      SearchClass.inc
  10. 36
      SecurityClass.inc
  11. 4
      XMLDatastream.inc
  12. 2
      api/dublin_core.inc
  13. 2
      api/fedora_collection.inc
  14. 4
      api/fedora_export.inc
  15. 9
      api/fedora_item.inc
  16. 68
      api/fedora_utils.inc
  17. 2
      api/rels-ext.inc
  18. 4
      api/tagging.inc
  19. 5
      fedora_repository.info
  20. 51
      fedora_repository.install
  21. 88
      fedora_repository.module
  22. 27
      fedora_repository.solutionpacks.inc
  23. 12
      formClass.inc
  24. 8
      installer_files/foxml/islandora-root.xml
  25. 2
      plugins/CollectionFormBuilder.inc
  26. 2
      plugins/CreateCollection.inc
  27. 2
      plugins/DarwinCore.inc
  28. 2
      plugins/DemoFormBuilder.inc
  29. 2
      plugins/Exiftool.inc
  30. 6
      plugins/FedoraObjectDetailedContent.inc
  31. 2
      plugins/Ffmpeg.inc
  32. 6
      plugins/Flv.inc
  33. 2
      plugins/FlvFormBuilder.inc
  34. 10
      plugins/FormBuilder.inc
  35. 2
      plugins/ImageManipulation.inc
  36. 6
      plugins/ModsFormBuilder.inc
  37. 6
      plugins/PersonalCollectionClass.inc
  38. 6
      plugins/Refworks.inc
  39. 2
      plugins/ShowDemoStreamsInFieldSets.inc
  40. 6
      plugins/ShowStreamsInFieldSets.inc
  41. 2
      plugins/fedora_imageapi.info
  42. 2
      plugins/map_viewer.inc
  43. 6
      plugins/qt_viewer.inc
  44. 2
      plugins/slide_viewer.inc
  45. 2
      plugins/tagging_form.inc
  46. 2
      tests/README_TESTING.txt
  47. 6
      tests/fedora_repository.test
  48. 2
      xsl/convertQDC.xsl
  49. 20
      xsl/sparql_to_html.xsl

273
BatchIngest.inc

@ -1,273 +0,0 @@
<?php
/**
* batch creation form submit
* @global type $user
* @param array $form
* @param array $form_state
* @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');
$cm_options = array();
$name_mappings = array();
foreach ($content_models as $content_model) {
if ($content_model->pid != "islandora:collectionCModel") {
$cm_options[$content_model->pid] = $content_model->name;
$name_mappings[] = $content_model->pid . '^' . $content_model->pid_namespace;
}
}
$mappings = implode('~~~', $name_mappings);
$form['#attributes']['enctype'] = 'multipart/form-data';
$form['titlebox'] = array(
'#type' => 'item',
'#value' => t("Batch ingest into $collection_pid"),
);
$form['collection_pid'] = array(
'#type' => 'hidden',
'#value' => $collection_pid,
);
$form['namespace_mappings'] = array(
'#type' => 'hidden',
'#value' => $mappings,
);
$form['metadata_type'] = array(
'#title' => "Choose Metadata Type",
'#type' => 'radios',
'#options' => array('MODS' => 'MODS', "DC" => "DUBLIN CORE"),
'#required' => true,
'#description' => t("Select primary metadata schema"),
);
$form['content_model'] = array(
'#title' => "Choose content model to be associated with objects ingested",
'#type' => 'select',
'#options' => $cm_options,
'#required' => true,
'#description' => t("Content models describe the behaviours of objects with which they are associated."),
);
$form['indicator']['file-location'] = array(
'#type' => 'file',
'#title' => t('Upload zipped folder'),
'#size' => 48,
'#description' => t('The zipped folder should contain all files necessary to build objects.<br .>
Related files must have the same filename, but with differing extensions to indicate mimetypes.<br />
ie. <em>myFile.xml</em> and <em>myFile.jpg</em>'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Create Objects ')
);
return($form);
}
/**
* @param array $form
* @param array $form_state
*/
function batch_creation_form_validate($form, &$form_state) {
$fieldName = 'file-location';
if (isset($_FILES['files']) && is_uploaded_file($_FILES['files']['tmp_name'][$fieldName])) {
$file = file_save_upload($fieldName);
if ($file->filemime != 'application/zip') {
form_set_error($fieldName, 'Input file must be a .zip file');
return;
}
if (!$file) {
form_set_error($fieldName, 'Error uploading file.');
return;
}
$form_state['values']['file'] = $file;
}
else {
// set error
form_set_error($fieldName, 'Error uploading file.');
return;
}
}
function batch_creation_form_submit($form, &$form_state) {
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'];
$metadata = $form_state['values']['metadata_type'];
$collection_pid = $form_state['values']['collection_pid'];
$namespace_process = explode('~~~', $form_state['values']['namespace_mappings']);
foreach ($namespace_process as $line) {
$line_parts = explode('^', $line);
$namespace_mappings[$line_parts[0]] = $line_parts[1];
}
$namespace = $namespace_mappings[$content_model];
$namespace = preg_replace('/:.*/', '', $namespace);
$dirName = "temp" . $user->uid;
$tmpDir = file_directory_path() . '/' . $dirName . '/';
mkdir($tmpDir);
$file = $form_state['values']['file'];
$fileName = $file->filepath;
$file_list = array();
$cmdString = "unzip -q -o -d $tmpDir \"$fileName\"";
system($cmdString, $retVal);
$dirs = array();
$doNotAdd = array('.', '..', '__MACOSX');
array_push($dirs, $tmpDir);
$files = scandir($tmpDir);
foreach ($files as $file) {
if (is_dir("$tmpDir/$file") & !in_array($file, $doNotAdd)) {
array_push($dirs, $tmpDir . $file);
}
}
foreach ($dirs as $directory) {
if ($inputs = opendir($directory)) {
while (FALSE !== ($file_name = readdir($inputs))) {
if (!in_array($file_name, $doNotAdd) && is_dir($file_name) == FALSE) {
$ext = strrchr($file_name, '.');
$base = preg_replace("/$ext$/", '', $file_name);
$ext = substr($ext, 1);
if ($ext) {
$file_list[$base][$ext] = "$directory/" . $file_name;
}
}
}
closedir($inputs);
}
}
if (($cm = ContentModel::loadFromModel($content_model, 'ISLANDORACM')) === FALSE) {
drupal_set_message("$content_model not found", "error");
return;
}
$batch = array(
'title' => 'Ingesting Objects',
'operations' => array(),
'file' => drupal_get_path('module', 'fedora_repository') . '/BatchIngest.inc',
);
foreach ($file_list as $label => $object_files) {
if ($object_files['xml']) {
$batch['operations'][] = array('create_batch_objects', array($label, $content_model, $object_files, $collection_pid, $namespace, $metadata));
}
}
$batch['operations'][] = array('recursive_directory_delete', array($tmpDir));
batch_set($batch);
batch_process();
}
/**
*
* @param <string> $label
* @param <string> $content_model
* @param <array> $object_files
* @param <string> $collection_pid
* @param <string> $namespace
* @param <string> $metadata
*/
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');
$cm = ContentModel::loadFromModel($content_model, 'ISLANDORACM');
$allowedMimeTypes = $cm->getMimetypes();
$mime_helper = new MimeClass();
$pid = fedora_item::get_next_PID_in_namespace($namespace);
module_load_include('inc', 'fedora_reppository', 'api/fedora_item');
$item = Fedora_item::ingest_new_item($pid, 'A', $label, $owner);
$item->add_relationship('hasModel', $content_model, FEDORA_MODEL_URI);
$item->add_relationship('isMemberOfCollection', $collection_pid);
if ($metadata == 'DC') {
$dc_xml = file_get_contents($object_files['xml']);
$item->modify_datastream_by_value($dc_xml, 'DC', "Dublin Core", 'text/xml');
}
if ($metadata == 'MODS') {
$mods_xml = file_get_contents($object_files['xml']);
$item->add_datastream_from_string($mods_xml, 'MODS');
$dc_xml = batch_create_dc_from_mods($mods_xml);
}
unset($object_files['xml']);
$use_primary = TRUE;
foreach ($object_files as $ext => $filename) {
$file_mimetype = $mime_helper->get_mimetype($filename);
if (in_array($file_mimetype, $allowedMimeTypes)) {
$added = $cm->execIngestRules($filename, $file_mimetype);
}
else {
$item->purge("$pid $label not ingested. $file_mimetype not permitted in objects associated with $content_model");
continue;
}
$ds_label = $use_primary ? $cm->getDatastreamNameDSID():$ext;
$item->add_datastream_from_file($filename, $ds_label);
$use_primary = FALSE;
if (!empty($_SESSION['fedora_ingest_files'])) {
foreach ($_SESSION['fedora_ingest_files'] as $dsid => $datastream_file) {
$item->add_datastream_from_file($datastream_file, $dsid);
}
}
}
}
/**
* transforms mods to dc
* @param <string> $mods_xml
* @return <string>
*/
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');
if ($xmlstr == NULL || strlen($xmlstr) < 5) {
return " ";
}
try {
$proc = new XsltProcessor();
} catch (Exception $e) {
drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error');
return " ";
}
$xsl = new DomDocument();
$xsl->load($path . '/xsl/mods_to_dc.xsl');
$input = new DomDocument();
$input->loadXML(trim($xmlstr));
$xsl = $proc->importStylesheet($xsl);
$newdom = $proc->transformToDoc($input);
$dc_xml = $newdom->saveXML();
return $dc_xml;
}
/**
*
* @param <string> $dir
* @return <boolean>
*/
function recursive_directory_delete($dir) {
if (!file_exists($dir))
return true;
if (!is_dir($dir))
return unlink($dir);
foreach (scandir($dir) as $item) {
if ($item == '.' || $item == '..')
continue;
if (!recursive_directory_delete($dir . DIRECTORY_SEPARATOR . $item))
return false;
}
return rmdir($dir);
}

46
CollectionClass.inc

@ -131,7 +131,7 @@ class CollectionClass {
try {
$xml = new SimpleXMLElement($stream);
} catch (Exception $e) {
drupal_set_message(t('Error getting relationship element from policy stream !e', array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('Error getting relationship element from policy stream @e', array('@e' => check_plain($e->getMessage()))), 'error');
return;
}
$relationship = $xml->relationship[0];
@ -172,7 +172,7 @@ class CollectionClass {
try {
$xml = new SimpleXMLElement($stream);
} catch (Exception $e) {
drupal_set_message(t('Error getting PID namespace !e', array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('Error getting PID namespace @e', array('@e' => check_plain($e->getMessage()))), 'error');
return;
}
foreach ($xml->contentmodels->contentmodel as $contentModel) {
@ -199,7 +199,7 @@ class CollectionClass {
$xml = new SimpleXMLElement($collection_stream);
} catch (Exception $e) {
if ($showError) {
drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error');
}
return NULL;
}
@ -239,7 +239,7 @@ class CollectionClass {
try {
$xml = new SimpleXMLElement($stream);
} catch (Exception $e) {
drupal_set_message(t('Error Getting FormHandler: !e', array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('Error Getting FormHandler: @e', array('@e' => check_plain($e->getMessage()))), 'error');
return NULL;
}
$formHandler = $xml->ingest_form;
@ -272,7 +272,7 @@ class CollectionClass {
try {
$xml = new SimpleXMLElement($stream);
} catch (Exception $e) {
drupal_set_message(t('Error getting content model stream for mime types !e', array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('Error getting content model stream for mime types @e', array('@e' => check_plain($e->getMessage()))), 'error');
return;
}
foreach ($xml->mimetypes->type as $type) {
@ -302,7 +302,7 @@ class CollectionClass {
try {
$xml = new SimpleXMLElement($stream);
} catch (Exception $e) {
drupal_set_message(t('Error getting content model stream !e', array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('Error getting content model stream @e', array('@e' => check_plain($e->getMessage()))), 'error');
return FALSE;
}
foreach ($xml->ingest_rules->rule as $rule) {
@ -365,7 +365,7 @@ class CollectionClass {
try {
$xml = new SimpleXMLElement($stream);
} catch (Exception $e) {
drupal_set_message(t('Error getting ingest form stream !e', array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('Error getting ingest form stream @e', array('@e' => check_plain($e->getMessage()))), 'error');
return FALSE;
}
$docRoot = $_SERVER['DOCUMENT_ROOT'];
@ -451,7 +451,7 @@ class CollectionClass {
$params
));
} catch (exception $e) {
drupal_set_message(t('Error getting Next PID: !e', array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('Error getting Next PID: @e', array('@e' => check_plain($e->getMessage()))), 'error');
return FALSE;
}
$pid = implode(get_object_vars($object));
@ -517,18 +517,21 @@ class CollectionClass {
$show_ingest_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_ingest_form');
$add_to_collection = $this->getIngestInterface();
$show_batch_tab = TRUE;
$show_batch_tab = FALSE;
$policy = CollectionPolicy::loadFromCollection($this->pid, TRUE);
$content_models = $policy->getContentModels();
if(!empty($policy)){
$content_models = $policy->getContentModels();
}
if (count($content_models) == 1 && $content_models[0]->pid == "islandora:collectionCModel") {
$show_batch_tab = FALSE;
}
if (!$show_ingest_tab) {
$view_selected = true;
$view_selected = TRUE;
}
if(!$collection_items){
$view_selected = false;
$add_selected = true;
if (!$collection_items) {
$view_selected = FALSE;
$add_selected = TRUE;
}
$view_selected = !$show_ingest_tab;
@ -538,7 +541,6 @@ class CollectionClass {
'#title' => 'View',
'#selected' => $view_selected,
'#content' => $collection_items,
);
$tabset['add_tab'] = array(
'#type' => 'tabpage',
@ -547,16 +549,7 @@ class CollectionClass {
// This will be the content of the tab.
'#content' => $add_to_collection,
);
if (user_access('manage collections')) {
$tabset['add_collection_tab'] = array(
// #type and #title are the minimum requirements.
'#type' => 'tabpage',
'#title' => t('Manage This Collection'),
// This will be the content of the tab.
'#content' => drupal_get_form('collection_management_form', $this->pid, $content_models),
'#selected' => false,
);
}
if ($show_batch_tab && user_access('create batch process')) {
$tabset['batch_ingest_tab'] = array(
// #type and #title are the minimum requirements.
@ -623,6 +616,7 @@ class CollectionClass {
$collectionName = $collection;
if (!$pageNumber) {
$pageNumber = 1;
}
@ -662,7 +656,7 @@ class CollectionClass {
throw new Exception("Invalid XML.");
}
} catch (Exception $e) {
drupal_set_message(t('!e', array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error');
return '';
}
}

401
CollectionManagement.inc

@ -1,401 +0,0 @@
<?php
/**
* collection creation form
* @param array $form_state
* @param string $parent_collection_pid
* @param string $content_models
* @return array
*/
function collection_management_form(&$form_state, $this_collection_pid, $content_models) {
module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
$restricted = FALSE;
if (variable_get('fedora_namespace_restriction_enforced', true)) {
$restricted = true;
$allowed_string = variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora:');
$namespaces = explode(':', $allowed_string);
foreach ($namespaces as $namespace) {
if ($namespace) {
$allowed[trim($namespace)] = trim($namespace);
}
}
}
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();
$cm_options = array();
$name_mappings = array();
foreach ($content_models as $content_model) {
if ($content_model->pid != "islandora:collectionCModel") {
$item = new fedora_item($content_model->pid);
$cm_name = $item->objectProfile->objLabel;
$cm_options[$content_model->pid] = $cm_name;
}
}
if (!empty($cm_options)) {
$show_delete = true;
}
$content_models = get_content_models_as_option_array();
$form['child_creation'] = array(
'#title' => "Create Child Collection",
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['child_creation']['titlebox'] = array(
'#type' => 'item',
'#value' => t("Create New Child Collection within $this_collection_pid"),
);
$form['child_creation']['collection_name'] = array(
'#title' => "Collection Name",
'#type' => 'textfield',
'#description' => t("Human readable name for this collection"),
);
$form['child_creation']['new_collection_pid'] = array(
'#title' => "Collection PID",
'#type' => 'textfield',
'#size' => 15,
'#description' => t("Unique PID for this collection. <br />Pids take the general form of namespace:collection eg islandora:pamphlets"),
);
if (!$restricted) {
$form['child_creation']['collection_namespace'] = array(
'#title' => "Collection Namespace",
'#type' => 'textfield',
'#size' => 15,
'#default_value' => 'default',
'#description' => t("Namespace for objects in this collection."),
);
}
else {
$form['child_creation']['collection_namespace'] = array(
'#title' => "Collection Namespace",
'#type' => 'select',
'#options' => $allowed,
'#default_value' => 'default',
'#description' => t("Namespace for objects in this collection."),
);
}
$form['parent_collection'] = array(
'#type' => 'hidden',
'#value' => $this_collection_pid,
);
$form['collection_pid'] = array(
'#type' => 'hidden',
'#value' => $this_collection_pid,
);
$form['child_creation']['content_models'] = array(
'#title' => "Choose allowable content models for this collection",
'#type' => 'checkboxes',
'#options' => $content_models,
'#description' => t("Content models describe the behaviours of objects with which they are associated."),
);
$form['child_creation']['submit'] = array(
'#type' => 'submit',
'#value' => t('Create Collection'),
'#id' => 'create_class'
);
$form['manage_collection_policy'] = array(
'#title' => "Manage Collection Policies",
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['manage_collection_policy']['add'] = array(
'#title' => "Add Content Model",
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => $show_delete,
);
$form ['manage_collection_policy']['add']['content_model_to_add'] = array(
'#title' => "Choose Content Model",
'#type' => 'select',
'#options' => array_diff_key($content_models, $cm_options),
'#description' => t("Choose content model to add to this collection policy."),
);
$form ['manage_collection_policy']['add']['new_cp_namespace'] = array(
'#title' => "Choose Namespace",
'#type' => 'textfield',
'#size' => 15,
'#description' => t("Choose namespace for objects in this collection associated with this content model"),
);
$form['manage_collection_policy']['add']['submit'] = array(
'#type' => 'submit',
'#value' => t('Add Content Model to Collection Policy'),
'#id' => 'add_cm'
);
if ($show_delete) {
$form['manage_collection_policy']['remove'] = array(
'#title' => "Delete Content Model",
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form ['manage_collection_policy']['remove']['content_models_to_remove'] = array(
'#title' => "Choose Content Model to Remove",
'#type' => 'checkboxes',
'#options' => $cm_options,
'#description' => t("Choose content models to remove from this collection policy."),
);
$form['manage_collection_policy']['remove']['submit'] = array(
'#type' => 'submit',
'#value' => t('Remove Content Collection Policy'),
'#id' => 'remove_cm'
);
}
$form['change_cmodel'] = array(
'#title' => "Change Content Models",
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['change_cmodel']['titlebox'] = array(
'#type' => 'item',
'#value' => t("Change Content Models within $this_collection_pid"),
);
$form['change_cmodel']['current_content_model'] = array(
'#title' => "Choose content model to be changed",
'#type' => 'select',
'#options' => $cm_options,
'#description' => t("All objects in this collection with the selected content model will be changed."),
);
$form['change_cmodel']['new_content_model'] = array(
'#title' => "Choose new content model",
'#type' => 'select',
'#options' => $new_content_models,
'#description' => t("The new content model to be assigned to selected objects."),
);
$form['change_cmodel']['collection_pid'] = array(
'#type' => 'hidden',
'#value' => $this_collection_pid,
);
$form['change_cmodel']['submit'] = array(
'#type' => 'submit',
'#value' => t('Change Content Model Associations'),
'#id' => 'change_model',
);
if (user_access('delete entire collections')) {
$form['delete_collection'] = array(
'#title' => "Permanently Delete $collection_name",
'#type' => 'fieldset',
'#description' => t("Clicking this button will delete all objects within $collection_name. <br /> <strong>This action cannot be undone.</strong>"),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['delete_collection']['confirm'] = array(
'#title' => "Are you sure?",
'#type' => 'fieldset',
'#description' => t('<strong>Clicking the delete button will permanantly remove all objects from this collection. <br /> <strong>This action cannot be undone.</strong> '),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['delete_collection']['confirm']['submit'] = array(
'#type' => 'submit',
'#value' => t('Delete this collection'),
'#id' => 'delete_collection',
);
}
return($form);
}
/**
* collection creation form validate
* @param array $form
* @param array $form_state
*/
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');
$pid = $form_state['values']['new_collection_pid'];
$item = new fedora_item($pid);
if ($item->exists()) {
form_set_error('new_collection_pid', t("$pid already exists within your repository. the PID must be unique"));
return;
}
if (!valid_pid($pid)) {
form_set_error('new_collection_pid', t("$pid is not a valid identifier"));
return;
}
}
if ($form_state['clicked_button']['#id'] == 'add_cm') {
if (!valid_pid($form_state['values']['new_cp_namespace'])) {
form_set_error('new_cp_namespace', t("Namespace must be a valid PID"));
return;
}
}
}
/**
* collection creation form submit
* @global type $user
* @param type $form
* @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');
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');
$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'];
$pid_namespace = $form_state['values']['collection_namespace'];
$all_cModels = get_content_models_as_option_array();
$collection_policy = '<?xml version="1.0" encoding="UTF-8"?>
<collection_policy xmlns="http://www.islandora.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="" xsi:schemaLocation="http://www.islandora.ca http://syn.lib.umanitoba.ca/collection_policy.xsd">
<content_models>
</content_models>
<search_terms>
</search_terms>
<staging_area></staging_area>
<relationship>isMemberOfCollection</relationship>
</collection_policy>';
$content_models = $form_state['values']['content_models'];
$collection_policy_xml = simplexml_load_string($collection_policy);
foreach ($content_models as $content_model) {
if ($content_model) {
$node = $collection_policy_xml->content_models->addChild('content_model');
$node->addAttribute('dsid', 'ISLANDORACM');
$node->addAttribute('name', $all_cModels[$content_model]);
$node->addAttribute('namespace', $pid_namespace . ':1');
$node->addAttribute('pid', $content_model);
}
}
$item = fedora_item::ingest_new_item($new_collection_pid, 'A', $new_collection_label, $user->name);
$item->add_relationship('isMemberOfCollection', $collection_pid, RELS_EXT_URI);
$item->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI);
$item->add_datastream_from_string($collection_policy_xml->saveXML(), 'COLLECTION_POLICY');
$item->add_datastream_from_file($thumbnail, 'TN');
drupal_goto("/fedora/repository/$new_collection_pid");
}
if ($form_state['clicked_button']['#id'] == 'add_cm') {
$cp_namespace = $form_state['values']['new_cp_namespace'];
$cp_content_model = $form_state['values']['content_model_to_add'];
$policy->addModel(ContentModel::loadFromModel($cp_content_model), $cp_namespace);
$policy->saveToFedora();
drupal_set_message("Collection model successfully added");
}
if ($form_state['clicked_button']['#id'] == 'remove_cm') {
$candidates = $form_state['values']['content_models_to_remove'];
$count = 0;
foreach ($candidates as $candidate) {
if (is_string($candidate)) {
$policy->removeModel(ContentModel::loadFromModel($candidate));
$count++;
}
}
if ($count > 0) {
$policy->saveToFedora();
if ($count > 1) {
$s = 's';
}
drupal_set_message("$count collection model$s removed");
}
}
if ($form_state['clicked_button']['#id'] == 'change_model') {
$current_content_model = $form_state['values']['current_content_model'];
$new_content_model = $form_state['values']['new_content_model'];
$add_to_policy = TRUE;
$policy_cms = $policy->getContentModels();
foreach ($policy_cms as $policy_cm) {
if ($policy_cm->pid == $current_content_model) {
$namespace = $policy_cm->pid_namespace;
}
if ($policy_cm->pid == $new_content_model) {
$add_to_policy = FALSE;
}
}
if ($add_to_policy) {
$policy->addModel(ContentModel::loadFromModel($new_content_model), $namespace);
$policy->saveToFedora();
}
$query = "select \$object from <#ri>
where (\$object <info:fedora/fedora-system:def/model#hasModel> <info:fedora/$current_content_model>
and \$object <info:fedora/fedora-system:def/relations-external#isMemberOfCollection> <info:fedora/$collection_pid>
and \$object <fedora-model:state> <info:fedora/fedora-system:def/model#Active>)";
$query = htmlentities(urlencode($query));
$content = '';
$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);
$object_pids = preg_replace('/^info:fedora\/|"object"/', '', $results);
$count = 0;
foreach ($object_pids as $object_pid) {
if (!$object_pid) {
continue;
}
$item = new fedora_item($object_pid);
$item->purge_relationship('hasModel', $current_content_model);
$item->add_relationship('hasModel', $new_content_model, FEDORA_MODEL_URI);
$count++;
}
drupal_set_message("$current_content_model changed to $new_content_model on $count objects");
}
if ($form_state['clicked_button']['#id'] == 'delete_collection') {
$collection_name = $form_state['values']['collection_name'];
$pids = get_related_items_as_array($collection_pid, 'isMemberOfCollection');
$batch = array(
'title' => "Deleting Objects from $name",
'operations' => array(),
'file' => drupal_get_path('module', 'fedora_repository') . '/CollectionManagement.inc',
);
foreach ($pids as $pid) {
$batch['operations'][] = array('delete_objects_as_batch', array($pid));
}
batch_set($batch);
batch_process('/fedora/repository');
}
}
/**
* deletes PID if pid is not collection
* @param <type> $pid
*/
function delete_objects_as_batch($pid) {
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();
foreach ($models as $model) {
if ($model['object'] != 'islandora:collectionCModel') {
$item_to_delete->purge("$object purged by $name");
}
}
}

21
CollectionPolicy.inc

@ -64,7 +64,7 @@ class CollectionPolicy extends XMLDatastream {
/**
* Ingests a new Collection Policy datastream to the specified
* PID with the DSID specified. The file should be a valid collection
* policy XML. Returns false on failure.
* policy XML. Returns FALSE on failure.
*
* @param string $pid
* @param string $name
@ -92,7 +92,7 @@ class CollectionPolicy extends XMLDatastream {
/**
* Ingests a new Collection Policy datastream to the specified
* PID with the DSID specified. Clones the collection policy from the
* source collection pid. Returns false on failure.
* source collection pid. Returns FALSE on failure.
*
* @param string $pid
* @param string $name
@ -122,7 +122,7 @@ class CollectionPolicy extends XMLDatastream {
/**
* Ingests a new minimum Collection Policy datastream to the specified
* PID with the DSID specified. Initializes the policy with the specified values.
* Returns false on failure
* Returns FALSE on failure
*
* @param string $pid
* @param string $name
@ -234,7 +234,7 @@ class CollectionPolicy extends XMLDatastream {
$termEl = $newDom->createElement('term', $term->value);
$termEl->setAttribute('field', $term->field);
if (strval($sXml->search_terms->default) == $term->field) {
$termEl->setAttribute('default', 'true');
$termEl->setAttribute('default', 'TRUE');
}
$search_termsEl->appendChild($termEl);
}
@ -321,7 +321,7 @@ class CollectionPolicy extends XMLDatastream {
/**
* Sets the path to the staging area to use for this
* collection. If specified path is blank (or false) it will
* collection. If specified path is blank (or FALSE) it will
* remove the staging are path element from the collection policy.
*
* @param string $path
@ -360,13 +360,14 @@ class CollectionPolicy extends XMLDatastream {
* @param string $dsid
* @return string $nextPid
*/
public function getNextPid($dsid) {
public function getNextPid($dsid, $content_model = null) {
$ret = FALSE;
if (self::valid_dsid($dsid) && $this->validate()) {
$content_models = $this->xml->getElementsByTagName('content_models')->item(0)->getElementsByTagName('content_model');
$namespace = FALSE;
for ($i = 0; $namespace === FALSE && $i < $content_models->length; $i++) {
if (strtolower($content_models->item($i)->getAttribute('dsid')) == strtolower($dsid)) {
if (strtolower($content_models->item($i)->getAttribute('dsid')) == strtolower($dsid) && (strtolower($content_models->item($i)->getAttribute('pid') == $content_model) || $content_model == null)) {
$namespace = $content_models->item($i)->getAttribute('namespace');
}
}
@ -435,7 +436,7 @@ class CollectionPolicy extends XMLDatastream {
$terms = $this->xml->getElementsByTagName('search_terms')->item(0)->getElementsByTagName('term');
for ($i = 0; $i < $terms->length; $i++) {
$default = $terms->item($i)->attributes->getNamedItem('default');
$default = ($default !== NULL) ? (strtolower($default->nodeValue) == 'true') : FALSE;
$default = ($default !== NULL) ? (strtolower($default->nodeValue) == 'TRUE') : FALSE;
$ret[] = ($asArray) ? array('value' => $terms->item($i)->nodeValue,
'field' => $terms->item($i)->getAttribute('field'),
'default' => $default) : $terms->item($i)->nodeValue;
@ -540,7 +541,7 @@ class CollectionPolicy extends XMLDatastream {
if ($terms->item($i)->attributes->getNamedItem('default') !== NULL) {
$terms->item($i)->removeAttribute('default');
}
$found->setAttribute('default', 'true');
$found->setAttribute('default', 'TRUE');
$ret = TRUE;
}
}
@ -550,7 +551,7 @@ class CollectionPolicy extends XMLDatastream {
/**
* Removes the specified content model from the collection policy. This will only
* prevent future ingests of the removed model to the collection. $cm should be
* a valid ContentModel object. Returns false on failure or when the CM was not found in
* a valid ContentModel object. Returns FALSE on failure or when the CM was not found in
* the collection policy.
*
* @param ContentModel $cm

6
ConnectionHelper.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file
@ -71,7 +71,7 @@ class ConnectionHelper {
'exceptions' => $exceptions,
));
} catch (SoapFault $e) {
drupal_set_message(t("!e", array('!e' => $e->getMessage())));
drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))));
return NULL;
}
}
@ -83,7 +83,7 @@ class ConnectionHelper {
'exceptions' => TRUE,
));
} catch (SoapFault $e) {
drupal_set_message(t("!e", array('!e' => $e->getMessage())));
drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))));
return NULL;
}
}

54
ContentModel.inc

@ -34,7 +34,7 @@ class ContentModel extends XMLDatastream {
/**
* Constructs a ContentModel object from a Fedora item
* by getting the first content model from the hasModel relationship.
* Returns false on failure.
* Returns FALSE on failure.
* @param string $pid
* @return ContentModel $cm
*/
@ -57,7 +57,7 @@ class ContentModel extends XMLDatastream {
/**
* Ingests a Content Model from a file to the specified pid/dsid .
* Returns false on failure.
* Returns FALSE on failure.
*
* @param string $pid
* @param string $name
@ -84,7 +84,7 @@ class ContentModel extends XMLDatastream {
/**
* Ingests a Content Model from an existing model to the specified pid/dsid .
* Returns false on failure.
* Returns FALSE on failure.
*
* @param string $pid
* @param string $name
@ -113,7 +113,7 @@ class ContentModel extends XMLDatastream {
/**
* Ingests a minimum Content Model to the specified pid/dsid.
* Returns false on failure.
* Returns FALSE on failure.
*
* @param string $pid
* @param string $name
@ -153,8 +153,8 @@ class ContentModel extends XMLDatastream {
$ingestFormEl = $newDom->createElement('ingest_form');
$ingestFormEl->setAttribute('dsid', $ingestFormDsid);
$ingestFormEl->setAttribute('page', $ingestFormPage);
if ($ingestFormHideChooser == 'true') {
$ingestFormEl->setAttribute('hide_file_chooser', 'true');
if ($ingestFormHideChooser == 'TRUE') {
$ingestFormEl->setAttribute('hide_file_chooser', 'TRUE');
}
$builderEl = $newDom->createElement('form_builder_method');
@ -186,7 +186,7 @@ class ContentModel extends XMLDatastream {
* If DSID is specified it will use that datastream as the model, otherwise it will
* use the default (usually ISLANDORACM). PID_NAMESPACE and name can also be initialized
* from the collection policy.
* Returns false on failure.
* Returns FALSE on failure.
*
* NOTE: $name will be overwritten with the content model name found in the datastream
* when the model is first validated.\
@ -344,7 +344,7 @@ class ContentModel extends XMLDatastream {
$ingest_formEl->setAttribute('dsid', $sXml->ingest_form['dsid']);
$ingest_formEl->setAttribute('page', $sXml->ingest_form['page']);
if (isset($sXml->ingest_form['hide_file_chooser'])) {
$ingest_formEl->setAttribute('hide_file_chooser', (strtolower($sXml->ingest_form['hide_file_chooser']) == 'true') ? 'true' : 'false');
$ingest_formEl->setAttribute('hide_file_chooser', (strtolower($sXml->ingest_form['hide_file_chooser']) == 'TRUE') ? 'TRUE' : 'FALSE');
}
$form_builderEl = $newDom->createElement('form_builder_method');
@ -373,8 +373,8 @@ class ContentModel extends XMLDatastream {
$elEl->setAttribute('label', $element->label);
$elEl->setAttribute('name', $element->name);
$elEl->setAttribute('type', $element->type);
if (strtolower($element->required) == 'true') {
$elEl->setAttribute('required', 'true');
if (strtolower($element->required) == 'TRUE') {
$elEl->setAttribute('required', 'TRUE');
}
if (isset($element->description) && trim($element->description) != '') {
$descEl = $newDom->createElement('description', trim($element->description));
@ -453,7 +453,7 @@ class ContentModel extends XMLDatastream {
/**
* Gets the name of the ContentModel
* Returns false on failure.
* Returns FALSE on failure.
*
* @return String $name
*/
@ -539,7 +539,7 @@ class ContentModel extends XMLDatastream {
$element = array('name' => $elements->item($i)->getAttribute('name'),
'label' => $label,
'type' => $elements->item($i)->getAttribute('type'),
'required' => ($elements->item($i)->getAttribute('required') == 'true') ? TRUE : FALSE,
'required' => ($elements->item($i)->getAttribute('required') == 'TRUE') ? TRUE : FALSE,
'description' => $desc
);
@ -561,7 +561,7 @@ class ContentModel extends XMLDatastream {
$items = $params->item(0)->getElementsByTagName('parameter');
for ($j = 0; $j < $items->length; $j++) {
$value = $items->item($j)->nodeValue;
$list[$items->item($j)->getAttribute('name')] = (strtolower($value) == 'true' ? TRUE : (strtolower($value) == 'false' ? FALSE : $value));
$list[$items->item($j)->getAttribute('name')] = (strtolower($value) == 'TRUE' ? TRUE : (strtolower($value) == 'FALSE' ? FALSE : $value));
}
}
$element['parameters'] = $list;
@ -657,7 +657,7 @@ class ContentModel extends XMLDatastream {
/**
* Sets a parameter of an ingest form element. If the value of the element is FALSE the parameter
* will be removed entirely (if you want to store false as a value, then send the String "false").
* will be removed entirely (if you want to store FALSE as a value, then send the String "FALSE").
*
* @param String $elementName
* @param String $paramName
@ -786,7 +786,7 @@ class ContentModel extends XMLDatastream {
$found->setAttribute('name', $name);
$found->setAttribute('type', $type);
$found->setAttribute('required', $required ? 'true' : 'false');
$found->setAttribute('required', $required ? 'TRUE' : 'FALSE');
if (trim($label) != '' && trim($label) != trim($name)) {
$found->setAttribute('label', $label);
}
@ -838,7 +838,7 @@ class ContentModel extends XMLDatastream {
$elementEl = $this->xml->createElement('element');
$elementEl->setAttribute('name', $name);
$elementEl->setAttribute('type', $type);
$elementEl->setAttribute('required', $requiredi ? 'true' : 'false');
$elementEl->setAttribute('required', $requiredi ? 'TRUE' : 'FALSE');
if (trim($label) != '' && trim($label) != trim($name)) {
$elementEl->setAttribute('label', $label);
}
@ -1062,7 +1062,7 @@ class ContentModel extends XMLDatastream {
$ingest_form = $this->xml->getElementsByTagName('ingest_form')->item(0);
if (!empty($ingest_form)) {
if (strtolower($ingest_form->getAttribute('hide_file_chooser')) == 'true') {
if (strtolower($ingest_form->getAttribute('hide_file_chooser')) == 'TRUE') {
$form['indicator']['ingest-file-location']['#type'] = 'hidden';
}
}
@ -1464,7 +1464,7 @@ class ContentModel extends XMLDatastream {
$datastreams = $datastreams->item(0)->getElementsByTagName('datastream');
for ($i = 0; $i < $datastreams->length; $i++) {
$ds = $datastreams->item($i);
if ($ds->attributes->getNamedItem('display_in_fieldset') == NULL || strtolower($ds->getAttribute('display_in_fieldset')) != 'false') {
if ($ds->attributes->getNamedItem('display_in_fieldset') == NULL || strtolower($ds->getAttribute('display_in_fieldset')) != 'FALSE') {
$dispMethods = $ds->getElementsByTagName('display_method');
for ($j = 0; $j < $dispMethods->length; $j++) {
$method = $dispMethods->item($j);
@ -1592,7 +1592,7 @@ class ContentModel extends XMLDatastream {
'file' => $dispMethods->item($i)->getAttribute('file'),
'class' => $dispMethods->item($i)->getAttribute('class'),
'method' => $dispMethods->item($i)->getAttribute('method'),
'default' => ($dispMethods->item($i)->attributes->getNamedItem('default') !== NULL ? strtolower($dispMethods->item($i)->getAttribute('default')) == 'true' : FALSE));
'default' => ($dispMethods->item($i)->attributes->getNamedItem('default') !== NULL ? strtolower($dispMethods->item($i)->getAttribute('default')) == 'TRUE' : FALSE));
}
}
return $ret;
@ -1620,7 +1620,7 @@ class ContentModel extends XMLDatastream {
$dsEl = $this->xml->createElement('datastream');
$dsEl->setAttribute('dsid', $dsid);
if ($display_in_fieldset == TRUE) {
$dsEl->setAttribute('display_in_fieldset', 'true');
$dsEl->setAttribute('display_in_fieldset', 'TRUE');
}
$datastreamsEl->appendChild($dsEl);
$ret = TRUE;
@ -1652,7 +1652,7 @@ class ContentModel extends XMLDatastream {
public function displayInFieldset($dsid) {
$ret = FALSE;
if (self::valid_dsid($dsid) && ($ds = $this->getDSModel($dsid)) !== FALSE) {
$ret = strtolower($ds->getAttribute('display_in_fieldset')) == 'true';
$ret = strtolower($ds->getAttribute('display_in_fieldset')) == 'TRUE';
}
return $ret;
}
@ -1671,7 +1671,7 @@ class ContentModel extends XMLDatastream {
$ret = TRUE;
}
elseif ($value == TRUE) {
$ds->setAttribute('display_in_fieldset', 'true');
$ds->setAttribute('display_in_fieldset', 'TRUE');
$ret = TRUE;
}
}
@ -1710,7 +1710,7 @@ class ContentModel extends XMLDatastream {
}
}
$found->setAttribute('default', 'true');
$found->setAttribute('default', 'TRUE');
$ret = TRUE;
}
}
@ -2112,8 +2112,8 @@ class ContentModel extends XMLDatastream {
$ingest_formEl = $this->xml->getElementsByTagName('ingest_form')->item(0);
$ret = array('dsid' => $ingest_formEl->getAttribute('dsid'),
'page' => $ingest_formEl->getAttribute('page'),
'hide_file_chooser' => strtolower($ingest_formEl->getAttribute('hide_file_chooser')) == 'true',
'redirect' => strtolower($ingest_formEl->getAttribute('redirect')) == 'false' ? FALSE : TRUE);
'hide_file_chooser' => strtolower($ingest_formEl->getAttribute('hide_file_chooser')) == 'TRUE',
'redirect' => strtolower($ingest_formEl->getAttribute('redirect')) == 'FALSE' ? FALSE : TRUE);
}
return $ret;
}
@ -2133,13 +2133,13 @@ class ContentModel extends XMLDatastream {
$ingest_formEl->setAttribute('dsid', $dsid);
$ingest_formEl->setAttribute('page', $page);
if (!$redirect) {
$ingest_formEl->setAttribute('redirect', 'false');
$ingest_formEl->setAttribute('redirect', 'FALSE');
}
else {
$ingest_formEl->removeAttribute('redirect');
}
if ($hide_file_chooser) {
$ingest_formEl->setAttribute('hide_file_chooser', 'true');
$ingest_formEl->setAttribute('hide_file_chooser', 'TRUE');
}
else {
$ingest_formEl->removeAttribute('hide_file_chooser');

2
MimeClass.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file

26
ObjectHelper.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file
* Object Helper Class
@ -19,9 +19,6 @@ class ObjectHelper {
public static $INGEST_FEDORA_OBJECTS = 'ingest new fedora objects';
public static $EDIT_TAGS_DATASTREAM = 'edit tags datastream';
public static $VIEW_DETAILED_CONTENT_LIST = 'view detailed list of content';
public static $MANAGE_COLLECTIONS = 'manage collections';
public static $DELETE_ENTIRE_COLLECTIONS = 'delete entire collections';
public static $CREATE_BATCH_PROCESS = 'create batch process';
public static $DISPLAY_ALWAYS = 0;
public static $DISPLAY_NEVER = 1;
public static $DISPLAY_NO_MODEL_OUTPUT = 2;
@ -387,7 +384,7 @@ class ObjectHelper {
$input = new DomDocument();
$input->loadXML(trim($xmlstr));
} catch (exception $e) {
watchdog(t("Fedora_Repository"), "Problem loading XSL file: !e", array('!e' => $e), NULL, WATCHDOG_ERROR);
watchdog(t("Fedora_Repository"), "Problem loading XSL file: @e", array('@e' => $e), NULL, WATCHDOG_ERROR);
}
$xsl = $proc->importStylesheet($xsl);
$newdom = $proc->transformToDoc($input);
@ -550,6 +547,7 @@ class ObjectHelper {
*/
function get_content_models_list($pid, $include_fedora_system_content_models = FALSE) {
module_load_include('inc', 'fedora_repository', 'CollectionClass');
module_load_include('inc', 'fedora_repository', 'ContentModel');
$collectionHelper = new CollectionClass();
$pids = array();
$query = 'select $object from <#ri>
@ -751,7 +749,7 @@ class ObjectHelper {
try {
$parent_collections = new SimpleXMLElement($parent_collections);
} catch (exception $e) {
drupal_set_message(t('Error getting parent objects !e', array('!e' => $e->getMessage())));
drupal_set_message(t('Error getting parent objects @e', array('@e' => check_plain($e->getMessage()))));
return;
}
@ -836,7 +834,7 @@ class ObjectHelper {
and $o <mulgara:is> <info:fedora/' . $pid . '>';
$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 .= "?type=tuples&flush=TRUE&format=csv&limit=1000&lang=itql&stream=on&query=";
$content = do_curl($url . htmlentities(urlencode($query_string)));
$rows = explode("\n", $content);
@ -870,7 +868,7 @@ class ObjectHelper {
$query_string = substr($query_string, 0, -3) . ' )';
$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 .= "?type=tuples&flush=TRUE&format=csv&limit=1000&lang=itql&stream=on&query=";
$url .= htmlentities(urlencode($query_string));
$content = $this->doCurl($url);
@ -938,7 +936,7 @@ class ObjectHelper {
or <info:fedora/' . $pid . '> <fedora-rels-ext:isPartOf> $parentObject)
and $parentObject <fedora-model:state> <info:fedora/fedora-system:def/model#Active>)
minus $content <mulgara:is> <info:fedora/fedora-system:FedoraObject-3.0>
order by $title';
order by $title desc';
$query_string = htmlentities(urlencode($query_string));
$url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch');
@ -947,9 +945,13 @@ class ObjectHelper {
$result = preg_split('/[\r\n]+/', do_curl($url));
array_shift($result); // throw away first line
$matches = str_getcsv(join("\n", $result));
if ($matches !== FALSE) {
if (count($matches) >= 2) {
$parent = preg_replace('/^info:fedora\//', '', $matches[0]);
if (0 == strlen($matches[1])) {
$matches[1] = "Unlabeled Object";
}
$breadcrumbs[] = l($matches[1], 'fedora/repository/' . $pid);
if ($parent == variable_get('fedora_repository_pid', 'islandora:root')) {
$breadcrumbs[] = l(t('Digital repository'), 'fedora/repository');
@ -959,6 +961,10 @@ class ObjectHelper {
$this->getBreadcrumbs($parent, $breadcrumbs, $level - 1);
}
}
else {
$breadcrumbs[] = l("Path Calculation Error", 'fedora/repository/' . $pid);
}
}
}

2
SearchClass.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file

36
SecurityClass.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file
@ -34,7 +34,6 @@ class SecurityClass {
$objectHelper = new ObjectHelper();
// get the childsecurity policy from the collection.
$policyStream = $objectHelper->getStream($collection_pid, SECURITYCLASS :: $SECURITY_CLASS_SECURITY_STREAM, FALSE);
if ($policyStream == NULL) {
// no child policy stream so collection is wide open to anyone to ingest, that has the permission ingest in Drupal.
// maybe we should return FALSE here?? would be more secure.
@ -79,34 +78,19 @@ class SecurityClass {
}
$xml->registerXPathNamespace('default', 'urn:oasis:names:tc:xacml:1.0:policy');
$conditions = $xml->xpath("//default:Condition");
$roles = $xml->xpath('//default:SubjectAttributeDesignator[@AttributeId="fedoraRole"]/../default:Apply/default:AttributeValue');
$users = $xml->xpath('//default:SubjectAttributeDesignator[@AttributeId="urn:fedora:names:fedora:2.1:subject:loginId"]/../default:Apply/default:AttributeValue');
foreach ($conditions as $condition) {
$designator = $condition->Apply->SubjectAttributeDesignator;
if (empty($designator)) {//$disignator may be wrapped by an or
$designator = $condition->Apply->Apply->SubjectAttributeDesignator;
}
$attributeId = strip_tags($designator['AttributeId']);
if ($attributeId == "fedoraRole") {
foreach ($condition->Apply->Apply->AttributeValue as $attributeValue) {
$allowedRoles[] = strip_tags($attributeValue->asXML());
}
foreach ($condition->Apply->Apply->Apply->AttributeValue as $attributeValue) {
$allowedRoles[] = strip_tags($attributeValue->asXML());
}
}
if ($attributeId == "urn:fedora:names:fedora:2.1:subject:loginId") {
foreach ($condition->Apply->Apply->AttributeValue as $attributeValue) {
$allowedUsers[] = strip_tags($attributeValue->asXML());
}
foreach ($condition->Apply->Apply->Apply->AttributeValue as $attributeValue) {
$allowedUsers[] = strip_tags($attributeValue->asXML());
}
}
foreach($roles as $role) {
$allowedRoles[] = (string)$role;
}
foreach($users as $user) {
$allowedUsers[] = (string)$user;
}
$usersAndRoles['users'] = $allowedUsers;
$usersAndRoles['roles'] = $allowedRoles;
return $usersAndRoles;
}

4
XMLDatastream.inc

@ -102,7 +102,7 @@ abstract class XMLDatastream {
* @return XMLDatastream $cm
*/
public function __construct($xmlStr, $pid = NULL, $dsid = NULL) {
libxml_use_internal_errors(true);
libxml_use_internal_errors(TRUE);
$this->pid = $pid;
$this->dsid = $dsid;
@ -253,7 +253,7 @@ abstract class XMLDatastream {
/**
* Gets the history of the datastream from fedora.
* Returns false on failure.
* Returns FALSE on failure.
*
* @return string[] $ret
*/

2
api/dublin_core.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file

2
api/fedora_collection.inc

@ -41,7 +41,7 @@ function export_collection($collection_pid, $relationship = 'isMemberOfCollectio
fwrite($file, $item_foxml);
fclose($file);
}
if (system("cd $container;zip -r $collection_pid.zip $collection_pid/* >/dev/NULL") == 0) {
if (system("cd $container;zip -r $collection_pid.zip $collection_pid/* >/dev/null") == 0) {
header("Content-type: application/zip");
header('Content-Disposition: attachment; filename="' . $collection_pid . '.zip' . '"');
$fh = fopen($container . '/' . $collection_pid . '.zip', 'r');

4
api/fedora_export.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file
@ -170,7 +170,7 @@ function export_foxml_for_pid($pid, $dir, $paths, &$log, $format = FOXML_11, $re
}
foreach ($xpath->('METS:FLocat[@xlink:href]', $content_node) as $floc) {
$floc->setAttribute('xlink:href', url($paths[$ds_id], array('absolute' => true)));
$floc->setAttribute('xlink:href', url($paths[$ds_id], array('absolute' => TRUE)));
}
`}
*/

9
api/fedora_item.inc

@ -297,10 +297,10 @@ class Fedora_Item {
$i++;
$url = variable_get('fedora_base_url', 'http://localhost:8080/fedora');
if ($cursor == 0) {
$url .= "/objects?query=$field~$pattern&pid=true&title=true&resultFormat=xml&maxResults=$max_results";
$url .= "/objects?query=$field~$pattern&pid=true&title=TRUE&resultFormat=xml&maxResults=$max_results";
}
else {
$url .= "/objects?pid=true&title=truesessionToken=$session_token&resultFormat=xml&maxResults=$max_results";
$url .= "/objects?pid=true&title=true&sessionToken=$session_token&resultFormat=xml&maxResults=$max_results";
}
if (count($resultFields) > 0) {
@ -308,7 +308,6 @@ class Fedora_Item {
}
$resultxml = do_curl($url);
libxml_use_internal_errors(TRUE);
$resultelements = simplexml_load_string($resultxml);
if ($resultelements === FALSE) {
@ -885,7 +884,7 @@ class Fedora_Item {
drupal_set_message(t("Error trying to call SOAP function $function_name. Check watchdog logs for more information."), 'error');
}
watchdog(t("FEDORA_REPOSITORY"), "Error Trying to call SOAP function !fn: !e", array('!fn' => $function_name, '!e' => $e), NULL, WATCHDOG_ERROR);
watchdog(t("FEDORA_REPOSITORY"), "Error Trying to call SOAP function @fn: @e", array('@fn' => $function_name, '@e' => $e), NULL, WATCHDOG_ERROR);
}
return NULL;
}
@ -904,7 +903,7 @@ class Fedora_Item {
} catch (exception $e) {
if (!$quiet) {
watchdog(t("FEDORA_REPOSITORY"), "Error trying to call SOAP function !fn: !e", array('!fn' => $function_name, '!e' => $e), NULL, WATCHDOG_ERROR);
watchdog(t("FEDORA_REPOSITORY"), "Error trying to call SOAP function @fn: @e", array('@fn' => $function_name, '@e' => $e), NULL, WATCHDOG_ERROR);
}
return NULL;
}

68
api/fedora_utils.inc

@ -1,12 +1,11 @@
<?php
// $Id$
/**
* @file
* Base utilities used by the Islandora fedora module.
*/
if (!function_exists('str_getcsv')) {
/**
@ -98,7 +97,6 @@ function do_curl_ext($url, $return_to_variable = 1, $number_of_post_vars = 0, $p
global $user;
// Check if we are inside Drupal and there is a valid user.
// If the user is not valid for a Fedora call curl will throw an exception.
if ((!isset($user)) || $user->uid == 0) {
$fedora_user = 'anonymous';
@ -131,9 +129,8 @@ function do_curl_ext($url, $return_to_variable = 1, $number_of_post_vars = 0, $p
$error_code = curl_errno($ch);
$error_string = curl_error($ch);
return array ($ret_val, $error_code, $error_string);
return array($ret_val, $error_code, $error_string);
}
else {
if (function_exists(drupal_set_message)) {
drupal_set_message(t('No curl support.'), 'error');
@ -159,10 +156,9 @@ function fedora_available() {
function risearch_available() {
$response = do_curl_ext(variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'));
return ($response != NULL) ? ($response[1] == 0): FALSE;
return ($response != NULL) ? ($response[1] == 0) : FALSE;
}
/**
* Returns a UTF-8-encoded transcripiton of the string given in $in_str.
* @param string $in_str
@ -239,13 +235,14 @@ function fix_dsid($dsid) {
*/
function get_collections_as_option_array() {
module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
$restricted = variable_get('fedora_namespace_restriction_enforced', TRUE);
$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 .= "?type=tuples&flush=true&format=csv&limit=1000&lang=itql&stream=on&query=";
$url .= "?type=tuples&flush=TRUE&format=csv&limit=1000&lang=itql&stream=on&query=";
$content = do_curl($url . htmlentities(urlencode($query)));
$list = explode("\n", $content);
array_shift($list);
@ -264,45 +261,46 @@ function get_collections_as_option_array() {
/**
* Function: get_content_models_as_option_array
*
* Description: Returns an associative array of all collection objects in Fedora instance
* Description: Returns an associative array of all available content models in Fedora instance
*
* @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');
$restricted = variable_get('fedora_namespace_restriction_enforced', true);
$allowed_string = variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora:');
$namespaces = explode(':', $allowed_string);
foreach ($namespaces as $namespace) {
if ($namespace) {
$allowed[] = trim($namespace);
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);
foreach ($namespaces as $namespace) {
if ($namespace) {
$allowed[] = trim($namespace);
}
}
}
$query = 'select $object $title from <#ri>
$query = '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';
$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);
array_shift($list);
$list = preg_replace('/info:fedora\//', '', $list);
foreach ($list as $item) { //removes blanks
if ($item) {
$parts = explode(',', $item);
$item = new fedora_item($parts[0]);
$nameparts = explode(':', $parts[0]);
if (!$restricted || in_array($nameparts[0], $allowed))
if ($item->get_datastream_dissemination('ISLANDORACM')) {
$options[$parts[0]] = $parts[1]. ' ~ ' . $parts[0] ;
$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);
array_shift($list);
$list = preg_replace('/info:fedora\//', '', $list);
foreach ($list as $item) { //removes blanks
if ($item) {
$parts = explode(',', $item);
$nameparts = explode(':', $parts[0]);
if (!$restricted || in_array($nameparts[0], $allowed)) {
if (!preg_match('/fedora-system/', $nameparts[0])) {
$options[$parts[0]] = $parts[1] . ' ~ ' . $parts[0];
}
}
}
}
}
return $options;
return $options;
}

2
api/rels-ext.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file

4
api/tagging.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file
@ -69,7 +69,7 @@ class TagSet {
$this->item->modify_datastream_by_value($tagdoc->saveXML(), $this->tagsDSID, 'Tags', 'text/xml', 'X');
}
} catch (exception $e) {
drupal_set_message(t('There was an error saving the tags datastream: !e'), array('!e' => $e), 'error');
drupal_set_message(t('There was an error saving the tags datastream: @e'), array('@e' => $e), 'error');
return FALSE;
}
return TRUE;

5
fedora_repository.info

@ -1,9 +1,8 @@
; $Id$
name = Digital Repository
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.beta1
version = 11.3beta2
core = 6.x

51
fedora_repository.install

@ -87,32 +87,6 @@ function fedora_repository_requirements($phase) {
$requirements['xslt']['value'] = t("Installed");
$requirements['xslt']['severity'] = REQUIREMENT_OK;
}
// Test for Imagick
system("hash convert 2>&-", $return_value);
$requirements['imagick']['title'] = t("Image Magick library");
if ($return_value) {
$requirements['imagick']['value'] = t("Not installed");
$requirements['imagick']['severity'] = REQUIREMENT_WARNING;
$requirements['imagick']['description'] = t('Ensure that the Image Magick library is installed.');
}
else {
$requirements['imagick']['value'] = t("Installed");
$requirements['imagick']['severity'] = REQUIREMENT_OK;
}
// Test for Kakadu
system("hash kdu_compress 2>&-", $return_value);
$requirements['kakadu']['title'] = t("Kakadu library");
if ($return_value) {
$requirements['kakadu']['value'] = t("Not installed");
$requirements['kakadu']['severity'] = REQUIREMENT_WARNING;
$requirements['kakadu']['description'] = t('Ensure that the Kakadu library is installed.');
}
else {
$requirements['kakadu']['value'] = t("Installed");
$requirements['kakadu']['severity'] = REQUIREMENT_OK;
}
}
elseif ($phase == 'runtime') {
module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
@ -127,31 +101,6 @@ function fedora_repository_requirements($phase) {
$requirements['fedora-repository']['value'] = t("Available");
$requirements['fedora-repository']['severity'] = REQUIREMENT_OK;
}
// Check for ImageMagick
$requirements['fedora-imagemagick']['title'] = t("ImageMagick convert in \$PATH");
$result = exec('convert');
if (!$result) {
$requirements['fedora-imagemagick']['value'] = t('Not in $PATH');
$requirements['fedora-imagemagick']['description'] = t('Islandora will not be able to create thumbnails. Ensure that <a href="www.imagemagick.org/">ImageMagick</a> is installed and the convert command is executable by the web server user.');
$requirements['fedora-imagemagick']['severity'] = REQUIREMENT_WARNING;
}
else {
$requirements['fedora-imagemagick']['value'] = t("Available");
$requirements['fedora-imagemagick']['severity'] = REQUIREMENT_OK;
}
$requirements['fedora-kakadu']['title'] = 'Kakadu kdu_compress in $PATH';
$kdu_res = exec('kdu_compress -v');
if (!$kdu_res) {
$requirements['fedora-kakadu']['value'] = ('Not in $PATH');
$requirements['fedora-kakadu']['description'] = t('Islandora cannot convert TIFF image files to JPEG2000 format. Ensure <a href="http://www.kakadusoftware.com/">Kakadu</a> is installed and the kdu_compress command is executable by the web server user.');
$requirements['fedora-kakadu']['severity'] = REQUIREMENT_WARNING;
}
else {
$requirements['fedora-kakadu']['value'] = t("Available");
$requirements['fedora-kakadu']['severity'] = REQUIREMENT_OK;
}
}
return $requirements;

88
fedora_repository.module

@ -54,8 +54,7 @@ function fedora_repository_purge_object($pid = NULL, $name = 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(
$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)
);
@ -115,7 +114,7 @@ function fedora_repository_ingest_object($collection_pid=NULL, $collection_label
$collection_pid = urldecode($collection_pid);
}
else {
drupal_set_message(t("This collection PID $collection_pid is not valid"), 'error');
drupal_set_message(t("This collection PID @collection_pid is not valid", check_plain($collection_pid)), 'error');
return ' ';
}
}
@ -143,6 +142,10 @@ function fedora_repository_ingest_object($collection_pid=NULL, $collection_label
*/
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['ahah_submission']) {
$form_state['submitted'] = false;
return;
}
if ($form_state['storage']['xml']) {
if (module_exists('islandora_content_model_forms')) {
module_load_include('inc', 'islandora_content_model_forms', 'IngestObjectMetadataForm');
@ -150,7 +153,7 @@ function fedora_repository_ingest_form_submit(array $form, array &$form_state) {
$xml_form->submit($form, $form_state);
}
}
else if ($form_state['clicked_button']['#id'] == 'edit-submit') {
elseif ($form_state['clicked_button']['#id'] == 'edit-submit') {
global $base_url;
module_load_include('inc', 'fedora_repository', 'CollectionClass');
module_load_include('inc', 'fedora_repository', 'CollectionPolicy');
@ -198,7 +201,11 @@ function fedora_repository_ingest_form_submit(array $form, array &$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') {
if ($form_state['ahah_submission']) {
$form_state['submitted'] = false;
return;
}
if ($form_state['clicked_button']['#id'] == 'edit-submit' && $form_state['ahah_submission'] != 1) {
switch ($form_state['storage']['step']) {
case 1:
$form_state['storage']['step']++;
@ -240,14 +247,14 @@ function fedora_repository_ingest_form_validate($form, &$form_state) {
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)));
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');
drupal_set_message(check_plain($err), 'error');
}
}
}
@ -318,7 +325,7 @@ function fedora_repository_purge_object_form(&$form_state, $pid, $referrer = NUL
if (!empty($collectionPid)) {
$collectionPid = $_SESSION['fedora_collection'];
}
//$form['#redirect'] = $referrer;
//$form['#rebuild'] = $false;
return $form;
}
@ -400,7 +407,7 @@ function add_stream_form_submit($form, &$form_state) {
file_delete($file);
} catch (exception $e) {
drupal_set_message(t($e->getMessage()), 'error');
drupal_set_message(t('@message', array('@message' => check_plain($e->getMessage()))), 'error');
return;
}
$form_state['rebuild'] = TRUE;
@ -436,7 +443,7 @@ function add_stream_form_validate($form, &$form_state) {
return FALSE;
}
if (!(preg_match("/^[a-zA-Z]/", $dsid))) {
form_set_error('', t("Data stream ID ($dsid) has to start with a letter."));
form_set_error('', t("Data stream ID (@dsid) has to start with a letter.", array('@dsid' => check_plain($dsid))));
return FALSE;
}
if (strlen($dsLabel) > 64) {
@ -448,9 +455,9 @@ function add_stream_form_validate($form, &$form_state) {
return FALSE;
}
$validators = array(
// 'file_validate_is_image' => array(),
// 'file_validate_image_resolution' => array('85x85'),
// 'file_validate_size' => array(30 * 1024),
// '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);
@ -482,8 +489,7 @@ function fedora_repository_purge_stream($pid = NULL, $dsId = NULL, $name = NULL)
return ' ';
}
$output = t('Are you sure you wish to purge this datastream %name<br />',
array(
$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);
@ -520,7 +526,7 @@ function fedora_repository_purge_object_form_submit($form, &$form_state) {
drupal_set_message(t('Error: Insufficient permissions to purge object.'), 'error');
}
else {
drupal_set_message(t($e->getMessage()), 'error');
drupal_set_message(t('@message', array('@message' => check_plain($e->getMessage()))), 'error');
}
return;
}
@ -578,7 +584,7 @@ function fedora_repository_purge_stream_form_submit($form, &$form_state) {
try {
$item->purge_datastream($dsid);
} catch (exception $e) {
drupal_set_message(t($e->getMessage()), 'error');
drupal_set_message(t('@message', array('@message' => check_plain($e->getMessage()))), 'error');
}
$form_state['redirect'] = $base_url . "/fedora/repository/$pid";
}
@ -830,9 +836,6 @@ function fedora_repository_perm() {
OBJECTHELPER::$INGEST_FEDORA_OBJECTS,
OBJECTHELPER::$EDIT_TAGS_DATASTREAM,
OBJECTHELPER::$VIEW_DETAILED_CONTENT_LIST,
OBJECTHELPER::$MANAGE_COLLECTIONS,
OBJECTHELPER::$DELETE_ENTIRE_COLLECTIONS,
OBJECTHELPER::$CREATE_BATCH_PROCESS,
);
}
@ -936,7 +939,7 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
}
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_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;
@ -990,16 +993,16 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
// 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)){
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);
$hook_tabs = module_invoke_all('islandora_tabs', $content_models, $pid);
$cmodels_tabs = array_merge($cmodels_tabs, $object_details, $hook_tabs);
return tabs_render($cmodels_tabs);
}
@ -1068,7 +1071,7 @@ function repository_service($pid = NULL, $servicePid = NULL, $serviceMethod = NU
//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');
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 ' ';
}
@ -1468,10 +1471,10 @@ function fedora_repository_demo_objects_form() {
);
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>.)',
'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 {
@ -1580,7 +1583,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) {
$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');
drupal_set_message(t("Successfully installed <a href=\"@base_url/fedora/repository/islandora:ContentModelCollection\">islandora:ContentModelCollection</a>.", array('@base_url' => check_plain($base_url))), 'message');
} catch (exception $e) {
}
@ -1592,7 +1595,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) {
$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');
drupal_set_message(t("Successfully installed <a href=\"@base_url/fedora/repository/islandora:root\">islandora:root</a>.", array('@base_url' => check_plain($base_url))), 'message');
} catch (exception $e) {
}
@ -1612,7 +1615,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) {
$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');
drupal_set_message(t("Successfully installed <a href=\"@base_url/fedora/repository/islandora:demos\">islandora:demos</a>.", array('@base_url' => check_plain($base_url))), 'message');
} catch (exception $e) {
}
@ -1634,7 +1637,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) {
$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');
drupal_set_message(t("Successfully installed <a href=\"@base_url/fedora/repository/demo:SmileyStuff\">demo:SmileyStuff</a> collection view.", array('@base_url' => check_plain($base_url))), 'message');
} catch (exception $e) {
}
@ -1643,7 +1646,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) {
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) {
'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) {
@ -1653,14 +1656,14 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) {
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');
drupal_set_message(t("Successfully installed <a href=\"@base_url/fedora/repository/islandora:largeimages\">islandora:largeimages</a>.", array('@base_url' => check_plain($base_url))), 'message');
} catch (exception $e) {
$error .= " - Problem ingesting islandora:largeimages collection";
}
}
if (!empty($error)) {
drupal_set_message(t('Some problems occurred: ' . $error));
drupal_set_message(t('Some problems occurred: @error', array('@error' => $error)));
}
}
}
@ -1685,7 +1688,6 @@ function fedora_repository_required_fedora_objects() {
'dsversion' => 2,
'cmodel' => 'fedora-system:ContentModel-3.0',
),
array(
'pid' => 'islandora:root',
'label' => 'Islandora Top-level Collection',
@ -1956,7 +1958,7 @@ function fedora_repository_basket_form_submit($form, &$form_state) {
$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');
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;
}
@ -1965,7 +1967,7 @@ function fedora_repository_basket_form_submit($form, &$form_state) {
$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');
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;
}
@ -2085,9 +2087,7 @@ function theme_add_to_basket_link($pid, $type = 'object') {
*/
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)
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)
);
}

27
fedora_repository.solutionpacks.inc

@ -173,3 +173,30 @@ function fedora_repository_solution_pack_form_submit($form, &$form_state) {
}
batch_set($batch);
}
function solution_pack_add_form($form_name, $form_xml) {
$result = db_result(db_query('Select name from {xml_forms} where name = "%s"', $form_name));
if (!$result) {
$object = new stdClass();
$object->name = $form_name;
$object->form = $form_xml;
$result = drupal_write_record('xml_forms', $object);
drupal_set_message("Added $name");
}
}
function solution_pack_add_form_association($content_model, $form_name) {
$result = db_result(db_query('Select content_model from {islandora_content_model_forms} where content_model = "%s" and form_name = "%s"',
$content_model, $form_name));
if (!$result) {
$object = new stdClass();
$object->content_model = $content_model;
$object->form_name = $form_name;
$object->dsid = 'MODS';
$object->title_field = "['titleInfo']['title']";
$object->transform = 'mods_to_dc.xsl';
$result = drupal_write_record('islandora_content_model_forms', $object);
drupal_set_message("Added association between $content_model$name");
}
}

12
formClass.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file
@ -25,7 +25,7 @@ class formClass {
$items = array();
$items['admin/settings/fedora_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('fedora_repository_admin'),
@ -306,8 +306,8 @@ class formClass {
'#type' => 'fieldset',
'#title' => t('Advanced configuration options'),
'#description' => t('Advanced configuration. Under normal circumstances these will not be touched'),
'#collapsible' => true,
'#collapsed' => true,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['advanced']['fedora_object_display_title'] = array(
'#type' => 'select',
@ -587,7 +587,7 @@ class formClass {
$form = new IngestObjectMetadataForm();
return $form->create($collection_pid, $collection_label, $form_state);
} catch (Exception $e) {
$form_state['storage']['xml'] = false; // An error occured revert back to the QDC Form.
$form_state['storage']['xml'] = FALSE; // An error occured revert back to the QDC Form.
}
}
return $this->createQDCIngestForm($collection_pid, $collection_label, $form_state);
@ -810,7 +810,7 @@ class formClass {
$form = new EditObjectMetadataForm($form_state);
return $form->create($pid, $client, $form_state);
} catch (Exception $e) {
$form_state['storage']['xml'] = false; // An error occured revert back to the QDC Form.
$form_state['storage']['xml'] = FALSE; // An error occured revert back to the QDC Form.
}
}
return $this->createQDCEditForm($pid, $dsid, $client, $form_state);

8
installer_files/foxml/islandora-top.xml → 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>

2
plugins/CollectionFormBuilder.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file

2
plugins/CreateCollection.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file

2
plugins/DarwinCore.inc

@ -261,7 +261,7 @@ class DarwinCore {
try {
$proc = new XsltProcessor();
} catch (Exception $e) {
drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error');
return " ";
}

2
plugins/DemoFormBuilder.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file

2
plugins/Exiftool.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file

6
plugins/FedoraObjectDetailedContent.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file
@ -39,11 +39,11 @@ class FedoraObjectDetailedContent {
$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()))));
$details_selected = ($show_purge_tab ||$show_edit_tab);
$tabset['fedora_object_details'] = array(
'#type' => 'tabpage',
'#title' => t('Object Details'),
'#selected' => $show_purge_tab,
'#selected' => $details_selected,
);
$tabset['fedora_object_details']['tabset'] = array(
'#type' => 'tabset',

2
plugins/Ffmpeg.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file

6
plugins/Flv.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file
@ -69,7 +69,7 @@ class FormBuilder {
$oai->appendChild($previousElement);
}
} catch (exception $e) {
drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error');
continue;
}
}
@ -126,7 +126,7 @@ class FormBuilder {
unlink($form_values['fullpath']);
}
} catch (exception $e) {
drupal_set_message(t('Error ingesting object: !e', array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('Error ingesting object: @e', array('@e' => check_plain($e->getMessage()))), 'error');
return;
}
}

2
plugins/FlvFormBuilder.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file

10
plugins/FormBuilder.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file
@ -68,7 +68,7 @@ class FormBuilder {
$oai->appendChild($previousElement);
}
} catch (exception $e) {
drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error');
continue;
}
}
@ -96,7 +96,7 @@ class FormBuilder {
$xml = new SimpleXMLElement($policyStreamDoc);
} catch (Exception $e) {
watchdog(t("Fedora_Repository"), t("Problem getting security policy."), NULL, WATCHDOG_ERROR);
drupal_set_message(t('Problem getting security policy: !e', array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('Problem getting security policy: @e', array('@e' => check_plain($e->getMessage()))), 'error');
return FALSE;
}
$policyElement = $dom->createDocumentFragment();
@ -182,8 +182,8 @@ class FormBuilder {
}
file_delete($form_values['ingest-file-location']);
} catch (exception $e) {
drupal_set_message(t('Error ingesting object: !e', array('!e' => $e->getMessage())), 'error');
watchdog(t("Fedora_Repository"), "Error ingesting object: !e", array('!e' => $e->getMessage()), NULL, WATCHDOG_ERROR);
drupal_set_message(t('Error ingesting object: @e', array('@e' => check_plain($e->getMessage()))), 'error');
watchdog(t("Fedora_Repository"), "Error ingesting object: @e", array('@e' => check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
return;
}
}

2
plugins/ImageManipulation.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file

6
plugins/ModsFormBuilder.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file
@ -316,8 +316,8 @@ class ModsFormBuilder extends FormBuilder {
}
file_delete($form_values['ingest-file-location']);
} catch (exception $e) {
drupal_set_message(t('Error ingesting object: !e', array('!e' => $e->getMessage())), 'error');
watchdog(t("Fedora_Repository"), "Error ingesting object: !e", array('!e' => $e->getMessage()), NULL, WATCHDOG_ERROR);
drupal_set_message(t('Error ingesting object: @e', array('@e' => check_plain($e->getMessage()))), 'error');
watchdog(t("Fedora_Repository"), "Error ingesting object: @e", array('@e' => check_plain($e->getMessage())), NULL, WATCHDOG_ERROR);
return;
}
}

6
plugins/PersonalCollectionClass.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file
@ -57,7 +57,7 @@ class PersonalCollectionClass {
$params
));
} catch (exception $e) {
drupal_set_message(t('Error ingesting personal collection object: !e', array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('Error ingesting personal collection object: @e', array('@e' => check_plain($e->getMessage()))), 'error');
return FALSE;
}
return TRUE;
@ -76,7 +76,7 @@ class PersonalCollectionClass {
$xml = new SimpleXMLElement($collectionTemplate);
} catch (Exception $e) {
watchdog(t("Fedora_Repository"), t("Problem creating personal collection policy, could not parse collection policy stream."), NULL, WATCHDOG_ERROR);
drupal_set_message(t('Problem creating personal collection policy, could not parse collection policy stream: !e', array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('Problem creating personal collection policy, could not parse collection policy stream: @e', array('@e' => check_plain($e->getMessage()))), 'error');
return FALSE;
}
$policyElement = $dom->createDocumentFragment();

6
plugins/Refworks.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file
@ -290,7 +290,7 @@ class Refworks {
if ($client == NULL) {
drupal_set_message(t('Error getting SOAP client.'), 'error');
watchdog(t("FEDORA_REPOSITORY"), "Error getting SOAP client: !e", array('!e' => $e), NULL, WATCHDOG_ERROR);
watchdog(t("FEDORA_REPOSITORY"), "Error getting SOAP client: @e", array('@e' => $e), NULL, WATCHDOG_ERROR);
return;
}
$object = $client->__soapCall('ingest', array(
@ -305,7 +305,7 @@ class Refworks {
} catch (exception $e) {
$errors++;
$errorMessage = 'yes';
watchdog(t("FEDORA_REPOSITORY"), t("Error during ingest !it !e", array('!it' => $item_title, '!e' => $e)), NULL, WATCHDOG_ERROR);
watchdog(t("FEDORA_REPOSITORY"), t("Error during ingest !it @e", array('!it' => $item_title, '@e' => $e)), NULL, WATCHDOG_ERROR);
}
$success++;
}

2
plugins/ShowDemoStreamsInFieldSets.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file

6
plugins/ShowStreamsInFieldSets.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file
@ -183,7 +183,7 @@ class ShowStreamsInFieldSets {
try {
$proc = new XsltProcessor();
} catch (Exception $e) {
drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error');
return " ";
}
$xsl = new DomDocument();
@ -237,7 +237,7 @@ class ShowStreamsInFieldSets {
try {
$proc = new XsltProcessor();
} catch (Exception $e) {
drupal_set_message(t("!e", array('!e' => $e->getMessage())), 'error');
drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error');
return;
}
$xsl = new DomDocument();

2
plugins/fedora_imageapi.info

@ -3,5 +3,5 @@ description = Adds image manipulation support through a REST interface
package = Islandora Dependencies
dependencies[] = fedora_repository
dependencies[] = imageapi
version = 11.2.beta1
version = 11.3beta2
core = 6.x

2
plugins/map_viewer.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file

6
plugins/qt_viewer.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file
@ -99,7 +99,7 @@ class ShowQtStreamsInFieldSets {
}
/**
* Is download enabled. It always returns false. ???
* Is download enabled. It always returns FALSE. ???
* @return FALSE
*/
function enableDownload() {
@ -147,7 +147,7 @@ class ShowQtStreamsInFieldSets {
}
$src = base_path() . 'fedora/repository/' . $this->pid . '/' . $media->ID . '/MOV.mov';
$qtparams = '';
$qtparams .= "'autostart', '" . ($pframe !== FALSE ? 'true' : 'false') . "', ";
$qtparams .= "'autostart', '" . ($pframe !== FALSE ? 'TRUE' : 'FALSE') . "', ";
$init = <<<EOD
$(function() {
src = "$src";

2
plugins/slide_viewer.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file

2
plugins/tagging_form.inc

@ -1,6 +1,6 @@
<?php
// $Id$
/**
* @file

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

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

2
xsl/convertQDC.xsl

@ -21,7 +21,7 @@
<xsl:value-of select="substring-after(name(),':')"/> = <xsl:value-of select="text()"/>
</div>
</xsl:for-each>
</td><td><a href="{$baseUrl}/search/fedora_repository/dc.{$FIELD}:{$DATA}"><img title="Find Similar by {$FIELD}" src="{$PATH}/images/view.gif" alt="Find Similar by {$FIELD}" /></a></td></tr>
</td></tr>
</xsl:if>
</xsl:for-each>

20
xsl/sparql_to_html.xsl

@ -8,7 +8,6 @@
<xsl:value-of select="$path"/>
</xsl:variable>
<xsl:variable name="thisPid" select="$collectionPid"/>
<xsl:variable name="thisTitle" select="$collectionTitle"/>
<xsl:variable name="size" select="20"/>
<xsl:variable name="page" select="$hitPage"/>
<xsl:variable name="start" select="((number($page) - 1) * number($size)) + 1"/>
@ -34,7 +33,7 @@
of <xsl:value-of select="$count"/>&#160;<br />
<li class="pager-previous">
<a>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/<xsl:value-of select="$thisTitle"/>/<xsl:value-of select="$page - 1"/>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page - 1"/>
</xsl:attribute>
&lt;Prev
</a></li>
@ -44,7 +43,7 @@
of <xsl:value-of select="$count"/>&#160;<br />
<li class="pager-next">
<a>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/<xsl:value-of select="$thisTitle"/>/<xsl:value-of select="$page + 1"/>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page + 1"/>
</xsl:attribute>
Next>
</a></li>
@ -54,13 +53,13 @@
of <xsl:value-of select="$count"/>&#160;<br />
<li class="pager-previous">
<a>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/<xsl:value-of select="$thisTitle"/>/<xsl:value-of select="$page - 1"/>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page - 1"/>
</xsl:attribute>
&lt;Prev
</a>&#160;</li>
<li class="pager-next">
<a>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/<xsl:value-of select="$thisTitle"/>/<xsl:value-of select="$page + 1"/>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page + 1"/>
</xsl:attribute>
Next>
</a></li>
@ -106,7 +105,7 @@
of <xsl:value-of select="$count"/>&#160;<br />
<li class="pager-previous">
<a>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/<xsl:value-of select="$thisTitle"/>/<xsl:value-of select="$page - 1"/>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page - 1"/>
</xsl:attribute>
&lt;Prev
</a></li>
@ -116,7 +115,7 @@
of <xsl:value-of select="$count"/>&#160;<br />
<li class="pager-next">
<a>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/<xsl:value-of select="$thisTitle"/>/<xsl:value-of select="$page + 1"/>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page + 1"/>
</xsl:attribute>
Next>
</a></li>
@ -126,13 +125,13 @@
of <xsl:value-of select="$count"/>&#160;<br />
<li class="pager-previous">
<a>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/<xsl:value-of select="$thisTitle"/>/<xsl:value-of select="$page - 1"/>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page - 1"/>
</xsl:attribute>
&lt;Prev
</a>&#160;</li>
<li class="pager-next">
<a>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/<xsl:value-of select="$thisTitle"/>/<xsl:value-of select="$page + 1"/>
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page + 1"/>
</xsl:attribute>
Next>
</a></li>
@ -161,6 +160,7 @@
<xsl:with-param name="from" select="'_'"/>
<xsl:with-param name="to" select="' '"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="cleanTitle">
<xsl:value-of select="php:functionString('fedora_repository_urlencode_string', $newTitle)"/>
@ -168,7 +168,7 @@
<xsl:variable name="linkUrl">
<xsl:choose>
<xsl:when test="($CONTENTMODEL='islandora:collectionCModel')">
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/-/<xsl:value-of select="$cleanTitle"/>
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/-/<xsl:value-of select="'collection'"/>
</xsl:when>
<xsl:otherwise>
<!--the below is an example of going straight to a datastream instead of the details page.

Loading…
Cancel
Save