From 32efbf8ae4b09a3c43f85c7c03be85db02a7a822 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Thu, 10 Nov 2011 15:47:20 -0400 Subject: [PATCH 1/2] Externalized tabbing --- fedora_repository.module | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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, ); } From e44be2a48c4ae483ed2a951baaada01f1a0a07ae Mon Sep 17 00:00:00 2001 From: ajstanley Date: Mon, 14 Nov 2011 14:37:27 -0400 Subject: [PATCH 2/2] Replaced fedora calls with regex to improve performance. --- api/fedora_utils.inc | 58 ++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/api/fedora_utils.inc b/api/fedora_utils.inc index 9399356d..89545191 100644 --- a/api/fedora_utils.inc +++ b/api/fedora_utils.inc @@ -266,41 +266,41 @@ function get_collections_as_option_array() { * @return array */ function get_content_models_as_option_array() { - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); - $restricted = variable_get('fedora_namespace_restriction_enforced', TRUE); - $allowed_string = variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora:'); - $namespaces = explode(':', $allowed_string); - foreach ($namespaces as $namespace) { - if ($namespace) { - $allowed[] = trim($namespace); + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); + $restricted = variable_get('fedora_namespace_restriction_enforced', TRUE); + $allowed_string = variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora:'); + $namespaces = explode(':', $allowed_string); + foreach ($namespaces as $namespace) { + if ($namespace) { + $allowed[] = trim($namespace); + } } - } - $query = 'select $object $title from <#ri> + $query = 'select $object $title from <#ri> where ($object $title and ($object or $object ) and $object ) order by $title'; - $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); - $url .= "?type=tuples&flush=TRUE&format=csv&limit=1000&lang=itql&stream=on&query="; - $content = do_curl($url . htmlentities(urlencode($query))); - $list = explode("\n", $content); - array_shift($list); - $list = preg_replace('/info:fedora\//', '', $list); - foreach ($list as $item) { //removes blanks - if ($item) { - $parts = explode(',', $item); - $item = new fedora_item($parts[0]); - $nameparts = explode(':', $parts[0]); - if (!$restricted || in_array($nameparts[0], $allowed)) - $datastreams = array_keys($item->get_datastreams_list_as_array()); - if (in_array('ISLANDORACM', $datastreams)) { - $options[$parts[0]] = $parts[1] . ' ~ ' . $parts[0]; - } + $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); + $url .= "?type=tuples&flush=TRUE&format=csv&limit=1000&lang=itql&stream=on&query="; + $content = do_curl($url . htmlentities(urlencode($query))); + $list = explode("\n", $content); + array_shift($list); + $list = preg_replace('/info:fedora\//', '', $list); + foreach ($list as $item) { //removes blanks + if ($item) { + $parts = explode(',', $item); + $nameparts = explode(':', $parts[0]); + if (!$restricted || in_array($nameparts[0], $allowed)) { + + if (!preg_match('/fedora-system/', $nameparts[0])) { + $options[$parts[0]] = $parts[1] . ' ~ ' . $parts[0]; + } + } + } } - } - return $options; -} + return $options; +} \ No newline at end of file