Restrict block visibility to mkdru node type
authorJason Skomorowski <jason@indexdata.com>
Fri, 28 Jan 2011 00:24:54 +0000 (01:24 +0100)
committerJason Skomorowski <jason@indexdata.com>
Fri, 28 Jan 2011 00:24:54 +0000 (01:24 +0100)
mkdru.info
mkdru.module

index e618a45..a5c816f 100644 (file)
@@ -1,3 +1,3 @@
-name = Z39.50/SRU metasearch
-description = Metasearching of Z39.50 and other targets via Index Data's Pazpar2 and associated tool stack.
+name = Pazpar2 metasearch integration
+description = Metasearching of Z39.50, SRU and SOLR targets via Index Data's Pazpar2 and associated tool stack.
 core = 6.x
index 5a6eb81..9d55303 100644 (file)
@@ -294,13 +294,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 = '<?php
+  if (arg(0) == "node" && is_numeric(arg(1))) {
+    $node = node_load(array("nid" => 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)) {