Index: worklogplugin/0.10/worklog/api.py
===================================================================
--- worklogplugin/0.10/worklog/api.py	(revision 2550)
+++ worklogplugin/0.10/worklog/api.py	(working copy)
@@ -42,7 +42,8 @@
             ticket integer,
             lastchange integer,
             starttime integer,
-            endtime integer
+            endtime integer,
+            comment text
             );
             """
             dbhelper.execute_non_query(self.env.get_db_cnx(), sql)
@@ -60,7 +61,7 @@
         when = int(time.time())
         sql = """
         INSERT INTO wiki (name,version,time,author,ipnr,text,comment,readonly)
-        VALUES ( %s, %s, %s, 'Timing and Estimation Plugin', '127.0.0.1', %s,'',0)
+        VALUES ( %s, %s, %s, 'WorkLog Plugin', '127.0.0.1', %s,'',0)
         """
         dbhelper.execute_non_query(self.env.get_db_cnx(),sql,
                                    user_manual_wiki_title,
Index: worklogplugin/0.10/worklog/manager.py
===================================================================
--- worklogplugin/0.10/worklog/manager.py	(revision 2550)
+++ worklogplugin/0.10/worklog/manager.py	(working copy)
@@ -81,7 +81,7 @@
         self.now += 1
         
 
-    def start_work(self, ticket):
+    def start_work(self, ticket, comment):
 
         if not self.can_work_on(ticket):
             return False
@@ -128,15 +128,15 @@
             # point is if there is no active task... which is the desired scenario :)
             self.stop_work()
             self.explanation = ''
-            
+ 
         cursor = db.cursor()
-        cursor.execute('INSERT INTO work_log (user, ticket, lastchange, starttime, endtime) '
-                       'VALUES (%s, %s, %s, %s, %s)',
-                       (self.authname, ticket, self.now, self.now, 0))
+        cursor.execute('INSERT INTO work_log (user, ticket, lastchange, starttime, endtime, comment) '
+                       'VALUES (%s, %s, %s, %s, %s, %s)',
+                       (self.authname, ticket, self.now, self.now, 0, comment))
         return True
 
     
-    def stop_work(self, stoptime=None):
+    def stop_work(self, stoptime=None, comment=''):
         active = self.get_active_task()
         if not active:
             self.explanation = 'You cannot stop working as you appear to be a complete slacker already!'
@@ -157,18 +157,19 @@
         db = self.env.get_db_cnx();
         cursor = db.cursor()
         cursor.execute('UPDATE work_log '
-                       'SET endtime=%s, lastchange=%s '
+                       'SET endtime=%s, lastchange=%s, comment=%s '
                        'WHERE user=%s AND lastchange=%s AND endtime=0',
-                       (stoptime, stoptime, self.authname, active['lastchange']))
+                       (stoptime, stoptime, comment, self.authname, active['lastchange']))
 
         message = ''
         if self.config.getbool('worklog', 'comment'):
             started = datetime.fromtimestamp(active['starttime'])
             finished = datetime.fromtimestamp(stoptime)
-            message = '%s worked on this ticket for %s between %s %s and %s %s' % \
+            message = '%s worked on this ticket for %s between %s %s and %s %s.  "%s"' % \
                       (self.authname, pretty_timedelta(started, finished), \
                        format_date(active['starttime']), format_time(active['starttime']), \
-                       format_date(stoptime), format_time(stoptime))
+                       format_date(stoptime), format_time(stoptime), \
+                       comment)
         if self.config.getbool('worklog', 'timingandestimation') and \
                self.config.get('ticket-custom', 'hours'):
             if not message:
@@ -184,7 +185,9 @@
             
             db = self.env.get_db_cnx()
             tckt = Ticket(self.env, active['ticket'], db)
-            tckt['hours'] = str(float(delta) / 60)
+            # This hideous hack is here because I don't yet know how to do variable-DP rounding in python - sorry!
+            # It's meant to round to 2 DP, so please replace it if you know how.  Many thanks, MK.
+            tckt['hours'] = str(float(int(100 * float(delta) / 60) / 100.0))
             self.save_ticket(tckt, db, message)
             message = ''
 
@@ -224,18 +227,19 @@
         lastchange = row[0]
     
         task = {}
-        cursor.execute('SELECT wl.user, wl.ticket, t.summary, wl.lastchange, wl.starttime, wl.endtime '
+        cursor.execute('SELECT wl.user, wl.ticket, t.summary, wl.lastchange, wl.starttime, wl.endtime, wl.comment '
                        'FROM work_log wl '
                        'LEFT JOIN ticket t ON wl.ticket=t.id '
                        'WHERE wl.user=%s AND wl.lastchange=%s', (self.authname, lastchange))
 
-        for user,ticket,summary,lastchange,starttime,endtime in cursor:
+        for user,ticket,summary,lastchange,starttime,endtime,comment in cursor:
             task['user'] = user
             task['ticket'] = ticket
             task['summary'] = summary
             task['lastchange'] = float(lastchange)
             task['starttime'] = float(starttime)
             task['endtime'] = float(endtime)
+            task['comment'] = comment
         return task
     
     def get_active_task(self):
Index: worklogplugin/0.10/worklog/webui.py
===================================================================
--- worklogplugin/0.10/worklog/webui.py	(revision 2550)
+++ worklogplugin/0.10/worklog/webui.py	(working copy)
@@ -39,38 +39,52 @@
     def get_worklog(self, req):
         db = self.env.get_db_cnx()
         cursor = db.cursor()
-        cursor.execute('SELECT wl.user, s.value, wl.starttime, wl.endtime, wl.ticket, t.summary '
-                       'FROM (SELECT user,MAX(lastchange) lastchange FROM work_log GROUP BY user) wlt '
-                       'LEFT JOIN work_log wl ON wlt.user=wl.user AND wlt.lastchange=wl.lastchange '
+        cursor.execute(#'SELECT wl.user, s.value, wl.starttime, wl.endtime, wl.ticket, wl.comment, t.summary '
+                        'SELECT wl.user, wl.starttime, wl.endtime, wl.ticket, wl.comment, t.summary '
+                        'FROM work_log wl '
+                       #'FROM (SELECT user,MAX(lastchange) lastchange FROM work_log GROUP BY user) wlt '
+                       #'LEFT JOIN work_log wl ON wlt.user=wl.user AND wlt.lastchange=wl.lastchange '
                        'LEFT JOIN ticket t ON wl.ticket=t.id '
-                       'LEFT JOIN session_attribute s ON wl.user=s.sid AND s.name=\'name\' '
+                       #'LEFT JOIN session_attribute s ON wl.user=s.sid AND s.name=\'name\' '
+                       #'LEFT JOIN session_attribute s ON wl.user=s.sid '
                        'ORDER BY wl.lastchange DESC, wl.user')
 
-        log = {}
-        for (user,name,starttime,endtime,ticket,summary) in cursor:
+        log = []
+        #for (user,name,starttime,endtime,ticket,comment,summary) in cursor:
+        for (user,starttime,endtime,ticket,comment,summary) in cursor:
             starttime = float(starttime)
             endtime = float(endtime)
             
             started = datetime.fromtimestamp(starttime)
 
             dispname = user
-            if name:
-                dispname = '%s (%s)' % (name, user)
-            log[user] = { "name": dispname,
+            #if name:
+            #    dispname = '%s (%s)' % (name, user)
+                        
+            finished = ''
+            delta = ''
+            if not endtime == 0:
+                finished = datetime.fromtimestamp(endtime)
+                delta = format_date(starttime) + " " + format_time(starttime) + " - " + format_date(endtime) + " " + format_time(endtime) + " (" + pretty_timedelta(started, finished) + ")"
+            else:
+                delta = 'Started ' + format_date(starttime) + " " + format_time(starttime) + " (" + pretty_timedelta(started) + " ago)",
+
+            minutes_elapsed = 0
+            diff = finished - started
+            age_s = float(diff.days * 86400 + diff.seconds)
+            age_m_10 = int(age_s / 6.0)
+            age_m = str(float(age_m_10 / 10.0))
+    
+            log.append({ "name": dispname,
                           "ticket": ticket,
                           "ticket_url": req.href.ticket(ticket),
+                          "comment": comment,
                           "summary": summary,
                           "started": started,
-                          "delta": 'Started ' + format_date(starttime) + " " + format_time(starttime) + \
-                                   " (" + pretty_timedelta(started) + " ago)"
-                          }
-
-            if not endtime == 0:
-                finished = datetime.fromtimestamp(endtime)
-                log[user]["finished"] = finished
-                log[user]["delta"] = 'Worked on from ' + format_date(starttime) + " " + format_time(starttime) + " - " + format_date(endtime) + " " + format_time(endtime) + \
-                                   " (" + pretty_timedelta(started, finished) + ")"
-
+                          "delta": delta,
+                          "finished": finished,
+                          "minutes_elapsed": age_m
+                          })
                 
         return log
         
@@ -92,19 +106,32 @@
         if req.method == 'POST':
             mgr = WorkLogManager(self.env, self.config, req.authname)
             if req.args.has_key('startwork') and req.args.has_key('ticket'):
-                if not mgr.start_work(req.args['ticket']):
+                if req.args.has_key('comment'):
+                    comment = req.args['comment']
+                else:
+                    comment = ''
+                
+                if not mgr.start_work(req.args['ticket'], comment):
                     addMessage(mgr.get_explanation())
                 else:
                     addMessage('You are now working on ticket #%s.' % (req.args['ticket'],))
+                
+                req.redirect(req.args['source_url'])
+                return None
+                
             elif req.args.has_key('stopwork'):
                 stoptime = None
                 if req.args.has_key('stoptime'):
                     stoptime = int(req.args['stoptime'])
-                if not mgr.stop_work(stoptime):
+                if not mgr.stop_work(stoptime, req.args['comment']):
                     addMessage(mgr.get_explanation())
                 else:
                     addMessage('You have stopped working.')
+                
+                req.redirect(req.args['source_url'])
+                return None
         
+        # no POST, so they're just wanting a list of the worklog entries
         req.hdf["worklog"] = {"messages": messages,
                               "worklog": self.get_worklog(req),
                               "href":req.href.worklog(),
Index: worklogplugin/0.10/worklog/usermanual.py
===================================================================
--- worklogplugin/0.10/worklog/usermanual.py	(revision 2550)
+++ worklogplugin/0.10/worklog/usermanual.py	(working copy)
@@ -2,9 +2,16 @@
 user_manual_version = 1
 user_manual_wiki_title = "WorkLogPluginUserManual"
 user_manual_content = """
