Warning: session_start(): open(/var/lib/php/sessions/sess_iel6bo4t0okurr0jore4fva90v, 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
cmodule ConvoPopup > DynModule {
L posts = dm_synchroList(this);
int windowWidth = 400, windowHeight = 400;
S userInput;
S text; bool right; // for form
bool popupVisible;
transient JChatConvo view;
srecord Post(S html, bool right) {}
start {
componentFieldsToKeep = litset('view); // we clean it up ourselves
if (popupVisible)
openPopup();
}
visual
withCenteredButtons(withMargin(jvstack(
centerAndEastWithMargin(dm_textField text(),
jline(dm_checkBox right(),
jbutton("Add post", rEnter { addPost(text, right) }))))),
"Show popup", rEnter openPopup,
"Clear posts", rEnter clearPosts);
void cleanMeUp {
JComponent v = view;
view = null;
disposeFrame(v);
}
// API
void openPopup swing {
if (view == null) {
setField(popupVisible := true);
view = new JChatConvo;
for (Post p : cloneList(posts))
view.addPost(p.html, p.right);
JComponent content = centerAndSouth(
jscroll_trackWidth(view),
withMargin(dm_textFieldAndSubmit userInput('sendInput, buttonText := "Send")));
alwaysOnTop(showFrameInBottomRightCorner(content, windowWidth, windowHeight));
onFrameClosing(content, r { if (view != null) setField(popupVisible := false) });
} else
activateFrame(view);
}
void sendInput {
S s = trim(userInput);
if (nempty(s)) {
addPost(htmlEncode2(s), false);
setField(userInput := "");
}
}
void addPost(S html, bool right) swing {
posts.add(new Post(html, right));
view?.addPost(html, right);
}
void clearPosts swing { posts.clear(); view?.clearPosts(); }
}