Changeset 4293

Show
Ignore:
Timestamp:
09/18/08 16:02:47 (2 months ago)
Author:
bobbysmith007
Message:

added ticket_policy which allows us to have an 'internal' checkbox to turn off certain tickets.

added internal checkbox

Updated the manual to contain the new stuff.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • timingandestimationplugin/branches/trac0.11-Permissions/timingandestimationplugin/api.py

    r4267 r4293  
    88from ticket_webui import * 
    99from usermanual import * 
     10from ticket_policy import * 
    1011from trac.log import logger_factory 
    1112from trac.ticket import ITicketChangeListener, Ticket 
     
    4344        estimatedhours.label = Estimated Hours? 
    4445 
     46        internal = checkbox 
     47        internal.value = 0 
     48        internal.label = Internal? 
     49 
    4550        """ 
    4651    implements(IEnvironmentSetupParticipant) 
     
    98103        if self.db_installed_version < 7: 
    99104            field_settings = "field settings" 
    100             self.config.set( field_settings, "fields", "billable, totalhours, hours, estimatedhours" ) 
     105            self.config.set( field_settings, "fields", "billable, totalhours, hours, estimatedhours, internal" ) 
    101106            self.config.set( field_settings, "billable.permission", "TIME_VIEW:hide, TIME_RECORD:disable" ) 
    102107            self.config.set( field_settings, "hours.permission", "TIME_VIEW:remove, TIME_RECORD:disable" ) 
    103108            self.config.set( field_settings, "estimatedhours.permission", "TIME_RECORD:disable" ) 
     109            self.config.set( field_settings, "internal.permission", "TIME_RECORD:hide") 
    104110 
    105111        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
     
    159165        ticket_custom = "ticket-custom" 
    160166        return not ( self.config.get( ticket_custom, "totalhours" ) and \ 
    161  
    162                      #self.config.get( ticket_custom, "billable" ) and \ 
    163                      #self.config.get( ticket_custom, "billable.order") and \ 
    164                      #(self.config.get( ticket_custom, "billable" ) == "checkbox") and \ 
    165                      #(not self.config.get( ticket_custom, "lastbilldate" )) and \ 
    166  
    167                      self.config.get( ticket_custom, "hours" ) and \ 
    168                      self.config.get( ticket_custom, "totalhours.order") and \ 
    169                      self.config.get( ticket_custom, "hours.order") and \ 
    170                      self.config.get( ticket_custom, "estimatedhours.order") and \ 
    171                      self.config.get( ticket_custom, "estimatedhours")) 
     167                         self.config.get( ticket_custom, "hours" ) and \ 
     168                         self.config.get( ticket_custom, "totalhours.order") and \ 
     169                         self.config.get( ticket_custom, "hours.order") and \ 
     170                         self.config.get( ticket_custom, "estimatedhours.order") and \ 
     171                         self.config.get( ticket_custom, "estimatedhours") and \ 
     172                         self.config.get( ticket_custom, "internal") and \ 
     173                         "InternalTicketsPolicy" in self.config.getlist("trac", "permission_policies")) 
    172174 
    173175    def do_ticket_field_upgrade(self): 
    174176        ticket_custom = "ticket-custom" 
    175177 
    176         self.config.set(ticket_custom,"totalhours", "text") 
    177         if not self.config.get( ticket_custom, "totalhours.order") : 
     178        if not self.config.get(ticket_custom,"totalhours"): 
     179            self.config.set(ticket_custom,"totalhours", "text") 
    178180            self.config.set(ticket_custom,"totalhours.order", "4") 
    179         self.config.set(ticket_custom,"totalhours.value", "0") 
    180         self.config.set(ticket_custom,"totalhours.label", "Total Hours") 
    181  
    182         self.config.set(ticket_custom,"billable", "checkbox") 
    183         self.config.set(ticket_custom,"billable.value", "1") 
    184         if not self.config.get( ticket_custom, "billable.order") : 
     181            self.config.set(ticket_custom,"totalhours.value", "0") 
     182            self.config.set(ticket_custom,"totalhours.label", "Total Hours") 
     183 
     184 
     185        if not self.config.get(ticket_custom,"billable"): 
     186            self.config.set(ticket_custom,"billable", "checkbox") 
     187            self.config.set(ticket_custom,"billable.value", "1") 
    185188            self.config.set(ticket_custom,"billable.order", "3") 
    186         self.config.set(ticket_custom,"billable.label", "Billable?") 
    187  
    188         self.config.set(ticket_custom,"hours", "text") 
    189         self.config.set(ticket_custom,"hours.value", "0") 
    190         if not self.config.get( ticket_custom, "hours.order") : 
     189            self.config.set(ticket_custom,"billable.label", "Billable?") 
     190 
     191        if not self.config.get(ticket_custom,"hours"): 
     192            self.config.set(ticket_custom,"hours", "text") 
     193            self.config.set(ticket_custom,"hours.value", "0") 
    191194            self.config.set(ticket_custom,"hours.order", "2") 
    192         self.config.set(ticket_custom,"hours.label", "Add Hours to Ticket") 
    193  
    194         self.config.set(ticket_custom,"estimatedhours", "text") 
    195         self.config.set(ticket_custom,"estimatedhours.value", "0") 
    196         if not self.config.get( ticket_custom, "estimatedhours.order") : 
     195            self.config.set(ticket_custom,"hours.label", "Add Hours to Ticket") 
     196 
     197        if not self.config.get(ticket_custom,"estimatedhours"): 
     198            self.config.set(ticket_custom,"estimatedhours", "text") 
     199            self.config.set(ticket_custom,"estimatedhours.value", "0") 
    197200            self.config.set(ticket_custom,"estimatedhours.order", "1") 
    198         self.config.set(ticket_custom,"estimatedhours.label", "Estimated Number of Hours") 
     201            self.config.set(ticket_custom,"estimatedhours.label", "Estimated Number of Hours") 
     202 
     203        if not self.config.get( ticket_custom, "internal"): 
     204            self.config.set(ticket_custom, "internal", "checkbox") 
     205            self.config.set(ticket_custom, "internal.value", "0") 
     206            self.config.set(ticket_custom, "internal.label", "Internal?") 
     207            self.config.set(ticket_custom,"internal.order", "5") 
     208 
     209        if "InternalTicketsPolicy" not in self.config.getlist("trac", "permission_policies"): 
     210            perms = ["InternalTicketsPolicy"] 
     211            other_policies = self.config.getlist("trac", "permission_policies") 
     212            if "DefaultPermissionPolicy" not in other_policies: 
     213                perms.append("DefaultPermissionPolicy") 
     214            perms.extend( other_policies ) 
     215            self.config.set("trac", "permission_policies", ', '.join(perms)) 
    199216 
    200217        self.config.save(); 
  • timingandestimationplugin/branches/trac0.11-Permissions/timingandestimationplugin/reports_filter.py

    r4282 r4293  
    6161 
    6262class ReportScreenFilter(Component): 
     63    """Hides TandE reports even when you just go to the url""" 
    6364    implements(ITemplateStreamFilter) 
    6465    def __init__(self): 
  • timingandestimationplugin/branches/trac0.11-Permissions/timingandestimationplugin/usermanual.py

    r4265 r4293  
    11user_manual_title = "Timing and Estimation Plugin User Manual" 
    2 user_manual_version = 12 
     2user_manual_version = 13 
    33user_manual_wiki_title = "TimingAndEstimationPluginUserManual" 
    44user_manual_content = """ 
     
    108108}}} 
    109109 
     110 
     111It also adds an "Internal" checkbox which allows you to set a ticket as internal.  For this policy to work correctly you need to add a line to the trac section of the config telling it which permission policies to use.  (The setup will attempt to put this line of configuration in place. )  The permission that looks at currently is 'TIME_ADMIN'.  To change that group set the internalgroup of the ticket section in the trac.ini as follows: 
     112 
     113{{{ 
     114#!ini 
     115[ticket] 
     116internalgroup = TRAC_ADMIN 
     117 
     118[trac] 
     119permission_policies = InternalTicketsPolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy 
     120}}} 
     121 
     122 
    110123== Future Improvements == 
    111124 * [http://trac-hacks.org/wiki/TimingAndEstimationPlugin See tickets] at the [http://trac-hacks.org/wiki/TimingAndEstimationPlugin project trac]