Parent: [4a259a] (diff)

Child: [21e17e] (diff)

Download this file

lib.html    186 lines (167 with data), 6.5 kB

  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
<html xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip="">
<ul py:def="project_tree(project)">
<li py:for="p in project.direct_subprojects">
<a href="${p.url()}">$p.shortname</a>
<py:if test="p.direct_subprojects">
${project_tree(p)}
</py:if>
</li>
</ul>
<py:def function="nav(s)">
<li>
<a py:if="s.url" href="$s.url" class="$s.className">$s.label</a>
<span py:if="not s.url" class="$s.className">$s.label</span>
<ul py:if="s.children">
<py:for each="ss in s.children">${nav(ss)}</py:for>
</ul>
</li>
</py:def>
<py:def function="main_menu()">
<div id="mainmenu">
<ul class="mb">
<li><a href="/"><em>Open</em>Forge</a></li>
<li><a>Neighborhood</a></li>
<li><a href="/search/">Search Forge</a></li>
<li class="loginlogout">
<a href="/auth/logout" py:if="c.user._id">Log Out</a>
<a href="/auth/" py:if="not c.user._id">Log In</a>
</li>
</ul>
<div id="project-menu" py:if="c.project">
<div class="pti">Project: <a href="${c.project.url()}">$c.project.name</a></div>
<span id="project-search"><input type="text"/></span>
<ul class="mb">
<li py:for="s in c.project.sitemap()">
<a py:if="s.url" href="$s.url" class="$s.className">$s.label</a>
<span py:if="not s.url" class="$s.className">$s.label</span>
</li>
</ul>
</div>
</div>
</py:def>
<py:def function="sidebar_menu()">
<ul id="sidebarmenu" py:if="getattr(c, 'app', None)">
<li py:for="s in c.app.sidebar_menu()">
<a py:if="s.url" href="$s.url" class="$s.className">$s.label</a>
<span py:if="not s.url" class="$s.className">$s.label</span>
</li>
</ul>
<ul id="sidebarmenu"
py:if="getattr(c, 'project', None) and not getattr(c, 'app', None)">
<li py:for="s in c.project.sidebar_menu()">
<a py:if="s.url" href="$s.url" class="$s.className">$s.label</a>
<span py:if="not s.url" class="$s.className">$s.label</span>
</li>
</ul>
</py:def>
<py:def function="crumbs(trail)">
<py:for each="i, (label, url) in enumerate(trail)">
<li class="${i == 0 and 'first' or None}">
<a py:if="url" href="$url">$label</a>
<span py:if="not url">$label</span>
</li>
</py:for>
</py:def>
<py:def function="text_field(name, label, value=None)">
<label for="$name">$label</label><br/>
<input type="text" id="$name" name="$name" class="text" value="$value"/><br/>
</py:def>
<py:def function="file_field(name, label)">
<label for="$name">$label</label><br/>
<input type="file" id="$name" name="$name" class="text" /><br/>
</py:def>
<py:def function="text_area(name, label, value=None, **kw)">
<label for="$name">$label</label><br/>
<textarea id="$name" name="$name" py:attrs="kw">$value</textarea><br/>
</py:def>
<py:def function="select_field(name, label, options, value=None)">
<label for="$name">$label</label><br/>
<select id="$name" name="$name">
<py:for each="olbl, oval in options">
<option value="$oval" selected="${oval == value or None}">$olbl</option>
</py:for>
</select>
<br/>
</py:def>
<py:def function="radio_button(name, label, option, value=None)">
<py:if test="label">
<label for="$name">$label</label><br/>
</py:if>
<input type="radio" id="$name" name="$name" class="text" value="$option"
checked="${option==value and 'on' or None}"/><br/>
</py:def>
<py:def function="checkbox(name, label, checked)">
<input type="checkbox" id="$name" name="$name"
checked="${checked or None}"/>
<py:if test="label">
<label for="$name">$label</label>
</py:if>
<br/>
</py:def>
<py:def function="submit_button(value, name=None)">
<input type="submit" name="$name" value="$value"/><br/>
</py:def>
<py:def function="list_attachments(attachments, edit_mode=False)">
<div py:if="len(attachments)" py:strip="True">
<strong>Attachments</strong>
<div class="attachment_images">
<div py:for="att in attachments" py:strip="True">
<div py:if="att.contentType.startswith('image/')" class="attachment_thumb">
<a href="${att.url()}">
<img src="${att.url()}"/>
</a><br/>
$att.metadata.filename
<form py:if="edit_mode" method="post" action="${att.url()}">
<input type="hidden" name="delete" value="True"/>
${submit_button('Delete file')}
</form>
</div>
</div>
</div>
<div py:for="att in attachments">
<form py:if="not att.contentType.startswith('image/')" method="post" action="${att.url()}">
<a href="${att.url()}">${att.metadata.filename}</a>
($att.length bytes)
<input type="hidden" name="delete" value="True"/>
<span py:if="edit_mode" py:strip="True">
${submit_button('Delete file')}
</span>
</form>
</div>
</div>
</py:def>
<py:def function="markdown_edit(name, content)">
<textarea id="wmd_edit_$name" name="$name">$content</textarea>
<div id="wmd_preview_$name"></div>
<script type="text/javascript">
wmd_options = { autostart: false, output:"Markdown" };
</script>
<script type="text/javascript" src="/wmd/wmd.js"></script>
<script type="text/javascript">
(function() {
var textarea = document.getElementById('wmd_edit_$name');
var previewDiv = document.getElementById('wmd_preview_$name');
var previewManager = new Attacklab.wmd.previewManager({
input:textarea,
preview:previewDiv,
output:null
});
new Attacklab.wmd.editor(textarea,previewManager.refresh);
})()
</script>
</py:def>
<py:def function="user_tags_edit(name, user_tags)">
<label for="$name">Tags:</label><br />
<input id="$name" name="$name" type="text" value="${','.join([t.tag for t in user_tags.tags])}" />
<script type="text/javascript" src="/js/jquery.tag.editor.js"></script>
<script type="text/javascript">
$("#$name").tagEditor({
confirmRemoval: false,
completeOnSeparator: true,
completeOnBlur: true
});
</script>
</py:def>
</html>