-= Timing and Estimation Plugin User Manual =
+= WorkLog Plugin User Manual =
+This is a plugin that adds a Work Log capability to Trac.
 
-This plugin provides a way to register which ticket you are currently working on. By doing this you keep the rest of your team in the loop so as to reduce the duplication of work.
+Basically, it allows you to register the fact you have started work on a ticket which effectively allows you to clock on and clock off.
 
-It provides an extension to the XMLRPC plugin which allows the integration with Desktop applications which makes interaction with this plugin seemless
+It uses javascript to add a button to the ticket page to allow you to start/stop working on a given ticket.
+
+If the TimingAndEstimationPlugin is installed then when you clock off, the time spent on the ticket will be recorded.
+
+If you visit the Work Log page (a new navigation entry), you will see a list of people (developers) and which tickets they are currently working on. Work log events are also logged to the Timeline for a historical view. 
+
+It provides an extension to the XMLRPC plugin which allows the integration with Desktop applications which makes interaction with this plugin seemless.
 """
Index: worklogplugin/0.10/worklog/htdocs/worklogplugin.css
===================================================================
--- worklogplugin/0.10/worklog/htdocs/worklogplugin.css	(revision 2550)
+++ worklogplugin/0.10/worklog/htdocs/worklogplugin.css	(working copy)
@@ -1,13 +1,23 @@
 #content.worklog
 {
-  width: 100%;
+  /*width: 100%;*/
 }
 #worklogmanual
 {
   display: block;
   float: right;
 }
-
+#worklog_comment {
+	font-size: 70%;
+    color: green;
+}
+#worklog_time_delta {
+	font-size: 70%;
+    color: green;
+}
+table#worklog_report {
+    width: 100%;
+}
 #content.worklog table th
 {
   background: #f7f7f7;
Index: worklogplugin/0.10/worklog/uihooks_ticket.py
===================================================================
--- worklogplugin/0.10/worklog/uihooks_ticket.py	(revision 2550)
+++ worklogplugin/0.10/worklog/uihooks_ticket.py	(working copy)
@@ -63,23 +63,47 @@
         return script;
 
 
-    def get_button_js(self, req, ticket, stop=False):
+    def get_button_js(self, req, ticket, stop=False, comment=''):
         script = """
   var f = document.createElement('form');
   d.appendChild(f);
   f.setAttribute('method', 'POST');
   f.setAttribute('action', '""" + req.href.worklog() + """')
   f.setAttribute('class', 'inlinebuttons');
