Changeset 2553
- Timestamp:
- 08/08/07 03:04:48 (1 year ago)
- Files:
-
- worklogplugin/0.10/worklog/templates/worklog.cs (modified) (1 diff)
- worklogplugin/0.10/worklog/webui.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
worklogplugin/0.10/worklog/templates/worklog.cs
r2552 r2553 33 33 </div> 34 34 </form> 35 36 <div id="altlinks"> <h3>Download in other formats:</h3><ul><li class="first last"><a href="?format=csv" class="csv">CSV</a></li></ul></div> 37 35 38 <?cs include "footer.cs"?> worklogplugin/0.10/worklog/webui.py
r2552 r2553 94 94 def worklog_csv(self, req): 95 95 # Headers 96 req.write('user,full_name,starttime,endtime,ticket,ticket_summary,work_comment') 97 req.write(CRLF) 96 sep=',' 97 req.write(sep.join(['user', 98 'full_name', 99 'starttime', 100 'endtime', 101 'ticket', 102 'ticket_summary', 103 'work_comment']) + CRLF) 98 104 99 105 # Rows 100 106 db = self.env.get_db_cnx() 101 107 cursor = db.cursor() 102 cursor.execute('SELECT wl.user, s.value, wl.starttime, wl.endtime, wl.ticket, wl.comment, t.summary'108 cursor.execute('SELECT wl.user, s.value, wl.starttime, wl.endtime, wl.ticket, t.summary, wl.comment ' 103 109 'FROM work_log wl ' 104 110 'LEFT JOIN ticket t ON wl.ticket=t.id ' 105 111 'LEFT JOIN session_attribute s ON wl.user=s.sid AND s.name=\'name\' ' 106 112 'ORDER BY wl.lastchange DESC, wl.user') 107 for (user,name,starttime,endtime,ticket,comment,summary) in cursor:108 if not comment:109 comment = ''110 111 req.write(user + ',')112 req.write(name + ',')113 req.write(str(starttime) + ',')114 req.write(str(endtime) + ',')115 req.write(str(ticket) + ',')116 req.write(summary + ',')117 req.write(comment)118 req.write(CRLF)119 113 114 for row in cursor: 115 req.write(sep.join([str(item) 116 .replace(sep, '_').replace('\\', '\\\\') 117 .replace('\n', '\\n').replace('\r', '\\r') 118 for item in row]) + CRLF) 120 119 121 120 … … 136 135 137 136 if req.args.has_key('format') and req.args['format'] == 'csv': 138 req.send_header('Content-Type', 'text/ plain;charset=utf-8')137 req.send_header('Content-Type', 'text/csv;charset=utf-8') 139 138 self.worklog_csv(req) 140 139 return None
