mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-08-04 00:41:56 +02:00
* A lot of cleanup in ViewController
* ViewController.getFormData() * Lots of WIP work on fse.js & multiple forms
This commit is contained in:
parent
a241f91546
commit
13d104c840
6 changed files with 200 additions and 182 deletions
BIN
mods/art/demo_fse_netmail_body.ans
Normal file
BIN
mods/art/demo_fse_netmail_body.ans
Normal file
Binary file not shown.
BIN
mods/art/demo_fse_netmail_header.ans
Normal file
BIN
mods/art/demo_fse_netmail_header.ans
Normal file
Binary file not shown.
65
mods/fse.js
65
mods/fse.js
|
@ -22,16 +22,22 @@ function FullScreenEditorModule(options) {
|
|||
var self = this;
|
||||
this.menuConfig = options.menuConfig;
|
||||
this.editorType = this.menuConfig.config.editorType;
|
||||
this.artNames = [ 'header', 'body', 'footerEdit', 'footerEditMenu', 'footerView' ];
|
||||
this.editorMode = 'edit'; // :TODO: This needs to be passed in via args
|
||||
|
||||
this.initSequence = function() {
|
||||
var mciData = { };
|
||||
var art = self.menuConfig.config.art;
|
||||
assert(_.isObject(art));
|
||||
|
||||
// :TODO: async.series here?
|
||||
async.waterfall(
|
||||
[
|
||||
function beforeDisplayArt(callback) {
|
||||
self.beforeArt();
|
||||
callback(null);
|
||||
},
|
||||
/*
|
||||
function displayMainArt(callback) {
|
||||
if(_.isString(self.menuConfig.art)) {
|
||||
self.displayArtAsset(self.menuConfig.art, function frameDisplayed(err, artData) {
|
||||
|
@ -42,6 +48,23 @@ function FullScreenEditorModule(options) {
|
|||
callback(null); // :TODO: should probably throw error... can't do much without this
|
||||
}
|
||||
},
|
||||
*/
|
||||
function displayArtHeaderAndBody(callback) {
|
||||
assert(_.isString(art.header));
|
||||
assert(_.isString(art.body));
|
||||
|
||||
async.eachSeries( [ 'header', 'body' ], function dispArt(n, next) {
|
||||
self.displayArtAsset(art[n], function artDisplayed(err, artData) {
|
||||
mciData[n] = artData;
|
||||
next(err);
|
||||
});
|
||||
}, function complete(err) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function displayArtFooter(callback) {
|
||||
callback(null);
|
||||
},
|
||||
function afterArtDisplayed(callback) {
|
||||
self.mciReady(mciData);
|
||||
callback(null);
|
||||
|
@ -53,6 +76,43 @@ function FullScreenEditorModule(options) {
|
|||
);
|
||||
};
|
||||
|
||||
this.mciReadyHandlerNetMail = function(mciData) {
|
||||
|
||||
var menuLoadOpts = { callingMenu : self };
|
||||
|
||||
async.series(
|
||||
[
|
||||
function header(callback) {
|
||||
menuLoadOpts.formId = 0;
|
||||
menuLoadOpts.mciMap = mciData.header.mciMap;
|
||||
|
||||
self.addViewController(
|
||||
'header',
|
||||
new ViewController( { client : self.client } )
|
||||
).loadFromMenuConfig(menuLoadOpts, function headerReady(err) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function body(callback) {
|
||||
menuLoadOpts.formId = 1;
|
||||
menuLoadOpts.mciMap = mciData.body.mciMap;
|
||||
|
||||
self.addViewController(
|
||||
'body',
|
||||
new ViewController( { client : self.client } )
|
||||
).loadFromMenuConfig(menuLoadOpts, function bodyReady(err) {
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
],
|
||||
function complete(err) {
|
||||
self.viewControllers.body.removeFocus(); // :TODO: Change vc to allow *not* setting focus @ create
|
||||
self.viewControllers.header.switchFocus(1);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
/*
|
||||
this.mciReadyHandlerNetMail = function(mciData) {
|
||||
var mainVc = self.addViewController('main', new ViewController( { client : self.client } ));
|
||||
|
||||
|
@ -65,8 +125,13 @@ function FullScreenEditorModule(options) {
|
|||
mainVc.loadFromMenuConfig(menuLoadOpts, function viewsReady(err) {
|
||||
});
|
||||
};
|
||||
*/
|
||||
|
||||
this.menuMethods = {
|
||||
headerSubmit : function(formData, extraArgs) {
|
||||
console.log('submit header:\n' + JSON.stringify(self.viewControllers.header.getFormData()))
|
||||
self.viewControllers.body.switchFocus(1);
|
||||
},
|
||||
editorEscPressed : function(formData, extraArgs) {
|
||||
|
||||
}
|
||||
|
|
|
@ -471,8 +471,66 @@
|
|||
"art" : "demo_fse_local_user.ans",
|
||||
"options" : { "cls" : true },
|
||||
"config" : {
|
||||
"editorType" : "netMail"
|
||||
"editorType" : "netMail",
|
||||
"art" : {
|
||||
"header" : "demo_fse_netmail_header.ans",
|
||||
"body" : "demo_fse_netmail_body.ans",
|
||||
"footerEdit" : "demo_fse_netmail_footer_edit.ans",
|
||||
"footerEditMenu" : "demo_fse_netmail_footer_edit_menu.ans",
|
||||
"footerView" : "demo_fse_netmail_footer_view.ans"
|
||||
}
|
||||
},
|
||||
"form" : {
|
||||
"0" : {
|
||||
"ET1ET2ET3" : {
|
||||
"mci" : {
|
||||
"ET1" : {
|
||||
// :TODO: from/to may be set by args
|
||||
// :TODO: focus may change dep on view vs edit
|
||||
"width" : 36,
|
||||
"focus" : true
|
||||
},
|
||||
"ET2" : {
|
||||
"width" : 36
|
||||
},
|
||||
"ET3" : {
|
||||
"width" : 65,
|
||||
"maxLength" : 72,
|
||||
"submit" : [ "enter" ]
|
||||
}
|
||||
},
|
||||
"submit" : {
|
||||
"3" : [
|
||||
{
|
||||
"value" : { "3" : null },
|
||||
"action" : "@method:headerSubmit"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"1" : {
|
||||
"MT1" : {
|
||||
"mci" : {
|
||||
"MT1" : {
|
||||
"width" : 79,
|
||||
"height" : 16,
|
||||
"text" : "", // :TODO: should not be req.
|
||||
"submit" : [ "escape" ]
|
||||
}
|
||||
},
|
||||
"submit" : {
|
||||
"*" : [
|
||||
{
|
||||
"value" : 1,
|
||||
"action" : "@method:editorEscPressed"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
"form" : {
|
||||
"0" : {
|
||||
"ET1ET2MT3" : {
|
||||
|
@ -504,6 +562,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue