Index: uts.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uts/uts.pages.inc,v
retrieving revision 1.34
diff -u -r1.34 uts.pages.inc
--- uts.pages.inc	27 Dec 2008 07:26:04 -0000	1.34
+++ uts.pages.inc	28 Dec 2008 07:02:04 -0000
@@ -379,8 +379,8 @@
 
   $js = array(
     'images' => array(
-      theme('image', 'misc/menu-collapsed.png', 'Expand', 'Expand'),
-      theme('image', 'misc/menu-expanded.png', 'Collapsed', 'Collapsed'),
+       theme('image', 'misc/menu-collapsed.png', 'Expand', 'Expand'),
+       theme('image', 'misc/menu-expanded.png', 'Collapsed', 'Collapsed'),
     ),
   );
 
Index: uts.analysis.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uts/uts.analysis.inc,v
retrieving revision 1.17
diff -u -r1.17 uts.analysis.inc
--- uts.analysis.inc	17 Aug 2008 00:59:10 -0000	1.17
+++ uts.analysis.inc	28 Dec 2008 07:02:03 -0000
@@ -37,28 +37,176 @@
 function uts_analysis_list_sessions($study_nid) {
   uts_analysis_set_title($study_nid);
 
-  $sessions = uts_session_load_all($study_nid);
-  $header = array(t('Name'), t('Status'), t('Total time'), t('Operations'));
+  drupal_add_js(drupal_get_path('module', 'uts') . '/uts.js');
+  drupal_add_css(drupal_get_path('module', 'uts') . '/uts.css', 'module');
+  jquery_ui_add('ui.accordion');
+
+  $js = array(
+    'images' => array(
+       theme('image', 'misc/menu-collapsed.png', 'Expand', 'Expand'),
+       theme('image', 'misc/menu-expanded.png', 'Collapsed', 'Collapsed'),
+    ),
+  );
+  drupal_add_js(array('uts' => $js), 'setting');
+
+  module_load_include('inc', 'uts', 'uts.pages');
+
+  $study = node_load($study_nid);
+  $progress = uts_dashboard_studies_progress($study);
+
+  $tasks = uts_tasks_load($study_nid);
+  $header = array(t('Name'), t('Participants'), t('Completion rate'));
   $rows = array();
-  foreach ($sessions as $session_id) {
+  foreach ($tasks as $task) {
     $row = array();
+    $row[] = '<div id="uts-task-open-' . $task->nid . '" class="uts-task-open"></div>' . l($task->title, 'node/' . $task->nid);
+    $row[] = $progress[$task->nid]['participated'];
+    $row[] = theme('uts_progress', $progress[$task->nid]['completed'], $progress[$task->nid]['participated']);
+
+    $rows[] = array(
+      'data' => $row,
+      'class' => 'uts-task-head'
+    );
+
+    $row = array();
+    $row[] = array(
+      'data' => '<div id="uts-task-' . $task->nid . '" style="display: none;">' . uts_analysis_list_sessions_details($task) . '</div>',
+      'colspan' => 3
+    );
+
+    $rows[] = array(
+      'data' => $row,
+      'class' => 'uts-task-details',
+      'style' => 'display: none;'
+    );
+  }
+  return '<div class="dashboard-main">' . theme('table', $header, $rows) . uts_analysis_list_sessions_links($study_nid) . '</div>' .
+         '<div class="dashboard-sidebar">' . uts_analysis_list_sessions_status($study, $tasks, $progress) . '</div>';
+}
+
+/**
+ * Create a summary of participant data for a particular task.
+ *
+ * @param object $task Task object.
+ * @return string HTML output.
+ */
+function uts_analysis_list_sessions_details($task) {
+  $out = '';
+
+  // Lime spent chart.
+  $chart = array(
+    '#chart_id' => 'time_spent_' . $task->nid,
+    '#title' => t('Time spent (seconds)'),
+    '#type' => CHART_TYPE_BAR_V_GROUPED,
+    '#size' => chart_size(250, 200),
+    '#grid_lines' => chart_grid_lines(15, 20),
+    '#bar_size' => chart_bar_size(20, 5),
+    '#data' => array(),
+    '#data_colors' => array()
+  );
+
+  $sessions = uts_session_load_all($task->study_nid);
+  $max = 0;
+  foreach ($sessions as $session_id) {
     $session = uts_session_load($session_id);
+    list($start, $stop) = uts_data_get_timestamps($session->session_id, $task->nid);
+    $time = $stop - $start;
+    $max = max($max, $time);
 
-    $row[] = $session->session_id;
-    $row[] = ($session->complete ? t('complete') : t('incomplete'));
-    $row[] = format_interval(uts_data_get_total_time($session->session_id));
-    $row[] = uts_render_operations(uts_session_operations($session));
-    $rows[] = $row;
+    $chart['#data'][] = array($time);
+    $chart['#data_colors'][] = chart_unique_color($session->session_id);
   }
 
-  if (empty($rows)) {
-    return t('No sessions to analyze.');
-  }
-  return t('<p>
-              Use the analysis tabs to view overal study analysis, or select an individual session from the list
-              below for analysis for analysis.
-            </p>
-            !sessions', array('!sessions' => theme('table', $header, $rows)));
+  $chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][][] = chart_mixed_axis_range_label(0, $max);
+
+  $out .= chart_render($chart);
+  $out .= '<br />';
+
+  // Live comments.
+  $out .= '<b>' . t('Live feedback') . '</b>';
+
+  $out .= '<div id="uts-live-feedback">';
+  $out .= '<div id="uts-live-feedback-participants">';
+  $out .= '<div id="uts-live-feedback-label">' . t('Participants') . ':</div> ';
+
+  $data = array();
+  $i = 1;
+  foreach ($sessions as $session_id) {
+    $out .= '<div class="uts-live-feedback-participant" style="background-color: #' . chart_unique_color($session_id) .
+            '">' . $i . '</div>';
+
+    list($start, $stop) = uts_data_get_timestamps($session_id, $task->nid);
+    $data[$session_id] = uts_data_get($task->study_nid, $session_id, $start, $stop);
+    $data[$session_id] = $data[$session_id]['uts_live_feedback'];
+    $i++;
+  }
+  $out .= '</div>';
+
+  $i = 1;
+  foreach ($data as $session_id => $comments) {
+    $out .= '<div id="uts-comments-' . $i . '" class="uts-live-feedback-comments">';
+    $list = array();
+    foreach ($comments as $comment) {
+      $teaser = node_teaser($comment['message'], NULL, 50);
+      $teaser = (drupal_strlen($comment['message']) > drupal_strlen($teaser) ? $teaser . '...' : $teaser);
+      $list[] = l($teaser, '#') . '<div>' . $comment['message'] . '</div>';
+    }
+
+    $out .= ($list ? theme('item_list', $list, NULL, 'ul', array('class' => 'hax ui-accordion-container')) :
+             '<em>' . t('No comments to display.') . '</em>');
+    $out .= '</div>';
+    $i++;
+  }
+
+  $out .= '</div>';
+
+  return $out;
+}
+
+/**
+ * Create analyze links for each participant.
+ *
+ * @param interger $study_nid Current study NID.
+ * @return string HTML output.
+ */
+function uts_analysis_list_sessions_links($study_nid) {
+  $sessions = uts_session_load_all($study_nid);
+
+  $out = '<div id="uts-live-feedback-label">' . t('Analyze participant') . ':</div> ';
+
+  $data = array();
+  $i = 1;
+  foreach ($sessions as $session_id) {
+    $out .= '<a href="/admin/uts/analyze/' . $study_nid . '/' . $session_id . '">' .
+            '<div class="uts-live-feedback-participant" style="background-color: #' . chart_unique_color($session_id) . '">' . $i .
+            '</div></a>';
+    $i++;
+  }
+  return $out;
+}
+
+/**
+ * Generate a table of study status information.
+ *
+ * @param object $study Study object.
+ * @param array $tasks List of tasks related to study.
+ * @param array $progress Progress information.
+ * @return string HTML output.
+ */
+function uts_analysis_list_sessions_status($study, $tasks, $progress) {
+  $out = '';
+  $header = array(t('Key'), t('Value'));
+  $rows = array();
+
+  $rows[] = array(t('Status'), uts_get_study_status($study->study_status));
+  $rows[] = array(t('Participants'), t('@count / @required',
+              array('@count' => $progress['overal']['participated'], '@required' => $study->participant_count)));
+  $rate = round(($progress['overal']['completed'] / (count($tasks) * $study->participant_count)) * 100);
+  $rows[] = array(t('Comletion rate'), $rate . '%');
+
+  $out .= theme('table', $header, $rows);
+
+  return $out;
 }
 
 /**
@@ -71,7 +219,7 @@
 function uts_analysis_session_details($study_nid, $sessiond_id) {
   uts_analysis_set_title($study_nid, $sessiond_id);
 
-  return 'TODO: session details.';
+  return 'TODO: session details and destroy link.';
 }
 
 /**
Index: uts.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uts/uts.info,v
retrieving revision 1.4
diff -u -r1.4 uts.info
--- uts.info	8 Aug 2008 03:38:40 -0000	1.4
+++ uts.info	28 Dec 2008 07:02:03 -0000
@@ -4,4 +4,5 @@
 package = "Usability testing suite"
 version = 1.x-dev
 core = 6.x
+dependencies[] = chart
 dependencies[] = jquery_ui
\ No newline at end of file
Index: uts.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uts/uts.module,v
retrieving revision 1.48
diff -u -r1.48 uts.module
--- uts.module	27 Dec 2008 07:26:04 -0000	1.48
+++ uts.module	28 Dec 2008 07:02:04 -0000
@@ -523,10 +523,12 @@
       'arguments' => array('form' => NULL)
     ),
     'uts_dashboard_studies' => array(
-      'arguments' => array('header' => NULL, 'rows' => NULL)
+      'arguments' => array('header' => NULL, 'rows' => NULL),
+      'file' => 'uts.pages.inc'
     ),
     'uts_progress' => array(
-      'arguments' => array('progress' => 0, 'total' => 100)
+      'arguments' => array('progress' => 0, 'total' => 100),
+      'file' => 'uts.pages.inc'
     )
   );
 }
Index: uts.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uts/uts.js,v
retrieving revision 1.1
diff -u -r1.1 uts.js
--- uts.js	27 Dec 2008 07:26:04 -0000	1.1
+++ uts.js	28 Dec 2008 07:02:03 -0000
@@ -7,7 +7,7 @@
  */
 Drupal.behaviors.utsMenuCollapse = function() {
    var timeout = null;
-   
+
    // Adds expand-collapse functionality.
    $('div.uts-image').each(function() {
      direction = Drupal.settings.uts[$(this).attr('id')].imageDirection;
@@ -53,4 +53,55 @@
      Drupal.settings.uts[this.id].imageDirection = !direction;
 
    });
-};
\ No newline at end of file
+};
+
+/**
+ * Expand/Collapse the task details on the analysis page.
+ */
+Drupal.behaviors.utsTaskAccordion = function() {
+  $('div.uts-task-open').each(function() {
+    $(this).html(Drupal.settings.uts.images[0]);
+  });
+
+  $('div.uts-task-open').click(function() {
+    var task = $(this).attr('id').replace('uts-task-open-', '');
+    if ($(this).children('img:first').attr('title') == $(Drupal.settings.uts.images[0]).attr('title')) {
+      // Expand details.
+      $(this).html(Drupal.settings.uts.images[1]);
+      $('div#uts-task-' + task).parent().parent().css('display', '');
+      $('div#uts-task-' + task).show('fast');
+    }
+    else {
+      // Collapse details.
+      $(this).html(Drupal.settings.uts.images[0]);
+      $('div#uts-task-' + task).hide('fast', function() { $('div#uts-task-' + task).parent().parent().css('display', 'none'); });
+    }
+  });
+};
+
+/**
+ * Show/Hide the participant comments.
+ */
+Drupal.behaviors.utsLiveFeedback = function() {
+  $('div.uts-live-feedback-participant').click(function() {
+    // Fade other participant buttons.
+    $(this).parent().children('div.uts-live-feedback-participant').fadeTo('fast', 0.40);
+
+    // Focus current participant button.
+    $(this).fadeTo('fast', 1.0);
+
+    $parent = $(this).parent().parent();
+
+    // Hide all other comments.
+    $parent.children('div.uts-live-feedback-comments').hide('fast');
+
+    // Show the comments that relate to the specified participant.
+    $parent.children('div#uts-comments-' + $(this).text()).show('fast');
+
+    // Create accordion if the comments are being viewed for the first time.
+    $ul = $parent.children('div#uts-comments-' + $(this).text()).find('ul');
+    if (!$ul.hasClass('ui-accordion')) {
+      $parent.children('div#uts-comments-' + $(this).text()).find('ul').accordion();
+    }
+  });
+};
Index: uts.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uts/uts.css,v
retrieving revision 1.2
diff -u -r1.2 uts.css
--- uts.css	27 Dec 2008 07:26:04 -0000	1.2
+++ uts.css	28 Dec 2008 07:02:03 -0000
@@ -16,7 +16,7 @@
   margin-top: 20px;
 }
 
