Kaynağa Gözat

Replaced tabs with two spaces... updated node template

Stephen Ficklin 11 yıl önce
ebeveyn
işleme
ccb384e703
25 değiştirilmiş dosya ile 1079 ekleme ve 1066 silme
  1. 36 36
      tripal_bulk_loader/api/tripal_bulk_loader.api.templates.inc
  2. 3 3
      tripal_bulk_loader/includes/tripal_bulk_loader.admin.templates.inc
  3. 42 42
      tripal_bulk_loader/includes/tripal_bulk_loader.loader.inc
  4. 37 37
      tripal_bulk_loader/theme/node--tripal-bulk-loader.tpl.php
  5. 24 24
      tripal_bulk_loader/theme/tripal_bulk_loader_template.tpl.php
  6. 22 22
      tripal_contact/includes/tripal_contact.chado_node.inc
  7. 1 1
      tripal_contact/tripal_contact.install
  8. 11 9
      tripal_core/theme/css/tripal.css
  9. 9 2
      tripal_core/theme/node--chado-generic.tpl.php
  10. 4 1
      tripal_core/tripal_core.module
  11. 10 10
      tripal_core/tripal_launch_jobs_multi.php
  12. 78 78
      tripal_cv/theme/js/jquery-treeview/demo/source.php
  13. 25 25
      tripal_cv/theme/js/jsTree/reference/_examples/1_async.php
  14. 358 358
      tripal_cv/theme/js/jsTree/reference/_examples/full/_inc/class.tree.php
  15. 73 73
      tripal_cv/theme/js/jsTree/reference/_examples/full/_inc/database.php
  16. 81 81
      tripal_cv/theme/js/jsTree/reference/_examples/full/server.php
  17. 54 53
      tripal_feature/includes/tripal_feature.blocks.inc
  18. 1 1
      tripal_feature/tripal_feature.module
  19. 25 25
      tripal_featuremap/includes/tripal_featuremap.chado_node.inc
  20. 1 1
      tripal_organism/theme/tripal_organism/tripal_organism_description.tpl.php
  21. 25 25
      tripal_project/includes/tripal_project.chado_node.inc
  22. 40 40
      tripal_pub/includes/tripal_pub.chado_node.inc
  23. 94 94
      tripal_pub/theme/tripal_pub_help.tpl.php
  24. 1 1
      tripal_stock/theme/tripal_organism/tripal_organism_stocks.tpl.php
  25. 24 24
      tripal_views/tripal_views.views.inc

+ 36 - 36
tripal_bulk_loader/api/tripal_bulk_loader.api.templates.inc

