Minor cleanup.
[mkdru-moved-to-drupal.org.git] / mkdru.install
index a2d828a..29b5b95 100644 (file)
@@ -1,17 +1,16 @@
 <?php
-// $Id$
 /**
  * @file
  * Install, update and uninstall functions.
  */
 
 /**
-* Implementation of hook_schema().
+* Implements hook_schema().
 */
 function mkdru_schema() {
   $schema['mkdru'] = array(
     'description' => t('Stores settings for mkdru nodes.'),
-    'fields' => array (
+    'fields' => array(
       'nid' => array(
         'description' => t('The primary identifier for a node.'),
         'type' => 'int',
@@ -26,34 +25,10 @@ function mkdru_schema() {
         'not null' => TRUE,
         'default' => 0
       ),
-      'pz2_path' => array(
+      'settings' => array(
         'type' => 'text',
         'not null' => TRUE,
-        'description' => t('Path to Pazpar2 or Service Proxy.')
-      ),
-      'use_sessions' => array(
-        'description' => t('Session handling toggle.'),
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-      ),
-      'source_max' => array(
-        'description' => t('Number of sources to display'),
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-      ),
-      'author_max' => array(
-        'description' => t('Number of authors to display'),
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-      ),
-      'subject_max' => array(
-        'description' => t('Number of subjects to display'),
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
+        'description' => 'Metasearch settings',
       ),
     ),
     'primary key' => array('nid', 'vid'),
@@ -64,20 +39,46 @@ function mkdru_schema() {
 }
 
 /**
-* Implementation of hook_install().
+* Implements hook_install().
 */
 function mkdru_install() {
   // Disable comments by default
   variable_set('comment_mkdru', COMMENT_NODE_DISABLED);
   // Create table.
   drupal_install_schema('mkdru');
+  // Default settings
+  $settings['pz2_path'] = "/pazpar2/search.pz2";
+  $settings['use_sessions'] = 1;
+  $settings['sp']['user'] = "";
+  $settings['sp']['pass'] = "";
+  $settings['facets']['source']['displayName'] = "Source";
+  $settings['facets']['source']['pz2Name'] = "xtargets";
+  $settings['facets']['source']['limiter'] = NULL;
+  $settings['facets']['source']['multiLimit'] = NULL;
+  $settings['facets']['source']['max'] = 10;
+  $settings['facets']['source']['orderWeight'] = 1;
+  $settings['facets']['subject']['displayName'] = "Subject";
+  $settings['facets']['subject']['pz2Name'] = "subject";
+  $settings['facets']['subject']['limiter'] = "su";
+  $settings['facets']['subject']['multiLimit'] = 1;
+  $settings['facets']['subject']['max'] = 10;
+  $settings['facets']['subject']['orderWeight'] = 2;
+  $settings['facets']['author']['displayName'] = "Author";
+  $settings['facets']['author']['pz2Name'] = "author";
+  $settings['facets']['author']['limiter'] = "au";
+  $settings['facets']['author']['multiLimit'] = 0;
+  $settings['facets']['author']['max'] = 10;
+  $settings['facets']['author']['orderWeight'] = 3;
+  variable_set('mkdru_defaults', $settings);
 }
 
 /**
-* Implementation of hook_uninstall().
+* Implements hook_uninstall().
 */
 function mkdru_uninstall() {
   // Drop table.
   drupal_uninstall_schema('mkdru');
-}
-?>
+  // Delete variables
+  variable_del('pz2_js_path');
+  variable_del('mkdru_defaults');
+}
\ No newline at end of file