diff --git a/BatchIngest.inc b/BatchIngest.inc
deleted file mode 100644
index 31daa608..00000000
--- a/BatchIngest.inc
+++ /dev/null
@@ -1,273 +0,0 @@
-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.
- Related files must have the same filename, but with differing extensions to indicate mimetypes.
- ie. myFile.xml and myFile.jpg'),
- );
-
- $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 $label
- * @param $content_model
- * @param $object_files
- * @param $collection_pid
- * @param $namespace
- * @param $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 $mods_xml
- * @return
- */
-
-
-
-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 $dir
- * @return
- */
-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);
-}
\ No newline at end of file
diff --git a/CollectionClass.inc b/CollectionClass.inc
index 4251eea4..6c5fd8f5 100644
--- a/CollectionClass.inc
+++ b/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 '';
}
}
diff --git a/CollectionManagement.inc b/CollectionManagement.inc
deleted file mode 100644
index 83bb9952..00000000
--- a/CollectionManagement.inc
+++ /dev/null
@@ -1,401 +0,0 @@
-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.
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.
This action cannot be undone."),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- );
- $form['delete_collection']['confirm'] = array(
- '#title' => "Are you sure?",
- '#type' => 'fieldset',
- '#description' => t('Clicking the delete button will permanantly remove all objects from this collection.
This action cannot be undone. '),
- '#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 = '
-
-
-
-
-
-
- isMemberOfCollection
-';
- $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
- and \$object
- and \$object )";
- $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 $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");
- }
- }
-}
\ No newline at end of file
diff --git a/CollectionPolicy.inc b/CollectionPolicy.inc
index b801eaff..5a3daf21 100644
--- a/CollectionPolicy.inc
+++ b/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
diff --git a/ConnectionHelper.inc b/ConnectionHelper.inc
index 8225f0fc..59f811e2 100644
--- a/ConnectionHelper.inc
+++ b/ConnectionHelper.inc
@@ -1,6 +1,6 @@
$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;
}
}
diff --git a/ContentModel.inc b/ContentModel.inc
index b1f28074..cbacd422 100644
--- a/ContentModel.inc
+++ b/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');
diff --git a/MimeClass.inc b/MimeClass.inc
index 119a8f97..42c11e37 100644
--- a/MimeClass.inc
+++ b/MimeClass.inc
@@ -1,6 +1,6 @@
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 ';
$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,18 +936,22 @@ class ObjectHelper {
or $parentObject)
and $parentObject )
minus $content
- order by $title';
+ order by $title desc';
$query_string = htmlentities(urlencode($query_string));
$url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch');
$url .= "?type=tuples&flush=TRUE&format=CSV&limit=1&offset=0&lang=itql&stream=on&query=" . $query_string;
-
+
$result = preg_split('/[\r\n]+/', do_curl($url));
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);
+ }
}
}
diff --git a/SearchClass.inc b/SearchClass.inc
index 3f1c78d5..751dbbfa 100644
--- a/SearchClass.inc
+++ b/SearchClass.inc
@@ -1,6 +1,6 @@
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;
}
diff --git a/XMLDatastream.inc b/XMLDatastream.inc
index d3afed09..ab8044f4 100644
--- a/XMLDatastream.inc
+++ b/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
*/
diff --git a/api/dublin_core.inc b/api/dublin_core.inc
index cb920c2a..ae8a3687 100644
--- a/api/dublin_core.inc
+++ b/api/dublin_core.inc
@@ -1,6 +1,6 @@
/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');
diff --git a/api/fedora_export.inc b/api/fedora_export.inc
index e1ed3cbd..f3c82160 100644
--- a/api/fedora_export.inc
+++ b/api/fedora_export.inc
@@ -1,6 +1,6 @@
('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)));
}
`}
*/
diff --git a/api/fedora_item.inc b/api/fedora_item.inc
index 4dacca8c..a79749a7 100644
--- a/api/fedora_item.inc
+++ b/api/fedora_item.inc
@@ -43,7 +43,7 @@ class Fedora_Item {
}
$raw_objprofile = $this->soap_call('getObjectProfile', array('pid' => $this->pid, 'asOfDateTime' => ""));
-
+
if (!empty($raw_objprofile)) {
$this->objectProfile = $raw_objprofile->objectProfile;
$this->datastreams = $this->get_datastreams_list_as_array();
@@ -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;
}
diff --git a/api/fedora_utils.inc b/api/fedora_utils.inc
index c8ce7d0e..89545191 100644
--- a/api/fedora_utils.inc
+++ b/api/fedora_utils.inc
@@ -1,12 +1,11 @@
uid == 0) {
$fedora_user = 'anonymous';
@@ -126,14 +124,13 @@ function do_curl_ext($url, $return_to_variable = 1, $number_of_post_vars = 0, $p
curl_setopt($ch, CURLOPT_POST, $number_of_post_vars);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$post");
}
-
+
$ret_val = curl_exec($ch);
-
+
$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 $title
and $object
and $object )
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 $title
and ($object
or $object )
and $object )
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;
+}
\ No newline at end of file
diff --git a/api/rels-ext.inc b/api/rels-ext.inc
index 4714b4ed..d89f9abd 100644
--- a/api/rels-ext.inc
+++ b/api/rels-ext.inc
@@ -1,6 +1,6 @@
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;
diff --git a/fedora_repository.info b/fedora_repository.info
index 20ff4d30..944568fe 100644
--- a/fedora_repository.info
+++ b/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
diff --git a/fedora_repository.install b/fedora_repository.install
index 43bbcf70..164ce02e 100644
--- a/fedora_repository.install
+++ b/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 ImageMagick 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 Kakadu 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;
diff --git a/fedora_repository.module b/fedora_repository.module
index ea1c15c5..600e3bcb 100644
--- a/fedora_repository.module
+++ b/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!
This cannot be undone
',
- array(
+ $output = t('Are you sure you wish to purge object %name %pid!
This cannot be undone
', 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
',
- array(
+ $output = t('Are you sure you wish to purge this datastream %name
', 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,
);
}
@@ -909,12 +912,12 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
drupal_set_message(t('The Fedora repository server is currently unavailable. Please contact the site administrator.'), 'warning', FALSE);
return '';
}
-
+
if (!risearch_available()) {
drupal_set_message(t('The Fedora resource index search is currently unavailable. Please contact the site administrator.'), 'warning', FALSE);
return '';
}
-
+
if ($pid == NULL) {
$pid = variable_get('fedora_repository_pid', 'islandora:root');
}
@@ -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 Djatoka and Kakadu.)',
+'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 Djatoka and Kakadu.)',
)
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 islandora:ContentModelCollection."), 'message');
+ drupal_set_message(t("Successfully installed islandora:ContentModelCollection.", 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 islandora:root."), 'message');
+ drupal_set_message(t("Successfully installed islandora:root.", 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 islandora:demos."), 'message');
+ drupal_set_message(t("Successfully installed islandora:demos.", 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 demo:SmileyStuff collection view."), 'message');
+ drupal_set_message(t("Successfully installed demo:SmileyStuff 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 islandora:largeimages."), 'message');
+ drupal_set_message(t("Successfully installed islandora:largeimages.", 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',
@@ -1701,7 +1703,7 @@ function fedora_repository_required_fedora_objects() {
'mimetype' => 'image/png',
),
),
- ),
+ ),
),
),
);
@@ -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)
);
}
diff --git a/fedora_repository.solutionpacks.inc b/fedora_repository.solutionpacks.inc
index de4ce137..fb09528d 100644
--- a/fedora_repository.solutionpacks.inc
+++ b/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");
+ }
+}
+
diff --git a/formClass.inc b/formClass.inc
index 762f1252..be5ef9d2 100644
--- a/formClass.inc
+++ b/formClass.inc
@@ -1,6 +1,6 @@
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);
diff --git a/installer_files/foxml/islandora-top.xml b/installer_files/foxml/islandora-root.xml
similarity index 97%
rename from installer_files/foxml/islandora-top.xml
rename to installer_files/foxml/islandora-root.xml
index 5d8c69b3..8c7fa1ac 100644
--- a/installer_files/foxml/islandora-top.xml
+++ b/installer_files/foxml/islandora-root.xml
@@ -1,5 +1,5 @@
-
@@ -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">
Islandora Top-Level Collection
- islandora:top
+ islandora:root
@@ -107,7 +107,7 @@
ID="RELS-EXT.0" LABEL="RDF Statements about this object" MIMETYPE="application/rdf+xml" SIZE="314">
-
+
@@ -144,7 +144,7 @@
-
+
diff --git a/plugins/CollectionFormBuilder.inc b/plugins/CollectionFormBuilder.inc
index a385aa26..93e11479 100644
--- a/plugins/CollectionFormBuilder.inc
+++ b/plugins/CollectionFormBuilder.inc
@@ -1,6 +1,6 @@
$e->getMessage())), 'error');
+ drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error');
return " ";
}
diff --git a/plugins/DemoFormBuilder.inc b/plugins/DemoFormBuilder.inc
index ccc74ba2..05a9304f 100644
--- a/plugins/DemoFormBuilder.inc
+++ b/plugins/DemoFormBuilder.inc
@@ -1,6 +1,6 @@
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',
diff --git a/plugins/Ffmpeg.inc b/plugins/Ffmpeg.inc
index 81072ee3..46b4ae80 100644
--- a/plugins/Ffmpeg.inc
+++ b/plugins/Ffmpeg.inc
@@ -1,6 +1,6 @@
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;
}
}
diff --git a/plugins/FlvFormBuilder.inc b/plugins/FlvFormBuilder.inc
index c259328c..8c2b5777 100644
--- a/plugins/FlvFormBuilder.inc
+++ b/plugins/FlvFormBuilder.inc
@@ -1,6 +1,6 @@
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;
}
}
diff --git a/plugins/ImageManipulation.inc b/plugins/ImageManipulation.inc
index 8f97ab94..4faabdd8 100644
--- a/plugins/ImageManipulation.inc
+++ b/plugins/ImageManipulation.inc
@@ -1,6 +1,6 @@
$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;
}
}
diff --git a/plugins/PersonalCollectionClass.inc b/plugins/PersonalCollectionClass.inc
index 68ae5528..29c76cfa 100644
--- a/plugins/PersonalCollectionClass.inc
+++ b/plugins/PersonalCollectionClass.inc
@@ -1,6 +1,6 @@
$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();
diff --git a/plugins/Refworks.inc b/plugins/Refworks.inc
index 592a7e99..5e39b3c2 100644
--- a/plugins/Refworks.inc
+++ b/plugins/Refworks.inc
@@ -1,6 +1,6 @@
$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++;
}
diff --git a/plugins/ShowDemoStreamsInFieldSets.inc b/plugins/ShowDemoStreamsInFieldSets.inc
index b648df53..80f8017c 100644
--- a/plugins/ShowDemoStreamsInFieldSets.inc
+++ b/plugins/ShowDemoStreamsInFieldSets.inc
@@ -1,6 +1,6 @@
$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();
diff --git a/plugins/fedora_imageapi.info b/plugins/fedora_imageapi.info
index e54e3f05..d17d73a8 100644
--- a/plugins/fedora_imageapi.info
+++ b/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
diff --git a/plugins/map_viewer.inc b/plugins/map_viewer.inc
index 3e9bcfb6..f3bfca80 100644
--- a/plugins/map_viewer.inc
+++ b/plugins/map_viewer.inc
@@ -1,6 +1,6 @@
pid . '/' . $media->ID . '/MOV.mov';
$qtparams = '';
- $qtparams .= "'autostart', '" . ($pframe !== FALSE ? 'true' : 'false') . "', ";
+ $qtparams .= "'autostart', '" . ($pframe !== FALSE ? 'TRUE' : 'FALSE') . "', ";
$init = << Site Configuration -> Fedora Colleciton List and click the Install
Demos tab and follow the instructions.)
diff --git a/tests/fedora_repository.test b/tests/fedora_repository.test
index 91d91b61..bbad2569 100644
--- a/tests/fedora_repository.test
+++ b/tests/fedora_repository.test
@@ -45,11 +45,11 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase {
$pid_list = array();
// Create a collection for ingesting PDF content model objects.
- //$this->drupalGet('fedora/ingestObject/islandora:top/Islandora%20Top-Level%20Collection');
+ //$this->drupalGet('fedora/ingestObject/islandora:root/Islandora%20Top-Level%20Collection');
$ingest_form = array();
$ingest_form['models'] = 'islandora:collectionCModel/ISLANDORACM';
- $this->drupalPost('fedora/ingestObject/islandora:top/Islandora%20Top-Level%20Collection', $ingest_form, 'Next');
+ $this->drupalPost('fedora/ingestObject/islandora:root/Islandora%20Top-Level%20Collection', $ingest_form, 'Next');
// Add a sample PDF object via the web ingest form.
// Required fields are file location, dc:title and dc:description
@@ -67,7 +67,7 @@ class FedoraRepositoryTestCase extends DrupalWebTestCase {
$ingest_form = array();
$ingest_form['models'] = 'islandora:collectionCModel/ISLANDORACM';
- $this->drupalPost('fedora/ingestObject/islandora:top/Islandora%20Top-Level%20Collection', $ingest_form, 'Next');
+ $this->drupalPost('fedora/ingestObject/islandora:root/Islandora%20Top-Level%20Collection', $ingest_form, 'Next');
// Required fields are file location, dc:title and dc:description
$ingest_form_step_2 = array();
$ingest_form_step_2['dc:title'] = $this->randomName(32);
diff --git a/xsl/convertQDC.xsl b/xsl/convertQDC.xsl
index e7e0d627..c2bb50f0 100644
--- a/xsl/convertQDC.xsl
+++ b/xsl/convertQDC.xsl
@@ -21,7 +21,7 @@
=
- |
+
diff --git a/xsl/sparql_to_html.xsl b/xsl/sparql_to_html.xsl
index 0c037f3e..1b042273 100644
--- a/xsl/sparql_to_html.xsl
+++ b/xsl/sparql_to_html.xsl
@@ -8,7 +8,6 @@
-
@@ -34,7 +33,7 @@
of
@@ -44,7 +43,7 @@
of
@@ -54,13 +53,13 @@
of
@@ -106,7 +105,7 @@
of
@@ -116,7 +115,7 @@
of
@@ -126,13 +125,13 @@
of
@@ -161,6 +160,7 @@
+
@@ -168,7 +168,7 @@
- /fedora/repository//-/
+ /fedora/repository//-/