<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>