Browse Source

Adjusted default node tempalte to use ?pane= instead of ?block= to reduce confusion with Drupal blocks. Old method still works

Stephen Ficklin 10 years ago
parent
commit
4bd98122d3

+ 15 - 0
tripal_core/includes/tripal_core.toc.inc

@@ -0,0 +1,15 @@
+<?php
+
+/**
+ * 
+ */
+function tripal_core_node_toc_form($form, &$form_state) {
+  
+}
+
+/**
+ * 
+ */
+function tripal_core_node_toc_form_submit($form, &$form_state) {
+  
+}

+ 13 - 13
tripal_core/theme/css/tripal.css

@@ -89,22 +89,22 @@
 /******************************************************************************
  * The links that appear in the TOC section are added dynamically by
  * JavaScript code found at the top of the node--chado-generc.tpl.php template.
- * Each link in the TOC cooresponds to a "block" of data added to the Data
- * Column. Initially, the JavaScript hids all "blocks" except for the "Details"
- * block.  There will be as many blocks as there are TOC links.
+ * Each link in the TOC cooresponds to a "pane" of data added to the Data
+ * Column. Initially, the JavaScript hids all "panes" except for the "Details"
+ * pane.  There will be as many panes as there are TOC links.
  *
- * By default, all blocks have the following layout that consists of a
+ * By default, all panes have the following layout that consists of a
  * container div box with the class 'tripal-info-box', a div box to house the
- * block title with the class 'tripal-info-box-title', and a div box to
- * house a brief description about the block with the class
+ * pane title with the class 'tripal-info-box-title', and a div box to
+ * house a brief description about the pane with the class
  * 'tripal-info-box-desc'
  *
  * |-----------------------------------------------|
- * |  .tripal-data-block                           |
+ * |  .tripal-data-pane                            |
  * | |-------------------------------------------| |
- * | | .tripal-data-block-title                  | |
+ * | | .tripal-data-pane-title                   | |
  * | |-------------------------------------------| |
- * | | .tripal-data-block-desc                   | |
+ * | | .tripal-data-pane-desc                    | |
  * | |-------------------------------------------| |
  * |                                               |
  * | (Block data goes here)                        |
@@ -114,12 +114,12 @@
  * |                                               |
  * |-----------------------------------------------|
  */
