keithsalisbury-subtrac 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/bin/subtrac +2 -0
- data/lib/subtrac.rb +85 -50
- data/lib/subtrac/config/config.yml +22 -19
- data/lib/subtrac/templates/location.erb +2 -2
- data/lib/subtrac/templates/projects/blank/trac/wiki/WikiStart +1 -1
- data/lib/subtrac/templates/trac.erb +1 -1
- data/lib/subtrac/templates/vhost.erb +6 -6
- metadata +1 -105
- data/lib/subtrac/trac-plugins/advancedticketworkflowplugin/advancedworkflow/__init__.py +0 -0
- data/lib/subtrac/trac-plugins/advancedticketworkflowplugin/advancedworkflow/controller.py +0 -419
- data/lib/subtrac/trac-plugins/advancedticketworkflowplugin/setup.cfg +0 -3
- data/lib/subtrac/trac-plugins/advancedticketworkflowplugin/setup.py +0 -20
- data/lib/subtrac/trac-plugins/clientsplugin/clients/__init__.py +0 -0
- data/lib/subtrac/trac-plugins/clientsplugin/clients/action.py +0 -28
- data/lib/subtrac/trac-plugins/clientsplugin/clients/action_email.py +0 -168
- data/lib/subtrac/trac-plugins/clientsplugin/clients/action_zendesk_forum.py +0 -137
- data/lib/subtrac/trac-plugins/clientsplugin/clients/admin.py +0 -91
- data/lib/subtrac/trac-plugins/clientsplugin/clients/api.py +0 -199
- data/lib/subtrac/trac-plugins/clientsplugin/clients/client.py +0 -105
- data/lib/subtrac/trac-plugins/clientsplugin/clients/events.py +0 -287
- data/lib/subtrac/trac-plugins/clientsplugin/clients/eventsadmin.py +0 -71
- data/lib/subtrac/trac-plugins/clientsplugin/clients/htdocs/clients.css +0 -4
- data/lib/subtrac/trac-plugins/clientsplugin/clients/model.py +0 -135
- data/lib/subtrac/trac-plugins/clientsplugin/clients/processor.py +0 -70
- data/lib/subtrac/trac-plugins/clientsplugin/clients/reportmanager.py +0 -142
- data/lib/subtrac/trac-plugins/clientsplugin/clients/reports.py +0 -231
- data/lib/subtrac/trac-plugins/clientsplugin/clients/summary.py +0 -27
- data/lib/subtrac/trac-plugins/clientsplugin/clients/summary_milestone.py +0 -152
- data/lib/subtrac/trac-plugins/clientsplugin/clients/summary_ticketchanges.py +0 -160
- data/lib/subtrac/trac-plugins/clientsplugin/clients/templates/admin_client_events.html +0 -124
- data/lib/subtrac/trac-plugins/clientsplugin/clients/templates/admin_clients.html +0 -134
- data/lib/subtrac/trac-plugins/clientsplugin/cron/changes.xslt +0 -132
- data/lib/subtrac/trac-plugins/clientsplugin/cron/run-client-event +0 -97
- data/lib/subtrac/trac-plugins/clientsplugin/cron/summary.xslt +0 -161
- data/lib/subtrac/trac-plugins/clientsplugin/setup.py +0 -43
- data/lib/subtrac/trac-plugins/estimationtoolsplugin/estimationtools/__init__.py +0 -4
- data/lib/subtrac/trac-plugins/estimationtoolsplugin/estimationtools/burndownchart.py +0 -273
- data/lib/subtrac/trac-plugins/estimationtoolsplugin/estimationtools/hoursinplaceeditor.py +0 -44
- data/lib/subtrac/trac-plugins/estimationtoolsplugin/estimationtools/hoursremaining.py +0 -36
- data/lib/subtrac/trac-plugins/estimationtoolsplugin/estimationtools/htdocs/jquery-1.2.3.min.js +0 -32
- data/lib/subtrac/trac-plugins/estimationtoolsplugin/estimationtools/htdocs/jquery.jeditable.js +0 -409
- data/lib/subtrac/trac-plugins/estimationtoolsplugin/estimationtools/htdocs/jquery.jeditable.mini.js +0 -30
- data/lib/subtrac/trac-plugins/estimationtoolsplugin/estimationtools/templates/edithours.html +0 -53
- data/lib/subtrac/trac-plugins/estimationtoolsplugin/estimationtools/tests/burndownchart.py +0 -181
- data/lib/subtrac/trac-plugins/estimationtoolsplugin/estimationtools/tests/hoursremaining.py +0 -66
- data/lib/subtrac/trac-plugins/estimationtoolsplugin/estimationtools/tests/workloadchart.py +0 -47
- data/lib/subtrac/trac-plugins/estimationtoolsplugin/estimationtools/utils.py +0 -93
- data/lib/subtrac/trac-plugins/estimationtoolsplugin/estimationtools/workloadchart.py +0 -86
- data/lib/subtrac/trac-plugins/estimationtoolsplugin/setup.py +0 -20
- data/lib/subtrac/trac-plugins/timingandestimationplugin/scripts/SumRollups.js +0 -23
- data/lib/subtrac/trac-plugins/timingandestimationplugin/scripts/adw_tracdb.py +0 -128
- data/lib/subtrac/trac-plugins/timingandestimationplugin/scripts/git-post-receive +0 -40
- data/lib/subtrac/trac-plugins/timingandestimationplugin/scripts/trac-post-commit.py +0 -285
- data/lib/subtrac/trac-plugins/timingandestimationplugin/scripts/trac_billing.py +0 -173
- data/lib/subtrac/trac-plugins/timingandestimationplugin/scripts/utils/__init__.py +0 -0
- data/lib/subtrac/trac-plugins/timingandestimationplugin/scripts/utils/mail.py +0 -164
- data/lib/subtrac/trac-plugins/timingandestimationplugin/setup.py +0 -69
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/__init__.py +0 -1
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/api.py +0 -292
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/blackmagic.py +0 -172
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/dbhelper.py +0 -178
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/htdocs/billingplugin.css +0 -25
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/htdocs/field_disabler.js +0 -6
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/htdocs/formatDate.js +0 -356
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/htdocs/js/tip_centerwindow.js +0 -100
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/htdocs/js/tip_followscroll.js +0 -84
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/htdocs/js/wz_tooltip.js +0 -1149
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/htdocs/linkifyer.js +0 -119
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/htdocs/query.js +0 -73
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/htdocs/ticket.js +0 -165
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/query_webui.py +0 -28
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/reportmanager.py +0 -221
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/reports.py +0 -675
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/reports_filter.py +0 -150
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/statuses.py +0 -25
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/tande_filters.py +0 -131
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/templates/billing.cs +0 -84
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/templates/billing.html +0 -104
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/ticket_daemon.py +0 -194
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/ticket_policy.py +0 -62
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/ticket_webui.py +0 -28
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/usermanual.py +0 -127
- data/lib/subtrac/trac-plugins/timingandestimationplugin/timingandestimationplugin/webui.py +0 -129
- data/lib/subtrac/trac-plugins/worklogplugin/setup.py +0 -29
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/__init__.py +0 -1
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/api.py +0 -187
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/htdocs/jqModal.css +0 -40
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/htdocs/jqModal.js +0 -67
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/htdocs/jquery.mousewheel.pack.js +0 -12
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/htdocs/jquery.timeentry.pack.js +0 -7
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/htdocs/tracWorklog.js +0 -40
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/htdocs/ui.datepicker.css +0 -208
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/htdocs/ui.datepicker.js +0 -1439
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/htdocs/work.png +0 -0
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/htdocs/work.xcf +0 -0
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/htdocs/worklogplugin.css +0 -80
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/htdocs/workstart.png +0 -0
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/htdocs/workstop.png +0 -0
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/manager.py +0 -336
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/reports.py +0 -598
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/templates/worklog.html +0 -45
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/templates/worklog_stop.html +0 -70
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/templates/worklog_user.html +0 -40
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/templates/worklog_webadminui.html +0 -59
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/ticket_daemon.py +0 -33
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/ticket_filter.py +0 -153
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/timeline_hook.py +0 -96
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/usermanual.py +0 -29
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/util.py +0 -31
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/webadminui.py +0 -47
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/webui.py +0 -174
- data/lib/subtrac/trac-plugins/worklogplugin/worklog/xmlrpc.py +0 -73
@@ -1,29 +0,0 @@
|
|
1
|
-
user_manual_title = "Work Log Plugin User Manual"
|
2
|
-
user_manual_version = 3
|
3
|
-
user_manual_wiki_title = "WorkLogPluginUserManual"
|
4
|
-
user_manual_content = """
|
5
|
-
= !WorkLog Plugin User Manual =
|
6
|
-
This is a plugin that adds a Work Log capability to Trac.
|
7
|
-
|
8
|
-
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.
|
9
|
-
|
10
|
-
== General stuff ==
|
11
|
-
The !WorkLog Plugin uses javascript to add a button to the ticket page to allow you to start/stop working on a given ticket.
|
12
|
-
|
13
|
-
If the [http://trac-hacks.org/wiki/TimingAndEstimationPlugin TimingAndEstimationPlugin] is installed then when you clock off, the time spent on the ticket will be recorded - but only if you explicitly enabled this on the [/admin/ticket/worklog plugins admin page].
|
14
|
-
|
15
|
-
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.
|
16
|
-
|
17
|
-
In the future it will also provide an extension to the XMLRPC plugin which allows the integration with Desktop applications which will make interaction with this plugin seemless.
|
18
|
-
|
19
|
-
== Configuration ==
|
20
|
-
Configuration can be done on the plugins [/admin/ticket/worklog admin page] - or directly in the `trac.ini`. The following options are available:
|
21
|
-
|
22
|
-
||'''Option'''||'''`trac.ini`'''||'''description'''||
|
23
|
-
||Record time via Timing and Estimation Plugin?||timingandestimation = True|__False__||Whether to update the corresponding fields of the Timing and Estimation Plugin. By default, this is disabled. And of course, enabling this would require the [http://trac-hacks.org/wiki/TimingAndEstimationPlugin Timing and Estimation Plugin] to be installed and enabled.||
|
24
|
-
||Automatically add a comment when you stop work on a ticket?||comment = True|__False__||As it says: This will automatically add a comment even if you provide none.||
|
25
|
-
||Stop work automatically if ticket is closed?||autostop = True|__False__||Usually, you explicitly have to stop work on a ticket. But it's quite handy to do this automatically when closing the ticket (usually, you stop work then). But sometimes you just want to declare e.g. a bug fixed by closing the ticket, while stop working only after having documented your changes somewhere else - so it's up to you how it should be done.||
|
26
|
-
||Automatically reassign and accept (if necessary) when starting work?||autoreassignaccept = True|__False__||May ease the take-over of a ticket||
|
27
|
-
||Allow users to start working on a different ticket (i.e. automatically stop working on current ticket)?||autostopstart = True|__False__||If you switch to a new ticket, you usually stop working on the first one. So this saves you from doing so manually.||
|
28
|
-
||Round up to nearest minute||roundup = <n>||By default, time is rounded up to the full minute. If you want to round up to the next 15min interval, put a 15 here. To only have full hours logged, chose 60. But keep in mind, that a work of 1 minute will always be rounded up to the value defined here - so if rounding up to the full hour, a work of 1 minute will be recorded as 1 hour. Handy to increase your payment ;)||
|
29
|
-
"""
|
@@ -1,31 +0,0 @@
|
|
1
|
-
from datetime import datetime
|
2
|
-
|
3
|
-
# Stolen from Trac trunk :)
|
4
|
-
def pretty_timedelta(time1, time2=None):
|
5
|
-
"""Calculate time delta (inaccurately, only for decorative purposes ;-) for
|
6
|
-
prettyprinting. If time1 is None, the current time is used."""
|
7
|
-
if not time1: time1 = datetime.now()
|
8
|
-
if not time2: time2 = datetime.now()
|
9
|
-
if time1 > time2:
|
10
|
-
time2, time1 = time1, time2
|
11
|
-
units = ((3600 * 24 * 365, 'year', 'years'),
|
12
|
-
(3600 * 24 * 30, 'month', 'months'),
|
13
|
-
(3600 * 24 * 7, 'week', 'weeks'),
|
14
|
-
(3600 * 24, 'day', 'days'),
|
15
|
-
(3600, 'hour', 'hours'),
|
16
|
-
(60, 'minute', 'minutes'))
|
17
|
-
diff = time2 - time1
|
18
|
-
age_s = int(diff.days * 86400 + diff.seconds)
|
19
|
-
if age_s < 60:
|
20
|
-
return 'less than a minute'
|
21
|
-
rv = ''
|
22
|
-
for u, unit, unit_plural in units:
|
23
|
-
r = int(float(age_s) / float(u))
|
24
|
-
if r > 0:
|
25
|
-
tmp_rv = '%d %s' % (r, r == 1 and unit or unit_plural)
|
26
|
-
if rv:
|
27
|
-
rv += ', '
|
28
|
-
rv += tmp_rv
|
29
|
-
age_s = float(age_s) - (r * float(u))
|
30
|
-
return rv
|
31
|
-
|
@@ -1,47 +0,0 @@
|
|
1
|
-
import time
|
2
|
-
|
3
|
-
from trac import ticket
|
4
|
-
from trac import util
|
5
|
-
from trac.core import *
|
6
|
-
from trac.perm import IPermissionRequestor, PermissionSystem
|
7
|
-
from trac.util import Markup
|
8
|
-
from trac.ticket.admin import TicketAdminPanel
|
9
|
-
|
10
|
-
|
11
|
-
class WorklogAdminPanel(TicketAdminPanel):
|
12
|
-
_type = 'worklog'
|
13
|
-
_label = ('Work Log', 'Work Log')
|
14
|
-
|
15
|
-
def _render_admin_panel(self, req, cat, page, component):
|
16
|
-
req.perm.require('TICKET_ADMIN') and req.perm.require('WORK_ADMIN')
|
17
|
-
|
18
|
-
bools = [ "timingandestimation", "comment",
|
19
|
-
"autostop", "autostopstart", "autoreassignaccept" ]
|
20
|
-
|
21
|
-
if req.method == 'POST' and req.args.has_key('update'):
|
22
|
-
for yesno in bools:
|
23
|
-
if req.args.has_key(yesno):
|
24
|
-
self.config.set(self._type, yesno, True)
|
25
|
-
else:
|
26
|
-
self.config.set(self._type, yesno, False)
|
27
|
-
roundup = 1
|
28
|
-
if req.args.has_key('roundup'):
|
29
|
-
try:
|
30
|
-
if int(req.args.get('roundup')) > 0:
|
31
|
-
roundup = int(req.args.get('roundup'))
|
32
|
-
except:
|
33
|
-
pass
|
34
|
-
self.config.set(self._type, 'roundup', roundup)
|
35
|
-
|
36
|
-
self.config.save()
|
37
|
-
|
38
|
-
settings = {}
|
39
|
-
for yesno in bools:
|
40
|
-
if self.config.getbool(self._type, yesno):
|
41
|
-
settings[yesno] = 'checked'
|
42
|
-
|
43
|
-
if self.config.getint(self._type, 'roundup'):
|
44
|
-
settings['roundup'] = self.config.getint(self._type, 'roundup')
|
45
|
-
|
46
|
-
settings['view'] = 'settings'
|
47
|
-
return 'worklog_webadminui.html', settings
|
@@ -1,174 +0,0 @@
|
|
1
|
-
import re
|
2
|
-
from util import *
|
3
|
-
from time import time
|
4
|
-
from datetime import tzinfo, timedelta, datetime
|
5
|
-
from usermanual import *
|
6
|
-
from manager import WorkLogManager
|
7
|
-
from trac.log import logger_factory
|
8
|
-
from trac.core import *
|
9
|
-
from trac.perm import IPermissionRequestor
|
10
|
-
from trac.web import IRequestHandler, IRequestFilter
|
11
|
-
from trac.util.datefmt import format_date, format_time
|
12
|
-
from trac.util import Markup
|
13
|
-
from trac.ticket import Ticket
|
14
|
-
from trac.web.chrome import add_stylesheet, add_script, \
|
15
|
-
INavigationContributor, ITemplateProvider
|
16
|
-
from trac.web.href import Href
|
17
|
-
from trac.wiki.formatter import wiki_to_html
|
18
|
-
from trac.util.text import CRLF
|
19
|
-
|
20
|
-
class WorkLogPage(Component):
|
21
|
-
implements(IPermissionRequestor, INavigationContributor, IRequestHandler, ITemplateProvider)
|
22
|
-
|
23
|
-
def __init__(self):
|
24
|
-
pass
|
25
|
-
|
26
|
-
# IPermissionRequestor methods
|
27
|
-
def get_permission_actions(self):
|
28
|
-
return ['WORK_LOG', ('WORK_VIEW', ['WORK_LOG']), ('WORK_ADMIN', ['WORK_VIEW'])]
|
29
|
-
|
30
|
-
# INavigationContributor methods
|
31
|
-
def get_active_navigation_item(self, req):
|
32
|
-
return 'worklog'
|
33
|
-
|
34
|
-
def get_navigation_items(self, req):
|
35
|
-
url = req.href.worklog()
|
36
|
-
if req.perm.has_permission("WORK_VIEW"):
|
37
|
-
yield 'mainnav', "worklog", \
|
38
|
-
Markup('<a href="%s">%s</a>' % \
|
39
|
-
(url , "Work Log"))
|
40
|
-
|
41
|
-
# Internal Methods
|
42
|
-
def worklog_csv(self, req, log):
|
43
|
-
#req.send_header('Content-Type', 'text/plain')
|
44
|
-
req.send_header('Content-Type', 'text/csv;charset=utf-8')
|
45
|
-
req.send_header('Content-Disposition', 'filename=worklog.csv')
|
46
|
-
|
47
|
-
# Headers
|
48
|
-
fields = ['user',
|
49
|
-
'name',
|
50
|
-
'starttime',
|
51
|
-
'endtime',
|
52
|
-
'ticket',
|
53
|
-
'summary',
|
54
|
-
'comment']
|
55
|
-
sep=','
|
56
|
-
req.write(sep.join(fields) + CRLF)
|
57
|
-
|
58
|
-
# Rows
|
59
|
-
for row in log:
|
60
|
-
first = True
|
61
|
-
for field in fields:
|
62
|
-
if not first:
|
63
|
-
req.write(sep)
|
64
|
-
first = False
|
65
|
-
req.write(str(row[field])
|
66
|
-
.replace(sep, '_').replace('\\', '\\\\')
|
67
|
-
.replace('\n', '\\n').replace('\r', '\\r'))
|
68
|
-
req.write(CRLF)
|
69
|
-
|
70
|
-
# IRequestHandler methods
|
71
|
-
def match_request(self, req):
|
72
|
-
if re.search('^/worklog', req.path_info):
|
73
|
-
return True
|
74
|
-
return None
|
75
|
-
|
76
|
-
def process_request(self, req):
|
77
|
-
messages = []
|
78
|
-
|
79
|
-
def addMessage(s):
|
80
|
-
messages.extend([s]);
|
81
|
-
|
82
|
-
# General protection (not strictly needed if Trac behaves itself)
|
83
|
-
if not re.search('/worklog', req.path_info):
|
84
|
-
return None
|
85
|
-
|
86
|
-
add_stylesheet(req, "worklog/worklogplugin.css")
|
87
|
-
|
88
|
-
# Specific pages:
|
89
|
-
match = re.search('/worklog/users/(.*)', req.path_info)
|
90
|
-
if match:
|
91
|
-
mgr = WorkLogManager(self.env, self.config, match.group(1))
|
92
|
-
if req.args.has_key('format') and req.args['format'] == 'csv':
|
93
|
-
self.worklog_csv(req, mgr.get_work_log('user'))
|
94
|
-
return None
|
95
|
-
|
96
|
-
data = {"worklog": mgr.get_work_log('user'),
|
97
|
-
"ticket_href": req.href.ticket(),
|
98
|
-
"usermanual_href":req.href.wiki(user_manual_wiki_title),
|
99
|
-
"usermanual_title":user_manual_title
|
100
|
-
}
|
101
|
-
return 'worklog_user.html', data, None
|
102
|
-
|
103
|
-
match = re.search('/worklog/stop/([0-9]+)', req.path_info)
|
104
|
-
if match:
|
105
|
-
ticket = match.group(1)
|
106
|
-
data = {'worklog_href': req.href.worklog(),
|
107
|
-
'ticket_href': req.href.ticket(ticket),
|
108
|
-
'ticket': ticket,
|
109
|
-
'action': 'stop',
|
110
|
-
'label': 'Stop Work'}
|
111
|
-
xhr = req.get_header('X-Requested-With') == 'XMLHttpRequest'
|
112
|
-
if xhr:
|
113
|
-
data['xhr'] = True
|
114
|
-
return 'worklog_stop.html', data, None
|
115
|
-
|
116
|
-
mgr = WorkLogManager(self.env, self.config, req.authname)
|
117
|
-
if req.args.has_key('format') and req.args['format'] == 'csv':
|
118
|
-
self.worklog_csv(req, mgr.get_work_log())
|
119
|
-
return None
|
120
|
-
|
121
|
-
# Not any specific page, so process POST actions here.
|
122
|
-
if req.method == 'POST':
|
123
|
-
if req.args.has_key('startwork') and req.args.has_key('ticket'):
|
124
|
-
if not mgr.start_work(req.args['ticket']):
|
125
|
-
addMessage(mgr.get_explanation())
|
126
|
-
else:
|
127
|
-
addMessage('You are now working on ticket #%s.' % (req.args['ticket'],))
|
128
|
-
|
129
|
-
req.redirect(req.args['source_url'])
|
130
|
-
return None
|
131
|
-
|
132
|
-
elif req.args.has_key('stopwork'):
|
133
|
-
stoptime = None
|
134
|
-
if req.args.has_key('stoptime') and req.args['stoptime']:
|
135
|
-
stoptime = int(req.args['stoptime'])
|
136
|
-
|
137
|
-
comment = ''
|
138
|
-
if req.args.has_key('comment'):
|
139
|
-
comment = req.args['comment']
|
140
|
-
|
141
|
-
if not mgr.stop_work(stoptime, comment):
|
142
|
-
addMessage(mgr.get_explanation())
|
143
|
-
else:
|
144
|
-
addMessage('You have stopped working.')
|
145
|
-
|
146
|
-
req.redirect(req.args['source_url'])
|
147
|
-
return None
|
148
|
-
|
149
|
-
# no POST, so they're just wanting a list of the worklog entries
|
150
|
-
data = {"messages": messages,
|
151
|
-
"worklog": mgr.get_work_log('summary'),
|
152
|
-
"worklog_href": req.href.worklog(),
|
153
|
-
"ticket_href": req.href.ticket(),
|
154
|
-
"usermanual_href": req.href.wiki(user_manual_wiki_title),
|
155
|
-
"usermanual_title": user_manual_title
|
156
|
-
}
|
157
|
-
return 'worklog.html', data, None
|
158
|
-
|
159
|
-
|
160
|
-
# ITemplateProvider
|
161
|
-
def get_htdocs_dirs(self):
|
162
|
-
"""Return the absolute path of a directory containing additional
|
163
|
-
static resources (such as images, style sheets, etc).
|
164
|
-
"""
|
165
|
-
from pkg_resources import resource_filename
|
166
|
-
return [('worklog', resource_filename(__name__, 'htdocs'))]
|
167
|
-
|
168
|
-
def get_templates_dirs(self):
|
169
|
-
"""Return the absolute path of the directory containing the provided
|
170
|
-
ClearSilver templates.
|
171
|
-
"""
|
172
|
-
from pkg_resources import resource_filename
|
173
|
-
return [resource_filename(__name__, 'templates')]
|
174
|
-
|
@@ -1,73 +0,0 @@
|
|
1
|
-
import xmlrpclib
|
2
|
-
import posixpath
|
3
|
-
|
4
|
-
from manager import WorkLogManager
|
5
|
-
|
6
|
-
from trac.core import *
|
7
|
-
from trac.perm import IPermissionRequestor
|
8
|
-
from tracrpc.api import IXMLRPCHandler, expose_rpc
|
9
|
-
|
10
|
-
class WorlLogRPC(Component):
|
11
|
-
""" Interface to the [http://trac-hacks.org/wiki/WorkLogPlugin Work Log Plugin] """
|
12
|
-
implements(IXMLRPCHandler)
|
13
|
-
|
14
|
-
def __init__(self):
|
15
|
-
pass
|
16
|
-
|
17
|
-
def xmlrpc_namespace(self):
|
18
|
-
return 'worklog'
|
19
|
-
|
20
|
-
def xmlrpc_methods(self):
|
21
|
-
yield ('WIKI_VIEW', ((int,),), self.getRPCVersionSupported)
|
22
|
-
yield ('WIKI_VIEW', ((str, int),), self.startWork)
|
23
|
-
yield ('WIKI_VIEW', ((str,), (str, str), (str, str, int),), self.stopWork)
|
24
|
-
yield ('WIKI_VIEW', ((dict,), (dict, str),), self.getLatestTask)
|
25
|
-
yield ('WIKI_VIEW', ((dict,), (dict, str),), self.getActiveTask)
|
26
|
-
yield ('WIKI_VIEW', ((str, int,),), self.whoIsWorkingOn)
|
27
|
-
yield ('WIKI_VIEW', ((str, int,),), self.whoLastWorkedOn)
|
28
|
-
|
29
|
-
def getRPCVersionSupported(self, req):
|
30
|
-
""" Returns 1 with this version of the Work Log XMLRPC API. """
|
31
|
-
return 1
|
32
|
-
|
33
|
-
def startWork(self, req, ticket):
|
34
|
-
""" Start work on a ticket. Returns the string 'OK' on success or an explanation on error (requires authentication)"""
|
35
|
-
mgr = WorkLogManager(self.env, self.config, req.authname)
|
36
|
-
if mgr.start_work(ticket):
|
37
|
-
return 'OK'
|
38
|
-
return mgr.get_explanation()
|
39
|
-
|
40
|
-
def stopWork(self, req, comment='', stoptime=None):
|
41
|
-
""" Stops work. Returns the string 'OK' on success or an explanation on error (requires authentication, stoptime is seconds since epoch) """
|
42
|
-
mgr = WorkLogManager(self.env, self.config, req.authname)
|
43
|
-
if mgr.stop_work(stoptime, comment):
|
44
|
-
return 'OK'
|
45
|
-
return mgr.get_explanation()
|
46
|
-
|
47
|
-
def getLatestTask(self, req, username=None):
|
48
|
-
""" Returns a structure representing the info about the latest task. """
|
49
|
-
if username:
|
50
|
-
mgr = WorkLogManager(self.env, self.config, username)
|
51
|
-
else:
|
52
|
-
mgr = WorkLogManager(self.env, self.config, req.authname)
|
53
|
-
return mgr.get_latest_task()
|
54
|
-
|
55
|
-
def getActiveTask(self, req, username=None):
|
56
|
-
""" Returns a structure representing the info about the active task (identical to getLatestTask but does not return anything if the work has stopped). """
|
57
|
-
if username:
|
58
|
-
mgr = WorkLogManager(self.env, self.config, username)
|
59
|
-
else:
|
60
|
-
mgr = WorkLogManager(self.env, self.config, req.authname)
|
61
|
-
return mgr.get_active_task()
|
62
|
-
|
63
|
-
def whoIsWorkingOn(self, req, ticket):
|
64
|
-
""" Returns the username of the person currently working on the given ticket """
|
65
|
-
mgr = WorkLogManager(self.env, self.config, req.authname)
|
66
|
-
(who, when) = mgr.who_is_working_on(ticket)
|
67
|
-
return who
|
68
|
-
|
69
|
-
def whoLastWorkedOn(self, req, ticket):
|
70
|
-
""" Returns the username of the person last worked on the given ticket """
|
71
|
-
mgr = WorkLogManager(self.env, self.config, req.authname)
|
72
|
-
return mgr.who_last_worked_on(ticket)
|
73
|
-
|