-/* Dashboard studies
+/* Dashboard - studies
  *******************/
 div.uts-image {
   cursor: pointer;
@@ -32,6 +32,7 @@
   border: 2px solid #FFFFFF;
   height: 10px;
   background: #CCCCCC;
+  width: 100px;
 }
 
 div#uts-dashboard-progess-part, div#uts-dashboard-progess-whole {
@@ -45,4 +46,43 @@
 
 div#uts-dashboard-progess-whole {
   background-color: #f36161;
-}
\ No newline at end of file
+}
+
+/* Dashboard analyze
+ *******************/
+div.dashboard-main {
+  float: left;
+}
+
+div.dashboard-sidebar {
+  float: left;
+  width: 200px;
+  margin-left: 20px;
+}
+
+div.uts-task-open {
+  cursor: pointer;
+  display: inline;
+  margin-right: 5px;
+}
+
+div#uts-live-feedback-label {
+  float: left;
+}
+
+div.uts-live-feedback-participant {
+	font-weight: bold;
+	text-align: center;
+	float: left;
+  width: 22px;
+  height: 22px;
+  margin-left: 5px;
+  cursor: pointer;
+  color: black;
+  text-decoration: none;
+}
+
+div.uts-live-feedback-comments {
+  display: none;
+  clear: both;
+}
