Warning: session_start(): open(/var/lib/php/sessions/sess_eipilrrmnpe36avu1jbf4sk5vv, 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 AskMeAQuestion {
S question, answer;
visualize {
if (empty(question)) newQuestion();
JLabel lblQ = dm_fieldLabel('question);
componentPopupMenuItem(lblQ, "Suggest question...", r {
inputText("Question", question, voidfunc(S s) {
setField(question := s)
})
});
ret withRightMargin(makeForm2(
"Computer question", lblQ,
"Human answer", centerAndEastWithMargin(onEnter(dm_fieldTextField('answer), rThread submit),
jbutton("Submit", rThread submit)),
"", withTopMargin(15, rightAlignedButtons("Ask me something else", rThread newQuestion))));
}
S randomWord() {
ret randomEnglishWordFromDictionary();
}
S makeQuestion() {
ret "Is " + randomWord() + " the same as " + randomWord() + "?";
}
void newQuestion enter {
setFields(answer := "", question := makeQuestion());
programLogStructure(litorderedmap(+question));
vmBus_send('showingQuestion, module(), question);
}
void submit enter {
programLogStructure(litorderedmap(+question, +answer));
vmBus_send('userAnsweredQuestion, module(), question, answer);
dm_addQAndA_infoBox(question, answer);
newQuestion();
}
}