<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="master.html" />
<xi:include href="${app.templates}/lib.html" />
<?python from allura.lib.security import has_artifact_access ?>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
<title>$c.project.name / $app.config.options.mount_label Admin Forums</title>
</head>
<body>
<h1 class="title">$app.config.options.mount_point Admin Forums</h1>
<div class="content">
<div class="row">
<div class="column grid_12">
<form method="POST" action="update_forums" enctype="multipart/form-data">
<table id="forums">
<thead>
<tr>
<th/>
<th>Forum</th><th>Topics</th><th>Posts</th><th>Last Post</th>
<th/>
</tr>
</thead>
<tbody>
<tr py:for="i, forum in enumerate(app.forums)" class="${i%2 and ' even' or ''}">
<td>
<div class="editable viewing">
<span class="viewer">
<img py:if="forum.icon" src="${forum.url()}/icon"/>
<img py:if="not forum.icon" src="${g.forge_static('images/project_default.png')}"/>
</span>
<span class="editor">${file_field('forum-%s.icon' % i, '')}</span>
</div>
</td>
<td>
<div class="editable viewing">
<span class="viewer"><a href="${forum.url()}">$forum.name</a>($forum.shortname)</span>
<span class="editor">
${text_field('forum-%s.name' % i, 'Forum Name', forum.name)}
</span>
</div>
<div class="editable viewing">
<span class="viewer">${Markup(g.markdown.convert(forum.description))}</span>
<span class="editor multiline">
${text_area('forum-%s.description' % i, 'Description', forum.description)}
</span>
</div>
<py:if test="forum.subforums">
<b>Subforums:</b>
<span py:for="j, sf in enumerate(forum.subforums)">
<py:if test="j != 0">, </py:if>
<a href="${sf.url()}">$sf.name</a>
</span>
</py:if>
</td>
<td>${forum.num_topics}</td>
<td>${forum.num_posts}</td>
<td>${post_summary(forum.last_post)}</td>
<td>
<input name="forum-${i}.id" type="hidden" value="$forum._id"/>
<py:if test="forum.deleted">${submit_button('Undelete', 'forum-%s.undelete' % i)}</py:if>
<py:if test="not forum.deleted">${submit_button('Delete', 'forum-%s.delete' % i)}</py:if>
</td>
</tr>
</tbody>
</table>
<input type="button" id="add_forum" value="Add another forum"
/>
<div id="add_forum_form" style="display:none">
<ol>
<li>
<label>Name:</label>
<input type="text" name="new_forum.name"/>
</li>
<li>
<label>Short Name:</label>
<input type="text" name="new_forum.shortname"/>
</li>
<li>
<label>Parent Forum:</label>
<select name="new_forum.parent">
<option value="">None</option>
<option py:for="f in app.forums" value="$f._id">$f.name</option>
</select>
</li>
<li>
<label>Description:</label>
<textarea name="new_forum.description" style="height:50px;"/>
</li>
<li>
<label>Icon:</label>
${file_field('new_forum.icon', '')}
</li>
<li>
<label> </label>
<input type="submit" id="new_forum.create" name="new_forum.create" value="Create Forum"
/>
<input type="button" id="add_forum_cancel" value="Cancel"
/>
</li>
</ol>
</div>
</form>
</div>
</div>
</div>
</body>
<script type="text/javascript">
$(function() {
$("#add_forum").click(function(){
$("#add_forum_form").show();
$(this).hide();
return false;
});
$("#add_forum_cancel").click(function(){
$("#add_forum_form").hide();
$("#add_forum").show();
return false;
});
});
</script>
</html>