Browse Source

Updated node template CSS... working on adding node template details on each content block

Stephen Ficklin 11 years ago
parent
commit
7069e91cb2

+ 26 - 7
tripal_analysis/includes/tripal_analysis.chado_node.inc

@@ -613,17 +613,36 @@ function tripal_analysis_node_view($node, $view_mode, $langcode) {
  * @param $node
  * @param $node
  */
  */
 function tripal_analysis_node_presave($node) {
 function tripal_analysis_node_presave($node) {
-  // If this is an analysis of some type it will should have thre three required
+  // If this is an analysis of some type it will should have three required
   // fields for the Chado analysis table: program, programversion and sourcename.
   // fields for the Chado analysis table: program, programversion and sourcename.
-  // So we will set the title for any node that has these three fields
+  // So we will set the title for any node that has these three fields. Some extension
+  // modules will use this module as a type of "inherited" class, so we don't know
+  // for sure when type of analysis we have.
   if (property_exists($node, 'program') and
   if (property_exists($node, 'program') and
-  property_exists($node, 'programversion') and
-  property_exists($node, 'sourcename')) {
-    if ($node->analysisname) {
-      $node->title = $node->analysisname;
+      property_exists($node, 'programversion') and
+      property_exists($node, 'sourcename')) {
+    $name = '';
+    $program = '';
+    $programversion = '';
+    $sourcename = '';
+    if (property_exists($node, 'analysis')) {
+      $name           = $node->analysis->name;
+      $program        = $node->analysis->program;
+      $programversion = $node->analysis->programversion;
+      $sourcename     = $node->analysis->sourcename;
     }
     }
     else {
     else {
-      $node->title = "$node->program ($node->programversion) $node->sourcename";
+      $name           = $node->analysisname;
+      $program        = $node->program;
+      $programversion = $node->programversion;
+      $sourcename     = $node->sourcename;
+    }
+    // now construct the title
+    if ($name) {
+      $node->title = $name;
+    }
+    else {
+      $node->title = "$program ($programversion) $sourcename";
     }
     }
   }
   }
 }
 }

+ 26 - 0
tripal_core/api/tripal_core.chado_general.api.inc

@@ -246,3 +246,29 @@ function tripal_core_get_max_chado_rank($tablename, $where_options) {
   }
   }
 
 
 }
 }
+
+/**
+ * Use this function to encapsulate text intended to be 
+ * visible only by the site administrator. A small tripal logo
+ * appears alongside the text.  Do not call this function directly, but
+ * rather, use the theme() function:
+ * 
+ *   theme('tripal_admin_message', array('message' => $my_message));
+ * 
+ * @param $message
+ *   The message to be displayed to the site administrator
+ * 
+ * @ingroup tripal_chado_api
+ */
+function theme_tripal_admin_message($variables) {
+  
+  $message = $variables['message'];
+  
+  if (!user_access('access administration pages')) {
+    return ''; 
+  }
+  return "
+    <div class=\"tripal-site-admin-only\">
+      <div class=\"tripal-site-admin-message\">$message</div>
+    </div>";
+}

+ 1 - 1
tripal_core/api/tripal_core.chado_nodes.api.inc

@@ -565,7 +565,7 @@ function tripal_core_chado_node_sync_records($base_table, $max_sync = FALSE, $or
         $new_node->type = 'chado_' . $base_table;
         $new_node->type = 'chado_' . $base_table;
         $new_node->uid = $user->uid;
         $new_node->uid = $user->uid;
         $new_node->{$base_table_id} = $record->{$base_table_id};
         $new_node->{$base_table_id} = $record->{$base_table_id};
-        $new_node->library = $record;
+        $new_node->$base_table = $record;
 
 
         // TODO: should we get rid of this hook and use hook_node_presave() instead?
         // TODO: should we get rid of this hook and use hook_node_presave() instead?
         // allow base module to set additional fields as needed
         // allow base module to set additional fields as needed

+ 142 - 122
tripal_core/theme/css/tripal.css

@@ -1,152 +1,146 @@
-.tripal-info-box {
-   width: 100%;
-   padding-bottom: 10px;
-}
-
-.tripal-info-box-nosidebar {
-   width: 100%;
-   padding-bottom: 10px;
-}
-
-.tripal-info-box-title {
-  font-size: 1.5em;
-  padding-bottom: 15px;
-}
-
-.tripal-info-box-title-nosidebar {
-  font-size: 1.5em;
-  padding-bottom: 15px;
-}
-
-.tripal-info-box-desc {
-  /* padding-bottom: 15px; */
-}
-/* hide the title when inside of a block on a panel */
-.pane-block .tripal-info-box-title {
-   visibility: hidden;
-   padding: 0;
-   margin: 0;
-   height: 0px;
-}
-
-/* no results message */
-.tripal-no-results {
-   font-style: italic;
-   padding: 10px;
-   background-color: #FFEEEE;
-}
 /**
 /**
- * Tripal Contents container: contains both the details 
- * section and the resources sidebar
+ * The Tripal generic node template (node--chado-generc.tpl.php)
+ * has an outer div box with class 'tripal-contents' and with an inner 
+ * table with an id of 'tripal-contents-table'.  The table has a single
+ * row with two columns.  The smaller left column houses the table of 
+ * contents (TOC) for the node data.  The larger right column houses the data:
+ *
+ * |-----------------------------------------------|
+ * |  .tripal-contents                             |
+ * | |-------------------------------------------| |
+ * | | #tripal-contents-table                    | |
+ * | |        |                                  | |
+ * | |        |                                  | |
+ * | | TOC    |          Data                    | |
+ * | | column |          Column                  | |
+ * | |        |                                  | |
+ * | |        |                                  | |
+ * | |        |                                  | |
+ * | |-------------------------------------------| |
+ * |-----------------------------------------------|
+ *
+ * The tripal-contents box and the inner table are designed to fill the width
+ * of the contents section of any theme.  Customize the CSS below to change
+ * the look-and-feel.
+ *
  */
  */
-.tripal_contents {
+
+.tripal-contents {
   width: 100%;
   width: 100%;
-  position: relative;
 }
 }
 
 
-#tripal_contents_table {
+#tripal-contents_table {
   padding: 0px !important;
   padding: 0px !important;
-  margin: 0px !important;
+  margin:  0px !important;
 }
 }
 
 
