diff options
author | hwc487 | 2012-07-09 16:08:02 -0700 |
---|---|---|
committer | hwc487 | 2012-07-09 16:08:02 -0700 |
commit | 5085d0f67df89a21715308956004164597a6ba79 (patch) | |
tree | 2c896163143a66331205a39b0a3b1b45d51bf12a /js/mediators/io-mediator.js | |
parent | 51f1691f792dbda9b740ded8aa0457c9406db156 (diff) | |
parent | 84b3327bd92faafab7954b5eb64c7abe24a3fe13 (diff) | |
download | ninja-5085d0f67df89a21715308956004164597a6ba79.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into GridFixes
Conflicts:
js/helper-classes/3D/StageLine.js
Diffstat (limited to 'js/mediators/io-mediator.js')
-rw-r--r-- | js/mediators/io-mediator.js | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index c69cbafa..af0f4dd6 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js | |||
@@ -30,11 +30,11 @@ POSSIBILITY OF SUCH DAMAGE. | |||
30 | 30 | ||
31 | //////////////////////////////////////////////////////////////////////// | 31 | //////////////////////////////////////////////////////////////////////// |
32 | // | 32 | // |
33 | var Montage = require("montage/core/core").Montage, | 33 | var Montage = require("montage/core/core").Montage, |
34 | Component = require("montage/ui/component").Component, | 34 | Component = require("montage/ui/component").Component, |
35 | FileIo = require("js/io/system/fileio").FileIo, | 35 | FileIo = require("js/io/system/fileio").FileIo, |
36 | ProjectIo = require("js/io/system/projectio").ProjectIo, | 36 | ProjectIo = require("js/io/system/projectio").ProjectIo, |
37 | TemplateMediator = require("js/document/mediators/template").TemplateDocumentMediator; | 37 | TemplateMediator = require("js/document/mediators/template").TemplateDocumentMediator; |
38 | //////////////////////////////////////////////////////////////////////// | 38 | //////////////////////////////////////////////////////////////////////// |
39 | // | 39 | // |
40 | exports.IoMediator = Montage.create(Component, { | 40 | exports.IoMediator = Montage.create(Component, { |
@@ -68,11 +68,11 @@ exports.IoMediator = Montage.create(Component, { | |||
68 | //////////////////////////////////////////////////////////////////// | 68 | //////////////////////////////////////////////////////////////////// |
69 | // | 69 | // |
70 | parseToTemplate: { | 70 | parseToTemplate: { |
71 | value: function(content, template) { | 71 | value: function(content, template) { |
72 | // | 72 | // |
73 | if (template.name.toLowerCase() === 'banner' || template.name.toLowerCase() === 'animation') { | 73 | if (template.name.toLowerCase() === 'banner' || template.name.toLowerCase() === 'animation') { |
74 | //Getting dimensions of banner | 74 | //Getting dimensions of banner |
75 | var dimensions = template.id.split('x'); | 75 | var dimensions = template.id.split('x'); |
76 | dimensions = {width: String(dimensions[0])+'px', height: String(dimensions[1])+'px'}; | 76 | dimensions = {width: String(dimensions[0])+'px', height: String(dimensions[1])+'px'}; |
77 | // | 77 | // |
78 | content = content.replace(/Dimensions@@@/gi, "Dimensions@@@"+template.id); | 78 | content = content.replace(/Dimensions@@@/gi, "Dimensions@@@"+template.id); |
@@ -81,7 +81,7 @@ exports.IoMediator = Montage.create(Component, { | |||
81 | } | 81 | } |
82 | // | 82 | // |
83 | return content; | 83 | return content; |
84 | } | 84 | } |
85 | }, | 85 | }, |
86 | //////////////////////////////////////////////////////////////////// | 86 | //////////////////////////////////////////////////////////////////// |
87 | // | 87 | // |
@@ -113,8 +113,8 @@ exports.IoMediator = Montage.create(Component, { | |||
113 | //Sending result to callback if requested for handling | 113 | //Sending result to callback if requested for handling |
114 | if (callback) callback(result); | 114 | if (callback) callback(result); |
115 | //Codes | 115 | //Codes |
116 | // 204: File exists | 400: File exists | 116 | // 204: File exists | 400: File exists |
117 | // 201: File succesfully created | 500: Unknown (Probably cloud API not running) | 117 | // 201: File succesfully created | 500: Unknown (Probably cloud API not running) |
118 | } | 118 | } |
119 | }, | 119 | }, |
120 | //////////////////////////////////////////////////////////////////// | 120 | //////////////////////////////////////////////////////////////////// |
@@ -159,9 +159,9 @@ exports.IoMediator = Montage.create(Component, { | |||
159 | 204: File exists (Success) | 159 | 204: File exists (Success) |
160 | 404: File does not exists (Failure) | 160 | 404: File does not exists (Failure) |
161 | 500: Unknown (Probably cloud API not running) | 161 | 500: Unknown (Probably cloud API not running) |
162 | 162 | ||
163 | (Below only present if succesfull 204) | 163 | (Below only present if succesfull 204) |
164 | 164 | ||
165 | Object.content | 165 | Object.content |
166 | Object.extension | 166 | Object.extension |
167 | Object.name | 167 | Object.name |
@@ -186,9 +186,9 @@ exports.IoMediator = Montage.create(Component, { | |||
186 | case 'html': | 186 | case 'html': |
187 | //Getting content from function to properly handle saving assets (as in external if flagged) | 187 | //Getting content from function to properly handle saving assets (as in external if flagged) |
188 | if (doc.template && (doc.template.type === 'banner' || doc.template.type === 'animation')) { | 188 | if (doc.template && (doc.template.type === 'banner' || doc.template.type === 'animation')) { |
189 | parsedDoc = this.tmplt.parseNinjaTemplateToHtml(true, doc, true, libCopyCallback); | 189 | parsedDoc = this.tmplt.parseNinjaTemplateToHtml(true, doc, true, libCopyCallback); |
190 | } else { | 190 | } else { |
191 | parsedDoc = this.tmplt.parseNinjaTemplateToHtml(true, doc, false, libCopyCallback); | 191 | parsedDoc = this.tmplt.parseNinjaTemplateToHtml(true, doc, false, libCopyCallback); |
192 | } | 192 | } |
193 | break; | 193 | break; |
194 | default: | 194 | default: |
@@ -196,21 +196,21 @@ exports.IoMediator = Montage.create(Component, { | |||
196 | break; | 196 | break; |
197 | } | 197 | } |
198 | if (parsedDoc) { | 198 | if (parsedDoc) { |
199 | //Making call to save file | 199 | //Making call to save file |
200 | save = this.fio.saveFile({uri: doc.file.uri, contents: parsedDoc.content}); | 200 | save = this.fio.saveFile({uri: doc.file.uri, contents: parsedDoc.content}); |
201 | //Checking for callback | 201 | //Checking for callback |
202 | if (callback) callback(save); | 202 | if (callback) callback(save); |
203 | //Checking for libraries, making callback if specified | 203 | //Checking for libraries, making callback if specified |
204 | if (!parsedDoc.libs && libCopyCallback) libCopyCallback(true); | 204 | if (!parsedDoc.libs && libCopyCallback) libCopyCallback(true); |
205 | // | 205 | // |
206 | return {montageId: parsedDoc.montageId, canvasId: parsedDoc.canvasId}; | 206 | return {montageId: parsedDoc.montageId, canvasId: parsedDoc.canvasId}; |
207 | } else { | 207 | } else { |
208 | //Making call to save file | 208 | //Making call to save file |
209 | save = this.fio.saveFile({uri: doc.file.uri, contents: content}); | 209 | save = this.fio.saveFile({uri: doc.file.uri, contents: content}); |
210 | //Checking for callback | 210 | //Checking for callback |
211 | if (callback) callback(save); | 211 | if (callback) callback(save); |
212 | // | 212 | // |
213 | return null; | 213 | return null; |
214 | } | 214 | } |
215 | } | 215 | } |
216 | }, | 216 | }, |