aboutsummaryrefslogtreecommitdiff
path: root/js/io/document/html-document.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/io/document/html-document.js')
-rwxr-xr-xjs/io/document/html-document.js84
1 files changed, 38 insertions, 46 deletions
diff --git a/js/io/document/html-document.js b/js/io/document/html-document.js
index fbb34a1d..d51cd279 100755
--- a/js/io/document/html-document.js
+++ b/js/io/document/html-document.js
@@ -11,7 +11,7 @@ var Montage = require("montage/core/core").Montage,
11var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.BaseDocument, { 11var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.BaseDocument, {
12 // PRIVATE MEMBERS 12 // PRIVATE MEMBERS
13 _selectionExclude: { value: null, enumerable: false }, 13 _selectionExclude: { value: null, enumerable: false },
14 _htmlTemplateUrl: { value: "user-document-templates/montage-application-cloud/index.html", enumerable: false}, 14 _cloudTemplateUri: { value: "user-document-templates/montage-application-cloud/index.html", enumerable: false},
15 _iframe: { value: null, enumerable: false }, 15 _iframe: { value: null, enumerable: false },
16 _server: { value: null, enumerable: false }, 16 _server: { value: null, enumerable: false },
17 _selectionModel: { value: [], enumerable: false }, 17 _selectionModel: { value: [], enumerable: false },
@@ -24,7 +24,7 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base
24 _styles: { value: null, enumerable: false }, 24 _styles: { value: null, enumerable: false },
25 _stylesheets: { value: null, enumerable: false }, 25 _stylesheets: { value: null, enumerable: false },
26 _stageStyleSheetId : { value: 'nj-stage-stylesheet', enumerable: false }, 26 _stageStyleSheetId : { value: 'nj-stage-stylesheet', enumerable: false },
27 _userDocument: { value: null, enumerable: false }, 27 _initialUserDocument: { value: null, enumerable: false },
28 _htmlSource: {value: "<html></html>", enumerable: false}, 28 _htmlSource: {value: "<html></html>", enumerable: false},
29 _glData: {value: null, enumerable: false }, 29 _glData: {value: null, enumerable: false },
30 30
@@ -218,27 +218,30 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base
218 218
219 //****************************************// 219 //****************************************//
220 // PUBLIC METHODS 220 // PUBLIC METHODS
221 221 initialize: {
222 222 value: function(doc, uuid, iframe, callback) {
223 //////////////////////////////////////////////////////////////////// 223 // Shell mode is not used anymore
224 // 224 //if(!window.IsInShellMode()) {
225 initialize: { 225 if(!doc.name){doc.name = "index-cloud"};
226 value: function(file, uuid, iframe, callback) { 226 if(!doc.uri){doc.uri = this._cloudTemplateUri};
227 // 227 this.init(doc.name, doc.uri, doc.type, iframe, uuid, callback);
228 this._userDocument = file; 228 /*
229 // 229 } else {
230 this.init(file.name, file.uri, file.extension, iframe, uuid, callback); 230 var tmpurl = doc.uri.split('\\');
231 // 231 var fileUrl = doc.server.url + "/" + tmpurl[tmpurl.length -1] + "?fileio=true&template=/user-document-templates/montage-application/index.html";
232 this.iframe = iframe; 232 this.init(name, fileUrl, doc.type, iframe, uuid, callback);
233 this.selectionExclude = ["HTML", "BODY", "Viewport", "UserContent", "stageBG"]; 233 this.server = doc.server;
234 this.currentView = "design"; 234 this._initialUserDocument = doc;
235 // 235 }
236 this.iframe.src = this._htmlTemplateUrl; 236 */
237 this.iframe.addEventListener("load", this, true); 237 this.iframe = iframe;
238 this.selectionExclude = ["HTML", "BODY", "Viewport", "UserContent", "stageBG"];
239 this.currentView = "design";
240
241 this._loadDocument(this.uri);
242
238 } 243 }
239 }, 244 },
240 ////////////////////////////////////////////////////////////////////
241
242 245
243 collectGLData: { 246 collectGLData: {
244 value: function( elt, dataArray ) 247 value: function( elt, dataArray )
@@ -342,8 +345,7 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base
342 } 345 }
343 }, 346 },
344 347
345 /* 348 // Private
346// Private
347 _loadDocument: { 349 _loadDocument: {
348 value: function(uri) { 350 value: function(uri) {
349 // Load the document into the Iframe 351 // Load the document into the Iframe
@@ -351,32 +353,23 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base
351 this.iframe.addEventListener("load", this, true); 353 this.iframe.addEventListener("load", this, true);
352 } 354 }
353 }, 355 },
354*/ 356
355
356
357
358 ////////////////////////////////////////////////////////////////////
359 //
360 handleEvent: { 357 handleEvent: {
361 value: function(event){ 358 value: function(event){
362 // 359 this.documentRoot = this.iframe.contentWindow.document.getElementById("UserContent");
363 this.documentRoot = this.iframe.contentWindow.document.getElementById("UserContent");
364 this.stageBG = this.iframe.contentWindow.document.getElementById("stageBG"); 360 this.stageBG = this.iframe.contentWindow.document.getElementById("stageBG");
365 this.stageBG.onclick = null; 361 this.stageBG.onclick = null;
366 this._document = this.iframe.contentWindow.document; 362 this._document = this.iframe.contentWindow.document;
367 this._window = this.iframe.contentWindow; 363 this._window = this.iframe.contentWindow;
368 // 364 if(!this.documentRoot.Ninja)
369 if(!this.documentRoot.Ninja) this.documentRoot.Ninja = {}; 365 {
370 // 366 this.documentRoot.Ninja = {};
371 367 }
372 this.documentRoot.innerHTML = this._userDocument.content.body; 368
373 this.iframe.contentWindow.document.getElementById("userHead").innerHTML = this._userDocument.content.head; 369 if(this._initialUserDocument) {
374 370 // Now load the user content
375 371 this.documentRoot.innerHTML = this._initialUserDocument.body;
376 372 this.iframe.contentWindow.document.getElementById("userHead").innerHTML = this._initialUserDocument.head;
377
378
379
380 373
381 this.cssLoadInterval = setInterval(function() { 374 this.cssLoadInterval = setInterval(function() {
382 if(this._document.styleSheets.length > 1) { 375 if(this._document.styleSheets.length > 1) {
@@ -390,8 +383,7 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base
390 383
391 // TODO - Not sure where this goes 384 // TODO - Not sure where this goes
392 this._userComponentSet = {}; 385 this._userComponentSet = {};
393 386 } else {
394
395 this._styles = this._document.styleSheets[this._document.styleSheets.length - 1]; 387 this._styles = this._document.styleSheets[this._document.styleSheets.length - 1];
396 this._stylesheets = this._document.styleSheets; // Entire stlyesheets array 388 this._stylesheets = this._document.styleSheets; // Entire stlyesheets array
397 389
@@ -437,7 +429,7 @@ var HTMLDocument = exports.HTMLDocument = Montage.create(baseDocumentModule.Base
437 } 429 }
438 430
439 this.callback(this); 431 this.callback(this);
440 432 }
441 } 433 }
442 }, 434 },
443 435