* 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.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);
}
*/
};

View File

@ -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