AJAX facets w/JSON serialised settings.
[mkdru-moved-to-drupal.org.git] / mkdru.install
index 56b8d4b..9bdf3a5 100644 (file)
@@ -26,44 +26,10 @@ function mkdru_schema() {
         'not null' => TRUE,
         'default' => 0
       ),
-      'pz2_path' => array(
+      'settings' => array(
         'type' => 'text',
         'not null' => TRUE,
-        'description' => 'Path to Pazpar2 or Service Proxy.',
-      ),
-      'use_sessions' => array(
-        'description' => 'Session handling toggle.',
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-      ),
-      'source_max' => array(
-        'description' => 'Number of sources to display',
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-      ),
-      'author_max' => array(
-        'description' => 'Number of authors to display',
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-      ),
-      'subject_max' => array(
-        'description' => 'Number of subjects to display',
-        'type' => 'int',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-      ),
-      'sp_user' => array(
-        'type' => 'text',
-        'not null' => FALSE,
-        'description' => 'Service Proxy username'
-      ),
-      'sp_pass' => array(
-        'type' => 'text',
-        'not null' => FALSE,
-        'description' => 'Service Proxy password'
+        'description' => 'Metasearch settings',
       ),
     ),
     'primary key' => array('nid', 'vid'),
@@ -79,17 +45,32 @@ function mkdru_schema() {
 function mkdru_install() {
   // Disable comments by default
   variable_set('comment_mkdru', COMMENT_NODE_HIDDEN);
-  // Facets
-  $facets = array('source', 'subject', 'author');
-  variable_set('mkdru_facets', $facets);
-  // Restrict facet block visibility
-  foreach ($facets as $facet) {
-    db_insert('block_node_type')
-    ->fields(array(
-      'module' => 'mkdru',
-      'delta' => 'mkdru_facet_' . $facet,
-      'type' => 'mkdru'))->execute();
-  }
+
+  // Default settings
+  $settings['title'] = "";
+  $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'] = TRUE;
+  $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'] = FALSE;
+  $settings['facets']['author']['max'] = 10;
+  $settings['facets']['author']['orderWeight'] = 3;
+  variable_set('mkdru_defaults', $settings);
 }
 
 /**