Browse Source

ISLANDORA-743 added the hook: postprocess_solution_pack and some style

clean
up
pull/163/head
William Panting 12 years ago
parent
commit
0f34fcde21
  1. 64
      fedora_repository.solutionpacks.inc

64
fedora_repository.solutionpacks.inc

@ -2,24 +2,36 @@
/** /**
* @file * @file
* Invokes a hook to any dependent modules asking them if their installations require * Invokes a hook to any dependent modules asking them if their
* any fedora objects to be present. Modules implementing this hook should return an array * installations require any fedora objects to be present.
* Modules implementing this hook should return an array
* of arrays of the form: * 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 * where the last three options are optional.
* foxml file to install, or can specify a datastreamstream to check for, with a * A module can either point to a simple foxml file to install,
* path to load the datastream from if it isn't there. Optionally a version number * or can specify a datastreamstream to check for, with a
* can be included, to enable updating of content model or collection policy streams * path to load the datastream from if it isn't there.
* that may have been updated. THis is a simple whole number that should be incremented * Optionally a version number can be included,
* when changed. This value appears in as an attribute of the topmost element of the stream, * 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.,: * 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. * 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() { function fedora_repository_solution_packs_page() {
$enabled_solution_packs = module_invoke_all('required_fedora_objects'); $enabled_solution_packs = module_invoke_all('required_fedora_objects');
$output = ''; $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 * @param array $solution_pack
*/ */
function fedora_repository_solution_pack_form(&$form_state, $solution_pack_module, $solution_pack_name, $objects = array()) { function fedora_repository_solution_pack_form(&$form_state, $solution_pack_module, $solution_pack_name, $objects = array()) {
@ -161,12 +175,18 @@ function fedora_repository_solution_pack_form(&$form_state, $solution_pack_modul
return $form; 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) { function fedora_repository_solution_pack_form_submit($form, &$form_state) {
$what = $form_state;
$module_name = $form_state['values']['solution_pack_module']; $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'); $solution_pack_info = module_invoke($module_name, 'required_fedora_objects');
$batch = array( $batch = array(
@ -180,9 +200,20 @@ function fedora_repository_solution_pack_form_submit($form, &$form_state) {
// Add this object to the batch job queue. // Add this object to the batch job queue.
$batch['operations'][] = array('fedora_repository_batch_reingest_object', array($object)); $batch['operations'][] = array('fedora_repository_batch_reingest_object', array($object));
} }
batch_set($batch); 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) { function solution_pack_add_form($form_name, $form_xml) {
$result = db_result(db_query('Select name from {xml_forms} where name = "%s"', $form_name)); $result = db_result(db_query('Select name from {xml_forms} where name = "%s"', $form_name));
if (!$result) { 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) { 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"', $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)); $content_model, $form_name));

Loading…
Cancel
Save