Przeglądaj źródła

Just checking in progress on Tripal pub module.

spficklin 12 lat temu
rodzic
commit
7eb8154d11

+ 6 - 6
tripal_core/api/tripal_core_misc.api.inc

@@ -14,25 +14,25 @@
  *  callback function should have three arguments: first, an array of values
  *  passed into the tripal_pager_callback; second, the start index of
  *  the paged values; third, the number of records to include.
- * @param cfunc
- *  The name of the callback function used to specify the total results. The
- *  callback f unction should receive one argument: an array of values that
- *  are passed into the tripal_pager_callbck function. 
  * @param limit
  *  The number of records to include in the paged results
  * @param element
  *  A unique integer ID if more than one pager exists on a page.  if multiple
  *  types of pagers (e.g. pager_query, chado_pager_query) are on the same
  *  page then this parameter should be unique amongst them all.
+ * @param cfunc
+ *  The name of the callback function used to specify the total results. The
+ *  callback f unction should receive one argument: an array of values that
+ *  are passed into the tripal_pager_callbck function. 
  */
-function tripal_pager_callback($func, $cfunc, $limit = 9, $element = 0) {
+function tripal_pager_callback($func, $limit = 9, $element = 0, $cfunc) {
   
   global $pager_page_array, $pager_total, $pager_total_items;
   $page = isset($_GET['page']) ? $_GET['page'] : '';
   
   // Substitute in query arguments.
   $args = func_get_args();
-  $args = array_slice($args, 3);
+  $args = array_slice($args, 4);
   // Alternative syntax for '...'
   if (isset($args[0]) && is_array($args[0])) {
     $args = $args[0];

+ 131 - 70
tripal_pub/includes/pubmed.inc

@@ -10,26 +10,25 @@
 /**
  *
  */
-function tripal_pub_remote_search_pubmed($terms_str, $num_to_retrieve, $pager_id) {
-
+function tripal_pub_remote_search_pubmed($search_array, $num_to_retrieve, $pager_id) {
+  
   // convert the terms list provicded by the caller into a string with words
   // separated by a '+' symbol.
-  $search_terms = implode("+", preg_split('/\s+/', trim($terms_str)));
+  $terms = '';
+  if ($search_array['search_terms']) {
+    $terms = '(' . implode("+", preg_split('/\s+/', trim($search_array['search_terms']))) . '[Title/Abstract]) AND ';
+  }
+  if ($search_array['author']) {
+    $terms = "(" . $search_array . "[Author]) AND ";
+  }
+  $terms = substr($terms, 0, -4);
+  
+  $search_array['limit'] = $num_to_retrieve;
 
   // we want to get the list of pubs using the search terms but using a Drupal style pager
-  $pubs = tripal_pager_callback('tripal_pub_remote_search_pubmed_range',
-    'tripal_pub_remote_search_pubmed_count', $num_to_retrieve, $pager_id, $search_terms);
-  
-  if ($pubs) {
-    foreach ($pubs as $pub) {
-      /*
-      $pmid = $output[$i];
-  
-      //aquiring the pubmed id from the pub table based on the uniquename
-      $values = array( 'uniquename' => $pmid);
-      $pubmed_id = tripal_core_chado_select('pub', array('pub_id'), $values); */
-    }
-  }
+  $pubs = tripal_pager_callback('tripal_pub_remote_search_pubmed_range',  
+    $num_to_retrieve, $pager_id, 'tripal_pub_remote_search_pubmed_count', $search_array);
+ 
   return $pubs;
 }
 
@@ -38,15 +37,18 @@ function tripal_pub_remote_search_pubmed($terms_str, $num_to_retrieve, $pager_id
  * tripal_pager_callback function.  This function returns a count of
  * the dataset to be paged.
  */
-function tripal_pub_remote_search_pubmed_count($terms) {
+function tripal_pub_remote_search_pubmed_count($search_array) {
+  $terms = $search_array['search_terms'];
+  $days = $search_array['days'];
+  $limit = $search_array['limit'];
+  
+  $results = tripal_pub_remote_search_pubmed_search_init($terms, $limit, $days);
+  $_SESSION['tripal_pub_pubmed_query'][$terms]['Count'] = $results['Count'];
+  $_SESSION['tripal_pub_pubmed_query'][$terms]['WebEnv'] = $results['WebEnv'];
+  $_SESSION['tripal_pub_pubmed_query'][$terms]['QueryKey'] = $results['QueryKey'];
+  
+  return $results['Count'];
 
-  // do a quick query using the provided terms, set the session variables
-  // so we can reuse this query and then return the total number of records.
-  $results = tripal_pub_remote_search_pubmed_query($terms);
-  $_SESSION['tripal_pub_pubmed_query']['WebEnv'] = $results['WebEnv'];
-  $_SESSION['tripal_pub_pubmed_query']['QueryKey'] = $results['QueryKey'];
-    
-  return $total_records;
 }
 
 /*
@@ -54,44 +56,53 @@ function tripal_pub_remote_search_pubmed_count($terms) {
  * tripal_pager_callback function.  This function returns the results
  * within the specified range
  */
-function tripal_pub_remote_search_pubmed_range($terms, $start = 0, $limit = 10) {
-
+function tripal_pub_remote_search_pubmed_range($search_array, $start = 0, $limit = 10) {
+  $terms = $search_array['search_terms'];
+  $days = $search_array['days'];
+  $limit = $search_array['limit'];
+  
   // get the query_key and the web_env from the previous count query.
-  $query_key = $_SESSION['tripal_pub_pubmed_query']['QueryKey'];
-  $web_env = $_SESSION['tripal_pub_pubmed_query']['WebEnv'];
-     
-  // repeat the search performed previously (using WebEnv & QueryKey) to retrieve
-  // the PMID's within the range specied.  The PMIDs will be returned as a text list
-  $pmids_txt = tripal_pub_remote_search_pubmed_fetch($terms, $query_key, $web_env, 'uilist', 'text', $start, $limit);  
+  $query_key = $_SESSION['tripal_pub_pubmed_query'][$terms]['QueryKey'];
+  $web_env = $_SESSION['tripal_pub_pubmed_query'][$terms]['WebEnv'];
+  
+  // if this function has been called without calling the count function
+  // then we need to do the query.
+  if (!$query_key) {
+    $results = tripal_pub_remote_search_pubmed_search_init($terms, $limit, $days);
+    $_SESSION['tripal_pub_pubmed_query']['WebEnv'] = $results['WebEnv'];
+    $_SESSION['tripal_pub_pubmed_query']['QueryKey'] = $results['QueryKey']; 
+    $query_key =  $results['QueryKey'];
+    $web_env = $results['WebEnv'];
+  }
+
+  // now get the list of PMIDs from the previous search
+  $pmids_txt = tripal_pub_remote_search_pubmed_fetch($query_key, $web_env, 'uilist', 'text', $start, $limit);  
   
   // iterate through each PMID and get the publication record. This requires a new search and new fetch
   $pmids = explode("\n", trim($pmids_txt));
   $pubs = array();
   foreach ($pmids as $pmid) {
-    
-    // first intialize the search for a single PMID. This will give us a new query key and Web env 
-    $term = $pmid . "[uid]";    
-    $query = tripal_pub_remote_search_pubmed_query($terms); 
-    
-    // second retrieve the individual record
-    $pub_xml = tripal_pub_remote_search_pubmed_fetch($terms, $query['QueryKey'], $query['WebEnv'], 'null', 'xml', 0, 1);
+    // now retrieve the individual record
+    $pub_xml = tripal_pub_remote_search_pubmed_fetch($query_key, $web_env, 'null', 'xml', 0, 1, array('id' => $pmid));
     $pub = tripal_pub_remote_search_pubmed_parse_pubxml($pub_xml);
     $pubs[] = $pub;    
-    
   } 
-  dpm($pubs);
   return $pubs;
 }
 
 /*
  * 
  */
-function tripal_pub_remote_search_pubmed_query($terms){
+function tripal_pub_remote_search_pubmed_search_init($terms, $retmax, $days = 0){
    
   // do a search for a single result so that we can establish a history, and get
   // the number of records. Once we have the number of records we can retrieve
   // those requested in the range.
-  $query_url = "http://www.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=Pubmed&retmax=1&usehistory=y&term=$terms";
+  $query_url = "http://www.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=Pubmed&retmax=$retmax&usehistory=y&term=$terms";
+  if($days) {
+    $query_url .= "&reldate=$days&datetype=edat";
+  }
+  //dpm($query_url);
   $rfh = fopen($query_url, "r");
   if (!$rfh) {
     drupal_set_message('Could not perform Pubmed query. Cannot connect to Entrez.', 'error');
@@ -104,25 +115,34 @@ function tripal_pub_remote_search_pubmed_query($terms){
     $query_xml .= fread($rfh, 255);
   }
   fclose($rfh);
+  //dpm("<pre>$query_xml</pre>");
   $xml = new XMLReader();
   $xml->xml($query_xml);
   
   // iterate though the child nodes of the <eSearchResult> tag and get the count, history and query_id
   $result = array();
   while ($xml->read()) {
+    $element = $xml->name;
+  
+    if ($xml->nodeType == XMLReader::END_ELEMENT and $element == 'WebEnv') {
+      // we've read as much as we need. If we go too much further our counts 
+      // will get messed up by other 'Count' elements.  so we're done.
+      break;
+    }
     if ($xml->nodeType == XMLReader::ELEMENT) {
-      $element = $xml->name;
-      $xml->read();
-      $value = $xml->value;
+      
       switch ($element) {
         case 'Count':
-          $result['Count'] = $value;
+          $xml->read();
+          $result['Count'] = $xml->value;
           break;        
         case 'WebEnv':
-          $result['WebEnv'] = $value;
+          $xml->read();
+          $result['WebEnv'] = $xml->value;
           break;
         case 'QueryKey':
-          $result['QueryKey'] = $value;
+          $xml->read();
+          $result['QueryKey'] = $xml->value;
           break;
       }
     }
@@ -133,18 +153,38 @@ function tripal_pub_remote_search_pubmed_query($terms){
 /*
  * 
  */
-function tripal_pub_remote_search_pubmed_fetch($terms, $query_key, $web_env, $rettype = 'null', 
-  $retmod = 'null', $start = 0, $limit = 10){
-  
+function tripal_pub_remote_search_pubmed_fetch($query_key, $web_env, $rettype = 'null', 
+  $retmod = 'null', $start = 0, $limit = 10, $args = array()){
+
   // repeat the search performed previously (using WebEnv & QueryKey) to retrieve
   // the PMID's within the range specied.  The PMIDs will be returned as a text list
   $fetch_url = "http://www.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?rettype=$rettype&retmode=$retmod&retstart=$start&retmax=$limit&db=Pubmed&query_key=$query_key&WebEnv=$web_env";
+  //dpm($fetch_url);
+  foreach ($args as $key => $value) {
+    if(is_array($value)) {
+      $fetch_url .= "&$key=";
+      foreach ($value as $item) {
+        $fetch_url .= "$item,";
+      }
+      $fetch_url = substr($fetch_url, 0, -1); // remove trailing comma  
+    }
+    else {
+      $fetch_url .= "&$key=$value";
+    }
+  }
+  
   $rfh = fopen($fetch_url, "r");
+  if (!$rfh) {
+    drupal_set_message('Could not perform Pubmed query. Cannot connect to Entrez.', 'error');
+    return '';    
+  }
   $results = '';
-  while (!feof($rfh)) {
-    $results .= fread($rfh, 255);
-  }  
-  fclose($rfh);
+  if($rfh) {
+    while (!feof($rfh)) {
+      $results .= fread($rfh, 255);
+    }  
+    fclose($rfh);
+  }
   
   return $results;
 }
@@ -164,6 +204,10 @@ function tripal_pub_remote_search_pubmed_fetch($terms, $query_key, $web_env, $re
 function tripal_pub_remote_search_pubmed_parse_pubxml($pub_xml) {
   $pub = array();
   
+  if (!$pub_xml) {
+    return $pub;
+  }
+  
   // read the XML and iterate through it.
   $xml = new XMLReader();
   $xml->xml($pub_xml);
@@ -232,7 +276,24 @@ function tripal_pub_remote_search_pubmed_parse_pubxml($pub_xml) {
       }
     }
   }
+  $pub['citation'] = $pub['author_list'] . 
+    '. <a href="http://www.ncbi.nlm.nih.gov/pubmed/' . $pub['pub_accession'] . '" target="_blank">' . $pub['title'] .  '</a> ' .
+    $pub['journal_iso_abbreviation']. '. ' . $pub['publication_date'];
+  if ($pub['volume'] or $pub['issue']) {
+    $pub['citation'] .= '; ';  
+  }
+  if ($pub['volume']) {
+    $pub['citation'] .= $pub['volume'];
+  }
+  if ($pub['issue']) {
+    $pub['citation'] .= '(' . $pub['issue'] . ')';
+  }
+  if ($pub['pages']) {
+    $pub['citation'] .= ':' . $pub['pages'];
+  }
+  $pub['citation'] .= '. PubMed PMID: ' . $pub['pub_accession']; 
   
+  $pub['xml'] = $pub_xml;
   return $pub;
 }
 
@@ -369,7 +430,7 @@ function tripal_pub_remote_search_pubmed_parse_publication_type($xml, &$pub) {
     $element = $xml->name;    
       
     if ($xml->nodeType == XMLReader::END_ELEMENT and $element == 'PublicationTypeList') {
-      // we've reached the </Pagination> element so we're done.
+      // we've reached the </PublicationTypeList> element so we're done.
       return;
     }
     if ($xml->nodeType == XMLReader::ELEMENT) {
@@ -439,7 +500,9 @@ function tripal_pub_remote_search_pubmed_parse_pagination($xml, &$pub) {
       switch ($element) {
         case 'MedlinePgn':  
           $xml->read();
-          $pub['pages'] = $xml->value;
+          if(trim($xml->value)) {
+            $pub['pages'] = $xml->value;
+          }
           break;          
         default:
           break;
@@ -455,11 +518,8 @@ function tripal_pub_remote_search_pubmed_parse_journal($xml, &$pub) {
   while ($xml->read()) {
     $element = $xml->name;
       
-    if ($xml->nodeType == XMLReader::END_ELEMENT){
-      // if we're at the </AuthorList> element then we're done with the article...
-      if($element == 'Journal') {
-        return;
-      }
+    if ($xml->nodeType == XMLReader::END_ELEMENT and $element == 'Journal') {
+      return;
     }
     if ($xml->nodeType == XMLReader::ELEMENT) {
       switch ($element) {
@@ -477,7 +537,7 @@ function tripal_pub_remote_search_pubmed_parse_journal($xml, &$pub) {
           break;
         case 'JournalIssue':   
           // valid values of cited_medium are 'Internet' and 'Print'
-          $cited_medium = $xml->getAttribute('CitedMedium');          
+          $cited_medium = $xml->getAttribute('CitedMedium');                    
           tripal_pub_remote_search_pubmed_parse_journal_issue($xml, $pub);       
           break;        
         case 'Title': 
@@ -502,7 +562,7 @@ function tripal_pub_remote_search_pubmed_parse_journal_issue($xml, &$pub) {
   while ($xml->read()) {
     $element = $xml->name;
       
-    if ($xml->nodeType == XMLReader::END_ELEMENT and $element = 'JournalIssue'){
+    if ($xml->nodeType == XMLReader::END_ELEMENT and $element == 'JournalIssue'){
       // if we're at the </JournalIssue> element then we're done 
       return;
     }
@@ -510,7 +570,7 @@ function tripal_pub_remote_search_pubmed_parse_journal_issue($xml, &$pub) {
       switch ($element) {
         case 'Volume': 
           $xml->read();
-          $pub['volumn'] = $xml->value;         
+          $pub['volume'] = $xml->value;         
           break;
         case 'Issue':
           $xml->read();
@@ -521,8 +581,9 @@ function tripal_pub_remote_search_pubmed_parse_journal_issue($xml, &$pub) {
           $year = $date['year'];
           $month = $date['month'];
           $day = $date['day']; 
-          $medline = $date['medline']; 
-            
+          $medline = $date['medline'];
+           
+          $pub['year'] = $year;            
           if ($month and $day and $year) {
             $pub['publication_date'] = "$year $month $day";
           }
@@ -536,7 +597,7 @@ function tripal_pub_remote_search_pubmed_parse_journal_issue($xml, &$pub) {
             $pub['publication_date'] = $medline;
           }
           else {
-            $pub['publication_date'] = "Unknown";
+            $pub['publication_date'] = "Date Unknown";
           }             
           break;
         default:
@@ -555,7 +616,7 @@ function tripal_pub_remote_search_pubmed_parse_date ($xml, $element_name) {
   while ($xml->read()) {
     $element = $xml->name;
       
-    if ($xml->nodeType == XMLReader::END_ELEMENT and $element = $element_name){
+    if ($xml->nodeType == XMLReader::END_ELEMENT and $element == $element_name){
       // if we're at the </$element_name> then we're done 
       return $date;
     }

+ 122 - 39
tripal_pub/includes/remote_search.inc

@@ -2,43 +2,21 @@
 /*
  * 
  */
-function tripal_pub_remote_search_page() {
-  global $pager_total;
-  
-  // generate the search form 
-  $form = drupal_get_form('tripal_pub_remote_search_form');
-
-  // retrieve any results
-  $remote_db = $_SESSION['tripal_pub_search_criteria']['remote_db'];
-  $search_terms = $_SESSION['tripal_pub_search_criteria']['search_terms'];  
-  $results = tripal_pub_get_remote_search_results($remote_db, $search_terms, 10, 0);
-  
-  // iterate through the results and construct the table displaying the publications
-  if (count($results) > 0) {
-  
-  }
-  
-  // generate the pager
-  $total_items = $pager_total[0];
-  $pager = theme('pager');
-  
-  // join all to form the final page
-  $output = $form . "<p><b>Found " . number_format($total_items) . " Results</b></br>" . $table . '</p>' . $pager;    
-  
-  return $output;
-}
-/*
- * 
- */
-function tripal_pub_get_remote_search_results($remote_db, $search_terms, $num_to_retrieve, $pager_id) {
- 
-  $results = array();
-  $callback = 'tripal_pub_remote_search_' . strtolower($remote_db);
-  if (function_exists($callback) and $search_terms) {
-    $results = call_user_func($callback, $search_terms, $num_to_retrieve, $pager_id);
-  }    
-  
-  return $results;  
+function theme_tripal_pub_remote_search_form($form) {
+  $rows = array(
+    array(            
+      drupal_render($form['scope']),
+      drupal_render($form['operation']),
+      drupal_render($form['search_terms']),
+    ),
+  );
+  $headers = array('Search Terms', 'Scope', 'Operation');
+  $form['criteria'] = array(
+    '#type' => 'markup',
+    '#value' =>  theme('table', $headers, $rows),
+    '#weight' => -10,
+  );
+  return drupal_render($form);
 }
 /**
  * Purpose: Provides the form to search pubmed
@@ -48,6 +26,9 @@ function tripal_pub_get_remote_search_results($remote_db, $search_terms, $num_to
 function tripal_pub_remote_search_form(&$form_state = NULL) {
   $remote_db = $_SESSION['tripal_pub_search_criteria']['remote_db'];
   $search_terms = $_SESSION['tripal_pub_search_criteria']['search_terms'];
+  $days = $_SESSION['tripal_pub_search_criteria']['days'];
+  $scope = $_SESSION['tripal_pub_search_criteria']['scope'];
+  $operation = $_SESSION['tripal_pub_search_criteria']['operation'];
   
   $remote_dbs = array('Pubmed' => 'Pubmed');
   $form['remote_db'] = array(
@@ -59,11 +40,32 @@ function tripal_pub_remote_search_form(&$form_state = NULL) {
 
   $form['search_terms']= array(
     '#type'          => 'textfield',
-    '#title'         => t('Search Terms'),
-    '#description'   => t('Please provide a list of words, separated by spaces for searching'),
+    '#description'   => t('Please provide a list of words, separated by spaces for searching.'),
     '#default_value' => $search_terms,
   );
+  $form['scope']= array(
+    '#type'          => 'select',
+    '#description'   => t('Please select the fields to search for this term.'),
+    '#options'       => array('title'    => 'Title',
+                              'abstract' => 'Title/Abstract',
+                              'author'   => 'Author'),
+    '#default_value' => $scope,
+  );
+  $form['operation']= array(
+    '#type'          => 'select',
+    '#options'       => array('AND' => 'AND',
+                              'OR'  => 'OR',
+                              'NOT' => 'NOT'),
+    '#default_value' => $operation,
+  );
 
+  $form['days']= array(
+    '#type'          => 'textfield',
+    '#title'         => t('Number of Days'),
+    '#description'   => t('Please provide the number of days to limit your search.  For example, to search only the last 60 days, enter the number 60 in the field.'),
+    '#default_value' => $days,
+  );
+  
   $form['submit'] = array(
     '#type'         => 'submit',
     '#value'        => t('Submit'),
@@ -79,14 +81,25 @@ function tripal_pub_remote_search_form(&$form_state = NULL) {
 function tripal_pub_remote_search_form_validate($form, &$form_state) {
   $remote_db =  $form_state['values']['remote_db'];
   $search_terms =  $form_state['values']['search_terms'];
+  $scope =  $form_state['values']['scope'];
+  $operation =  $form_state['values']['operation'];
+  $days =  $form_state['values']['days'];
+  
+  if ($days and !is_numeric($days) or preg_match('/\./', $days)) {
+    form_set_error('days', "Please enter a numeric, non decimal value, for the number of days.");
+  }
 }
 
 /**
  *
  */
 function tripal_pub_remote_search_form_submit($form, &$form_state) {
+  
   $remote_db =  $form_state['values']['remote_db'];
   $search_terms =  $form_state['values']['search_terms'];
+  $scope =  $form_state['values']['scope'];
+  $operation =  $form_state['values']['operation'];
+  $days =  $form_state['values']['days'];
   
   // store the search settings in a session variable. Then when the page
   // is refreshed these values will be available for the page to 
@@ -99,6 +112,76 @@ function tripal_pub_remote_search_form_submit($form, &$form_state) {
     $_SESSION['tripal_pub_search_criteria'] = array(
       'remote_db' => $remote_db,
       'search_terms' => $search_terms,
+      'scope' => $scope,
+      'operation' => $operation,
+      'days' => $days
     );
   }  
 }
+/*
+ * 
+ */
+function tripal_pub_remote_search_page() {
+  global $pager_total, $pager_total_items;
+  
+  $pager_id = 0;
+  $limit = 10;
+  
+  // generate the search form 
+  $form = drupal_get_form('tripal_pub_remote_search_form');
+
+  // retrieve any results
+  $remote_db = $_SESSION['tripal_pub_search_criteria']['remote_db'];
+  
+  $search_array['search_terms'] = $_SESSION['tripal_pub_search_criteria']['search_terms'];
+  $search_array['days'] = $_SESSION['tripal_pub_search_criteria']['days'];  
+  $search_array['scope'] = $_SESSION['tripal_pub_search_criteria']['scope'];  
+  $search_array['operation'] = $_SESSION['tripal_pub_search_criteria']['operation'];
+    
+  // get the list of publications from the remote database using the search criteria.
+  $pubs = tripal_pub_get_remote_search_results($remote_db, $search_array, $limit, $pager_id);
+
+  // generate the pager
+  $total_pages = $pager_total[$pager_id];
+  $total_items = $pager_total_items[$pager_id];
+  $page = isset($_GET['page']) ? $_GET['page'] : '0';
+  $pager = theme('pager');
+  
+  // iterate through the results and construct the table displaying the publications
+  $rows = array();
+  $i = $page * $limit + 1;
+  if (count($pubs) > 0) {
+    foreach ($pubs as $pub) {
+      $rows[] = array(number_format($i), $pub['citation']);
+      $i++;
+    }
+  }
+  $headers = array('', 'Citation');
+  $table = theme('table', $headers, $rows);
+  
+
+  
+  // join all to form the final page
+  $output = $form . "<p><b>Found " . number_format($total_items) .  
+    ". Page " . ($page + 1) . " of $total_pages. " .
+    " Results</b></br>" . $table . '</p>' . $pager;    
+  
+  return $output;
+}
+/*
+ * 
+ */
+function tripal_pub_get_remote_search_results($remote_db, $search_array, $num_to_retrieve, $pager_id) {
+   
+  // construct the callback function using the remote database name
+  $callback = 'tripal_pub_remote_search_' . strtolower($remote_db);
+   
+  // now call the callback function to get the rsults
+  $pubs = array();
+  if (function_exists($callback)) {
+    $pubs = call_user_func($callback, $search_array, $num_to_retrieve, $pager_id);
+  }    
+  
+  return $pubs;  
+}
+

+ 18 - 16
tripal_pub/tripal_pub.module

@@ -7,10 +7,6 @@ require_once "includes/remote_search.inc";
 
 /**
  * @file
- * This file contains all the functions which provide functionality to this module.
- * This module was developed by Chad N.A. Krilow and Lacey-Anne Sanderson,
- * The University of Saskatchewan.
- *
  *
  * The Tripal Publication module allows you to search the PubMed databse for academic articles,
  * that relate to user specified tpoic\s. As well, it allows management of publications so that
@@ -62,16 +58,24 @@ function tripal_pub_menu() {
     'access arguments' => array('administer tripal pubs'),
     'type' => MENU_NORMAL_ITEM
   );
-
+ 
   $items['admin/tripal/tripal_pub/configuration'] = array(
     'title' => 'Configuration',
     'description' => 'Configuration for this module',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('tripal_pub_configuration_form'),
     'access arguments' => array('administer tripal pubs'),
-    'type' => MENU_NORMAL_ITEM
-    );
+    'type' => MENU_NORMAL_ITEM  
+  );
 
+  $items['admin/tripal/tripal_pub/import_setup'] = array(
+    'title' => t('Publication Finder'),
+    'description' => t('Finds publications using remote publication databases (e.g. PubMed).'),
+    'page callback' => 'tripal_pub_remote_search_page',
+    'access arguments' => array('access content'),
+    'type ' => MENU_CALLBACK,
+  );
+  
   // Automatically generate checkboxes.
   $items['node/add/tripal_pub/ahah_authors'] = array(
     'title' => 'Add Additional Authors',
@@ -88,14 +92,6 @@ function tripal_pub_menu() {
     'access arguments' => array('access content'),
     'type ' => MENU_CALLBACK,
   );
-  
-  $items['pub_finder'] = array(
-    'title' => t('Publication Finder'),
-    'description' => t('Finds publications using remote publication databases (e.g. PubMed).'),
-    'page callback' => 'tripal_pub_remote_search_page',
-    'access arguments' => array('access content'),
-    'type ' => MENU_CALLBACK,
-  );
 
   return $items;
 }
@@ -118,7 +114,13 @@ function tripal_pub_theme() {
     'publication_author' => array(
       'arguments' => array('element' => NULL)
     ),
-   'tripal_pub_admin' => array(
+    'publication_author' => array(
+      'arguments' => array('element' => NULL)
+    ),
+    'tripal_pub_remote_search_form' => array(
+       'arguments' => array('form'),
+    ),
+    'tripal_pub_admin' => array(
       'template' => 'tripal_pub_admin',  
       'arguments' =>  array(NULL),  
       'path' => drupal_get_path('module', 'tripal_pub') . '/theme'