Browse Source

Added validity check for Collection Policy class

pull/63/head
Alan Stanley 14 years ago
parent
commit
9ca282d521
  1. 9
      CollectionClass.inc
  2. 13
      fedora_repository.module

9
CollectionClass.inc

@ -519,14 +519,16 @@ class CollectionClass {
$show_batch_tab = FALSE; $show_batch_tab = FALSE;
$policy = CollectionPolicy::loadFromCollection($this->pid, TRUE); $policy = CollectionPolicy::loadFromCollection($this->pid, TRUE);
$content_models = $policy->getContentModels(); if ($policy) {
$content_models = $policy->getContentModels();
}
if (count($content_models) == 1 && $content_models[0]->pid == "islandora:collectionCModel") { if (count($content_models) == 1 && $content_models[0]->pid == "islandora:collectionCModel") {
$show_batch_tab = FALSE; $show_batch_tab = FALSE;
} }
if (!$show_ingest_tab) { if (!$show_ingest_tab) {
$view_selected = TRUE; $view_selected = TRUE;
} }
if(!$collection_items){ if (!$collection_items) {
$view_selected = FALSE; $view_selected = FALSE;
$add_selected = TRUE; $add_selected = TRUE;
} }
@ -538,7 +540,6 @@ class CollectionClass {
'#title' => 'View', '#title' => 'View',
'#selected' => $view_selected, '#selected' => $view_selected,
'#content' => $collection_items, '#content' => $collection_items,
); );
$tabset['add_tab'] = array( $tabset['add_tab'] = array(
'#type' => 'tabpage', '#type' => 'tabpage',
@ -614,7 +615,7 @@ class CollectionClass {
$collectionName = $collection; $collectionName = $collection;
if (!$pageNumber) { if (!$pageNumber) {
$pageNumber = 1; $pageNumber = 1;
} }

13
fedora_repository.module

@ -142,6 +142,10 @@ function fedora_repository_ingest_object($collection_pid=NULL, $collection_label
*/ */
function fedora_repository_ingest_form_submit(array $form, array &$form_state) { 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 //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 ($form_state['storage']['xml']) {
if (module_exists('islandora_content_model_forms')) { if (module_exists('islandora_content_model_forms')) {
module_load_include('inc', 'islandora_content_model_forms', 'IngestObjectMetadataForm'); module_load_include('inc', 'islandora_content_model_forms', 'IngestObjectMetadataForm');
@ -197,7 +201,11 @@ function fedora_repository_ingest_form_submit(array $form, array &$form_state) {
*/ */
function fedora_repository_ingest_form_validate($form, &$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 //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']) { switch ($form_state['storage']['step']) {
case 1: case 1:
$form_state['storage']['step']++; $form_state['storage']['step']++;
@ -828,9 +836,6 @@ function fedora_repository_perm() {
OBJECTHELPER::$INGEST_FEDORA_OBJECTS, OBJECTHELPER::$INGEST_FEDORA_OBJECTS,
OBJECTHELPER::$EDIT_TAGS_DATASTREAM, OBJECTHELPER::$EDIT_TAGS_DATASTREAM,
OBJECTHELPER::$VIEW_DETAILED_CONTENT_LIST, OBJECTHELPER::$VIEW_DETAILED_CONTENT_LIST,
OBJECTHELPER::$MANAGE_COLLECTIONS,
OBJECTHELPER::$DELETE_ENTIRE_COLLECTIONS,
OBJECTHELPER::$CREATE_BATCH_PROCESS,
); );
} }

Loading…
Cancel
Save