Mercurial Hosting > nabble
view 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 |
line wrap: on
line source
<macro name="view_log" requires="servlet"> <n.if.not.visitor.is_site_admin> <then> <n.login.><t>Only authorized users can proceed in this area.</t></n.login.> </then> </n.if.not.visitor.is_site_admin> <n.html> <head> <n.title.>Template Logs</n.title.> <script type="text/javascript"> function refreshLog() { var call = '/template/NamlServlet.jtp?macro=get_site_log'; $.get(call, function(data) { data = Nabble.trim(data); data = data.length == 0? 'Log is empty' : '<pre>'+data+'</pre>'; $('#log_data').html(data); }); }; function clearLog() { var call = '/template/NamlServlet.jtp?macro=clear_site_log'; $.get(call, function(data) { if (Nabble.trim(data) == 'ok') $('#log_data').html('Log is empty'); }); }; </script> </head> <body> <n.edit_header first_text="Template Logs" second_text="[n.root_node.get_app_node.subject/]" /> <div style="margin:.5em 0"> <button class="toolbar" style="font-weight:bold" onclick="refreshLog()"><t>Refresh</t></button> <button class="toolbar" style="font-weight:bold" onclick="clearLog()"><t>Clear Log</t></button> </div> <div id="log_data" style="padding:.3em;margin-top:.5em;overflow-x:auto"> <n.if.is_empty.get_log> <then><t>Log is empty</t></then> <else> <pre><n.get_log/></pre> </else> </n.if.is_empty.get_log> </div> </body> </n.html> </macro> <macro name="clear_site_log" requires="servlet"> <n.if.visitor.is_site_admin> <then> <n.root_node.clear_log/> ok </then> </n.if.visitor.is_site_admin> </macro> <macro name="get_site_log" requires="servlet"> <n.if.visitor.is_site_admin> <then.get_log/> </n.if.visitor.is_site_admin> </macro> <macro name="do_nothing"> </macro>