Warning: session_start(): open(/var/lib/php/sessions/sess_agrvnm5b3idn7q7bv72idkteuk, 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 Rule {
S globalID = aGlobalIDUnlessLoading();
S text;
S comments;
}
// Bug when making cmodule
module Rules > DynCRUD {
enhanceFrame { internalFrameIcon(f, gazelle_frameIcon()); }
start {
crud.multiLineFields = litset('text, 'comments);
crud.renderer = func(Rule r) -> Map { litorderedmap("ID" := r.globalID, text := joinWithSpace(tlft(r.text)), comments := escapeNewLines(r.comments)) };
onConceptsChange(r { vmBus_sendMessage('gazelleRulesChanged, this) });
}
// API
Pair addRule(S when, S then) {
ret addRule(when + "\n=> " + then);
}
Pair addRule(S text) {
ret addRuleWithComment(text, null);
}
Pair addRuleWithComment(S text, S comment) {
Pair p = uniq2_sync(Rule,
text := rtrim(text),
comment := nullIfEmpty(rtrim(comment)));
if (p.b) vmBus_sendMessage('gazelleRuleCreated, this, p.a);
ret pair(p.a.globalID, p.b);
}
}