Browse Source

Merge pull request #163 from willtp87/ISLANDORA-743

Islandora 743
pull/167/merge
Jonathan Green 12 years ago
parent
commit
25645330c1
  1. 6
      api/fedora_item.inc
  2. 64
      fedora_repository.solutionpacks.inc

6
api/fedora_item.inc

@ -274,10 +274,12 @@ class Fedora_Item {
function add_relationship($relationship, $object, $namespaceURI = RELS_EXT_URI, $literal_value = RELS_TYPE_URI) {
static $relsextxml = NULL;
if ($relsextxml === NULL) {
$relsextxml = new DOMDocument(); //Avoid new instantiations in long-running processes
// Avoid new instantiations in long-running processes.
$relsextxml = new DOMDocument();
}
$ds_list = $this->datastreams;
$f_prefix = 'info:fedora/';
if (!array_key_exists('RELS-EXT', $ds_list)) {
$rdf_string = <<<RDF
@ -978,6 +980,8 @@ RDF;
'force' => $force
);
$this->forget();
// Delete the object
return $this->soap_call('purgeObject', $params);
}

64
fedora_repository.solutionpacks.inc

@ -2,24 +2,36 @@
/**
* @file
* Invokes a hook to any dependent modules asking them if their installations require
* any fedora objects to be present. Modules implementing this hook should return an array
* Invokes a hook to any dependent modules asking them if their
* installations require any fedora objects to be present.
* Modules implementing this hook should return an array
* of arrays of the form:
*
* array( 'pid', 'path-to-foxml-file', 'dsid', 'path-to-datastream-file', int dsversion)
* array( 'pid', 'path-to-foxml-file',
* 'dsid',
* 'path-to-datastream-file',
* int dsversion)
*
* where the last three options are optional. A module can either point to a simple
* foxml file to install, or can specify a datastreamstream to check for, with a
* path to load the datastream from if it isn't there. Optionally a version number
* can be included, to enable updating of content model or collection policy streams
* that may have been updated. THis is a simple whole number that should be incremented
* when changed. This value appears in as an attribute of the topmost element of the stream,
* where the last three options are optional.
* A module can either point to a simple foxml file to install,
* or can specify a datastreamstream to check for, with a
* path to load the datastream from if it isn't there.
* Optionally a version number can be included,
* to enable updating of content model or collection policy streams
* that may have been updated.
* This is a simple whole number that should be incremented when changed.
* This value appears in as an attribute of the topmost element of the stream,
* e.g.,:
*
* <?xml version="1.0" encoding="utf-8"?> <content_model name="Collection" version="2" ...
* <?xml version="1.0" encoding="utf-8"?>
* <content_model name="Collection" version="2" ...
*
* Datastreams which don't have this element are assumed to be at version 0.
*/
/**
* Builds the tab for the solution packs.
*/
function fedora_repository_solution_packs_page() {
$enabled_solution_packs = module_invoke_all('required_fedora_objects');
$output = '';
@ -42,7 +54,9 @@ function fedora_repository_solution_packs_page() {
}
/**
* Check for installed objects and add a 'Update' or 'Install' button if some objects are missing.
* Check for installed objects and add a 'Update' or 'Install' button if
* some objects are missing.
*
* @param array $solution_pack
*/
function fedora_repository_solution_pack_form(&$form_state, $solution_pack_module, $solution_pack_name, $objects = array()) {
@ -161,12 +175,18 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul
return $form;
}
/**
* Submit handler for solution pack form.
*
* @param array $form
* The form submitted.
* @param array_reference $form_state
* The state of the form submited.
*/
function fedora_repository_solution_pack_form_submit($form, &$form_state) {
$what = $form_state;
$module_name = $form_state['values']['solution_pack_module'];
// This should be replaced with module_invoke
//$solution_pack_info = call_user_func($module_name . '_required_fedora_objects');
$solution_pack_info = module_invoke($module_name, 'required_fedora_objects');
$batch = array(
@ -180,9 +200,20 @@ function fedora_repository_solution_pack_form_submit($form, &$form_state) {
// Add this object to the batch job queue.
$batch['operations'][] = array('fedora_repository_batch_reingest_object', array($object));
}
batch_set($batch);
// Hook to let solution pack objects be modified.
// Not using module_invoke so solution packs can be expanded by other modules.
module_invoke_all('postprocess_solution_pack', $module_name);
}
/**
*
* @param unknown_type $form_name
* @param unknown_type $form_xml
*/
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) {
@ -194,6 +225,11 @@ function solution_pack_add_form($form_name, $form_xml) {
}
}
/**
*
* @param unknown_type $content_model
* @param unknown_type $form_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));

Loading…
Cancel
Save