-#tripal_contents_table tbody {
+/**
+ * The table formatting must override the default theme.  This is because
+ * the table is meant for organizing the sidebar and contents so they don't
+ * slip and slide around as would happen with div boxes that were floated.
+ * Therefore, we use !important to keep the default theme from overrideing
+ * the table settings. 
+ */
+ 
+#tripal-contents-table tbody {
   padding: 0px !important;
   padding: 0px !important;
-  margin: 0px !important;
-  border: 0px solid #FFFFFF;
+  margin:  0px !important;
+  border:  none !important;
+  background-color: transparent !important;
 }
 }
-
-.tripal_contents_table_td { 
-  border: 0px solid #FFFFFF !important;
-  text-align: left;
-  vertical-align: top;
-  padding: 0px 0px 0px 20px;
+.tripal-contents-table-tr {
+  padding: 0px !important;
+  margin:  0px !important;
+  border:  none !important;
+  background-color: transparent !important;
 }
 }
-.tripal_contents_table_td_toc { 
+.tripal-contents-table-td-toc { 
   border: 1px solid #888888 !important;
   border: 1px solid #888888 !important;
+  margin:  0px !important;
   padding: 10px !important;
   padding: 10px !important;
-  background: none repeat scroll 0 0 rgba(0, 0, 0, 0.063);
-}
-.tripal_contents_table_tr {
-background-color: transparent;
+  background-color: transparent !important;
+  text-align: left !important;
+  vertical-align: top !important;
+}
+.tripal-contents-table-td-data { 
+  border: none !important;
+  margin:  0px !important;
+  padding: 0px 0px 0px 20px !important;
+  background-color: transparent !important;
+  text-align: left !important;
+  vertical-align: top !important;
 }
 }
 
 
 /**
 /**
- * Resources Sidebar
+ * The table of contents is an unordered list. The following can are used
+ * to style the list 
  */
  */
-.tripal_toc {
-  padding: 0px; 
-  margin-right: 0px;
-}
-.tripal_toc ul {
-  margin: 0 !important;
-  padding: 0 !important;
-  list-style-type: none;
-}
-.tripal_toc li {
-  /*
-  background-color: #EEEEEE;
-  border-style:solid;
-  border-width:1px;
-  border-color: #999999;  */
-  padding: 3px 20px 3px 10px;
-  margin: 2px 0 2px 0;
-}
-.tripal_toc_title {
-  font-size: 1.5em;
-  line-height: 110%;
-  padding-bottom: 10px;
-}
-.tripal_toc_desc {
+.tripal_toc_list ul {
+
 }
 }
-/**
- * Details Section
- */
-.tripal_details {
-  min-height: 400px;
-  overflow:auto;
+.tripal_toc_list li {
+  padding: 3px 20px 3px 10px !important;
+  margin: 2px 0 2px 0 !important;
 }
 }
 
 
-.tripal_details_full {
-  float: left;
-  background-color: #FFFFFF;
-
-  -moz-border-radius: 15px;
-  -webkit-border-radius: 15px;
-  -khtml-border-radius: 15px;
-  border-radius: 15px;
-
-  -moz-box-shadow: 3px 3px 4px #888888;
-  -webkit-box-shadow: 3px 3px 4px #888888;
-  box-shadow: 3px 3px 4px #888888;
-  padding: 20px;
-  min-height: 500px;
-  margin-right: 10px;
-  margin-bottom: 10px;
-  border-style:solid;
-  border-width:1px;
-  
-  overflow:auto;
-}
-/**
- * Tables
+/******************************************************************************
+ * 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.
+ *
+ * By default, all blocks 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 
+ * 'tripal-info-box-desc' 
+ *
+ * |-----------------------------------------------|
+ * |  .tripal-info-box                             |
+ * | |-------------------------------------------| |
+ * | | .tripal-info-box-title                    | |
+ * | |-------------------------------------------| |
+ * | | .tripal-info-box-desc                     | |
+ * | |-------------------------------------------| |
+ * |                                               |
+ * | (Block data goes here)                        |
+ * |                                               |
+ * |                                               |
+ * |                                               |
+ * |                                               |
+ * |-----------------------------------------------|
  */
  */
