* More work on 'action' vs 'next' -- mostly complete for now

This commit is contained in:
Bryan Ashby 2015-09-08 22:31:38 -06:00
parent ca4b99a83e
commit cc6d214882
2 changed files with 31 additions and 10 deletions

View File

@ -129,7 +129,8 @@ function MenuModule(options) {
} }
self.finishedLoading(); self.finishedLoading();
self.nextAction(); self.nextMenu();
//self.nextAction();
} }
); );
}; };
@ -138,6 +139,10 @@ function MenuModule(options) {
return 'end' === self.menuConfig.options.pause || true === self.menuConfig.options.pause; return 'end' === self.menuConfig.options.pause || true === self.menuConfig.options.pause;
}; };
this.hasNextTimeout = function() {
return _.isNumber(self.menuConfig.options.nextTimeout);
};
// :TODO: Convert this to process "next" instead of "action" // :TODO: Convert this to process "next" instead of "action"
this.nextAction = function() { this.nextAction = function() {
if(!_.isObject(self.menuConfig.form) && !_.isString(self.menuConfig.prompt) && if(!_.isObject(self.menuConfig.form) && !_.isString(self.menuConfig.prompt) &&
@ -146,6 +151,21 @@ function MenuModule(options) {
menuUtil.handleAction(self.client, null, self.menuConfig); menuUtil.handleAction(self.client, null, self.menuConfig);
} }
}; };
this.nextMenu = function() {
if(!_.isObject(self.menuConfig.form) && !_.isString(self.menuConfig.prompt) &&
_.isString(self.menuConfig.next))
{
if(self.hasNextTimeout()) {
setTimeout(function nextTimeout() {
menuUtil.handleNext(self.client, self.menuConfig.next);
}, this.menuConfig.options.nextTimeout);
} else {
menuUtil.handleNext(self.client, self.menuConfig.next);
}
}
};
} }
require('util').inherits(MenuModule, PluginModule); require('util').inherits(MenuModule, PluginModule);
@ -239,7 +259,7 @@ MenuModule.prototype.standardMCIReadyHandler = function(mciData, cb) {
}; };
MenuModule.prototype.finishedLoading = function() { MenuModule.prototype.finishedLoading = function() {
/*
var self = this; var self = this;
if(_.isNumber(this.menuConfig.options.nextTimeout) && if(_.isNumber(this.menuConfig.options.nextTimeout) &&
@ -250,4 +270,5 @@ MenuModule.prototype.finishedLoading = function() {
//self.client.gotoMenuModule( { name : self.menuConfig.next } ); //self.client.gotoMenuModule( { name : self.menuConfig.next } );
}, this.menuConfig.options.nextTimeout); }, this.menuConfig.options.nextTimeout);
} }
*/
}; };

View File

@ -139,7 +139,7 @@
}, },
"logoff" : { "logoff" : {
"art" : "LOGOFF", "art" : "LOGOFF",
"action" : "@systemMethod:logoff", "next" : "@systemMethod:logoff",
}, },
"apply" : { "apply" : {
"art" : "APPLY", "art" : "APPLY",
@ -225,7 +225,7 @@
"fullLoginSequenceLoginArt" : { "fullLoginSequenceLoginArt" : {
"art" : "LOGIN", "art" : "LOGIN",
"options" : { "pause" : true }, "options" : { "pause" : true },
"action" : "@menu:fullLoginSequenceLastCallers" "next" : "fullLoginSequenceLastCallers"
}, },
"fullLoginSequenceLastCallers": { "fullLoginSequenceLastCallers": {
"module" : "last_callers", "module" : "last_callers",
@ -234,22 +234,22 @@
"config" : { "config" : {
"dateTimeFormat" : "ddd MMM Do h:mm a" "dateTimeFormat" : "ddd MMM Do h:mm a"
}, },
"action" : "@menu:fullLoginSequenceSysStats" "next" : "fullLoginSequenceSysStats"
}, },
"fullLoginSequenceSysStats" : { "fullLoginSequenceSysStats" : {
"art" : "SYSSTAT", "art" : "SYSSTAT",
"options" : { "pause" : true }, "options" : { "pause" : true },
"action" : "@menu:fullLoginSequenceUserStats" "next" : "fullLoginSequenceUserStats"
}, },
"fullLoginSequenceUserStats" : { "fullLoginSequenceUserStats" : {
"art" : "USRSTAT", "art" : "USRSTAT",
"options" : { "pause" : true }, "options" : { "pause" : true },
"action" : "@menu:mainMenu" "next" : "mainMenu"
}, },
"newUserActive" : { "newUserActive" : {
"art" : "SO-CC1.ANS", "art" : "SO-CC1.ANS",
"options" : { "pause" : true }, "options" : { "pause" : true },
"action" : "@menu:currentUserStats" "next" : "currentUserStats"
}, },
"currentUserStats" : { "currentUserStats" : {
"art" : "userstats", "art" : "userstats",
@ -300,12 +300,12 @@
"config" : { "config" : {
"dateTimeFormat" : "ddd MMM Do h:mm a" "dateTimeFormat" : "ddd MMM Do h:mm a"
}, },
"action" : "@menu:mainMenu" "next" : "mainMenu"
}, },
"mainMenuUserStats" : { "mainMenuUserStats" : {
"art" : "USRSTAT", "art" : "USRSTAT",
"options" : { "pause" : true }, "options" : { "pause" : true },
"action" : "@menu:mainMenu" "next" : "mainMenu"
}, },
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// Message Area Related // Message Area Related