Преглед на файлове

fixed merge conflict in tripal_core.module

Lacey Sanderson преди 11 години
родител
ревизия
788ce8a018

+ 25 - 8
tripal_core/theme/css/tripal.css

@@ -55,9 +55,9 @@
   background-color: transparent !important;
 }
 .tripal-contents-table-td-toc { 
-  border: 1px solid #888888 !important;
+  border-right: 1px solid #888888 !important;
   margin:  0px !important;
-  padding: 10px !important;
+  padding: 0px !important;
   background-color: transparent !important;
   text-align: left !important;
   vertical-align: top !important;
@@ -75,11 +75,11 @@
  * The table of contents is an unordered list. The following can are used
  * to style the list 
  */
-.tripal_toc_list ul {
+.tripal_toc_list {
 
 }
-.tripal_toc_list li {
-  padding: 3px 20px 3px 10px !important;
+.tripal_toc_list_item  {
+  padding: 3px 20px 3px 0px !important;
   margin: 2px 0 2px 0 !important;
 }
 
@@ -111,20 +111,31 @@
  * |                                               |
  * |-----------------------------------------------|
  */
+.tripal-data-block {
+   padding: 0;
+   margin:  0;
+}
 .tripal-info-box {
    width: 100%;
-   padding-bottom: 10px;
 }
 
 .tripal-info-box-title {
   font-size: 1.5em;
-  padding-bottom: 15px;
+  padding-bottom: 5px;
 }
 
 .tripal-info-box-desc {
-
+  margin-bottom: 10px;
 }
 
+/**
+ * Within the block data 
+ */
+ .tripal-data-table {
+   margin-top: 0px;
+   margin-bottom: 10px;
+ }
+
 /******************************************************************************
  * 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.
@@ -179,6 +190,11 @@
   background-image: url("../images/TripalLogo-sm.png");
   background-repeat: no-repeat;
   background-color: #cce3ff;
+  margin-top: 10px;
+  margin-bottom: 10px;
+  border: 1px solid #888888;
+  min-height: 50px;
+  clear: both;
 }
 
 .tripal-site-admin-message {
@@ -192,4 +208,5 @@
   background-image: none;
   background-color: #cce3ff;
   color: black;
+  clear: both;
 }

+ 11 - 18
tripal_core/theme/node--chado-generic.tpl.php

@@ -5,26 +5,17 @@
 $ttype = $variables['type'];
 $ttype = preg_replace('/chado_/','', $ttype);
 
-// get the template settings
-$template_settings = theme_get_setting('tripal');
-
-// toggle the sidebar if desired
-$no_sidebar = 0;
-if (is_array($template_settings['tripal_no_sidebar']) and 
-   $template_settings['tripal_no_sidebar'][$ttype]) {
-  $no_sidebar = 1;
-}
-
 if ($teaser) { 
   print theme('tripal_' . $ttype . '_teaser', $variables); 
 } 
 else { ?>
 
+
 <script type="text/javascript">
 (function ($) {
   Drupal.behaviors.<?php print $ttype?>Behavior = {
     attach: function (context, settings){ 
-      $(".tripal-info-box").hide();
+      $(".tripal-data-block").hide();
  
       // iterate through all of the info boxes and add their titles
       // to the table of contents
@@ -32,13 +23,13 @@ else { ?>
         var parent = $(this).parent();
         var id = $(parent).attr('id');
         var title = $(this).text();
-        $('#tripal_<?php print $ttype?>_toc_list').append('<li><a href="#'+id+'" class="tripal_<?php print $ttype?>_toc_item">'+title+'</a></li>');
+        $('#tripal_<?php print $ttype?>_toc_list').append('<div class="tripal_toc_list_item"><a href="#'+id+'" class="tripal_<?php print $ttype?>_toc_item">'+title+'</a></div>');
       });
 
       // when a title in the table of contents is clicked, then
       // show the corresponding item in the details box
       $(".tripal_<?php print $ttype?>_toc_item").click(function(){
-        $(".tripal-info-box").hide();
+        $(".tripal-data-block").hide();
         href = $(this).attr('href');
         if(href.match(/^#/)){
            //alert("correct: " + href);
@@ -48,7 +39,7 @@ else { ?>
           href = tmp;
           //alert("fixed: " + href);
         }
-        $(href).fadeIn('slow');
+        $(href).parent().fadeIn('slow');
 
         return false;
       }); 
@@ -60,10 +51,12 @@ else { ?>
         block = window.location.href.match(/[\?|\&]block=(.+)/)
       }
       if(block != null){
-        $("#tripal_<?php print $ttype?>-"+block[1]+"-box").show();
+        var parent =  $("#tripal_<?php print $ttype?>-"+block[1]+"-box").parent();
+        parent.show();
       }
       else {
-        $("#tripal_<?php print $ttype?>-base-box").show();
+        var parent = $("#tripal_<?php print $ttype?>-base-box").parent();
+        parent.show();
       }
     }
   };
@@ -81,7 +74,7 @@ else { ?>
   <table id="tripal-contents-table">
     <tr class="tripal-contents-table-tr">
       <td nowrap class="tripal-contents-table-td tripal-contents-table-td-toc"  align="left">
-        <ul id="tripal_<?php print $ttype?>_toc_list" class="tripal_toc_list">
+        <div id="tripal_<?php print $ttype?>_toc_list" class="tripal_toc_list">
         
          <!-- Resource Links CCK elements --><?php
          if(property_exists($node, 'field_resource_links')) {
@@ -93,7 +86,7 @@ else { ?>
            }
          }
          ?> 
-          </ul>
+          </div>
         </td>
         <td class="tripal-contents-table-td-data" align="left" width="100%">
          <!-- Resource Blocks CCK elements --> <?php

+ 41 - 17
tripal_core/tripal_core.module

@@ -542,6 +542,7 @@ function tripal_core_views_api() {
   );
 }
 
+
 /**
  * After the node is built, we want to add instructions to each
  * content section letting the administrator know which template
@@ -552,26 +553,49 @@ function tripal_core_views_api() {
 function tripal_core_node_view_alter(&$build) {
   global $theme;
 
-
   $cache = cache_get("theme_registry:$theme", 'cache');
-  $paths = array();
-  foreach ($build as $key => $value) {
-    if (preg_match('/^tripal_/', $key)) {
-      if (array_key_exists($key, $cache->data)) {
-        $paths[$key] = $cache->data[$key]['path'];
+  $node = $build['#node'];
+
+  // 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
+  // a table of contents and add administrator and curator messages
+  if (preg_match('/chado_/', $node->type)) {
+
+    // iterate through all the elements of the $build array and for those
+    // with a '#value' add some extra <div> tags
+    foreach ($build as $key => $value) {
+
+      // only examine elements without a '#' prefix
+      if (!preg_match('/^#/', $key)) {
+
+        // get the template path
+        $path = '';
+        if (array_key_exists($key, $cache->data) and array_key_exists('path', $cache->data[$key])) {
+
+          $path = $cache->data[$key]['path'] . '/' . $key . '.tpl.php';
+          $path = theme('tripal_admin_message', array('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
+            site's default theme and edit.  Currently, the content above is provided by
+            this template:
+            <br><br>$path
+          "));
+        }
+
+        // if this element has a #value child then add our div box
+        if (array_key_exists('#value', $build[$key])) {
+          $build[$key]['#value'] = "
+            <div id=\"$key-tripal-data-block\" class=\"tripal-data-block\">" .
+              $build[$key]['#value'] .
+              $path .
+            "</div>";
+
+
+        }
       }
     }
   }
-  if (count($paths) > 0) {
-    $message = '<p>The content displayed on this page is provided by the following templates: <ul>';
-    foreach ($paths as $template => $path) {
-      $message .= "<li>$key: $path</li>";
-    }
-    $message .= "</ul>";
-    $build['tripal_template_paths']['#value'] = theme(
-      'theme_tripal_admin_message',
-      array('message' => $message)
-    );
-  }
 
+  //dpm($build);
+  //dpm($cache);
 }

+ 2 - 25
tripal_organism/theme/css/tripal_organism.css

@@ -1,27 +1,4 @@
-
-#tripal_organism-image-box {
-   float: left;
-   margin-left: 10px;
-   margin-bottom: 10px;
-   margin-right: 10px;
-   width: auto;
-}
-#tripal_organism-image-box img {
-   max-height: 200px;
-}
-
-#tripal_organism-base-box {
-   float: left;
-}
-#tripal_organism-description-box {
-   clear: left;
-   width: auto;
-}
-
 #tripal_organism-base-box img {
- float: left;
- margin-bottom: 5px;
- margin-right: 10px;
- margin-top: 5px;
-
+  float: left;
+  margin: 0px 10px 0px 0px;
 }

+ 2 - 5
tripal_organism/theme/tripal_organism/tripal_organism_base.tpl.php

@@ -69,12 +69,8 @@ $organism = tripal_core_expand_chado_vars($organism,'field','organism.comment');
       array(
         'data' => 'Organism ID',
         'header' => TRUE,
-        'class' => 'tripal-site-admin-only-noimg'
-      ),
-      array(
-        'data' => $organism->organism_id,
-        'class' => 'tripal-site-admin-only-noimg'
       ),
+       $organism->organism_id,
     );
   }
 
@@ -87,6 +83,7 @@ $organism = tripal_core_expand_chado_vars($organism,'field','organism.comment');
     'rows' => $rows, 
     'attributes' => array(
       'id' => 'tripal_organism-table-base',
+      'class' => 'tripal-organism-data-table tripal-data-table',
     ), 
     'sticky' => FALSE,
     'caption' => '',