Roxen.git/
server/
config_interface/
logutil.pike
Branch:
Tag:
Non-build tags
All tags
No tags
2017-05-23
2017-05-23 19:33:18 by Pontus Östlund <ponost@roxen.com>
fc8ffc86a5945d4ee57d9b3ef80159434d6df7e8 (
84
lines) (+
56
/-
28
)
[
Show
|
Annotate
]
Branch:
ponost/admin-if-17
Most of the UI is now rewritten.
1:
+
#include <config_interface.h>
#include <config.h> #include <roxen.h> //<locale-token project="roxen_config">LOCALE</locale-token>
-
#define LOCALE(X,Y) _STR_LOCALE("roxen_config",X,Y)
-
#define CALL(X,Y) _LOCALE_FUN("roxen_config",X,Y)
+
#define LOCALE(X,Y) _STR_LOCALE("roxen_config",X,Y)
+
#define CALL(X,Y) _LOCALE_FUN("roxen_config",X,Y)
int __lt; string describe_time(int t)
78:
return Roxen.html_encode_string(capitalize(s)); }
+
+
constant logitem_tmpl = #"
+
<ul class='logitem'>
+
<li class='err-{{ code }}' title='{{ code_text }}'>
+
{{ &links }}
+
{{ #times }}<span class='times'>{{ times }}</span><br>{{ /times }}
+
{{ &message }}
+
</li>
+
</ul>";
+
int last_time; string describe_error(string err, array (int) times, string lang, int|void no_links)
91:
if(sizeof(times)==1 && times[0]/60==last_time) nt=1; last_time=times[0]/60; sscanf(err, "%d,%[^,],%s", code, reference, err);
+
switch(no_links) { Configuration conf;
106:
@get_conf_url_to_module( module, lang )); }
-
return "<table class='logitems'><tr><td><img src=&usr.err-"+code+"; \n"
-
"alt=\"" + codetext[code-1] + "\" />"
-
"</td><td>" + links + (nt?"":describe_times(times)+"<br />") +
-
replace(fix_err(err), "\n", "<br />\n") + "</table>";
+
mapping mctx = ([
+
"code" : code,
+
"code_text" : codetext[code-1],
+
"links" : links,
+
"times" : nt ? 0 : describe_times(times),
+
"message" : replace(fix_err(err), "\n", "<br />\n")
+
]);
+
+
Mustache stache = Mustache();
+
string out = stache->render(logitem_tmpl, mctx);
+
+
destruct(stache);
+
+
return
out;
+
+
// return
"<table class='logitems'><tr><td><img src=&usr.err-"+code+"; \n"
+
//
"alt=\"" + codetext[code-1] + "\" />"
+
//
"</td><td>" + links + (nt?"":describe_times(times)+"<br />") +
+
//
replace(fix_err(err), "\n", "<br />\n") + "</table>";
}