Browse Source

Cleanup in collection manager and addition of hook to add in new collection management functions

pull/120/head
rwincewicz 13 years ago
parent
commit
822e945ff7
  1. 2
      islandora_basic_collection/includes/ChangeContentModels.inc
  2. 2
      islandora_basic_collection/includes/ChildCollection.inc
  3. 18
      islandora_basic_collection/includes/CollectionManagement.inc
  4. 8
      islandora_basic_collection/includes/ManagePolicies.inc
  5. 2
      islandora_basic_collection/includes/MoveCollection.inc
  6. 19
      islandora_basic_collection/islandora_basic_collection.module

2
islandora_basic_collection/includes/ChangeContentModels.inc

@ -46,7 +46,7 @@ function islandora_change_content_models_form($form, &$form_state, $collection_p
$form['change_cmodel']['titlebox'] = array(
'#type' => 'item',
'#title' => t("Change Content Models within @collection_pid", array('@collection_pid' => $collection_pid)),
'#title' => t("Change content models within @collection_pid", array('@collection_pid' => $collection_pid)),
);
$form['change_cmodel']['current_content_model'] = array(

2
islandora_basic_collection/includes/ChildCollection.inc

@ -34,7 +34,7 @@ function islandora_create_child_collection_form($form, &$form_state, $this_colle
$form['child_creation']['titlebox'] = array(
'#type' => 'item',
'#title' => t("Create New Child Collection within @collection", array('@collection' => $this_collection_pid)),
'#title' => t("Create new child collection within @collection", array('@collection' => $this_collection_pid)),
);
$form['child_creation']['collection_name'] = array(

18
islandora_basic_collection/includes/CollectionManagement.inc

@ -72,7 +72,7 @@ EOD;
return $collection_pids;
}
function Islandora_collections_get_collection_from_pid($pid) {
function islandora_collections_get_collection_from_pid($pid) {
module_load_include('inc', 'islandora', 'RestConnection');
$rest_connection = new RestConnection();
require_once 'sites/all/libraries/tuque/RepositoryQuery.php';
@ -220,7 +220,7 @@ function get_content_models_as_option_array() {
return $options;
}
function getContentModels($collection_pid, $showError = TRUE) {
function get_content_models($collection_pid, $show_error = TRUE) {
module_load_include('inc', 'islandora', 'RestConnection');
$rest_connection = new RestConnection();
$collection_stream = $this->getCollectionPolicyStream($collection_pid);
@ -229,18 +229,18 @@ function get_content_models_as_option_array() {
try {
$xml = new SimpleXMLElement($collection_stream);
} catch (Exception $e) {
if ($showError) {
if ($show_error) {
drupal_set_message(t('@e', array('@e' => check_plain($e->getMessage()))), 'error');
}
return NULL;
}
foreach ($xml->contentmodels->contentmodel as $content_model) {
$contentModel = new ContentModel();
$contentModel->contentModelDsid = $content_model->dsid;
$contentModel->contentModelPid = $content_model->pid;
$contentModel->pidNamespace = $content_model->pidNamespace;
$contentModel->contentModelName = $content_model['name'];
$models[] = $contentModel;
$content_model_object = new ContentModel();
$content_model_object->contentModelDsid = $content_model->dsid;
$content_model_object->contentModelPid = $content_model->pid;
$content_model_object->pidNamespace = $content_model->pidNamespace;
$content_model_object->contentModelName = $content_model['name'];
$models[] = $content_model_object;
}
return $models;
}

8
islandora_basic_collection/includes/ManagePolicies.inc

@ -63,14 +63,14 @@ function islandora_manage_policies_form($form, &$form_state, $collection_pid) {
);
$form ['manage_collection_policy']['add']['content_model_to_add'] = array(
'#title' => "Choose Content Model",
'#title' => "Choose content model",
'#type' => 'select',
'#options' => $new_options,
'#description' => t("Choose content model to add to this collection policy."),
);
$form ['manage_collection_policy']['add']['new_cp_namespace'] = array(
'#title' => "Choose Namespace",
'#title' => "Choose namespace",
'#type' => 'textfield',
'#size' => 15,
'#default_value' => $namespace,
@ -95,14 +95,14 @@ function islandora_manage_policies_form($form, &$form_state, $collection_pid) {
if (count($current_models_in_policy) > 0) {
$form['manage_collection_policy']['remove'] = array(
'#title' => "Delete Content Model from Collection Policy",
'#title' => "Delete content model from collection policy",
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form ['manage_collection_policy']['remove']['content_models_to_remove'] = array(
'#title' => "Choose Content Model to Remove",
'#title' => "Choose content model to remove",
'#type' => 'checkboxes',
'#options' => $current_models_in_policy,
'#description' => t("Choose content models to remove from this collection policy."),

2
islandora_basic_collection/includes/MoveCollection.inc

@ -31,7 +31,7 @@ function islandora_collection_migrate_form($form, &$form_state, $pid) {
);
$form['migrate']['new_collection'] = array(
'#title' => t('New Collection'),
'#title' => t('New collection'),
'#description' => t("All content will be migrated from @pid to the selected collection", array('@pid' => $pid)),
'#type' => 'select',
'#options' => $potential_collections,

19
islandora_basic_collection/islandora_basic_collection.module

@ -30,7 +30,7 @@
function islandora_basic_collection_menu() {
$items = array();
$items['islandora/object/%/manage/collection'] = array(
'title' => 'Collection Related',
'title' => 'Collection related',
'page callback' => 'islandora_basic_collection_manage_object',
'page arguments' => array(2),
'type' => MENU_LOCAL_TASK,
@ -39,7 +39,7 @@ function islandora_basic_collection_menu() {
);
$items['admin/islandora/basic_collection'] = array(
'title' => 'Islandora Basic Collection',
'title' => 'Islandora basic collection',
'description' => 'Configure the basic Collection solution pack.',
'page callback' => 'drupal_get_form',
'access arguments' => array('administer site configuration'),
@ -105,7 +105,7 @@ function islandora_basic_collection_manage_object($object_id) {
);
$form['collection_manager']['create_child_collection'] = array(
'#title' => t('Create Child Collection'),
'#title' => t('Create child collection'),
'#type' => 'fieldset',
);
@ -113,7 +113,7 @@ function islandora_basic_collection_manage_object($object_id) {
$form['collection_manager']['manage_policies'] = array(
'#type' => 'fieldset',
'#title' => t('Manage Collection Policies'),
'#title' => t('Manage collection policies'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
@ -122,7 +122,7 @@ function islandora_basic_collection_manage_object($object_id) {
$form['collection_manager']['change_content_models'] = array(
'#type' => 'fieldset',
'#title' => t('Change Content Models'),
'#title' => t('Change content models'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
@ -131,7 +131,7 @@ function islandora_basic_collection_manage_object($object_id) {
$form['collection_manager']['migrate_members'] = array(
'#type' => 'fieldset',
'#title' => t('Migrate Members'),
'#title' => t('Migrate members'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
@ -140,16 +140,17 @@ function islandora_basic_collection_manage_object($object_id) {
$form['collection_manager']['delete_members'] = array(
'#type' => 'fieldset',
'#title' => t('Delete Members of this Collection'),
'#title' => t('Delete members of this collection'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['collection_manager']['delete_members']['form'] = drupal_get_form('islandora_collection_deletion_form', $object_id);
// Pass the form around any modules that are interested so that they can add their own collection management functions.
module_invoke_all('islandora_collection_manager', $form);
return $form;
// return 'Collection CModel edit function ' . $object_id;
}
/**

Loading…
Cancel
Save