## 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.
<%namespace name="forms" file="/component/forms.html"/>
<%!
iconmap = {
'addattach' : '/zetaicons/add_attach.png',
'addtag' : '/zetaicons/tag_green_add.png',
'attach' : '/zetaicons/attach.png',
'project' : '/zetaicons/project.png',
'projects' : '/zetaicons/projects.png',
'relation' : '/zetaicons/user_link.png',
'tag' : '/zetaicons/tag_green.png',
'team' : '/zetaicons/group_link.png',
'users' : '/zetaicons/group.png',
'user' : '/zetaicons/user.png',
'trash' : '/zetaicons/bin.png',
'refresh' : '/zetaicons/arrow_refresh.png',
'servergo' : '/zetaicons/server_go.png',
'plus_exp' : '/zetaicons/plus_exp.gif',
'arrow_right' : '/zetaicons/arrow_right.png',
'timeline' : '/zetaicons/time.png',
'tooltips' : '/zetaicons/tooltips.png',
'barchart' : '/zetaicons/chart_bar.png',
'commentadd' : '/zetaicons/comment_add.png',
}
%>
<%def name="mainnav()" >
% for m in c.mainnavs :
|
|
% endfor
%def>
<%def name="favoriteicon( name )">
%def>
<%def name="iconize( spantext, iconname, span_name='', classes='', styles='', title='' )">
<% iconfile = iconmap.get( iconname, '' ) %>
${spantext | n}
%def>
<%def name="iconlink( link, iconname, anchor_name='', classes='', styles='', title='' )">
<% iconfile = iconmap.get( iconname, '' ) %>
%def>
<%def name="flashmessages()">
<%
allflash = [ ('%s'%m) for m in h.flash.pop_messages() ]
errors = [ m.strip( h.ERROR_FLASH ) for m in allflash if h.ERROR_FLASH in m ]
messages = [ m.strip( h.MESSAGE_FLASH ) for m in allflash if h.MESSAGE_FLASH in m ]
allflash = errors + messages
flashcls = (errors and 'bgLSalmon') or (messages and 'bgyellow') or ''
if allflash :
style= ""
else :
style= "display: none;"
%>
% for message in allflash:
${message}
% endfor
%def>
<%def name="pagebar( text, spans=[], rspans=[], tooltips=[], *args )" >
% if tooltips :
${iconize( '', 'tooltips', styles="height: 16px;" )}
% else :
% endif
% for span in rspans :
${span | n}
% endfor
${text}
% for span in spans :
${span | n}
% endfor
% for div_spans in args :
% for span in div_spans :
${span | n}
% endfor
% endfor
% if tooltips :
% endif :
%def>
<%def name="contextnav( spans=[], rspans=[], tooltips=[] )">
% if tooltips :
${iconize( '', 'tooltips' )}
% else :
% endif
% for span in rspans :
${span | n}
% endfor
% for span in spans :
${span | n}
% endfor
% if tooltips :
% endif :
%def>
<%def name="user_panes( userpanes )">
|
refresh
collapse
% for up in userpanes :
${up}
% endfor
% for up in userpanes :
% endfor
|
%def>
<%def name="lictable1( license, editable )">
Id |
License name |
Projects |
% if editable :
|
% endif
% for l in license :
<% id, licensename, licurl, editurl, rmurl = l[:5] %>
${id} |
${licensename} |
% for p, href in l[5:] :
% endfor
|
% if editable :
${iconize( '', 'trash', span_name='rmlic', classes='fgblue pointer',
title='Remove this license' )}
|
% endif
% endfor
%def>
<%def name="captiontextarea( text='' )">
%def>
<%def name="attach_spans( span_name, form_id, refreshurl )">
%def>
<%def name="tag_spans( span_name, form_id, refreshurl )">
%def>
<%def name="helpboard( help='', classes='', styles='' )">
${help |n}
%def>
<%def name="userdetails( user, userinfo, urlphoto )">
<% username = user.username %>
${'%s %s %s' % (userinfo.firstname, userinfo.middlename, userinfo.lastname) }
${user.emailid}
timezone :
${user.timezone}
Registered on :
${userinfo.created_on.strftime("%a, %b %d, %Y")}
Address :
${userinfo.addressline1}
${userinfo.addressline2}
${userinfo.city} - ${userinfo.pincode}
${userinfo.state}
${userinfo.country}
% if urlphoto :

