Warning: session_start(): open(/var/lib/php/sessions/sess_ntsgmggoda2bskura2jrptmocc, 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 GeneralDefinitions extends DynModule {
transient S term;
transient JPanel stack;
transient JTextField tfInput;
transient JCheckBox cbInput;
transient S listName = "General definitions (long list)";
JComponent visualize() {
tfInput = jtextfield();
cbInput = jcheckbox();
onChangeAndNow(cbInput, r { setEnabled(tfInput, isChecked(cbInput)) });
ret northCenterAndSouth(
westAndCenter(cbInput, tfInput),
stack = dynamicVStack2(),
withMargin(jcenteredbutton("Add definition...", r {
fS t = term;
inputText("Definition for: " + t, voidfunc(S def) {
addToMechMap(listName, litmap(t, def));
infoBox("Definition added: " + t + " = " + def);
update();
});
})));
}
void update {
bool myInput = isChecked(cbInput);
fS s = trim(myInput ? getText(tfInput) : dm_getInterestingString());
if (!myInput) setText(tfInput, s);
term = s;
MultiMap map = mechMultiMapCI(listName);
L answers = map.get(s);
MultiMap map2 = mechMultiMapCI("Unauthorized Appends | " + listName);
L answers2 = map2.get(s);
S text = "";
if (empty(answers) && empty(answers2)) text = "No definitions found for " + quote(s);
else
text = lines(concatLists(
map(answers, func(S a) -> S { s + " = " + a }),
map(answers2, func(S a) -> S { s + " " + unicode_questionedEquals() + " " + a }),
));
replaceAllComponents(stack, ll(fontSize(17, jCenteredMultiLineLabel(text))));
}
}