Merge pull request #66 from apamment/master
Message Areas/Conference Next / Prev
This commit is contained in:
commit
e7e6f1ea54
|
@ -5,6 +5,7 @@
|
||||||
const Config = require('./config.js').config;
|
const Config = require('./config.js').config;
|
||||||
const Log = require('./logger.js').log;
|
const Log = require('./logger.js').log;
|
||||||
const getMessageAreaByTag = require('./message_area.js').getMessageAreaByTag;
|
const getMessageAreaByTag = require('./message_area.js').getMessageAreaByTag;
|
||||||
|
const getMessageConferenceByTag = require('./message_area.js').getMessageConferenceByTag;
|
||||||
const clientConnections = require('./client_connections.js');
|
const clientConnections = require('./client_connections.js');
|
||||||
const sysProp = require('./system_property.js');
|
const sysProp = require('./system_property.js');
|
||||||
|
|
||||||
|
@ -68,6 +69,10 @@ function getPredefinedMCIValue(client, code) {
|
||||||
const area = getMessageAreaByTag(client.user.properties.message_area_tag);
|
const area = getMessageAreaByTag(client.user.properties.message_area_tag);
|
||||||
return area ? area.name : '';
|
return area ? area.name : '';
|
||||||
},
|
},
|
||||||
|
MC : function messageConfName() {
|
||||||
|
const conf = getMessageConferenceByTag(client.user.properties.message_conf_tag);
|
||||||
|
return conf ? conf.name : '';
|
||||||
|
},
|
||||||
|
|
||||||
ML : function messageAreaDescription() {
|
ML : function messageAreaDescription() {
|
||||||
const area = getMessageAreaByTag(client.user.properties.message_area_tag);
|
const area = getMessageAreaByTag(client.user.properties.message_area_tag);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
const removeClient = require('./client_connections.js').removeClient;
|
const removeClient = require('./client_connections.js').removeClient;
|
||||||
const ansiNormal = require('./ansi_term.js').normal;
|
const ansiNormal = require('./ansi_term.js').normal;
|
||||||
const userLogin = require('./user_login.js').userLogin;
|
const userLogin = require('./user_login.js').userLogin;
|
||||||
|
const messageArea = require('./message_area.js');
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
@ -14,6 +15,10 @@ exports.login = login;
|
||||||
exports.logoff = logoff;
|
exports.logoff = logoff;
|
||||||
exports.prevMenu = prevMenu;
|
exports.prevMenu = prevMenu;
|
||||||
exports.nextMenu = nextMenu;
|
exports.nextMenu = nextMenu;
|
||||||
|
exports.prevConf = prevConf;
|
||||||
|
exports.nextConf = nextConf;
|
||||||
|
exports.prevArea = prevArea;
|
||||||
|
exports.nextArea = nextArea;
|
||||||
|
|
||||||
function login(callingMenu, formData) {
|
function login(callingMenu, formData) {
|
||||||
|
|
||||||
|
@ -72,3 +77,111 @@ function nextMenu(callingMenu) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function prevConf(callingMenu) {
|
||||||
|
const confs = messageArea.getSortedAvailMessageConferences(callingMenu.client);
|
||||||
|
let prev_tag = confs[confs.length - 1].confTag;
|
||||||
|
for (var i=0;i<confs.length;i++) {
|
||||||
|
if (confs[i].confTag === callingMenu.client.user.properties.message_conf_tag) {
|
||||||
|
messageArea.changeMessageConference(callingMenu.client, prev_tag, err => {
|
||||||
|
if (err) {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
let prevMenu = callingMenu.client.menuStack.pop();
|
||||||
|
prevMenu.instance.leave();
|
||||||
|
callingMenu.client.menuStack.goto(prevMenu.name);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
prev_tag = confs[i].confTag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function nextConf(callingMenu) {
|
||||||
|
const confs = messageArea.getSortedAvailMessageConferences(callingMenu.client);
|
||||||
|
let prev_tag = confs[0].confTag;
|
||||||
|
|
||||||
|
if (confs.length > 1) {
|
||||||
|
for (var i=1;i<confs.length;i++) {
|
||||||
|
if (prev_tag === callingMenu.client.user.properties.message_conf_tag) {
|
||||||
|
messageArea.changeMessageConference(callingMenu.client, confs[i].confTag, err => {
|
||||||
|
if (err) {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
let prevMenu = callingMenu.client.menuStack.pop();
|
||||||
|
prevMenu.instance.leave();
|
||||||
|
callingMenu.client.menuStack.goto(prevMenu.name);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
prev_tag = confs[i].confTag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
messageArea.changeMessageConference(callingMenu.client, confs[0].confTag, err => {
|
||||||
|
if (err) {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
let prevMenu = callingMenu.client.menuStack.pop();
|
||||||
|
prevMenu.instance.leave();
|
||||||
|
callingMenu.client.menuStack.goto(prevMenu.name);
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function prevArea(callingMenu) {
|
||||||
|
const areas = messageArea.getSortedAvailMessageAreasByConfTag(callingMenu.client.user.properties.message_conf_tag);
|
||||||
|
let prev_tag = areas[areas.length - 1].areaTag;
|
||||||
|
for (var i=0;i<areas.length;i++) {
|
||||||
|
if (areas[i].areaTag === callingMenu.client.user.properties.message_area_tag) {
|
||||||
|
messageArea.changeMessageArea(callingMenu.client, prev_tag, err => {
|
||||||
|
if (err) {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
let prevMenu = callingMenu.client.menuStack.pop();
|
||||||
|
prevMenu.instance.leave();
|
||||||
|
callingMenu.client.menuStack.goto(prevMenu.name);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
prev_tag = areas[i].areaTag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function nextArea(callingMenu) {
|
||||||
|
const areas = messageArea.getSortedAvailMessageAreasByConfTag(callingMenu.client.user.properties.message_conf_tag);
|
||||||
|
let prev_tag = areas[0].areaTag;
|
||||||
|
|
||||||
|
if (areas.length > 1) {
|
||||||
|
for (var i=1;i<areas.length;i++) {
|
||||||
|
if (prev_tag === callingMenu.client.user.properties.message_area_tag) {
|
||||||
|
messageArea.changeMessageArea(callingMenu.client, areas[i].areaTag, err => {
|
||||||
|
if (err) {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
let prevMenu = callingMenu.client.menuStack.pop();
|
||||||
|
prevMenu.instance.leave();
|
||||||
|
callingMenu.client.menuStack.goto(prevMenu.name);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
prev_tag = areas[i].areaTag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
messageArea.changeMessageArea(callingMenu.client, areas[0].areaTag, err => {
|
||||||
|
if (err) {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
let prevMenu = callingMenu.client.menuStack.pop();
|
||||||
|
prevMenu.instance.leave();
|
||||||
|
callingMenu.client.menuStack.goto(prevMenu.name);
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue