* Updates & notes to fse for view mode... WIP!

This commit is contained in:
Bryan Ashby 2015-09-01 22:20:29 -06:00
parent b910007647
commit e0f267c9a5
3 changed files with 62 additions and 15 deletions

View File

@ -11,6 +11,7 @@ var Message = require('../core/message.js');
var async = require('async'); var async = require('async');
var assert = require('assert'); var assert = require('assert');
var _ = require('lodash'); var _ = require('lodash');
var moment = require('moment');
exports.FullScreenEditorModule = FullScreenEditorModule; exports.FullScreenEditorModule = FullScreenEditorModule;
@ -24,6 +25,25 @@ exports.moduleInfo = {
author : 'NuSkooler', author : 'NuSkooler',
}; };
/*
MCI Codes - General
MA - Message Area Desc
MCI Codes - View Mode
Header
TL1 - From
TL2 - To
TL3 - Subject
TL5 - Date/Time (TODO: format)
TL6 - Message number/total
TL7 - View Count
TL8 - Hash tags
TL9 - Message ID
TL10 - Reply to message ID
*/
function FullScreenEditorModule(options) { function FullScreenEditorModule(options) {
MenuModule.call(this, options); MenuModule.call(this, options);
@ -46,13 +66,21 @@ function FullScreenEditorModule(options) {
if(_.isObject(options.extraArgs)) { if(_.isObject(options.extraArgs)) {
this.messageAreaName = options.extraArgs.messageAreaName || Message.WellKnownAreaNames.Private; this.messageAreaName = options.extraArgs.messageAreaName || Message.WellKnownAreaNames.Private;
} }
this.isEditMode = function() {
return 'edit' === self.editorMode;
};
this.isViewMode = function() {
return 'view' === self.editorMode;
};
this.isLocalEmail = function() { this.isLocalEmail = function() {
return 'email' === this.editorType && Message.WellKnownAreaNames.Private === this.messageAreaName; return 'email' === self.editorType && Message.WellKnownAreaNames.Private === self.messageAreaName;
}; };
this.getFooterName = function(editorMode) { this.getFooterName = function(editorMode) {
editorMode = editorMode || this.editorMode; editorMode = editorMode || self.editorMode;
return 'footer' + _.capitalize(editorMode); // e.g.. 'footerEditMenu' return 'footer' + _.capitalize(editorMode); // e.g.. 'footerEditMenu'
}; };
@ -83,13 +111,13 @@ function FullScreenEditorModule(options) {
}; };
this.setMessage = function(message) { this.setMessage = function(message) {
console.log('setting message....')
console.log(message) console.log(message)
self.message = message; self.message = message;
}; };
this.getMessage = function() { this.getMessage = function() {
if('edit' === this.editMode) { if(self.isEditMode()) {
self.buildMessage(); self.buildMessage();
} }
@ -307,17 +335,26 @@ function FullScreenEditorModule(options) {
from.acceptsFocus = false; from.acceptsFocus = false;
//from.setText(self.client.user.username); //from.setText(self.client.user.username);
// :TODO: make this a method
var body = self.viewControllers.body.getView(1); var body = self.viewControllers.body.getView(1);
self.updateTextEditMode(body.getTextEditMode()); self.updateTextEditMode(body.getTextEditMode());
self.updateEditModePosition(body.getEditPosition()); self.updateEditModePosition(body.getEditPosition());
// :TODO: If view mode, set body to read only... which needs an impl...
callback(null); callback(null);
}, },
function setInitialData(callback) { function setInitialData(callback) {
switch(self.editorMode) { switch(self.editorMode) {
case 'view' : case 'view' :
if(self.message) { if(self.message) {
self.initHeaderFromMessage(); self.initHeaderFromMessage();
var bodyMessageView = self.viewControllers.body.getView(1);
if(bodyMessageView && _.has(self, 'message.message')) {
bodyMessageView.setText(self.message.message);
}
} }
break; break;
@ -329,6 +366,7 @@ function FullScreenEditorModule(options) {
callback(null); callback(null);
}, },
function setInitialFocus(callback) { function setInitialFocus(callback) {
switch(self.editorMode) { switch(self.editorMode) {
case 'edit' : case 'edit' :
self.switchToHeader(); self.switchToHeader();
@ -389,15 +427,20 @@ function FullScreenEditorModule(options) {
}; };
this.initHeaderFromMessage = function() { this.initHeaderFromMessage = function() {
assert(_.isObject(this.message)); assert(_.isObject(self.message));
var fromView = this.viewControllers.header.getView(1); // TL var fromView = self.viewControllers.header.getView(1); // TL
var toView = this.viewControllers.header.getView(2); // ET var toView = self.viewControllers.header.getView(2); // TL
var subjView = this.viewControllers.header.getView(3); // ET var subjView = self.viewControllers.header.getView(3); // TL
var tsView = self.viewControllers.header.getView(5); // TL
fromView.setText(self.message.fromUserName);
toView.setText(self.message.toUserName);
subjView.setText(self.message.subject);
// :TODO: set full date/time -- need a defaults dateTimeFormat
tsView.setText(moment(self.message.modTimestamp).format(self.client.currentTheme.helpers.getDateFormat()));
fromView.setText(this.message.fromUserName);
toView.setText(this.message.toUserName);
subjView.setText(this.message.subject);
}; };

Binary file not shown.

View File

@ -360,28 +360,32 @@
"fallback" : "messageArea", // :TODO: remove once default fallback is in place "fallback" : "messageArea", // :TODO: remove once default fallback is in place
"config" : { "config" : {
"art" : { "art" : {
"header" : "msg_area_post_header", // :TODO: FIXME! "header" : "msg_area_view_header",
"body" : "demo_fse_netmail_body.ans", "body" : "demo_fse_netmail_body.ans",
"footerEdit" : "demo_fse_netmail_footer_edit.ans", "footerEdit" : "demo_fse_netmail_footer_edit.ans",
"footerEditMenu" : "demo_fse_netmail_footer_edit_menu.ans", "footerEditMenu" : "demo_fse_netmail_footer_edit_menu.ans",
"footerView" : "msg_area_footer_view.ans", "footerView" : "msg_area_footer_view.ans",
"help" : "demo_fse_netmail_help.ans" "help" : "demo_fse_netmail_help.ans"
}, },
"editorMode" : "view",
"editorType" : "area" "editorType" : "area"
}, },
"form" : { "form" : {
"0" : { "0" : {
"ETETTL" : { "TLTLTLTL" : {
"mci" : { "mci" : {
"TL1" : { "TL1" : {
"width" : 36 "width" : 36
}, },
"ET2" : { "TL2" : {
"width" : 36 "width" : 36
}, },
"ET3" : { "TL3" : {
"width" : 65 "width" : 65
}, },
"TL5" : {
"width" : 19
},
"MA5" : { "MA5" : {
"width" : 19, "width" : 19,
"textOverflow" : "..." "textOverflow" : "..."