Jelajahi Sumber

Merge branch '7.x-2.x-ds' into 7.x-3.x

Stephen Ficklin 8 tahun lalu
induk
melakukan
10bd88ced9

+ 1 - 69
legacy/tripal_core/theme/css/tripal_core.css

@@ -131,13 +131,13 @@
 /**
  * Within the pane 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,71 +179,3 @@
   padding-bottom: 5px;
 }
 
-/******************************************************************************
- * Administrative CSS classes
- *****************************************************************************/
-
- /**
-  * This class is used when providing hints or other instructions to the
-  * site administrator
-  */
-
-div.messages.tripal-site-admin-only{
-  background-image: url("../images/TripalLogo-sm.png");
-  background-repeat: no-repeat;
-  background-color: #cce3ff;
-  margin-top: 10px;
-  margin-bottom: 10px;
-  margin-left: 0px;
-  margin-right: 0px;
-  border: 1px solid #7DA1D4;
-  min-height: 65px;
-  clear: both;
-  padding: 0px;
-}
-
-.tripal-code {
-  font-family: "Courier New", Courier, monospace;
-  word-wrap: break-word;
-  display: block;
-  padding-top: 10px;
-  padding-bottom: 10px;
-}
-
-.tripal-severity-string {
-  font-weight: bold;
-}
-
-.tripal-severity-string-critical, .tripal-severity-string-error, 
-.tripal-severity-string.critical, .tripal-severity-string.error {
-  color: #FF0000;
-}
-
-.tripal-severity-string-warning,
-.tripal-severity-string.warning {
-  color: #FF8000;
-}
-
-.tripal-site-admin-message {
-  padding: 15px 10px 10px 70px;
-  font-style: italic;
-}
-
-.tripal-site-admin-only-table-row {
-  background-color: #cce3ff;
-  /* border: 1px solid #7DA1D4; */
-  color: black;
-}
-
-/******************************************************************************
- * Misc CSS classes
- *****************************************************************************/
-.tripal-dl {
-  width: 100%;
-  overflow: hidden;
-}
-.tripal-dl dt {
-  float: left;
-}
-.tripal-dl dd {
-}

+ 15 - 1
tripal/api/tripal.entities.api.inc

