Warning: session_start(): open(/var/lib/php/sessions/sess_hr90o3t5esdkfa76kguk7ktrkl, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
concept AIList {
S name;
S text;
long modified;
}
p {
db();
}
html {
if (!webAuthed()) ret redirectToWebAuth();
new Matches m;
// Show list
if (startsWith(uri, "/list/", m)) {
AIList l = conceptWhere(AIList, name := urldecode(m.get(0)));
if (l == null) ret "List not found";
// Update text
S text = params.get("human");
if (text != null) {
cset(l, +text);
ret hrefresh(rawLink(uri));
}
ret nav() + htitle_h2(htmlencode(l.name))
+ hpostform(h3("Contents (human-edited)")
+ htextarea(l.text, name := 'human, cols := 80, rows := 40)
+ hsubmit("Save"));
}
// New list
S newList = params.get('newList);
if (nempty(newList)) {
AIList l = uniq(AIList, name := newList);
ret hrefresh(rawLink("/list/" + urlencode(l.name)));
}
// Overview
ret htitle("Lists DB")
+ h3("Lists")
+ ul(map(list(AIList), func(AIList l) -> S {
ahref(rawLink("/list/" + urlencode(l.name)), htmlencode(l.name))
}))
+ h3("New list")
+ hpostform("Name: " + htextinput('newList) + " " + hsubmit("Create list"));
}
sS nav() {
ret p(ahref(rawLink(), "<< back"));
}