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

33
LINES

< > BotCompany Repo | #1026102 // Rules Web Bot [dev.]

JavaX module (desktop) [tags: butter use-pretranspiled] - homepage

Download Jar. Uses 140K of libraries. Click here for Pure Java version (14956L/102K).

!7

concept Rule > ConceptWithGlobalID {
  S text;
  S page; // markDown
  
  sS _fieldOrder = "text page globalID";
}

p { dbIndexing(Rule, 'globalID); }

html {
  uri = dropSlashPrefix(uri);
  
  if (eqic(uri, "admin")) {
    try object checkWebAuthed(params);
    ret new HCRUD(rawLink("admin"), new HCRUD_Concepts(Rule)
      .addRenderer(page := new HCRUD_Data.TextArea(80, 10))
    ).renderPage(params);
  }

  
  if (empty(uri))
    ret htitle_h1("Rules") + ul_noEncode(map(list(Rule), r -> ahref(rawLink(r.globalIDStr()), htmlEncode2(or2(r.text, "unnamed")))));
    
  if (possibleGlobalID(uri)) {
    Rule r = conceptWhere(Rule, globalID := GlobalID(uri));
    if (r == null) ret subBot_serve404("Rule not found");
    ret htitle_h1(r.text) + markDownToHTML(r.page);
  }
  
  ret subBot_serve404();
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1026102
Snippet name: Rules Web Bot [dev.]
Eternal ID of this version: #1026102/14
Text MD5: 8741360f3c0b081c5e91a65eb6901d73
Transpilation MD5: efe89da0f714579151a58b3edf2a878b
Author: stefan
Category: javax
Type: JavaX module (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-11-24 00:04:42
Source code size: 841 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 433 / 1650
Version history: 13 change(s)
Referenced in: #1026126 - Rules + Inputs Web Bot