Warning: session_start(): open(/var/lib/php/sessions/sess_vgt5tpaq58vrf8dl9dkqo8urg4, 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 ServerModuleSearch extends DynCalculatedList {
transient S query;
transient S dbID;
void start {
calculateWhenHidden = true;
dbID = dm_requireModule("#1016872/SnippetsDB");
}
JComponent visualize() {
JComponent c = super.visualize();
onDoubleClickOrEnter(list, r { dm_hideModule() });
ret c;
}
void update {
S s = unnullTrim(dm_getInterestingString());
if (neq(s, query)) {
query = s;
super.update();
if (nempty(query) && print("have results: ", nempty(results)))
dm_placeModuleUnderAIBar(this);
else
dm_hideModule();
}
}
L calc() {
if (empty(query)) ret emptyList();
// L
L snippets = cast callOpt(dm_getModule(dbID), 'snippetsOfType, snippetType_dynModule());
print("dbID=" + dbID + ", full snippets: " + l(snippets));
ret scoredSearch(dm_getInterestingString(),
map(snippets, func(fO snippet) -> S {
fsI(getLong(snippet, 'id))
+ " - "
+ _get(snippet, 'title) }));
}
}