!7 concept Entry { S computerID, shortName, comment; S controllableByMe; sS _fieldOrder = "shortName computerID comment"; } cmodule2 ComputerNames > DynCRUD { bool automaticallyAddOnlineComputers = true; start { indexConceptField(Entry, 'computerID); // Add myself cset(uniq_returnIfNew(Entry, computerID := computerID()), comment := "This computer"); dm_vmBus_onMessage('onlineComputerIDs, voidfunc(Collection ids) { if (automaticallyAddOnlineComputers) slurpIDs(ids) }); dm_requireAndCall("#1016578/AllOnlineComputers", 'updateList); // Add currently online computers pcall { slurpIDs((LS) dm_callModuleOpt(dm_findModule("#1016578/AllOnlineComputers"), 'onlineComputerIDs)); } onConceptsChange(r { dm_findAndCallModule("#1016578/AllOnlineComputers", 'updateList) }); dm_registerAs('controllableComputerList); } // API svoid slurpIDs(Collection ids) { for (S id : unnull(ids)) uniq(Entry, computerID := id); } S nameForID(S computerID) { ret cget(conceptWhere(Entry, +computerID), 'shortName); } void setControllableByMe(S computerID, bool b) { cset(uniq(Entry, +computerID), controllableByMe := yesNo_short(b)); } LS controllableComputers() { ret withoutMyComputerID(collect('computerID, conceptsWhere(Entry, controllableByMe := 'yes))); } void openDialogForComputerID(S computerID) { if (isComputerID(computerID)) crud.editConcept(uniq Entry(+computerID)); } }