comparison src/nabble/view/naml/tools.naml @ 0:7ecd1a4ef557

add content
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 Mar 2019 19:15:52 -0600
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:7ecd1a4ef557
1 <macro name="view_log" requires="servlet">
2 <n.if.not.visitor.is_site_admin>
3 <then>
4 <n.login.><t>Only authorized users can proceed in this area.</t></n.login.>
5 </then>
6 </n.if.not.visitor.is_site_admin>
7 <n.html>
8 <head>
9 <n.title.>Template Logs</n.title.>
10 <script type="text/javascript">
11 function refreshLog() {
12 var call = '/template/NamlServlet.jtp?macro=get_site_log';
13 $.get(call, function(data) {
14 data = Nabble.trim(data);
15 data = data.length == 0? 'Log is empty' : '<pre>'+data+'</pre>';
16 $('#log_data').html(data);
17 });
18 };
19 function clearLog() {
20 var call = '/template/NamlServlet.jtp?macro=clear_site_log';
21 $.get(call, function(data) {
22 if (Nabble.trim(data) == 'ok')
23 $('#log_data').html('Log is empty');
24 });
25 };
26 </script>
27 </head>
28 <body>
29 <n.edit_header first_text="Template Logs" second_text="[n.root_node.get_app_node.subject/]" />
30 <div style="margin:.5em 0">
31 <button class="toolbar" style="font-weight:bold" onclick="refreshLog()"><t>Refresh</t></button>
32 <button class="toolbar" style="font-weight:bold" onclick="clearLog()"><t>Clear Log</t></button>
33 </div>
34 <div id="log_data" style="padding:.3em;margin-top:.5em;overflow-x:auto">
35 <n.if.is_empty.get_log>
36 <then><t>Log is empty</t></then>
37 <else>
38 <pre><n.get_log/></pre>
39 </else>
40 </n.if.is_empty.get_log>
41 </div>
42 </body>
43 </n.html>
44 </macro>
45
46 <macro name="clear_site_log" requires="servlet">
47 <n.if.visitor.is_site_admin>
48 <then>
49 <n.root_node.clear_log/>
50 ok
51 </then>
52 </n.if.visitor.is_site_admin>
53 </macro>
54
55 <macro name="get_site_log" requires="servlet">
56 <n.if.visitor.is_site_admin>
57 <then.get_log/>
58 </n.if.visitor.is_site_admin>
59 </macro>
60
61 <macro name="do_nothing">
62 </macro>