@@ -183,6 +183,15 @@ function hook_bundle_delete($bundle) {
  */
 function hook_bundle_create(&$bundle, $storage_args) {
 
+}
+/**
+ * Allows a module to perform tasks after fields are added to a TripalBundle.
+ *
+ * @param $bundle
+ *   The newly created TripalBundle object.
+ */
+function hook_bundle_postcreate(&$bundle) {
+
 }
 /**
  * Creates a new Tripal Entity type (i.e. bundle).
@@ -257,7 +266,6 @@ function tripal_create_bundle($args, &$error = '') {
       $function($bundle, $storage_args);
     }
 
-
     // Clear the entity cache so that Drupal will read our
     // hook_entity_info() implementation.
     global $language;
@@ -308,6 +316,12 @@ function tripal_create_bundle($args, &$error = '') {
         $instance = field_create_instance($details);
       }
     }
+
+    $modules = module_implements('bundle_postcreate');
+    foreach ($modules as $module) {
+      $function = $module . '_bundle_postcreate';
+      $function($bundle);
+    }
   }
   catch (Exception $e) {
     $transaction->rollback();

+ 69 - 28
tripal/theme/css/tripal.css

@@ -1,28 +1,69 @@
-/* Tooltip container */
-.tripal-tooltip {
-    position: relative;
-    display: inline-block;
-    padding-left: 5px;
-    padding-right: 5px;
-}
-
-/* Tooltip text */
-.tripal-tooltip .tripal-tooltiptext {
-    visibility: hidden;
-    width: 300px;
-    background-color: #888888;
-    color: #FFFFFF;
-    text-align: left;
-    padding: 10px;
-    border-radius: 6px;
- 
-    /* Position the tooltip text - see examples below! */
-    position: absolute;
-    z-index: 1;
-}
-
-/* Show the tooltip text when you mouse over the tooltip container */
-.tripal-tooltip:hover .tripal-tooltiptext {
-    visibility: visible;
-}
-</style>
+
+ /******************************************************************************
+ * Administrative CSS classes
+ *****************************************************************************/
+
+ /**
+  * This class is used when providing hints or other instructions to the
+  * site administrator
+  */
+
+div.messages.tripal-site-admin-only{
+  background-image: url("../images/TripalLogo-sm.png");
+  background-repeat: no-repeat;
+  background-color: #cce3ff;
+  margin-top: 10px;
+  margin-bottom: 10px;
+  margin-left: 0px;
+  margin-right: 0px;
+  border: 1px solid #7DA1D4;
+  min-height: 65px;
+  clear: both;
+  padding: 0px;
+}
+
+.tripal-code {
+  font-family: "Courier New", Courier, monospace;
+  word-wrap: break-word;
+  display: block;
+  padding-top: 10px;
+  padding-bottom: 10px;
+}
+
+.tripal-severity-string {
+  font-weight: bold;
+}
+
+.tripal-severity-string-critical, .tripal-severity-string-error, 
+.tripal-severity-string.critical, .tripal-severity-string.error {
+  color: #FF0000;
+}
+
+.tripal-severity-string-warning,
+.tripal-severity-string.warning {
+  color: #FF8000;
+}
+
+.tripal-site-admin-message {
+  padding: 15px 10px 10px 70px;
+  font-style: italic;
+}
+
+.tripal-site-admin-only-table-row {
+  background-color: #cce3ff;
+  /* border: 1px solid #7DA1D4; */
+  color: black;
+}
+
+/******************************************************************************
+ * Misc CSS classes
+ *****************************************************************************/
+.tripal-dl {
+  width: 100%;
+  overflow: hidden;
+}
+.tripal-dl dt {
+  float: left;
+}
+.tripal-dl dd {
+}

+ 3 - 0
tripal_chado/includes/tripal_chado.fields.inc

@@ -589,6 +589,8 @@ function tripal_chado_bundle_create_instances($entity_type, $bundle) {
   return $info;
 
 }
+
+
 /**
  * Helper function for the hook_create_tripalfield_instance().
  *
@@ -673,6 +675,7 @@ function tripal_chado_bundle_create_instances_base(&$info, $entity_type, $bundle
       'display' => array(
         'default' => array(
           'label' => 'inline',
+          'region' =>'Left',
           'settings' => array(),
         ),
       ),

+ 184 - 0
tripal_ds/includes/tripal_ds.ds.inc

@@ -0,0 +1,184 @@
+<?php
+
+/**
+ * Implements hook_ds_layout_settings_info().
+ */
+function _ds_layout_settings_info($bundle_name, $instances) {
+    $region_right = array(); 
+    $region_left = array();
+    $prop_fields = array(); 
+    $summary_fields = array();
+    $data_sequence_fields = array(); 
+    $all_other_fields = array();
+    $fields_with_regions = array();
+    $i = 0;
+    foreach ($instances as $key => $instance){
+        $instance_name = $instance['field_name'];
+        if($instance_name=="rdfs__type"){
+            array_push($summary_fields, $instance_name);
+            $fields_with_regions[$instance_name]= 'right';
+
+        } 
+        else {
+            //TODO: How do we handle non-chado dbs, placement of fields within tripal panes might need to be done in a hook. 
+            $instance_base_table = $instance['settings']['base_table'];
+            $instance_base_chado = $instance['settings']['chado_table'];
+            $prop_table = strpos($instance_base_chado, 'prop');
+            $data_sequence = strpos($instance_name, 'data__sequence');
+
+            if ($instance_base_chado && $instance_base_table){
+
+                if ($instance_base_chado == $instance_base_table){
+                    if ($prop_table !== FALSE){
+                        //Properties section instances
+                        array_push($prop_fields, $instance_name);
+                        $fields_with_regions[$instance_name]= 'right';
+
+                    } 
+                    elseif ($data_sequence !== FALSE) {
+                        //data sequence section instances
+                        array_push($data_sequence_fields, $instance_name);
+                        $fields_with_regions[$instance_name] = 'right';
+
+                    } 
+                    else {
+                        //overview section instances
+                        array_push($summary_fields, $instance_name);
+                        $fields_with_regions[$instance_name] = 'right';
+                    }
+
+                } 
+                elseif ($instance_base_chado != $instance_base_table){
+                    if ($prop_table !== FALSE){
+                        //Properties section instances
+                        array_push($prop_fields, $instance_name);
+                        $fields_with_regions[$instance_name]= 'right';
+
+                    } 
+                    elseif ($data_sequence !== FALSE){
+                        //data sequence section instances
+                        array_push($data_sequence_fields, $instance_name);
+                        $fields_with_regions[$instance_name]= 'right';
+
+                    } 
+                    else {
+                        //Linker section instances
+                        array_push($all_other_fields, $instance);
+                        $fields_with_regions[$instance_name]= 'right';
+
+                        //update the display settings so that the title is hidden
+                        $instance['display']['default']['label'] = 'hidden';
+                        field_update_instance($instance);
+                    }
+                }
+            }
+        }
+        $i++;
+    }
+
+    //consolidate the field sets
+    if(!empty($summary_fields)){
+        _summary_field_group_info($bundle_name, $summary_fields);
+
+        //add the fields to the regions
+        array_unshift($summary_fields, 'group_summary_tripalpane', 'group_summary', 'group_summary_table');
+        $fields_with_regions += [ 'group_summary_tripalpane' =>'right', 'group_summary' => 'right', 'group_summary_table' => 'right' ];
+        $region_right = array_merge($summary_fields, $region_right);
+
+    }
+    if (!empty($prop_fields)){
+        _prop_field_group_info($bundle_name, $prop_fields);
+        array_unshift($prop_fields, 'group_prop_tripalpane', 'group_prop', 'group_prop_table');
+
+        //add the fields to the regions
+        $region_right = array_merge($region_right, $prop_fields);
+        $fields_with_regions += [ 'group_prop_tripalpane' => 'right', 'group_prop' => 'right', 'group_prop_table' => 'right' ];
+    }
+    if (!empty($data_sequence_fields)){
+        _data_sequence_field_group_info($bundle_name, $data_sequence_fields);
+        array_unshift($data_sequence_fields, 'group_sequence_tripalpane', 'group_sequence', 'group_sequence_table');
+
+        //add the fields to the regions
+        $region_right = array_merge($region_right, $data_sequence_fields);
+        $fields_with_regions += [ 'group_sequence_tripalpane' => 'right', 'group_sequence' => 'right', 'group_sequence_table' => 'right' ];
+    }
+    if (!empty($all_other_fields)){
+        foreach ($all_other_fields as $key => $other_field) {
+          //temporary field names
+          $temporary_field = array();
+          $group_field_name = 'gp_'.$other_field['field_name'];
+          $fieldset_field_name = 'ft_'.$other_field['field_name'];
+
+          //need to truncate the names because of database field size restrictions, updating fields here to ensure name consistency
+          $group_field_name = substr($group_field_name, 0, 27);
+          $fieldset_field_name = substr($fieldset_field_name, 0, 27);
+
+          //add randomm numbers to ensure the field name is unique within the 32 character limit of the field
+          $group_field_name = $group_field_name.rand(0, 99999);
+          $fieldset_field_name = $fieldset_field_name.rand(0, 99999);
+
+          //build the field group
+          _additional_fields_field_group_info($bundle_name, $other_field['label'], $group_field_name, $fieldset_field_name, $other_field['field_name']);
+          //update arrays
+          array_push($temporary_field, $group_field_name, $fieldset_field_name, $other_field['field_name']);
+          $region_right = array_merge($region_right, $temporary_field);
+          $fields_with_regions += [ $group_field_name => 'right', $fieldset_field_name => 'right' ];
+        }
+    }
+    //add blocks to $region_left
+    $position = count($region_right);
+    $region_left[$position] = 'toc';
+    $fields_with_regions += [ 'toc' => 'left'];
+    //build the ds layout
+    $record = new stdClass;
+    $record->id ='TripalEntity|' . $bundle_name . '|default';
+    $record->entity_type = 'TripalEntity';
+    $record->bundle = $bundle_name;
+    $record->view_mode = 'default';
+    $record->layout = 'tripal_ds_feature';
+    $settings = array(
+        'regions' => array(
+            'left' => 
+                $region_left,
+            'right' =>
+                $region_right,
+        ),
+        'fields' =>
+            $fields_with_regions,
+        'classes' => array(),
+        'wrappers' => array(
+            'left' => 'div',
+            'right' => 'div',
+        ),
+        'layout_wrapper' => 'div',
+        'layout_attributes' => '',
+        'layout_attributes_merge' => 1,
+        'layout_link_attribute' => '',
+        'layout_link_custom' => '',
+        'layout_disable_css' => 0,
+    );
+    $record->settings = $settings;
+    drupal_write_record('ds_layout_settings', $record);
+}
+
+
+/*
+ * Implements hook_ds_fields_info().
+*/
+function tripal_ds_ds_fields_info($entity_type) {
+  $fields = array();
+
+  $fields['toc'] = array(
+    'title' => t('Table of Contents'),
+    'field_type' => DS_FIELD_TYPE_FUNCTION,
+    'function' => 'tripal_ds_toc_block',
+  );
+  return array('TripalEntity' => $fields);
+}
+
+function tripal_ds_toc_block($entity_type) {
+    $bundle_name = $entity_type['bundle'];
+    $toc = views_embed_view('tripal_content_type_toc', 'block', $bundle_name);
+    return $toc;
+}
+

+ 132 - 0
tripal_ds/includes/tripal_ds.field_formatter.inc

@@ -0,0 +1,132 @@
+<?php
+/**
+ * Implements hook_field_group_formatter_info().
+ */
+function tripal_ds_field_group_formatter_info() {
+  return array(
+    'form' => array(
+      'tripalpane' => array(
+        'label' => t('Tripal Pane'),
+        'description' => t('This fieldgroup renders the inner content in a Tripal Pane with the title as legend.'),
+        'instance_settings' => array('description' => '', 'classes' => '', 'id' => ''),
+      ),
+    ),
+     'display' => array(
+        'tripalpane' => array(
+          'label' => t('Tripal Pane'),
+          'description' => t('This fieldgroup renders the inner content in a Tripal Pane with the title as legend.'),
+          'instance_settings' => array('description' => '', 'classes' => '', 'id' => ''),
+        ),
+      ),
+  );
+}
+
+/**
+ * Implements hook_field_group_format_settings().
+ * If the group has no format settings, default ones will be added.
+ * @params Object $group The group object.
+ * @return Array $form The form element for the format settings.
+ */
+function tripal_ds_field_group_format_settings($group) {
+  $form = array();
+
+  // Add instance_settings.
+  switch ($group->format_type) {
+    case 'tripalpane':
+      $form['label']['#description'] = t('Please enter a label for collapsible elements');
+      break;
+  }
+
+  return $form;
+}
+
+/*
+ * Implements field_group_pre_render_<format-type>.
+ * Format type: Tripalpane.
+ *
+ * @param $element The field group form element.
+ * @param $group The Field group object prepared for pre_render.
+ * @param $form The root element or form.
+ */
+function tripal_ds_field_group_pre_render(&$element, $group, &$form) {
+  $group_name = $group->group_name;
+  switch ($group->format_type) {
+    case 'tripalpane':
+      $element['#prefix'] = '<div class="tripal_pane-fieldset-'.$group_name.' '.$group_name.'">';
+      $element['#suffix'] = '</div>';
+      break;
+  }
+}
+
+/*
+ * Implements hook_field_group_create_field_group
+ * 
+ */
+function tripal_ds_field_group_create_field_group($group) {
+
+  if($group->format_type == 'tripalpane'){
+    //write to the tripal_ds table to record the new tripal pane
+    $field_for_table = new stdClass();
+    $field_for_table->tripal_ds_field_name = $group->group_name;
+    $field_for_table->tripal_ds_field_label = $group->label;
+    $field_for_table->entity_type = 'TripalEntity';
+    $field_for_table->bundle = $group->bundle;
+
+    drupal_write_record('tripal_ds', $field_for_table);
+
+  }
+}
+
+/*
+ * Implements hook_field_group_delete_field_group
+ * 
+ */
+function tripal_ds_field_group_delete_field_group($group) {
+
+  if($group->format_type == 'tripalpane'){
+    db_delete('tripal_ds')
+      ->condition('bundle', $group->bundle, '=')
+      ->condition('tripal_ds_field_name', $group->group_name, '=')
+      ->execute();
+    }
+}
+
+/*
+ * Implements hook_field_group_update_field_group
+ * checks for changes from tripalpane to another type
+ */
+function tripal_ds_field_group_update_field_group($group) {
+  //change from tripal pane to another type
+  if(!empty($group->bundle)){
+    $result = db_select('tripal_ds', 't')
+      ->fields('t')
+      ->condition('bundle', $group->bundle,'=')
+      ->condition('tripal_ds_field_name', $group->group_name,'=')
+      ->execute()
+      ->fetchAssoc();
+
+    //change from tripal pane to another type
+    if($group->format_type !== 'tripalpane' && !empty($result)){
+       db_delete('tripal_ds')
+      ->condition('bundle', $result['bundle'], '=')
+      ->condition('tripal_ds_field_name', $result['tripal_ds_field_name'], '=')
+      ->execute();
+    }
+
+    //change from other type to tripalpane
+    if($group->format_type == 'tripalpane' && empty($result)){
+
+      if(strpos($group->group_name, 'Tripal Pane')){
+        $group_name = str_replace('Tripal Pane', "", $group->group_name);
+      } 
+      $field_for_table = new stdClass();
+      $field_for_table->tripal_ds_field_name = $group_name;
+      $field_for_table->tripal_ds_field_label = $group->label;
+      $field_for_table->entity_type = 'TripalEntity';
+      $field_for_table->bundle = $group->bundle;
+
+      drupal_write_record('tripal_ds', $field_for_table);
+    }
+  }
+}
+

+ 397 - 0
tripal_ds/includes/tripal_ds.field_group.inc

@@ -0,0 +1,397 @@
+<?php
+/**
+ * Implements hook_field_group_info().
+ */
+
+function _summary_field_group_info($bundle_name, $fields){
+    
+    //tripalpane  to nest the fieldset within
+    $field_group_tripalpane = new stdClass();
+    $field_group_tripalpane->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
+    $field_group_tripalpane->api_version = 1;
+    $field_group_tripalpane->identifier = 'group_summary_tripalpane|TripalEntity|'.$bundle_name.'|default';
+    $field_group_tripalpane->group_name = 'group_summary_tripalpane';
+    $field_group_tripalpane->entity_type = 'TripalEntity';
+    $field_group_tripalpane->bundle = $bundle_name;
+    $field_group_tripalpane->mode = 'default';
+    $field_group_tripalpane->parent_name = '';
+    $field_group_tripalpane->data = array(
+        'label' => 'Tripal Pane Summary',
+        'weight' => '1',
+        'children' => array(
+            0 => 'group_summary',
+        ),
+        'format_type' => 'tripalpane',
+        'format_settings' => array(
+            'label' => 'Tripal Pane Summary',
+            'instance_settings' => array(
+                'id' => 'tripal_ds-fieldset-group_summary_tripalpane',
+                'classes' => 'group-summary-tripalpane field-group-tripalpane',
+                'description' => '',
+            ),
+        ),
+    );
+    drupal_write_record('field_group', $field_group_tripalpane);
+
+    //write to the tripal_ds table to record the new tripal pane
+    $field_for_table = new stdClass();
+    $field_for_table->tripal_ds_field_name = 'group_summary_tripalpane';
+    $field_for_table->tripal_ds_field_label = 'Summary';
+    $field_for_table->entity_type = 'TripalEntity';
+    $field_for_table->bundle = $bundle_name;
+
+    drupal_write_record('tripal_ds', $field_for_table);
+
+    //fieldset field to nest the table within
+    $field_group_fieldset = new stdClass();
+    $field_group_fieldset->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
+    $field_group_fieldset->api_version = 1;
+    $field_group_fieldset->identifier = 'group_summary|TripalEntity|'.$bundle_name.'|default';
+    $field_group_fieldset->group_name = 'group_summary';
+    $field_group_fieldset->entity_type = 'TripalEntity';
+    $field_group_fieldset->bundle = $bundle_name;
+    $field_group_fieldset->mode = 'default';
+    $field_group_fieldset->parent_name = 'group_summary_tripalpane';
+    $field_group_fieldset->data = array(
+        'label' => 'Summary',
+        'weight' => '5',
+        'children' => array(
+            0 => 'group_summary_table',
+        ),
+        'format_type' => 'fieldset',
+        'format_settings' => array(
+            'label' => 'Summary',
+            'instance_settings' => array(
+                'id' => '',
+                'classes' => 'group-summary field-group-fieldset',
+                'description' => '',
+            ),
+            'formatter' => 'collapsible',
+        ),
+    );
+
+    drupal_write_record('field_group', $field_group_fieldset);
+
+    //table of fields
+    $field_group = new stdClass();
+    $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
+    $field_group->api_version = 1;
+    $field_group->identifier = 'group_summary_table|TripalEntity|'.$bundle_name.'|default';
+    $field_group->group_name = 'group_summary_table';
+    $field_group->entity_type = 'TripalEntity';
+    $field_group->bundle = $bundle_name;
+    $field_group->mode = 'default';
+    $field_group->parent_name = 'group_summary';
+    $field_group->data = array(
+        'label' => 'Summary Table',
+        'weight' => '30',
+        'children' => $fields,
+        'format_type' => 'table',
+        'format_settings' => array(
+            'label' => 'Summary Table',
+            'instance_settings' => array(
+                'label_visibility' => '1',
+                'desc' => '',
+                'first_column' => '',
+                'second_column' => '',
+                'empty_label_behavior' => '1',
+                'table_row_striping' => 0,
+                'always_show_field_label' => 0,
+                'classes' => 'group-summary-table field-group-table',
+            ),
+        ),
+    );
+
+    drupal_write_record('field_group', $field_group);
+
+
+}
+/**
+ * Implements hook_field_group_info().
+ */
+
+function _prop_field_group_info($bundle_name, $fields){
+    //tripalpane  to nest the fieldset within
+    $field_group_tripalpane = new stdClass();
+    $field_group_tripalpane->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
+    $field_group_tripalpane->api_version = 1;
+    $field_group_tripalpane->identifier = 'group_prop_tripalpane|TripalEntity|'.$bundle_name.'|default';
+    $field_group_tripalpane->group_name = 'group_prop_tripalpane';
+    $field_group_tripalpane->entity_type = 'TripalEntity';
+    $field_group_tripalpane->bundle = $bundle_name;
+    $field_group_tripalpane->mode = 'default';
+    $field_group_tripalpane->parent_name = '';
+    $field_group_tripalpane->data = array(
+        'label' => 'Tripal Pane Properties',
+        'weight' => '2',
+        'children' => array(
+            0 => 'group_prop',
+        ),
+        'format_type' => 'tripalpane',
+        'format_settings' => array(
+            'label' => 'Tripal Pane Properties',
+            'instance_settings' => array(
+                'id' => 'tripal_ds-fieldset-group_prop_tripalpane',
+                'classes' => 'group-prop-tripalpane field-group-tripalpane',
+                'description' => '',
+            ),
+        ),
+    );
+    drupal_write_record('field_group', $field_group_tripalpane);
+    
+    //write to the tripal_ds table to record the new tripal pane
+    $field_for_table = new stdClass();
+    $field_for_table->tripal_ds_field_name = 'group_prop_tripalpane';
+    $field_for_table->tripal_ds_field_label = 'Properties';
+    $field_for_table->entity_type = 'TripalEntity';
+    $field_for_table->bundle = $bundle_name;
+
+    drupal_write_record('tripal_ds', $field_for_table);
+
+
+    //fieldset field to nest the table within
+    $field_group_fieldset = new stdClass();
+    $field_group_fieldset->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
+    $field_group_fieldset->api_version = 1;
+    $field_group_fieldset->identifier = 'group_prop|TripalEntity|'.$bundle_name.'|default';
+    $field_group_fieldset->group_name = 'group_prop';
+    $field_group_fieldset->entity_type = 'TripalEntity';
+    $field_group_fieldset->bundle = $bundle_name;
+    $field_group_fieldset->mode = 'default';
+    $field_group_fieldset->parent_name = 'group_prop_tripalpane';
+    $field_group_fieldset->data = array(
+        'label' => 'Properties',
+        'weight' => '3',
+        'children' => array(
+            0 => 'group_prop_table',
+        ),
+        'format_type' => 'fieldset',
+        'format_settings' => array(
+            'label' => 'Properties',
+            'instance_settings' => array(
+                'id' => '',
+                'classes' => 'group-prop field-group-fieldset',
+                'description' => '',
+                ),
+            'formatter' => 'collapsible',
+        ),
+    );
+
+    drupal_write_record('field_group', $field_group_fieldset);
+
+    //table of fields
+    $field_group = new stdClass();
+    $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
+    $field_group->api_version = 1;
+    $field_group->identifier = 'group_prop_table|TripalEntity|'.$bundle_name.'|default';
+    $field_group->group_name = 'group_prop_table';
+    $field_group->entity_type = 'TripalEntity';
+    $field_group->bundle = $bundle_name;
+    $field_group->mode = 'default';
+    $field_group->parent_name = 'group_prop';
+    $field_group->data = array(
+        'label' => 'Properties Table',
+        'weight' => '30',
+        'children' => $fields,
+        'format_type' => 'table',
+        'format_settings' => array(
+            'label' => 'Properties Table',
+            'instance_settings' => array(
+                'label_visibility' => '1',
+                'desc' => '',
+                'first_column' => '',
+                'second_column' => '',
+                'empty_label_behavior' => '1',
+                'table_row_striping' => 0,
+                'always_show_field_label' => 0,
+                'classes' => 'group-prop-table field-group-table',
+            ),
+        ),
+    );
+
+    drupal_write_record('field_group', $field_group);
+}
+/**
+ * Implements hook_field_group_info().
+ */
+
+function _data_sequence_field_group_info($bundle_name, $fields){
+    //tripalpane  to nest the fieldset within
+    $field_group_tripalpane = new stdClass();
+    $field_group_tripalpane->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
+    $field_group_tripalpane->api_version = 1;
+    $field_group_tripalpane->identifier = 'group_sequence_tripalpane|TripalEntity|'.$bundle_name.'|default';
+    $field_group_tripalpane->group_name = 'group_sequence_tripalpane';
+    $field_group_tripalpane->entity_type = 'TripalEntity';
+    $field_group_tripalpane->bundle = $bundle_name;
+    $field_group_tripalpane->mode = 'default';
+    $field_group_tripalpane->parent_name = '';
+    $field_group_tripalpane->data = array(
+        'label' => 'Tripal Pane Data Sequences',
+        'weight' => '2',
+        'children' => array(
+            0 => 'group_sequence',
+        ),
+        'format_type' => 'tripalpane',
+        'format_settings' => array(
+            'label' => 'Tripal Pane Data Sequences',
+            'instance_settings' => array(
+                'id' => 'tripal_ds-fieldset-group_sequence_tripalpane',
+                'classes' => 'group-sequence-tripalpane field-group-tripalpane',
+                'description' => '',
+            ),
+        ),
+    );
+    drupal_write_record('field_group', $field_group_tripalpane);
+
+    //write to the tripal_ds table to record the new tripal pane
+    $field_for_table = new stdClass();
+    $field_for_table->tripal_ds_field_name = 'group_sequence_tripalpane';
+    $field_for_table->tripal_ds_field_label = 'Data Sequences';
+    $field_for_table->entity_type = 'TripalEntity';
+    $field_for_table->bundle = $bundle_name;
+
+    drupal_write_record('tripal_ds', $field_for_table);
+
+    //fieldset field to nest the table within
+    $field_group_fieldset = new stdClass();
+    $field_group_fieldset->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
+    $field_group_fieldset->api_version = 1;
+    $field_group_fieldset->identifier = 'group_sequence|TripalEntity|'.$bundle_name.'|default';
+    $field_group_fieldset->group_name = 'group_sequence';
+    $field_group_fieldset->entity_type = 'TripalEntity';
+    $field_group_fieldset->bundle = $bundle_name;
+    $field_group_fieldset->mode = 'default';
+    $field_group_fieldset->parent_name = 'group_sequence_tripalpane';
+    $field_group_fieldset->data = array(
+        'label' => 'Data Sequences',
+        'weight' => '3',
+        'children' => array(
+            0 => 'group_sequence_table',
+        ),
+        'format_type' => 'fieldset',
+        'format_settings' => array(
+            'label' => 'Data Sequences',
+            'instance_settings' => array(
+                'id' => '',
+                'classes' => 'group-sequence field-group-fieldset',
+                'description' => '',
+            ),
+            'formatter' => 'collapsible',
+        ),
+    );
+
+    drupal_write_record('field_group', $field_group_fieldset);
+
+    //table of fields
+    $field_group = new stdClass();
+    $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
+    $field_group->api_version = 1;
+    $field_group->identifier = 'group_sequence_table|TripalEntity|'.$bundle_name.'|default';
+    $field_group->group_name = 'group_sequence_table';
+    $field_group->entity_type = 'TripalEntity';
+    $field_group->bundle = $bundle_name;
+    $field_group->mode = 'default';
+    $field_group->parent_name = 'group_sequence';
+    $field_group->data = array(
+        'label' => 'Data Sequences Table',
+        'weight' => '30',
+        'children' => $fields,
+        'format_type' => 'table',
+        'format_settings' => array(
+            'label' => 'Data Sequences Table',
+            'instance_settings' => array(
+                'label_visibility' => '1',
+                'desc' => '',
+                'first_column' => '',
+                'second_column' => '',
+                'empty_label_behavior' => '1',
+                'table_row_striping' => 0,
+                'always_show_field_label' => 0,
+                'classes' => 'group-sequence-table field-group-table',
+            ),
+        ),
+    );
+
+    drupal_write_record('field_group', $field_group);
+}
+
+/**
+ * Implements hook_field_group_info().
+ * Processes all additional fields into Tripal Panes
+ */
+
+function _additional_fields_field_group_info($bundle_name, $field_label, $group_field_name, $fieldset_field_name, $field_name){
+    //write to the tripal_ds table to record the new tripal pane
+    $field_for_table = new stdClass();
+    $field_for_table->tripal_ds_field_name = $group_field_name;
+    $field_for_table->tripal_ds_field_label = $field_label;
+    $field_for_table->entity_type = 'TripalEntity';
+    $field_for_table->bundle = $bundle_name;
+
+    drupal_write_record('tripal_ds', $field_for_table);
+
+    //fieldset field to nest the table within
+    $field_group_fieldset = new stdClass();
+    $field_group_fieldset->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
+    $field_group_fieldset->api_version = 1;
+    $field_group_fieldset->identifier = $group_field_name.'|TripalEntity|'.$bundle_name.'|default';
+    $field_group_fieldset->group_name = $group_field_name;
+    $field_group_fieldset->entity_type = 'TripalEntity';
+    $field_group_fieldset->bundle = $bundle_name;
+    $field_group_fieldset->mode = 'default';
+    $field_group_fieldset->parent_name = '';
+    $field_group_fieldset->data = array(
+        'label' => $field_label.' TripalPane',
+        'weight' => '5',
+        'children' => array(
+            0 => $fieldset_field_name,
+        ),
+        'format_type' => 'tripalpane',
+        'format_settings' => array(
+            'label' => $field_label.' TripalPane',
+            'instance_settings' => array(
+                'id' => 'tripal_ds-fieldset-'.$group_field_name,
+                'classes' => $group_field_name.' field-group-tripalpane',
+                'description' => '',
+            ),
+            'formatter' => 'collapsible',
+        ),
+    );
+
+    drupal_write_record('field_group', $field_group_fieldset);
+
+    //table of fields
+    $field_group = new stdClass();
+    $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially*/
+    $field_group->api_version = 1;
+    $field_group->identifier =  $fieldset_field_name.'|TripalEntity|'.$bundle_name.'|default';
+    $field_group->group_name =  $fieldset_field_name;
+    $field_group->entity_type = 'TripalEntity';
+    $field_group->bundle = $bundle_name;
+    $field_group->mode = 'default';
+    $field_group->parent_name =  $group_field_name;
+    $field_group->data = array(
+        'label' => $field_label,
+        'weight' => '30',
+        'children' => array(
+            0 =>$field_name,
+        ),
+        'format_type' => 'table',
+        'format_type' => 'fieldset',
+        'format_settings' => array(
+            'label' => $field_label,
+            'instance_settings' => array(
+                'label_visibility' => '1',
+                'id' => '',
+                'classes' => $fieldset_field_name.' field-group-fieldset',
+                'description' => '',
+            ),
+            'formatter' => 'collapsible',
+        ),
+    );
+
+    drupal_write_record('field_group', $field_group);
+
+}
+

+ 10 - 0
tripal_ds/includes/tripal_ds.inc

@@ -0,0 +1,10 @@
+<?php
+
+/**
+ * Implements hook_ctools_plugin_api().
+ */
+function tripal_ds_ctools_plugin_api($module = NULL, $api = NULL){
+    if ($module == "ds" && $api == "ds") {
+        return array("version" => "1");
+    }
+}

+ 80 - 0
tripal_ds/includes/views/tripal_ds.views.inc

@@ -0,0 +1,80 @@
+<?php
+
+
+
+/**
+ * Implements hook_views_data().
+ */
+function tripal_ds_views_data() {
+
+    $data = array();
+
+    $data['tripal_ds']['table']['group'] = t('Tripal Panes');
+
+    $data['tripal_ds']['table']['base'] = array(
+        'title' => t('Tripal Panes'),
+        'help' => t('Contains Tripal Pane records we want exposed to Views.'),
+    );
+
+    $data['tripal_ds']['bundle'] = array(
+	   'title' => t('Bundle ID'),
+	   'help' => t('This the unque bundle name, eg bio_data_1.'),
+		'relationship' => array(
+		      'base' => 'tripal_entity', // The name of the table to join with.
+		      'base field' => 'bundle', // The name of the field on the joined table.
+		      // 'field' => 'nid' -- see hook_views_data_alter(); not needed here.
+		      'handler' => 'views_handler_relationship',
+		      'label' => t('Default label for the relationship'),
+		      'title' => t('Title shown when adding the relationship'),
+		      'help' => t('More information on this relationship'),
+		    ),    	
+		'filter' => array(
+      		'handler' => 'views_handler_filter_bundle',
+     	),
+    	'argument' => array(
+      		'handler' => 'views_handler_argument_string',
+    	),
+    	'field' => array(
+      		'handler' => 'views_handler_field',
+    	),
+  	);
+
+    $data['tripal_ds']['tripal_ds_field_name'] = array(
+	   'title' => t('Field Name'),
+	   'help' => t('This the field name, it is not necessarily unique, like "summary" which might feature across several bundles.'),
+	   'field' => array(
+      		'handler' => 'views_handler_field',
+      		'click sortable' => TRUE, // This is use by the table display plugin.
+    	),
+	    'sort' => array(
+	      'handler' => 'views_handler_sort',
+	    ),
+	    'filter' => array(
+	      'handler' => 'views_handler_filter_string',
+	    ),
+	    'argument' => array(
+	      'handler' => 'views_handler_argument_string',
+	    ),
+    );
+
+    $data['tripal_ds']['tripal_ds_field_label'] = array(
+	   'title' => t('Field Label'),
+	   'help' => t('The human readable name of the field, like "Data Sequences".'),
+	   'field' => array(
+      		'handler' => 'views_handler_field',
+      		'click sortable' => TRUE, // This is use by the table display plugin.
+    	),
+	    'sort' => array(
+	      'handler' => 'views_handler_sort',
+	    ),
+	    'filter' => array(
+	      'handler' => 'views_handler_filter_string',
+	    ),
+	    'argument' => array(
+	      'handler' => 'views_handler_argument_string',
+	    ),
+    );
+
+    return $data;
+}
+

+ 88 - 0
tripal_ds/includes/views/tripal_ds.views_default.inc

@@ -0,0 +1,88 @@
+<?php
+
+/**
+ * Implements hook_views_default_views().
+ */
+function tripal_ds_views_default_views() {
+ 
+	$view = new view();
+	$view->name = 'tripal_content_type_toc';
+	$view->description = '';
+	$view->tag = 'default';
+	$view->base_table = 'tripal_ds';
+	$view->human_name = 'Tripal Content Type Table of Contents';
+	$view->core = 7;
+	$view->api_version = '3.0';
+	$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+	/* Display: Master */
+	$handler = $view->new_display('default', 'Master', 'default');
+	$handler->display->display_options['title'] = 'Table of Contents';
+	$handler->display->display_options['use_more_always'] = FALSE;
+	$handler->display->display_options['access']['type'] = 'none';
+	$handler->display->display_options['cache']['type'] = 'none';
+	$handler->display->display_options['query']['type'] = 'views_query';
+	$handler->display->display_options['exposed_form']['type'] = 'basic';
+	$handler->display->display_options['pager']['type'] = 'full';
+	$handler->display->display_options['pager']['options']['items_per_page'] = '10';
+	$handler->display->display_options['style_plugin'] = 'default';
+	$handler->display->display_options['row_plugin'] = 'fields';
+	/* Field: Tripal Panes: Field Name */
+	$handler->display->display_options['fields']['tripal_ds_field_name']['id'] = 'tripal_ds_field_name';
+	$handler->display->display_options['fields']['tripal_ds_field_name']['table'] = 'tripal_ds';
+	$handler->display->display_options['fields']['tripal_ds_field_name']['field'] = 'tripal_ds_field_name';
+	$handler->display->display_options['fields']['tripal_ds_field_name']['label'] = '';
+	$handler->display->display_options['fields']['tripal_ds_field_name']['exclude'] = TRUE;
+	$handler->display->display_options['fields']['tripal_ds_field_name']['element_label_colon'] = FALSE;
+	/* Field: Tripal Panes: Bundle ID */
+	$handler->display->display_options['fields']['bundle']['id'] = 'bundle';
+	$handler->display->display_options['fields']['bundle']['table'] = 'tripal_ds';
+	$handler->display->display_options['fields']['bundle']['field'] = 'bundle';
+	$handler->display->display_options['fields']['bundle']['label'] = '';
+	$handler->display->display_options['fields']['bundle']['exclude'] = TRUE;
+	$handler->display->display_options['fields']['bundle']['element_label_colon'] = FALSE;
+	/* Field: Tripal Panes: Field Label */
+	$handler->display->display_options['fields']['tripal_ds_field_label']['id'] = 'tripal_ds_field_label';
+	$handler->display->display_options['fields']['tripal_ds_field_label']['table'] = 'tripal_ds';
+	$handler->display->display_options['fields']['tripal_ds_field_label']['field'] = 'tripal_ds_field_label';
+	$handler->display->display_options['fields']['tripal_ds_field_label']['label'] = '';
+	$handler->display->display_options['fields']['tripal_ds_field_label']['alter']['alter_text'] = TRUE;
+	$handler->display->display_options['fields']['tripal_ds_field_label']['alter']['text'] = '<a href="#" class="tripal_pane-toc-list-item-link" id ="[tripal_ds_field_name]">[tripal_ds_field_label] </a>';
+	$handler->display->display_options['fields']['tripal_ds_field_label']['element_label_colon'] = FALSE;
+	/* Contextual filter: Tripal Panes: Bundle ID */
+	$handler->display->display_options['arguments']['bundle']['id'] = 'bundle';
+	$handler->display->display_options['arguments']['bundle']['table'] = 'tripal_ds';
+	$handler->display->display_options['arguments']['bundle']['field'] = 'bundle';
+	$handler->display->display_options['arguments']['bundle']['default_action'] = 'default';
+	$handler->display->display_options['arguments']['bundle']['default_argument_type'] = 'php';
+	$handler->display->display_options['arguments']['bundle']['default_argument_options']['code'] = '$url = current_path();
+	$url_exploded = explode("/", $url);
+	$tripal_entity_id = (int)$url_exploded[1];
+
+	    $result = db_select(\'tripal_entity\', \'te\')
+	      ->fields(\'te\', array(\'bundle\'))
+	      ->condition(\'id\', $tripal_entity_id, \'=\')
+	      ->execute()
+	      ->fetchField();
+
+	return $result;';
+	$handler->display->display_options['arguments']['bundle']['summary']['number_of_records'] = '0';
+	$handler->display->display_options['arguments']['bundle']['summary']['format'] = 'default_summary';
+	$handler->display->display_options['arguments']['bundle']['summary_options']['items_per_page'] = '25';
+	$handler->display->display_options['arguments']['bundle']['limit'] = '0';
+
+	/* Display: Page */
+	$handler = $view->new_display('page', 'Page', 'page');
+	$handler->display->display_options['path'] = 'tripal_ct_toc';
+
+	/* Display: Block */
+	$handler = $view->new_display('block', 'Block', 'block');
+	$handler->display->display_options['defaults']['pager'] = FALSE;
+	$handler->display->display_options['pager']['type'] = 'none';
+	$handler->display->display_options['pager']['options']['offset'] = '0';
+	 
+	$views[$view->name] = $view;
+	 
+	// return views
+	return $views;
+}

+ 64 - 0
tripal_ds/publication.ds.inc

@@ -0,0 +1,64 @@
+<?php
+/**
+ * @file
+ * publication.ds.inc
+ */
+
+/**
+ * Implements hook_ds_layout_settings_info().
+ */
+function publication_ds_layout_settings_info() {
+  $export = array();
+
+  $ds_layout = new stdClass();
+  $ds_layout->api_version = 1;
+  $ds_layout->id = 'TripalEntity|bio_data_45|default';
+  $ds_layout->entity_type = 'TripalEntity';
+  $ds_layout->bundle = 'bio_data_45';
+  $ds_layout->view_mode = 'default';
+  $ds_layout->layout = 'ds_2col';
+  $ds_layout->settings = array(
+    'regions' => array(
+      'left' => array(
+        0 => 'tpub__abstract',
+      ),
+      'right' => array(
+        1 => 'group_citation',
+        2 => 'tpub__citation',
+        3 => 'group_properties',
+        4 => 'group_references',
+        5 => 'sio__references',
+        6 => 'group_property_table',
+        7 => 'tpub__publication_type',
+        8 => 'tpub__doi',
+        9 => 'sbo__database_cross_reference',
+      ),
+    ),
+    'fields' => array(
+      'tpub__abstract' => 'left',
+      'group_citation' => 'right',
+      'tpub__citation' => 'right',
+      'group_properties' => 'right',
+      'group_references' => 'right',
+      'sio__references' => 'right',
+      'group_property_table' => 'right',
+      'tpub__publication_type' => 'right',
+      'tpub__doi' => 'right',
+      'sbo__database_cross_reference' => 'right',
+    ),
+    'classes' => array(),
+    'wrappers' => array(
+      'left' => 'div',
+      'right' => 'div',
+    ),
+    'layout_wrapper' => 'div',
+    'layout_attributes' => '',
+    'layout_attributes_merge' => 1,
+    'layout_link_attribute' => '',
+    'layout_link_custom' => '',
+    'layout_disable_css' => 0,
+  );
+  $export['TripalEntity|bio_data_45|default'] = $ds_layout;
+
+  return $export;
+}

+ 17 - 0
tripal_ds/publication.features.inc

@@ -0,0 +1,17 @@
+<?php
+/**
+ * @file
+ * publication.features.inc
+ */
+
+/**
+ * Implements hook_ctools_plugin_api().
+ */
+function publication_ctools_plugin_api($module = NULL, $api = NULL) {
+  if ($module == "ds" && $api == "ds") {
+    return array("version" => "1");
+  }
+  if ($module == "field_group" && $api == "field_group") {
+    return array("version" => "1");
+  }
+}

+ 138 - 0
tripal_ds/publication.field_group.inc

@@ -0,0 +1,138 @@
+<?php
+/**
+ * @file
+ * publication.field_group.inc
+ */
+
+/**
+ * Implements hook_field_group_info().
+ */
+function publication_field_group_info() {
+  $field_groups = array();
+
+  $field_group = new stdClass();
+  $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially */
+  $field_group->api_version = 1;
+  $field_group->identifier = 'group_citation|TripalEntity|bio_data_45|default';
+  $field_group->group_name = 'group_citation';
+  $field_group->entity_type = 'TripalEntity';
+  $field_group->bundle = 'bio_data_45';
+  $field_group->mode = 'default';
+  $field_group->parent_name = '';
+  $field_group->data = array(
+    'label' => 'Citation',
+    'weight' => '1',
+    'children' => array(
+      0 => 'tpub__citation',
+    ),
+    'format_type' => 'fieldset',
+    'format_settings' => array(
+      'label' => 'Citation',
+      'instance_settings' => array(
+        'id' => '',
+        'classes' => 'group-citation field-group-fieldset',
+        'description' => '',
+      ),
+      'formatter' => 'open',
+    ),
+  );
+  $field_groups[''] = $field_group;
+
+  $field_group = new stdClass();
+  $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially */
+  $field_group->api_version = 1;
+  $field_group->identifier = 'group_properties|TripalEntity|bio_data_45|default';
+  $field_group->group_name = 'group_properties';
+  $field_group->entity_type = 'TripalEntity';
+  $field_group->bundle = 'bio_data_45';
+  $field_group->mode = 'default';
+  $field_group->parent_name = '';
+  $field_group->data = array(
+    'label' => 'Properties',
+    'weight' => '2',
+    'children' => array(
+      0 => 'group_property_table',
+    ),
+    'format_type' => 'fieldset',
+    'format_settings' => array(
+      'label' => 'Properties',
+      'instance_settings' => array(
+        'id' => '',
+        'classes' => 'group-properties field-group-fieldset',
+        'description' => '',
+      ),
+      'formatter' => 'open',
+    ),
+  );
+  $field_groups[''] = $field_group;
+
+  $field_group = new stdClass();
+  $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially */
+  $field_group->api_version = 1;
+  $field_group->identifier = 'group_property_table|TripalEntity|bio_data_45|default';
+  $field_group->group_name = 'group_property_table';
+  $field_group->entity_type = 'TripalEntity';
+  $field_group->bundle = 'bio_data_45';
+  $field_group->mode = 'default';
+  $field_group->parent_name = 'group_properties';
+  $field_group->data = array(
+    'label' => '',
+    'weight' => '30',
+    'children' => array(
+      0 => 'sbo__database_cross_reference',
+      1 => 'tpub__doi',
+      2 => 'tpub__publication_type',
+    ),
+    'format_type' => 'table',
+    'format_settings' => array(
+      'label' => '',
+      'instance_settings' => array(
+        'label_visibility' => '3',
+        'desc' => '',
+        'first_column' => '',
+        'second_column' => '',
+        'empty_label_behavior' => '1',
+        'table_row_striping' => 0,
+        'always_show_field_label' => 0,
+        'classes' => 'group-property-table field-group-table',
+      ),
+    ),
+  );
+  $field_groups[''] = $field_group;
+
+  $field_group = new stdClass();
+  $field_group->disabled = FALSE; /* Edit this to true to make a default field_group disabled initially */
+  $field_group->api_version = 1;
+  $field_group->identifier = 'group_references|TripalEntity|bio_data_45|default';
+  $field_group->group_name = 'group_references';
+  $field_group->entity_type = 'TripalEntity';
+  $field_group->bundle = 'bio_data_45';
+  $field_group->mode = 'default';
+  $field_group->parent_name = '';
+  $field_group->data = array(
+    'label' => 'References',
+    'weight' => '3',
+    'children' => array(
+      0 => 'sio__references',
+    ),
+    'format_type' => 'fieldset',
+    'format_settings' => array(
+      'label' => 'References',
+      'instance_settings' => array(
+        'id' => '',
+        'classes' => 'group-references field-group-fieldset',
+        'description' => 'The following data housed by this site is referred  to by this publication.',
+      ),
+      'formatter' => 'open',
+    ),
+  );
+  $field_groups[''] = $field_group;
+
+  // Translatables
+  // Included for use with string extractors like potx.
+  t('Citation');
+  t('Properties');
+  t('References');
+
+  return $field_groups;
+}

+ 14 - 0
tripal_ds/publication.info

@@ -0,0 +1,14 @@
+name = Publication
+core = 7.x
+package = Features
+dependencies[] = ctools
+dependencies[] = ds
+dependencies[] = field_group
+features[ctools][] = ds:ds:1
+features[ctools][] = field_group:field_group:1
+features[ds_layout_settings][] = TripalEntity|bio_data_45|default
+features[features_api][] = api:2
+features[field_group][] = group_citation|TripalEntity|bio_data_45|default
+features[field_group][] = group_properties|TripalEntity|bio_data_45|default
+features[field_group][] = group_property_table|TripalEntity|bio_data_45|default
+features[field_group][] = group_references|TripalEntity|bio_data_45|default

+ 7 - 0
tripal_ds/publication.module

@@ -0,0 +1,7 @@
+<?php
+/**
+ * @file
+ * Code for the Publication feature.
+ */
+
+include_once 'publication.features.inc';

+ 61 - 0
tripal_ds/theme/css/tripaldsfeature.css

@@ -0,0 +1,61 @@
+
+.ds-right {
+  width: 75%;
+  float: right;
+}
+
+.ds-left {
+  width: 23%;
+  float: left;
+}
+
+.tripal-ds-button {
+  height: 15px;
+  vertical-align: text-top;
+}
+
+.hideTripalPane {
+	display: none;
+}
+.showTripalPane {
+	display: inherit;
+}
+/*
+fieldset {
+	border: none!important;
+}
+
+th {
+	border-bottom: none;
+}
+
+.tripal-entity-unattached {
+    vertical-align: top;
+    border-top: 1px solid #CCCCCC;
+    font-size: 14px;
+}
+
+.tripal-entity-unattached .field-label {
+	font-weight: bold;
+	font-size: 16px;
+	padding: 10px 0;
+}
+.tripal-entity-unattached .field {
+	padding: 10px 0 0 20px;
+}
+
+.tripal-entity-unattached tr.odd {
+	border:	none;
+	background: none;
+	padding: 0;
+}
+
+.tripal-entity-unattached tbody {
+	border: none;
+}
+
+
+fieldset.collapsed {
+	height: 2em!important;
+}
+*/

TEMPAT SAMPAH
tripal_ds/theme/images/close_btn.png


+ 56 - 0
tripal_ds/theme/js/tripal_ds.js

@@ -0,0 +1,56 @@
+(function($) {
+
+  Drupal.behaviors.tripal_ds = {
+    attach: function (context, settings){
+
+      // Add a close button for each pane except for the te_base
+      $('.field-group-fieldset .fieldset-legend').each(function (i) {
+        $(this).append('<div class="tripal_pane-fieldset-close_button"><div id="tripal-pane-close-button" class="tripal-pane-button">CLOSE</div></div>');
+        var id = '.tripal_pane-fieldset-' + $(this).attr('id');
+      });
+      // Hide the pane when the close button is clicked
+      $('.tripal_pane-fieldset-close_button').each(function (i) {
+        $(this).css('float', 'right');
+        $(this).css('cursor', 'pointer');
+        $(this).css('margin', '0px 5px');
+        $(this).click(function () {
+          var fs = $(this).parent().parent().parent().parent().parent();
+          if($(fs).hasClass('showTripalPane'))  {
+            $(fs).removeClass('showTripalPane');
+            $(fs).addClass('hideTripalPane');
+          }
+          else {
+            $(fs).addClass('hideTripalPane');
+          } 
+        });
+      });
+      // Move the tripal pane to the first position when its TOC item is clicked.
+      $('.tripal_pane-toc-list-item-link').each(function (i) {
+        $(this).click(function() {
+          var id = '.tripal_pane-fieldset-' + $(this).attr('id');
+          var prevObj = $(id).prev().attr('class');
+            // If the user clicks on other TOC item, move its fieldset to the top 
+              $(id + ' fieldset').removeClass('collapsed');
+              $(id + ' fieldset .fieldset-wrapper').show();
+              // Hightlight the fieldset instead of moving if it's already at the top
+              if (prevObj.indexOf('group-tripal-pane-content-top') == 0) {
+                $(id + ' fieldset').fadeTo(10, 0.3, function() {});
+                $(id + ' fieldset').fadeTo(200, 1, function() {});
+              }
+              if ($(id).hasClass('hideTripalPane')) {
+                $(id).removeClass('hideTripalPane');
+                $(id).addClass('showTripalPane');
+              }
+              else {
+                $(id + ' fieldset .fieldset-wrapper').hide();
+                var obj = $(id).detach();
+                $('.group-tripal-pane-content-top').after(obj);
+              }
+            $(id + ' fieldset .fieldset-wrapper').show(300);
+          return false;
+        });
+      });
+    },
+  };
+  
+})(jQuery);

+ 23 - 0
tripal_ds/theme/templates/tripal-ds-feature.tpl.php

@@ -0,0 +1,23 @@
+<?php
+
+/**
+ * This template file provides the layout for the Tripal DS modules.
+ *
+ */
+?>
+ <<?php print $layout_wrapper; print $layout_attributes; ?> class="<?php print $classes;?> clearfix">
+
+   <?php if (isset($title_suffix['contextual_links'])): ?>
+   <?php print render($title_suffix['contextual_links']); ?>
+   <?php endif; ?>
+
+   <<?php print $left_wrapper ?> class="ds-left<?php print $left_classes; ?>">
+     <?php print $left; ?>
+   </<?php print $left_wrapper ?>>
+
+   <<?php print $right_wrapper ?> class="ds-right<?php print $right_classes; ?>">
+    <div class='group-tripal-pane-content-top'></div>
+     <?php print $right; ?>
+   </<?php print $right_wrapper ?>>
+
+ </<?php print $layout_wrapper ?>>

+ 14 - 0
tripal_ds/tripal_ds.info

@@ -0,0 +1,14 @@
+name = Tripal DS
+description = Provides display options for Tripal Entities through extending Display Suite.
+core = 7.x
+project = tripal
+package = Tripal
+version = 7.x-3.0-alpha1
+
+stylesheets[all][] = theme/css/tripaldsfeature.css
+
+dependencies[] = ds
+dependencies[] = field_group
+dependencies[] = field_group_table
+dependencies[] = tripal
+dependencies[] = ctools

+ 45 - 0
tripal_ds/tripal_ds.install

@@ -0,0 +1,45 @@
+<?php
+/**
+ * @file
+ * Fieldgroup module install file.
+ */
+
+/**
+ * Implements hook_schema().
+ */
+function tripal_ds_schema() {
+  $schema['tripal_ds'] = array(
+    'description' => t('Table that contains the Tripal Pane fieldsets.'),
+
+    'fields' => array(
+      'id' => array(
+        'type' => 'serial',
+        'not null' => TRUE,
+        'description' => 'The primary identifier for a group',
+        'no export' => TRUE,
+      ),
+      'tripal_ds_field_label' => array(
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => '',
+        'description' => 'The label of this Tripal Pane.',
+      ),
+      'tripal_ds_field_name' => array(
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => '',
+        'description' => 'The name of this Tripal Pane.',
+      ),
+      'bundle' => array(
+        'type' => 'varchar',
+        'length' => 128,
+        'not null' => TRUE,
+        'default' => ''
+        ),
+    ),
+    'primary key' => array('id'),
+  );
+  return $schema;
+}

+ 86 - 0
tripal_ds/tripal_ds.module

@@ -0,0 +1,86 @@
+<?php
+
+require_once "includes/tripal_ds.inc";
+require_once "includes/tripal_ds.ds.inc";
+require_once "includes/tripal_ds.field_group.inc";
+require_once "includes/tripal_ds.field_formatter.inc";
+
+function tripal_ds_init() {
+  drupal_add_css(drupal_get_path('module', 'tripal_ds') . '/theme/css/tripaldsfeature.css');
+  drupal_add_js(drupal_get_path('module', 'tripal_ds') . '/theme/js/tripal_ds.js');
+  
+  $theme_dir = url(drupal_get_path('module', 'tripal_ds') . '/theme');
+  drupal_add_js("var ds_theme_dir  = '$theme_dir';", 'inline', 'header');
+
+}
+
+/**
+ * Implements hook_views_api().
+ */
+function tripal_ds_views_api() {
+    return array(
+        'api' => 3,
+        'path' => drupal_get_path('module', 'tripal_ds') . '/includes/views',
+    );
+}
+
+/**
+ * Implements hook_bundle_postcreate().
+ *
+ * This is a Triapl defined hook and is called in the TripalBundle::create()
+ * function to allow modules to perform tasks when a bundle is created.
+ */
+function tripal_ds_bundle_postcreate($bundle) {
+  $bundle_name = $bundle->name;
+  $instances = field_info_instances('TripalEntity', $bundle_name);
+  _ds_layout_settings_info($bundle_name, $instances);
+}
+
+function tripal_ds_table_column_delete($bundle){
+    $bundle_name = $bundle->name;
+    db_delete('tripal_ds')
+      ->condition('bundle', $bundle_name, '=')
+      ->execute();
+}
+
+function tripal_ds_bundle_delete($bundle){
+  tripal_ds_table_column_delete($bundle);
+}
+/*
+ * Implements hook_ds_layout_info() to define layouts from code in a module for
+ * display suite
+ */
+function tripal_ds_ds_layout_info() {
+  $path = drupal_get_path('module', 'tripal_ds');
+
+  $layouts = array(
+    'tripal_ds_feature' => array(
+      'label' => t('Tripal Feature Layout'),
+      'path' => $path . '/theme/templates',
+      'regions' => array(
+        'left' => t('Left'),
+        'right' => t('Right'),
+      ),
+      'css' => TRUE,
+    ),
+  );
+
+  return $layouts;
+}
+
+/*
+ * Code for the view of the menu items
+
+    //get tripal entity id from url then run it against tripal entity db
+    //and grab the bundle id, then pass bundle id to view
+    $url = current_path();
+    $url_exploded = explode("/", $url);
+    $tripal_entity_id = (int)$url_exploded[1];
+
+    $result = db_select('tripal_entity', 'te')
+      ->fields('te', array('bundle'))
+      ->condition('id', $tripal_entity_id, '=')
+      ->execute()
+      ->fetchField();
+*/
+