-.tripal-data-block {
+.tripal-data-pane {
    padding: 0;
    margin:  0;
    width: 100%;
 }
-.tripal-data-block-title {
+.tripal-data-pane-title {
   font-size: 1.5em;
   padding-bottom: 5px;
 }
@@ -129,7 +129,7 @@
 }
 
 /**
- * Within the block data
+ * Within the pane data
  */
  .tripal-data-table {
    margin-top: 0px;
@@ -140,7 +140,7 @@
  * The teaser appears anywhere that a small snippet of the content is required.
  * When any node in Drupal is published to the home page a teaser is used.
  * Teasers can also be used in views to provide lists of content. The
- * teaser template is similar to the block but with the following sections and
+ * teaser template is similar to the pane but with the following sections and
  * classes
  *
  * |-----------------------------------------------|

+ 24 - 14
tripal_core/theme/templates/node--chado-generic.tpl.php

@@ -7,32 +7,42 @@ else {
   $node_type = $node->type; ?>
   
   <script type="text/javascript">
-    // we do not use Drupal Behaviors because we do not want this
+    // We do not use Drupal Behaviors because we do not want this
     // code to be executed on AJAX callbacks. This code only needs to 
     // be executed once the page is ready.
     jQuery(document).ready(function($){
 
-      // hide all but the first data block 
-      $(".tripal-data-block").hide().filter(":first-child").show();
+      // Hide all but the first data pane 
+      $(".tripal-data-pane").hide().filter(":first-child").show();
   
-      // when a title in the table of contents is clicked, then 
+      // When a title in the table of contents is clicked, then 
       // show the corresponding item in the details box 
       $(".tripal_toc_list_item_link").click(function(){
-        var id = $(this).attr('id') + "-tripal-data-block";
-        $(".tripal-data-block").hide().filter("#"+ id).fadeIn('fast');
+        var id = $(this).attr('id') + "-tripal-data-pane";
+        $(".tripal-data-pane").hide().filter("#"+ id).fadeIn('fast');
         return false;
       });
   
-      // if a ?block= is specified in the URL then we want to show the
-      // requested block
-      var block = window.location.href.match(/[\?|\&]block=(.+?)[\&|\#]/)
-      if(block == null){
-        block = window.location.href.match(/[\?|\&]block=(.+)/)
+      // If a ?pane= is specified in the URL then we want to show the
+      // requested content pane. For previous version of Tripal,
+      // ?block=, was used.  We support it here for backwards
+      // compatibility
+      var pane;
+      pane = window.location.href.match(/[\?|\&]pane=(.+?)[\&|\#]/)
+      if (pane == null) {
+        pane = window.location.href.match(/[\?|\&]pane=(.+)/)
       }
-      if(block != null){
-        $(".tripal-data-block").hide().filter("#" + block[1] + "-tripal-data-block").show();
+      // if we don't have a pane then try the old style ?block=
+      if (pane == null) {
+        pane = window.location.href.match(/[\?|\&]block=(.+?)[\&|\#]/)
+        if (pane == null) {
+          pane = window.location.href.match(/[\?|\&]block=(.+)/)
+        }
       }
-      // remove the 'active' class from the links section, as it doesn't
+      if(pane != null){
+        $(".tripal-data-pane").hide().filter("#" + pane[1] + "-tripal-data-pane").show();
+      }
+      // Remove the 'active' class from the links section, as it doesn't
       // make sense for this layout
       $("a.active").removeClass('active');
     });

+ 10 - 10
tripal_core/tripal_core.module

@@ -592,7 +592,7 @@ function tripal_core_node_view_alter(&$build) {
   $toc_html = '';
 
   // If we are looking at a Tripal node template then we want to
-  // make some changes to each block of content so that we can associate
+  // make some changes to each pane of content so that we can associate
   // a table of contents and add administrator and curator messages.
   if ($build['#tripal_generic_node_template'] == TRUE) {
 
@@ -682,14 +682,14 @@ function tripal_core_node_view_alter(&$build) {
       }
       if ($key == "field_resource_blocks") {
         foreach (element_children($build[$key]) as $index) {
-          // get the block details and the title
+          // get the details and the title
           $weight = 0;
           $markup = $build[$key][$index]["#markup"];
           $toc_item_id = "resource-$index";
           $toc_item_title = $build["field_resource_titles"][$index]["#markup"];
           $updated_markup = "
-            <div id=\"$toc_item_id-tripal-data-block\" class=\"tripal-data-block\">
-              <div class=\"$toc_item_id-tripal-data-block-title tripal-data-block-title\">$toc_item_title</div>
+            <div id=\"$toc_item_id-tripal-data-pane\" class=\"tripal-data-pane\">
+              <div class=\"$toc_item_id-tripal-data-pane-title tripal-data-pane-title\">$toc_item_title</div>
                 $markup
               </div>
             </div>
@@ -698,7 +698,7 @@ function tripal_core_node_view_alter(&$build) {
           $build[$toc_item_id]['#weight'] = $weight;
           $build[$toc_item_id]['#toc_handled'] = TRUE;
           // add the entry to the TOC
-          $toc_item_link = "<div class=\"tripal_toc_list_item\"><a id=\"$toc_item_id\" class=\"tripal_toc_list_item_link\" href=\"?block=$toc_item_id\">$toc_item_title</a></div>";
+          $toc_item_link = "<div class=\"tripal_toc_list_item\"><a id=\"$toc_item_id\" class=\"tripal_toc_list_item_link\" href=\"?pane=$toc_item_id\">$toc_item_title</a></div>";
           $toc[$weight][$toc_item_title] = $toc_item_link;
         }
         // Remove the key from the build array. We have have replaced it
@@ -740,7 +740,7 @@ function tripal_core_node_view_alter(&$build) {
       if (array_key_exists('#tripal_toc_id', $build[$key])) {
         $toc_item_id = $build[$key]['#tripal_toc_id'];
       }
-      $toc_item_link = "<div class=\"tripal_toc_list_item\"><a id=\"$toc_item_id\" class=\"tripal_toc_list_item_link\" href=\"?block=$toc_item_id\">$toc_item_title</a></div>";
+      $toc_item_link = "<div class=\"tripal_toc_list_item\"><a id=\"$toc_item_id\" class=\"tripal_toc_list_item_link\" href=\"?pane=$toc_item_id\">$toc_item_title</a></div>";
 
 
       //-----------------------
@@ -786,7 +786,7 @@ function tripal_core_node_view_alter(&$build) {
 
           $path = tripal_set_message("Administrators, you can
             customize the way the content above is presented.  Tripal provides a template
-            file for each block of content.  To customize, copy the template file to your
+            file for each pane of content.  To customize, copy the template file to your
             site's default theme, edit then " .
             l('clear the Drupal cache', 'admin/config/development/performance', array('attributes' => array('target' => '_blank'))) . ".
             Currently, the content above is provided by this template: <br><br>$path",
@@ -814,8 +814,8 @@ function tripal_core_node_view_alter(&$build) {
       //-----------------------
       // add a surrounding <div> box around the content
       $updated_markup = "
-        <div id=\"$toc_item_id-tripal-data-block\" class=\"tripal-data-block\">
-          <div class=\"$toc_item_id-tripal-data-block-title tripal-data-block-title\">$toc_item_title</div>
+        <div id=\"$toc_item_id-tripal-data-pane\" class=\"tripal-data-pane\">
+          <div class=\"$toc_item_id-tripal-data-pane-title tripal-data-pane-title\">$toc_item_title</div>
             $markup
             $path
           </div>
@@ -840,7 +840,7 @@ function tripal_core_node_view_alter(&$build) {
       $toc_html .= $toc_item_link;
     }
   }
-  $build['tripal_toc']['#markup'] = "<div id=\"$node->type-tripal-toc-block\" class=\"tripal-toc-block\">$toc_html</div>";
+  $build['tripal_toc']['#markup'] = "<div id=\"$node->type-tripal-toc-pane\" class=\"tripal-toc-pane\">$toc_html</div>";
 }
 
 /**

+ 1 - 1
tripal_db/api/tripal_db.api.inc

@@ -304,7 +304,7 @@ function tripal_get_dbxref($identifiers, $options = array()) {
  *
  * @ingroup tripal_db_api
  */
-function tripal_insert_db($values, $options) {
+function tripal_insert_db($values, $options = array()) {
 
   // Default Values
   $dbname = $values['name'];