+  
+  var h_url = document.createElement('input');
+  h_url.setAttribute('type', 'hidden');
+  h_url.setAttribute('name', 'source_url');
+  h_url.setAttribute('value', location.pathname);
+  f.appendChild(h_url);
+  
   var h = document.createElement('input');
   h.setAttribute('type', 'hidden');
   h.setAttribute('name', 'ticket');
   h.setAttribute('value', '""" + str(ticket) + """');
   f.appendChild(h);
+  
   var h2 = document.createElement('input');
   h2.setAttribute('type', 'hidden');
   h2.setAttribute('name', '__FORM_TOKEN');
   h2.setAttribute('value', '""" + str(req.incookie['trac_form_token'].value) + """');
-  f.appendChild(h2);
+  f.appendChild(h2);"""
+  
+        if stop:
+            script += """
+  var s_comment_label = document.createElement('span');
+  s_comment_label.id = 'worklog_comment';
+  s_comment_label.innerHTML = 'Comment: ';
+  f.appendChild(s_comment_label);
+  
+  var s_comment = document.createElement('input');
+  s_comment.type = 'text';
+  s_comment.size = '50';
+  s_comment.name = 'comment';
+  s_comment.value = '""" + comment + """';
+  f.appendChild(s_comment);"""
+  
+        script += """
   var s = document.createElement('input');
   s.setAttribute('type', 'submit');"""
         if stop:
@@ -135,10 +159,12 @@
 
             mgr = WorkLogManager(self.env, self.config, req.authname)
             task_js = ''
+            comment = ''
             if req.authname != 'anonymous':
                 task = mgr.get_active_task()
                 if task:
                     task_js = self.get_task_js(req, ticket, task)
+                    comment = task['comment']
 
             who,since = mgr.who_is_working_on(ticket)
             ticket_js = ''
@@ -155,7 +181,7 @@
                     # Display a "Work on Link" button.
                     button_js = self.get_button_js(req, ticket)
                 elif task and task['ticket'] == ticket:
-                    # We are currnetly working on this, so display the stop button...
-                    button_js = self.get_button_js(req, ticket, True)
+                    # We are currently working on this, so display the stop button...
+                    button_js = self.get_button_js(req, ticket, True, comment)
 
             yield 'mainnav', 'ticket-worklog-addon', self.get_javascript(task_js, ticket_js, button_js)
Index: worklogplugin/0.10/worklog/timeline_hook.py
===================================================================
--- worklogplugin/0.10/worklog/timeline_hook.py	(revision 2550)
+++ worklogplugin/0.10/worklog/timeline_hook.py	(working copy)
@@ -27,15 +27,15 @@
             db = self.env.get_db_cnx()
             cursor = db.cursor()
 
-            cursor.execute("""SELECT wl.user,wl.ticket,wl.time,wl.starttime,wl.kind,wl.humankind,t.summary
+            cursor.execute("""SELECT wl.user,wl.ticket,wl.time,wl.starttime,wl.comment,wl.kind,wl.humankind,t.summary
                              FROM (
                              
-                             SELECT user, ticket, starttime AS time, starttime, 'workstart' AS kind, 'started' AS humankind
+                             SELECT user, ticket, starttime AS time, starttime, comment, 'workstart' AS kind, 'started' AS humankind
                              FROM work_log
 
                              UNION
 
-                             SELECT user, ticket, endtime AS time, starttime, 'workstop' AS kind, 'stopped' AS humankind
+                             SELECT user, ticket, endtime AS time, starttime, comment, 'workstop' AS kind, 'stopped' AS humankind
                              FROM work_log
 
                              ) AS wl
@@ -44,17 +44,17 @@
                            ORDER BY wl.time"""
                            % (start, stop))
             previous_update = None
