Warning: session_start(): open(/var/lib/php/sessions/sess_a1ur32pia5eepgsdiusfvt19sc, 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
sclass Msg {
S author, text;
long created = now();
}
concept ItemPage {
S globalID = aGlobalID();
S title, imageID;
long created = now(), occurred;
L comments = listInConcept(this);
}
static JTextPane textPane;
static JTextField tfComment;
static ItemPage page;
p-subst {
setConsoleInputFontSize(20);
centerConsoleInput();
centerBottomConsole();
db();
bot("Show Item Page.");
focusConsole();
}
static bool showItemPage(S _word) {
final new ItemPage p;
fS word = trim(_word);
cset(p, title := word);
showPage(p);
true;
}
svoid showPage(final ItemPage p) {
swing {
page = p;
fS shorter = deUserSaid(p.title);
JFrame f = getFrame(textPane);
fS text = p.title + "\n\n";
JTextPane oldTextPane = textPane;
textPane = jcenteredtextpane(text, style_bold(style_fontSize(24)));
if (oldTextPane != null) {
replaceAWTComponent(oldTextPane, textPane);
frameToFront(f);
} else {
showFrame(shorter, textPane);
addToFrame(textPane, withLabel("Add Comment:", centerAndEast(tfComment = jtextfield(), jbutton("OK", f addComment))));
onEnter(tfComment, f addComment);
}
textPane.setEditable(false);
focusConsole();
if (p.imageID == null) thread {
BufferedImage img = quickVisualize(shorter);
if (p.imageID != null) ret;
cset(p, imageID := "quickvis/" + urlencode(quickVisualize_preprocess(shorter)) + "/" + md5OfBufferedImage(img));
showPage(p);
} else {
BufferedImage img = quickVisualize(shorter);
addImageToTextPane(textPane, img); // sync OK, uses swing {}
}
for (Msg c : p.comments)
appendToTextPane(textPane, "\n\n" + c.author + ": " + c.text, style_normal());
centerTextPane(textPane);
}
}
answer {
if "quickrun *" run($1);
if (showItemPage(s)) ret "OK";
}
svoid addComment {
S text = getTextTrim(tfComment);
if (empty(text)) ret;
page.comments.add(nuWithValues(Msg, author := 'User, +text));
showPage(page);
}