Index: hosting.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/hosting/hosting.module,v
retrieving revision 1.74
diff -u -p -r1.74 hosting.module
--- hosting.module	29 Oct 2008 00:10:34 -0000	1.74
+++ hosting.module	31 Oct 2008 19:53:52 -0000
@@ -52,8 +52,15 @@ function hosting_menu($may_cache = true)
         ); 
       }
     }
-
-
+    
+    // Queue page & task lists
+    
+    $items[] = array(
+       'path' => 'hosting/queues',
+       'callback' => 'hosting_queues',
+       'type' => MENU_CALLBACK,
+       'access' => user_access('access task logs')
+      );
   }
   return $items;
 }
@@ -256,42 +263,46 @@ function hosting_block($op = 'list', $de
 }
 
 function hosting_queue_summary_block() {
-  $queues = hosting_get_queues();
-  $output = '';
-  foreach ($queues as $queue => $info) {
-    foreach (array('description' => t('Description'), 'frequency' => t('Frequency'), 'items' => t('Items per run'), 'total_items' => t('Items in queue'), 'last_run' => t('Last run')) as $key => $title) {
+  if (user_access('administer hosting queues')) {
+    $queues = hosting_get_queues();
+    $output = '';
+    foreach ($queues as $queue => $info) {
       # special case
       if (!$info['enabled']) {
         $disp[] = t('Status: disabled');
         continue;
       }
       $disp[] = t('Status: enabled');
-      if ($key == 'last_run') {
-        $info[$key] = hosting_format_interval($info[$key]);
-      } elseif ($key == 'frequency') {
-        $info[$key] = t('every @interval', array('@interval' => format_interval($info[$key])));
+      foreach (array('description' => t('Description'), 'frequency' => t('Frequency'), 'items' => t('Items per run'), 'total_items' => t('Items in queue'), 'last_run' => t('Last run')) as $key => $title) {
+        if ($key == 'last_run') {
+          $info[$key] = hosting_format_interval($info[$key]);
+        } elseif ($key == 'frequency') {
+          $info[$key] = t('every @interval', array('@interval' => format_interval($info[$key])));
+        }
+        $disp[] = $title . ": " . $info[$key]; 
       }
-      $disp[] = $title . ": " . $info[$key]; 
-    }
-    $output .= theme('item_list', $disp, $info['name']);
-    /* to print all stats of the queue... */
-    #$lambda = create_function('$k,$v', 'return "$k: $v";');
-    #$output .= theme('item_list', array_map($lambda, array_keys($info), $info), $info['name']);
+      $output .= theme('item_list', $disp, $info['name']);
+      /* to print all stats of the queue... */
+      #$lambda = create_function('$k,$v', 'return "$k: $v";');
+      #$output .= theme('item_list', array_map($lambda, array_keys($info), $info), $info['name']);
     
+    }
+    return $output;
   }
-  return $output;
 }
 
 function hosting_queue_block() {
-  $queues = hosting_get_queues();
-  $output = '';
-  foreach ($queues as $queue => $info) {
-    $func = 'hosting_'.$info['singular'].'_list';
-    if (function_exists($func)) {
-      $output .= $func();
+  if (user_access('access task logs')) {
+    $queues = hosting_get_queues();
+    $output = '';
+    foreach ($queues as $queue => $info) {
+      $func = 'hosting_'.$info['singular'].'_summary';
+      if (function_exists($func)) {
+        $output .= $func();
+      }
     }
+    return $output;
   }
-  return $output;
 }
 
 function hosting_summary_block() {
@@ -449,6 +460,34 @@ function _hosting_node_add($type = '') {
   return $output;
 }
 
+/**
+ * List queues or tasks in a queue if a key is provided
+ */
+
+function hosting_queues($key='') {
+  $queues = hosting_get_queues();
+
+  if ($queues[$key]) {
+    if ($queues[$key]['name'])
+    {
+      $output .= "<h1>".$queues[$key]['name']."</h1>";
+    }
+  
+    $func = 'hosting_'.$queues[$key]['singular'].'_list';
+    if (function_exists($func)) {
+      $output .= $func();
+    }
+  }
+  else
+  {
+    foreach($queues as $key => $queue) {
+      $item[] = l($queue['name'], 'hosting/queues/'.$key);
+    }
+    $output .= theme('item_list', $item, t('Queues'));
+  }
+  
+  return $output;
+}
 
 /**
  * Generate context sensitive breadcrumbs
Index: task/hosting_task.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/hosting/task/hosting_task.module,v
retrieving revision 1.34
diff -u -p -r1.34 hosting_task.module
--- task/hosting_task.module	30 Oct 2008 16:41:23 -0000	1.34
+++ task/hosting_task.module	31 Oct 2008 19:53:53 -0000
@@ -23,7 +23,6 @@ function hosting_task_menu($may_cache) {
             'type' => MENU_LOCAL_TASK,
             'weight' => ($task['weight']) ? $task['weight'] : 0, 
           );
-          
         }
      }
   }
@@ -480,6 +479,27 @@ function hosting_get_most_recent_task($r
   return false;
 }
 
+/**
+ * Retrieve tasks with specified criterias
+ */
+
+function hosting_get_tasks($filter_by = null, $filter_value = null, $element = 0) {
+  $node = array();
+  $args[] = 'task';
+  $cond = '';
+
+  if ($filter_by && $filter_value) {
+    $cond = ' AND t.' . $filter_by . ' = %d';
+    $args[] = $filter_value;
+  }
+  $result = pager_query(db_rewrite_sql("SELECT *, t.task_status FROM {node} n left join {hosting_task} t on n.vid=t.vid where type='%s'" . $cond . " ORDER BY n.nid DESC"), 5, $element, NULL, $args);
+  
+  while ($row = db_fetch_object($result)) {
+    $nodes[] = $row;
+  }
+  
+  return $nodes;
+}
 
 /**
  * Turn bitmask integer error code into associative array
@@ -525,45 +545,13 @@ function hosting_task_status_output($fil
 /**
  * Display list of tasks
  */
+ 
 function hosting_task_list($filter_by = null, $filter_value = null) {
-  $args[] = 'task';
-  $cond = '';
-
-  if ($filter_by && $filter_value) {
-    $cond = ' AND t.' . $filter_by . ' = %d';
-    $args[] = $filter_value;
-  }
-  $result = pager_query(db_rewrite_sql("SELECT *, t.task_status FROM {node} n left join {hosting_task} t on n.vid=t.vid where type='%s'" . $cond . " ORDER BY n.nid DESC"), 5, 0, NULL, $args);
-
-  if (!db_num_rows($result)) {
-    return t('No tasks available');
-  }
-  $header = array(t('Task'), t('Created'));
-
-  if (user_access('retry failed tasks')) {
-    $header[] = t('Actions');
-
-  }
-  $rows = array();
-  while ($node = db_fetch_object($result)) {
-    $row = array();
-    $row['type'] = array('data' => l(drupal_ucfirst($node->task_type), 'node/' . $node->nid), 'class' => 'hosting-status');
-    $row['created'] = t("@interval ago", array('@interval' => format_interval(mktime() - $node->created, 1)));
-
-    $in_queue = _hosting_task_in_queue($node->nid); 
-    if (user_access('retry failed tasks')) {
-      if (!in_array($node->task_status, array(PROVISION_QUEUED, PROVISION_SUCCESS)) && !$in_queue) {
-        $row['actions'] = array('data' => drupal_get_form('hosting_task_retry_form', $node->nid), 'class' => 'hosting-task-retry');
-      }
-      else {
-        $row['actions'] = '';
-      }
-    } 
-    $rows[] = array('data' => $row, 'class' => _hosting_task_list_class($node->task_status));
-  }
+  return theme("hosting_task_list", hosting_get_tasks($filter_by, $filter_value));
+}
   
-  return theme('table', $header, $rows, array('class' => 'hosting-table')) . theme('pager', NULL, 5, 0);
-
+function hosting_task_summary($filter_by = null, $filter_value = null) {
+  return theme("hosting_task_summary", hosting_get_tasks($filter_by, $filter_value,1));
 }
 
 function _hosting_task_list_class($status) {
@@ -575,3 +563,55 @@ function _hosting_task_list_class($statu
   }
   return 'hosting-error';
 }
+
+/**
+ * Theme functions
+ */
+ 
+function theme_hosting_task_list($nodes) {
+ if (!$nodes) {
+   return t('No tasks available');
+ }
+ else {
+   $header = array(t('Task'), t('Created'));
+
+   if (user_access('retry failed tasks')) {
+     $header[] = t('Actions');
+
+   }
+   
+   foreach ($nodes as $node) {
+     $row = array();
+     $row['type'] = array('data' => l(drupal_ucfirst($node->task_type), 'node/' . $node->nid), 'class' => 'hosting-status');
+     $row['created'] = t("@interval ago", array('@interval' => format_interval(mktime() - $node->created, 1)));
+
+     $in_queue = _hosting_task_in_queue($node->nid); 
+     if (user_access('retry failed tasks')) {
+       if (!in_array($node->task_status, array(PROVISION_QUEUED, PROVISION_SUCCESS)) && !$in_queue) {
+         $row['actions'] = array('data' => drupal_get_form('hosting_task_retry_form', $node->nid), 'class' => 'hosting-task-retry');
+       }
+       else {
+         $row['actions'] = '';
+       }
+     } 
+     $rows[] = array('data' => $row, 'class' => _hosting_task_list_class($node->task_status));
+   }
+   
+  return theme('table', $header, $rows, array('class' => 'hosting-table')) . theme('pager', NULL, 5, 0); 
+ }
+}
+ 
+function theme_hosting_task_summary($nodes) {
+ if (!$nodes) {
+   return t('No tasks available');
+ }
+ else {
+     foreach ($nodes as $node) {
+       $row = array();
+       $row['type'] = array('data' => l(drupal_ucfirst($node->title), 'node/' . $node->nid), 'class' => 'hosting-status');
+       $rows[] = array('data' => $row, 'class' => _hosting_task_list_class($node->task_status));
+     }
+   
+   return theme('table', array(t('Task')), $rows, array('class' => 'hosting-table')).l(t('Read more'),'hosting/queues/tasks'); 
+ }
+}
\ No newline at end of file
