From 9ca282d521e9c81af31e0dcced75c96b8f5ea4f0 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Tue, 22 Nov 2011 12:01:49 -0400 Subject: [PATCH] Added validity check for Collection Policy class --- CollectionClass.inc | 9 +++++---- fedora_repository.module | 13 +++++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CollectionClass.inc b/CollectionClass.inc index 2af37522..bee0c495 100644 --- a/CollectionClass.inc +++ b/CollectionClass.inc @@ -519,14 +519,16 @@ class CollectionClass { $show_batch_tab = FALSE; $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") { $show_batch_tab = FALSE; } if (!$show_ingest_tab) { $view_selected = TRUE; } - if(!$collection_items){ + if (!$collection_items) { $view_selected = FALSE; $add_selected = TRUE; } @@ -538,7 +540,6 @@ class CollectionClass { '#title' => 'View', '#selected' => $view_selected, '#content' => $collection_items, - ); $tabset['add_tab'] = array( '#type' => 'tabpage', @@ -614,7 +615,7 @@ class CollectionClass { $collectionName = $collection; - + if (!$pageNumber) { $pageNumber = 1; } diff --git a/fedora_repository.module b/fedora_repository.module index 27060dda..600e3bcb 100644 --- a/fedora_repository.module +++ b/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) { //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'); @@ -197,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']++; @@ -828,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, ); }