Index: context_ui/context_ui-list-contexts.tpl.php
===================================================================
RCS file: context_ui/context_ui-list-contexts.tpl.php
diff -N context_ui/context_ui-list-contexts.tpl.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ context_ui/context_ui-list-contexts.tpl.php	31 May 2009 17:08:11 -0000
@@ -0,0 +1,49 @@
+<?php
+// $Id$
+/**
+ * @file
+ *
+ * Displays the list of contexts on the administration screen.
+ */
+?>
+
+<p><?php print $help ?></p>
+
+<?php foreach ($contexts_tree as $namespace => $attributes): ?>
+  <?php foreach ($attributes as $attribute => $contexts): ?>
+    <div class='context-namespace-attribute context-<?php print $namespace ?>-<?php print $attribute ?> clear'>
+      <div class='context-namespace-attribute-title'>
+        <?php print $namespace ?> &gt; <?php print $attribute ?>
+      </div>
+      <?php foreach ($contexts as $name => $context): ?>
+        <table class="contexts-entry <?php print $context->classes ?>">
+          <tbody>
+            <tr>
+              <td class="context-name">
+                <?php print $help_type_icon ?>
+                <?php print t('<em>@type</em> context: <strong>@context</strong>', array('@type' => $context->type, '@context' => $context->name)) ?>
+                <?php if (!empty($context->tag)): ?>
+                  &nbsp;(<?php print $context->tag ?>)
+                <?php endif ?>
+              </td>
+              <td class="context-ops"><?php print $context->ops ?></td>
+            </tr>
+            <tr>
+              <td>
+                <?php if ($context->conditions): ?>
+                  <?php print t('Conditions: @conditions', array('@conditions' => $context->conditions)) ?> <br />
+                <?php endif ?>
+                <?php if ($context->reactions): ?>
+                  <?php print t('Reactions: @reactions', array('@reactions' => $context->reactions)) ?>
+                <?php endif ?>
+              </td>
+              <td colspan="2" class="description">
+                <?php print $context->description ?>
+              </td>
+            </tr>
+          </tbody>
+        </table>
+      <?php endforeach ?>
+    </div>
+  <?php endforeach ?>
+<?php endforeach ?>
Index: context_ui/context_ui-list.css
===================================================================
RCS file: context_ui/context_ui-list.css
diff -N context_ui/context_ui-list.css
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ context_ui/context_ui-list.css	31 May 2009 16:49:35 -0000
@@ -0,0 +1,100 @@
+/* $Id$ */
+
+div.context-namespace-attribute {
+  margin-top: 1em;
+  background: #eee;
+  border: 2px solid #ddd;
+}
+
+div.context-namespace-attribute-title {
+  margin: 2px;
+  padding-left: 10px;
+  font-weight: bold;
+  background: #fff;
+  line-height: 1.8;
+  border: 1px solid #ddd;
+}
+
+table.contexts-entry {
+  margin: 3px 0;
+  border: 1px solid #ddd;
+  background-color: white;
+  color: #494949; /* matches garland */
+  clear: left; /* LTR */
+  width: 97%;
+  margin-left: 2%;
+}
+
+table.contexts-entry tbody {
+  border: none;
+}
+
+table.contexts-entry td.context-ops {
+  width: 45%;
+  text-align: right; /* LTR */
+  background-color: #eee;
+}
+
+table.contexts-entry td.context-name {
+  background-color: #eee;
+}
+
+table.contexts-entry .description {
+  vertical-align: top;
+}
+
+body form#contexts-ui-list-contexts-form {
+  margin: 0 0 1.5em 0;
+}
+
+#contexts-ui-list-contexts-form .form-item {
+  padding-right: 1em; /* LTR */
+  float: left; /* LTR */
+  margin-top: 0;
+  margin-bottom: 0;
+}
+
+#edit-order-wrapper {
+  clear: left; /* LTR */
+}
+
+#edit-contexts-apply,
+#edit-contexts-reset {
+  margin-top: 1.65em;
+  float: left; /* LTR */
+}
+
+.contexts-entry .advanced-help-link {
+  position: relative;
+  top: 2px;
+  padding-right: 3px; /* LTR */
+}
+
+table.context-disabled {
+  color: #999;
+}
+
+table.contexts-entry td {
+  line-height: 1.4;
+  padding-bottom: 10px;
+}
+table.context-disabled td {
+  line-height: 1.4;
+  padding-bottom: 10px;
+  background: none;
+}
+table.context-enabled td.context-name,
+table.context-enabled td.context-ops,
+table.context-disabled td.context-name,
+table.context-disabled td.context-ops {
+  line-height: 1.6;
+  padding-bottom: 0.3em;
+}
+table.contexts-entry td.context-name,
+table.contexts-entry td.context-ops {
+  background: #eee;
+}
+table.context-enabled td.context-name,
+table.context-enabled td.context-ops {
+  background: #E4F0F8; 
+}
Index: context_ui/context_ui.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/context/context_ui/Attic/context_ui.admin.inc,v
retrieving revision 1.1.2.7.2.3
diff -u -p -r1.1.2.7.2.3 context_ui.admin.inc
--- context_ui/context_ui.admin.inc	26 May 2009 04:49:36 -0000	1.1.2.7.2.3
+++ context_ui/context_ui.admin.inc	31 May 2009 17:14:01 -0000
@@ -4,40 +4,107 @@
 /**
  * Page callback for context_ui admin landing page.
  */
