2015-06-25 04:45:21 +00:00
|
|
|
/* jslint node: true */
|
|
|
|
'use strict';
|
|
|
|
|
2015-06-26 04:34:33 +00:00
|
|
|
var MenuModule = require('../core/menu_module.js').MenuModule;
|
|
|
|
var ViewController = require('../core/view_controller.js').ViewController;
|
2015-06-25 04:45:21 +00:00
|
|
|
|
2015-06-26 04:34:33 +00:00
|
|
|
var async = require('async');
|
|
|
|
var assert = require('assert');
|
|
|
|
var _ = require('lodash');
|
2015-06-25 05:09:26 +00:00
|
|
|
|
2015-06-25 22:33:17 +00:00
|
|
|
exports.getModule = FullScreenEditorModule;
|
2015-06-25 04:45:21 +00:00
|
|
|
|
|
|
|
exports.moduleInfo = {
|
2015-06-25 22:33:17 +00:00
|
|
|
name : 'Full Screen Editor (FSE)',
|
|
|
|
desc : 'A full screen editor/viewer',
|
2015-06-25 04:45:21 +00:00
|
|
|
author : 'NuSkooler',
|
|
|
|
};
|
|
|
|
|
2015-06-25 22:33:17 +00:00
|
|
|
function FullScreenEditorModule(options) {
|
2015-06-25 05:09:26 +00:00
|
|
|
MenuModule.call(this, options);
|
|
|
|
|
2015-06-26 04:34:33 +00:00
|
|
|
var self = this;
|
|
|
|
this.menuConfig = options.menuConfig;
|
|
|
|
this.editorType = this.menuConfig.config.editorType;
|
2015-06-25 05:09:26 +00:00
|
|
|
|
|
|
|
this.initSequence = function() {
|
2015-06-26 04:34:33 +00:00
|
|
|
var mciData = { };
|
|
|
|
|
2015-06-25 05:09:26 +00:00
|
|
|
async.waterfall(
|
|
|
|
[
|
|
|
|
function beforeDisplayArt(callback) {
|
|
|
|
self.beforeArt();
|
|
|
|
callback(null);
|
|
|
|
},
|
2015-06-26 04:34:33 +00:00
|
|
|
function displayMainArt(callback) {
|
|
|
|
if(_.isString(self.menuConfig.art)) {
|
|
|
|
self.displayArtAsset(self.menuConfig.art, function frameDisplayed(err, artData) {
|
|
|
|
mciData.main = artData;
|
|
|
|
callback(err);
|
2015-06-25 05:09:26 +00:00
|
|
|
});
|
2015-06-26 04:34:33 +00:00
|
|
|
} else {
|
|
|
|
callback(null); // :TODO: should probably throw error... can't do much without this
|
2015-06-25 05:09:26 +00:00
|
|
|
}
|
2015-06-25 05:12:03 +00:00
|
|
|
},
|
2015-06-26 04:34:33 +00:00
|
|
|
function afterArtDisplayed(callback) {
|
|
|
|
self.mciReady(mciData);
|
|
|
|
callback(null);
|
|
|
|
}
|
|
|
|
],
|
|
|
|
function complete(err) {
|
|
|
|
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
this.mciReadyHandlerNetMail = function(mciData) {
|
2015-06-27 21:32:29 +00:00
|
|
|
var mainVc = self.addViewController('main', new ViewController( { client : self.client } ));
|
2015-06-26 04:34:33 +00:00
|
|
|
|
2015-06-27 21:32:29 +00:00
|
|
|
var menuLoadOpts = {
|
|
|
|
callingMenu : self,
|
|
|
|
mciMap : mciData.main.mciMap,
|
|
|
|
formId : 0,
|
2015-06-26 04:34:33 +00:00
|
|
|
};
|
2015-06-27 21:32:29 +00:00
|
|
|
|
|
|
|
mainVc.loadFromMenuConfig(menuLoadOpts, function viewsReady(err) {
|
|
|
|
});
|
|
|
|
};
|
2015-06-25 05:12:03 +00:00
|
|
|
|
2015-06-27 21:32:29 +00:00
|
|
|
this.menuMethods = {
|
|
|
|
editorEscPressed : function(formData, extraArgs) {
|
2015-06-29 04:31:12 +00:00
|
|
|
|
2015-06-27 21:32:29 +00:00
|
|
|
}
|
2015-06-25 05:09:26 +00:00
|
|
|
};
|
2015-06-25 04:45:21 +00:00
|
|
|
}
|
|
|
|
|
2015-06-25 22:33:17 +00:00
|
|
|
require('util').inherits(FullScreenEditorModule, MenuModule);
|
2015-06-25 05:09:26 +00:00
|
|
|
|
2015-06-25 22:33:17 +00:00
|
|
|
FullScreenEditorModule.prototype.enter = function(client) {
|
|
|
|
FullScreenEditorModule.super_.prototype.enter.call(this, client);
|
2015-06-25 05:09:26 +00:00
|
|
|
};
|
|
|
|
|
2015-06-26 04:34:33 +00:00
|
|
|
FullScreenEditorModule.prototype.mciReady = function(mciData) {
|
|
|
|
this['mciReadyHandler' + _.capitalize(this.editorType)](mciData);
|
|
|
|
};
|
|
|
|
|