-            for user,ticket,time,starttime,kind,humankind,summary in cursor:
+            for user,ticket,time,starttime,comment,kind,humankind,summary in cursor:
                 summary = Markup.escape(summary)
                 time = float(time)
                 starttime = float(starttime)
                 
                 if format == 'rss':
-                    title = Markup('%s %s working on Ticket #%s (%s)' % \
-                                   (user, humankind, ticket, summary))
+                    title = Markup('%s %s working on Ticket #%s (%s): <span id="worklog_comment">%s</span>' % \
+                                   (user, humankind, ticket, summary, comment))
                 else:
-                    title = Markup('%s %s working on Ticket <em title="%s">#%s</em>' % \
-                                   (user, humankind, summary, ticket))
+                    title = Markup('%s %s working on Ticket <em title="%s">#%s</em>: <span id="worklog_comment">%s</span>' % \
+                                   (user, humankind, summary, ticket, comment))
                 message = ''
                 if kind == 'workstop':
                     started = datetime.fromtimestamp(starttime)
Index: worklogplugin/0.10/worklog/templates/worklog.cs
===================================================================
--- worklogplugin/0.10/worklog/templates/worklog.cs	(revision 2550)
+++ worklogplugin/0.10/worklog/templates/worklog.cs	(working copy)
@@ -1,20 +1,20 @@
-<?cs include "header.cs"?>
-<?cs include "macros.cs"?>
+<link rel="stylesheet" href="/chrome/worklog/worklogplugin.css" type="text/css" />
 
 <form method="post" action="<?cs var:worklog.href ?>" >
 <div id="content" class="worklog">
