Child: [9652b9] (diff)

Download this file

admin.html    186 lines (181 with data), 8.2 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
<!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 pyforge.lib.security import has_artifact_access ?>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
<title>Admin for $c.project.name $app.config.options.mount_point</title>
</head>
<body>
<div id="app_admin_tabs">
<ul>
<li><a href="#app-config" py:if="len(app.config_options) > 1">$app.config.plugin_name Options</a></li>
<li><a href="#app-acl"
py:if="app.permissions and allow_config">Permissions</a></li>
<li><a href="#app-forums">Forums</a></li>
</ul>
<div id="app-config" py:if="len(app.config_options) > 1" style="overflow: auto">
<h3>$app.config.plugin_name Options</h3>
<form method="post" action="configure">
<py:for each="o in app.config_options" py:if="o.name != 'mount_point'">
<div class="span-3"><label for="$o.name" class="span-3">$o.name</label></div>
<div class="span-15 last" py:if="not allow_config">
${app.config.options.get(o.name, o.default)}
</div>
<div class="editable viewing span-15 last" style="min-height:1em;"
py:if="allow_config">
<div class="viewer">${app.config.options.get(o.name, o.default)}</div>
<div class="editor"><input name="$o.name" value="${app.config.options.get(o.name, o.default)}"/></div>
</div>
</py:for>
<div class="span-15 push-3 last">
<input type="submit" value="Update config" py:if="allow_config"
class="ui-state-default ui-button ui-button-text"/>
<input py:if="app.installable and allow_config" type="submit" name="delete" value="Delete Plugin"
class="ui-state-default ui-button ui-button-text"/>
</div>
</form>
</div>
<div id="app-acl" py:if="app.permissions and allow_config">
<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" py:if="role.display() != '*user-'+c.user.username"
class="ui-state-default ui-button ui-button-text"/>
</form>
</td>
</tr>
<tr>
<form method="POST" action="add_perm">
<td>
<select name="role">
<option py:for="role in c.project.roles"
value="$role._id"
>${role.display()}</option>
</select>
</td>
<td>
<input type="hidden" name="permission" value="$p"/>
<input type="submit" value="Add Permission" class="ui-state-default ui-button ui-button-text"/>
</td>
</form>
</tr>
</tbody>
</table>
</div>
</py:for>
</div>
</div>
<div id="app-forums">
<h3>Forums</h3>
<form method="POST" action="update_forums">
<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>[icon]</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">
${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"/>
${submit_button('Delete', 'forum-%s.delete' % i)}
</td>
</tr>
</tbody>
</table>
<input type="button" id="add_forum" value="Add another forum"
class="ui-state-default ui-button ui-button-text"/>
<div id="add_forum_form" style="display:none">
<div class="span-3 clear"><label>Name:</label></div>
<div class="span-13 last"><input type="text" name="new_forum.name" class="title wide"/></div>
<div class="span-3 clear"><label>Short Name:</label></div>
<div class="span-13 last"><input type="text" name="new_forum.shortname" class="title wide"/></div>
<div class="span-3 clear"><label>Parent Forum:</label></div>
<div class="span-13 last">
<select name="new_forum.parent" class="title">
<option value="">None</option>
<option py:for="f in app.forums" value="$f._id">$f.name</option>
</select>
</div>
<div class="span-3 clear"><label>Description:</label></div>
<div class="span-13 last"><textarea name="new_forum.description" class="title" style="height:50px; width:100%"/></div>
<div class="push-3 clear span-13 last">
<input type="submit" id="new_forum.create" name="new_forum.create" value="Create Forum"
class="ui-state-default ui-button ui-button-text"/>
<input type="button" id="add_forum_cancel" value="Cancel"
class="ui-state-default ui-button ui-button-text"/>
</div>
</div>
<div class="clear"/>
</form>
</div>
</div>
<script type="text/javascript">
$(function() {
$("#app_admin_tabs").tabs({cookie:{expires:30}});
$("#acl-admin").accordion({
autoHeight: false,
navigation: true
});
$("#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>
</body>
</html>