% endif
%def>
<%def name="titleindex( items, url_for )">
<% curdir = [] %>
% for path, text in items :
<%
parts = filter( None, path.split('/') )
render = map( lambda r, p : None if r == p else p, curdir, parts )
while render :
if render[-1] == None :
render.pop(-1)
else :
break
curdir = parts
ndirs = render and (len(render)-1) or 0
%>
% for i in range(ndirs) :
% if render[i] :
-
${render[i]}
% endif
% endfor
-
${render[-1]}
% endfor
%def>
<%def name="captcha( url )">
${forms.input_text( name='captcha', id='captcha' )}
%def>
## ------------------- Difference formatting ----------------------
<%def name="diff_row( col1, col2, col3, cls )">
${col1} |
${col2} |
${col3} |
%def>
<%def name="equal_row( tup, flines, tlines )">
<%
if tup[2] - tup[1] != tup[4] - tup[3] :
raise Exception
len = tup[2] - tup[1]
%>
% for ln in range(0, len) :
${ diff_row( tup[1]+ln+1, tup[3]+ln+1, flines[tup[1]+ln], 'diffequal' )}
% endfor
%def>
<%def name="delete_row( tup, flines, tlines )">
% for ln in range(tup[1], tup[2]) :
${diff_row( ln+1, '', flines[ln], 'diffdelete' )}
% endfor
%def>
<%def name="insert_row( tup, flines, tlines )">
% for ln in range(tup[3], tup[4]) :
${diff_row( '', ln+1, tlines[ln], 'diffinsert' )}
% endfor
%def>
<%def name="replace_row( tup, flines, tlines )">
% for ln in range(tup[1], tup[2]) :
${diff_row( ln+1, '', flines[ln], 'diffreplace' )}
% endfor
% for ln in range(tup[3], tup[4]) :
${diff_row( '', ln+1, tlines[ln], 'diffreplace' )}
% endfor
%def>
<%def name="difftable( oldver, newver, flines, tlines )">
<% m = h.SequenceMatcher( None, flines, tlines ) %>
- Un-modified
- Deleted
- Inserted
- Replaced
v${oldver} |
v${newver} |
Difference |
% for cluster in m.get_grouped_opcodes() :
${diff_row( '...', '...', '', 'skip' )}
% for tup in cluster :
% if tup[0] == 'equal' :
${equal_row( tup, flines, tlines )}
% elif tup[0] == 'delete' :
${delete_row( tup, flines, tlines )}
% elif tup[0] == 'insert' :
${insert_row( tup, flines, tlines )}
% elif tup[0] == 'replace' :
${replace_row( tup, flines, tlines )}
% endif
% endfor
% endfor
%def>
## -------------------- Timeline libraries --------------------------
<%def name="timeline( ondt, log )">
${iconize( ondt, 'plus_exp', span_name='interface', classes='pointer mr5',
title='%s'%log.created_on )}
By ${log.userhtml |n }
in ${log.itemhtml |n }
${log.log}
%def>
<%def name="timeline_view( logs, fromoff, tooff, links, chartid='' )">
<%
if logs :
lf = '%s' % logs[0].created_on.strftime("%a, %b %d, %Y")
lt = '%s' % logs[-1].created_on.strftime("%a, %b %d, %Y")
logwindow = "Till %s from %s" % ( lf, lt )
else :
logwindow = "No logs"
slices = h.timeslice( logs )
slicedt = sorted( slices.keys(),
key=lambda x : h.dt.datetime.strptime(x, '%a, %b %d %Y' ),
reverse=True )
%>
% if links[0] :
«
% endif
% if links[1] :
‹
% endif
${fromoff}-${tooff}
% if links[2] :
›
% endif
${logwindow |n}
Expand
% if chartid :
% endif
% for ondt in slicedt :
% for log in slices[ondt] :
${timeline(ondt, log )}
% endfor
% endfor
% if links[0] :
«
% endif
% if links[1] :
‹
% endif
${fromoff}-${tooff}
% if links[2] :
›
% endif
%def>
## --- Function used by review templates
<%def name="showpeople()">
<%
participants = [ u.username for u in c.review.participants ]
x_participants = sorted(list(
set( c.usernames ).difference( set( participants ))
))
'admin' in x_participants and x_participants.remove('admin')
'anonymous' in x_participants and x_participants.remove('anonymous')
%>
Author
% if c.revweditable :
${forms.form_revwauthor( c.authuser, c.project, c.review,
h.suburl_revwauthor, c.projusers )}
% else :
<% authorname = c.review.author and c.review.author.username or '-' %>
% if c.review.author :
${authorname}
% else :
${authorname}
% endif
% endif
Moderator
% if c.revweditable :
${forms.form_revwmoderator( c.authuser, c.project, c.review,
h.suburl_revwmoderator, c.projusers )}
% else :
<%
moderatorname = c.review.moderator and c.review.moderator.username \
or '-'
%>
% endif
% if c.authuser == c.review.moderator :
${forms.form_closerev( c.authuser, c.project,
c.review, h.suburl_closerev )}
% endif
Participants
% if c.revweditable :
${forms.form_addparts( c.authuser, c.project, c.review,
h.suburl_addparts, x_participants )}
% endif
% for username in sorted([ u.username for u in c.review.participants ]) :
% endfor
${forms.form_delparts( c.authuser, c.project, c.review,
h.suburl_delparts )}
%def>
## -------------------- Attachment libraries --------------------------
<%def name="attachments( u, attachments, editable, attachassc=None, aa=None,
ua=None, la=None, pa=None, ta=None, ra=None, wa=None )">
<% keys = sorted( attachments.keys() ) %>
id |
filename |
summary |
tags |
uploader |
% if attachassc :
attached-to |
% endif
downloads |
% for k in keys :
<% count = 0 %>
${k} |
% for att in attachments[k] :
<%
createdon = att[4] and h.utc_2_usertz( att[4], u.timezone ).strftime("%a, %b %d, %Y")
count += 1
bgrnd = (count%2 == 0) and 'bggray1' or ''
if attachassc :
items = [ h.attachassc2link( item, aa, ua, la, pa, ta, ra, wa )
for item in attachassc.get( att[0], [] ) ]
else :
items = []
%>
${att[0]}
|
${att[1]} |
${att[2]}
|
${att[6]}
|
${att[5]}
|
% if attachassc :
% for text, href in items :
% endfor
|
% endif
${att[3]} |
% endfor
% endfor
%def>
<%def name="attachdownloads( u, attachments )">
<%
count = 0
values = [];
[ values.extend( v ) for v in attachments.values() ]
%>
filename |
summary |
uploader |
created-on |
downloads |
% for att in values :
<%
createdon = att[4] and h.utc_2_usertz( att[4], u.timezone ).strftime("%a, %b %d, %Y")
count += 1
bgrnd = (count%2 == 0) and 'bggray1' or ''
%>
${att[1]}
|
${att[2]}
|
${att[5]}
|
${createdon} |
${att[3]} |
% if att[6] :
( ${att[6]} )
|
% endif
% endfor
%def>