|
|
@ -6,7 +6,7 @@ |
|
|
|
* @return array |
|
|
|
* @return array |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
function islandora_repository_admin() { |
|
|
|
function islandora_repository_admin($form, &$form_state) { |
|
|
|
module_load_include('inc', 'islandora', 'RestConnection'); |
|
|
|
module_load_include('inc', 'islandora', 'RestConnection'); |
|
|
|
|
|
|
|
|
|
|
|
if (!RestConnection::exists()) { |
|
|
|
if (!RestConnection::exists()) { |
|
|
@ -17,6 +17,32 @@ |
|
|
|
|
|
|
|
|
|
|
|
$form = array(); |
|
|
|
$form = array(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isset($form_state['values']['islandora_base_url'])) { |
|
|
|
|
|
|
|
$url = $form_state['values']['islandora_base_url']; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
$url = variable_get('islandora_base_url', 'http://localhost:8080/fedora'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module_load_include('inc', 'islandora', 'RestConnection'); |
|
|
|
|
|
|
|
$connection = new RestConnection(NULL, $url); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
$info = $connection->api->a->describeRepository(); |
|
|
|
|
|
|
|
$connected = TRUE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (RepositoryException $e) { |
|
|
|
|
|
|
|
$connected = FALSE; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($connected) { |
|
|
|
|
|
|
|
$confirmation_message = '<img src="' . url('misc/watchdog-ok.png') . '"/>' |
|
|
|
|
|
|
|
. t('Successfully connected to Fedora Server (Version !version).', array('!version' => $info['repositoryVersion'])); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
$confirmation_message = '<img src="' . url('misc/watchdog-error.png') . '"/> ' |
|
|
|
|
|
|
|
. t('Unable to connect to Fedora server at !islandora_url', array('!islandora_url' => $url)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$form['islandora_tabs'] = array( |
|
|
|
$form['islandora_tabs'] = array( |
|
|
|
'#type' => 'vertical_tabs', |
|
|
|
'#type' => 'vertical_tabs', |
|
|
|
); |
|
|
|
); |
|
|
@ -26,30 +52,41 @@ |
|
|
|
'#title' => t('General Configuarion'), |
|
|
|
'#title' => t('General Configuarion'), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['islandora_tabs']['islandora_general']['islandora_repository_pid'] = array( |
|
|
|
// ajax wrapper for url checking |
|
|
|
'#type' => 'textfield', |
|
|
|
$form['islandora_tabs']['islandora_general']['wrapper'] = array( |
|
|
|
'#title' => t('Root Collection PID'), |
|
|
|
'#prefix' => '<div id="islandora-url">', |
|
|
|
'#default_value' => variable_get('islandora_repository_pid', 'islandora:root'), |
|
|
|
'#suffix' => '</div>', |
|
|
|
'#description' => t('The PID of the Root Collection Object'), |
|
|
|
'#type' => 'markup', |
|
|
|
'#required' => TRUE, |
|
|
|
|
|
|
|
'#weight' => -18 |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['islandora_tabs']['islandora_general']['islandora_base_url'] = array( |
|
|
|
$form['islandora_tabs']['islandora_general']['wrapper']['islandora_base_url'] = array( |
|
|
|
'#type' => 'textfield', |
|
|
|
'#type' => 'textfield', |
|
|
|
'#title' => t('Fedora base URL'), |
|
|
|
'#title' => t('Fedora base URL'), |
|
|
|
'#default_value' => variable_get('islandora_base_url', 'http://localhost:8080/fedora'), |
|
|
|
'#default_value' => variable_get('islandora_base_url', 'http://localhost:8080/fedora'), |
|
|
|
'#description' => t('The URL to use for REST connections'), |
|
|
|
'#description' => t('The URL to use for REST connections <br>' . $confirmation_message), |
|
|
|
'#required' => TRUE, |
|
|
|
'#required' => TRUE, |
|
|
|
'#weight' => -16, |
|
|
|
'#ajax' => array( |
|
|
|
|
|
|
|
'callback' => 'islandora_update_url_div', |
|
|
|
|
|
|
|
'wrapper' => 'islandora-url', |
|
|
|
|
|
|
|
'effect' => 'fade', |
|
|
|
|
|
|
|
'event' => 'blur', |
|
|
|
|
|
|
|
'progress' => array('type' => 'throbber'), |
|
|
|
|
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// will allow admin user to remove namepsace restrictions if not explicitly disallowed in settings.php |
|
|
|
|
|
|
|
$form['islandora_tabs']['islandora_namespace'] = array( |
|
|
|
$form['islandora_tabs']['islandora_namespace'] = array( |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#type' => 'fieldset', |
|
|
|
'#title' => t('Namespaces'), |
|
|
|
'#title' => t('Namespaces'), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$form['islandora_tabs']['islandora_general']['islandora_repository_pid'] = array( |
|
|
|
|
|
|
|
'#type' => 'textfield', |
|
|
|
|
|
|
|
'#title' => t('Root Collection PID'), |
|
|
|
|
|
|
|
'#default_value' => variable_get('islandora_repository_pid', 'islandora:root'), |
|
|
|
|
|
|
|
'#description' => t('The PID of the Root Collection Object'), |
|
|
|
|
|
|
|
'#required' => TRUE, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$form['islandora_tabs']['islandora_namespace']['islandora_namespace_restriction_enforced'] = array( |
|
|
|
$form['islandora_tabs']['islandora_namespace']['islandora_namespace_restriction_enforced'] = array( |
|
|
|
'#weight' => -1, |
|
|
|
'#weight' => -1, |
|
|
|
'#type' => 'checkbox', |
|
|
|
'#type' => 'checkbox', |
|
|
@ -68,3 +105,13 @@ |
|
|
|
|
|
|
|
|
|
|
|
return system_settings_form($form); |
|
|
|
return system_settings_form($form); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Checks url validity and refreshes requestHandler dropdown list |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
function islandora_update_url_div($form, $form_state) { |
|
|
|
|
|
|
|
unset($form_state['submit_handlers']); |
|
|
|
|
|
|
|
$form_state['rebuild'] = TRUE; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $form['islandora_tabs']['islandora_general']['wrapper']; |
|
|
|
|
|
|
|
} |