<!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" />
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
<title>Admin for $c.project._id $app.config.options.mount_point</title>
</head>
<body>
<div id="app_admin_tabs">
<ul>
<li><a href="#app-acl" py:if="app.permissions">Permissions</a></li>
<li><a href="#app-status" py:if="app.permissions">Statuses</a></li>
<li><a href="#app-custom-fields" py:if="app.permissions">Custom Fields</a></li>
</ul>
<div id="app-acl">
<h3>Permissions</h3>
<div id="acl-admin">
<py:for each="p in app.permissions" >
<h3><a href="#">$p</a></h3>
<div>
<table>
<thead>
<tr>
<th>Role</th>
<th/>
</tr>
</thead>
<tbody>
<tr py:for="role in h.make_roles(app.config.acl[p])">
<td>${role.display()}</td>
<td>
<form method="POST" action="del_perm" style="display:inline">
<input type="hidden" name="permission" value="$p"/>
<input type="hidden" name="role" value="${role._id}"/>
<input type="submit" value="Remove"/>
</form>
</td>
</tr>
</tbody>
</table>
<form method="POST" action="add_perm">
<input type="hidden" name="permission" value="$p"/>
<select name="role">
<option py:for="role in c.project.roles"
value="$role._id"
>${role.display()}</option>
</select>
<input type="submit" value="Add role"/>
</form>
</div>
</py:for>
</div>
</div>
<div id="app-status">
<h3>Status</h3>
<div>
<form method="POST" action="set_status_names">
status names:
<input type="text" name="status_names" style="width:50%" value="${globals.status_names}"/>
<input type="submit" value="Save"/>
</form>
</div>
</div>
<div id="app-custom-fields">
<h3>Custom Fields</h3>
<div>
<div id="custom-field-list">
<div py:for="field in globals.custom_fields" style="display:none" class="custom-field-stub"
data-label="${field.label}" data-type="${field.type}" data-options="${getattr(field, 'options', '')}"/>
</div>
<button onclick="add_field()">Add Field</button>
<button onclick="save_fields()">Save</button>
</div>
</div>
</div>
<script type="text/javascript">
$(function() {
$("#app_admin_tabs").tabs();
});
$(function() {
$("#acl-admin").accordion({
autoHeight: false,
navigation: true
});
});
</script>
</body>
<script type="text/javascript" src="/static/Tickets/js/custom-fields.js"/>
</html>