@@ -44,9 +44,9 @@ function tripal_bulk_loader_is_record_name_unique($new_record_name, $template_id
   // Check the new record name is unique
   foreach ($template_array as $priority => $t) {
     if (strcmp($t['record_id'], $new_record_name) == 0) {
-    	if (($priority != $current_priority) AND ($current_priority !== NULL)) {
-	      return FALSE;
-	    }
+      if (($priority != $current_priority) AND ($current_priority !== NULL)) {
+        return FALSE;
+      }
     }
   }
   return TRUE;
@@ -67,21 +67,21 @@ function tripal_bulk_loader_is_record_name_unique($new_record_name, $template_id
  */
 function tripal_bulk_loader_delete_record($delete_priority, $template_array) {
 
-	if (empty($template_array)) {
-		drupal_set_message("Unable to delete record with a priority of $priority since the template was not supplied",'error');
-		return FALSE;
-	}
+  if (empty($template_array)) {
+    drupal_set_message("Unable to delete record with a priority of $priority since the template was not supplied",'error');
+    return FALSE;
+  }
 
-	$new_template_array = array();
-	$i=0;
-	foreach ($template_array as $priority => $record) {
-		if ($priority != $delete_priority) {
-			$new_template_array[$i] = $record;
-			$i++;
-		}
-	}
+  $new_template_array = array();
+  $i=0;
+  foreach ($template_array as $priority => $record) {
+    if ($priority != $delete_priority) {
+      $new_template_array[$i] = $record;
+      $i++;
+    }
+  }
 
-	return $new_template_array;
+  return $new_template_array;
 }
 
 /**
@@ -101,27 +101,27 @@ function tripal_bulk_loader_delete_record($delete_priority, $template_array) {
  */
 function tripal_bulk_loader_delete_field($priority, $delete_field_index, $template_array) {
 
-	if (empty($template_array)) {
-		drupal_set_message("Unable to delete record with a priority of $priority since the template was not supplied",'error');
-		return FALSE;
-	}
+  if (empty($template_array)) {
+    drupal_set_message("Unable to delete record with a priority of $priority since the template was not supplied",'error');
+    return FALSE;
+  }
 
-	// Re-order the remaining fields of the same record to ensure that the indicies are
-	// 0 to size and. If this is not done, weird behaviour may result
-	$new_template_array = $template_array;
-	$new_template_array[$priority]['fields'] = array();
-	$i=0;
-	foreach ($template_array[$priority]['fields'] as $field_index => $field_details) {
-		if ($field_index != $delete_field_index) {
-			$new_template_array[$priority]['fields'][$i] = $field_details;
-			$i++;
-		}
-	}
+  // Re-order the remaining fields of the same record to ensure that the indicies are
+  // 0 to size and. If this is not done, weird behaviour may result
+  $new_template_array = $template_array;
+  $new_template_array[$priority]['fields'] = array();
+  $i=0;
+  foreach ($template_array[$priority]['fields'] as $field_index => $field_details) {
+    if ($field_index != $delete_field_index) {
+      $new_template_array[$priority]['fields'][$i] = $field_details;
+      $i++;
+    }
+  }
 
-	// If this field was the only one in the current record, also delete the record
-	if (empty($new_template_array[$priority]['fields'])) {
-		$new_template_array = tripal_bulk_loader_delete_record($priority, $new_template_array);
-	}
+  // If this field was the only one in the current record, also delete the record
+  if (empty($new_template_array[$priority]['fields'])) {
+    $new_template_array = tripal_bulk_loader_delete_record($priority, $new_template_array);
+  }
 
-	return $new_template_array;
+  return $new_template_array;
 }

+ 3 - 3
tripal_bulk_loader/includes/tripal_bulk_loader.admin.templates.inc

@@ -2368,9 +2368,9 @@ function tripal_bulk_loader_delete_template_field_form_submit($form, &$form_stat
     $form_state['storage']['field_id'],
     $form_state['storage']['template']
   );
-	if (!empty($new_template)) {
-		$form_state['storage']['template'] = $new_template;
-	}
+  if (!empty($new_template)) {
+    $form_state['storage']['template'] = $new_template;
+  }
   drupal_set_message(t('Deleted Field from Template.'));
 
   $record = array(

+ 42 - 42
tripal_bulk_loader/includes/tripal_bulk_loader.loader.inc

@@ -672,51 +672,51 @@ function process_data_array_for_line($priority, &$data, &$default_data, $addt) {
       // This should have been set on the first round of inserts for this record
       $match = $data[$priority]['is_duplicate'];
       // However, sometimes there is a pre-existing record before the loader starts
-			// Thus check that this value is set and if not, then generate a match array
-			// based on the unique keys for this record.
-			if (empty($match)) {
-				$match = array();
-				// First check to see if we have fields for the primary key
-				foreach ($table_desc['primary key'] as $k_field) {
-					if (!empty($values[$k_field])) {
-						$match[$k_field] = $values[$k_field];
-					}
-				}
-				// Otherwise check the fields that are part of the unique key
-				if (empty($match)) {
-					foreach ($table_desc['unique keys'] as $u_keys) {
-						foreach ($u_keys as $u_field) {
-							if (!empty($values[$u_field])) {
-								$match[$u_field] = $values[$u_field];
-							}
-						}
-					}
-				}
-			}
-			if (!empty($match)) {
-				// Now we need to check if it already exists via a select
-				$results = tripal_core_chado_select($table, array_keys($table_desc['fields']), $match, array('print_errors' => TRUE));
-				// If not then insert
-				if (empty($results)) {
-					$options['statement_name'] = 'ins_'.$options['statement_name'];
-					$options['print_errors'] = TRUE;
-					$record = tripal_core_chado_insert($table, $values, $options);
-				}
-				else {
-				  $options['return_record'] = TRUE;
-				  $options['print_errors'] = TRUE;
-  		    $record = tripal_core_chado_update($table, $match, $values, $options);
-  		  }
-  	  }
-  	  else {
-  	  	$msg = "\nLine " . $addt->line_num . ' ' . $table_data['record_id'] . ' (' .
+      // Thus check that this value is set and if not, then generate a match array
+      // based on the unique keys for this record.
+      if (empty($match)) {
+        $match = array();
+        // First check to see if we have fields for the primary key
+        foreach ($table_desc['primary key'] as $k_field) {
+          if (!empty($values[$k_field])) {
+            $match[$k_field] = $values[$k_field];
+          }
+        }
+        // Otherwise check the fields that are part of the unique key
+        if (empty($match)) {
+          foreach ($table_desc['unique keys'] as $u_keys) {
+            foreach ($u_keys as $u_field) {
+              if (!empty($values[$u_field])) {
+                $match[$u_field] = $values[$u_field];
+              }
+            }
+          }
+        }
+      }
+      if (!empty($match)) {
+        // Now we need to check if it already exists via a select
+        $results = tripal_core_chado_select($table, array_keys($table_desc['fields']), $match, array('print_errors' => TRUE));
+        // If not then insert
+        if (empty($results)) {
+          $options['statement_name'] = 'ins_'.$options['statement_name'];
+          $options['print_errors'] = TRUE;
+          $record = tripal_core_chado_insert($table, $values, $options);
+        }
+        else {
+          $options['return_record'] = TRUE;
+          $options['print_errors'] = TRUE;
+          $record = tripal_core_chado_update($table, $match, $values, $options);
+        }
+      }
+      else {
+        $msg = "\nLine " . $addt->line_num . ' ' . $table_data['record_id'] . ' (' .
         $table_data['mode'] . ') Unable to update record since none of the unique key or primary key fields were available ' .
         ' where values:' . print_r($values, TRUE);
 
-      	tripal_bulk_loader_throw_error($msg, array(), TRIPAL_ERROR);
-      	$data[$priority]['error'] = TRUE;
-      	$no_errors = FALSE;
-  	  }
+        tripal_bulk_loader_throw_error($msg, array(), TRIPAL_ERROR);
+        $data[$priority]['error'] = TRUE;
+        $no_errors = FALSE;
+      }
     }
     else {
       $options['print_errors'] = TRUE;

+ 37 - 37
tripal_bulk_loader/theme/node--tripal-bulk-loader.tpl.php

@@ -1,45 +1,45 @@
 <div id="tripal_bulk_loader-base-box" class="tripal_bulk_loader-info-box tripal-info-box">
   <div class="tripal_bulk_loader-info-box-title tripal-info-box-title">
-  	<?php if ($teaser) { print l($node->title, 'node/'.$node->nid); } ?>
+    <?php if ($teaser) { print l($node->title, 'node/'.$node->nid); } ?>
   </div>
   <div class="tripal_bulk_loader-info-box-desc tripal-info-box-desc"></div>
 
-	<table id="tripal_bulk_loader-base-table" class="tripal_bulk_loader-table tripal-table tripal-table-vert">
-		<tr class="tripal_bulk_loader-table-odd-row tripal-table-odd-row">
-			<th>Job Name</th>
-			<td><?php print $node->loader_name;?></td>
-		</tr>
-		<tr class="tripal_bulk_loader-table-even-row tripal-table-even-row">
-			<th>Submitted By</th>
-			<td><span class="author"><?php //print theme('username', $node); ?></span></td>
-		</tr>
-		<tr class="tripal_bulk_loader-table-odd-row tripal-table-odd-row">
-			<th>Job Creation Date</th>
-			<td><?php print format_date($node->created, 'custom', "F j, Y, g:i a"); ?></td>
-		</tr>
-		<tr class="tripal_bulk_loader-table-even-row tripal-table-even-row">
-			<th>Last Updated</th>
-			<td><?php print format_date($node->changed, 'custom', "F j, Y, g:i a"); ?></td>
-		</tr>
-		<tr class="tripal_bulk_loader-table-odd-row tripal-table-odd-row">
-			<th>Template Name</th>
-			<td><?php print $node->template->name; ?></td>
-		</tr>
-		<tr class="tripal_bulk_loader-table-even-row tripal-table-even-row">
-			<th>Data File</th>
-			<td><?php print $node->file;?></td>
-		</tr>
-		<tr class="tripal_bulk_loader-table-odd-row tripal-table-odd-row">
-			<th>Job Status</th>
-			<td><?php print $node->job_status;?></td>
-		</tr>
-		<?php if (isset($node->job)) { if (isset($node->job->progress)) { ?>
-		<tr class="tripal_bulk_loader-table-even-row tripal-table-even-row">
-			<th>Job Progress</th>
-			<td><?php print $node->job->progress . '% (' . l('view job', 'admin/tripal/tripal_jobs/view/' . $node->job_id) . ')';?></td>
-		</tr>
-		<?php }} ?>
-	</table>
+  <table id="tripal_bulk_loader-base-table" class="tripal_bulk_loader-table tripal-table tripal-table-vert">
+    <tr class="tripal_bulk_loader-table-odd-row tripal-table-odd-row">
+      <th>Job Name</th>
+      <td><?php print $node->loader_name;?></td>
+    </tr>
+    <tr class="tripal_bulk_loader-table-even-row tripal-table-even-row">
+      <th>Submitted By</th>
+      <td><span class="author"><?php //print theme('username', $node); ?></span></td>
+    </tr>
+    <tr class="tripal_bulk_loader-table-odd-row tripal-table-odd-row">
+      <th>Job Creation Date</th>
+      <td><?php print format_date($node->created, 'custom', "F j, Y, g:i a"); ?></td>
+    </tr>
+    <tr class="tripal_bulk_loader-table-even-row tripal-table-even-row">
+      <th>Last Updated</th>
+      <td><?php print format_date($node->changed, 'custom', "F j, Y, g:i a"); ?></td>
+    </tr>
+    <tr class="tripal_bulk_loader-table-odd-row tripal-table-odd-row">
+      <th>Template Name</th>
+      <td><?php print $node->template->name; ?></td>
+    </tr>
+    <tr class="tripal_bulk_loader-table-even-row tripal-table-even-row">
+      <th>Data File</th>
+      <td><?php print $node->file;?></td>
+    </tr>
+    <tr class="tripal_bulk_loader-table-odd-row tripal-table-odd-row">
+      <th>Job Status</th>
+      <td><?php print $node->job_status;?></td>
+    </tr>
+    <?php if (isset($node->job)) { if (isset($node->job->progress)) { ?>
+    <tr class="tripal_bulk_loader-table-even-row tripal-table-even-row">
+      <th>Job Progress</th>
+      <td><?php print $node->job->progress . '% (' . l('view job', 'admin/tripal/tripal_jobs/view/' . $node->job_id) . ')';?></td>
+    </tr>
+    <?php }} ?>
+  </table>
 </div>
 
 <?php if (!$teaser) { ?>

+ 24 - 24
tripal_bulk_loader/theme/tripal_bulk_loader_template.tpl.php

@@ -10,29 +10,29 @@
   $template->template_array = unserialize($template->template_array);
 
   // Summarize Template
-	$fields = array();
-	$constants = array();
-	foreach ($template->template_array as $priority => $table_array) {
-		if (!is_array($table_array)) {
-			continue;
-		}
+  $fields = array();
+  $constants = array();
+  foreach ($template->template_array as $priority => $table_array) {
+    if (!is_array($table_array)) {
+      continue;
+    }
 
-		$table = $table_array['table'];
-		$record = $table_array['record_id'];
-		foreach ($table_array['fields'] as $field) {
-			if (preg_match('/table field/', $field['type'])) {
-				$field['table'] = $table;
-				$field['record'] = $record;
-				$sheet = 0;//$field['spreadsheet sheet'];
-				$column = $field['spreadsheet column'];
-				$fields[$sheet.'-'.$column][] = $field;
-			} elseif ($field['type'] == 'constant') {
-				$field['table'] = $table;
-				$field['record'] = $record;
-				$constants[] = $field;
-			}
-		}
-	}
+    $table = $table_array['table'];
+    $record = $table_array['record_id'];
+    foreach ($table_array['fields'] as $field) {
+      if (preg_match('/table field/', $field['type'])) {
+        $field['table'] = $table;
+        $field['record'] = $record;
+        $sheet = 0;//$field['spreadsheet sheet'];
+        $column = $field['spreadsheet column'];
+        $fields[$sheet.'-'.$column][] = $field;
+      } elseif ($field['type'] == 'constant') {
+        $field['table'] = $table;
+        $field['record'] = $record;
+        $constants[] = $field;
+      }
+    }
+  }
 ?>
 
 <div id="tripal_bulk_loader-base-box" class="tripal_bulk_loader-info-box tripal-info-box">
@@ -47,7 +47,7 @@
     <?php $row = 'even' ?>
     <?php foreach ($constants as $field) {?>
       <tr class="tripal_bulk_loader-table-<?php print $row; ?>-row tripal-table-<?php print $row; ?>-row">
-				<td><?php print $field['record'];?></td>
+        <td><?php print $field['record'];?></td>
         <td><?php print $field['title'];?></td>
         <td><?php print $field['constant value']; ?></td>
         <td><?php print $field['table'];?></td>
@@ -66,7 +66,7 @@
   <?php foreach ($fields as $column) {?>
     <?php foreach ($column as $field) {?>
     <tr class="tripal_bulk_loader-table-<?php print $row; ?>-row tripal-table-<?php print $row; ?>-row">
-    	<td><?php print $field['record'];?></td>
+      <td><?php print $field['record'];?></td>
       <td><?php print $field['title'];?></td>
       <td><?php print $field['spreadsheet column'];?></td>
       <td><?php print $field['table'];?></td>

+ 22 - 22
tripal_contact/includes/tripal_contact.chado_node.inc

@@ -503,27 +503,27 @@ function chado_contact_delete(&$node) {
  */
 function tripal_contact_node_view($node, $view_mode, $langcode) {
   switch ($node->type) {
-  	case 'chado_contact':
-  	  // Show feature browser and counts
-  	  if ($view_mode == 'full') {
-  	    $node->content['tripal_contact_base'] = array(
-  	      '#value' => theme('tripal_contact_base', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_contact_properties'] = array(
-  	      '#value' => theme('tripal_contact_properties', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_contact_publications'] = array(
-  	      '#value' => theme('tripal_contact_publications', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_contact_relationships'] = array(
-  	      '#value' => theme('tripal_contact_relationships', array('node' => $node)),
-  	    );
-  	  }
-  	  if ($view_mode == 'teaser') {
-  	    $node->content['tripal_contact_teaser'] = array(
-  	      '#value' => theme('tripal_contact_teaser', array('node' => $node)),
-  	    );
-  	  }
-  	  break;
+    case 'chado_contact':
+      // Show feature browser and counts
+      if ($view_mode == 'full') {
+        $node->content['tripal_contact_base'] = array(
+          '#value' => theme('tripal_contact_base', array('node' => $node)),
+        );
+        $node->content['tripal_contact_properties'] = array(
+          '#value' => theme('tripal_contact_properties', array('node' => $node)),
+        );
+        $node->content['tripal_contact_publications'] = array(
+          '#value' => theme('tripal_contact_publications', array('node' => $node)),
+        );
+        $node->content['tripal_contact_relationships'] = array(
+          '#value' => theme('tripal_contact_relationships', array('node' => $node)),
+        );
+      }
+      if ($view_mode == 'teaser') {
+        $node->content['tripal_contact_teaser'] = array(
+          '#value' => theme('tripal_contact_teaser', array('node' => $node)),
+        );
+      }
+      break;
   }
 }

+ 1 - 1
tripal_contact/tripal_contact.install

@@ -48,7 +48,7 @@ function tripal_contact_requirements($phase) {
  */
 function tripal_contact_install() {
 
-	// create the module's data directory
+  // create the module's data directory
   tripal_create_moddir('tripal_contact');
 
   // add the contactprop table to Chado

+ 11 - 9
tripal_core/theme/css/tripal.css

@@ -47,7 +47,6 @@
 #tripal_contents_table {
   padding: 0px !important;
   margin: 0px !important;
-  
 }
 
 #tripal_contents_table tbody {
@@ -58,9 +57,14 @@
 
 .tripal_contents_table_td { 
   border: 0px solid #FFFFFF !important;
-  padding: 0px !important;
   text-align: left;
   vertical-align: top;
+  padding: 0px 0px 0px 20px;
+}
+.tripal_contents_table_td_toc { 
+  border: 1px solid #888888 !important;
+  padding: 10px !important;
+  background: none repeat scroll 0 0 rgba(0, 0, 0, 0.063);
 }
 .tripal_contents_table_tr {
 background-color: transparent;
@@ -79,11 +83,12 @@ background-color: transparent;
   list-style-type: none;
 }
 .tripal_toc li {
-	background-color: #EEEEEE;
+  /*
+  background-color: #EEEEEE;
   border-style:solid;
   border-width:1px;
-  border-color: #999999;
-  padding: 3px 20px 3px 20px;
+  border-color: #999999;  */
+  padding: 3px 20px 3px 10px;
   margin: 2px 0 2px 0;
 }
 .tripal_toc_title {
@@ -97,10 +102,7 @@ background-color: transparent;
  * Details Section
  */
 .tripal_details {
-  padding: 0px 20px 20px 20px;
-  min-height: 500px;
-  margin-right: 10px;
-  margin-bottom: 10px;
+  min-height: 400px;
   overflow:auto;
 }
 

+ 9 - 2
tripal_core/theme/node--chado-generic.tpl.php

@@ -79,10 +79,17 @@ else { ?>
 })(jQuery);
 </script>
 
-<div id="tripal_<?php print $ttype?>_content" class="tripal_contents">
+<div id="tripal_<?php print $ttype?>_content" class="tripal_contents"> <?php 
+  if ($page['tripal_sidebar']) { ?>
+    <div id="tripal-sidebar" class="column sidebar">
+      <div class="section">
+        <?php print render($page["chado_" . $ttype . " _toc"]); ?>
+      </div>
+    </div><?php 
+  } ?>
   <table id="tripal_contents_table">
     <tr class="tripal_contents_table_tr">
-      <td nowrap class="tripal_contents_table_td"  align="left">
+      <td nowrap class="tripal_contents_table_td tripal_contents_table_td_toc"  align="left">
         <div id="tripal_<?php print $ttype?>_toc" class="tripal_toc">
           <ul id="tripal_<?php print $ttype?>_toc_list" class="tripal_toc_list">
           

+ 4 - 1
tripal_core/tripal_core.module

@@ -520,4 +520,7 @@ function tripal_core_views_api() {
   return array(
     'api' => 3.0,
   );
-}
+}
+
+
+

+ 10 - 10
tripal_core/tripal_launch_jobs_multi.php

@@ -99,16 +99,16 @@ function runjob($sitename, $username) {
 
   drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
 
-	// check to make sure the username is valid
-	$results = db_query("SELECT * FROM {users} WHERE name = :name", array(':name' => $username));
-	$u = $results->fetchObject();
-	if (!$u) {
-	  fwrite($stdout, "'$username' is not a valid Drupal username. exiting...\n");
-	  exit;
-	}
-	
-	global $user;
-	$user = user_load($u->uid);
+  // check to make sure the username is valid
+  $results = db_query("SELECT * FROM {users} WHERE name = :name", array(':name' => $username));
+  $u = $results->fetchObject();
+  if (!$u) {
+    fwrite($stdout, "'$username' is not a valid Drupal username. exiting...\n");
+    exit;
+  }
+  
+  global $user;
+  $user = user_load($u->uid);
 
   tripal_jobs_launch();
 }

+ 78 - 78
tripal_cv/theme/js/jquery-treeview/demo/source.php

@@ -2,86 +2,86 @@
 if ($_REQUEST['root'] == "source"):
 ?>
 [
-	{
-		"text": "1. Pre Lunch (120 min)",
-		"expanded": true,
-		"classes": "important",
-		"children":
-		[
-			{
-				"text": "1.1 The State of the Powerdome (30 min)"
-			},
-		 	{
-				"text": "1.2 The Future of jQuery (30 min)"
-			},
-		 	{
-				"text": "1.2 jQuery UI - A step to richnessy (60 min)"
-			}
-		]
-	},
-	{
-		"text": "2. Lunch  (60 min)"
-	},
-	{
-		"text": "3. After Lunch  (120+ min)",
-		"children":
-		[
-			{
-				"text": "3.1 jQuery Calendar Success Story (20 min)"
-			},
-		 	{
-				"text": "3.2 jQuery and Ruby Web Frameworks (20 min)"
-			},
-		 	{
-				"text": "3.3 Hey, I Can Do That! (20 min)"
-			},
-		 	{
-				"text": "3.4 Taconite and Form (20 min)"
-			},
-		 	{
-				"text": "3.5 Server-side JavaScript with jQuery and AOLserver (20 min)"
-			},
-		 	{
-				"text": "3.6 The Onion: How to add features without adding features (20 min)",
-				"id": "36",
-				"hasChildren": true
-			},
-		 	{
-				"text": "3.7 Visualizations with JavaScript and Canvas (20 min)"
-			},
-		 	{
-				"text": "3.8 ActiveDOM (20 min)"
-			},
-		 	{
-				"text": "3.8 Growing jQuery (20 min)"
-			}
-		]
-	}
+  {
+    "text": "1. Pre Lunch (120 min)",
+    "expanded": true,
+    "classes": "important",
+    "children":
+    [
+      {
+        "text": "1.1 The State of the Powerdome (30 min)"
+      },
+       {
+        "text": "1.2 The Future of jQuery (30 min)"
+      },
+       {
+        "text": "1.2 jQuery UI - A step to richnessy (60 min)"
+      }
+    ]
+  },
+  {
+    "text": "2. Lunch  (60 min)"
+  },
+  {
+    "text": "3. After Lunch  (120+ min)",
+    "children":
+    [
+      {
+        "text": "3.1 jQuery Calendar Success Story (20 min)"
+      },
+       {
+        "text": "3.2 jQuery and Ruby Web Frameworks (20 min)"
+      },
+       {
+        "text": "3.3 Hey, I Can Do That! (20 min)"
+      },
+       {
+        "text": "3.4 Taconite and Form (20 min)"
+      },
+       {
+        "text": "3.5 Server-side JavaScript with jQuery and AOLserver (20 min)"
+      },
+       {
+        "text": "3.6 The Onion: How to add features without adding features (20 min)",
+        "id": "36",
+        "hasChildren": true
+      },
+       {
+        "text": "3.7 Visualizations with JavaScript and Canvas (20 min)"
+      },
+       {
+        "text": "3.8 ActiveDOM (20 min)"
+      },
+       {
+        "text": "3.8 Growing jQuery (20 min)"
+      }
+    ]
+  }
 ]
 <?php else: ?>
 [
-	{
-		"text": "1. Review of existing structures",
-		"expanded": true,
-		"children":
-		[
-			{
-				"text": "1.1 jQuery core"
-			},
-		 	{
-				"text": "1.2 metaplugins"
-			}
-		]
-	},
-	{
-		"text": "2. Wrapper plugins"
-	},
-	{
-		"text": "3. Summary"
-	},
-	{
-		"text": "4. Questions and answers"
-	}
-	
+  {
+    "text": "1. Review of existing structures",
+    "expanded": true,
+    "children":
+    [
+      {
+        "text": "1.1 jQuery core"
+      },
+       {
+        "text": "1.2 metaplugins"
+      }
+    ]
+  },
+  {
+    "text": "2. Wrapper plugins"
+  },
+  {
+    "text": "3. Summary"
+  },
+  {
+    "text": "4. Questions and answers"
+  }
+  
 ]
 <?php endif; ?>

+ 25 - 25
tripal_cv/theme/js/jsTree/reference/_examples/1_async.php

@@ -1,29 +1,29 @@
 <?
-	// Make sure nothing is cached
-	header("Cache-Control: must-revalidate");
-	header("Cache-Control: post-check=0, pre-check=0", false);
-	header("Pragma: no-cache");
-	header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H")-2, date("i"), date("s"), date("m"), date("d"), date("Y")))." GMT");
-	header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
+  // Make sure nothing is cached
+  header("Cache-Control: must-revalidate");
+  header("Cache-Control: post-check=0, pre-check=0", false);
+  header("Pragma: no-cache");
+  header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H")-2, date("i"), date("s"), date("m"), date("d"), date("Y")))." GMT");
+  header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
 
-	// So that the loading indicator is visible
-	sleep(1);
+  // So that the loading indicator is visible
+  sleep(1);
 
-	// The id of the node being opened
-	$id = $_REQUEST["id"];
-	//echo $id;
-	if($id == "0") {
-		echo '['."\n";
-		echo "\t".'{ attributes: { id : "pjson_1" }, state: "closed", data: "Root node 1" },'."\n";
-		echo "\t".'{ attributes: { id : "pjson_5" }, data: "Root node 2" }'."\n";
-		echo ']'."\n";
-	}
-	else {
-		echo '['."\n";
-		echo "\t".'{ attributes: { id : "pjson_2" }, data: { title : "Custom icon", icon : "../media/images/ok.png" } },'."\n";
-		echo "\t".'{ attributes: { id : "pjson_3" }, data: "Child node 2" },'."\n";
-		echo "\t".'{ attributes: { id : "pjson_4" }, data: "Some other child node" }'."\n";
-		echo ']'."\n";
-	}
-	exit();
+  // The id of the node being opened
+  $id = $_REQUEST["id"];
+  //echo $id;
+  if($id == "0") {
+    echo '['."\n";
+    echo "\t".'{ attributes: { id : "pjson_1" }, state: "closed", data: "Root node 1" },'."\n";
+    echo "\t".'{ attributes: { id : "pjson_5" }, data: "Root node 2" }'."\n";
+    echo ']'."\n";
+  }
+  else {
+    echo '['."\n";
+    echo "\t".'{ attributes: { id : "pjson_2" }, data: { title : "Custom icon", icon : "../media/images/ok.png" } },'."\n";
+    echo "\t".'{ attributes: { id : "pjson_3" }, data: "Child node 2" },'."\n";
+    echo "\t".'{ attributes: { id : "pjson_4" }, data: "Some other child node" }'."\n";
+    echo ']'."\n";
+  }
+  exit();
 ?>

+ 358 - 358
tripal_cv/theme/js/jsTree/reference/_examples/full/_inc/class.tree.php

@@ -1,362 +1,362 @@
 <?
 class tree {
-	// Structure table and fields
-	var $s_table	= "";
-	var $s_fields	= array(
-			"id"		=> false,
-			"parent_id"	=> false,
-			"position"	=> false,
-			"left"		=> false,
-			"right"		=> false,
-			"level"		=> false
-		);
-
-	// Additional fields (stored in format `table_name.field_name`)
-	var $d_fields	= array();
-
-	// Tree type (or types)
-	var $adjacency	= false;
-	var $nestedset	= false;
-
-	// Database
-	var $db			= false;
-
-	// Constructor
-	function __construct($tables = array()) {
-		if(!is_array($tables) || !count($tables)) return;
-		foreach($tables as $table_name => $fields) {
-			if(is_array($fields)) {
-				foreach($fields as $key => $field) {
-					switch($key) {
-						case "id":
-						case "parent_id":
-						case "position":
-						case "left":
-						case "right":
-						case "level":
-							$this->s_table = $table_name;
-							$this->s_fields[$key] = $field;
-							break;
-						default:
-							$this->d_fields[] = $table_name.".".$field;
-							break;
-					}
-				}
-			}
-		}
-
-		// Determine what kind of a tree is used (or both)
-		if($this->s_fields["id"] && $this->s_fields["position"])														$this->adjacency = true;
-		if($this->s_fields["id"] && $this->s_fields["left"] && $this->s_fields["right"] && $this->s_fields["level"])	$this->nestedset = true;
-
-		// Database
-		$this->db = new DB;
-	}
-	function tree($tables = array()) { return $this->__construct($tables); } // PHP 4 compatibilty
-
-	// WRITING FUNCTIONS
-	// Function for moving nodes
-	// ID is the node that is being moved - 0 is creating a new NODE
-	// REF_ID is the reference node in the move
-	// TYPE is one of "after", "before" or "inside"
-	function move($id, $ref_id, $type, $mode = "move") {
-		if(!in_array($type, array("after", "before", "inside"))) return false;
-
-		// Queries executed at the end
-		$sql	= array();
-
-		if(!(int)$id) $mode = "create";
-
-		if($mode == "create") {
-			// Fields and values that will be inserted
-			$fields	= array();
-			$values	= array();
-			// Inserting an ID
-			$fields[] = "`".$this->s_fields["id"]."`";
-			$values[] = "NULL";
-		}
-
-		// If the tree maintains an ID->PARENT_ID relation
-		if($this->adjacency) {
-			$this->db->query("SELECT `".$this->s_fields["parent_id"]."`, `".$this->s_fields["position"]."` FROM `".$this->s_table."` WHERE `".$this->s_fields["id"]."` = ".(int)$ref_id);
-			$this->db->nextr();
-
-			// Determine new parent and position
-			if($type == "inside") {
-				$new_parent_id = $ref_id;
-				$new_position = 1;
-			}
-			else {
-				$new_parent_id = (int)$this->db->f(0);
-				if($type == "before")	$new_position = $this->db->f(1);
-				if($type == "after")	$new_position = $this->db->f(1) + 1;
-			}
-
-			// Cleanup old parent
-			if($mode == "create") {
-				$old_parent_id	= -1;
-				$old_position	= 0;
-			}
-			else {
-				$this->db->query("SELECT `".$this->s_fields["parent_id"]."`, `".$this->s_fields["position"]."` FROM `".$this->s_table."` WHERE `".$this->s_fields["id"]."` = ".(int)$id);
-				$this->db->nextr();
-				$old_parent_id	= $this->db->f(0);
-				$old_position	= $this->db->f(1);
-			}
-
-			// A reorder was made
-			if($old_parent_id == $new_parent_id) {
-				if($new_position > $old_position) {
-					$new_position = $new_position - 1;
-					$sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["position"]."` = `".$this->s_fields["position"]."` - 1 WHERE `".$this->s_fields["parent_id"]."` = ".$old_parent_id." AND `".$this->s_fields["position"]."` BETWEEN ".($old_position + 1)." AND ".$new_position;
-				}
-				if($new_position < $old_position) {
-					$sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["position"]."` = `".$this->s_fields["position"]."` + 1 WHERE `".$this->s_fields["parent_id"]."` = ".$old_parent_id." AND `".$this->s_fields["position"]."` BETWEEN ".$new_position." AND ".($old_position - 1);
-				}
-			}
-			else {
-				// Fix old parent (move siblings up)
-				$sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["position"]."` = `".$this->s_fields["position"]."` - 1 WHERE `".$this->s_fields["parent_id"]."` = ".$old_parent_id." AND `".$this->s_fields["position"]."` > ".$old_position;
-				// Prepare new parent (move sibling down)
-				$sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["position"]."` = `".$this->s_fields["position"]."` + 1 WHERE `".$this->s_fields["parent_id"]."` = ".$new_parent_id." AND `".$this->s_fields["position"]."` >".($type != "after" ? "=" : "")." ".$new_position;
-			}
-			// Move the node to the new position
-			if($mode == "create") {
-				$fields[] = "`".$this->s_fields["parent_id"]."`";
-				$fields[] = "`".$this->s_fields["position"]."`";
-				$values[] = $new_parent_id;
-				$values[] = $new_position;
-			}
-			else {
-				$sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["position"]."` = ".$new_position.", `".$this->s_fields["parent_id"]."` = ".$new_parent_id." WHERE `".$this->s_fields["id"]."` = ".(int)$id;
-			}
-		}
-
-		// If the tree maintains a nested set
-		if($this->nestedset) {
-			$this->db->query("SELECT `".$this->s_fields["id"]."` AS id, `".$this->s_fields["left"]."` AS lft, `".$this->s_fields["right"]."` AS rgt, `".$this->s_fields["level"]."` AS lvl FROM `".$this->s_table."` WHERE `".$this->s_fields["id"]."` IN(".(int)$id.",".(int)$ref_id.")");
-			while($this->db->nextr()) {
-				if($id == $this->db->f("id")) {
-					$nod_lft = (int)$this->db->f("lft");
-					$nod_rgt = (int)$this->db->f("rgt");
-					$dif = $nod_rgt - $nod_lft + 1;
-				}
-				if($ref_id == $this->db->f("id")) {
-					$ref_lft = (int)$this->db->f("lft");
-					$ref_rgt = (int)$this->db->f("rgt");
-					$ref_lvl = (int)$this->db->f("lvl");
-				}
-			}
-
-			if($mode == "move") {
-				$sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["left"]."` = `".$this->s_fields["left"]."` - ".$dif." WHERE `".$this->s_fields["left"]."` > ".$nod_rgt;
-				$sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["right"]."` = `".$this->s_fields["right"]."` - ".$dif." WHERE `".$this->s_fields["right"]."` > ".$nod_rgt;
-				if($ref_lft > $nod_rgt) $ref_lft -= $dif;
-				if($ref_rgt > $nod_rgt) $ref_rgt -= $dif;
-			}
-			else $dif = 2;
-
-			$ids = array();
-			if($mode == "move") {
-				$this->db->query("SELECT `".$this->s_fields["id"]."` FROM `".$this->s_table."` WHERE `".$this->s_fields["left"]."` >= ".$nod_lft." AND `".$this->s_fields["right"]."` <= ".$nod_rgt);
-				while($this->db->nextr()) $ids[] = (int)$this->db->f(0);
-			} 
-			else $ids[] = -1;
-
-			switch($type) {
-				case "before":
-					$sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["left"]."` = `".$this->s_fields["left"]."` + ".$dif." WHERE `".$this->s_fields["left"]."` >= ".$ref_lft." AND `".$this->s_fields["id"]."` NOT IN(".implode(",",$ids).") ";
-					$sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["right"]."` = `".$this->s_fields["right"]."` + ".$dif." WHERE `".$this->s_fields["right"]."` > ".$ref_lft." AND `".$this->s_fields["id"]."` NOT IN(".implode(",",$ids).") ";
-					if($mode == "move") {
-						$dif = $ref_lft - $nod_lft;
-						$sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["level"]."` = ".(int)$ref_lvl.", `".$this->s_fields["left"]."` = `".$this->s_fields["left"]."` + (".$dif."), `".$this->s_fields["right"]."` = `".$this->s_fields["right"]."` + (".$dif.") WHERE `".$this->s_fields["id"]."` IN (".implode(",",$ids).") ";
-					}
-					else {
-						$fields[] = "`".$this->s_fields["level"]."`";
-						$fields[] = "`".$this->s_fields["left"]."`";
-						$fields[] = "`".$this->s_fields["right"]."`";
-						$values[] = (int)$ref_lvl;
-						$values[] = (int)$ref_lft;
-						$values[] = ((int)$ref_lft + 2);
-					}
-					break;
-				case "after":
-					$sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["left"]."` = `".$this->s_fields["left"]."` + ".$dif." WHERE `".$this->s_fields["left"]."` > ".$ref_rgt." AND `".$this->s_fields["id"]."` NOT IN(".implode(",",$ids).") ";
-					$sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["right"]."` = `".$this->s_fields["right"]."` + ".$dif." WHERE `".$this->s_fields["right"]."` > ".$ref_rgt." AND `".$this->s_fields["id"]."` NOT IN(".implode(",",$ids).") ";
-					if($mode == "move") {
-						$dif = ($ref_rgt + 1) - $nod_lft;
-						$sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["level"]."` = ".(int)$ref_lvl.", `".$this->s_fields["left"]."` = `".$this->s_fields["left"]."` + (".$dif."), `".$this->s_fields["right"]."` = `".$this->s_fields["right"]."` + (".$dif.") WHERE `".$this->s_fields["id"]."` IN (".implode(",",$ids).") ";
-					} else {
-						$fields[] = "`".$this->s_fields["level"]."`";
-						$fields[] = "`".$this->s_fields["left"]."`";
-						$fields[] = "`".$this->s_fields["right"]."`";
-						$values[] = (int)$ref_lvl;
-						$values[] = ((int)$ref_rgt + 1);
-						$values[] = ((int)$ref_rgt + 3);
-					}
-					break;
-				case "inside":
-				default:
-					$sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["left"]."` = `".$this->s_fields["left"]."` + ".$dif." WHERE `".$this->s_fields["left"]."` > ".$ref_lft." AND `".$this->s_fields["id"]."` NOT IN(".implode(",",$ids).") ";
-					$sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["right"]."` = `".$this->s_fields["right"]."` + ".$dif." WHERE `".$this->s_fields["right"]."` > ".$ref_lft." AND `".$this->s_fields["id"]."` NOT IN(".implode(",",$ids).") ";
-					if($mode == "move") {
-						$dif = ($ref_lft + 1) - $nod_lft;
-						$sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["level"]."` = ".(int)($ref_lvl + 1).", `".$this->s_fields["left"]."` = `".$this->s_fields["left"]."` + (".$dif."), `".$this->s_fields["right"]."` = `".$this->s_fields["right"]."` + (".$dif.") WHERE `".$this->s_fields["id"]."` IN (".implode(",",$ids).") ";
-					}
-					else {
-						$fields[] = "`".$this->s_fields["level"]."`";
-						$fields[] = "`".$this->s_fields["left"]."`";
-						$fields[] = "`".$this->s_fields["right"]."`";
-						$values[] = ((int)$ref_lvl + 1);
-						$values[] = ((int)$ref_lft + 1);
-						$values[] = ((int)$ref_lft + 3);
-					}
-					break;
-			}
-		}
-		
-		// If creating a new node
-		if($mode == "create") $sql[] = "INSERT INTO `".$this->s_table."` (".implode(",",$fields).") VALUES (".implode(",",$values).")";
-
-		// Applying all changes - there should be a transaction here
-		foreach($sql as $q) { $this->db->query($q); }
-
-		if($mode == "create") return mysql_insert_id();
-	}
-
-	// Function for removing nodes
-	// ID is the node (or array of nodes) that is being removed
-	function remove($id) {
-		if(is_array($id)) {
-			foreach($id as $i) { $this->remove($i); }
-			return;
-		}
-		if(!(int)$id) return false;
-
-		// Take care of nested sets (and adjacency at the same time if applicable)
-		if($this->nestedset) {
-			$this->db->query("SELECT `".$this->s_fields["left"]."` AS lft, `".$this->s_fields["right"]."` AS rgt ".( ($this->adjacency) ? " , `".$this->s_fields["parent_id"]."` AS pid, `".$this->s_fields["position"]."` AS pos " : "" )." FROM `".$this->s_table."` WHERE `".$this->s_fields["id"]."` = ".(int)$id);
-			$this->db->nextr();
-			if($this->adjacency) {
-				$pid = (int)$this->db->f("pid");
-				$pos = (int)$this->db->f("pos");
-			}
-			$lft = (int)$this->db->f("lft");
-			$rgt = (int)$this->db->f("rgt");
-			$dif = $rgt - $lft + 1;
-
-			$this->db->query("DELETE FROM `".$this->s_table."` WHERE `".$this->s_fields["left"]."` >= ".$lft." AND `".$this->s_fields["right"]."` <= ".$rgt);
-			$this->db->query("UPDATE `".$this->s_table."` SET `".$this->s_fields["left"]."` = `".$this->s_fields["left"]."` - ".$dif." WHERE `".$this->s_fields["left"]."` > ".$rgt);
-			$this->db->query("UPDATE `".$this->s_table."` SET `".$this->s_fields["right"]."` = `".$this->s_fields["right"]."` - ".$dif." WHERE `".$this->s_fields["right"]."` > ".$lft);
-			if($this->adjacency) {
-				$this->db->query("UPDATE `".$this->s_table."` SET `".$this->s_fields["position"]."` = `".$this->s_fields["position"]."` - 1 WHERE `".$this->s_fields["parent_id"]."` = ".$pid." AND `".$this->s_fields["position"]."` > ".$pos);
-			}
-			return;
-		}
-		// Only end up here if the tree is adjacency only
-		if($this->adjacency) {
-			$this->db->query("SELECT `".$this->s_fields["parent_id"]."` AS pid, `".$this->s_fields["position"]."` AS pos FROM `".$this->s_table."` WHERE `".$this->s_fields["id"]."` = ".(int)$id);
-			$this->db->nextr();
-			$pid = (int)$this->db->f("pid");
-			$pos = (int)$this->db->f("pos");
-
-			$tmp = array($id);
-			$ids = array($id);
-			while(count($tmp)) {
-				$t = array_shift($tmp);
-				if($t) {
-					$this->db->query("SELECT `".$this->s_fields["id"]."` FROM `".$this->s_table."` WHERE `".$this->s_fields["parent_id"]."` = ".(int)$t);
-					while($this->db->nextr()) { 
-						array_push($ids, $this->db->f(0));
-						array_push($tmp, $this->db->f(0));
-					}
-				}
-			}
-			$this->db->query("DELETE FROM `".$this->s_table."` WHERE `".$this->s_fields["id"]."` IN (".implode(",",$ids).")");
-			$this->db->query("UPDATE `".$this->s_table."` SET `".$this->s_fields["position"]."` = `".$this->s_fields["position"]."` - 1 WHERE `".$this->s_fields["parent_id"]."` = ".$pid." AND `".$this->s_fields["position"]."` > ".$pos);
-		}
-	}
-
-	function reconstruct() {
-		if(!$this->adjacency || !$this->nestedset) return;
-
-		// не знам защо да не е persistent
-		$this->db->pcn = false;
-
-		$q = "CREATE TEMPORARY TABLE temp_tree (".$this->s_fields["id"]." INTEGER NOT NULL, ".$this->s_fields["parent_id"]." INTEGER NOT NULL, ". $this->s_fields["position"]." INTEGER NOT NULL) type=HEAP";
-		$this->db->query($q);
-
-		$q = "INSERT INTO temp_tree SELECT ".$this->s_fields["id"].", ".$this->s_fields["parent_id"].", ".$this->s_fields["position"]." FROM ".$this->s_table;
-		$this->db->query($q);
-
-
-		$q = "CREATE TEMPORARY TABLE temp_stack (".$this->s_fields["id"]." INTEGER NOT NULL, ".$this->s_fields["left"]." INTEGER, ".$this->s_fields["right"]." INTEGER, ".$this->s_fields["level"]." INTEGER, stack_top INTEGER NOT NULL, ".$this->s_fields["parent_id"]." INTEGER, ".$this->s_fields["position"]." INTEGER) type=HEAP";
-		$this->db->query($q);
-		$counter = 2;
-
-		$q = "SELECT COUNT(*) as maxcounter FROM temp_tree";
-		$this->db->query($q);
-		$this->db->nextr();
-		$maxcounter = (int) $this->db->f("maxcounter") * 2;
-		$currenttop = 1;
-
-		$q = "INSERT INTO temp_stack SELECT ".$this->s_fields["id"].", 1, NULL, 0, 1, ".$this->s_fields["parent_id"].", ".$this->s_fields["position"]." FROM temp_tree WHERE ".$this->s_fields["parent_id"]." = 0";
-		$this->db->query($q);
-
-		$q = "DELETE FROM temp_tree WHERE ".$this->s_fields["parent_id"]." = 0";
-		$this->db->query($q);
-
-		while ($counter <= $maxcounter) {
-			$q = "SELECT temp_tree.".$this->s_fields["id"]." AS tempmin, temp_tree.".$this->s_fields["parent_id"]." AS pid, temp_tree.".$this->s_fields["position"]." AS lid FROM temp_stack, temp_tree WHERE temp_stack.".$this->s_fields["id"]." = temp_tree.".$this->s_fields["parent_id"]." AND temp_stack.stack_top = ".$currenttop." ORDER BY temp_tree.".$this->s_fields["position"]." ASC LIMIT 1";
-			$this->db->query($q);
-
-			if ($this->db->nextr()) {
-				$tmp = $this->db->f("tempmin");
-
-				$q = "INSERT INTO temp_stack (stack_top, ".$this->s_fields["id"].", ".$this->s_fields["left"].", ".$this->s_fields["right"].", ".$this->s_fields["level"].", ".$this->s_fields["parent_id"].", ".$this->s_fields["position"].") VALUES(".($currenttop + 1).", ".$tmp.", ".$counter.", NULL, ".$currenttop.", ".$this->db->f("pid").", ".$this->db->f("lid").")";
-				$this->db->query($q);
-				$q = "DELETE FROM temp_tree WHERE ".$this->s_fields["id"]." = ".$tmp;
-				$this->db->query($q);
-				$counter++;
-				$currenttop++;
-			}
-			else {
-				$q = "UPDATE temp_stack SET ".$this->s_fields["right"]." = ".$counter.", stack_top = -stack_top WHERE stack_top = ".$currenttop;
-				$this->db->query($q);
-				$counter++;
-				$currenttop--;
-			}
-		}
-
-		$q = "TRUNCATE TABLE ".$this->s_table;
-		$this->db->query($q);
-
-		$q = "INSERT INTO ".$this->s_table." SELECT ".$this->s_fields["id"].", ".$this->s_fields["parent_id"].", ".$this->s_fields["position"].", ".$this->s_fields["left"].", ".$this->s_fields["right"].", ".$this->s_fields["level"]." FROM temp_stack ORDER BY ".$this->s_fields["id"];
-		$this->db->query($q);
-	}
-
-	function analyze() {
-		$this->errors = array();
-		if($this->adjacency) {
-			$this->db->query("SELECT COUNT(*) FROM ".$this->s_table." s WHERE ".$this->s_fields["parent_id"]." != 0 AND (SELECT COUNT(*) FROM ".$this->s_table." WHERE ".$this->s_fields["id"]." = s.".$this->s_fields["parent_id"].") = 0 ");
-			$this->db->nextr();
-			if($this->db->f(0) > 0) $this->errors[] = "Missing parents.";
-		}
-		if($this->nestedset) {
-			$this->db->query("SELECT MAX(".$this->s_fields["right"].") FROM ".$this->s_table);
-			$this->db->nextr();
-			$n = $this->db->f(0);
-			$this->db->query("SELECT COUNT(*) FROM ".$this->s_table);
-			$this->db->nextr();
-			$c = $this->db->f(0);
-			if($n/2 != $c) $this->errors[] = "Right index does not match node count.";
-		}
-		if($this->adjacency && $this->nestedset) {
-			$this->db->query("SELECT COUNT(".$this->s_fields["id"].") FROM ".$this->s_table." s WHERE (SELECT COUNT(*) FROM ".$this->s_table." WHERE ".$this->s_fields["right"]." < s.".$this->s_fields["right"]." AND ".$this->s_fields["left"]." > s.".$this->s_fields["left"]." AND ".$this->s_fields["level"]." = s.".$this->s_fields["level"]." + 1) != (SELECT COUNT(*) FROM ".$this->s_table." WHERE ".$this->s_fields["parent_id"]." = s.".$this->s_fields["id"].") ");
-			$this->db->nextr();
-			if($this->db->f(0) > 0) $this->errors = "Adjacency and nested set do not match.";
-		}
-		return $error;
-	}
+  // Structure table and fields
+  var $s_table  = "";
+  var $s_fields  = array(
+      "id"    => false,
+      "parent_id"  => false,
+      "position"  => false,
+      "left"    => false,
+      "right"    => false,
+      "level"    => false
+    );
+
+  // Additional fields (stored in format `table_name.field_name`)
+  var $d_fields  = array();
+
+  // Tree type (or types)
+  var $adjacency  = false;
+  var $nestedset  = false;
+
+  // Database
+  var $db      = false;
+
+  // Constructor
+  function __construct($tables = array()) {
+    if(!is_array($tables) || !count($tables)) return;
+    foreach($tables as $table_name => $fields) {
+      if(is_array($fields)) {
+        foreach($fields as $key => $field) {
+          switch($key) {
+            case "id":
+            case "parent_id":
+            case "position":
+            case "left":
+            case "right":
+            case "level":
+              $this->s_table = $table_name;
+              $this->s_fields[$key] = $field;
+              break;
+            default:
+              $this->d_fields[] = $table_name.".".$field;
+              break;
+          }
+        }
+      }
+    }
+
+    // Determine what kind of a tree is used (or both)
+    if($this->s_fields["id"] && $this->s_fields["position"])                            $this->adjacency = true;
+    if($this->s_fields["id"] && $this->s_fields["left"] && $this->s_fields["right"] && $this->s_fields["level"])  $this->nestedset = true;
+
+    // Database
+    $this->db = new DB;
+  }
+  function tree($tables = array()) { return $this->__construct($tables); } // PHP 4 compatibilty
+
+  // WRITING FUNCTIONS
+  // Function for moving nodes
+  // ID is the node that is being moved - 0 is creating a new NODE
+  // REF_ID is the reference node in the move
+  // TYPE is one of "after", "before" or "inside"
+  function move($id, $ref_id, $type, $mode = "move") {
+    if(!in_array($type, array("after", "before", "inside"))) return false;
+
+    // Queries executed at the end
+    $sql  = array();
+
+    if(!(int)$id) $mode = "create";
+
+    if($mode == "create") {
+      // Fields and values that will be inserted
+      $fields  = array();
+      $values  = array();
+      // Inserting an ID
+      $fields[] = "`".$this->s_fields["id"]."`";
+      $values[] = "NULL";
+    }
+
+    // If the tree maintains an ID->PARENT_ID relation
+    if($this->adjacency) {
+      $this->db->query("SELECT `".$this->s_fields["parent_id"]."`, `".$this->s_fields["position"]."` FROM `".$this->s_table."` WHERE `".$this->s_fields["id"]."` = ".(int)$ref_id);
+      $this->db->nextr();
+
+      // Determine new parent and position
+      if($type == "inside") {
+        $new_parent_id = $ref_id;
+        $new_position = 1;
+      }
+      else {
+        $new_parent_id = (int)$this->db->f(0);
+        if($type == "before")  $new_position = $this->db->f(1);
+        if($type == "after")  $new_position = $this->db->f(1) + 1;
+      }
+
+      // Cleanup old parent
+      if($mode == "create") {
+        $old_parent_id  = -1;
+        $old_position  = 0;
+      }
+      else {
+        $this->db->query("SELECT `".$this->s_fields["parent_id"]."`, `".$this->s_fields["position"]."` FROM `".$this->s_table."` WHERE `".$this->s_fields["id"]."` = ".(int)$id);
+        $this->db->nextr();
+        $old_parent_id  = $this->db->f(0);
+        $old_position  = $this->db->f(1);
+      }
+
+      // A reorder was made
+      if($old_parent_id == $new_parent_id) {
+        if($new_position > $old_position) {
+          $new_position = $new_position - 1;
+          $sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["position"]."` = `".$this->s_fields["position"]."` - 1 WHERE `".$this->s_fields["parent_id"]."` = ".$old_parent_id." AND `".$this->s_fields["position"]."` BETWEEN ".($old_position + 1)." AND ".$new_position;
+        }
+        if($new_position < $old_position) {
+          $sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["position"]."` = `".$this->s_fields["position"]."` + 1 WHERE `".$this->s_fields["parent_id"]."` = ".$old_parent_id." AND `".$this->s_fields["position"]."` BETWEEN ".$new_position." AND ".($old_position - 1);
+        }
+      }
+      else {
+        // Fix old parent (move siblings up)
+        $sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["position"]."` = `".$this->s_fields["position"]."` - 1 WHERE `".$this->s_fields["parent_id"]."` = ".$old_parent_id." AND `".$this->s_fields["position"]."` > ".$old_position;
+        // Prepare new parent (move sibling down)
+        $sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["position"]."` = `".$this->s_fields["position"]."` + 1 WHERE `".$this->s_fields["parent_id"]."` = ".$new_parent_id." AND `".$this->s_fields["position"]."` >".($type != "after" ? "=" : "")." ".$new_position;
+      }
+      // Move the node to the new position
+      if($mode == "create") {
+        $fields[] = "`".$this->s_fields["parent_id"]."`";
+        $fields[] = "`".$this->s_fields["position"]."`";
+        $values[] = $new_parent_id;
+        $values[] = $new_position;
+      }
+      else {
+        $sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["position"]."` = ".$new_position.", `".$this->s_fields["parent_id"]."` = ".$new_parent_id." WHERE `".$this->s_fields["id"]."` = ".(int)$id;
+      }
+    }
+
+    // If the tree maintains a nested set
+    if($this->nestedset) {
+      $this->db->query("SELECT `".$this->s_fields["id"]."` AS id, `".$this->s_fields["left"]."` AS lft, `".$this->s_fields["right"]."` AS rgt, `".$this->s_fields["level"]."` AS lvl FROM `".$this->s_table."` WHERE `".$this->s_fields["id"]."` IN(".(int)$id.",".(int)$ref_id.")");
+      while($this->db->nextr()) {
+        if($id == $this->db->f("id")) {
+          $nod_lft = (int)$this->db->f("lft");
+          $nod_rgt = (int)$this->db->f("rgt");
+          $dif = $nod_rgt - $nod_lft + 1;
+        }
+        if($ref_id == $this->db->f("id")) {
+          $ref_lft = (int)$this->db->f("lft");
+          $ref_rgt = (int)$this->db->f("rgt");
+          $ref_lvl = (int)$this->db->f("lvl");
+        }
+      }
+
+      if($mode == "move") {
+        $sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["left"]."` = `".$this->s_fields["left"]."` - ".$dif." WHERE `".$this->s_fields["left"]."` > ".$nod_rgt;
+        $sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["right"]."` = `".$this->s_fields["right"]."` - ".$dif." WHERE `".$this->s_fields["right"]."` > ".$nod_rgt;
+        if($ref_lft > $nod_rgt) $ref_lft -= $dif;
+        if($ref_rgt > $nod_rgt) $ref_rgt -= $dif;
+      }
+      else $dif = 2;
+
+      $ids = array();
+      if($mode == "move") {
+        $this->db->query("SELECT `".$this->s_fields["id"]."` FROM `".$this->s_table."` WHERE `".$this->s_fields["left"]."` >= ".$nod_lft." AND `".$this->s_fields["right"]."` <= ".$nod_rgt);
+        while($this->db->nextr()) $ids[] = (int)$this->db->f(0);
+      } 
+      else $ids[] = -1;
+
+      switch($type) {
+        case "before":
+          $sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["left"]."` = `".$this->s_fields["left"]."` + ".$dif." WHERE `".$this->s_fields["left"]."` >= ".$ref_lft." AND `".$this->s_fields["id"]."` NOT IN(".implode(",",$ids).") ";
+          $sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["right"]."` = `".$this->s_fields["right"]."` + ".$dif." WHERE `".$this->s_fields["right"]."` > ".$ref_lft." AND `".$this->s_fields["id"]."` NOT IN(".implode(",",$ids).") ";
+          if($mode == "move") {
+            $dif = $ref_lft - $nod_lft;
+            $sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["level"]."` = ".(int)$ref_lvl.", `".$this->s_fields["left"]."` = `".$this->s_fields["left"]."` + (".$dif."), `".$this->s_fields["right"]."` = `".$this->s_fields["right"]."` + (".$dif.") WHERE `".$this->s_fields["id"]."` IN (".implode(",",$ids).") ";
+          }
+          else {
+            $fields[] = "`".$this->s_fields["level"]."`";
+            $fields[] = "`".$this->s_fields["left"]."`";
+            $fields[] = "`".$this->s_fields["right"]."`";
+            $values[] = (int)$ref_lvl;
+            $values[] = (int)$ref_lft;
+            $values[] = ((int)$ref_lft + 2);
+          }
+          break;
+        case "after":
+          $sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["left"]."` = `".$this->s_fields["left"]."` + ".$dif." WHERE `".$this->s_fields["left"]."` > ".$ref_rgt." AND `".$this->s_fields["id"]."` NOT IN(".implode(",",$ids).") ";
+          $sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["right"]."` = `".$this->s_fields["right"]."` + ".$dif." WHERE `".$this->s_fields["right"]."` > ".$ref_rgt." AND `".$this->s_fields["id"]."` NOT IN(".implode(",",$ids).") ";
+          if($mode == "move") {
+            $dif = ($ref_rgt + 1) - $nod_lft;
+            $sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["level"]."` = ".(int)$ref_lvl.", `".$this->s_fields["left"]."` = `".$this->s_fields["left"]."` + (".$dif."), `".$this->s_fields["right"]."` = `".$this->s_fields["right"]."` + (".$dif.") WHERE `".$this->s_fields["id"]."` IN (".implode(",",$ids).") ";
+          } else {
+            $fields[] = "`".$this->s_fields["level"]."`";
+            $fields[] = "`".$this->s_fields["left"]."`";
+            $fields[] = "`".$this->s_fields["right"]."`";
+            $values[] = (int)$ref_lvl;
+            $values[] = ((int)$ref_rgt + 1);
+            $values[] = ((int)$ref_rgt + 3);
+          }
+          break;
+        case "inside":
+        default:
+          $sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["left"]."` = `".$this->s_fields["left"]."` + ".$dif." WHERE `".$this->s_fields["left"]."` > ".$ref_lft." AND `".$this->s_fields["id"]."` NOT IN(".implode(",",$ids).") ";
+          $sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["right"]."` = `".$this->s_fields["right"]."` + ".$dif." WHERE `".$this->s_fields["right"]."` > ".$ref_lft." AND `".$this->s_fields["id"]."` NOT IN(".implode(",",$ids).") ";
+          if($mode == "move") {
+            $dif = ($ref_lft + 1) - $nod_lft;
+            $sql[] = "UPDATE `".$this->s_table."` SET `".$this->s_fields["level"]."` = ".(int)($ref_lvl + 1).", `".$this->s_fields["left"]."` = `".$this->s_fields["left"]."` + (".$dif."), `".$this->s_fields["right"]."` = `".$this->s_fields["right"]."` + (".$dif.") WHERE `".$this->s_fields["id"]."` IN (".implode(",",$ids).") ";
+          }
+          else {
+            $fields[] = "`".$this->s_fields["level"]."`";
+            $fields[] = "`".$this->s_fields["left"]."`";
+            $fields[] = "`".$this->s_fields["right"]."`";
+            $values[] = ((int)$ref_lvl + 1);
+            $values[] = ((int)$ref_lft + 1);
+            $values[] = ((int)$ref_lft + 3);
+          }
+          break;
+      }
+    }
+    
+    // If creating a new node
+    if($mode == "create") $sql[] = "INSERT INTO `".$this->s_table."` (".implode(",",$fields).") VALUES (".implode(",",$values).")";
+
+    // Applying all changes - there should be a transaction here
+    foreach($sql as $q) { $this->db->query($q); }
+
+    if($mode == "create") return mysql_insert_id();
+  }
+
+  // Function for removing nodes
+  // ID is the node (or array of nodes) that is being removed
+  function remove($id) {
+    if(is_array($id)) {
+      foreach($id as $i) { $this->remove($i); }
+      return;
+    }
+    if(!(int)$id) return false;
+
+    // Take care of nested sets (and adjacency at the same time if applicable)
+    if($this->nestedset) {
+      $this->db->query("SELECT `".$this->s_fields["left"]."` AS lft, `".$this->s_fields["right"]."` AS rgt ".( ($this->adjacency) ? " , `".$this->s_fields["parent_id"]."` AS pid, `".$this->s_fields["position"]."` AS pos " : "" )." FROM `".$this->s_table."` WHERE `".$this->s_fields["id"]."` = ".(int)$id);
+      $this->db->nextr();
+      if($this->adjacency) {
+        $pid = (int)$this->db->f("pid");
+        $pos = (int)$this->db->f("pos");
+      }
+      $lft = (int)$this->db->f("lft");
+      $rgt = (int)$this->db->f("rgt");
+      $dif = $rgt - $lft + 1;
+
+      $this->db->query("DELETE FROM `".$this->s_table."` WHERE `".$this->s_fields["left"]."` >= ".$lft." AND `".$this->s_fields["right"]."` <= ".$rgt);
+      $this->db->query("UPDATE `".$this->s_table."` SET `".$this->s_fields["left"]."` = `".$this->s_fields["left"]."` - ".$dif." WHERE `".$this->s_fields["left"]."` > ".$rgt);
+      $this->db->query("UPDATE `".$this->s_table."` SET `".$this->s_fields["right"]."` = `".$this->s_fields["right"]."` - ".$dif." WHERE `".$this->s_fields["right"]."` > ".$lft);
+      if($this->adjacency) {
+        $this->db->query("UPDATE `".$this->s_table."` SET `".$this->s_fields["position"]."` = `".$this->s_fields["position"]."` - 1 WHERE `".$this->s_fields["parent_id"]."` = ".$pid." AND `".$this->s_fields["position"]."` > ".$pos);
+      }
+      return;
+    }
+    // Only end up here if the tree is adjacency only
+    if($this->adjacency) {
+      $this->db->query("SELECT `".$this->s_fields["parent_id"]."` AS pid, `".$this->s_fields["position"]."` AS pos FROM `".$this->s_table."` WHERE `".$this->s_fields["id"]."` = ".(int)$id);
+      $this->db->nextr();
+      $pid = (int)$this->db->f("pid");
+      $pos = (int)$this->db->f("pos");
+
+      $tmp = array($id);
+      $ids = array($id);
+      while(count($tmp)) {
+        $t = array_shift($tmp);
+        if($t) {
+          $this->db->query("SELECT `".$this->s_fields["id"]."` FROM `".$this->s_table."` WHERE `".$this->s_fields["parent_id"]."` = ".(int)$t);
+          while($this->db->nextr()) { 
+            array_push($ids, $this->db->f(0));
+            array_push($tmp, $this->db->f(0));
+          }
+        }
+      }
+      $this->db->query("DELETE FROM `".$this->s_table."` WHERE `".$this->s_fields["id"]."` IN (".implode(",",$ids).")");
+      $this->db->query("UPDATE `".$this->s_table."` SET `".$this->s_fields["position"]."` = `".$this->s_fields["position"]."` - 1 WHERE `".$this->s_fields["parent_id"]."` = ".$pid." AND `".$this->s_fields["position"]."` > ".$pos);
+    }
+  }
+
+  function reconstruct() {
+    if(!$this->adjacency || !$this->nestedset) return;
+
+    // не знам защо да не е persistent
+    $this->db->pcn = false;
+
+    $q = "CREATE TEMPORARY TABLE temp_tree (".$this->s_fields["id"]." INTEGER NOT NULL, ".$this->s_fields["parent_id"]." INTEGER NOT NULL, ". $this->s_fields["position"]." INTEGER NOT NULL) type=HEAP";
+    $this->db->query($q);
+
+    $q = "INSERT INTO temp_tree SELECT ".$this->s_fields["id"].", ".$this->s_fields["parent_id"].", ".$this->s_fields["position"]." FROM ".$this->s_table;
+    $this->db->query($q);
+
+
+    $q = "CREATE TEMPORARY TABLE temp_stack (".$this->s_fields["id"]." INTEGER NOT NULL, ".$this->s_fields["left"]." INTEGER, ".$this->s_fields["right"]." INTEGER, ".$this->s_fields["level"]." INTEGER, stack_top INTEGER NOT NULL, ".$this->s_fields["parent_id"]." INTEGER, ".$this->s_fields["position"]." INTEGER) type=HEAP";
+    $this->db->query($q);
+    $counter = 2;
+
+    $q = "SELECT COUNT(*) as maxcounter FROM temp_tree";
+    $this->db->query($q);
+    $this->db->nextr();
+    $maxcounter = (int) $this->db->f("maxcounter") * 2;
+    $currenttop = 1;
+
+    $q = "INSERT INTO temp_stack SELECT ".$this->s_fields["id"].", 1, NULL, 0, 1, ".$this->s_fields["parent_id"].", ".$this->s_fields["position"]." FROM temp_tree WHERE ".$this->s_fields["parent_id"]." = 0";
+    $this->db->query($q);
+
+    $q = "DELETE FROM temp_tree WHERE ".$this->s_fields["parent_id"]." = 0";
+    $this->db->query($q);
+
+    while ($counter <= $maxcounter) {
+      $q = "SELECT temp_tree.".$this->s_fields["id"]." AS tempmin, temp_tree.".$this->s_fields["parent_id"]." AS pid, temp_tree.".$this->s_fields["position"]." AS lid FROM temp_stack, temp_tree WHERE temp_stack.".$this->s_fields["id"]." = temp_tree.".$this->s_fields["parent_id"]." AND temp_stack.stack_top = ".$currenttop." ORDER BY temp_tree.".$this->s_fields["position"]." ASC LIMIT 1";
+      $this->db->query($q);
+
+      if ($this->db->nextr()) {
+        $tmp = $this->db->f("tempmin");
+
+        $q = "INSERT INTO temp_stack (stack_top, ".$this->s_fields["id"].", ".$this->s_fields["left"].", ".$this->s_fields["right"].", ".$this->s_fields["level"].", ".$this->s_fields["parent_id"].", ".$this->s_fields["position"].") VALUES(".($currenttop + 1).", ".$tmp.", ".$counter.", NULL, ".$currenttop.", ".$this->db->f("pid").", ".$this->db->f("lid").")";
+        $this->db->query($q);
+        $q = "DELETE FROM temp_tree WHERE ".$this->s_fields["id"]." = ".$tmp;
+        $this->db->query($q);
+        $counter++;
+        $currenttop++;
+      }
+      else {
+        $q = "UPDATE temp_stack SET ".$this->s_fields["right"]." = ".$counter.", stack_top = -stack_top WHERE stack_top = ".$currenttop;
+        $this->db->query($q);
+        $counter++;
+        $currenttop--;
+      }
+    }
+
+    $q = "TRUNCATE TABLE ".$this->s_table;
+    $this->db->query($q);
+
+    $q = "INSERT INTO ".$this->s_table." SELECT ".$this->s_fields["id"].", ".$this->s_fields["parent_id"].", ".$this->s_fields["position"].", ".$this->s_fields["left"].", ".$this->s_fields["right"].", ".$this->s_fields["level"]." FROM temp_stack ORDER BY ".$this->s_fields["id"];
+    $this->db->query($q);
+  }
+
+  function analyze() {
+    $this->errors = array();
+    if($this->adjacency) {
+      $this->db->query("SELECT COUNT(*) FROM ".$this->s_table." s WHERE ".$this->s_fields["parent_id"]." != 0 AND (SELECT COUNT(*) FROM ".$this->s_table." WHERE ".$this->s_fields["id"]." = s.".$this->s_fields["parent_id"].") = 0 ");
+      $this->db->nextr();
+      if($this->db->f(0) > 0) $this->errors[] = "Missing parents.";
+    }
+    if($this->nestedset) {
+      $this->db->query("SELECT MAX(".$this->s_fields["right"].") FROM ".$this->s_table);
+      $this->db->nextr();
+      $n = $this->db->f(0);
+      $this->db->query("SELECT COUNT(*) FROM ".$this->s_table);
+      $this->db->nextr();
+      $c = $this->db->f(0);
+      if($n/2 != $c) $this->errors[] = "Right index does not match node count.";
+    }
+    if($this->adjacency && $this->nestedset) {
+      $this->db->query("SELECT COUNT(".$this->s_fields["id"].") FROM ".$this->s_table." s WHERE (SELECT COUNT(*) FROM ".$this->s_table." WHERE ".$this->s_fields["right"]." < s.".$this->s_fields["right"]." AND ".$this->s_fields["left"]." > s.".$this->s_fields["left"]." AND ".$this->s_fields["level"]." = s.".$this->s_fields["level"]." + 1) != (SELECT COUNT(*) FROM ".$this->s_table." WHERE ".$this->s_fields["parent_id"]." = s.".$this->s_fields["id"].") ");
+      $this->db->nextr();
+      if($this->db->f(0) > 0) $this->errors = "Adjacency and nested set do not match.";
+    }
+    return $error;
+  }
 }
 ?>

+ 73 - 73
tripal_cv/theme/js/jsTree/reference/_examples/full/_inc/database.php

@@ -1,85 +1,85 @@
 <?
-define ("server"	, $server );
-define ("db_user"	, $db_user);
-define ("db_pass"	, $db_pass);
-define ("only_db"	, $only_db);
+define ("server"  , $server );
+define ("db_user"  , $db_user);
+define ("db_pass"  , $db_pass);
+define ("only_db"  , $only_db);
 
 class DB {
-	var $srv = server;
-	var $usr = db_user;
-	var $pwd = db_pass;
-	var $odb = only_db;
-	var $pcn = false;
-	var $doe = true;
-	var $fel = true;
-	var $error_log = "mysql_errors.log";
+  var $srv = server;
+  var $usr = db_user;
+  var $pwd = db_pass;
+  var $odb = only_db;
+  var $pcn = false;
+  var $doe = true;
+  var $fel = true;
+  var $error_log = "mysql_errors.log";
 
-	function connect(){
-		if (!$this->link){
-			$this->link = ($this->pcn) ? mysql_pconnect($this->srv, $this->usr, $this->pwd) : 
-										 mysql_connect( $this->srv, $this->usr, $this->pwd) or 
-										 $this->error();
-		}
-		if (!mysql_select_db($this->odb,$this->link)) $this->error();
-		if($this->link) mysql_query("SET NAMES 'utf8'");
-		return ($this->link) ? true : false;
-	}
+  function connect(){
+    if (!$this->link){
+      $this->link = ($this->pcn) ? mysql_pconnect($this->srv, $this->usr, $this->pwd) : 
+                     mysql_connect( $this->srv, $this->usr, $this->pwd) or 
+                     $this->error();
+    }
+    if (!mysql_select_db($this->odb,$this->link)) $this->error();
+    if($this->link) mysql_query("SET NAMES 'utf8'");
+    return ($this->link) ? true : false;
+  }
 
-	function query($sql){
-		if (!$this->link && !$this->connect()) $this->error();
-		if (!($this->result = mysql_query($sql, $this->link))) $this->error($sql);
-		return ($this->result) ? true : false;
-	}
-	
-	function nextr(){
-		if (!$this->result) die ("No query pending");
-		unset($this->row);
-		$this->row = mysql_fetch_array($this->result, MYSQL_BOTH);
-		return ($this->row) ? true : false ;
-	}
+  function query($sql){
+    if (!$this->link && !$this->connect()) $this->error();
+    if (!($this->result = mysql_query($sql, $this->link))) $this->error($sql);
+    return ($this->result) ? true : false;
+  }
+  
+  function nextr(){
+    if (!$this->result) die ("No query pending");
+    unset($this->row);
+    $this->row = mysql_fetch_array($this->result, MYSQL_BOTH);
+    return ($this->row) ? true : false ;
+  }
 
-	function f($index){
-		return stripslashes($this->row[$index]);
-	}
+  function f($index){
+    return stripslashes($this->row[$index]);
+  }
 
-	function goto($row){
-		if (!$this->result) die ("No query pending");
-		if (!mysql_data_seek($this->result, $row)) $this->error();
-	}
+  function goto($row){
+    if (!$this->result) die ("No query pending");
+    if (!mysql_data_seek($this->result, $row)) $this->error();
+  }
 
-	function nf(){
-		if ($numb = mysql_num_rows($this->result) === false) $this->error();
-		return mysql_num_rows($this->result);
-	}
-	function af(){
-		return mysql_affected_rows();
-	}
-	function error($string=""){
-		echo $error = mysql_error();
-		if ($this->fel){
-			$fp = fopen($this->error_log,"a+");
-			fwrite($fp, "[".date("Y-m-d H:i:s")."]<".$error.">$string\n");
-			fclose($fp);
-		}
-		if ($this->doe){
-			if (isset($this->result)) mysql_free_result($this->result);
-			mysql_close($this->link);
-			die();
-		}
-	}
-	function insert_id(){
-		if(!$this->link) return false;
-		return mysql_insert_id();
-	}
-	function escape($string){
-		if(!$this->link) return addslashes($string);
-		return mysql_real_escape_string($string);
-	}
+  function nf(){
+    if ($numb = mysql_num_rows($this->result) === false) $this->error();
+    return mysql_num_rows($this->result);
+  }
+  function af(){
+    return mysql_affected_rows();
+  }
+  function error($string=""){
+    echo $error = mysql_error();
+    if ($this->fel){
+      $fp = fopen($this->error_log,"a+");
+      fwrite($fp, "[".date("Y-m-d H:i:s")."]<".$error.">$string\n");
+      fclose($fp);
+    }
+    if ($this->doe){
+      if (isset($this->result)) mysql_free_result($this->result);
+      mysql_close($this->link);
+      die();
+    }
+  }
+  function insert_id(){
+    if(!$this->link) return false;
+    return mysql_insert_id();
+  }
+  function escape($string){
+    if(!$this->link) return addslashes($string);
+    return mysql_real_escape_string($string);
+  }
 
-	function destroy(){
-		if (isset($this->result)) mysql_free_result($this->result);
-		if (isset($this->link_id)) mysql_close($this->link_id);
-	}
+  function destroy(){
+    if (isset($this->result)) mysql_free_result($this->result);
+    if (isset($this->link_id)) mysql_close($this->link_id);
+  }
 
 
 }

+ 81 - 81
tripal_cv/theme/js/jsTree/reference/_examples/full/server.php

@@ -1,9 +1,9 @@
 <?
 // Configure database
-$server		= "localhost";
-$db_user	= "********";
-$db_pass	= "********";
-$only_db	= "********";
+$server    = "localhost";
+$db_user  = "********";
+$db_pass  = "********";
+$only_db  = "********";
 
 // Include required classes
 require_once("_inc/database.php");
@@ -20,86 +20,86 @@ while($db->nextr()) { $languages[$db->f(0)] = array($db->f(1),$db->f(2)); }
 
 // SERVER SIDE PART
 if(isset($_REQUEST["server"])) {
-	// Make sure nothing is cached
-	header("Cache-Control: must-revalidate");
-	header("Cache-Control: post-check=0, pre-check=0", false);
-	header("Pragma: no-cache");
-	header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H")-2, date("i"), date("s"), date("m"), date("d"), date("Y")))." GMT");
-	header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
+  // Make sure nothing is cached
+  header("Cache-Control: must-revalidate");
+  header("Cache-Control: post-check=0, pre-check=0", false);
+  header("Pragma: no-cache");
+  header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H")-2, date("i"), date("s"), date("m"), date("d"), date("Y")))." GMT");
+  header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
 
-	
-	switch($_REQUEST["type"]) {
-		 case "list":
-			$id = (int)str_replace("node_","",$_REQUEST["id"]);
-			$db->query("SELECT s.id, ( SELECT COUNT(*) FROM structure WHERE parent_id = s.id ) AS children, c.language, c.name FROM structure s LEFT JOIN content c ON c.id = s.id WHERE s.parent_id = ".$id." ORDER BY position");
-			$data = array();
-			$children = array();
-			while($db->nextr()) {
-				$children[$db->f("id")] = (int)$db->f("children");
-				$data[$db->f("id")][$db->f("language")] = $db->f("name");
-			}
-			echo "[\n";
-			$i = 0;
-			foreach($data as $k => $v) {
-				echo "{\n";
-				echo "\tattributes: {\n";
-				echo "\t\tid :  'node_".$k."'\n";
-				echo "\t},\n";
-				if($children[$k]) echo "\tstate: 'closed', \n";
-				echo "\tdata: {\n";
-				$kf = 0;
-				foreach($v as $lang => $name) {
-					if($kf > 0)	echo ",\n";
-					else		echo "\n";
-					$kf ++;
-					echo "\t\t'".$languages[$lang][0]."' : { title : '".$name."' }"; 
-				}
-				echo "\n";
-				echo "\t}\n";
-				echo "}";
-				if(++$i < count($data)) echo ",";
-				echo "\n";
-			}
-			echo "\n]";
-			break;
-		case "delete":
-			$id = (int)str_replace("node_","",$_REQUEST["id"]);
-			$tree->remove($id);
-			$db->query("DELETE FROM content WHERE id = ".$id);
-			echo "OK";
-			break;
+  
+  switch($_REQUEST["type"]) {
+     case "list":
+      $id = (int)str_replace("node_","",$_REQUEST["id"]);
+      $db->query("SELECT s.id, ( SELECT COUNT(*) FROM structure WHERE parent_id = s.id ) AS children, c.language, c.name FROM structure s LEFT JOIN content c ON c.id = s.id WHERE s.parent_id = ".$id." ORDER BY position");
+      $data = array();
+      $children = array();
+      while($db->nextr()) {
+        $children[$db->f("id")] = (int)$db->f("children");
+        $data[$db->f("id")][$db->f("language")] = $db->f("name");
+      }
+      echo "[\n";
+      $i = 0;
+      foreach($data as $k => $v) {
+        echo "{\n";
+        echo "\tattributes: {\n";
+        echo "\t\tid :  'node_".$k."'\n";
+        echo "\t},\n";
+        if($children[$k]) echo "\tstate: 'closed', \n";
+        echo "\tdata: {\n";
+        $kf = 0;
+        foreach($v as $lang => $name) {
+          if($kf > 0)  echo ",\n";
+          else    echo "\n";
+          $kf ++;
+          echo "\t\t'".$languages[$lang][0]."' : { title : '".$name."' }"; 
+        }
+        echo "\n";
+        echo "\t}\n";
+        echo "}";
+        if(++$i < count($data)) echo ",";
+        echo "\n";
+      }
+      echo "\n]";
+      break;
+    case "delete":
+      $id = (int)str_replace("node_","",$_REQUEST["id"]);
+      $tree->remove($id);
+      $db->query("DELETE FROM content WHERE id = ".$id);
+      echo "OK";
+      break;
 
-		case "create":
-		case "move":
-			$id		= (int)str_replace("node_","",$_REQUEST["id"]);
-			$ref_id	= (int)str_replace("node_","",$_REQUEST["ref_id"]);
-			$type	= $_REQUEST["move_type"];
-			$result = $tree->move($id,$ref_id,$type);
-			if($id == 0) {
-				foreach($languages as $k => $lang) {
-					$db->query("INSERT INTO content (id,language,name,data) VALUES(".$result.",".$k.",'New folder','')");
-				}
-				echo "node_".$result;
-			}
-			break;
-		case "rename":
-			$sql = "UPDATE content SET name = '".addslashes($_REQUEST["data"])."' WHERE id = ".(int)str_replace("node_","",$_REQUEST["id"])." AND language = ".(int)$_REQUEST["lang"];
-			$db->query($sql);
-			echo $sql;
-			break;
+    case "create":
+    case "move":
+      $id    = (int)str_replace("node_","",$_REQUEST["id"]);
+      $ref_id  = (int)str_replace("node_","",$_REQUEST["ref_id"]);
+      $type  = $_REQUEST["move_type"];
+      $result = $tree->move($id,$ref_id,$type);
+      if($id == 0) {
+        foreach($languages as $k => $lang) {
+          $db->query("INSERT INTO content (id,language,name,data) VALUES(".$result.",".$k.",'New folder','')");
+        }
+        echo "node_".$result;
+      }
+      break;
+    case "rename":
+      $sql = "UPDATE content SET name = '".addslashes($_REQUEST["data"])."' WHERE id = ".(int)str_replace("node_","",$_REQUEST["id"])." AND language = ".(int)$_REQUEST["lang"];
+      $db->query($sql);
+      echo $sql;
+      break;
 
 
-		case "loadfile":
-			$db->query("SELECT * FROM content WHERE id = ".(int)str_replace("node_","",$_REQUEST["id"])." AND language = ".(int)$_REQUEST["lang"]);
-			$db->nextr();
-			echo $db->f("data");
-			break;
-		case "savefile":
-			$sql = "UPDATE content SET data = '".addslashes($_REQUEST["data"])."' WHERE id = ".(int)str_replace("node_","",$_REQUEST["id"])." AND language = ".(int)$_REQUEST["lang"];
-			$db->query($sql);
-			echo $sql;
-			break;
-	}
-	exit();
+    case "loadfile":
+      $db->query("SELECT * FROM content WHERE id = ".(int)str_replace("node_","",$_REQUEST["id"])." AND language = ".(int)$_REQUEST["lang"]);
+      $db->nextr();
+      echo $db->f("data");
+      break;
+    case "savefile":
+      $sql = "UPDATE content SET data = '".addslashes($_REQUEST["data"])."' WHERE id = ".(int)str_replace("node_","",$_REQUEST["id"])." AND language = ".(int)$_REQUEST["lang"];
+      $db->query($sql);
+      echo $sql;
+      break;
+  }
+  exit();
 }
 ?>

+ 54 - 53
tripal_feature/includes/tripal_feature.blocks.inc

@@ -42,6 +42,7 @@ function tripal_feature_block_info() {
 
   return $blocks;
 }
+
 /**
  *
  *
@@ -55,59 +56,59 @@ function tripal_feature_block_view($delta = '') {
 
     $block = array();
     switch ($delta) {
-    	case 'references':
-    	  $block['subject'] = t('References');
-    	  $block['content'] = theme('tripal_feature_references', $node);
-    	  break;
-    	case 'base':
-    	  $block['subject'] = t('Feature Details');
-    	  $block['content'] = theme('tripal_feature_base', $node);
-    	  break;
-    	case 'synonyms':
-    	  $block['subject'] = t('Synonyms');
-    	  $block['content'] = theme('tripal_feature_synonyms', $node);
-    	  break;
-    	case 'properties':
-    	  $block['subject'] = t('Properties');
-    	  $block['content'] = theme('tripal_feature_properties', $node);
-    	  break;
-    	case 'terms':
-    	  $block['subject'] = t('Annotated Terms');
-    	  $block['content'] = theme('tripal_feature_terms', $node);
-    	  break;
-    	case 'sequence':
-    	  $block['subject'] = t('Sequence');
-    	  $block['content'] = theme('tripal_feature_sequence', $node);
-    	  break;
-    	case 'featureloc_sequences':
-    	  $block['subject'] = t('Formatted Sequences');
-    	  $block['content'] = theme('tripal_feature_featureloc_sequences', $node);
-    	  break;
-    	case 'alignments':
-    	  $block['subject'] = t('Alignments');
-    	  $block['content'] = theme('tripal_feature_alignments', $node);
-    	  break;
-    	case 'relationships':
-    	  $block['subject'] = t('Relationships');
-    	  $block['content'] = theme('tripal_feature_relationships', $node);
-    	  break;
-    	case 'org_feature_counts':
-    	  $block['subject'] = t('Feature Type Summary');
-    	  $block['content'] = theme('tripal_organism_feature_counts', array('node' => $node));
-    	  break;
-    	case 'org_feature_browser':
-    	  $block['subject'] = t('Feature Browser');
-    	  $block['content'] = theme('tripal_organism_feature_browser', array('node' => $node));
-    	  break;
-    	case 'library_feature_browser':
-    	  $block['subject'] = t('Library Feature Browser');
-    	  $block['content'] = theme('tripal_library_feature_browser', $node);
-    	  break;
-    	case 'analysis_feature_browser':
-    	  $block['subject'] = t('Analysis Feature Browser');
-    	  $block['content'] = theme('tripal_analysis_feature_browser', $node);
-    	  break;
-    	default :
+      case 'references':
+        $block['subject'] = t('References');
+        $block['content'] = theme('tripal_feature_references', $node);
+        break;
+      case 'base':
+        $block['subject'] = t('Feature Details');
+        $block['content'] = theme('tripal_feature_base', $node);
+        break;
+      case 'synonyms':
+        $block['subject'] = t('Synonyms');
+        $block['content'] = theme('tripal_feature_synonyms', $node);
+        break;
+      case 'properties':
+        $block['subject'] = t('Properties');
+        $block['content'] = theme('tripal_feature_properties', $node);
+        break;
+      case 'terms':
+        $block['subject'] = t('Annotated Terms');
+        $block['content'] = theme('tripal_feature_terms', $node);
+        break;
+      case 'sequence':
+        $block['subject'] = t('Sequence');
+        $block['content'] = theme('tripal_feature_sequence', $node);
+        break;
+      case 'featureloc_sequences':
+        $block['subject'] = t('Formatted Sequences');
+        $block['content'] = theme('tripal_feature_featureloc_sequences', $node);
+        break;
+      case 'alignments':
+        $block['subject'] = t('Alignments');
+        $block['content'] = theme('tripal_feature_alignments', $node);
+        break;
+      case 'relationships':
+        $block['subject'] = t('Relationships');
+        $block['content'] = theme('tripal_feature_relationships', $node);
+        break;
+      case 'org_feature_counts':
+        $block['subject'] = t('Feature Type Summary');
+        $block['content'] = theme('tripal_organism_feature_counts', array('node' => $node));
+        break;
+      case 'org_feature_browser':
+        $block['subject'] = t('Feature Browser');
+        $block['content'] = theme('tripal_organism_feature_browser', array('node' => $node));
+        break;
+      case 'library_feature_browser':
+        $block['subject'] = t('Library Feature Browser');
+        $block['content'] = theme('tripal_library_feature_browser', $node);
+        break;
+      case 'analysis_feature_browser':
+        $block['subject'] = t('Analysis Feature Browser');
+        $block['content'] = theme('tripal_analysis_feature_browser', $node);
+        break;
+      default :
     }
     return $block;
   }

+ 1 - 1
tripal_feature/tripal_feature.module

@@ -1164,4 +1164,4 @@ function tripal_feature_form_alter(&$form, &$form_state, $form_id) {
   if ($form_id == "chado_feature_node_form") {
     $form['actions']['preview']['#access'] = FALSE;
   }
-}
+}

+ 25 - 25
tripal_featuremap/includes/tripal_featuremap.chado_node.inc

@@ -436,30 +436,30 @@ function tripal_featuremap_node_presave($node) {
  */
 function tripal_featuremap_node_view($node, $view_mode, $langcode) {
   switch ($node->type) {
-  	case 'chado_featuremap':
-  	  // Show feature browser and counts
-  	  if ($view_mode == 'full') {
-  	    $node->content['tripal_featuremap_base'] = array(
-  	      '#value' => theme('tripal_featuremap_base', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_featuremap_featurepos'] = array(
-  	      '#value' => theme('tripal_featuremap_featurepos', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_featuremap_properties'] = array(
-  	      '#value' => theme('tripal_featuremap_properties', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_featuremap_publication'] = array(
-  	      '#value' => theme('tripal_featuremap_publication', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_featuremap_references'] = array(
-  	      '#value' => theme('tripal_featuremap_references', array('node' => $node)),
-  	    );
-  	  }
-  	  if ($view_mode == 'teaser') {
-  	    $node->content['tripal_featuremap_teaser'] = array(
-  	      '#value' => theme('tripal_featuremap_teaser', array('node' => $node)),
-  	    );
-  	  }
-  	  break;
+    case 'chado_featuremap':
+      // Show feature browser and counts
+      if ($view_mode == 'full') {
+        $node->content['tripal_featuremap_base'] = array(
+          '#value' => theme('tripal_featuremap_base', array('node' => $node)),
+        );
+        $node->content['tripal_featuremap_featurepos'] = array(
+          '#value' => theme('tripal_featuremap_featurepos', array('node' => $node)),
+        );
+        $node->content['tripal_featuremap_properties'] = array(
+          '#value' => theme('tripal_featuremap_properties', array('node' => $node)),
+        );
+        $node->content['tripal_featuremap_publication'] = array(
+          '#value' => theme('tripal_featuremap_publication', array('node' => $node)),
+        );
+        $node->content['tripal_featuremap_references'] = array(
+          '#value' => theme('tripal_featuremap_references', array('node' => $node)),
+        );
+      }
+      if ($view_mode == 'teaser') {
+        $node->content['tripal_featuremap_teaser'] = array(
+          '#value' => theme('tripal_featuremap_teaser', array('node' => $node)),
+        );
+      }
+      break;
   }
 }

+ 1 - 1
tripal_organism/theme/tripal_organism/tripal_organism_description.tpl.php

@@ -6,6 +6,6 @@ $organism = $variables['node']->organism;
    <table id="tripal_organism-table-description" class="tripal_organism-table tripal-table tripal-table-horz">
       <tr class="tripal_organism-table-odd-row tripal-table-even-row">
         <td><?php print $organism->comment; ?></td>
-      </tr>        	                                
+      </tr>                                          
    </table>
 </div>

+ 25 - 25
tripal_project/includes/tripal_project.chado_node.inc

@@ -408,30 +408,30 @@ function chado_project_node_access($node, $op, $account) {
  */
 function tripal_project_node_view($node, $view_mode, $langcode) {
   switch ($node->type) {
-  	case 'chado_project':
-  	  // Show feature browser and counts
-  	  if ($view_mode == 'full') {
-  	    $node->content['tripal_project_base'] = array(
-  	      '#value' => theme('tripal_project_base', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_project_contact'] = array(
-  	      '#value' => theme('tripal_project_contact', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_project_properties'] = array(
-  	      '#value' => theme('tripal_project_properties', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_project_publications'] = array(
-  	      '#value' => theme('tripal_project_publications', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_project_relationships'] = array(
-  	      '#value' => theme('tripal_project_relationships', array('node' => $node)),
-  	    );
-  	  }
-  	  if ($view_mode == 'teaser') {
-  	    $node->content['tripal_project_teaser'] = array(
-  	      '#value' => theme('tripal_project_teaser', array('node' => $node)),
-  	    );
-  	  }
-  	  break;
+    case 'chado_project':
+      // Show feature browser and counts
+      if ($view_mode == 'full') {
+        $node->content['tripal_project_base'] = array(
+          '#value' => theme('tripal_project_base', array('node' => $node)),
+        );
+        $node->content['tripal_project_contact'] = array(
+          '#value' => theme('tripal_project_contact', array('node' => $node)),
+        );
+        $node->content['tripal_project_properties'] = array(
+          '#value' => theme('tripal_project_properties', array('node' => $node)),
+        );
+        $node->content['tripal_project_publications'] = array(
+          '#value' => theme('tripal_project_publications', array('node' => $node)),
+        );
+        $node->content['tripal_project_relationships'] = array(
+          '#value' => theme('tripal_project_relationships', array('node' => $node)),
+        );
+      }
+      if ($view_mode == 'teaser') {
+        $node->content['tripal_project_teaser'] = array(
+          '#value' => theme('tripal_project_teaser', array('node' => $node)),
+        );
+      }
+      break;
   }
 }

+ 40 - 40
tripal_pub/includes/tripal_pub.chado_node.inc

@@ -924,46 +924,46 @@ function chado_pub_delete(&$node) {
  */
 function tripal_pub_node_view($node, $view_mode, $langcode) {
   switch ($node->type) {
-  	case 'chado_pub':
-  	  // Show feature browser and counts
-  	  if ($view_mode == 'full') {
-  	    $node->content['tripal_pub_authors'] = array(
-  	      '#value' => theme('tripal_pub_authors', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_base'] = array(
-  	      '#value' => theme('tripal_pub_base', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_featuremaps'] = array(
-  	      '#value' => theme('tripal_pub_featuremaps', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_features'] = array(
-  	      '#value' => theme('tripal_pub_features', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_libraries'] = array(
-  	      '#value' => theme('tripal_pub_libraries', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_projects'] = array(
-  	      '#value' => theme('tripal_pub_projects', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_properties'] = array(
-  	      '#value' => theme('tripal_pub_properties', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_references'] = array(
-  	      '#value' => theme('tripal_pub_references', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_relationships'] = array(
-  	      '#value' => theme('tripal_pub_relationships', array('node' => $node)),
-  	    );
-  	    $node->content['tripal_pub_stocks'] = array(
-  	      '#value' => theme('tripal_pub_stocks', array('node' => $node)),
-  	    );
-  	  }
-  	  if ($view_mode == 'teaser') {
-  	    $node->content['tripal_pub_teaser'] = array(
-  	      '#value' => theme('tripal_pub_teaser', array('node' => $node)),
-  	    );
-  	  }
-  	  break;
+    case 'chado_pub':
+      // Show feature browser and counts
+      if ($view_mode == 'full') {
+        $node->content['tripal_pub_authors'] = array(
+          '#value' => theme('tripal_pub_authors', array('node' => $node)),
+        );
+        $node->content['tripal_pub_base'] = array(
+          '#value' => theme('tripal_pub_base', array('node' => $node)),
+        );
+        $node->content['tripal_pub_featuremaps'] = array(
+          '#value' => theme('tripal_pub_featuremaps', array('node' => $node)),
+        );
+        $node->content['tripal_pub_features'] = array(
+          '#value' => theme('tripal_pub_features', array('node' => $node)),
+        );
+        $node->content['tripal_pub_libraries'] = array(
+          '#value' => theme('tripal_pub_libraries', array('node' => $node)),
+        );
+        $node->content['tripal_pub_projects'] = array(
+          '#value' => theme('tripal_pub_projects', array('node' => $node)),
+        );
+        $node->content['tripal_pub_properties'] = array(
+          '#value' => theme('tripal_pub_properties', array('node' => $node)),
+        );
+        $node->content['tripal_pub_references'] = array(
+          '#value' => theme('tripal_pub_references', array('node' => $node)),
+        );
+        $node->content['tripal_pub_relationships'] = array(
+          '#value' => theme('tripal_pub_relationships', array('node' => $node)),
+        );
+        $node->content['tripal_pub_stocks'] = array(
+          '#value' => theme('tripal_pub_stocks', array('node' => $node)),
+        );
+      }
+      if ($view_mode == 'teaser') {
+        $node->content['tripal_pub_teaser'] = array(
+          '#value' => theme('tripal_pub_teaser', array('node' => $node)),
+        );
+      }
+      break;
   }
 }
 /**

+ 94 - 94
tripal_pub/theme/tripal_pub_help.tpl.php

@@ -6,106 +6,106 @@ module additionally provides a search tool for finding publications that
 have been added to Chado database.</p>
 <h3>Setup Instructions:</h3>
 <ol>
-	<li>
-	<p><b>Set Permissions</b>: The publication module supports the Drupal
-	user permissions interface for controlling access to publication
-	content and functions. These permissions include viewing, creating,
-	editing or administering of publications. The default is that only the
-	original site administrator has these permissions. You can <a
-		href="<?php print url('admin/user/roles') ?>">add roles</a> for
-	classifying users, <a href="<?php print url('admin/user/user') ?>">assign
-	users to roles</a> and <a
-		href="<?php print url('admin/user/permissions') ?>">assign permissions</a>
-	for the publication content to those roles. For a simple setup, allow
-	anonymous users access to view publication content and allow the site
-	administrator all other permissions.</p>
-	</li>
-	<li>
-	<p><b>Sync Publications</b>: If you already have publications in your
-	Chado database, or you loaded them through a means other than Tripal,
-	and you want those publications to appear on your site then you will
-	need to "sync" them with Drupal. Use the <?php print l('sync publications', 'admin/tripal/tripal_pub/sync') ?>
-	page to sync all publications.</p>
-	</li>
-	<li>
-	<p><b>Configure the Search Behavior</b>: Before allowing site visitors
-	to search for publications visit the <?php print l('configuration page', 'admin/tripal/tripal_pub/configuration') ?>
-	to disable or enable fields for searching. Tripal uses its own ontology
-	for storing publication information in Chado, and all child terms of
-	the "Publication Details" are made available for searching. However,
-	some of these may not be desired for searching and can be disabled.</p>
-	</li>
-	<li>
-	<p><b>AGL Importer</b>: Initially, the Tripal publication module
-	supports creating publication importers using PubMed and the USDA
-	National Agricultural Library (AGL). The AGL database uses a Z39.50
-	protocol for querying and therefore Tripal requires the 'YAZ' library
-	to connect. Before you can query AGL you must install the YAZ library
-	and the PHP YAZ library. The following steps can be used on an Ubuntu
-	12.04 server to intall the necessary pre-requisites:</p>
-	<ol>
-		<li>Install the YAZ libraries: sudo apt-get install yaz libyaz4-dev</li>
-		<li>Install the PHP YAZ extension: sudo pecl install yaz</li>
-		<li>Add the text 'extension=yaz.so' to the appropriate php.ini file
-		(e.g. /etc/php5/apache2filter/php.ini). On Ubuntu you may need to
-		add it to the php.ini file specfic for the Apache webserver and 
-		also to the php.ini specific for the command-line.</li>
-		<li>Restart the webserver</li>
-	</ol>
-	</li>
-	<li>
-	<p><b>Automate Importers:</b> Site administrators can <?php print l('create publication importers', 'admin/tripal/tripal_pub/import/new') ?>
-	that can be used to query remote databases (e.g. PubMed) and import
-	publications into this database. After creation of importers you can
-	automate import of publications into the site by creating a cron job
-	with a <?php print l('Drush', "http://drupal.org/project/drush")?>
-	command. The cron job can be setup to run the importers periodically.
-	The following is an example entry, added to the 'root' crontab, that
-	would run importers on a weekly bases (Friday at 9am): <br>
-	</p>
-	<pre>0 9 * * 5  su - [web user] -c 'cd [drupal install path]; drush -l http://[site url] tpubs-import --report=[email]'</pre>
-	Where:<br>
-	<p>[web user] is the name of the user on the system under which the web
-	server runs<br>
-	[drupal install path] is the location where drupal is installed<br>
-	[site url] is the URL path for the site <br>
-	[email] is the email address of the person who should receive an HTML
-	report of the publications added. Separate multiple emails with a comma
-	(no spaces).<br>
-	The --report=Y option indicates that an HTML style report should be
-	generated listing the publications that were added. If this options is
-	not used then no report is generated.</p>
-	</li>
+  <li>
+  <p><b>Set Permissions</b>: The publication module supports the Drupal
+  user permissions interface for controlling access to publication
+  content and functions. These permissions include viewing, creating,
+  editing or administering of publications. The default is that only the
+  original site administrator has these permissions. You can <a
+    href="<?php print url('admin/user/roles') ?>">add roles</a> for
+  classifying users, <a href="<?php print url('admin/user/user') ?>">assign
+  users to roles</a> and <a
+    href="<?php print url('admin/user/permissions') ?>">assign permissions</a>
+  for the publication content to those roles. For a simple setup, allow
+  anonymous users access to view publication content and allow the site
+  administrator all other permissions.</p>
+  </li>
+  <li>
+  <p><b>Sync Publications</b>: If you already have publications in your
+  Chado database, or you loaded them through a means other than Tripal,
+  and you want those publications to appear on your site then you will
+  need to "sync" them with Drupal. Use the <?php print l('sync publications', 'admin/tripal/tripal_pub/sync') ?>
+  page to sync all publications.</p>
+  </li>
+  <li>
+  <p><b>Configure the Search Behavior</b>: Before allowing site visitors
+  to search for publications visit the <?php print l('configuration page', 'admin/tripal/tripal_pub/configuration') ?>
+  to disable or enable fields for searching. Tripal uses its own ontology
+  for storing publication information in Chado, and all child terms of
+  the "Publication Details" are made available for searching. However,
+  some of these may not be desired for searching and can be disabled.</p>
+  </li>
+  <li>
+  <p><b>AGL Importer</b>: Initially, the Tripal publication module
+  supports creating publication importers using PubMed and the USDA
+  National Agricultural Library (AGL). The AGL database uses a Z39.50
+  protocol for querying and therefore Tripal requires the 'YAZ' library
+  to connect. Before you can query AGL you must install the YAZ library
+  and the PHP YAZ library. The following steps can be used on an Ubuntu
+  12.04 server to intall the necessary pre-requisites:</p>
+  <ol>
+    <li>Install the YAZ libraries: sudo apt-get install yaz libyaz4-dev</li>
+    <li>Install the PHP YAZ extension: sudo pecl install yaz</li>
+    <li>Add the text 'extension=yaz.so' to the appropriate php.ini file
+    (e.g. /etc/php5/apache2filter/php.ini). On Ubuntu you may need to
+    add it to the php.ini file specfic for the Apache webserver and 
+    also to the php.ini specific for the command-line.</li>
+    <li>Restart the webserver</li>
+  </ol>
+  </li>
+  <li>
+  <p><b>Automate Importers:</b> Site administrators can <?php print l('create publication importers', 'admin/tripal/tripal_pub/import/new') ?>
+  that can be used to query remote databases (e.g. PubMed) and import
+  publications into this database. After creation of importers you can
+  automate import of publications into the site by creating a cron job
+  with a <?php print l('Drush', "http://drupal.org/project/drush")?>
+  command. The cron job can be setup to run the importers periodically.
+  The following is an example entry, added to the 'root' crontab, that
+  would run importers on a weekly bases (Friday at 9am): <br>
+  </p>
+  <pre>0 9 * * 5  su - [web user] -c 'cd [drupal install path]; drush -l http://[site url] tpubs-import --report=[email]'</pre>
+  Where:<br>
+  <p>[web user] is the name of the user on the system under which the web
+  server runs<br>
+  [drupal install path] is the location where drupal is installed<br>
+  [site url] is the URL path for the site <br>
+  [email] is the email address of the person who should receive an HTML
+  report of the publications added. Separate multiple emails with a comma
+  (no spaces).<br>
+  The --report=Y option indicates that an HTML style report should be
+  generated listing the publications that were added. If this options is
+  not used then no report is generated.</p>
+  </li>
 </ol>
 <h3>Features of this Module:</h3>
 <ul>
 
-	<li>
-	<p><b>Add/Edit/Delete Publications</b>: Publications can be maually
-	added <?php  l('here', 'node/add/chado-pub') ?>. Once added,
-	publications can be modified or deleted by clicking the Edit tab at the
-	top of a publication page.</p>
-	</li>
+  <li>
+  <p><b>Add/Edit/Delete Publications</b>: Publications can be maually
+  added <?php  l('here', 'node/add/chado-pub') ?>. Once added,
+  publications can be modified or deleted by clicking the Edit tab at the
+  top of a publication page.</p>
+  </li>
 
-	<li>
-	<p><b>Publication Search Tool</b>: A <?php print l('search tool','find/publications') ?>
-	is provided for finding publications. Unlike most default search tools
-	for Tripal, this tool does not rely on Drupal Views</p>
-	</li>
+  <li>
+  <p><b>Publication Search Tool</b>: A <?php print l('search tool','find/publications') ?>
+  is provided for finding publications. Unlike most default search tools
+  for Tripal, this tool does not rely on Drupal Views</p>
+  </li>
 
-	<li>
-	<p><b>Bulk Import of Publications</b>: Site administrators can <?php print l('add a new publication importer', 'admin/tripal/tripal_pub/import/new') ?>
-	which provides a set of search terms for querying a remote publication
-	database (e.g. PubMed). Publications that matche the search terms can
-	be imported when the publication import cron command is executed. The
-	cron command can be executed using the Drush command: drush
-	tpubs-import. This drush command can be added as a system-wide cron (in
-	the same way the Tripal jobs cron is implemented) to be executed on a
-	periodic basis. This will allow the site to import publications which
-	have been newly added to remote databases and which are relative to the
-	site. Site administrators can <?php print l('see the list of importers', 'admin/tripal/tripal_pub/import_list') ?>
-	and edit, disable or delete the importers.</p>
-	</li>
+  <li>
+  <p><b>Bulk Import of Publications</b>: Site administrators can <?php print l('add a new publication importer', 'admin/tripal/tripal_pub/import/new') ?>
+  which provides a set of search terms for querying a remote publication
+  database (e.g. PubMed). Publications that matche the search terms can
+  be imported when the publication import cron command is executed. The
+  cron command can be executed using the Drush command: drush
+  tpubs-import. This drush command can be added as a system-wide cron (in
+  the same way the Tripal jobs cron is implemented) to be executed on a
+  periodic basis. This will allow the site to import publications which
+  have been newly added to remote databases and which are relative to the
+  site. Site administrators can <?php print l('see the list of importers', 'admin/tripal/tripal_pub/import_list') ?>
+  and edit, disable or delete the importers.</p>
+  </li>
 
 
 

+ 1 - 1
tripal_stock/theme/tripal_organism/tripal_organism_stocks.tpl.php

@@ -44,7 +44,7 @@ if (count($stocks) > 0) { ?>
           <td><?php
             $name = $stock->name;
             if (!$stock->name) {
-            	$name = $stock->uniquename;
+              $name = $stock->uniquename;
             }
             if ($stock->nid) {    
               print l($name, "node/$stock->nid", array('attributes' => array('target' => '_blank')));        

+ 24 - 24
tripal_views/tripal_views.views.inc

@@ -569,35 +569,35 @@ function tripal_views_views_data_alter(&$data) {
           //      without 1st needing to add relationship to organism table
           $base_field = $base_table . '_id';
           $data[$linker_table][$base_field] = array(
-			      'group' => $base_title,
-			      'title' => $base_title . 'Node',
-			      'help' => "Links $base_title to it's node.",
-			      'relationship' => array(
-			        'handler' => 'views_handler_relationship',
-			        'title' => t("$base_title => Node"),
-			        'label' => t("$base_title => Node"),
-			        'real field' => 'nid',
-			        'base' => 'node',
-			        'base field' => 'nid'
-			      ),
-			    );
+            'group' => $base_title,
+            'title' => $base_title . 'Node',
+            'help' => "Links $base_title to it's node.",
+            'relationship' => array(
+              'handler' => 'views_handler_relationship',
+              'title' => t("$base_title => Node"),
+              'label' => t("$base_title => Node"),
+              'real field' => 'nid',
+              'base' => 'node',
+              'base field' => 'nid'
+            ),
+          );
 
           // Add Chado fields to a node-based view
           // This will only be done with relationships
           $base_field = $base_table . '_id';
           $data['node'][$base_field] = array(
-			      'group' => $base_title,
-			      'title' => $base_title,
-			      'help' => "Links node to chado $base_title.",
-			      'relationship' => array(
-			        'handler' => 'views_handler_relationship',
-			        'title' => t("Node => $base_title"),
-			        'label' => t("Node => $base_title"),
-			        'real field' => 'nid',
-			        'base' => $linker_table,
-			        'base field' => 'nid'
-			      ),
-			    );
+            'group' => $base_title,
+            'title' => $base_title,
+            'help' => "Links node to chado $base_title.",
+            'relationship' => array(
+              'handler' => 'views_handler_relationship',
+              'title' => t("Node => $base_title"),
+              'label' => t("Node => $base_title"),
+              'real field' => 'nid',
+              'base' => $linker_table,
+              'base field' => 'nid'
+            ),
+          );
 
         }
       }