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).

1  
!7
2  
3  
concept Rule > ConceptWithGlobalID {
4  
  S text;
5  
  S page; // markDown
6  
  
7  
  sS _fieldOrder = "text page globalID";
8  
}
9  
10  
p { dbIndexing(Rule, 'globalID); }
11  
12  
html {
13  
  uri = dropSlashPrefix(uri);
14  
  
15  
  if (eqic(uri, "admin")) {
16  
    try object checkWebAuthed(params);
17  
    ret new HCRUD(rawLink("admin"), new HCRUD_Concepts(Rule)
18  
      .addRenderer(page := new HCRUD_Data.TextArea(80, 10))
19  
    ).renderPage(params);
20  
  }
21  
22  
  
23  
  if (empty(uri))
24  
    ret htitle_h1("Rules") + ul_noEncode(map(list(Rule), r -> ahref(rawLink(r.globalIDStr()), htmlEncode2(or2(r.text, "unnamed")))));
25  
    
26  
  if (possibleGlobalID(uri)) {
27  
    Rule r = conceptWhere(Rule, globalID := GlobalID(uri));
28  
    if (r == null) ret subBot_serve404("Rule not found");
29  
    ret htitle_h1(r.text) + markDownToHTML(r.page);
30  
  }
31  
  
32  
  ret subBot_serve404();
33  
}

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: 434 / 1652
Version history: 13 change(s)
Referenced in: [show references]