-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.html
130 lines (114 loc) · 4.67 KB
/
admin.html
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
{% extends "index.html" %}
{% block sidebar %}
<h3><a href="/admin">Admin</a></h3>
<div class="sb1">
<div>Do admin stuff here.</div>
{% endblock %}
{% block main %}
<div class="book3" style="text-align: left;">
<form method="get" action="/admin">
<p>command: <select name="command">
<option value="delete story">delete story
<option value="delete story collection">delete story collection
<option value="move pages">move pages
<option value="purge unused images">purge unused images
</select></p>
<p>var: <input type="text" name="var" size="50"></p>
<p>var2: <input type="text" name="var2" size="50"></p>
<p><input type="submit" onclick="this.form.submit();this.disabled=true"></p>
</form>
</div>
<div class="book3" style="text-align: left;">
<p id="msgBar" style="font-size: x-small;">
{{ output }}
</p>
</div>
<hr><div id="books" class="book3"><h1>Submitted Stories For Approval</h1></div>
<div class="books">
{% for as in adventureStatuses %}
<div class="book">
<center><b><a href="/playStory?myAdventureKey={{ as.submittedAdventure.key }}">{{ as.submittedAdventure.title|escape }}</a></b><br>
<i>{{ as.submittedAdventure.author|escape }}</i><br>
{{ as.submittedAdventure.created.date }}</center><hr>
<code>{{ as.submittedAdventure.desc|escape }}</code><hr>
<code>{{ as.comment|escape }}</code><hr>
{% if as.submittedAdventure.coverImage %}<img src="/images/{{ as.submittedAdventure.coverImage }}.png"><hr>{% endif %}
<table><tr>
<td class="myStoryButton"><a href="/createStory?myAdventureKey={{ as.submittedAdventure.key }}"><div class="icon-edit"></div>Edit Title & Description</a></td>
<td class="myStoryButton"><a href="/storyEditor?myAdventureKey={{ as.submittedAdventure.key }}"><div class="icon-storyEdit"></div>StoryForge</a></td>
<td class="myStoryButton"><a href="/share?myAdventureKey={{ as.submittedAdventure.key }}"><div class="icon-share"></div>Share</a></td>
<td><a href="javascript:approve('yes', '{{ as.key }}')">Approve</a>
<br><br><a href="javascript:approve('no', '{{ as.key }}')">Deny</a></td>
</tr></table>
</div>
{% endfor %}
</div>
<div class="dialog" id="dialogSubmit" style="visibility:hidden">
<div id="dialogHeader" class="hd">Approve This Story</div>
<div class="bd">
<form name="formSubmit" method="POST" action="/admin">
<p id="dialogDesc"></p><hr><p>Your Comments:</p>
<textarea style="margin:10px;" cols="50" rows="3" name="adminComment"></textarea>
<input id="formStatusKey" type="hidden" name="myStatusKey" value="" />
<input id="formApproved" type="hidden" name="approved" value="" />
</form>
</div>
</div>
{% endblock %}
{% block index %}
{% endblock %}
{% block footer %}
<script type="text/javascript" src="http://yui.yahooapis.com/combo?2.6.0/build/utilities/utilities.js&2.6.0/build/container/container-min.js&2.6.0/build/resize/resize-min.js&2.6.0/build/imagecropper/imagecropper-beta-min.js&2.6.0/build/json/json-min.js&2.6.0/build/treeview/treeview-min.js"></script>
<script type="text/javascript">
//Add an onDOMReady handler to build the tree when the document is ready
YAHOO.util.Event.onDOMReady(treeInit);
//set shortcuts for common yahoo stuff
var YUD = YAHOO.util.Dom, YUE = YAHOO.util.Event, YUC = YAHOO.util.Connect;
//if there is no console, set it to null
try { console.log('init console... done'); } catch(e) { console = { log: function() {} } }
var myDialog = null;
function treeInit() {
myDialog = new YAHOO.widget.Dialog("dialogSubmit",
{
width: "30em",
fixedcenter: true,
visible: false,
constraintoviewport: true,
buttons: [
{ text:"Yes", handler:handleYes, isDefault:true },
{ text:"No", handler:handleNo }
]
} );
myDialog.callback.success = submitSuccess;
myDialog.callback.failure = submitFailure;
}
var submitSuccess = function(o) {
console.log('submit success: ' + o.responseText);
YUD.get("msgBar").innerHTML = o.responseText;
}
var submitFailure = function(o) {
console.log("submit: fail");
}
// Instantiate the Dialog
function approve(approved, statusKey) {
var myText = "None";
var myHeader = "None";
if (approved == 'yes') { myText = "Are you sure you want to APPROVE this story?"; myHeader = "APPROVE"; }
else if (approved == 'no') { myText = "Are you sure you want to DENY this story?"; myHeader = "DENY"; }
YUD.get("dialogHeader").innerHTML = myHeader;
YUD.get("dialogDesc").innerHTML = myText;
YUD.get("formStatusKey").value = statusKey;
YUD.get("formApproved").value = approved;
console.log("showing approve(" + approved + ") form for key: " + statusKey);
myDialog.render();
myDialog.show();
}
// Define various event handlers for Dialog
var handleYes = function() {
this.submit();
};
var handleNo = function() {
this.hide();
};
</script>
{% endblock %}