-.tripal-subtable {
-  border-collapse:collapse;
-  border: 0px solid black;
-  width: auto;
+.tripal-info-box {
+   width: 100%;
+   padding-bottom: 10px;
 }
 }
 
 
-.tripal-subtable td {
-  padding: 0px 5px 5px 0px; 
-  border: 0px solid black;
+.tripal-info-box-title {
+  font-size: 1.5em;
+  padding-bottom: 15px;
 }
 }
 
 
-.tripal-notice {
-  color: red;
+.tripal-info-box-desc {
+
 }
 }
 
 
-/**
- * Teaser
+/******************************************************************************
+ * 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
+ * classes
+ *
+ * |-----------------------------------------------|
+ * |  .tripal-teaser                               |
+ * | |-------------------------------------------| |
+ * | | .tripal-teaser-title                      | |
+ * | |-------------------------------------------| |
+ * | | .tripal-teaser-text                       | |
+ * | |                                           | |
+ * | |-------------------------------------------| |
+ * |-----------------------------------------------|
  */
  */
 .tripal-teaser {
 .tripal-teaser {
   clear_both;
   clear_both;
@@ -160,9 +154,35 @@ background-color: transparent;
   text-align: justify;
   text-align: justify;
   text-justify:inter-word;
   text-justify:inter-word;
 }
 }
+
+/**
+ * some nodes such as the organism node may have images. This class
+ * is used to format any image that appears in the teaser 
+ */
 .tripal-teaser-img {
 .tripal-teaser-img {
   width: 100px; 
   width: 100px; 
   float: left; 
   float: left; 
   padding-right: 10px; 
   padding-right: 10px; 
   padding-bottom: 5px;
   padding-bottom: 5px;
 }
 }
+
+/******************************************************************************
+ * Administrative CSS classes
+ *****************************************************************************/
+ 
+ /**
+  * This class is used when providing hints or other instructions to the 
+  * site administrator
+  */ 
+ 
+.tripal-site-admin-only {
+   background-image: url("../images/TripalLogo-sm.png");
+   background-repeat: no-repeat;
+   background-color: #BBBBFF;
+}
+
+.tripal-site-admin-message {
+   padding: 10px 10px 10px 55px;
+   font-style: italic;
+}
+

+ 36 - 50
tripal_core/theme/node--chado-generic.tpl.php

