Browse Source

final changes before merge

Shawna Spoor 8 years ago
parent
commit
f5429b58f6

+ 10 - 0
tripal/api/tripal.entities.api.inc

@@ -160,6 +160,16 @@ function tripal_load_bundle_entity($values) {
   return NULL;
 }
 
+
+/**
+ * Allows a module to perform tasks before a TripalBundle object is deleted.
+ *
+ * @param $bundle
+ *   The newly created TripalBundle object.
+ */
+function hook_bundle_delete($bundle) {
+
+}
 /**
  * Allows a module to perform tasks after a TripalBundle object is created.
  *

+ 7 - 0
tripal/includes/TripalBundleController.inc

@@ -55,6 +55,13 @@ class TripalBundleController extends EntityAPIControllerExportable {
 
       foreach ($bundles as $id => $bundle) {
 
+        // Allow modules to perform actions when the bundle is deleted.
+        $modules = module_implements('bundle_delete');
+        foreach ($modules as $module) {
+          $function = $module . '_bundle_delete';
+          $function($bundle);
+        }
+
         // Find any TripalEntity fields that are attached to this bundle and
         // remove them.
         $instances = field_info_instances('TripalEntity', $bundle->name);

+ 54 - 37
tripal_ds/includes/tripal_ds.ds.inc

@@ -1,24 +1,41 @@
 <?php
+/*
+ * 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;
+}
+
 /**
  * Implements hook_ds_layout_settings_info().
  */
 function _ds_layout_settings_info($bundle_name, $instances) {
-    //$all_fields= array(); //was region_right
-    $prop_fields = array(); // was region_left
-    $summary_fields = array(); // was region_top
-    $data_sequence_fields = array(); //was region_bottom
-
-    //$prop_fields = array();
-    //$data_sequence_fields = array();
+    $region_right = array(); 
+    $region_left = array();
+    $prop_fields = array(); 
+    $summary_fields = array();
+    $data_sequence_fields = array(); 
     $all_other_fields = array();
-    //$fields_with_regions = 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]= 'top';
+            $fields_with_regions[$instance_name]= 'right';
 
         } 
         else {
@@ -34,19 +51,19 @@ function _ds_layout_settings_info($bundle_name, $instances) {
                     if ($prop_table !== FALSE){
                         //Properties section instances
                         array_push($prop_fields, $instance_name);
-                        //$fields_with_regions[$instance_name]= 'right';
+                        $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';
+                        $fields_with_regions[$instance_name] = 'right';
 
                     } 
                     else {
                         //overview section instances
                         array_push($summary_fields, $instance_name);
-                       // $fields_with_regions[$instance_name] = 'top';
+                        $fields_with_regions[$instance_name] = 'right';
                     }
 
                 } 
@@ -54,19 +71,19 @@ function _ds_layout_settings_info($bundle_name, $instances) {
                     if ($prop_table !== FALSE){
                         //Properties section instances
                         array_push($prop_fields, $instance_name);
-                       // $fields_with_regions[$instance_name]= 'right';
+                        $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';
+                        $fields_with_regions[$instance_name]= 'right';
 
                     } 
                     else {
                         //Linker section instances
                         array_push($all_other_fields, $instance);
-                       // $fields_with_regions[$instance_name]= 'right';
+                        $fields_with_regions[$instance_name]= 'right';
 
                         //update the display settings so that the title is hidden
                         $instance['display']['default']['label'] = 'hidden';
@@ -83,24 +100,26 @@ function _ds_layout_settings_info($bundle_name, $instances) {
         _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' =>'top', 'group_summary' => 'top', 'group_summary_table' => 'top' ];
+        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 = $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');
+        array_unshift($prop_fields, 'group_prop_tripalpane', 'group_prop', 'group_prop_table');
 
         //add the fields to the regions
-        //$region_right = array_merge($prop_fields, $region_right);
-        //$fields_with_regions += [ 'group_prop_tripalpane' => 'right', 'group_prop' => 'right', 'group_prop_table' => 'right' ];
+        $region_right = $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');
+        array_unshift($data_sequence_fields, 'group_sequence_tripalpane', 'group_sequence', 'group_sequence_table');
 
         //add the fields to the regions
-        //$region_right = array_merge($data_sequence_fields, $region_right);
-        //$fields_with_regions += [ 'group_sequence_tripalpane' => 'right', 'group_sequence' => 'right', 'group_sequence_table' => 'right' ];
+        $region_right = $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) {
@@ -120,15 +139,17 @@ function _ds_layout_settings_info($bundle_name, $instances) {
           //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' ];
+          array_push($temporary_field, $group_field_name, $fieldset_field_name, $other_field['field_name']);
+          $region_right = $region_right + $temporary_field;
+          $fields_with_regions += [ $group_field_name => 'right', $fieldset_field_name => 'right' ];
 
 
         }
 
     }
-    /*
+    //add blocks to $region_left
+    array_push($region_left, 'toc');
+    $fields_with_regions += [ 'toc' => 'left'];
     //build the ds layout
     $record = new stdClass;
     $record->id ='TripalEntity|' . $bundle_name . '|default';
@@ -138,23 +159,17 @@ function _ds_layout_settings_info($bundle_name, $instances) {
     $record->layout = 'tripal_ds_feature';
     $settings = array(
         'regions' => array(
-            'top' =>
-                $region_top,
-            'left' =>
+            'left' => 
                 $region_left,
             'right' =>
                 $region_right,
-            'bottom' =>
-                $region_bottom,
         ),
         'fields' =>
             $fields_with_regions,
         'classes' => array(),
         'wrappers' => array(
-            'top' => 'div',
             'left' => 'div',
             'right' => 'div',
-            'bottom' => 'div',
         ),
         'layout_wrapper' => 'div',
         'layout_attributes' => '',
@@ -165,5 +180,7 @@ function _ds_layout_settings_info($bundle_name, $instances) {
     );
     $record->settings = $settings;
     drupal_write_record('ds_layout_settings', $record);
-    */
-}
+}
+
+
+

+ 75 - 5
tripal_ds/includes/tripal_ds.field_formatter.inc

@@ -8,17 +8,13 @@ function tripal_ds_field_group_formatter_info() {
       'tripalpane' => array(
         'label' => t('Tripal Pane'),
         'description' => t('This fieldgroup renders the inner content in a Tripal Pane with the title as legend.'),
-        'format_types' => array('open', 'collapsible', 'collapsed'),
         'instance_settings' => array('description' => '', 'classes' => '', 'id' => ''),
-        'default_formatter' => 'collapsible',
       ),
     ),
      '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.'),
