Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

41
LINES

< > BotCompany Repo | #1002638 // Web Log Bot (Web)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (2714L/19K/59K).

!752


static S webLogProgramID = "#1002576";
static S webLog = "webLog";

static S html(S subUri, Map<S, S> params) {
  if (!master()) ret "Sorry, not authorized.";
  
  L<S> keepFields = litlist("full", "n");
  
  boolean full = webTrue(params.get("full"));
  L data; // contains maps or structure()-d maps
  if (full)
    data = scanLog(getProgramFile(webLogProgramID, webLog));
  else
    data = (L) call(getMainBot(), "getRecentWebLog");
  new StringBuffer buf;
  
  pcall {
    int x = 0;

    int n;
    if (!empty(params.get("n")))
      n = parseInt(params.get("n"));
    else
      n = max(0, l(data)-1)/100*100;
      
    for (int i = min(n+100, l(data))-1; i >= n; i--) {
      S entry = structureOrText(data.get(i));
      buf.append("Entry " + (i+1) + ": " + entry + "\n");
    }
  }
  
  ret p(href(selfLink(params, keepFields, "full", "0"), "Recent Log")
    + " | "
    + href(selfLink(params, keepFields, "full", "1"), "Full Log"))
    + p("n=" + l(data))
    + pageNav(params, keepFields, l(data), "n") // has its own <p>
    + sourceCodeToHTML(buf);
}

Author comment

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: 714 / 4397
Referenced in: #3000202 - Answer for stefanreich (>> T conversion bot)
#3000203 - Answer for stefanreich (>> timing hello bot)
#3000208 - Answer for bgrgndz (>> list sub bots)
#3000209 - Answer for bgrgndz (>> list sub bots)
#3000238 - Answer for stefanreich (>> t power bot)
#3000369 - Answer for Stefan (>> list sub bots)
#3000376 - Answer for stefanreich (>> list sub bots)
#3000377 - Answer for stefanreich (>> timing eleu?)
#3000380 - Answer for stefanreich (>> list sub bots)
#3000381 - Answer for speedforce (>> list sub bots)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)