@@ -23,17 +23,8 @@ else { ?>
 <script type="text/javascript">
 <script type="text/javascript">
 (function ($) {
 (function ($) {
   Drupal.behaviors.<?php print $ttype?>Behavior = {
   Drupal.behaviors.<?php print $ttype?>Behavior = {
-    attach: function (context, settings){ <?php
-      // hide the resource sidbar if requested and strech the details section
-      if ($no_sidebar) { ?>    
-        $(".tripal_toc").hide();
-        $(".tripal_details").addClass("tripal_details_full");
-        $(".tripal_details_full").removeClass("tripal_details"); <?php
-      } 
-      // use default resource sidebar
-      else { ?>        
-        $(".tripal-info-box").hide(); <?php
-      } ?>
+    attach: function (context, settings){ 
+      $(".tripal-info-box").hide();
  
  
       // iterate through all of the info boxes and add their titles
       // iterate through all of the info boxes and add their titles
       // to the table of contents
       // to the table of contents
@@ -79,7 +70,7 @@ else { ?>
 })(jQuery);
 })(jQuery);
 </script>
 </script>
 
 
-<div id="tripal_<?php print $ttype?>_content" class="tripal_contents"> <?php 
+<div id="tripal_<?php print $ttype?>_content" class="tripal-contents"> <?php 
   if ($page['tripal_sidebar']) { ?>
   if ($page['tripal_sidebar']) { ?>
     <div id="tripal-sidebar" class="column sidebar">
     <div id="tripal-sidebar" class="column sidebar">
       <div class="section">
       <div class="section">
@@ -87,48 +78,43 @@ else { ?>
       </div>
       </div>
     </div><?php 
     </div><?php 
   } ?>
   } ?>
-  <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">
-        <div id="tripal_<?php print $ttype?>_toc" class="tripal_toc">
-          <ul id="tripal_<?php print $ttype?>_toc_list" class="tripal_toc_list">
-          
-           <!-- Resource Links CCK elements --><?php
-           if(property_exists($node, 'field_resource_links')) {
-             for($i = 0; $i < count($node->field_resource_links); $i++){
-               if($node->field_resource_links[$i]['value']){
-                 $matches = preg_split("/\|/",$node->field_resource_links[$i]['value']);?>
-                 <li><a href="<?php print $matches[1] ?>" target="_blank"><?php print $matches[0] ?></a></li><?php
-               }
+  <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">
+        
+         <!-- Resource Links CCK elements --><?php
+         if(property_exists($node, 'field_resource_links')) {
+           for($i = 0; $i < count($node->field_resource_links); $i++){
+             if($node->field_resource_links[$i]['value']){
+               $matches = preg_split("/\|/",$node->field_resource_links[$i]['value']);?>
+               <li><a href="<?php print $matches[1] ?>" target="_blank"><?php print $matches[0] ?></a></li><?php
              }
              }
            }
            }
-           ?> 
-            </ul>
-          </div>
+         }
+         ?> 
+          </ul>
         </td>
         </td>
-        <td class="tripal_contents_table_td" align="left" width="100%">
-          <div id="tripal_<?php print $ttype?>_details" class="tripal_details">
-        
-           <!-- Resource Blocks CCK elements --> <?php
-           if (property_exists($node, 'field_resource_titles')) {
-             for ($i = 0; $i < count($node->field_resource_titles); $i++){
-               if ($node->field_resource_titles[$i]['value']){ ?>
-                 <div id="tripal_<?php print $ttype?>-resource_<?php print $i?>-box" class="tripal_<?php print $ttype?>-info-box tripal-info-box">
-                   <div class="tripal_<?php print $ttype?>-info-box-title tripal-info-box-title"><?php print $node->field_resource_titles[$i]['value'] ?></div>
-                   <?php print $node->field_resource_blocks[$i]['value']; ?>
-                 </div> <?php
-               }
-             } 
-           }?>
-           <!-- Let modules add more content -->
-           <?php
-             foreach ($content as $key => $values) {
-               if (array_key_exists('#value', $values)) {
-                 print $content[$key]['#value'];
-               }
+        <td class="tripal-contents-table-td-data" align="left" width="100%">
+         <!-- Resource Blocks CCK elements --> <?php
+         if (property_exists($node, 'field_resource_titles')) {
+           for ($i = 0; $i < count($node->field_resource_titles); $i++){
+             if ($node->field_resource_titles[$i]['value']){ ?>
+               <div id="tripal_<?php print $ttype?>-resource_<?php print $i?>-box" class="tripal_<?php print $ttype?>-info-box tripal-info-box">
+                 <div class="tripal_<?php print $ttype?>-info-box-title tripal-info-box-title"><?php print $node->field_resource_titles[$i]['value'] ?></div>
+                 <?php print $node->field_resource_blocks[$i]['value']; ?>
+               </div> <?php
              }
              }
-           ?>
-        </div>
+           } 
+         }?>
+         <!-- Let modules add more content -->
+         <?php
+           foreach ($content as $key => $values) {
+             if (array_key_exists('#value', $values)) {
+               print $content[$key]['#value'];
+             }
+           }
+         ?>
       </td>
       </td>
     </tr>
     </tr>
   </table>
   </table>

+ 42 - 2
tripal_core/tripal_core.module

@@ -453,9 +453,17 @@ function tripal_core_theme($existing, $type, $theme, $path) {
       'function' => 'theme_chado_node_relationships_form_table',
       'function' => 'theme_chado_node_relationships_form_table',
       'render element' => 'element',
       'render element' => 'element',
     ),
     ),
+    
+    // Admin messages theme
+    // --------------------------------
+    'tripal_admin_message' => array(
+      'function' => 'theme_tripal_admin_message',
+      'variables' => array('message' => NULL),
+    )
   );
   );
 }
 }
 
 
+
 /**
 /**
  * Implements hook_job_describe_args().
  * Implements hook_job_describe_args().
  * Describes the arguements for the tripal_update_mview job to allow for greater
  * Describes the arguements for the tripal_update_mview job to allow for greater
@@ -526,5 +534,37 @@ 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
+ * they can customize
+ * 
+ * @param unknown $build
+ */
+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'];
+      }
+    }
+  }
+  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);
+}

+ 24 - 2
tripal_feature/includes/tripal_feature.chado_node.inc

@@ -630,9 +630,31 @@ function tripal_feature_node_presave($node) {
   // set the title to ensure it is always unique
   // set the title to ensure it is always unique
   switch ($node->type) {
   switch ($node->type) {
     case 'chado_feature':
     case 'chado_feature':
-      $values = array('organism_id' => $node->organism_id);
+      // for a form submission the fields part of the node object
+      // but for a sync the feilds are in an object of the node
+      $name = '';
+      $uname = '';
+      $type = ''; 
+      $organism_id = null;
+      if(property_exists($node, 'feature')) {
+        $organism_id = $node->feature->organism_id;
+        $name        = $node->feature->name;
+        $uname       = $node->feature->uniquname;
+        $type_id     = $node->feature->type_id;
+        $values = array('cvterm_id' => $type_id);
+        $ftype = tripal_core_chado_select('cv', array('name'), $values);
+        $type = $ftype[0]->name;
+        
+      }
+      else {
+        $organism_id = $node->organism_id;
+        $name = $node->name;
+        $uname = $node->uniquname;
+        $type = $node->feature_type;
+      }
+      $values = array('organism_id' => $organism_id);
       $organism = tripal_core_chado_select('organism', array('genus', 'species'), $values);
       $organism = tripal_core_chado_select('organism', array('genus', 'species'), $values);
-      $node->title = $node->fname . ', ' . $node->uniquename . ' (' . $node->feature_type . ') ' . $organism[0]->genus . ' ' . $organism[0]->species;
+      $node->title = $fname . ', ' . $uniquename . ' (' . $type . ') ' . $organism[0]->genus . ' ' . $organism[0]->species;
       break;
       break;
   }
   }
 }
 }

