Various fixes and new module-wide config page.
[mkdru-moved-to-drupal.org.git] / mkdru.module
index a89db52..8158bb0 100644 (file)
@@ -5,7 +5,7 @@
 
 // Module metainfo
 /**
-* Implementation of hook_node_info().
+* Implementation of hook_node_info()
 */
 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');
 }
 
 /**
-* Implementation of hook_access().
+* Implementation of hook_access()
 */
 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
 /**
-* Implementation of hook_form().
+* Implementation of hook_form()
 */
 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) {
-  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);
 }
 
@@ -214,7 +229,8 @@ function mkdru_theme() {
 */
 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');