-function context_ui_admin() {
-  // Add css
-  drupal_add_css(drupal_get_path("module", "context_ui") ."/context_ui.css");
-
+function context_ui_list_contexts() {
   // rebuild blocks
   _block_rehash();
 
   // rebuild context cache
   context_invalidate_cache();
 
-  // user defined contexts
-  $output = "<h3>". t('Context definitions') ."</h3>";
-  $normal = context_contexts();
-  if ($normal) {
-    ksort($normal);
-    $output .= theme('context_ui_admin', $normal);
+  $output = theme('context_ui_list_contexts');
+  return $output;
+}
+
+/**
+ * Preprocess the contexts list theme
+ */
+function template_preprocess_context_ui_list_contexts(&$vars) {
+  $contexts = context_contexts();
+  $conditions = context_conditions();
+  $reactions = context_reactions();
+  ksort($contexts);
+  $vars['contexts_tree'] = array();
+
+  foreach ($contexts as $key => $context) {
+    $identifier = (isset($context->cid) && $context->cid) ? $context->cid : key;
+
+    $item = new stdClass();
+    $item->namespace = $context->namespace;
+    $item->attribute = $context->attribute;
+    $item->name = $context->value;
+    $item->ops = array();
+
+    switch ($context->type) {
+      case CONTEXT_STORAGE_DEFAULT:
+        $item->type = 'Default';
+        $links[0] = l(t('Override'), "admin/build/context/$identifier/clone");
+        $links[2] = l(t('Export'), "admin/build/context/$identifier/export");
+        $links[3] = l(t('Clone'), "admin/build/context/$identifier/clone");
+        break;
+      case CONTEXT_STORAGE_OVERRIDDEN:
+        $item->type = 'Overridden';
+        $links[0] = l(t('Edit'), "admin/build/context/$identifier");
+        $links[2] = l(t('Export'), "admin/build/context/$identifier/export");
+        $links[3] = l(t('Clone'), "admin/build/context/$identifier/clone");
+        $links[4] = l(t('Revert'), "admin/build/context/$identifier/delete");
+        break;
+      case CONTEXT_STORAGE_NORMAL:
+        $item->type = 'Normal';
+        $links[0] = l(t('Edit'), "admin/build/context/$identifier");
+        $links[2] = l(t('Export'), "admin/build/context/$identifier/export");
+        $links[3] = l(t('Clone'), "admin/build/context/$identifier/clone");
+        $links[4] = l(t('Delete'), "admin/build/context/$identifier/delete");
+    }
+    switch ($context->status) {
+      case CONTEXT_STATUS_DISABLED:
+        $item->classes = 'context-disabled';
+        $links[1] = l(t('Enable'), "admin/build/context/$identifier/enable");
+        break;
+      case CONTEXT_STATUS_ENABLED:
+        $item->classes = 'context-enabled';
+        $links[1] = l(t('Disable'), "admin/build/context/$identifier/disable");
+    }
+    $item->ops = implode(' | ', $links);
+
+    foreach ($conditions as $id => $condition) {
+      if (!empty($context->$id)) {
+        $item->conditions[] = $condition['#title'];
+      }
+    }
+    $item->conditions = isset($item->conditions) ? implode(', ', $item->conditions) : t('none');
+
+    foreach ($reactions as $id => $reaction) {
+      if (!empty($context->$id)) {
+        $item->reactions[] = $reaction['#title'];
+      }
+    }
+    $item->reactions = isset($item->reactions) ? implode(', ', $item->reactions) : t('none');
+
+    $item->description = !empty($context->description) ? filter_xss_admin($context->description) : '';
+    $vars['contexts_tree'][$item->namespace][$item->attribute][$item->name] = $item;
   }
-  else {
-    $output .= "<p>". t('Please !add_context to get started.', array('!add_context' => l(t('add a context'), 'admin/build/context/add'))) ."</p>";
+
+  $getting_started = theme('advanced_help_topic', 'context_ui', 'getting-started', 'title');
+  if (!$getting_started) {
+    $getting_started = t('Install the advanced help module for the getting started');
   }
 
-  return $output;
+  $vars['help'] = t('Not sure what to do? Try the "!getting-started" page.', array('!getting-started' => $getting_started));
+  $vars['help_type_icon'] = theme('advanced_help_topic', 'context_ui', 'type');
+
+  drupal_add_css(drupal_get_path("module", "context_ui") ."/context_ui-list.css");
 }
 
 /**
  * Recursive function that intelligently populates default values in a
  * form from a provided array of data.
- * 
+ *
  * @param $form
  *   A form API element to populate with default values.
  * @param $data
  *   A keyed array of data that matches the tree structure of the
  *   form API branch it should populate.
- * 
+ *
  * @return
  *   A form API element populated with default values.
  */
@@ -690,89 +757,7 @@ function theme_context_ui_bulk_export_ta
   return $output;
 }
 
-/**
- * Generates the main context_ui admin page with a tiered context listing.
- */
-function theme_context_ui_admin($contexts) {
-  $rows = $headings = array();
-  foreach ($contexts as $key => $context) {
-    $row = array();
-
-    $namespace = $context->namespace;
-    $attribute = $context->attribute;
-    $value = $context->value;
-    if (isset($context->cid) && $context->cid) {
-      $identifier = $context->cid;
-    }
-    else {
-      $identifier = $key;
-    }
-
-    // If no heading has been printed for this n/a pair, do so
-    if (!isset($rows["$namespace-$attribute"])) {
-      $row = array(array('data' => "<span class='context-namespace'>$namespace &gt; $attribute</span>", 'colspan' => 2));
-      $rows["$namespace-$attribute"] = $row;
-    }
-
-    // Add row for context
-    $links = array();
-    $icon = theme('advanced_help_topic', 'context_ui', 'type');
-    switch ($context->type) {
-      case CONTEXT_STORAGE_DEFAULT:
-        $type = 'Default';
-        $links[0] = l(t('Override'), "admin/build/context/$identifier/clone");
-        $links[2] = l(t('Export'), "admin/build/context/$identifier/export");
-        $links[3] = l(t('Clone'), "admin/build/context/$identifier/clone");
-        break;
-      case CONTEXT_STORAGE_OVERRIDDEN:
-        $type = 'Overridden';
-        $links[0] = l(t('Edit'), "admin/build/context/$identifier");
-        $links[2] = l(t('Export'), "admin/build/context/$identifier/export");
-        $links[3] = l(t('Clone'), "admin/build/context/$identifier/clone");
-        $links[4] = l(t('Revert'), "admin/build/context/$identifier/delete");
-        break;
-      case CONTEXT_STORAGE_NORMAL:
-        $type = 'Normal';
-        $links[0] = l(t('Edit'), "admin/build/context/$identifier");
-        $links[2] = l(t('Export'), "admin/build/context/$identifier/export");
-        $links[3] = l(t('Clone'), "admin/build/context/$identifier/clone");
-        $links[4] = l(t('Delete'), "admin/build/context/$identifier/delete");
-    }
-    switch ($context->status) {
-      case CONTEXT_STATUS_DISABLED:
-        $class = 'disabled';
-        $enable = l(t('Enable'), "admin/build/context/$identifier/enable");
-        break;
-      case CONTEXT_STATUS_ENABLED:
-        $class = 'enabled';
-        $enable = l(t('Disable'), "admin/build/context/$identifier/disable");
-    }
-    $links[1] = $enable;
-    if ($icon) {
-      // These spans are used to work-around advanced help's default styling of
-      // floating the help icon left. We would like to display it after the text,
-      // so we put a series of floats next to each other.
-      $data = "<strong>$value</strong> <em><span>($type</span> $icon<span>)</span></em>";
-    }
-    else {
-      $data = "<strong>$value</strong> <em>($type)</em>";
-    }
-    $description = !empty($context->description) ? '<div class="description">'. filter_xss_admin($context->description) .'</div>' : '';
 
-    ksort($links);
-    $rows[$key] = array(
-      'data' => array(
-        array(
-          'data' => $data . $description,
-          'class' => 'context-name '. ($icon? 'icon' : 'no-icon'),
-        ),
-        implode(' | ', $links),
-      ),
-      'class' => 'context-table-row ' . $class,
-    );
-  }
-  return theme('table', array(t('Context'), t('Operations')), $rows, array('class' => 'context-ui-overview')); 
-}
 
 /**
  * Generates the AJAX enabled block administration portion of the context_ui admin form.
Index: context_ui/context_ui.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/context/context_ui/context_ui.css,v
retrieving revision 1.6.2.7
diff -u -p -r1.6.2.7 context_ui.css
--- context_ui/context_ui.css	8 Mar 2009 04:34:10 -0000	1.6.2.7
+++ context_ui/context_ui.css	31 May 2009 16:39:42 -0000
@@ -36,48 +36,6 @@
  * Context admin listing page =========================================
  */
 
-table.context-ui-overview a.advanced-help-link {
-  position: relative;
-  top: 3px;
-  margin-left: 3px;
-  }
-
-table.context-ui-overview span.context-namespace {
-  font-weight:bold;
-  }
-
-table.context-ui-overview td.context-name {
-  padding-left:30px;
-  }
-
-table.context-ui-overview tr.disabled td.context-name {
-  color:#999;
-  }
-
-table.context-ui-overview tr.context-table-row td.icon strong,
-table.context-ui-overview tr.context-table-row td.icon em,
-table.context-ui-overview tr.context-table-row td.icon span {
-  display: block;
-  float: left;
-  padding-right: 2px;
-  }
-
-table.context-ui-overview tr.context-table-row td div.description {
-  margin-bottom: 0;
-  }
-
-table.context-ui-overview tr.context-table-row td div.description {
-  margin-bottom: 0;
-  }
-
-table.context-ui-overview tr.context-table-row td.icon strong {
-  padding-right: 4px;
-  }
-
-table.context-ui-overview tr.context-table-row td.icon a span {
-  display: none;  
-  }
-
 h3.context-space small {
   display:inline;
   padding:.1em .5em; margin-left:1em;
Index: context_ui/context_ui.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/context/context_ui/context_ui.module,v
retrieving revision 1.13.2.48.2.1
diff -u -p -r1.13.2.48.2.1 context_ui.module
--- context_ui/context_ui.module	14 May 2009 03:55:26 -0000	1.13.2.48.2.1
+++ context_ui/context_ui.module	31 May 2009 16:52:19 -0000
@@ -5,30 +5,29 @@
  * Implementation of hook_theme().
  */
 function context_ui_theme() {
-  $items['context_ui_export_form'] = array(
-    'arguments' => array('form' => array()),
-    'file' => 'context_ui.admin.inc',
-  );
-  $items['context_ui_item_display'] = array(
-    'arguments' => array('form' => array()),
-    'file' => 'context_ui.admin.inc',
-  );
-  $items['context_ui_form'] = array(
-    'arguments' => array('form' => array()),
-    'file' => 'context_ui.admin.inc',
-  );
-  $items['context_ui_block_ui'] = array(
-    'arguments' => array('form' => array()),
-    'file' => 'context_ui.admin.inc',
-  );
-  $items['context_ui_admin'] = array(
+  $path = drupal_get_path('module', 'context_ui');
+
+  // This is only required for the preprocess function.
+  require_once "./$path/context_ui.admin.inc";
+
+  // Minor code reduction technique.
+  $base = array(
     'arguments' => array('form' => array()),
     'file' => 'context_ui.admin.inc',
   );
-  $items['context_ui_bulk_export_table'] = array(
-    'arguments' => array('form' => array()),
-    'file' => 'context_ui.admin.inc',
+
+  $items['context_ui_export_form'] = $base;
+  $items['context_ui_item_display'] = $base;
+  $items['context_ui_form'] = $base;
+  $items['context_ui_block_ui'] = $base;
+  $items['context_ui_bulk_export_table'] = $base;
+
+  // List contexts (admin landing page).
+ $items['context_ui_list_contexts'] = array(
+   'template' => 'context_ui-list-contexts',
+   'path' => $path,
   );
+
   $items['context_devel'] = array(
     'arguments' => array('form' => array()),
   );
@@ -72,12 +71,11 @@ function context_ui_menu() {
   $items['admin/build/context'] = array(
     'title' => 'Context',
     'description' => 'Associate menus, views, blocks, etc. with different contexts to structure your site.',
-    'page callback' => 'context_ui_admin',
+    'page callback' => 'context_ui_list_contexts',
     'type' => MENU_NORMAL_ITEM,
   );
   $items['admin/build/context/list'] = array(
     'title' => 'List',
-    'page callback' => 'context_ui_admin',
     'type' => MENU_DEFAULT_LOCAL_TASK,
     'weight' => 0,
   );
Index: context_ui/help/context_ui.help.ini
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/context/context_ui/help/Attic/context_ui.help.ini,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 context_ui.help.ini
--- context_ui/help/context_ui.help.ini	9 Feb 2009 02:36:35 -0000	1.1.2.1
+++ context_ui/help/context_ui.help.ini	31 May 2009 16:39:42 -0000
@@ -2,5 +2,10 @@
 [advanced help settings]
 line break = TRUE
 
+[getting-started]
+title = "Getting started"
+weight = -45
+
 [type]
-title = "Types"
+title = "Context types"
+
Index: context_ui/help/getting-started.html
===================================================================
RCS file: context_ui/help/getting-started.html
diff -N context_ui/help/getting-started.html
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ context_ui/help/getting-started.html	31 May 2009 16:39:42 -0000
@@ -0,0 +1,2 @@
+<!-- $Id$ -->
+TODO: write documentation
