Browse Source

Added support for GBrowse linkouts

E.Cannon 9 years ago
parent
commit
22b400fd42
1 changed files with 15 additions and 2 deletions
  1. 15 2
      includes/blast_ui.node.inc

+ 15 - 2
includes/blast_ui.node.inc

@@ -180,6 +180,14 @@ function blastdb_form($node, &$form_state) {
     '#default_value' => (isset($node->linkout->db_id->db_id)) ? $node->linkout->db_id->db_id : 0
   );
 
+  $form['dbxref']['gbrowse_path']= array(
+    '#type' => 'textfield',
+    '#title' => t('Website URL path for the GBrowse track'),
+    '#description' => t('The website URL path for the GBrowse track corresponding to the database. For example, /gbrowse_aradu1.0, prefix with /'),
+  //  '#required' => TRUE,
+    '#default_value' => isset($node->gbrowse_path) ? $node->gbrowse_path : '',
+  );
+
   $types = module_invoke_all('blast_linkout_info');
   $options = array();
   foreach ($types as $machine_name => $details) {
@@ -250,6 +258,7 @@ function blastdb_insert($node) {
     'dbtype' => $node->db_dbtype,
     'dbxref_id_regex' => $regex,
     'dbxref_db_id' => $node->db_id,
+    'gbrowse_path' => $node->gbrowse_path,
     'dbxref_linkout_type' => $node->dbxref_linkout_type
   ))->execute();
 
@@ -284,6 +293,7 @@ function blastdb_update($node) {
     'path' => $node->db_path,
     'dbtype' => $node->db_dbtype,
     'dbxref_id_regex' => $regex,
+//eksc- linkout vs gbrowse
     'dbxref_db_id' => $node->db_id,
     'dbxref_linkout_type' => $node->dbxref_linkout_type
   ))->condition('nid', $node->nid)->execute();
@@ -291,10 +301,10 @@ function blastdb_update($node) {
 
 /**
  * Implements hook_node_update().
- * This	function acts on ALL NODES
+ * This  function acts on ALL NODES
  */
 function blast_ui_node_update($node) {
-  if ($node->type == 'blastdb')	{
+  if ($node->type == 'blastdb')  {
     $node->title = $node->db_name;
   }
 }
@@ -311,13 +321,16 @@ function blastdb_delete($node) {
  */
 function blastdb_load($nodes) {
 
+//eksc- linkout vs gbrowse
   $result = db_query('SELECT nid, name, path, dbtype, dbxref_id_regex, dbxref_db_id, dbxref_linkout_type FROM {blastdb} WHERE nid IN (:nids)', array(':nids' => array_keys($nodes)));
+  $result = db_query('SELECT nid, name, path, dbtype, dbxref_id_regex, dbxref_db_id, gbrowse_path FROM {blastdb} WHERE nid IN (:nids)', array(':nids' => array_keys($nodes)));
 
   foreach ($result as $record) {
     $nodes[$record->nid]->db_name = $record->name;
     $nodes[$record->nid]->db_path = $record->path;
     $nodes[$record->nid]->title = $record->name;
     $nodes[$record->nid]->db_dbtype = $record->dbtype;
+    $nodes[$record->nid]->gbrowse_path = $record->gbrowse_path;
 
     if ($record->dbxref_id_regex) {
       $nodes[$record->nid]->linkout = new stdClass();