Various fixes and new module-wide config page.
authorJason Skomorowski <jason@indexdata.com>
Thu, 25 Nov 2010 04:12:48 +0000 (05:12 +0100)
committerJason Skomorowski <jason@indexdata.com>
Thu, 25 Nov 2010 04:12:48 +0000 (05:12 +0100)
mkdru.admin.inc
mkdru.client.js
mkdru.install
mkdru.module

index 47a2524..994cd36 100644 (file)
@@ -2,8 +2,10 @@
 function mkdru_admin_settings() {
   $form['pz2_js_path']=array(
     '#type' => 'textfield',
 function mkdru_admin_settings() {
   $form['pz2_js_path']=array(
     '#type' => 'textfield',
-    '#title' => t('Path to Pazpar2 client library, pz2.js'),
-    '#default_value' => variable_get('pz2_js_path', '/pazpar2/pz2.js'),
+    '#title' => t('Path to Pazpar2 client library'),
+    '#description' => t('Absolute path to the directory containing pz2.js within the current domain. Do not include leading slash.'),
+    '#default_value' => variable_get('pz2_js_path', 'pazpar2/js'),
+    '#required' => TRUE
   );
 
   return system_settings_form($form);
   );
 
   return system_settings_form($form);
index 1eb7ece..2cf70cb 100644 (file)
@@ -91,7 +91,7 @@ mkdru.pz2ByTarget = function (data) {
 // UI functions:
 mkdru.submitQuery = function () {
   mkdru.submitted = true;
 // UI functions:
 mkdru.submitQuery = function () {
   mkdru.submitted = true;
-//   mkdru.resetPage();
+  mkdru.resetPage();
 //   mkdru.pollDropDowns();
   mkdru.search();
   return false;
 //   mkdru.pollDropDowns();
   mkdru.search();
   return false;
@@ -106,8 +106,8 @@ mkdru.pollDropDowns = function () {
   mkdru.recPerPage = $('#mkdru-perpage').value;
   mkdru.curSort = $('#mkdru-sort').value;
   if (!mkdru.submitted) return false;
   mkdru.recPerPage = $('#mkdru-perpage').value;
   mkdru.curSort = $('#mkdru-sort').value;
   if (!mkdru.submitted) return false;
-  mkdru.resetPage();
-  mkdru.pz2.show(0, mkdru.recPerPage, mkdru.curSort);
+//   mkdru.resetPage();
+//   mkdru.pz2.show(0, mkdru.recPerPage, mkdru.curSort);
 };
 
 mkdru.limitQuery = function (field, value) {
 };
 
 mkdru.limitQuery = function (field, value) {
@@ -125,7 +125,7 @@ mkdru.limitTarget = function (id, name) {
   navi.innerHTML += '<hr/>';
   mkdru.curFilter = 'pz:id=' + id;
   mkdru.resetPage();
   navi.innerHTML += '<hr/>';
   mkdru.curFilter = 'pz:id=' + id;
   mkdru.resetPage();
-  mkdru.pollDropDowns();
+//   mkdru.pollDropDowns();
   mkdru.search();
   return false;
 };
   mkdru.search();
   return false;
 };
index a2d828a..15f5568 100644 (file)
@@ -79,5 +79,7 @@ function mkdru_install() {
 function mkdru_uninstall() {
   // Drop table.
   drupal_uninstall_schema('mkdru');
 function mkdru_uninstall() {
   // Drop table.
   drupal_uninstall_schema('mkdru');
+  // Delete variables
+  variable_del('pz2_js_path');
 }
 ?>
 }
 ?>
index a89db52..8158bb0 100644 (file)
@@ -5,7 +5,7 @@
 
 // Module metainfo
 /**
 
 // Module metainfo
 /**
-* Implementation of hook_node_info().
+* Implementation of hook_node_info()
 */
 function mkdru_node_info() {
   return array(
 */
 function mkdru_node_info() {
   return array(
@@ -19,14 +19,14 @@ function mkdru_node_info() {
 }
 
 /**
 }
 
 /**
-* Implementation of hook_perm().
+* Implementation of hook_perm()
 */
 function mkdru_perm() {
   return array('create metasearch interface', 'edit any metasearch interface', 'edit own metasearch interface');
 }
 
 /**
 */
 function mkdru_perm() {
   return array('create metasearch interface', 'edit any metasearch interface', 'edit own metasearch interface');
 }
 
 /**
-* Implementation of hook_access().
+* Implementation of hook_access()
 */
 function mkdru_access($op, $node, $account) {
 
 */
 function mkdru_access($op, $node, $account) {
 
@@ -47,11 +47,26 @@ function mkdru_access($op, $node, $account) {
   }
 }
 
   }
 }
 
+/**
+* Implementation of hook_menu()
+*/
+function mkdru_menu() {
+  $items['admin/settings/mkdru'] = array(
+    'title' => 'mkdru Settings',
+    'description' => 'Settings for mkdru.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('mkdru_admin_settings'),
+    'access arguments' => array('administer site configuration'),
+    'type' => MENU_NORMAL_ITEM,
+    'file' => 'mkdru.admin.inc',
+  );
+  return $items;
+}
 
 
 // Node config
 /**
 
 
 // Node config
 /**
-* Implementation of hook_form().
+* Implementation of hook_form()
 */
 function mkdru_form(&$node, $form_state) {
   $type = node_get_types('type', $node);
 */
 function mkdru_form(&$node, $form_state) {
   $type = node_get_types('type', $node);
@@ -137,7 +152,7 @@ function mkdru_validate($node) {
 * Implementation of hook_insert().
 */
 function mkdru_insert($node) {
 * Implementation of hook_insert().
 */
 function mkdru_insert($node) {
-  db_query("INSERT INTO {mkdru} (nid, vid, pz2_path, use_sessions, source_max, author_max, subject_max) VALUES (%d, %d, '%s', %d, %d, %d)",
+  db_query("INSERT INTO {mkdru} (nid, vid, pz2_path, use_sessions, source_max, author_max, subject_max) VALUES (%d, %d, '%s', %d, %d, %d, %d)",
     $node->nid, $node->vid, $node->pz2_path, $node->use_sessions, $node->source_max, $node->author_max, $node->subject_max);
 }
 
     $node->nid, $node->vid, $node->pz2_path, $node->use_sessions, $node->source_max, $node->author_max, $node->subject_max);
 }
 
@@ -214,7 +229,8 @@ function mkdru_theme() {
 */
 function theme_mkdru_page_js($node) {
   $path = drupal_get_path('module', 'mkdru');
 */
 function theme_mkdru_page_js($node) {
   $path = drupal_get_path('module', 'mkdru');
-  drupal_add_js('pazpar2/js/pz2.js', 'module', 'footer');
+  // Include client library.
+  drupal_add_js(variable_get('pz2_js_path', 'pazpar2/js') . '/pz2.js', 'module', 'footer');
   drupal_add_js($path . '/mkdru.theme.js', 'module', 'footer');
   drupal_add_js($path . '/mkdru.client.js', 'module', 'footer');
   drupal_add_js(array('mkdru' => $node->mkdru), 'setting');
   drupal_add_js($path . '/mkdru.theme.js', 'module', 'footer');
   drupal_add_js($path . '/mkdru.client.js', 'module', 'footer');
   drupal_add_js(array('mkdru' => $node->mkdru), 'setting');