!7 concept Rule > ConceptWithGlobalID { S input; S output; S variables; // comma-separated sS _fieldOrder = "globalID input output variables"; } concept Example > ConceptWithGlobalID { Rule rule; S input, output; SS mapping; sS _fieldOrder = "globalID rule input output mapping"; } p { dbIndexing(Rule, 'globalID, Example, 'rule); } html { uri = dropSlashPrefix(uri); if (eqic(uri, "admin")) { try object checkWebAuthed(params); ret new HCRUD(rawLink("admin"), new HCRUD_Concepts(Rule) { MapSO itemToMap(Rule r) { ret mapPlus(super.itemToMap(r), "Examples" := countConcepts(Example, rule := r)); } }.fieldHelp(variables := "comma-separated") ) { S renderValue(S field, O value) { S html = super.renderValue(field, value); if (eq(field, 'globalID)) ret ahref(rawLink(str(value)), html); if (eq(field, 'input)) ret b(html); ret html; } }.renderPage(params); } if (empty(uri)) ret htitle_h1("Rules") + (webAuthed(params) ? p(ahref(rawLink("admin"), "Admin")) : "") + ul_noEncode(map(list(Rule), r -> ahref(rawLink(r.globalIDStr()), htmlEncode2(r.input + " => " + r.output)))); if (possibleGlobalID(uri)) { Rule r = conceptWhere(Rule, globalID := GlobalID(uri)); if (r == null) ret subBot_serve404("Rule not found"); ret htitle_h1("Rule " + r.globalID) + htmlTable2(litorderedmap("Input" := r.input, "Output" := r.output)); } ret subBot_serve404(); }