Index: uts.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uts/uts.pages.inc,v
retrieving revision 1.33
diff -u -r1.33 uts.pages.inc
--- uts.pages.inc	13 Oct 2008 01:27:35 -0000	1.33
+++ uts.pages.inc	27 Dec 2008 05:12:55 -0000
@@ -304,7 +304,7 @@
 
 /**
  * Dashboard displayed on admin/uts as the main landing page. If no studies
- * displays instructional video(s) otherwise summary view.
+ * displays instructional video(s), otherwise summary view.
  *
  * @return string HTML output.
  */
@@ -312,23 +312,115 @@
   drupal_add_css(drupal_get_path('module', 'uts') . '/uts.css', 'module');
   $studies = uts_studies_load();
 
-  $output = '';
+  $out = '';
   if (empty($studies)) {
-    $output .= t('<p>Running a usability test will give you valuable data to improve your application.
+    $out .= t('<p>Running a usability test will give you valuable data to improve your application.
                   Getting feedback from real people using your module is the best feedback you can get.
                   The usability testing suite allows you to easily collect exactly that data!</p>');
-    $output .= '<div class="uts-dashboard">';
-    $output .= l(t('Create study'), 'admin/uts/studies/add', array('attributes' => array('id' => 'uts-create-study')));
-    $output .= '<h3 id="uts-learn">' . t('Learn about UTS, watch a video.') . '</h3>';
-    $output .= '<embed src="http://blip.tv/play/AaXwG4mSHQ" type="application/x-shockwave-flash" width="640" height="510" allowscriptaccess="always" allowfullscreen="true"></embed>';
-    $output .= '</div>';
+    $out .= '<div class="uts-dashboard">';
+    $out .= l(t('Create study'), 'admin/uts/studies/add', array('attributes' => array('id' => 'uts-create-study')));
+    $out .= '<h3 id="uts-learn">' . t('Learn about UTS, watch a video.') . '</h3>';
+    $out .= '<embed src="http://blip.tv/play/AaXwG4mSHQ" type="application/x-shockwave-flash" width="640" height="510" allowscriptaccess="always" allowfullscreen="true"></embed>';
+    $out .= '</div>';
   }
   else {
-    // TODO #307518.
-    $output .= 'TODO: http://drupal.org/node/307518';
+    $out .= '<div id="uts-dashboard-summary">';
+    $out .= uts_dashboard_studies($studies);
+    $out .= '</div>';
+    $out .= '<div id="uts-dashboard-sidebar">';
+    $out .= l(t('Create study'), 'admin/uts/studies/add', array('attributes' => array('id' => 'uts-create-study')));
+
+    // Get list
+//    $out .= menu_tree();
+    $out .= '</div>';
   }
 
-  return $output;
+  return $out;
+}
+
+function uts_dashboard_studies($studies) {
+  $header = array(t('Name'), t('Participants'), t('Task progress'));
+  $rows = array();
+
+  // Cycle through studies to generate summary table.
+  foreach ($studies as $study) {
+    $progress = uts_dashboard_studies_progress($study);
+
+    $row = array();
+    $row[] = l($study->title, 'node/' . $study->nid); // TODO link to expand?
+    $row[] = t('@count / @required', array('@count' => $progress['overal']['participated'], '@required' => $study->participant_count));
+    $row[] = theme('uts_progress', $progress['overal']['completed'], $progress['overal']['participated']);
+
+    $rows[] = $row;
+
+    // Generate individual task rows.
+    $tasks = uts_tasks_load($study->nid);
+    foreach ($tasks as $task) {
+      $row = array();
+      $row[] = theme('indentation', 1) . $task->title;
+      $row[] = t('@count / @required', array('@count' => $progress[$task->nid]['participated'], '@required' => $study->participant_count));
+      $row[] = theme('uts_progress', $progress[$task->nid]['completed'], $progress[$task->nid]['participated']);
+
+      $rows[] = $row;
+    }
+  }
+
+  return theme('table', $header, $rows);
+}
+
+function uts_dashboard_studies_progress($study) {
+  $sessions = uts_session_load_all($study->nid);
+
+  // Get the number of sessions that completed each task.
+  $tasks = uts_tasks_load($study->nid);
+
+  // Initialize all progress results to 0.
+  $progress = array();
+  $progress['overal']['completed'] = 0;
+  $progress['overal']['participated'] = count($sessions);
+  foreach ($tasks as $task) {
+    $progress[$task->nid]['completed'] = 0;
+    $progress[$task->nid]['participated'] = 0;
+  }
+
+  // Collect task progress data based on the related sessions.
+  foreach ($sessions as $session_id) {
+    $session = uts_session_load($session_id);
+
+    if ($session->complete) {
+      // Session completed all tasks.
+      $progress['overal']['completed']++;
+
+      foreach ($tasks as $task) {
+        $progress[$task->nid]['completed']++;
+        $progress[$task->nid]['participated']++;
+      }
+    }
+    else {
+      // See how far the session has progressed.
+      foreach ($tasks as $task) {
+        if ($session->current_task != $task->nid) {
+          // Made it past this task.
+          $progress[$task->nid]['completed']++;
+          $progress[$task->nid]['participated']++;
+        }
+        else {
+          $progress[$task->nid]['participated']++;
+          break;
+        }
+      }
+    }
+  }
+  return $progress;
+}
+
+function theme_uts_progress($progress, $total) {
+  $part = round(($progress / $total) * 100);
+  $whole = 100 - $part;
+  return '<div id="uts-dashboard-progess">' .
+           '<div id="uts-dashboard-progess-part" style="width: ' . $part . 'px;"></div>' .
+           '<div id="uts-dashboard-progess-whole" style="width: ' . $whole . 'px;"></div>' .
+         '</div>';
 }
 
 /**
Index: uts.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uts/uts.module,v
retrieving revision 1.47
diff -u -r1.47 uts.module
--- uts.module	13 Oct 2008 01:27:35 -0000	1.47
+++ uts.module	27 Dec 2008 05:12:55 -0000
@@ -521,6 +521,9 @@
     ),
     'uts_participate_start_form_data_collection' => array(
       'arguments' => array('form' => NULL)
+    ),
+    'uts_progress' => array(
+      'arguments' => array('progress' => 0, 'total' => 100)
     )
   );
 }
Index: uts.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uts/uts.css,v
retrieving revision 1.1
diff -u -r1.1 uts.css
--- uts.css	13 Oct 2008 01:27:35 -0000	1.1
+++ uts.css	27 Dec 2008 05:12:54 -0000
@@ -14,3 +14,32 @@
 h3#uts-learn {
   margin-top: 20px;
 }
+
+/* Dashboard studies
+ *******************/
+div#uts-dashboard-sidebar {
+	width: 180px;
+	float: right;
+}
+
+div#uts-dashboard-summary {
+  float: left;
+}
+
+div#uts-dashboard-progess {
+  border: 2px solid #FFFFFF;
+  height: 10px;
+}
+
+div#uts-dashboard-progess-part, div#uts-dashboard-progess-whole {
+	float: left;
+  height: 10px;
+}
+
+div#uts-dashboard-progess-part {
+  background-color: #92f86e;
+}
+
+div#uts-dashboard-progess-whole {
+  background-color: #f36161;
+}
\ No newline at end of file
