@ -74,11 +74,6 @@ function islandora_repository_admin($form, &$form_state) {
),
);
$form['islandora_tabs']['islandora_namespace'] = array(
'#type' => 'fieldset',
'#title' => t('Namespaces'),
);
$form['islandora_tabs']['islandora_general']['islandora_repository_pid'] = array(
'#type' => 'textfield',
'#title' => t('Root Collection PID'),
@ -87,21 +82,48 @@ function islandora_repository_admin($form, &$form_state) {
'#required' => TRUE,
);
$form['islandora_tabs']['islandora_namespace']['islandora_namespace_restriction_enforced'] = array(
$form['islandora_tabs']['islandora_namespace'] = array(
'#type' => 'fieldset',
'#title' => t('Namespaces'),
);
$form['islandora_tabs']['islandora_namespace']['wrapper'] = array(
'#type' => 'markup',
'#prefix' => '< div id = "islandora-namespace" > ',
'#suffix' => '< / div > ',
);
$form['islandora_tabs']['islandora_namespace']['wrapper']['islandora_namespace_restriction_enforced'] = array(
'#weight' => -1,
'#type' => 'checkbox',
'#title' => t('Enforce namespace restrictions'),
'#description' => t('Allow administrator to restrict user\'s access to the PID namepaces listed below'),
'#default_value' => variable_get('islandora_namespace_restriction_enforced', FALSE),
'#ajax' => array(
'callback' => 'islandora_update_namespace_div',
'wrapper' => 'islandora-namespace',
'effect' => 'fade',
'event' => 'change',
'progress' => array('type' => 'throbber'),
),
);
if(isset($form_state['values']['islandora_namespace_restriction_enforced'])) {
$namespaces = $form_state['values']['islandora_namespace_restriction_enforced'];
}
else {
$namespaces = variable_get('islandora_namespace_restriction_enforced', FALSE);
}
$form['islandora_tabs']['islandora_namespace']['islandora_pids_allowed'] = array(
'#type' => 'textfield',
'#title' => t('PID namespaces allowed in this Drupal install'),
'#default_value' => variable_get('islandora_pids_allowed', 'default: demo: changeme: ilives: islandora-book: books: newspapers: '),
'#description' => t('A space separated list of PID namespaces that users are permitted to access from this Drupal installation. < br / > This could be more than a simple namespace ie demo:mydemos. < br > islandora: is reserved and is always allowed.'),
'#weight' => 0,
);
if($namespaces) {
$form['islandora_tabs']['islandora_namespace']['wrapper']['islandora_pids_allowed'] = array(
'#type' => 'textfield',
'#title' => t('PID namespaces allowed in this Drupal install'),
'#default_value' => variable_get('islandora_pids_allowed', 'default: demo: changeme: ilives: islandora-book: books: newspapers: '),
'#description' => t('A space separated list of PID namespaces that users are permitted to access from this Drupal installation. < br / > This could be more than a simple namespace ie demo:mydemos. < br > islandora: is reserved and is always allowed.'),
'#weight' => 0,
);
}
return system_settings_form($form);
}
@ -114,4 +136,14 @@ function islandora_update_url_div($form, $form_state) {
$form_state['rebuild'] = TRUE;
return $form['islandora_tabs']['islandora_general']['wrapper'];
}
/**
* Checks url validity and refreshes requestHandler dropdown list
*/
function islandora_update_namespace_div($form, $form_state) {
unset($form_state['submit_handlers']);
$form_state['rebuild'] = TRUE;
return $form['islandora_tabs']['islandora_namespace']['wrapper'];
}