@ -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(
$form['islandora_tabs']['islandora_general']['islandora_repository_pid'] = array(
'#type' => 'textfield',
'#type' => 'textfield',
'#title' => t('Root Collection PID'),
'#title' => t('Root Collection PID'),
@ -87,21 +82,48 @@ function islandora_repository_admin($form, &$form_state) {
'#required' => TRUE,
'#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,
'#weight' => -1,
'#type' => 'checkbox',
'#type' => 'checkbox',
'#title' => t('Enforce namespace restrictions'),
'#title' => t('Enforce namespace restrictions'),
'#description' => t('Allow administrator to restrict user\'s access to the PID namepaces listed below'),
'#description' => t('Allow administrator to restrict user\'s access to the PID namepaces listed below'),
'#default_value' => variable_get('islandora_namespace_restriction_enforced', FALSE),
'#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'),
),
);
);
$form['islandora_tabs']['islandora_namespace']['islandora_pids_allowed'] = array(
if(isset($form_state['values']['islandora_namespace_restriction_enforced'])) {
'#type' => 'textfield',
$namespaces = $form_state['values']['islandora_namespace_restriction_enforced'];
'#title' => t('PID namespaces allowed in this Drupal install'),
}
'#default_value' => variable_get('islandora_pids_allowed', 'default: demo: changeme: ilives: islandora-book: books: newspapers: '),
else {
'#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.'),
$namespaces = variable_get('islandora_namespace_restriction_enforced', FALSE);
'#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);
return system_settings_form($form);
}
}
@ -115,3 +137,13 @@ function islandora_update_url_div($form, $form_state) {
return $form['islandora_tabs']['islandora_general']['wrapper'];
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'];
}