mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-24 11:38:27 +02:00
ENiGMA 1/2 WILL USE SPACES FROM THIS POINT ON VS TABS
* Really just to make GitHub formatting happy. Arg.
This commit is contained in:
parent
5ddf04c882
commit
e9787cee3e
135 changed files with 27397 additions and 27397 deletions
|
@ -14,135 +14,135 @@ const async = require('async');
|
|||
const _ = require('lodash');
|
||||
|
||||
exports.moduleInfo = {
|
||||
name : 'Message Conference List',
|
||||
desc : 'Module for listing / choosing message conferences',
|
||||
author : 'NuSkooler',
|
||||
name : 'Message Conference List',
|
||||
desc : 'Module for listing / choosing message conferences',
|
||||
author : 'NuSkooler',
|
||||
};
|
||||
|
||||
const MciViewIds = {
|
||||
ConfList : 1,
|
||||
ConfList : 1,
|
||||
|
||||
// :TODO:
|
||||
// # areas in conf .... see Obv/2, iNiQ, ...
|
||||
//
|
||||
// :TODO:
|
||||
// # areas in conf .... see Obv/2, iNiQ, ...
|
||||
//
|
||||
};
|
||||
|
||||
exports.getModule = class MessageConfListModule extends MenuModule {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
constructor(options) {
|
||||
super(options);
|
||||
|
||||
this.messageConfs = messageArea.getSortedAvailMessageConferences(this.client);
|
||||
const self = this;
|
||||
this.messageConfs = messageArea.getSortedAvailMessageConferences(this.client);
|
||||
const self = this;
|
||||
|
||||
this.menuMethods = {
|
||||
changeConference : function(formData, extraArgs, cb) {
|
||||
if(1 === formData.submitId) {
|
||||
let conf = self.messageConfs[formData.value.conf];
|
||||
const confTag = conf.confTag;
|
||||
conf = conf.conf; // what we want is embedded
|
||||
this.menuMethods = {
|
||||
changeConference : function(formData, extraArgs, cb) {
|
||||
if(1 === formData.submitId) {
|
||||
let conf = self.messageConfs[formData.value.conf];
|
||||
const confTag = conf.confTag;
|
||||
conf = conf.conf; // what we want is embedded
|
||||
|
||||
messageArea.changeMessageConference(self.client, confTag, err => {
|
||||
if(err) {
|
||||
self.client.term.pipeWrite(`\n|00Cannot change conference: ${err.message}\n`);
|
||||
messageArea.changeMessageConference(self.client, confTag, err => {
|
||||
if(err) {
|
||||
self.client.term.pipeWrite(`\n|00Cannot change conference: ${err.message}\n`);
|
||||
|
||||
setTimeout( () => {
|
||||
return self.prevMenu(cb);
|
||||
}, 1000);
|
||||
} else {
|
||||
if(_.isString(conf.art)) {
|
||||
const dispOptions = {
|
||||
client : self.client,
|
||||
name : conf.art,
|
||||
};
|
||||
setTimeout( () => {
|
||||
return self.prevMenu(cb);
|
||||
}, 1000);
|
||||
} else {
|
||||
if(_.isString(conf.art)) {
|
||||
const dispOptions = {
|
||||
client : self.client,
|
||||
name : conf.art,
|
||||
};
|
||||
|
||||
self.client.term.rawWrite(resetScreen());
|
||||
self.client.term.rawWrite(resetScreen());
|
||||
|
||||
displayThemeArt(dispOptions, () => {
|
||||
// pause by default, unless explicitly told not to
|
||||
if(_.has(conf, 'options.pause') && false === conf.options.pause) {
|
||||
return self.prevMenuOnTimeout(1000, cb);
|
||||
} else {
|
||||
self.pausePrompt( () => {
|
||||
return self.prevMenu(cb);
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return self.prevMenu(cb);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return cb(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
displayThemeArt(dispOptions, () => {
|
||||
// pause by default, unless explicitly told not to
|
||||
if(_.has(conf, 'options.pause') && false === conf.options.pause) {
|
||||
return self.prevMenuOnTimeout(1000, cb);
|
||||
} else {
|
||||
self.pausePrompt( () => {
|
||||
return self.prevMenu(cb);
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return self.prevMenu(cb);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return cb(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
prevMenuOnTimeout(timeout, cb) {
|
||||
setTimeout( () => {
|
||||
return this.prevMenu(cb);
|
||||
}, timeout);
|
||||
}
|
||||
prevMenuOnTimeout(timeout, cb) {
|
||||
setTimeout( () => {
|
||||
return this.prevMenu(cb);
|
||||
}, timeout);
|
||||
}
|
||||
|
||||
mciReady(mciData, cb) {
|
||||
super.mciReady(mciData, err => {
|
||||
if(err) {
|
||||
return cb(err);
|
||||
}
|
||||
mciReady(mciData, cb) {
|
||||
super.mciReady(mciData, err => {
|
||||
if(err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
const self = this;
|
||||
const vc = self.viewControllers.areaList = new ViewController( { client : self.client } );
|
||||
const self = this;
|
||||
const vc = self.viewControllers.areaList = new ViewController( { client : self.client } );
|
||||
|
||||
async.series(
|
||||
[
|
||||
function loadFromConfig(callback) {
|
||||
let loadOpts = {
|
||||
callingMenu : self,
|
||||
mciMap : mciData.menu,
|
||||
formId : 0,
|
||||
};
|
||||
async.series(
|
||||
[
|
||||
function loadFromConfig(callback) {
|
||||
let loadOpts = {
|
||||
callingMenu : self,
|
||||
mciMap : mciData.menu,
|
||||
formId : 0,
|
||||
};
|
||||
|
||||
vc.loadFromMenuConfig(loadOpts, callback);
|
||||
},
|
||||
function populateConfListView(callback) {
|
||||
const listFormat = self.menuConfig.config.listFormat || '{index} ) - {name}';
|
||||
const focusListFormat = self.menuConfig.config.focusListFormat || listFormat;
|
||||
vc.loadFromMenuConfig(loadOpts, callback);
|
||||
},
|
||||
function populateConfListView(callback) {
|
||||
const listFormat = self.menuConfig.config.listFormat || '{index} ) - {name}';
|
||||
const focusListFormat = self.menuConfig.config.focusListFormat || listFormat;
|
||||
|
||||
const confListView = vc.getView(MciViewIds.ConfList);
|
||||
let i = 1;
|
||||
confListView.setItems(_.map(self.messageConfs, v => {
|
||||
return stringFormat(listFormat, {
|
||||
index : i++,
|
||||
confTag : v.conf.confTag,
|
||||
name : v.conf.name,
|
||||
desc : v.conf.desc,
|
||||
});
|
||||
}));
|
||||
const confListView = vc.getView(MciViewIds.ConfList);
|
||||
let i = 1;
|
||||
confListView.setItems(_.map(self.messageConfs, v => {
|
||||
return stringFormat(listFormat, {
|
||||
index : i++,
|
||||
confTag : v.conf.confTag,
|
||||
name : v.conf.name,
|
||||
desc : v.conf.desc,
|
||||
});
|
||||
}));
|
||||
|
||||
i = 1;
|
||||
confListView.setFocusItems(_.map(self.messageConfs, v => {
|
||||
return stringFormat(focusListFormat, {
|
||||
index : i++,
|
||||
confTag : v.conf.confTag,
|
||||
name : v.conf.name,
|
||||
desc : v.conf.desc,
|
||||
});
|
||||
}));
|
||||
i = 1;
|
||||
confListView.setFocusItems(_.map(self.messageConfs, v => {
|
||||
return stringFormat(focusListFormat, {
|
||||
index : i++,
|
||||
confTag : v.conf.confTag,
|
||||
name : v.conf.name,
|
||||
desc : v.conf.desc,
|
||||
});
|
||||
}));
|
||||
|
||||
confListView.redraw();
|
||||
confListView.redraw();
|
||||
|
||||
callback(null);
|
||||
},
|
||||
function populateTextViews(callback) {
|
||||
// :TODO: populate other avail MCI, e.g. current conf name
|
||||
callback(null);
|
||||
}
|
||||
],
|
||||
function complete(err) {
|
||||
cb(err);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
callback(null);
|
||||
},
|
||||
function populateTextViews(callback) {
|
||||
// :TODO: populate other avail MCI, e.g. current conf name
|
||||
callback(null);
|
||||
}
|
||||
],
|
||||
function complete(err) {
|
||||
cb(err);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue