X-Git-Url: http://git.indexdata.com/cgi-bin?a=blobdiff_plain;f=mkdru.module;h=a68fc93f7490cf90b7c01b7974858c177ef44d49;hb=3cb6b390f4a99238e077e2c776e77e6b1ddb9814;hp=ac0609755469b25d84c865423b148c54c67f9305;hpb=4b3873f962312d06553eb7ffe4e7dd1d0e56d058;p=mkdru-moved-to-drupal.org.git diff --git a/mkdru.module b/mkdru.module index ac06097..a68fc93 100644 --- a/mkdru.module +++ b/mkdru.module @@ -80,7 +80,7 @@ function mkdru_menu() { /** * Implementation of hook_init() */ -function mkdru_init(){ +function mkdru_init() { // Applies our module specific CSS to all pages. This works best because // all CSS is aggregated and cached so we reduce the number of HTTP // requests and the size is negligible. @@ -124,6 +124,29 @@ function mkdru_form(&$node, $form_state) { '#default_value' => isset($node->mkdru->use_sessions) ? $node->mkdru->use_sessions : 1, ); + $form['sp_settings'] = array( + '#type' => 'fieldset', + '#title' => t('Service Proxy specific settings'), + '#collapsible' => TRUE, + '#collapsed' => TRUE + ); + $form['sp_settings']['sp_user'] = array( + '#type' => 'textfield', + '#title' => t('Service Proxy username'), + '#description' => t('Service Proxy username'), + '#required' => FALSE, + '#default_value' => isset($node->mkdru->sp_user) ? + $node->mkdru->sp_user : '', + ); + $form['sp_settings']['sp_pass'] = array( + '#type' => 'textfield', + '#title' => t('Service Proxy password'), + '#description' => t('Service Proxy password'), + '#required' => FALSE, + '#default_value' => isset($node->mkdru->sp_pass) ? + $node->mkdru->sp_pass : '', + ); + $form['display_settings'] = array( '#type' => 'fieldset', '#title' => t('Display settings'), @@ -177,8 +200,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, %d)", - $node->nid, $node->vid, $node->pz2_path, $node->use_sessions, $node->source_max, $node->author_max, $node->subject_max); + drupal_write_record('mkdru', $node); } /** @@ -190,7 +212,7 @@ function mkdru_update($node) { mkdru_insert($node); } else { - db_query("UPDATE {mkdru} SET pz2_path = '%s', use_sessions = %d, source_max = %d, author_max = %d, subject_max = %d WHERE vid = %d", $node->pz2_path, $node->use_sessions, $node->source_max, $node->author_max, $node->subject_max, $node->vid); + drupal_write_record('mkdru', $node, 'vid'); } } @@ -246,12 +268,12 @@ function mkdru_theme() { ), 'mkdru_block_search' => array( 'template' => 'mkdru-block-search', - 'arguments' => array('nid' => null, 'path' => NULL), + 'arguments' => array('nid' => NULL, 'path' => NULL), ), -// 'mkdru_block_facet' => array( -// 'template' => 'mkdru-block-facet', -// 'arguments' => array('divId' => NULL), -// ), + 'mkdru_block_facet' => array( + 'template' => 'mkdru-block-facet', + 'arguments' => array('class' => NULL) + ) ); } @@ -295,13 +317,28 @@ function mkdru_block($op='list', $delta='sources', $edit=array()) { switch ($op) { case 'list': // facet blocks + // D6 has no setting for note type visibility, set + // the default to limit facet display to this type + $visPHP = ' arg(1))); + return $node->type == "mkdru"; + } +?>'; + // NB: block caching is redundant for static content $blocks['mkdru_sources']['info'] = t('mkdru - source facets'); $blocks['mkdru_sources']['cache'] = BLOCK_NO_CACHE; + $blocks['mkdru_sources']['visibility'] = 2; + $blocks['mkdru_sources']['pages'] = $visPHP; $blocks['mkdru_subjects']['info'] = t('mkdru - subject facets'); $blocks['mkdru_subjects']['cache'] = BLOCK_NO_CACHE; + $blocks['mkdru_subjects']['visibility'] = 2; + $blocks['mkdru_subjects']['pages'] = $visPHP; $blocks['mkdru_authors']['info'] = t('mkdru - author facets'); $blocks['mkdru_authors']['cache'] = BLOCK_NO_CACHE; + $blocks['mkdru_authors']['visibility'] = 2; + $blocks['mkdru_authors']['pages'] = $visPHP; // search blocks $result = db_query("SELECT title, nid FROM {node} WHERE type = 'mkdru';"); while ($node = db_fetch_object($result)) { @@ -313,30 +350,17 @@ function mkdru_block($op='list', $delta='sources', $edit=array()) { case 'view': switch ($delta) { - // TODO: make the facet themable, I have no clue why this won't work -// case 'mkdru_sources': -// $block['subject'] = t('Source'); -// $block['content'] = theme('mkdru_block_facet', 'mkdru-sources'); -// return $block; -// case 'mkdru_subjects': -// $block['subject'] = t('Subject'); -// $block['content'] = theme('mkdru_block_facet', 'mkdru-subjects'); -// return $block; -// case 'mkdru_authors': -// $block['subject'] = t('Author'); -// $block['content'] = theme('mkdru_block_facet', 'mkdru-authors'); -// return $block; case 'mkdru_sources': $block['subject'] = t('Source'); - $block['content'] = '
'; + $block['content'] = theme('mkdru_block_facet', 'mkdru-facet-source'); return $block; case 'mkdru_subjects': $block['subject'] = t('Subject'); - $block['content'] = '
'; + $block['content'] = theme('mkdru_block_facet', 'mkdru-facet-subject'); return $block; case 'mkdru_authors': $block['subject'] = t('Author'); - $block['content'] = '
'; + $block['content'] = theme('mkdru_block_facet', 'mkdru-facet-author'); return $block; } if (substr($delta, 0, 13) == 'mkdru_search_') {