From: Jakub Skoczen Date: Wed, 23 Feb 2011 13:13:14 +0000 (+0100) Subject: Add SP/Pazpar2 configuration to the module config X-Git-Url: http://git.indexdata.com/?p=mkdru-moved-to-drupal.org.git;a=commitdiff_plain;h=895c5ddc7ab1754bc7a97c5af9132e22557f49ca Add SP/Pazpar2 configuration to the module config To allow running without a node --- diff --git a/mkdru.admin.inc b/mkdru.admin.inc index ceaa676..779cd5d 100644 --- a/mkdru.admin.inc +++ b/mkdru.admin.inc @@ -1,10 +1,8 @@ -// $Id$ - + 'textfield', @@ -13,6 +11,44 @@ function mkdru_admin_settings() { '#default_value' => variable_get('pz2_js_path', 'pazpar2/js'), '#required' => TRUE ); + $form['search_settings'] = array( + '#type' => 'fieldset', + '#title' => t('Pazpar2/Service Proxy search settings'), + '#collapsible' => TRUE, + '#collapsed' => FALSE + ); + $form['search_settings']['pz2_path'] = array( + '#type' => 'textfield', + '#title' => t('Pazpar2/Service Proxy path'), + '#description' => t('Path that takes Pazpar2 commands via HTTP'), + '#required' => TRUE, + '#default_value' => variable_get('pz2_path','/pazpar2/search.pz2') + ); + $form['search_settings']['use_sessions'] = array( + '#type' => 'checkbox', '#title' => t('Session handling'), + '#description' => t('Disable for use with Service Proxy'), + '#default_value' => variable_get('use_sessions', '1') + ); + $form['sp_settings'] = array( + '#type' => 'fieldset', + '#title' => t('Service Proxy specific settings'), + '#collapsible' => TRUE, + '#collapsed' => FALSE + ); + $form['sp_settings']['sp_user'] = array( + '#type' => 'textfield', + '#title' => t('Service Proxy username'), + '#description' => t('Service Proxy username'), + '#required' => FALSE, + '#default_value' => variable_get('sp_user','') + ); + $form['sp_settings']['sp_pass'] = array( + '#type' => 'textfield', + '#title' => t('Service Proxy password'), + '#description' => t('Service Proxy password'), + '#required' => FALSE, + '#default_value' => variable_get('sp_pass','') + ); return system_settings_form($form); } diff --git a/mkdru.module b/mkdru.module index 7ffc565..d057df2 100644 --- a/mkdru.module +++ b/mkdru.module @@ -27,8 +27,14 @@ function mkdru_ting_search_show($params) { drupal_add_js($path . '/mkdru.client.js', 'module', 'footer'); $html = theme('mkdru_results'); drupal_add_js(array('mkdru' => - array('use_sessions' => '1', 'query' => $params['keys'] - )), 'setting'); + array( + 'use_sessions' => variable_get('use_sessions', '1'), + 'pz2_path' => variable_get('pz2_path', '/pazpar2/search.pz2'), + 'sp_user' => variable_get('sp_user', ''), + 'sp_pass' => variable_get('sp_pass', ''), + 'query' => $params['keys'] + ) + ), 'setting'); return array("content" => $html); }