diff --git a/.CollectionClass.inc.swp b/.CollectionClass.inc.swp index 4672c0ca..123bc8be 100644 Binary files a/.CollectionClass.inc.swp and b/.CollectionClass.inc.swp differ diff --git a/CollectionClass.inc b/CollectionClass.inc index 964cd457..f9d906e8 100644 --- a/CollectionClass.inc +++ b/CollectionClass.inc @@ -715,6 +715,7 @@ function collection_creation_form(&$form_state, $parent_collection_pid) { '#title' => "Choose allowable content models for this collection", '#type' => 'checkboxes', '#options' => $content_models, + '#required' => true, '#description' => t("Content models describe the behaviours of objects with which they are associated."), ); @@ -736,12 +737,17 @@ function collection_creation_form(&$form_state, $parent_collection_pid) { */ function collection_creation_form_validate($form, &$form_state) { module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); $pid = $form_state['values']['collection_pid']; $item = new fedora_item($pid); if ($item->exists()) { - drupal_set_message("$pid already exists within your repository. the PID must be unique", 'warning'); + form_set_error('', t("$pid already exists within your repository. the PID must be unique")); return; } + if (!valid_pid($pid)){ + form_set_error('', t("$pid is not a valid identifier")); + return; + } } /** @@ -759,6 +765,7 @@ function collection_creation_form_submit($form, &$form_state) { $collection_pid = $form_state['values']['collection_pid']; $new_collection_label = $form_state['values']['collection_name']; $parent_collection = $form_state['values']['parent_collection']; + $pid_namespace = $form_state['values']['collection_namespace']; $all_cModels = get_content_models_as_option_array(); $collection_policy = ' @@ -776,7 +783,7 @@ function collection_creation_form_submit($form, &$form_state) { $node = $collection_policy_xml->content_models->addChild('content_model'); $node->addAttribute('dsid', 'ISLANDORACM'); $node->addAttribute('name', $all_cModels[$content_model]); - $node->addAttribute('namespace', $pid_namespace . '1'); + $node->addAttribute('namespace', $pid_namespace . ':1'); $node->addAttribute('pid', $content_model); } } diff --git a/ObjectHelper.inc b/ObjectHelper.inc index 4bf1c31d..e575fb7d 100644 --- a/ObjectHelper.inc +++ b/ObjectHelper.inc @@ -601,7 +601,7 @@ class ObjectHelper { if ($pid == NULL) { $pid = variable_get('fedora_repository_pid', 'islandora:top'); } - $nameSpaceAllowed = explode(" ", variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: ')); + $nameSpaceAllowed = explode(" ", variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); $pos = NULL; foreach ($nameSpaceAllowed as $nameSpace) { $pos = stripos($pid, $nameSpace); diff --git a/SearchClass.inc b/SearchClass.inc index 043a5e02..3f1c78d5 100644 --- a/SearchClass.inc +++ b/SearchClass.inc @@ -393,7 +393,7 @@ class SearchClass { $proc->setParameter('', 'searchToken', drupal_get_token('fedora_repository_advanced_search')); //token generated by Drupal, keeps tack of what tab etc we are on $proc->setParameter('', 'searchUrl', url('search') . '/fedora_repository'); //needed in our xsl $proc->setParameter('', 'objectsPage', base_path()); - $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: ')); + $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); $proc->setParameter('', 'hitPageStart', $startPage); $proc->registerPHPFunctions(); $xsl = new DomDocument(); @@ -443,7 +443,7 @@ class SearchClass { $proc->setParameter('', 'userID', $user->uid); $proc->setParameter('', 'searchUrl', url('search') . '/fedora_repository'); //needed in our xsl $proc->setParameter('', 'objectsPage', base_path()); - $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: ')); + $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); $proc->setParameter('', 'orderBy', $orderBy); $xsl = new DomDocument(); diff --git a/api/fedora_item.inc b/api/fedora_item.inc index 06f65698..836e5b53 100644 --- a/api/fedora_item.inc +++ b/api/fedora_item.inc @@ -652,7 +652,7 @@ class Fedora_Item { if (empty($pid_namespace)) { // Just get the first one in the config settings. - $allowed_namespaces = explode(" ", variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: ')); + $allowed_namespaces = explode(" ", variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); $pid_namespace = $allowed_namespaces[0]; if (!empty($pid_namespace)) { $pid_namespace = substr($pid_namespace, 0, strpos($pid_namespace, ":")); diff --git a/fedora_repository.module b/fedora_repository.module index 40d6fc74..4b6470c5 100644 --- a/fedora_repository.module +++ b/fedora_repository.module @@ -1194,7 +1194,7 @@ function fedora_repository_search_page($resultData) { $proc->setParameter('', 'searchToken', drupal_get_token('search_form')); //token generated by Drupal, keeps tack of what tab etc we are on $proc->setParameter('', 'searchUrl', url('search') . '/fedora_repository'); //needed in our xsl $proc->setParameter('', 'objectsPage', base_path()); - $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: Islandora: ilives: ')); + $proc->setParameter('', 'allowedPidNameSpaces', variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); $proc->registerPHPFunctions(); $xsl = new DomDocument(); if ($isRestricted) { diff --git a/formClass.inc b/formClass.inc index 866e2e5f..c28a4a53 100644 --- a/formClass.inc +++ b/formClass.inc @@ -281,7 +281,7 @@ class formClass { $form['fedora_namespace']['fedora_pids_allowed'] = array( '#type' => 'textfield', '#title' => t('PID namespaces allowed in this Drupal install'), - '#default_value' => variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: '), + '#default_value' => variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: '), '#description' => t('A space separated list of PID namespaces that users are permitted to access from this Drupal installation.
This could be more than a simple namespace ie demo:mydemos.'), '#weight' => 0 ); @@ -290,7 +290,7 @@ class formClass { $form['fedora_pids_allowed'] = array( '#type' => 'textfield', '#title' => t('PID namespaces allowed in this Drupal install'), - '#default_value' => variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: '), + '#default_value' => variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: '), '#description' => t('A space separated list of PID namespaces that users are permitted to access from this Drupal installation.
This could be more than a simple namespace ie demo:mydemos.'), '#weight' => 0 );