Libraryless. Click here for Pure Java version (2714L/19K/59K).
1 | !752 |
2 | |
3 | |
4 | static S webLogProgramID = "#1002576"; |
5 | static S webLog = "webLog"; |
6 | |
7 | static S html(S subUri, Map<S, S> params) { |
8 | if (!master()) ret "Sorry, not authorized."; |
9 | |
10 | L<S> keepFields = litlist("full", "n"); |
11 | |
12 | boolean full = webTrue(params.get("full")); |
13 | L data; // contains maps or structure()-d maps |
14 | if (full) |
15 | data = scanLog(getProgramFile(webLogProgramID, webLog)); |
16 | else |
17 | data = (L) call(getMainBot(), "getRecentWebLog"); |
18 | new StringBuffer buf; |
19 | |
20 | pcall { |
21 | int x = 0; |
22 | |
23 | int n; |
24 | if (!empty(params.get("n"))) |
25 | n = parseInt(params.get("n")); |
26 | else |
27 | n = max(0, l(data)-1)/100*100; |
28 | |
29 | for (int i = min(n+100, l(data))-1; i >= n; i--) { |
30 | S entry = structureOrText(data.get(i)); |
31 | buf.append("Entry " + (i+1) + ": " + entry + "\n"); |
32 | } |
33 | } |
34 | |
35 | ret p(href(selfLink(params, keepFields, "full", "0"), "Recent Log") |
36 | + " | " |
37 | + href(selfLink(params, keepFields, "full", "1"), "Full Log")) |
38 | + p("n=" + l(data)) |
39 | + pageNav(params, keepFields, l(data), "n") // has its own <p> |
40 | + sourceCodeToHTML(buf); |
41 | } |
Began life as a copy of #1002378
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1002638 |
Snippet name: | Web Log Bot (Web) |
Eternal ID of this version: | #1002638/1 |
Text MD5: | 5bc1995be890efd6913c03ee16f58b4e |
Transpilation MD5: | b45613ad9f8a10a793b686a09c17bc1e |
Author: | stefan |
Category: | nl bots |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-10-31 05:01:31 |
Source code size: | 1112 bytes / 41 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 796 / 4543 |
Referenced in: | [show references] |