X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=mkdru.install;h=4651a034408029487c3ac19931a92f5464306ed8;hb=f95e7a4268e7e62fe1ba36b120e0b58108d4c5a6;hp=15f55682f207a0b5b3ae9aaf2caddc98e4c6b6d3;hpb=9bb075c111afad0a4dc12d6b9bee8b21b532500c;p=mkdru-moved-to-drupal.org.git diff --git a/mkdru.install b/mkdru.install index 15f5568..4651a03 100644 --- a/mkdru.install +++ b/mkdru.install @@ -6,54 +6,30 @@ */ /** -* Implementation of hook_schema(). +* Implements hook_schema(). */ function mkdru_schema() { $schema['mkdru'] = array( - 'description' => t('Stores settings for mkdru nodes.'), - 'fields' => array ( + 'description' => 'Stores settings for mkdru nodes.', + 'fields' => array( 'nid' => array( - 'description' => t('The primary identifier for a node.'), + 'description' => 'The primary identifier for a node.', 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 ), 'vid' => array( - 'description' => t('The current {node_revisions}.vid version identifier.'), + 'description' => 'The current {node_revisions}.vid version identifier.', 'type' => 'int', 'unsigned' => TRUE, '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,22 +40,47 @@ 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'); + variable_set('comment_mkdru', defined('COMMENT_NODE_HIDDEN') ? COMMENT_NODE_HIDDEN : NULL); + + + // 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); } /** -* 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'); + // Clear block visibility + db_delete('block_node_type')->condition('module', 'mkdru')->execute(); } -?>