mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-06 12:47:13 +02:00
* Fix short timeFormat
* Pause prompts now support MCI codes using View Controller * View Controller 'noInput' option for read-only/viewable but no interaction * Ability to omit final trailing CRLF's in ANSI's * Move asset.displayArtAsset -> theme.displayThemedAsset
This commit is contained in:
parent
dd478ed6ba
commit
35a99b7e3e
10 changed files with 125 additions and 154 deletions
|
@ -36,11 +36,13 @@ function ANSIEscapeParser(options) {
|
||||||
mciReplaceChar : '',
|
mciReplaceChar : '',
|
||||||
termHeight : 25,
|
termHeight : 25,
|
||||||
termWidth : 80,
|
termWidth : 80,
|
||||||
|
omitTrailingLF : false,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.mciReplaceChar = miscUtil.valueWithDefault(options.mciReplaceChar, '');
|
this.mciReplaceChar = miscUtil.valueWithDefault(options.mciReplaceChar, '');
|
||||||
this.termHeight = miscUtil.valueWithDefault(options.termHeight, 25);
|
this.termHeight = miscUtil.valueWithDefault(options.termHeight, 25);
|
||||||
this.termWidth = miscUtil.valueWithDefault(options.termWidth, 80);
|
this.termWidth = miscUtil.valueWithDefault(options.termWidth, 80);
|
||||||
|
this.omitTrailingLF = miscUtil.valueWithDefault(options.omitTrailingLF, false);
|
||||||
|
|
||||||
|
|
||||||
function getArgArray(array) {
|
function getArgArray(array) {
|
||||||
|
@ -243,7 +245,11 @@ function ANSIEscapeParser(options) {
|
||||||
} while(0 !== re.lastIndex);
|
} while(0 !== re.lastIndex);
|
||||||
|
|
||||||
if(pos < buffer.length) {
|
if(pos < buffer.length) {
|
||||||
parseMCI(buffer.slice(pos));
|
var lastBit = buffer.slice(pos);
|
||||||
|
if(self.omitTrailingLF && '\r\n' === lastBit.slice(-2).toString()) {
|
||||||
|
lastBit = lastBit.slice(pos, -2); // trim off last CRLF
|
||||||
|
}
|
||||||
|
parseMCI(lastBit)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.emit('complete');
|
self.emit('complete');
|
||||||
|
|
|
@ -417,6 +417,7 @@ function display(options, cb) {
|
||||||
mciReplaceChar : mciReplaceChar,
|
mciReplaceChar : mciReplaceChar,
|
||||||
termHeight : options.client.term.termHeight,
|
termHeight : options.client.term.termHeight,
|
||||||
termWidth : options.client.term.termWidth,
|
termWidth : options.client.term.termWidth,
|
||||||
|
omitTrailingLF : options.omitTrailingLF,
|
||||||
});
|
});
|
||||||
|
|
||||||
var mciMap = {};
|
var mciMap = {};
|
||||||
|
|
|
@ -11,7 +11,6 @@ exports.parseAsset = parseAsset;
|
||||||
exports.getArtAsset = getArtAsset;
|
exports.getArtAsset = getArtAsset;
|
||||||
exports.resolveConfigAsset = resolveConfigAsset;
|
exports.resolveConfigAsset = resolveConfigAsset;
|
||||||
exports.getViewPropertyAsset = getViewPropertyAsset;
|
exports.getViewPropertyAsset = getViewPropertyAsset;
|
||||||
exports.displayArtAsset = displayArtAsset;
|
|
||||||
|
|
||||||
var ALL_ASSETS = [
|
var ALL_ASSETS = [
|
||||||
'art',
|
'art',
|
||||||
|
@ -85,47 +84,3 @@ function getViewPropertyAsset(src) {
|
||||||
|
|
||||||
return parseAsset(src);
|
return parseAsset(src);
|
||||||
};
|
};
|
||||||
|
|
||||||
function displayArtAsset(assetSpec, client, options, cb) {
|
|
||||||
assert(_.isObject(client));
|
|
||||||
|
|
||||||
// options are... optional
|
|
||||||
if(3 === arguments.length) {
|
|
||||||
cb = options;
|
|
||||||
options = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
var artAsset = getArtAsset(assetSpec);
|
|
||||||
if(!artAsset) {
|
|
||||||
cb(new Error('Asset not found: ' + assetSpec));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var dispOpts = {
|
|
||||||
name : artAsset.asset,
|
|
||||||
client : client,
|
|
||||||
font : options.font,
|
|
||||||
};
|
|
||||||
|
|
||||||
switch(artAsset.type) {
|
|
||||||
case 'art' :
|
|
||||||
theme.displayThemeArt(dispOpts, function displayed(err, artData) {
|
|
||||||
cb(err, err ? null : { mciMap : artData.mciMap, height : artData.extraInfo.height } );
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'method' :
|
|
||||||
// :TODO: fetch & render via method
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'inline ' :
|
|
||||||
// :TODO: think about this more in relation to themes, etc. How can this come
|
|
||||||
// from a theme (with override from menu.json) ???
|
|
||||||
// look @ client.currentTheme.inlineArt[name] -> menu/prompt[name]
|
|
||||||
break;
|
|
||||||
|
|
||||||
default :
|
|
||||||
cb(new Error('Unsupported art asset type: ' + artAsset.type));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -95,7 +95,7 @@ function getDefaultConfig() {
|
||||||
short : 'MM/DD/YYYY',
|
short : 'MM/DD/YYYY',
|
||||||
},
|
},
|
||||||
timeFormat : {
|
timeFormat : {
|
||||||
short : 'h:mm tt',
|
short : 'h:mm a',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -26,48 +26,6 @@ function MenuModule(options) {
|
||||||
this.menuMethods = {}; // methods called from @method's
|
this.menuMethods = {}; // methods called from @method's
|
||||||
this.viewControllers = {}; // name->vc
|
this.viewControllers = {}; // name->vc
|
||||||
|
|
||||||
// :TODO: Move this elsewhere
|
|
||||||
/*
|
|
||||||
this.displayArtAsset = function(assetSpec, cb) {
|
|
||||||
var artAsset = asset.getArtAsset(assetSpec);
|
|
||||||
|
|
||||||
if(!artAsset) {
|
|
||||||
cb(new Error('Asset not found: ' + assetSpec));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var dispOptions = {
|
|
||||||
name : artAsset.asset,
|
|
||||||
client : self.client,
|
|
||||||
font : self.menuConfig.font,
|
|
||||||
};
|
|
||||||
|
|
||||||
switch(artAsset.type) {
|
|
||||||
case 'art' :
|
|
||||||
theme.displayThemeArt(dispOptions, function displayed(err, themeArtData) {
|
|
||||||
cb(err, err ? null : { mciMap : themeArtData.mciMap, height : themeArtData.extraInfo.height } );
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'method' :
|
|
||||||
// :TODO: fetch and render via method/generator
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'inline' :
|
|
||||||
if(_.isString(assetSpec.asset)) {
|
|
||||||
// :TODO: think about this more in relation to themes, etc. How can this come
|
|
||||||
// from a theme (with override from menu.json) ???
|
|
||||||
// look @ client.currentTheme.inlineArt[name] -> menu/prompt[name]
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default :
|
|
||||||
cb(new Error('Unsupported art asset type'));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
this.initSequence = function() {
|
this.initSequence = function() {
|
||||||
var mciData = { };
|
var mciData = { };
|
||||||
|
|
||||||
|
@ -79,7 +37,7 @@ function MenuModule(options) {
|
||||||
},
|
},
|
||||||
function displayMenuArt(callback) {
|
function displayMenuArt(callback) {
|
||||||
if(_.isString(self.menuConfig.art)) {
|
if(_.isString(self.menuConfig.art)) {
|
||||||
asset.displayArtAsset(
|
theme.displayThemedAsset(
|
||||||
self.menuConfig.art,
|
self.menuConfig.art,
|
||||||
self.client,
|
self.client,
|
||||||
{ font : self.menuConfig.font },
|
{ font : self.menuConfig.font },
|
||||||
|
@ -90,12 +48,6 @@ function MenuModule(options) {
|
||||||
}
|
}
|
||||||
callback(err);
|
callback(err);
|
||||||
});
|
});
|
||||||
/*self.displayArtAsset(self.menuConfig.art, function displayed(err, artData) {
|
|
||||||
if(!err) {
|
|
||||||
mciData.menu = artData.mciMap;
|
|
||||||
}
|
|
||||||
callback(err);
|
|
||||||
});*/
|
|
||||||
} else {
|
} else {
|
||||||
callback(null);
|
callback(null);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +70,7 @@ function MenuModule(options) {
|
||||||
// Prompts *must* have art. If it's missing it's an error
|
// Prompts *must* have art. If it's missing it's an error
|
||||||
// :TODO: allow inline prompts in the future, e.g. @inline:memberName -> { "memberName" : { "text" : "stuff", ... } }
|
// :TODO: allow inline prompts in the future, e.g. @inline:memberName -> { "memberName" : { "text" : "stuff", ... } }
|
||||||
var promptConfig = self.menuConfig.promptConfig;
|
var promptConfig = self.menuConfig.promptConfig;
|
||||||
asset.displayArtAsset(
|
theme.displayThemedAsset(
|
||||||
promptConfig.art,
|
promptConfig.art,
|
||||||
self.client,
|
self.client,
|
||||||
{ font : self.menuConfig.font },
|
{ font : self.menuConfig.font },
|
||||||
|
@ -246,7 +198,7 @@ MenuModule.prototype.finishedLoading = function() {
|
||||||
|
|
||||||
if('end' === self.menuConfig.pause || true === self.menuConfig.pause) {
|
if('end' === self.menuConfig.pause || true === self.menuConfig.pause) {
|
||||||
// :TODO: really need a client.term.pause() that uses the correct art/etc.
|
// :TODO: really need a client.term.pause() that uses the correct art/etc.
|
||||||
theme.displayThemePause( { client : self.client }, function keyPressed() {
|
theme.displayThemedPause( { client : self.client }, function keyPressed() {
|
||||||
nextAction();
|
nextAction();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
104
core/theme.js
104
core/theme.js
|
@ -7,6 +7,8 @@ var ansi = require('./ansi_term.js');
|
||||||
var miscUtil = require('./misc_util.js');
|
var miscUtil = require('./misc_util.js');
|
||||||
var Log = require('./logger.js').log;
|
var Log = require('./logger.js').log;
|
||||||
var jsonCache = require('./json_cache.js');
|
var jsonCache = require('./json_cache.js');
|
||||||
|
var asset = require('./asset.js');
|
||||||
|
var ViewController = require('./view_controller.js').ViewController;
|
||||||
|
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var paths = require('path');
|
var paths = require('path');
|
||||||
|
@ -20,7 +22,8 @@ exports.getThemeArt = getThemeArt;
|
||||||
exports.getRandomTheme = getRandomTheme;
|
exports.getRandomTheme = getRandomTheme;
|
||||||
exports.initAvailableThemes = initAvailableThemes;
|
exports.initAvailableThemes = initAvailableThemes;
|
||||||
exports.displayThemeArt = displayThemeArt;
|
exports.displayThemeArt = displayThemeArt;
|
||||||
exports.displayThemePause = displayThemePause;
|
exports.displayThemedPause = displayThemedPause;
|
||||||
|
exports.displayThemedAsset = displayThemedAsset;
|
||||||
|
|
||||||
// :TODO: use JSONCache here... may need to fancy it up a bit in order to have events for after re-cache, e.g. to update helpers below:
|
// :TODO: use JSONCache here... may need to fancy it up a bit in order to have events for after re-cache, e.g. to update helpers below:
|
||||||
function loadTheme(themeID, cb) {
|
function loadTheme(themeID, cb) {
|
||||||
|
@ -69,7 +72,7 @@ function loadTheme(themeID, cb) {
|
||||||
getTimeFormat : function(style) {
|
getTimeFormat : function(style) {
|
||||||
style = style || 'short';
|
style = style || 'short';
|
||||||
|
|
||||||
var format = Config.defaults.timeFormat[style] || 'h:mm tt';
|
var format = Config.defaults.timeFormat[style] || 'h:mm a';
|
||||||
|
|
||||||
if(_.has(theme, 'customization.defaults.timeFormat')) {
|
if(_.has(theme, 'customization.defaults.timeFormat')) {
|
||||||
return theme.customization.defaults.timeFormat[style] || format;
|
return theme.customization.defaults.timeFormat[style] || format;
|
||||||
|
@ -176,10 +179,11 @@ function displayThemeArt(options, cb) {
|
||||||
cb(err);
|
cb(err);
|
||||||
} else {
|
} else {
|
||||||
var dispOptions = {
|
var dispOptions = {
|
||||||
art : artInfo.data,
|
art : artInfo.data,
|
||||||
sauce : artInfo.sauce,
|
sauce : artInfo.sauce,
|
||||||
client : options.client,
|
client : options.client,
|
||||||
font : options.font,
|
font : options.font,
|
||||||
|
omitTrailingLF : options.omitTrailingLF,
|
||||||
};
|
};
|
||||||
|
|
||||||
art.display(dispOptions, function displayed(err, mciMap, extraInfo) {
|
art.display(dispOptions, function displayed(err, mciMap, extraInfo) {
|
||||||
|
@ -192,7 +196,7 @@ function displayThemeArt(options, cb) {
|
||||||
//
|
//
|
||||||
// Pause prompts are a special prompt by the name 'pause'.
|
// Pause prompts are a special prompt by the name 'pause'.
|
||||||
//
|
//
|
||||||
function displayThemePause(options, cb) {
|
function displayThemedPause(options, cb) {
|
||||||
//
|
//
|
||||||
// options.client
|
// options.client
|
||||||
// options clearPrompt
|
// options clearPrompt
|
||||||
|
@ -208,8 +212,10 @@ function displayThemePause(options, cb) {
|
||||||
// :TODO: Prompt should support MCI codes in general
|
// :TODO: Prompt should support MCI codes in general
|
||||||
|
|
||||||
var artInfo;
|
var artInfo;
|
||||||
|
var vc;
|
||||||
|
var promptConfig;
|
||||||
|
|
||||||
async.waterfall(
|
async.series(
|
||||||
[
|
[
|
||||||
function loadPromptJSON(callback) {
|
function loadPromptJSON(callback) {
|
||||||
jsonCache.getJSON('prompt.json', function loaded(err, promptJson) {
|
jsonCache.getJSON('prompt.json', function loaded(err, promptJson) {
|
||||||
|
@ -217,28 +223,38 @@ function displayThemePause(options, cb) {
|
||||||
callback(err);
|
callback(err);
|
||||||
} else {
|
} else {
|
||||||
if(_.has(promptJson, [ 'prompts', 'pause' ] )) {
|
if(_.has(promptJson, [ 'prompts', 'pause' ] )) {
|
||||||
callback(null, promptJson.prompts.pause);
|
promptConfig = promptJson.prompts.pause;
|
||||||
|
callback(_.isObject(promptConfig) ? null : new Error('Invalid prompt config block!'));
|
||||||
} else {
|
} else {
|
||||||
callback(new Error('Missing standard \'pause\' prompt'))
|
callback(new Error('Missing standard \'pause\' prompt'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function displayPausePrompt(pausePrompt, callback) {
|
function displayPausePrompt(callback) {
|
||||||
// :TODO: use displayArtAsset()
|
displayThemedAsset(
|
||||||
displayThemeArt( { client : options.client, name : pausePrompt.art }, function pauseDisplayed(err, artData) {
|
promptConfig.art,
|
||||||
artInfo = artData;
|
options.client,
|
||||||
callback(err);
|
{ font : promptConfig.font, omitTrailingLF : true },
|
||||||
});
|
function displayed(err, artData) {
|
||||||
|
artInfo = artData;
|
||||||
|
callback(err);
|
||||||
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
function discoverCursorPosition(callback) {
|
function discoverCursorPosition(callback) {
|
||||||
options.client.once('cursor position report', function cpr(pos) {
|
options.client.once('cursor position report', function cpr(pos) {
|
||||||
artInfo.startRow = pos[0] - artInfo.extraInfo.height;
|
artInfo.startRow = pos[0] - artInfo.height;
|
||||||
callback(null);
|
callback(null);
|
||||||
});
|
});
|
||||||
options.client.term.rawWrite(ansi.queryPos());
|
options.client.term.rawWrite(ansi.queryPos());
|
||||||
},
|
},
|
||||||
// :TODO: use view Controller loadFromPromptConfig() with 'noInput' option or such
|
function createMCIViews(callback) {
|
||||||
|
vc = new ViewController( { client : options.client, noInput : true } );
|
||||||
|
vc.loadFromPromptConfig( { promptName : 'pause', mciMap : artInfo.mciMap, config : promptConfig }, function loaded(err) {
|
||||||
|
callback(null);
|
||||||
|
});
|
||||||
|
},
|
||||||
function pauseForUserInput(callback) {
|
function pauseForUserInput(callback) {
|
||||||
options.client.waitForKeyPress(function keyPressed() {
|
options.client.waitForKeyPress(function keyPressed() {
|
||||||
callback(null);
|
callback(null);
|
||||||
|
@ -248,7 +264,7 @@ function displayThemePause(options, cb) {
|
||||||
if(options.clearPrompt) {
|
if(options.clearPrompt) {
|
||||||
if(artInfo.startRow) {
|
if(artInfo.startRow) {
|
||||||
options.client.term.rawWrite(ansi.goto(artInfo.startRow, 1));
|
options.client.term.rawWrite(ansi.goto(artInfo.startRow, 1));
|
||||||
options.client.term.rawWrite(ansi.deleteLine(artInfo.extraInfo.height));
|
options.client.term.rawWrite(ansi.deleteLine(artInfo.height));
|
||||||
} else {
|
} else {
|
||||||
options.client.term.rawWrite(ansi.up(1) + ansi.deleteLine());
|
options.client.term.rawWrite(ansi.up(1) + ansi.deleteLine());
|
||||||
}
|
}
|
||||||
|
@ -261,13 +277,63 @@ function displayThemePause(options, cb) {
|
||||||
callback(null);
|
callback(null);
|
||||||
}, 4000);
|
}, 4000);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
],
|
],
|
||||||
function complete(err) {
|
function complete(err) {
|
||||||
if(err) {
|
if(err) {
|
||||||
Log.error(err);
|
Log.error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(vc) {
|
||||||
|
vc.detachClientEvents();
|
||||||
|
}
|
||||||
|
|
||||||
cb();
|
cb();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function displayThemedAsset(assetSpec, client, options, cb) {
|
||||||
|
assert(_.isObject(client));
|
||||||
|
|
||||||
|
// options are... optional
|
||||||
|
if(3 === arguments.length) {
|
||||||
|
cb = options;
|
||||||
|
options = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
var artAsset = asset.getArtAsset(assetSpec);
|
||||||
|
if(!artAsset) {
|
||||||
|
cb(new Error('Asset not found: ' + assetSpec));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dispOpts = {
|
||||||
|
name : artAsset.asset,
|
||||||
|
client : client,
|
||||||
|
font : options.font,
|
||||||
|
omitTrailingLF : options.omitTrailingLF,
|
||||||
|
};
|
||||||
|
|
||||||
|
switch(artAsset.type) {
|
||||||
|
case 'art' :
|
||||||
|
displayThemeArt(dispOpts, function displayed(err, artData) {
|
||||||
|
cb(err, err ? null : { mciMap : artData.mciMap, height : artData.extraInfo.height } );
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'method' :
|
||||||
|
// :TODO: fetch & render via method
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'inline ' :
|
||||||
|
// :TODO: think about this more in relation to themes, etc. How can this come
|
||||||
|
// from a theme (with override from menu.json) ???
|
||||||
|
// look @ client.currentTheme.inlineArt[name] -> menu/prompt[name]
|
||||||
|
break;
|
||||||
|
|
||||||
|
default :
|
||||||
|
cb(new Error('Unsupported art asset type: ' + artAsset.type));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,6 +33,7 @@ function ViewController(options) {
|
||||||
this.views = {}; // map of ID -> view
|
this.views = {}; // map of ID -> view
|
||||||
this.formId = options.formId || 0;
|
this.formId = options.formId || 0;
|
||||||
this.mciViewFactory = new MCIViewFactory(this.client); // :TODO: can this not be a singleton?
|
this.mciViewFactory = new MCIViewFactory(this.client); // :TODO: can this not be a singleton?
|
||||||
|
this.noInput = _.isBoolean(options.noInput) ? options.noInput : false;
|
||||||
|
|
||||||
this.actionKeyMap = {};
|
this.actionKeyMap = {};
|
||||||
|
|
||||||
|
@ -114,7 +115,7 @@ function ViewController(options) {
|
||||||
var mci = mciMap[name];
|
var mci = mciMap[name];
|
||||||
var view = self.mciViewFactory.createFromMCI(mci);
|
var view = self.mciViewFactory.createFromMCI(mci);
|
||||||
|
|
||||||
if(view) {
|
if(view && false === self.noInput) {
|
||||||
view.on('action', self.viewActionListener);
|
view.on('action', self.viewActionListener);
|
||||||
|
|
||||||
self.addView(view);
|
self.addView(view);
|
||||||
|
@ -335,7 +336,8 @@ ViewController.prototype.loadFromPromptConfig = function(options, cb) {
|
||||||
assert(_.isObject(options.mciMap));
|
assert(_.isObject(options.mciMap));
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var promptConfig = self.client.currentMenuModule.menuConfig.promptConfig;
|
var promptName = _.isString(options.promptName) ? options.promptName : self.client.currentMenuModule.menuConfig.prompt;
|
||||||
|
var promptConfig = _.isObject(options.config) ? options.config : self.client.currentMenuModule.menuConfig.promptConfig;
|
||||||
var initialFocusId = 1; // default to first
|
var initialFocusId = 1; // default to first
|
||||||
|
|
||||||
async.waterfall(
|
async.waterfall(
|
||||||
|
@ -348,7 +350,7 @@ ViewController.prototype.loadFromPromptConfig = function(options, cb) {
|
||||||
function applyThemeCustomization(callback) {
|
function applyThemeCustomization(callback) {
|
||||||
if(_.isObject(promptConfig)) {
|
if(_.isObject(promptConfig)) {
|
||||||
menuUtil.applyThemeCustomization({
|
menuUtil.applyThemeCustomization({
|
||||||
name : self.client.currentMenuModule.menuConfig.prompt,
|
name : promptName,//self.client.currentMenuModule.menuConfig.prompt,
|
||||||
type : "prompts",
|
type : "prompts",
|
||||||
client : self.client,
|
client : self.client,
|
||||||
configMci : promptConfig.mci,
|
configMci : promptConfig.mci,
|
||||||
|
@ -367,12 +369,13 @@ ViewController.prototype.loadFromPromptConfig = function(options, cb) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function prepareFormSubmission(callback) {
|
function prepareFormSubmission(callback) {
|
||||||
|
if(false === self.noInput) {
|
||||||
|
self.on('submit', function promptSubmit(formData) {
|
||||||
|
self.client.log.trace( { formData : self.getLogFriendlyFormData(formData) }, 'Prompt submit');
|
||||||
|
|
||||||
self.on('submit', function promptSubmit(formData) {
|
menuUtil.handleAction(self.client, formData, self.client.currentMenuModule.menuConfig);
|
||||||
self.client.log.trace( { formData : self.getLogFriendlyFormData(formData) }, 'Prompt submit');
|
});
|
||||||
|
}
|
||||||
menuUtil.handleAction(self.client, formData, self.client.currentMenuModule.menuConfig);
|
|
||||||
});
|
|
||||||
|
|
||||||
callback(null);
|
callback(null);
|
||||||
},
|
},
|
||||||
|
|
BIN
mods/art/pause.ans
Normal file
BIN
mods/art/pause.ans
Normal file
Binary file not shown.
41
mods/fse.js
41
mods/fse.js
|
@ -7,7 +7,6 @@ var ansi = require('../core/ansi_term.js');
|
||||||
var theme = require('../core/theme.js');
|
var theme = require('../core/theme.js');
|
||||||
var MultiLineEditTextView = require('../core/multi_line_edit_text_view.js').MultiLineEditTextView;
|
var MultiLineEditTextView = require('../core/multi_line_edit_text_view.js').MultiLineEditTextView;
|
||||||
var Message = require('../core/message.js');
|
var Message = require('../core/message.js');
|
||||||
var asset = require('../core/asset.js');
|
|
||||||
|
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
|
@ -103,19 +102,14 @@ function FullScreenEditorModule(options) {
|
||||||
function displayFooterArt(callback) {
|
function displayFooterArt(callback) {
|
||||||
var footerArt = self.menuConfig.config.art[options.footerName];
|
var footerArt = self.menuConfig.config.art[options.footerName];
|
||||||
|
|
||||||
asset.displayArtAsset(
|
theme.displayThemedAsset(
|
||||||
footerArt,
|
footerArt,
|
||||||
self.client,
|
self.client,
|
||||||
function displayed(err, artData)
|
{ font : self.menuConfig.font },
|
||||||
{
|
function displayed(err, artData) {
|
||||||
callback(err, artData);
|
callback(err, artData);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
/*
|
|
||||||
self.displayArtAsset(footerArt, function artDisplayed(err, artData) {
|
|
||||||
callback(err, artData);
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
function complete(err, artData) {
|
function complete(err, artData) {
|
||||||
|
@ -134,18 +128,14 @@ function FullScreenEditorModule(options) {
|
||||||
[
|
[
|
||||||
function displayHeaderAndBody(callback) {
|
function displayHeaderAndBody(callback) {
|
||||||
async.eachSeries( comps, function dispArt(n, next) {
|
async.eachSeries( comps, function dispArt(n, next) {
|
||||||
asset.displayArtAsset(
|
theme.displayThemedAsset(
|
||||||
art[n],
|
art[n],
|
||||||
self.client,
|
self.client,
|
||||||
|
{ font : self.menuConfig.font },
|
||||||
function displayed(err, artData) {
|
function displayed(err, artData) {
|
||||||
next(err);
|
next(err);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
/*
|
|
||||||
self.displayArtAsset(art[n], function artDisplayed(err, artData) {
|
|
||||||
next(err);
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
}, function complete(err) {
|
}, function complete(err) {
|
||||||
callback(err);
|
callback(err);
|
||||||
});
|
});
|
||||||
|
@ -218,20 +208,15 @@ function FullScreenEditorModule(options) {
|
||||||
assert(_.isString(art.body));
|
assert(_.isString(art.body));
|
||||||
|
|
||||||
async.eachSeries( [ 'header', 'body' ], function dispArt(n, next) {
|
async.eachSeries( [ 'header', 'body' ], function dispArt(n, next) {
|
||||||
asset.displayArtAsset(
|
theme.displayThemedAsset1(
|
||||||
art[n],
|
art[n],
|
||||||
self.client,
|
self.client,
|
||||||
|
{ font : self.menuConfig.font },
|
||||||
function displayed(err, artData) {
|
function displayed(err, artData) {
|
||||||
mciData[n] = artData;
|
mciData[n] = artData;
|
||||||
next(err);
|
next(err);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
/*
|
|
||||||
self.displayArtAsset(art[n], function artDisplayed(err, artData) {
|
|
||||||
mciData[n] = artData;
|
|
||||||
next(err);
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
}, function complete(err) {
|
}, function complete(err) {
|
||||||
callback(err);
|
callback(err);
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
"dateFormat" : {
|
"dateFormat" : {
|
||||||
"short" : "YYYY-MMM-DD"
|
"short" : "YYYY-MMM-DD"
|
||||||
},
|
},
|
||||||
|
"timeFormat" : {
|
||||||
|
"short" : "h:mm:ss a"
|
||||||
|
},
|
||||||
"mci" : {
|
"mci" : {
|
||||||
"TM" : {
|
"TM" : {
|
||||||
"styleSGR1" : "|00|30|01"
|
"styleSGR1" : "|00|30|01"
|
||||||
|
@ -26,7 +29,7 @@
|
||||||
"focusTextStyle" : "l33t"
|
"focusTextStyle" : "l33t"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"apply" : {
|
"apply" : {
|
||||||
"ET1" : { "width" : 21 },
|
"ET1" : { "width" : 21 },
|
||||||
"ET2" : { "width" : 21 },
|
"ET2" : { "width" : 21 },
|
||||||
//"ET3" : { "width" : 21 },
|
//"ET3" : { "width" : 21 },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue