diff options
25 files changed, 451 insertions, 341 deletions
diff --git a/js/components/converter/string-units-converter.js b/js/components/converter/string-units-converter.js new file mode 100644 index 00000000..6b97d5c5 --- /dev/null +++ b/js/components/converter/string-units-converter.js | |||
@@ -0,0 +1,31 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | var Montage = require("montage").Montage, | ||
7 | Converter = require("montage/core/converter/converter").Converter, | ||
8 | NJUtils = require("js/lib/NJUtils").NJUtils; | ||
9 | |||
10 | exports.StringUnitsConverter = Montage.create(Converter, { | ||
11 | |||
12 | // convert fahrenheit to celsius (showing our non-metric heritage here) | ||
13 | convert: { | ||
14 | value: function(value) { | ||
15 | if(value) { | ||
16 | console.log("convert string to unit ", value); | ||
17 | var tmp = NJUtils.getValueAndUnits(value); | ||
18 | return tmp[1]; | ||
19 | } | ||
20 | } | ||
21 | }, | ||
22 | |||
23 | // revert celsius to fahrenheit | ||
24 | revert: { | ||
25 | value: function(value) { | ||
26 | console.log("revert string to unit ", value); | ||
27 | return value; | ||
28 | } | ||
29 | } | ||
30 | |||
31 | }); | ||
diff --git a/js/components/converter/string-value-converter.js b/js/components/converter/string-value-converter.js new file mode 100644 index 00000000..28d7dd29 --- /dev/null +++ b/js/components/converter/string-value-converter.js | |||
@@ -0,0 +1,29 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | var Montage = require("montage").Montage, | ||
7 | Converter = require("montage/core/converter/converter").Converter, | ||
8 | NJUtils = require("js/lib/NJUtils").NJUtils; | ||
9 | |||
10 | exports.StringValueConverter = Montage.create(Converter, { | ||
11 | |||
12 | // convert fahrenheit to celsius (showing our non-metric heritage here) | ||
13 | convert: { | ||
14 | value: function(value) { | ||
15 | console.log(value); | ||
16 | console.log(parseInt(value)); | ||
17 | return parseInt(value); | ||
18 | } | ||
19 | }, | ||
20 | |||
21 | // revert celsius to fahrenheit | ||
22 | revert: { | ||
23 | value: function(value) { | ||
24 | console.log("revert string to value ", value); | ||
25 | return value; | ||
26 | } | ||
27 | } | ||
28 | |||
29 | }); | ||
diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js index 9e4110e2..4d09a362 100755 --- a/js/components/layout/document-entry.reel/document-entry.js +++ b/js/components/layout/document-entry.reel/document-entry.js | |||
@@ -7,8 +7,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
7 | var Montage = require("montage/core/core").Montage; | 7 | var Montage = require("montage/core/core").Montage; |
8 | var Component = require("montage/ui/component").Component; | 8 | var Component = require("montage/ui/component").Component; |
9 | 9 | ||
10 | //var documentManagerModule = ("js/document/documentManager"); | ||
11 | |||
12 | exports.DocumentEntry = Montage.create(Component, { | 10 | exports.DocumentEntry = Montage.create(Component, { |
13 | 11 | ||
14 | dirty: { value: null }, | 12 | dirty: { value: null }, |
@@ -119,7 +117,7 @@ exports.DocumentEntry = Montage.create(Component, { | |||
119 | handleClick: { | 117 | handleClick: { |
120 | value: function(event) { | 118 | value: function(event) { |
121 | if(event._event.target.nodeName === "IMG") { | 119 | if(event._event.target.nodeName === "IMG") { |
122 | this.application.ninja.documentController.closeDocument(this._uuid); | 120 | this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); |
123 | } else { | 121 | } else { |
124 | if(!this._document.isActive) { | 122 | if(!this._document.isActive) { |
125 | this.application.ninja.stage.stageView.switchDocument(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); | 123 | this.application.ninja.stage.stageView.switchDocument(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); |
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index d88059ab..fba9fad5 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -33,6 +33,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
33 | value: false | 33 | value: false |
34 | }, | 34 | }, |
35 | 35 | ||
36 | _hackInitialStyles: { | ||
37 | value: true | ||
38 | }, | ||
39 | |||
36 | _activeDocument: { value: null }, | 40 | _activeDocument: { value: null }, |
37 | _iframeCounter: { value: 1, enumerable: false }, | 41 | _iframeCounter: { value: 1, enumerable: false }, |
38 | _iframeHolder: { value: null, enumerable: false }, | 42 | _iframeHolder: { value: null, enumerable: false }, |
@@ -44,8 +48,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
44 | return this._activeDocument; | 48 | return this._activeDocument; |
45 | }, | 49 | }, |
46 | set: function(doc) { | 50 | set: function(doc) { |
47 | if(!!this._activeDocument){ this._activeDocument.isActive = false;} | 51 | // if(!!this._activeDocument){ this._activeDocument.isActive = false;} |
52 | |||
48 | this._activeDocument = doc; | 53 | this._activeDocument = doc; |
54 | |||
49 | if(!!this._activeDocument){ | 55 | if(!!this._activeDocument){ |
50 | if(this._documents.indexOf(doc) === -1) this._documents.push(doc); | 56 | if(this._documents.indexOf(doc) === -1) this._documents.push(doc); |
51 | this._activeDocument.isActive = true; | 57 | this._activeDocument.isActive = true; |
@@ -95,11 +101,14 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
95 | value: function (request) { | 101 | value: function (request) { |
96 | //TODO: Check if frameId is proper | 102 | //TODO: Check if frameId is proper |
97 | if (this._hackRootFlag && request.parentFrameId !== -1) { | 103 | if (this._hackRootFlag && request.parentFrameId !== -1) { |
98 | //TODO: Optimize creating string | 104 | //Checking for proper URL redirect (from different directories) |
99 | //console.log(request); | 105 | if (request.url.indexOf('js/document/templates/banner') !== -1) { |
100 | //console.log(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1], request.url); | 106 | return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/banner/'))[1]}; |
101 | //return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]}; | 107 | } else if (request.url.indexOf('js/document/templates/html') !== -1) { |
102 | return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/'))[1]}; | 108 | return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/html/'))[1]}; |
109 | } else { | ||
110 | //Error, not a valid folder | ||
111 | } | ||
103 | } | 112 | } |
104 | } | 113 | } |
105 | }, | 114 | }, |
@@ -155,13 +164,13 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
155 | }, | 164 | }, |
156 | 165 | ||
157 | handleExecuteNewFile: { | 166 | handleExecuteNewFile: { |
158 | value: function(event) { | 167 | value: function(event) { |
159 | var newFileSettings = event._event.settings || {}; | 168 | var newFileSettings = event._event.settings || {}; |
160 | if (this.application.ninja.coreIoApi.cloudAvailable()) { | 169 | if (this.application.ninja.coreIoApi.cloudAvailable()) { |
161 | newFileSettings.callback = this.createNewFile.bind(this); | 170 | newFileSettings.callback = this.createNewFile.bind(this); |
162 | this.application.ninja.newFileController.showNewFileDialog(newFileSettings); | 171 | this.application.ninja.newFileController.showNewFileDialog(newFileSettings); |
163 | } | ||
164 | } | 172 | } |
173 | } | ||
165 | }, | 174 | }, |
166 | //////////////////////////////////////////////////////////////////// | 175 | //////////////////////////////////////////////////////////////////// |
167 | // | 176 | // |
@@ -210,13 +219,9 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
210 | handleExecuteFileClose:{ | 219 | handleExecuteFileClose:{ |
211 | value: function(event) { | 220 | value: function(event) { |
212 | if (this.activeDocument) { | 221 | if (this.activeDocument) { |
213 | this.activeDocument.closeDocument(); | 222 | // this.activeDocument.closeDocument(); |
223 | this.closeFile(this.activeDocument); | ||
214 | } | 224 | } |
215 | /* | ||
216 | if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){ | ||
217 | this.closeDocument(this.activeDocument.uuid); | ||
218 | } | ||
219 | */ | ||
220 | } | 225 | } |
221 | }, | 226 | }, |
222 | //////////////////////////////////////////////////////////////////// | 227 | //////////////////////////////////////////////////////////////////// |
@@ -445,7 +450,32 @@ if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){ | |||
445 |