Index: watchdog_live.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/watchdog_live/watchdog_live.info,v
retrieving revision 1.1
diff -u -p -r1.1 watchdog_live.info
--- watchdog_live.info	23 Jan 2008 19:12:20 -0000	1.1
+++ watchdog_live.info	16 Apr 2009 19:56:12 -0000
@@ -1,3 +1,10 @@
 ; $Id: watchdog_live.info,v 1.1 2008/01/23 19:12:20 stevemckenzie Exp $
 name = "Watchdog Live"
 description = "Adds auto update functionality to the watchdog table with jQuery."
+core = 6.x
+
+dependencies[] = dblog
+
+version = "6.x-1.0beta"
+project = "watchdog_live"
+
Index: watchdog_live.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/watchdog_live/watchdog_live.js,v
retrieving revision 1.2
diff -u -p -r1.2 watchdog_live.js
--- watchdog_live.js	28 Jan 2008 22:43:26 -0000	1.2
+++ watchdog_live.js	16 Apr 2009 19:56:12 -0000
@@ -26,13 +26,14 @@ Drupal.watchdog = {
   
   // Check callback for update and display new content if any.
   load: function() {
-    $.get(Drupal.settings.watchdogLive.basePath +'admin/logs/watchdog/live/callback', function(data) {
+    $.get(Drupal.settings.watchdogLive.callback_url, function(data) {
       var result = Drupal.parseJson(data);
       
       // Only if we get content back.
       if (result.content) {
+    	  
         var animated = false;
-        $('#watchdog-form-overview').parent().children().not('#watchdog-form-overview').fadeOut('fast', function() {
+        $('#dblog-filter-form').parent().children().not('#dblog-filter-form').fadeOut('fast', function() {
           // Since we have multiple children, the callback will be called multiple times.
           // Force a stop.
           if (animated) { 
@@ -41,11 +42,11 @@ Drupal.watchdog = {
           animated = true;
           
           // Remove old table.
-          $('#watchdog-form-overview').parent().children().not('#watchdog-form-overview').remove();
+          $('#dblog-filter-form').parent().children().not('#dblog-filter-form').remove();
           
           // Bring in new content.
-          $('#watchdog-form-overview').parent().append(result.content);
-          $('#watchdog-form-overview').parent().children().not('#watchdog-form-overview').fadeIn('fast');
+          $('#dblog-filter-form').parent().append(result.content);
+          $('#dblog-filter-form').parent().children().not('#dblog-filter-form').fadeIn('fast');
         });
       }
       
@@ -56,7 +57,9 @@ Drupal.watchdog = {
   
   // Save a setting for the configurable options.
   saveSetting: function(name, value) {
-    $.post(Drupal.settings.watchdogLive.basePath +'admin/logs/watchdog/live/settings', {name: value})
+    var setting = {};
+    setting[name] = value;
+    $.post(Drupal.settings.watchdogLive.setting_url, setting);
     Drupal.watchdog[name] = value;
   },
   
Index: watchdog_live.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/watchdog_live/watchdog_live.module,v
retrieving revision 1.2
diff -u -p -r1.2 watchdog_live.module
--- watchdog_live.module	28 Jan 2008 22:43:26 -0000	1.2
+++ watchdog_live.module	16 Apr 2009 19:56:12 -0000
@@ -2,30 +2,29 @@
 // $Id: watchdog_live.module,v 1.2 2008/01/28 22:43:26 stevemckenzie Exp $
 
 /**
- *  
  *  @file
  *  Adds auto update functionality to the watchdog table.
- * 
  */
 
 /**
  *  Implementation of hook_menu().
  */
-function watchdog_live_menu($may_cache) {
+function watchdog_live_menu() {
   $items = array();
-
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/logs/watchdog/live/callback',
-      'callback' => 'watchdog_live_callback',
-      'type' => MENU_CALLBACK
-    );
-    $items[] = array(
-      'path' => 'admin/logs/watchdog/live/settings',
-      'callback' => 'watchdog_live_settings',
-      'type' => MENU_CALLBACK
-    );
-  }
+  
+  $items['admin/logs/watchdog/live/callback'] = array(
+    'page callback' => 'watchdog_live_callback',
+    'access arguments' => array('access site reports'),
+    'type' => MENU_CALLBACK,
+    'file' => 'watchdog_live.module',
+  );
+  
+  $items['admin/logs/watchdog/live/settings'] = array(
+    'page callback' => 'watchdog_live_settings',
+    'access arguments' => array('administer site configuration'),
+    'type' => MENU_CALLBACK,
+    'file' => 'watchdog_live.module',
+  );
   
   return $items;
 }
@@ -33,19 +32,32 @@ function watchdog_live_menu($may_cache) 
 /**
  *  Implementation of hook_form_alter().
  */
-function watchdog_live_form_alter($form_id, &$form) {
-  if ($form_id == 'watchdog_form_overview') {
+function watchdog_live_form_alter(&$form, &$form_state , $form_id) {
+  if ($form_id == 'dblog_filter_form' && empty($_GET['page'])) {
     // Include needed JavaScript.
-    drupal_add_js(array('watchdogLive' => array('basePath' => base_path())), 'setting');
+    
+  	$path = array(
+  	  'callback_url' => url('admin/logs/watchdog/live/callback'),
+  	  'setting_url' => url('admin/logs/watchdog/live/settings')
+  	);
+  	
+    drupal_add_js(array('watchdogLive' => $path), 'setting');
     drupal_add_js(drupal_get_path('module', 'watchdog_live') .'/watchdog_live.js');
     
     // Keep record of the newest log they have seen.
     $_SESSION['watchdog_live_latest_wid'] = watchdog_live_latest_wid();
-    
+    $intervals = drupal_map_assoc(array(0, 50, 100, 200, 300, 400, 500, 1000, 1500, 2000, 2500, 3000, 4000, 5000, 10000), create_function('$a', 'return $a/1000 . " '. t('seconds'). '";'));
+  
     // Add configurable options right on the watchdog page so we can update instantly.. just for kicks.
     $form['watchdog_live'] = array('#type' => 'fieldset', '#title' => t('Live settings'), '#tree' => TRUE);
-    $form['watchdog_live']['interval'] = array('#type' => 'select', '#title' => t('Update interval'), '#options' => drupal_map_assoc(array(0, 50, 100, 200, 300, 400, 500, 1000, 1500, 2000, 2500, 3000, 4000, 5000, 10000)), '#default_value' => variable_get('watchdog_live_interval', 1000));
-    $form['watchdog_live']['disabled'] = array('#type' => 'checkbox', '#title' => t('Disable'), '#default_value' => $_SESSION['watchdog_live_disabled']);
+    $form['watchdog_live']['interval'] = array(
+      '#type' => 'select', '#title' => t('Update interval'), 
+      '#options' => $intervals, '#default_value' => variable_get('watchdog_live_interval', 2000)
+    );
+    $form['watchdog_live']['disabled'] = array(
+      '#type' => 'checkbox', '#title' => t('Disable'), 
+      '#default_value' => $_SESSION['watchdog_live_disabled']
+    );
   }
 }
 
@@ -53,11 +65,17 @@ function watchdog_live_form_alter($form_
  *  Callback used to retrieve the updated table.
  */
 function watchdog_live_callback() {
+  require_once drupal_get_path('module','dblog') . '/dblog.admin.inc';
+	
   // Make sure we need to update the table.
   $latest_wid = watchdog_live_latest_wid();
   if ($_SESSION['watchdog_live_latest_wid'] < $latest_wid) {
     $_SESSION['watchdog_live_latest_wid'] = $latest_wid;
-    $output['content'] = watchdog_live_overview();
+    
+    $output['content'] = preg_replace('#<form.*</form>\s+#s','',dblog_overview());
+    
+    // fix url
+    $output['content'] = preg_replace('#admin/logs/watchdog/live/callback#','admin/reports/dblog',$output['content']);
   } else {
     $output['error'] = TRUE;
   }
@@ -67,69 +85,12 @@ function watchdog_live_callback() {
 }
 
 /**
- *  Watchdog table display. Taken directly from watchdog.module but removed call to render the filtered form since we keep it on the screen.
- */
-function watchdog_live_overview() {
-  $icons = array(WATCHDOG_NOTICE  => '',
-                 WATCHDOG_WARNING => theme('image', 'misc/watchdog-warning.png', t('warning'), t('warning')),
-                 WATCHDOG_ERROR   => theme('image', 'misc/watchdog-error.png', t('error'), t('error')));
-  $classes = array(WATCHDOG_NOTICE => 'watchdog-notice', WATCHDOG_WARNING => 'watchdog-warning', WATCHDOG_ERROR => 'watchdog-error');
-
-  // Originally this had the filter form at the top but we do not want to show it here since we are bringing this back inside the form.
-  $output = '';
-
-  $header = array(
-    ' ',
-    array('data' => t('Type'), 'field' => 'w.type'),
-    array('data' => t('Date'), 'field' => 'w.wid', 'sort' => 'desc'),
-    array('data' => t('Message'), 'field' => 'w.message'),
-    array('data' => t('User'), 'field' => 'u.name'),
-    array('data' => t('Operations'))
-  );
-
-  $sql = "SELECT w.wid, w.uid, w.severity, w.type, w.timestamp, w.message, w.link, u.name FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid";
-  $tablesort = tablesort_sql($header);
-  $type = $_SESSION['watchdog_overview_filter'];
-  if ($type != 'all') {
-    $result = pager_query($sql ." WHERE w.type = '%s'". $tablesort, 50, 0, NULL, $type);
-  }
-  else {
-    $result = pager_query($sql . $tablesort, 50);
-  }
-
-  while ($watchdog = db_fetch_object($result)) {
-    $rows[] = array('data' =>
-      array(
-        // Cells
-        $icons[$watchdog->severity],
-        t($watchdog->type),
-        format_date($watchdog->timestamp, 'small'),
-        l(truncate_utf8($watchdog->message, 56, TRUE, TRUE), 'admin/logs/event/'. $watchdog->wid, array(), NULL, NULL, FALSE, TRUE),
-        theme('username', $watchdog),
-        $watchdog->link,
-      ),
-      // Attributes for tr
-      'class' => "watchdog-". preg_replace('/[^a-z]/i', '-', $watchdog->type) .' '. $classes[$watchdog->severity]
-    );
-  }
-
-  if (!$rows) {
-    $rows[] = array(array('data' => t('No log messages available.'), 'colspan' => 6));
-  }
-
-  $output .= theme('table', $header, $rows);
-  $output .= theme('pager', NULL, 50, 0);
-
-  return $output;
-}
-
-/**
  * Update the interval time.
  */
 function watchdog_live_settings() {
   // Handle interval.
-  if (isset($_POST['interval']) && is_numeric($_POST['interval'])) {
-    variable_set('watchdog_live_interval', $interval);
+  if (isset($_POST['interval']) && intval($_POST['interval'])) {
+    variable_set('watchdog_live_interval', $_POST['interval']);
   }
 
   // Allow user's to turn off live updating for a session.