-  <a id="worklogmanual" href="<?cs var:worklog.usermanual_href ?>" ><?cs var:worklog.usermanual_title ?></a>
   <div id="messages" >
     <?cs each:item = worklog.messages ?>
       <div class="message" ><?cs var:item ?></div>
     <?cs /each ?>
   </div>
 
-  <table border="0" cellspacing="0" cellpadding="0">
+  <table border="0" cellspacing="0" cellpadding="0" id="worklog_report">
     <tr>
       <th>User</th>
       <th>Activity</th>
       <th>Last Change</th>
+      <th style="text-align:right">Minutes</th>
+      <th>Comment</th>
     </tr>
     <?cs each:log = worklog.worklog ?>
     <tr>
@@ -22,12 +22,14 @@
       <?cs if:log.finished == #0 ?>
       <td><a href="<?cs var:log.ticket_url ?>">#<?cs var:log.ticket ?></a>: <?cs var:log.summary ?></td>
       <?cs else ?>
-      <td><em>Idle</em> <small>(Last worked on: <a href="<?cs var:log.ticket_url ?>">#<?cs var:log.ticket ?></a>: <?cs var:log.summary ?>)</small></td>      
+      <td><a href="<?cs var:log.ticket_url ?>">#<?cs var:log.ticket ?></a>:<small><?cs var:log.summary ?></small></td>
       <?cs /if ?>
-      <td><?cs var:log.delta ?></td>
+      <td><span id="worklog_time_delta"><?cs var:log.delta ?></span></td>
+      <td style="text-align:right"><span id="worklog_time_delta"><?cs var:log.minutes_elapsed ?></span></td>
+      <td><span id="worklog_comment"><?cs var:log.comment ?></span></td>
     </tr>
     <?cs /each ?>
   </table>
 </div>
+<a id="worklogmanual" href="<?cs var:worklog.usermanual_href ?>" ><?cs var:worklog.usermanual_title ?></a>
 </form>
-<?cs include "footer.cs"?>
