Sha256: 4239dcb18d331533ab5bf9b98b8afb368621ee19705b2fed129546d2b160ab9c

Contents?: true

Size: 1.62 KB

Versions: 4

Compression:

Stored size: 1.62 KB

Contents

import time

from trac import ticket
from trac import util
from trac.core import *
from trac.perm import IPermissionRequestor, PermissionSystem
from trac.util import Markup
from trac.ticket.admin import TicketAdminPanel


class WorklogAdminPanel(TicketAdminPanel):
    _type = 'worklog'
    _label = ('Work Log', 'Work Log')

    def _render_admin_panel(self, req, cat, page, component):
        req.perm.require('TICKET_ADMIN') and req.perm.require('WORK_ADMIN') 

        bools = [ "timingandestimation", "comment",
                  "autostop", "autostopstart", "autoreassignaccept" ]
        
        if req.method == 'POST' and req.args.has_key('update'):
            for yesno in bools:
                if req.args.has_key(yesno):
                    self.config.set(self._type, yesno, True)
                else:
                    self.config.set(self._type, yesno, False)
                roundup = 1
                if req.args.has_key('roundup'):
                    try:
                        if int(req.args.get('roundup')) > 0:
                            roundup = int(req.args.get('roundup'))
                    except:
                        pass
                self.config.set(self._type, 'roundup', roundup)
                
            self.config.save()

        settings = {}
        for yesno in bools:
            if self.config.getbool(self._type, yesno):
                settings[yesno] = 'checked'

        if self.config.getint(self._type, 'roundup'):
            settings['roundup'] = self.config.getint(self._type, 'roundup')
        
        settings['view'] = 'settings'
        return 'worklog_webadminui.html', settings

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
keithsalisbury-subtrac-0.1.1 lib/subtrac/trac-plugins/worklogplugin/worklog/webadminui.py
keithsalisbury-subtrac-0.1.2 lib/subtrac/trac-plugins/worklogplugin/worklog/webadminui.py
keithsalisbury-subtrac-0.1.3 lib/subtrac/trac-plugins/worklogplugin/worklog/webadminui.py
keithsalisbury-subtrac-0.1.4 lib/subtrac/trac-plugins/worklogplugin/worklog/webadminui.py