-          'format_types' => array('open', 'collapsible', 'collapsed'),
-          'default_formatter' => 'collapsible',
           'instance_settings' => array('description' => '', 'classes' => '', 'id' => ''),
         ),
       ),
@@ -43,6 +39,7 @@ function tripal_ds_field_group_format_settings($group) {
 
   return $form;
 }
+
 /*
  * Implements field_group_pre_render_<format-type>.
  * Format type: Tripalpane.
@@ -59,4 +56,77 @@ function tripal_ds_field_group_pre_render(&$element, $group, &$form) {
       $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);
+    }
+  }
+}
+

+ 8 - 8
tripal_ds/includes/tripal_ds.field_group.inc

@@ -35,8 +35,8 @@ function _summary_field_group_info($bundle_name, $fields){
 
     //write to the tripal_ds table to record the new tripal pane
     $field_for_table = new stdClass();
-    $field_for_table->field_name = 'group_summary_tripalpane';
-    $field_for_table->field_label = 'Summary';
+    $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;
 
@@ -141,8 +141,8 @@ function _prop_field_group_info($bundle_name, $fields){
     
     //write to the tripal_ds table to record the new tripal pane
     $field_for_table = new stdClass();
-    $field_for_table->field_name = 'group_prop_tripalpane';
-    $field_for_table->field_label = 'Properties';
+    $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;
 
@@ -246,8 +246,8 @@ function _data_sequence_field_group_info($bundle_name, $fields){
 
     //write to the tripal_ds table to record the new tripal pane
     $field_for_table = new stdClass();
-    $field_for_table->field_name = 'group_sequences_tripalpane';
-    $field_for_table->field_label = 'Data Sequences';
+    $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;
 
@@ -324,8 +324,8 @@ function _data_sequence_field_group_info($bundle_name, $fields){
 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->field_name = $group_field_name;
-    $field_for_table->field_label = $field_label;
+    $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;
 

+ 2 - 2
tripal_ds/includes/views/tripal_ds.views.inc

@@ -39,7 +39,7 @@ function tripal_ds_views_data() {
     	),
   	);
 
-    $data['tripal_ds']['field_name'] = array(
+    $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(
@@ -57,7 +57,7 @@ function tripal_ds_views_data() {
 	    ),
     );
 
-    $data['tripal_ds']['field_label'] = array(
+    $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(

+ 75 - 73
tripal_ds/includes/views/tripal_ds.views_default.inc

@@ -5,82 +5,84 @@
  */
 function tripal_ds_views_default_views() {
  
-$view = new view();
-$view->name = 'page_info_menu';
-$view->description = '';
-$view->tag = 'default';
-$view->base_table = 'tripal_ds';
-$view->human_name = 'Tripal Content Type Page Info';
-$view->core = 7;
-$view->api_version = '3.0';
-$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+	$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['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']['field_name']['id'] = 'field_name';
-$handler->display->display_options['fields']['field_name']['table'] = 'tripal_ds';
-$handler->display->display_options['fields']['field_name']['field'] = 'field_name';
-$handler->display->display_options['fields']['field_name']['label'] = '';
-$handler->display->display_options['fields']['field_name']['exclude'] = TRUE;
-$handler->display->display_options['fields']['field_name']['element_label_colon'] = FALSE;
-/* Field: Tripal Panes: Field Label */
-$handler->display->display_options['fields']['field_label']['id'] = 'field_label';
-$handler->display->display_options['fields']['field_label']['table'] = 'tripal_ds';
-$handler->display->display_options['fields']['field_label']['field'] = 'field_label';
-$handler->display->display_options['fields']['field_label']['label'] = '';
-$handler->display->display_options['fields']['field_label']['alter']['alter_text'] = TRUE;
-$handler->display->display_options['fields']['field_label']['alter']['text'] = '<a href="#" class="tripal_pane-toc-list-item-link" id ="[field_name]">[field_label] </a>';
-$handler->display->display_options['fields']['field_label']['alter']['link_class'] = '[field_label]';
-$handler->display->display_options['fields']['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];
+	/* 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();
+	    $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';
-/* Filter criterion: Global: Fields comparison */
-$handler->display->display_options['filters']['fields_compare']['id'] = 'fields_compare';
-$handler->display->display_options['filters']['fields_compare']['table'] = 'views';
-$handler->display->display_options['filters']['fields_compare']['field'] = 'fields_compare';
+	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'] = 'page_info_menu';
+	/* 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;
+	/* 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;
 }

+ 10 - 7
tripal_ds/theme/css/tripaldsfeature.css

@@ -1,15 +1,12 @@
-.ds-top {
-  width: 100%;
-  padding: 25px 0;
-}
 
 .ds-right {
-  width: 100%;
+  width: 75%;
   float: right;
 }
 
-.ds-bottom {
-  width: 100%;
+.ds-left {
+  width: 23%;
+  float: left;
 }
 
 .tripal-ds-button {
@@ -17,6 +14,12 @@
   vertical-align: text-top;
 }
 
+.hideTripalPane {
+	display: none;
+}
+.showTripalPane {
+	display: inherit;
+}
 /*
 fieldset {
 	border: none!important;

+ 17 - 36
tripal_ds/theme/js/tripal_ds.js

@@ -2,70 +2,51 @@
 
   Drupal.behaviors.tripal_ds = {
     attach: function (context, settings){
-    	console.log('tripal pane javascript');
+
       // Add a close button for each pane except for the te_base
-      $('.tripal_pane-fieldset .fieldset-legend').each(function (i) {
-        if ($(this).parent().parent().attr('id') != 'tripal_ds-fieldset-te_base') {
-          $(this).append('<div class="tripal_pane-fieldset-close_button"><div id="tripal-pane-close-button" class="trip al-pane-button">CLOSE</div></div>');
-        }
+      $('.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();
-          var fsid = fs.attr('id');
-          if (fsid.indexOf('tripal_pane-fieldset-') == 0) {
-            $(fs).fadeOut(300);
+          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');
-          console.log("id: ");
-          console.log(id);
-
-          //console.log(prevObj);
-
-            // If the user clicks on the tripal_pane-fieldset-group_summary_tripalpane TOC item, open the fieldset if it's closed
-            if (id == '.tripal_pane-fieldset-group_summary_tripalpane') {
-              if ($('.tripal_pane-fieldset-group_summary_tripalpane fieldset').hasClass('collapsed')) {
-            	  $('.tripal_pane-fieldset-group_summary_tripalpane fieldset').removeClass('collapsed');
-            	  $('.tripal_pane-fieldset-group_summary_tripalpane fieldset .fieldset-wrapper').show();
-              }
-              else {
-                 $('.tripal_pane-fieldset-group_summary_tripalpane fieldset').fadeTo(10, 0.3, function() {});
-                 $('.tripal_pane-fieldset-group_summary_tripalpane fieldset').fadeTo(200, 1, function() {});
-              }
-            }
-            // If the user clicks on other TOC item, move its fieldset to the top right below the te_base
-            else {
+            // 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 && $('.tripal_pane-fieldset-group_summary_tripalpane fieldset').hasClass('collapsed')) {
+              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);
               }
-              // Close the te_base fieldset
-              $('.tripal_pane-fieldset-group_summary_tripalpane fieldset .fieldset-wrapper').hide();
-              $('.tripal_pane-fieldset-group_summary_tripalpane fieldset').addClass('collapsed');
-            }
             $(id + ' fieldset .fieldset-wrapper').show(300);
-          //}
           return false;
         });
       });

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

@@ -10,9 +10,6 @@
    <?php if (isset($title_suffix['contextual_links'])): ?>
    <?php print render($title_suffix['contextual_links']); ?>
    <?php endif; ?>
-   <<?php print $top_wrapper ?> class="ds-top<?php print $top_classes; ?>">
-     <?php print $top; ?>
-   </<?php print $top_wrapper ?>>
 
    <<?php print $left_wrapper ?> class="ds-left<?php print $left_classes; ?>">
      <?php print $left; ?>
@@ -23,8 +20,4 @@
      <?php print $right; ?>
    </<?php print $right_wrapper ?>>
 
-   <<?php print $bottom_wrapper ?> class="ds-bottom<?php print $bottom_wrapper; ?>">
-     <?php print $bottom; ?>
-   </<?php print $bottom_wrapper ?>>
-
  </<?php print $layout_wrapper ?>>

+ 2 - 2
tripal_ds/tripal_ds.install

@@ -18,14 +18,14 @@ function tripal_ds_schema() {
         'description' => 'The primary identifier for a group',
         'no export' => TRUE,
       ),
-      'field_label' => array(
+      'tripal_ds_field_label' => array(
         'type' => 'varchar',
         'length' => 255,
         'not null' => TRUE,
         'default' => '',
         'description' => 'The label of this Tripal Pane.',
       ),
-      'field_name' => array(
+      'tripal_ds_field_name' => array(
         'type' => 'varchar',
         'length' => 255,
         'not null' => TRUE,

+ 24 - 18
tripal_ds/tripal_ds.module

@@ -24,10 +24,32 @@ function tripal_ds_views_api() {
     );
 }
 
+/**
+ * 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');
 
@@ -36,10 +58,8 @@ function tripal_ds_ds_layout_info() {
       'label' => t('Tripal Feature Layout'),
       'path' => $path . '/theme/templates',
       'regions' => array(
-        'top' => t('Top'),
         'left' => t('Left'),
         'right' => t('Right'),
-        'bottom' => t('Bottom'),
       ),
       'css' => TRUE,
     ),
@@ -47,21 +67,6 @@ function tripal_ds_ds_layout_info() {
 
   return $layouts;
 }
- */
-/**
- * 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);
-}
-
-
-
 
 /*
  * Code for the view of the menu items
@@ -78,3 +83,4 @@ function tripal_ds_bundle_postcreate($bundle) {
       ->execute()
       ->fetchField();
 */
+