## This file is subject to the terms and conditions defined in
## file 'LICENSE', which is part of this source code package.
## Copyright (c) 2009 SKR Farms (P) LTD.
<%inherit file="/base/basic1.html"/>
<%namespace name="elements" file="/component/elements.html"/>
<%namespace name="forms" file="/component/forms.html"/>
<%!
page_tooltips = [
[ 'Help',
"""Tickets are helpful to track bugs, tasks, requirements etc ...
The three main attributes of a ticket are type, status, severity.
Type should give an idea about why? and what? of a ticket. Status actually
tracks the flow of work or activity happening on a ticket. Severity, well tells
how severe the ticket is to the project (synonymous to priority).
Every ticket status change should provide the next status of the ticket and
due-date to act on the ticket state. The user who changes the ticket status
will become the new owner of the ticket.
If, in case the changed ticket status actually expects a response from a user
other than the ticket owner, it can be indicated so using 'promptuser'
attribute.
Use ticket id, where ever the ticket needs to be referenced.
"""
],
[ 'Attachments',
"""Upload attachments by clicking on the iconized title. Clicking on the
same once again will hide it. Delete attachments by clicking on the cross-wire.
Upload any number of attachments files to ticket.
Every attached file, will have its "id" in paranthesis. Use the id value when
refering to the attachment.
"""
],
[ 'Tags',
"""Tag a ticket by clicking on the iconized title. Delete tags by clicking on
the cross-wire. Tag names should be 2 or more characters
"""
],
[ 'Favorites',
"""Registered users can pick ticket(s) as their favorite, provided the user
has got 'TICKET_VIEW' permission"""
],
[ 'Vote',
"""Registered users can up-vote or down-vote a ticket."""
],
]
%>
<%def name="hd_links()">
${parent.hd_links()}
%def>
<%def name="hd_script()">
${parent.hd_script()}
%def>
<%def name="ticket_details( tckdet )">
<%
due_date = tckdet.get( 'due_date', '' )
statusname = tckdet['status']
parent_id = tckdet.get( 'parent', '' )
blockers = ', '.join([ str(b) for b in c.blockers ])
blocking = ', '.join([ str(b) for b in c.blocking ])
children = ', '.join([ str(child) for child in c.children ])
flash_schedule = ''
flashfg = ''
if due_date :
due_date = due_date.astimezone( h.timezone(c.authuser.timezone))
daysleft = due_date.astimezone( h.timezone('UTC') ) - \
h.timezone('UTC').localize( h.dt.datetime.utcnow() )
if statusname not in c.ticketresolv :
if (daysleft < h.dt.timedelta(0)) and statusname not in c.ticketresolv :
flash_schedule = "( Schedule overun by %s )" % \
h.olderby( abs(daysleft.days) )
flashfg = 'fgred'
else :
flash_schedule = "( %s left )" % h.olderby( daysleft.days )
flashfg = 'fggreen'
tckcreator = c.ticketstatus[0][4]
%>
Created by,
${tckcreator},
on ${c.ticket.created_on.strftime('%a, %b %d, %Y')}
Summary
<% summary = tckdet['summary'] %>
${summary |n}
%if c.tckeditable :
Change-status
% endif
status
${statusname.upper()}
Duedate
${due_date and due_date.strftime('%a, %b %d, %Y') or '-'}
Owner
${tckdet['owner']}
${flash_schedule}
${forms.form_changetckst(
c.authuser, c.project, c.ticket,
tckdet['status'],
due_date and due_date.strftime('%m/%d/%Y') or '-',
h.suburl_changetckst, c.tck_statusnames
)}
Reference
<%
parent = tckdet['parent']
%>
% for tck in c.children :
${tck}
% endfor
% for tck in c.blockers :
${tck}
% endfor
% for tck in c.blocking :
${tck}
% endfor
Type
${tckdet['type']}
Severity
${tckdet['severity']}
Component
${tckdet['compname']}
Milestone
${tckdet['mstnname']}
Version
${tckdet['vername']}
Prompting
${tckdet['promptuser']}
Parent
${tckdet['parent']}
Children
${children}
Blockers
${blockers}
Blocking
${blocking}
Describe
Description
${tckdet['descriptionhtml'] | n}
${forms.form_tckdescription(
c.authuser, c.project, h.suburl_configtck, t=c.ticket )}
${forms.form_tcksummary(
c.authuser, c.project, h.suburl_configtck, t=c.ticket )}
${forms.form_tcktype(
c.authuser, c.project, h.suburl_configtck, t=c.ticket )}
${forms.form_tckseverity(
c.authuser, c.project, h.suburl_configtck, t=c.ticket )}
${forms.form_tckcomponent(
c.authuser, c.project, h.suburl_configtck, t=c.ticket )}
${forms.form_tckmilestone(
c.authuser, c.project, h.suburl_configtck, t=c.ticket )}
${forms.form_tckversion(
c.authuser, c.project, h.suburl_configtck, t=c.ticket )}
${forms.form_tckpromptuser(
c.authuser, c.project, h.suburl_configtck, t=c.ticket )}
${forms.form_tckparent(
c.authuser, c.project, h.suburl_configtck, t=c.ticket )}
${forms.form_tckblockedby(
c.authuser, c.project, h.suburl_configtck, t=c.ticket )}
${forms.form_tckblocking(
c.authuser, c.project, h.suburl_configtck, t=c.ticket )}
%def>
<%def name="status_block( ts, refdt )">
<%
created_on = h.timezone( c.authuser.timezone ).localize( ts[3] )
before = refdt - created_on
stfg = ts[1] in c.ticketresolv and 'fggray' or 'fgblue'
ownername = ts[4]
%>
${ts[1]}
${created_on.strftime('%a, %b %d, %Y')}
%def>
<%def name="status_delimiter( ts, actualdt=None )">
<%
if ts[2] :
due_date = ts[2].astimezone( h.timezone(c.authuser.timezone))
diffdt = due_date - actualdt
diffdays = int(repr(diffdt.days))
if 0 <= diffdays :
diffby = 'beaten by ' + h.olderby( diffdays )
difffg = 'fggreen'
else :
diffby = 'overrun by ' + h.olderby( abs(diffdays) )
difffg = 'fgred'
else :
diffby = '-'
difffg = 'fggray'
%>
%def>
<%def name="status_flow( tckstat )">
<%
tss = tckstat
tss.reverse()
currdt = h.timezone(c.authuser.timezone).localize( h.dt.datetime.utcnow() )
nextdt = h.timezone(c.authuser.timezone).localize( tss[0][3] )
%>
Status Flow
(in reverse chonology)
${status_block( tss[0], currdt )}
% for ts in tss[1:] :
${status_delimiter( ts, nextdt )}
<% nextdt = h.timezone(c.authuser.timezone).localize( ts[3] ) %>
${status_block( ts, currdt )}
% endfor
%def>
<%def name="show_ticket()">
<%
tckdet = c.ticketdetail
tckccodes = h.json.loads( c.tckccodes )
bgcolor = h.tckcolorcode(
{ 'tck_statusname' : tckdet['status'],
'tck_severityname': tckdet['severity'],
'tck_typename' : tckdet['type'],
},
tckccodes
)
resolved= tckdet['status'] in c.ticketresolv and 'strike' or ''
%>
${status_flow( c.ticketstatus )}
${ticket_details( c.ticketdetail )}
%def>
<%def name="bd_body()">
<%
searchbox = capture(
forms.form_searchbox,
c.authuser, 'searchticket', 'Search-ticket',
h.suburl_search, c.searchfaces
)
sel_tck = capture( forms.form_selectticket, c.authuser,
c.seltickets, c.ticket and str(c.ticket.id) or '' )
if c.tckeditable :
newtck = ' \
\
Create' % h.url_ticketcreate
else :
newtck = ''
fav = capture( elements.favoriteicon, 'favtck' )
charts = capture( elements.iconlink, h.url_ticketcharts,
'barchart', title="Ticket analytics" )
tline = capture( elements.iconlink, h.url_tcktimeline,
'timeline', title="Timeline for ticket" )
%>
${elements.mainnav()}
${elements.contextnav( [ fav, searchbox, sel_tck, newtck, ],
rspans=[ charts, tline ],
tooltips=page_tooltips )}
% if c.authusername == 'anonymous' or not c.userpanes :
% else :
% endif
% if c.authorized :
${forms.form_tckfav(
c.authuser, c.project, c.ticket, h.suburl_tckfav,
c.isuserfavorite and 'delfavuser' or 'addfavuser'
)}
${forms.form_votetck(
c.authuser, c.project, c.ticket, h.suburl_votetck,
c.upvotes, c.downvotes, c.currvote
)}
% endif
${show_ticket()}
% if c.authusername != 'anonymous' and c.userpanes :
${elements.user_panes( c.userpanes )}
% endif
%def>
<%def name="bd_script()">
${parent.bd_script()}
%def>