From cc6d214882f79ea63f1542306c592ff6e71c3f0f Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Tue, 8 Sep 2015 22:31:38 -0600 Subject: [PATCH] * More work on 'action' vs 'next' -- mostly complete for now --- core/menu_module.js | 25 +++++++++++++++++++++++-- mods/menu.hjson | 16 ++++++++-------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/core/menu_module.js b/core/menu_module.js index f1a33346..c267f210 100644 --- a/core/menu_module.js +++ b/core/menu_module.js @@ -129,7 +129,8 @@ function MenuModule(options) { } 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; }; + this.hasNextTimeout = function() { + return _.isNumber(self.menuConfig.options.nextTimeout); + }; + // :TODO: Convert this to process "next" instead of "action" this.nextAction = function() { if(!_.isObject(self.menuConfig.form) && !_.isString(self.menuConfig.prompt) && @@ -146,6 +151,21 @@ function MenuModule(options) { 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); @@ -239,7 +259,7 @@ MenuModule.prototype.standardMCIReadyHandler = function(mciData, cb) { }; MenuModule.prototype.finishedLoading = function() { - +/* var self = this; if(_.isNumber(this.menuConfig.options.nextTimeout) && @@ -250,4 +270,5 @@ MenuModule.prototype.finishedLoading = function() { //self.client.gotoMenuModule( { name : self.menuConfig.next } ); }, this.menuConfig.options.nextTimeout); } + */ }; \ No newline at end of file diff --git a/mods/menu.hjson b/mods/menu.hjson index 15da0b95..c050f056 100644 --- a/mods/menu.hjson +++ b/mods/menu.hjson @@ -139,7 +139,7 @@ }, "logoff" : { "art" : "LOGOFF", - "action" : "@systemMethod:logoff", + "next" : "@systemMethod:logoff", }, "apply" : { "art" : "APPLY", @@ -225,7 +225,7 @@ "fullLoginSequenceLoginArt" : { "art" : "LOGIN", "options" : { "pause" : true }, - "action" : "@menu:fullLoginSequenceLastCallers" + "next" : "fullLoginSequenceLastCallers" }, "fullLoginSequenceLastCallers": { "module" : "last_callers", @@ -234,22 +234,22 @@ "config" : { "dateTimeFormat" : "ddd MMM Do h:mm a" }, - "action" : "@menu:fullLoginSequenceSysStats" + "next" : "fullLoginSequenceSysStats" }, "fullLoginSequenceSysStats" : { "art" : "SYSSTAT", "options" : { "pause" : true }, - "action" : "@menu:fullLoginSequenceUserStats" + "next" : "fullLoginSequenceUserStats" }, "fullLoginSequenceUserStats" : { "art" : "USRSTAT", "options" : { "pause" : true }, - "action" : "@menu:mainMenu" + "next" : "mainMenu" }, "newUserActive" : { "art" : "SO-CC1.ANS", "options" : { "pause" : true }, - "action" : "@menu:currentUserStats" + "next" : "currentUserStats" }, "currentUserStats" : { "art" : "userstats", @@ -300,12 +300,12 @@ "config" : { "dateTimeFormat" : "ddd MMM Do h:mm a" }, - "action" : "@menu:mainMenu" + "next" : "mainMenu" }, "mainMenuUserStats" : { "art" : "USRSTAT", "options" : { "pause" : true }, - "action" : "@menu:mainMenu" + "next" : "mainMenu" }, /////////////////////////////////////////////////////////////////////// // Message Area Related