Index: journal.install
===================================================================
--- journal.install	(Revision 163)
+++ journal.install	(Arbeitskopie)
@@ -14,7 +14,8 @@ function journal_install() {
         message longtext NOT NULL,
         location text NOT NULL,
         timestamp int NOT NULL,
-        PRIMARY KEY (jid)
+        PRIMARY KEY (jid),
+        KEY location (location(32))
       ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
       break;
     case 'pgsql':
@@ -27,6 +28,7 @@ function journal_install() {
         PRIMARY KEY (jid)
       )");
       db_query("CREATE INDEX {journal}_jid_idx ON {journal} (jid)");
+      db_query("CREATE INDEX {journal}_location_idx ON {journal} (location)");
       break;
   }
 }
@@ -38,3 +40,19 @@ function journal_uninstall() {
   db_query('DROP TABLE {journal}');
 }
 
+/**
+ * Add index for location.
+ */
+function journal_update_1() {
+  $ret = array();
+  switch ($GLOBALS['db_type']) {
+    case 'mysql':
+    case 'mysqli':
+      $ret[] = update_sql("ALTER TABLE {journal} ADD KEY location (location)");
+      break;
+    case 'pgsql':
+      $ret[] = update_sql("CREATE INDEX {journal}_location_idx ON {journal} (location)");
+      break;
+  }
+  return $ret;
+}
Index: journal.css
===================================================================
--- journal.css	(Revision 0)
+++ journal.css	(Revision 0)
@@ -0,0 +1,2 @@
+/* $Id$ */
+.journal-info { font-size: 85%; font-weight: bold; }
Index: journal.module
===================================================================
--- journal.module	(Revision 163)
+++ journal.module	(Arbeitskopie)
@@ -145,11 +145,41 @@ function journal_user($op, &$edit, &$use
   }
 }
 
+/**
+ * Implementation of hook_block().
+ */
+function journal_block($op = 'list', $delta = 0, $edit = array()) {
+  if ($op == 'list') {
+    $blocks['backlog'] = array(
+      'info' => t('Journal backlog'),
+      'weight' => -10,
+      'enabled' => 1,
+      'region' => 'right',
+    );
+    return $blocks;
+  }
+  else if ($op == 'view') {
+    switch($delta) {
+      case 'backlog':
+        $result = db_query("SELECT j.*, u.name FROM {journal} j INNER JOIN {users} u ON j.uid = u.uid WHERE j.location = '%s'", $_GET['q']);
+        if ($output = journal_output($result, 'list')) {
+          drupal_add_css(drupal_get_path('module', 'journal') .'/journal.css', 'module', 'all', FALSE);
+          $block = array(
+            'subject' => t('Backlog'),
+            'content' => $output,
+          );
+        }
+        break;
+    }
+    return $block;
+  }
+}
+
 /**
  * Output a sortable table containing all journal entries.
  */
 function journal_view() {
-  $sql = "SELECT * FROM {journal} j INNER JOIN {users} u ON j.uid = u.uid";
+  $sql = "SELECT j.*, u.name FROM {journal} j INNER JOIN {users} u ON j.uid = u.uid";
   
   $header = array(
     array('data' => t('Date'), 'field' => 'j.timestamp', 'sort' => 'asc'),
@@ -160,7 +190,7 @@ function journal_view() {
   $tablesort = tablesort_sql($header);
   $result = pager_query($sql . $tablesort, 50);
 
-  return journal_output($result, $header);
+  return journal_output($result, 'table', $header);
 }
 
 /**
@@ -176,14 +206,14 @@ function journal_view() {
  * @param array $journal
  *   A database query result resource or an array containing journal entry
  *   objects to output.
+ * @param string $format
+ *   Whether to output all log entries as 'table', 'list' or plain 'text'.
  * @param array $header
  *   An array containing table header data for HTML output.
- * @param string $format
- *   Whether to output all log entries as 'html' or plain 'text'.
  *
  * @todo Add XML output format.
  */
-function journal_output($journal, $header = array(), $format = 'html') {
+function journal_output($journal, $format = 'table', $header = array()) {
   $type = gettype($journal);
   
   switch ($format) {
@@ -202,13 +232,25 @@ function journal_output($journal, $heade
       }
       break;
       
-    case 'html':
+    case 'list':
+      $output = '';
+      while ($entry = ($type == 'resource' ? db_fetch_object($journal) : array_shift($journal))) {
+        $output .= '<div class="journal-info">'. theme('username', $entry) .' '. format_date($entry->timestamp, 'custom', 'ymd H:i') .'</div>';
+        $output .= '<div class="journal-entry">'. filter_xss_admin($entry->message) ."</div>\n";
+      }
+      if ($output) {
+        $output = '<div id="journal-backlog">'. $output .'</div>';
+      }
+      break;
+
+    case 'table':
     default:
+      $rows = array();
       while ($entry = ($type == 'resource' ? db_fetch_object($journal) : array_shift($journal))) {
         $rows[] = array(
           format_date($entry->timestamp, 'small'),
           theme('username', $entry),
-          $entry->message,
+          filter_xss_admin($entry->message),
           l($entry->location, $entry->location),
         );
       }
