Browse Source

Added pager to bulk loader jobs listing

Lacey Sanderson 12 years ago
parent
commit
dd392f84fc

+ 4 - 1
tripal_bulk_loader/tripal_bulk_loader.admin.inc

@@ -80,12 +80,13 @@ function tripal_bulk_loader_admin_manage_templates() {
  */
 function tripal_bulk_loader_admin_jobs() {
   $output = '';
+  $num_jobs_per_page = 50;
 
   $output .= '<p>' . t('Jobs are not automatically submitted to the tripal jobs management system when they are first created. Any jobs listed below with a status of "Initialized" will not have a Job ID until you go to the bulk loader page and submit the job.') . '</p>';
 
   $header = array('Job ID', 'Name','Template','Status');
   $rows = array();
-  $resource = db_query("SELECT n.*, t.name as template_name FROM tripal_bulk_loader n LEFT JOIN tripal_bulk_loader_template t ON cast(n.template_id as integer)=t.template_id ORDER BY n.job_id DESC");
+  $resource = pager_query("SELECT n.*, t.name as template_name FROM tripal_bulk_loader n LEFT JOIN tripal_bulk_loader_template t ON cast(n.template_id as integer)=t.template_id ORDER BY n.job_id DESC", $num_jobs_per_page);
   while ($n = db_fetch_object($resource)) {
     $rows[] = array(
       l($n->job_id, 'admin/tripal/tripal_jobs/view/' . $n->job_id),
@@ -96,6 +97,8 @@ function tripal_bulk_loader_admin_jobs() {
   }
   $output .= theme_table($header, $rows);
 
+  $output .= theme('pager');
+
   return $output;
 }
 

+ 1 - 30
tripal_bulk_loader/tripal_bulk_loader.module

@@ -226,35 +226,6 @@ function tripal_bulk_loader_perm() {
   );
 }
 
-/**
- * Creates a listing page for all bulk loading jobs
- */
-function tripal_bulk_loader_list() {
-  $num_results_per_page = 50;
-  $output = '';
-
-  $header = array('', 'Status', 'Loader', 'File');
-  $rows = array();
-
-  $query = 'SELECT * FROM {tripal_bulk_loader} l '
-    .'LEFT JOIN {node} n ON n.nid = l.nid '
-    .'LEFT JOIN {tripal_bulk_loader_template} t ON t.template_id = cast(l.template_id as integer)';
-  $resource = pager_query($query, $num_results_per_page, 0, NULL);
-  while ($r = db_fetch_object($resource)) {
-    $row = array(
-      l($r->title, 'node/' . $r->nid),
-      $r->job_status,
-      $r->name,
-      $r->file
-    );
-    $rows[] = $row;
-  }
-
-  $output .= theme('table', $header, $rows);
-  return $output;
-
-}
-
 //////////////////////////////////////////////////////////////////////////////////////////////
 // Node Functions
 //////////////////////////////////////////////////////////////////////////////////////////////
@@ -330,7 +301,7 @@ function tripal_bulk_loader_form($node, $form_state) {
   $form['loader']['file']= array(
     '#type'          => 'textfield',
     '#title'         => t('Data File'),
-    '#description'   => t('Please specify the data file to be loaded.'),
+    '#description'   => t('Please specify the data file to be loaded. This must be a tab-delimited text file with UNIX line endings.'),
     '#weight'        => -8,
     '#default_value' => $node->file
   );