1 module servers.modeller.pages.sites; 2 3 @safe: 4 import servers.modeller; 5 6 void uimSites(HTTPServerRequest req, HTTPServerResponse res) { 7 debugMethodCall(moduleName!uimSites~":uimSites"); 8 9 APPPageController(serverModeller).request(req, res); 10 } 11 12 void uimSiteSelectAction(HTTPServerRequest req, HTTPServerResponse res) { 13 debugMethodCall(moduleName!uimSiteSelectAction~":uimSiteSelectAction"); 14 15 APPSelectSiteActionController(serverModeller).request(req, res); 16 } 17 /* 18 static this() { 19 serverModeller.pages("sites", new class DAPPPageController { 20 this() { 21 super(); 22 this 23 .checks([APPCheckAppSession, APPCheckSession]); 24 } 25 26 override DH5Obj toH5(STRINGAA options = null) { 27 super.toH5(reqParameters); 28 29 // debug writeln(StyledString("In serverModeller.index...").setForeground(AnsiColor.black).setBackground(AnsiColor.white)); 30 debug writeln("serverModeller.index -> reqParameters = ", reqParameters); 31 debug writeln("serverModeller.index -> pageTitle = ", reqParameters.get("pageTitle", "")); 32 33 DOOPEntity session; 34 DOOPEntity site; 35 auto appSession = getAppSession(options); 36 if (appSession) { 37 session = appSession.session; 38 site = appSession.site; } 39 auto sessionId = session ? session.id.toString : ""; 40 41 auto sites = database ? database["central", "sites"].findMany : null; 42 DH5Obj[] sitesContent; 43 sites.each!(a => sitesContent ~= 44 cast(DH5Obj)H5Div(["col-md-6 col-xl-3"], 45 H5Div(["ratio ratio-1x1"], 46 BS5Form(["method":"Post", "action": "/sites/select"], 47 BS5Card 48 .body_(["text-center"], 49 H5InputHidden("sessionId", ["name":"sessionId", "value":sessionId]), 50 H5InputHidden("siteId", ["name":"siteId", "value":a.id.toString]), 51 H5Div(["card-title mb-1"], a.display), 52 H5Div(["text-muted"], BS5ButtonSubmit(["btn-info"], "Site auswählen"))))))); 53 54 return 55 H5Div(["content"], 56 H5Div(["container-xl"], 57 BS5Row("messages", [""]), 58 BS5Row(["row-deck row-cards"], sitesContent))); 59 60 /* reqParameters["script"] = reqParameters.get("script", "") 61 ~"sessionStorage.setItem('sessionId', '%s'); sessionStorage.setItem('siteId', '%s');".format(sessionId, siteId); 62 * / 63 64 } 65 } 66 ); 67 } 68 69 */