Browse Source

Merge branch '7.x-3.x' into 7.x-3.x-dashboard

Shawna 7 years ago
parent
commit
78880610c6

+ 10 - 5
tripal/tripal.module

@@ -681,6 +681,8 @@ function tripal_block_info() {
  * Implements hook_block_view().
  */
 function tripal_block_view($delta = ''){
+  global $base_path;
+
   // The $delta parameter tells us which block is being requested.
   switch ($delta) {
     case 'powered_by_tripal':
@@ -700,7 +702,7 @@ function tripal_block_view($delta = ''){
 
       $block['title'] = '';
       $block['content'] = array(
-        '#markup' => '<a href="http://tripal.info"><img border="0" src="' . drupal_get_path('module', 'tripal') . '/theme/images/' . $image . '"></a>',
+        '#markup' => '<a href="http://tripal.info"><img border="0" src="' . $base_path . drupal_get_path('module', 'tripal') . '/theme/images/' . $image . '"></a>',
       );
       break;
 
@@ -1003,23 +1005,26 @@ function tripal_html5_file_value($element, $input = FALSE, &$form_state) {
 
 
 /**
- *  Implements hook_field_display_alter().
+ * Implements hook_field_display_alter().
+ *
  * @param $display
  * @param $context
  */
-function tripal_field_display_alter(&$display, $context){
+function tripal_field_display_TripalEntity_alter(&$display, $context){
   $field_name = $context['field']['field_name'];
   $bundle = $context['entity']->bundle;
   $bundle_info = tripal_load_bundle_entity(array('name' => $bundle));
-  $hide_variable = tripal_get_bundle_variable('hide_empty_field', $bundle_info->id, 'hide');
 
+  // Hide fields that are empty, but only if the hide_empty_field variable
+  // is set to 'hide' for this bundel.
+  $hide_variable = tripal_get_bundle_variable('hide_empty_field', $bundle_info->id, 'hide');
   if($hide_variable == 'hide'){
     $item = field_get_items('TripalEntity', $context['entity'], $field_name);
     if($item) {
       $field = field_info_field($field_name);
       if(tripal_field_is_empty($item[0], $field)) {
         // Stop the right rail element from rendering.
-        drupal_add_css('.'.$field_name.' {display:none;}', 'inline');
+        drupal_add_css('.' . $field_name.' {display: none;}', 'inline');
       }
     }
   }

+ 1 - 2
tripal_chado/includes/TripalFields/data__accession/data__accession.inc

@@ -15,8 +15,7 @@ class data__accession extends ChadoField {
   public static $default_label = 'Site Accession';
 
   // The default description for this field.
-  public static $description = 'The unique stable accession (ID) for
-        this record on this site.';
+  public static $description = 'The unique stable accession (ID) for this record on this site.';
 
   // Provide a list of instance specific settings. These can be access within
   // the instanceSettingsForm.  When the instanceSettingsForm is submitted

+ 3 - 3
tripal_chado/includes/TripalImporter/OBOImporter.inc

@@ -183,7 +183,7 @@ class OBOImporter extends TripalImporter {
         '#type'          => 'textfield',
         '#title'         => t('Remote URL'),
         '#description'   => t('Please enter a URL for the online OBO file.  The file will be downloaded and parsed.
-                             (e.g. http://www.obofoundry.org/ro/ro.obo'),
+                             (e.g. http://www.obofoundry.org/ro/ro.obo)'),
         '#default_value' => $uobo_url,
       );
 
@@ -230,7 +230,7 @@ class OBOImporter extends TripalImporter {
       '#type'          => 'textfield',
       '#title'         => t('Remote URL'),
       '#description'   => t('Please enter a URL for the online OBO file.  The file will be downloaded and parsed.
-                             (e.g. http://www.obofoundry.org/ro/ro.obo'),
+                             (e.g. http://www.obofoundry.org/ro/ro.obo)'),
     );
 
     $form['obo_new']['obo_file']= array(
@@ -1393,4 +1393,4 @@ class OBOImporter extends TripalImporter {
  */
 function tripal_cv_obo_form_ajax_callback($form, $form_state) {
   return $form['class_elements']['obo_existing'];
-}
+}

+ 2 - 2
tripal_chado/includes/loaders/tripal_chado.obo_loader.inc

@@ -122,7 +122,7 @@ function tripal_cv_obo_form($form, &$form_state) {
       '#type'          => 'textfield',
       '#title'         => t('Remote URL'),
       '#description'   => t('Please enter a URL for the online OBO file.  The file will be downloaded and parsed.
-                           (e.g. http://www.obofoundry.org/ro/ro.obo'),
+                           (e.g. http://www.obofoundry.org/ro/ro.obo)'),
       '#default_value' => $uobo_url,
     );
 
@@ -174,7 +174,7 @@ function tripal_cv_obo_form($form, &$form_state) {
     '#type'          => 'textfield',
     '#title'         => t('Remote URL'),
     '#description'   => t('Please enter a URL for the online OBO file.  The file will be downloaded and parsed.
-                           (e.g. http://www.obofoundry.org/ro/ro.obo'),
+                           (e.g. http://www.obofoundry.org/ro/ro.obo)'),
   );
 
   $form['obo_new']['obo_file']= array(

+ 1 - 1
tripal_chado/includes/tripal_chado.field_storage.inc

@@ -879,7 +879,7 @@ function tripal_chado_field_storage_bundle_mapping_form_add_allrecs(&$form,
     '#title' => 'Are all records in the "' . $default['table'] .
       '" table of type "'. $term_name . '"?',
     '#description' => 'Select "No" if the "' .
-      $default['table'] . '" table houses more that just data of type "' .
+      $default['table'] . '" table houses more than just data of type "' .
       $term_name . '".',
     '#default_value' => $default['has_all'],
     '#ajax' => array(

+ 13 - 11
tripal_chado/includes/tripal_chado.fields.inc

@@ -1614,17 +1614,19 @@ function tripal_chado_bundle_instances_info_linker(&$info, $entity_type, $bundle
      $pkey = $schema['primary key'][0];
      // Get the list of existing property types for this table.
      $args = array();
-      $sql = "
-        SELECT DISTINCT P.type_id
-        FROM {" . $prop_table . "} P
-      ";
-      if (array_key_exists('type_id', $tschema['fields'])) {
-        $sql .= "
-            INNER JOIN {" . $table_name . "} T on T.$tpkey = P.$tpkey
-          WHERE T.type_id = :cvterm_id
-        ";
-        $args[':cvterm_id'] = $cvterm_id;
-      }
+     $sql = 'SELECT DISTINCT type_id FROM {' . $prop_table . '}';
+
+//       $sql = "
+//         SELECT DISTINCT P.type_id
+//         FROM {" . $prop_table . "} P
+//       ";
+//       if (array_key_exists('type_id', $tschema['fields'])) {
+//         $sql .= "
+//             INNER JOIN {" . $table_name . "} T on T.$tpkey = P.$tpkey
+//           WHERE T.type_id = :cvterm_id
+//         ";
+//         $args[':cvterm_id'] = $cvterm_id;
+//       }
 
      $props = chado_query($sql, $args);
      while ($prop = $props->fetchObject()) {

+ 23 - 0
tripal_ds/tripal_ds.install

@@ -38,8 +38,31 @@ function tripal_ds_schema() {
         'not null' => TRUE,
         'default' => ''
       ),
+      'weight' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 1,
+      ),
     ),
     'primary key' => array('id'),
   );
   return $schema;
 }
+
+/**
+ * Add a weight column to the tripal_ds table.
+ */
+function tripal_ds_update_7300() {
+  try {
+    db_add_field('tripal_ds', 'weight', array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'default' => 1,
+    ));
+  }
+  catch (\PDOException $e) {
+    $transaction->rollback();
+    $error = $e->getMessage();
+    throw new DrupalUpdateException('Could not perform update: '. $error);
+  }
+}