forked from edgewall/trac
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jattachment.html
196 lines (180 loc) · 6.53 KB
/
jattachment.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
{# Copyright (C) 2006-2014 Edgewall Software
This software is licensed as described in the file COPYING, which
you should have received as part of this distribution. The terms
are also available at http://trac.edgewall.com/license.html.
This software consists of voluntary contributions made by many
individuals. For the exact contribution history, see the revision
history and logs, available at http://trac.edgewall.org/.
#}
# extends "jlayout.html"
<!DOCTYPE html>
<html>
# set parent = attachments.parent if attachments else attachment.resource.parent
<head>
<title>
# block title
# if mode == 'new':
${_("%(parent)s – Attachment", parent=name_of(parent))}
# elif mode == 'list':
${_("%(parent)s – Attachments", parent=name_of(parent))}
# else:
# trans filename = attachment.filename, parent = name_of(parent)
${filename} on ${parent} – Attachment
# endtrans
# endif
${ super() }
# endblock title
</title>
# block head
${ super() }
# if preview:
<script type="text/javascript"
src="${chrome.htdocs_location}js/folding.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#preview table.code').enableCollapsibleColumns(
$('#preview table.code thead th.content'));
});
</script>
# endif
# endblock head
</head>
<body>
# block content
<div id="content" class="attachment">
# if mode == 'new':
<h1>${tag_("Add Attachment to %(parent)s",
parent=tag.a(name_of(parent), href=url_of(parent)))}</h1>
<form id="attachment" class="mod" method="post"
enctype="multipart/form-data" action="">
${jmacros.form_token_input()}
<div class="field">
<label>File{% if max_size is greaterthanorequal 0 %}
${_("(size limit %(value)s)", value=pretty_size(max_size))}{%
endif %}:<br />
<input type="file" name="attachment"
class="trac-disable-determinant" />
</label>
</div>
<fieldset id="changeinfo">
<legend>${_("Attachment Info")}</legend>
# if authname == 'anonymous':
<div class="field">
<label>${_("Your email or username:")}<br />
<input type="text" name="author" class="trac-fullwidth"
value="${attachment.author or author}" />
</label>
# set preferences_link
<a href="${href.prefs()}" class="trac-target-new">${
_("Preferences")}</a>
# endset
# if author == 'anonymous':
<p class="hint">
# trans preferences_link = preferences_link
E-mail address and name can be saved in the
${preferences_link}.
# endtrans
</p>
# endif
</div>
# endif
<div class="field">
<label>${_("Description of the file (optional):")}<br />
<input type="text" class="trac-fullwidth" name="description"
value="${attachment.description}" />
</label>
</div>
# if authname and authname != 'anonymous':
<div class="options">
<label>
<input type="checkbox" name="replace"${
{'checked': is_replace}|htmlattr}/>
${_("Replace existing attachment of the same name")}
</label>
</div>
# endif
</fieldset>
<div class="buttons">
<input type="hidden" name="action" value="new" />
<input type="hidden" name="realm" value="${parent.realm}" />
<input type="hidden" name="id" value="${parent.id}" />
<input type="submit" class="trac-disable trac-disable-on-submit"
value="${_('Add attachment')}" />
<input type="submit" name="cancel" value="${_('Cancel')}" />
</div>
</form>
# elif mode == 'delete':
<h1><a href="${url_of(parent)}">${name_of(parent)}</a>:
${attachment.filename}</h1>
<p>
<strong>
${_("Are you sure you want to delete this attachment?")}
</strong>
<br />
${_("This is an irreversible operation.")}
</p>
<div class="buttons">
<form method="post" action="">
${jmacros.form_token_input()}
<div id="delete">
<input type="hidden" name="action" value="delete" />
<input type="submit" class="trac-disable-on-submit"
value="${_('Delete attachment')}" />
<input type="submit" name="cancel" value="${_('Cancel')}" />
</div>
</form>
</div>
# elif mode == 'list':
<h1><a href="${url_of(parent)}">${name_of(parent)}</a></h1>
# with
# set context = context.child(parent)
# set alist = attachments
# include "jlist_of_attachments.html"
# endwith
# else:
## 'render' mode
<h1><a href="${url_of(parent)}">${name_of(parent)}</a>:
${attachment.filename}</h1>
<table id="info" summary="${_("Description")}">
<tr>
<th scope="col">
# with
# set file = attachment.filename
# set size = _('%(size)s bytes', size=attachment.size)
# set psize = pretty_size(attachment.size)
# set author = authorinfo(attachment.author)
# set pdate = pretty_dateinfo(attachment.date)
# trans file, size, psize, author, pdate
File ${file}, <span title="${size}">${psize}</span> (added
by ${author}, ${pdate})
# endtrans
# endwith
</th>
</tr>
<tr>
<td class="message searchable">
${wiki_to_html(context.child(parent), attachment.description)}
</td>
</tr>
</table>
# if preview:
<div id="preview" class="searchable">
# include "jpreview_file.html"
</div>
# endif
# if attachment and 'ATTACHMENT_DELETE' in perm(attachment.resource):
<div class="buttons">
<form method="get" action="">
<div id="delete"> {# jinjacheck: "ID delete already defined" OK #}
<input type="hidden" name="action" value="delete" />
<input type="submit" value="${_('Delete attachment')}" />
</div>
</form>
</div>
# endif
# endif
</div>
${ super() }
# endblock content
</body>
</html>