+ 5 - 9
tripal_feature/includes/tripal_feature.seq_extract.inc

@@ -38,16 +38,12 @@ function tripal_feature_seq_extract_page() {
   // generate the search form 
   // generate the search form 
   $output .= '';
   $output .= '';
   if (user_access('access administration pages')) { 
   if (user_access('access administration pages')) { 
-    $output .= "
-      <div class=\"tripal-no-results\">
-        <p>Administrators, the " . l('organism_feature_count', 'admin/tripal/mviews') . " and 
-        " . l('analysis_organism', 'admin/tripal/mviews') . " materialized
+    $output .= theme('tripal_admin_message', array('message' => "
+        Administrators, the " . l('organism_feature_count', 'admin/tripal/schema/mviews') . " and 
+        " . l('analysis_organism', 'admin/tripal/schema/mviews') . " materialized
         views must be populated before using this form.  Those views should be re-populated 
         views must be populated before using this form.  Those views should be re-populated 
-        when new data is added.  If you use the " . l('jquery_update module', 'http://drupal.org/project/jquery_update') . ", it may break this form.
-        You will need to update the  jquery_update/replace/jquery.form.js file with " .
-        l('a more recent version', 'https://raw.github.com/malsup/form/master/jquery.form.js') . "</p>         
-      </div>
-    ";
+        when new data is added."
+    ));
   }
   }
   $output .= "<div id=\"tripal-feature-seq-extract-form-block\">";
   $output .= "<div id=\"tripal-feature-seq-extract-form-block\">";
   $output .= drupal_get_form('tripal_feature_seq_extract_form');  
   $output .= drupal_get_form('tripal_feature_seq_extract_form');  

+ 31 - 36
tripal_feature/theme/tripal_organism/tripal_organism_feature_browser.tpl.php

@@ -73,12 +73,11 @@ if ($enabled) {
       $rows = array();
       $rows = array();
       
       
       // let admins know they can customize the terms that appear in the list
       // let admins know they can customize the terms that appear in the list
-      if (user_access('access administration pages')) { ?>
-         <div class="tripal-no-results">Administrators, you can specify the feature types
-         that should appear in this browser or remove it from the list of resources by navigating to the 
-         <?php print l("Tripal feature settings page", "admin/tripal/chado/tripal_feature/configuration", array('attributes' => array('target' => '_blank'))) ?>.  
-         </div><?php 
-      }
+      print theme('tripal_admin_message', array('message' => "
+        Administrators, you can specify the feature types that should appear in 
+        this browser or remove it from the list of resources by navigating to the ". 
+        l("Tripal feature settings page", "admin/tripal/chado/tripal_feature/configuration", array('attributes' => array('target' => '_blank')))
+      ));
       
       
       foreach ($features as $feature){
       foreach ($features as $feature){
         $fname =  $feature->name;
         $fname =  $feature->name;
@@ -127,36 +126,32 @@ if ($enabled) {
       print theme_pager($pager); ?>
       print theme_pager($pager); ?>
     </div> <?php
     </div> <?php
   } 
   } 
-  else {
-    // if there are no results and this is the admin user then show some instructions
-    // otherwise nothing is shown.
-    if(user_access('access administration pages')){ ?>
-      <div id="tripal_organism-feature_browser-box" class="tripal_organism-info-box tripal-info-box">
-        <div class="tripal_organism-info-box-title tripal-info-box-title">Feature Browser</div>
-        <div class="tripal-no-results">
-          There are no features available for browsing
-          <p><br>Administrators, perform the following to show features in this browser:
-          <ul>
-            <li>Load features for this organism using the 
-            <?php print l("FASTA loader", 'admin/tripal/loaders/fasta_loader'); ?>, 
-            <?php print l("GFF Loader",   'admin/tripal/loaders/gff3_load'); ?> or 
-            <?php print l("Bulk Loader",  'admin/tripal/loaders/bulk'); ?></li>
-            <li>Sync the features that should have pages using the 
-            <?php print l("Sync features page", 'admin/tripal/chado/tripal_feature/sync');?></li>
-            <li>Return to this page to browse features.</li>
-            <li>Ensure the user 
-            <?php print l("has permission", 'admin/people/permissions'); ?> to view the feature content</li>
-          </ul> 
-          <br>
-          <br>
-          You can specify the feature types
-          that should appear in this browser or remove it from the list of resources by navigating to the 
-          <?php print l("Tripal feature settings page", "admin/tripal/chado/tripal_feature/configuration", array('attributes' => array('target' => '_blank'))) ?>.
-          </p>
-          The feature browser will not appear to site visitors unless features are present.  These instructions only appear to site administrators.
-        </div>         
-      </div><?php
-    }
+  else {  ?>
+    <div id="tripal_organism-feature_browser-box" class="tripal_organism-info-box tripal-info-box">
+      <div class="tripal_organism-info-box-title tripal-info-box-title">Feature Browser</div>
+      <p>There are no results.</p><?php
+      print theme('tripal_admin_message', array('message' => "
+        Administrators, perform the following to show features in this browser:
+        <ul>
+          <li>Load features for this organism using the " .
+            l("FASTA loader", 'admin/tripal/loaders/fasta_loader') . ",  ".
+            l("GFF Loader",   'admin/tripal/loaders/gff3_load') . " or ".
+            l("Bulk Loader",  'admin/tripal/loaders/bulk'). "</li>
+          <li>Sync the features that should have pages using the ".
+            l("Sync features page", 'admin/tripal/chado/tripal_feature/sync'). "</li>
+          <li>Return to this page to browse features.</li>
+          <li>Ensure the user " .
+           l("has permission", 'admin/people/permissions') . " to view the feature content</li>
+        </ul>
+        <br>
+        <br>
+        You can specify the feature types
+        that should appear in this browser or remove it from the list of resources by navigating to the " . 
+        l("Tripal feature settings page", "admin/tripal/chado/tripal_feature/configuration", array('attributes' => array('target' => '_blank')))  . "
+        </p>
+        The feature browser will not appear to site visitors unless features are present. "
+      )); ?>
+    </div><?php
   }
   }
 }
 }
 
 

+ 19 - 17
tripal_feature/theme/tripal_organism/tripal_organism_feature_counts.tpl.php

@@ -17,14 +17,17 @@ if ($enabled) {
       <div class="tripal_organism-info-box-title tripal-info-box-title">Data Type Summary</div>
       <div class="tripal_organism-info-box-title tripal-info-box-title">Data Type Summary</div>
       <div class="tripal_organism-info-box-desc tripal-info-box-desc">The following data types are currently present for this organism</div> <?php
       <div class="tripal_organism-info-box-desc tripal-info-box-desc">The following data types are currently present for this organism</div> <?php
       // let admins know they can customize the terms that appear in the list
       // let admins know they can customize the terms that appear in the list
-      if (user_access('access administration pages')) { ?>
-         <div class="tripal-no-results">Administrators, you can customize the types of terms that appear in this report by 
-         navigating to the <a href="<?php print url('admin/tripal/tripal_feature/configuration') ?>">Tripal 
-         feature configuration page</a> opening the section "Feature Summary Report" and adding the list of
-         terms you want to appear in the list. You can rename terms as well.  To disable this report and 
-         remove it from the list of resources, navigate to the <a href="<?php print url('admin/tripal/tripal_feature/configuration') ?>">Tripal feature configuration page</a> 
-         and hide the "Feature Summary". To refresh the data,re-populate the <a href="<?php print url('admin/tripal/mviews');?>" target="_blank">organism_feature_count</a> materialized view. 
-         </div><?php 
+      if (user_access('access administration pages')) { 
+         print theme('tripal_admin_message', array('message' => "
+           Administrators, you can customize the types of terms that appear in this report by 
+           navigating to the " . l('Tripal feature configuration page', 'admin/tripal/chado/tripal_feature/configuration') . "
+           opening the section \"Feature Summary Report\" and adding the list of
+           terms you want to appear in the list. You can rename terms as well.  To disable this report and 
+           remove it from the list of resources, navigate to the " . 
+           l('Tripal feature configuration page', 'admin/tripal/tripal_feature/configuration') . "
+           and hide the \"Feature Summary\". To refresh the data,re-populate the " .
+           l('organism_feature_count', 'admin/tripal/schema/mviews') . " materialized view.")
+         ); 
       }?>
       }?>
       <table id="tripal_organism-table-feature_counts" class="tripal_organism-table tripal-table tripal-table-horz">     
       <table id="tripal_organism-table-feature_counts" class="tripal_organism-table tripal-table tripal-table-horz">     
         <tr class="tripal_organism-table-odd-row tripal-table-even-row">
         <tr class="tripal_organism-table-odd-row tripal-table-even-row">
@@ -52,20 +55,19 @@ if ($enabled) {
     if (user_access('access administration pages')) { ?>
     if (user_access('access administration pages')) { ?>
       <div id="tripal_organism-feature_counts-box" class="tripal_organism-info-box tripal-info-box">
       <div id="tripal_organism-feature_counts-box" class="tripal_organism-info-box tripal-info-box">
         <div class="tripal_organism-info-box-title tripal-info-box-title">Data Type Summary</div>
         <div class="tripal_organism-info-box-title tripal-info-box-title">Data Type Summary</div>
-        <div class="tripal_organism-info-box-desc tripal-info-box-desc">The following data types are currently present for this organism</div>
-        <div class="tripal-no-results">There are no features available.
-           <p><br>Administrators, to view the feature type report:
+        <div class="tripal_organism-info-box-desc tripal-info-box-desc">The following data types are currently present for this organism</div> <?php 
+        print theme('tripal_admin_message', array('message' => "
+           Administrators, to view the feature type report:
            <ul>
            <ul>
-              <li>Populate the <a href="<?php print url('admin/tripal/mviews');?>" target="_blank">organism_feature_count</a> materialized view</li>
+              <li>Populate the " . l('organism_feature_count', 'admin/tripal/schema/mviews') ." materialized view</li>
               <li>Refresh this page</li>
               <li>Refresh this page</li>
            </ul> 
            </ul> 
-           <br><br>To disable this report and remove it from the list of resources:
+           To disable this report and remove it from the list of resources:
            <ul>
            <ul>
-             <li>Navigate to the <a href="<?php print url('admin/tripal/tripal_feature/configuration') ?>">Tripal feature configuration page</a> and hide the "Feature Summary"</li>
+             <li>Navigate to the " . l('Tripal feature configuration page', 'admin/tripal/chado/tripal_feature/configuration') ." and hide the \"Feature Summary\"</li>
             </ul>
             </ul>
-           </p>
-           This page will not appear to site visitors unless features are present. 
-         </div>
+           </p>")
+        ); ?> 
       </div><?php               
       </div><?php               
     }
     }
   }
   }

+ 9 - 4
tripal_featuremap/includes/tripal_featuremap.chado_node.inc

@@ -424,10 +424,15 @@ function chado_featuremap_delete(&$node) {
  * @param $node
  * @param $node
  */
  */
 function tripal_featuremap_node_presave($node) {
 function tripal_featuremap_node_presave($node) {
-  // if this is a chado_featuremap and the $node->featuremap object is set then we
-  // are syncing and we want to set the node title to be the same as the node name
-  if ($node->type == 'chado_featuremap' and property_exists($node, 'featuremap')) {
-    $node->title = $node->featuremap->name;
+  if ($node->type == 'chado_featuremap') {
+    // for a form submission the fields part of the node object
+    // but for a sync the feilds are in an object of the node
+    if(property_exists($node, 'featuremap')) {
+      $node->title = $node->featuremap->name;
+    }
+    else {
+      // the title is already set in the form
+    }
   }
   }
 }
 }
 /**
 /**

+ 12 - 4
tripal_library/includes/tripal_library.chado_node.inc

@@ -436,9 +436,17 @@ function tripal_library_node_view($node, $view_mode, $langcode) {
  * @param $node
  * @param $node
  */
  */
 function tripal_library_node_presave($node) {
 function tripal_library_node_presave($node) {
-  // if this is a chado_library and the $node->library object is set then we
-  // are syncing and we want to set the node title to be the same as the node name
-  if ($node->type == 'chado_library' and property_exists($node, 'library')) {
-    $node->title = $node->library->name;
+  switch ($node->type) {
+    case 'chado_library':
+      // for a form submission the fields part of the node object
+      // but for a sync the feilds are in an object of the node
+      if(property_exists($node, 'library')) {
+        // set the title
+        $node->title = $node->name;
+      } 
+      else {
+        // the title field is already in the form
+      }
+      break;
   }
   }
 }
 }

+ 8 - 2
tripal_library/tripal_library.install

@@ -154,8 +154,14 @@ function tripal_library_add_mview_library_feature_count(){
  * Adds new CV's used by this module
  * Adds new CV's used by this module
  */
  */
 function tripal_library_add_cvs(){
 function tripal_library_add_cvs(){
-  tripal_cv_add_cv('library_property', 'Contains properties for libraries');
-  tripal_cv_add_cv('library_type', 'Contains terms for types of libraries (e.g. BAC, cDNA, FOSMID, etc).');
+  tripal_cv_add_cv(
+    'library_property', 
+    'Contains properties for libraries'
+  );
+  tripal_cv_add_cv(
+    'library_type', 
+    'Contains terms for types of libraries (e.g. BAC, cDNA, FOSMID, etc).'
+  );
 }
 }
 /**
 /**
  * @ingroup tripal_library
  * @ingroup tripal_library

+ 1 - 1
tripal_organism/api/tripal_organism.api.inc

@@ -1,7 +1,7 @@
 <?php
 <?php
 
 
 /**
 /**
- * @defgroup tripal_library_api Organism API
+ * @defgroup tripal_organism_api Organism API
  * @ingroup tripal_api
  * @ingroup tripal_api
  * @{
  * @{
  * Provides an application programming interface (API) to manage organisms
  * Provides an application programming interface (API) to manage organisms

+ 15 - 6
tripal_organism/includes/tripal_organism.chado_node.inc

@@ -260,13 +260,14 @@ function chado_organism_delete($node) {
   $check_feature = chado_query($sql, array(':organism_id' => $organism_id))->fetchObject();
   $check_feature = chado_query($sql, array(':organism_id' => $organism_id))->fetchObject();
   $sql = "SELECT library_id FROM {library} WHERE organism_id = :organism_id";
   $sql = "SELECT library_id FROM {library} WHERE organism_id = :organism_id";
   $check_lib = chado_query($sql, array(':organism_id' => $organism_id))->fetchObject();
   $check_lib = chado_query($sql, array(':organism_id' => $organism_id))->fetchObject();
-
-  if (!$check_lib && !$check_feature) {
+  $sql = "SELECT stock_id FROM {stock} WHERE organism_id = :organism_id";
+  $check_stock = chado_query($sql, array(':organism_id' => $organism_id))->fetchObject();
+  
+  if (!$check_lib && !$check_feature && !$check_stock) {
     tripal_core_chado_delete('organism', array('organism_id' => $organism_id));
     tripal_core_chado_delete('organism', array('organism_id' => $organism_id));
   }
   }
   else {
   else {
-    drupal_set_message(t("Organism deleted from drupal. Warning: at least one " .
-        "library or feature depends on this organism. It was not removed from chado."));
+    drupal_set_message(t("Warning: other data depends on this organism. The organism page was removed from this site but the organism was removed from Chado."), 'warning');
   }
   }
 }
 }
 
 
@@ -412,8 +413,16 @@ function chado_organism_load($nodes) {
 function tripal_organism_node_presave($node) {
 function tripal_organism_node_presave($node) {
   switch ($node->type) {
   switch ($node->type) {
     case 'chado_organism':
     case 'chado_organism':
-      // set the title for the node
-      $node->title = "$node->genus $node->species";
+      // for a form submission the fields part of the node object
+      // but for a sync the feilds are in an object of the node
+      if(property_exists($node, 'organism')) {
+        // set the title
+        $node->title = $node->organism->genus . " " . $node->organism->species;
+      } 
+      else {
+        // set the title
+        $node->title = $node->genus  . " " . $node->species;
+      }
       break;
       break;
   }
   }
 }
 }

+ 7 - 10
tripal_pub/includes/tripal_pub.pub_search.inc

@@ -159,16 +159,13 @@ function tripal_pub_search_form($form, &$form_state) {
     '#default_value' => $num_criteria,
     '#default_value' => $num_criteria,
   );
   );
   
   
-  if (user_access('access administration pages')) {
-    $form['admin-instructions'] = array(
-      '#prefix' => '<div class="tripal-no-results">',
-      '#markup'  =>  t('Administrators, you can select the fields with which a user can use to search,
-          by checking the desired fields on the ' .
-          l('Publication Module Settings Page', 'admin/tripal/chado/tripal_pub/configuration'). ' in
-         the section titled "Search Options".  The selected fields will appear in the dropdowns below.'),
-      '#suffix' => '</div>'
-    );
-  }
+  $form['admin-instructions'] = array(
+    '#markup'  =>  theme('tripal_admin_message', array('message' => 
+      t('Administrators, you can select the fields with which a user can use to search,
+         by checking the desired fields on the ' .
+         l('Publication Module Settings Page', 'admin/tripal/chado/tripal_pub/configuration'). ' in
+        the section titled "Search Options".  The selected fields will appear in the dropdowns below.'))),
+  ); 
   $form['instructions'] = array(
   $form['instructions'] = array(
     '#markup'  =>  t('To search for publications enter keywords in the text boxes below.  
     '#markup'  =>  t('To search for publications enter keywords in the text boxes below.  
         You can limit your search by selecting the field in the dropdown box. Click the 
         You can limit your search by selecting the field in the dropdown box. Click the 

+ 11 - 2
tripal_stock/includes/tripal_stock.chado_node.inc

@@ -783,7 +783,16 @@ function tripal_stock_node_presave($node) {
 
 
   switch ($node->type) {
   switch ($node->type) {
     case 'chado_stock':
     case 'chado_stock':
-      $values = array('organism_id' => $node->organism_id);
+      // for a form submission the fields part of the node object
+      // but for a sync the feilds are in an object of the node
+      $organism_id = null;
+      if(property_exists($node, 'stock')) {
+        $organism_id = $node->stock->organism_id;
+      }
+      else {
+        $organism_id = $node->organism_id;
+      }
+      $values = array('organism_id' => $organism_id);
       $organism = tripal_core_chado_select('organism', array('genus','species'), $values);
       $organism = tripal_core_chado_select('organism', array('genus','species'), $values);
       $values = array('cvterm_id' => $node->type_id);
       $values = array('cvterm_id' => $node->type_id);
       $cvterm = tripal_core_chado_select('cvterm', array('name'), $values);
       $cvterm = tripal_core_chado_select('cvterm', array('name'), $values);
@@ -873,7 +882,7 @@ function tripal_stock_node_view($node, $view_mode, $langcode) {
     case 'chado_organism':
     case 'chado_organism':
       if ($view_mode == 'full') {
       if ($view_mode == 'full') {
         $node->content['tripal_organism_stocks'] = array(
         $node->content['tripal_organism_stocks'] = array(
-          '#value' => theme('tripal_organism_stocks', $node),
+          '#value' => theme('tripal_organism_stocks', array('node' => $node)),
         );
         );
       }
       }
       break;
       break;