source: timingandestimationplugin/branches/trac0.10/timingandestimationplugin/ticket_webui.py

Last change on this file was 2460, checked in by Russ Tyndall, 16 years ago

TimingAndEstimationPlugin:

closes #1772

added javascript provided by Colin Guthrie that:

  • Changes the totalhours field to a non-editable span (no change).
  • Changes the estimated hours and total hours fields in the header table to be hours/minutes rather than a conceptually harder for humans decimal value!
  • Changes the billable flag in the header table to read Yes or No rather than 1 or 0.
  • Does the above two changes for all changelog entries through the ticket.

The only change I made to the javascript was to not emit any javascript into the global environment, instead add everything as local to a function that gets executed. Should keep the browser's namespace a bit cleaner for greasemonkey/other scripts and what not.

File size: 787 bytes
Line 
1import re
2from trac.log import logger_factory
3from trac.core import *
4from trac.web import IRequestHandler
5from trac.util import Markup
6from trac.web.chrome import add_stylesheet, add_script, \
7     INavigationContributor, ITemplateProvider
8from trac.web.href import Href
9
10class TicketWebUiAddon(Component):
11    implements(INavigationContributor)
12   
13    def __init__(self):
14        pass
15   
16     # INavigationContributor methods
17    def get_active_navigation_item(self, req):
18   
19        if re.search('ticket', req.path_info):
20            return "ticket-addon"
21        else:
22            return ""
23
24    def get_navigation_items(self, req):
25        if re.search('ticket', req.path_info):
26            add_script(req, 'Billing/ticket.js')
27            yield 'mainnav', "ticket-addon", ""
Note: See TracBrowser for help on using the repository browser.