Index: CHANGELOG.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/journal/CHANGELOG.txt,v
retrieving revision 1.4.2.3
diff -u -p -r1.4.2.3 CHANGELOG.txt
--- CHANGELOG.txt	24 Feb 2008 04:58:18 -0000	1.4.2.3
+++ CHANGELOG.txt	16 Apr 2008 21:02:17 -0000
@@ -6,6 +6,7 @@ Journal x.x-x.x, xxxx-xx-xx
 
 Journal 6.x-1.x, xxxx-xx-xx
 ---------------------------
+#247517 by smk-ka: Added a block displaying all journal entries of current page.
 #200660 by sun: Changed order of journal entries to be reverse-chronical by
   default.
 #224657 by sun: Fixed PHP warning if $form['#submit'] isn't set.
Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/journal/README.txt,v
retrieving revision 1.5
diff -u -p -r1.5 README.txt
--- README.txt	14 Feb 2008 02:24:02 -0000	1.5
+++ README.txt	16 Apr 2008 21:04:19 -0000
@@ -27,6 +27,10 @@ Bug reports, feature suggestions and lat
   roles to access the journal (which includes adding new journal entries) by
   enabling 'access journal' and 'access site reports' permissions.
 
+* Optionally enable the Journal block at Administer -> Build -> Blocks. This
+  block displays all entries which have been made in the past for the url
+  currently visited.
+
 
 -- USAGE --
 
Index: journal.css
===================================================================
RCS file: journal.css
diff -N journal.css
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ journal.css	16 Apr 2008 19:19:47 -0000
@@ -0,0 +1,15 @@
+/* $Id: journal.css,v 1.1.2.1 2008/04/16 19:19:47 smk Exp $ */
+
+#journal-backlog {
+  list-style-type: none;
+}
+#journal-backlog li {
+  margin: 0;
+  padding: 0 0 0.25em;
+  background: transparent none;
+}
+#journal-backlog .journal-info {
+  font-size: 85%;
+  font-weight: bold;
+  display: block;
+}
Index: journal.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/journal/journal.install,v
retrieving revision 1.2
diff -u -p -r1.2 journal.install
--- journal.install	14 Feb 2008 02:24:02 -0000	1.2
+++ journal.install	16 Apr 2008 21:02:30 -0000
@@ -40,6 +40,9 @@ function journal_schema() {
       ),
     ),
     'primary key' => array('jid'),
+    'indexes' => array(
+      'location' => array(array('location', 32)),
+    ),
   );
   return $schema;
 }
@@ -58,3 +61,12 @@ function journal_uninstall() {
   drupal_uninstall_schema('journal');
 }
 
+/**
+ * Add index for location.
+ */
+function journal_update_6100() {
+  $ret = array();
+  $ret[] = db_add_index($ret, 'journal', 'location', array(array('location', 32)));
+  return $ret;
+}
+
Index: journal.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/journal/journal.module,v
retrieving revision 1.5.2.4
diff -u -p -r1.5.2.4 journal.module
--- journal.module	25 Feb 2008 00:32:28 -0000	1.5.2.4
+++ journal.module	16 Apr 2008 21:04:11 -0000
@@ -145,10 +145,40 @@ 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 entries'),
+      'weight' => -10,
+      'enabled' => 1,
+      'region' => 'right',
+    );
+    return $blocks;
+  }
+  else if ($op == 'view' && user_access('access journal')) {
+    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' ORDER BY j.timestamp DESC", $_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('Journal entries'),
+            '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' => 'desc'),
@@ -159,7 +189,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);
 }
 
 /**
@@ -175,14 +205,14 @@ function journal_view() {
  * @param array $journal
  *   A database query result resource or an array containing journal entry
  *   objects to output.
- * @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'.
+ *   Whether to output all log entries as 'table', 'list' or plain 'text'.
+ * @param array $header
+ *   An array containing header data for 'table' output.
  *
  * @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) {
@@ -201,13 +231,27 @@ function journal_output($journal, $heade
       }
       break;
       
-    case 'html':
+    case 'list':
+      $output = '';
+      while ($entry = ($type == 'resource' ? db_fetch_object($journal) : array_shift($journal))) {
+        $output .= '<li>';
+        $output .= '<span class="journal-info">'. theme('username', $entry) .' '. format_date($entry->timestamp, 'custom', 'ymd H:i') .'</span>';
+        $output .= '<span class="journal-entry">'. filter_xss_admin($entry->message) .'</span>';
+        $output .= '</li>';
+      }
+      if ($output) {
+        $output = '<ul id="journal-backlog">'. $output .'</ul>';
+      }
+      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),
         );
       }
