@ -158,6 +158,13 @@ class formClass {
'access arguments' => array('administer site configuration'),
'access arguments' => array('administer site configuration'),
);
);
$items['islandora/fedora/url'] = array(
'page callback' => 'update_fedora_url_div',
'access arguments' => array('view fedora collection'),
'file' => 'fedora_repository.module',
'type' => MENU_CALLBACK,
);
return $items;
return $items;
}
}
@ -165,14 +172,25 @@ class formClass {
* Create admin form
* Create admin form
* @return array
* @return array
*/
*/
function createAdminForm() {
function createAdminForm(& $form_state ) {
if (!user_access('administer site configuration')) {
if (!user_access('administer site configuration')) {
drupal_set_message(t('You must be a site administrator to edit the Fedora collections list.'), 'error');
drupal_set_message(t('You must be a site administrator to edit the Fedora collections list.'), 'error');
return;
return;
}
}
module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
$fedora_path = isset($form_state['values']['fedora_base_url']) ? $form_state['values']['fedora_base_url'] : variable_get('fedora_base_url', 'http://localhost:8080/fedora');
$triplepath = "$fedora_path/risearch";
$response = do_curl_ext($fedora_path . '/describe');
$available = ($response != NULL) ? ($response[1] == 0) : FALSE;
$confirmation_message = ($available ? '< img src = "' . url('misc/watchdog-ok.png') . '" / > '
. t('Successfully connected to Fedora server at @fedora_soap_url', array('@fedora_soap_url' => $fedora_path)) : '< img src = "'
. url('misc/watchdog-error.png') . '"/> '
. t('Unable to connect to Fedora server at @fedora_soap_url', array('@fedora_soap_url' => $fedora_path)));
$form = array();
$form = array();
$form['fedora_repository_pid'] = array(
$form['fedora_repository_pid'] = array(
'#type' => 'textfield',
'#type' => 'textfield',
'#title' => t('Root Collection PID'),
'#title' => t('Root Collection PID'),
@ -182,45 +200,41 @@ class formClass {
'#weight' => -18
'#weight' => -18
);
);
$form['fedora_base_url'] = array(
'#type' => 'textfield',
'#title' => t('Fedora base URL'),
'#default_value' => variable_get('fedora_base_url', 'http://localhost:8080/fedora'),
'#description' => t('The URL to use for REST-type connections'),
'#required' => TRUE,
'#weight' => -16,
);
$form['fedora_repository_url'] = array(
// new ahah stuff
'#type' => 'textfield',
'#title' => t('Fedora RISearch URL'),
$form['fedora_ahah_wrapper'] = array(
'#default_value' => variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch') ,
'#prefix' => '< div id = "islandora-fedora-url" > ',
'#description' => t('The url of the Fedora server'), '#required' => TRUE ,
'#suffix' => '< / div > ',
'#weight' => -14
'#type' => 'markup',
);
);
$form['fedora_soap _url'] = array(
$form['fedora_ahah_wrapper']['fedora_base _url'] = array(
'#type' => 'textfield',
'#type' => 'textfield',
'#title' => t('Fedora SOAP Url'),
'#title' => t('Fedora base URL'),
'#default_value' => variable_get('fedora_soap_url', 'http://localhost:8080/fedora/wsdl?api=API-A'),
'#default_value' => $fedora_path,
'#description' => t('The URL to use for SOAP connections'),
'#description' => t('The URL to use for REST-type connections'),
'#required' => TRUE,
'#ahah' => array(
'#weight' => -12,
'path' => 'islandora/fedora/url',
'#suffix' => '< p > ' . (
'wrapper' => 'islandora-fedora-url',
fedora_available() ?
'effect' => 'fade',
theme('image', 'misc/watchdog-ok.png') . t('Successfully connected to Fedora server at @fedora_soap_url', array('@fedora_soap_url' => variable_get('fedora_soap_url', ''))) :
'event' => 'change'),
theme('image', 'misc/watchdog-error.png') . t('Unable to connect to Fedora server at @fedora_soap_url', array('@fedora_soap_url' => variable_get('fedora_soap_url', '')))) . '< / p > ',
);
);
$form['fedora_ahah_wrapper']['infobox'] = array(
$form['fedora_soap_manage_url'] = array(
'#type' => 'item',
'#value' => $confirmation_message,
);
$form['fedora_ahah_wrapper']['fedora_repository_url'] = array(
'#type' => 'textfield',
'#type' => 'textfield',
'#title' => t('Fedora SOAP management URL'),
'#title' => t('Fedora RISearch URL'),
'#default_value' => variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/wsdl?api=API-M'), '#description' => t('The URL to use for SOAP API-M connections'),
'#default_value' => $triplepath,
'#description' => t('The url of the Fedora server\'s Triplestore. Change this only if you have set up an external triplestore'),
'#required' => TRUE,
'#required' => TRUE,
'#weight' => -10
);
);
// will allow admin user to remove namepsace restrictions if not explicitly disallowed in settings.php
// will allow admin user to remove namepsace restrictions if not explicitly disallowed in settings.php
if (variable_get('allow_open_namespace', TRUE)) {
if (variable_get('allow_open_namespace', TRUE)) {
$form['fedora_namespace'] = array(
$form['fedora_namespace'] = array(
@ -365,9 +379,13 @@ class formClass {
);
);
$form['#attributes'] = array('enctype' => "multipart/form-data");
$form['#attributes'] = array('enctype' => "multipart/form-data");
$form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save Configuration'));
$form['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults'));
$form['#submit'][] = 'islandora_fedora_settings_form_submit';
$form['#theme'] = 'system_settings_form';
return ($form);
// return system_settings_form($form);
return system_settings_form($form);
}
}
/**
/**
@ -422,8 +440,7 @@ class formClass {
}
}
// Save the title
// Save the title
if ( $label != null )
if ($label != null) {
{
$object = new Fedora_Item($form_values['pid']);
$object = new Fedora_Item($form_values['pid']);
$object->modify_object($label);
$object->modify_object($label);
}
}