diff options
author | Jose Antonio Marquez | 2012-02-17 13:40:38 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-17 13:40:38 -0800 |
commit | a42c536c2b3209afc058eabd31167bd0aa6f71c8 (patch) | |
tree | 04158cd6136807bd77e8748972e165a5c91ce23b /js | |
parent | c56673e931e77b0c45b3a1c1112d16be3b599916 (diff) | |
download | ninja-a42c536c2b3209afc058eabd31167bd0aa6f71c8.tar.gz |
Adding webRequest redirects for iFrame templates
Diffstat (limited to 'js')
-rwxr-xr-x | js/controllers/document-controller.js | 20 | ||||
-rwxr-xr-x | js/document/html-document.js | 5 | ||||
-rwxr-xr-x | js/document/text-document.js | 5 | ||||
-rwxr-xr-x | js/io/ui/cloudpopup.reel/cloudpopup.html | 2 |
4 files changed, 21 insertions, 11 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 9785d824..5e2a6461 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -14,7 +14,7 @@ var Montage = require("montage/core/core").Montage, | |||
14 | DocumentController; | 14 | DocumentController; |
15 | //////////////////////////////////////////////////////////////////////// | 15 | //////////////////////////////////////////////////////////////////////// |
16 | // | 16 | // |
17 | DocumentController = exports.DocumentController = Montage.create(Component, { | 17 | var DocumentController = exports.DocumentController = Montage.create(Component, { |
18 | hasTemplate: { | 18 | hasTemplate: { |
19 | value: false | 19 | value: false |
20 | }, | 20 | }, |
@@ -22,6 +22,10 @@ DocumentController = exports.DocumentController = Montage.create(Component, { | |||
22 | _documents: { | 22 | _documents: { |
23 | value: [] | 23 | value: [] |
24 | }, | 24 | }, |
25 | |||
26 | _hackRootFlag: { | ||
27 | value: false | ||
28 | }, | ||
25 | 29 | ||
26 | _activeDocument: { value: null }, | 30 | _activeDocument: { value: null }, |
27 | _iframeCounter: { value: 1, enumerable: false }, | 31 | _iframeCounter: { value: 1, enumerable: false }, |
@@ -71,11 +75,13 @@ DocumentController = exports.DocumentController = Montage.create(Component, { | |||
71 | 75 | ||
72 | //TODO: Figure out why active document is not available here | 76 | //TODO: Figure out why active document is not available here |
73 | 77 | ||
74 | /* | 78 | if (this._hackRootFlag) { |
75 | if (request.url.indexOf('calculator.css') !== -1) { | 79 | |
76 | return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+'/calculator/components/calculator.reel/calculator.css'}; | 80 | //console.log(request.url.split('/')[request.url.split('/').length-1]); |
81 | //console.log(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]); | ||
82 | |||
83 | 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]}; | ||
77 | } | 84 | } |
78 | */ | ||
79 | } | 85 | } |
80 | } | 86 | } |
81 | }, | 87 | }, |
@@ -205,6 +211,9 @@ if (request.url.indexOf('calculator.css') !== -1) { | |||
205 | // | 211 | // |
206 | openDocument: { | 212 | openDocument: { |
207 | value: function(doc) { | 213 | value: function(doc) { |
214 | |||
215 | // | ||
216 | this.documentHackReference = doc; | ||
208 | // | 217 | // |
209 | switch (doc.extension) { | 218 | switch (doc.extension) { |
210 | case 'html': case 'html': | 219 | case 'html': case 'html': |
@@ -302,7 +311,6 @@ if (request.url.indexOf('calculator.css') !== -1) { | |||
302 | _onOpenDocument: { | 311 | _onOpenDocument: { |
303 | value: function(doc){ | 312 | value: function(doc){ |
304 | //var data = DocumentManager.activeDocument; | 313 | //var data = DocumentManager.activeDocument; |
305 | |||
306 | this._hideCurrentDocument(); | 314 | this._hideCurrentDocument(); |
307 | this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid); | 315 | this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid); |
308 | 316 | ||
diff --git a/js/document/html-document.js b/js/document/html-document.js index 16595d14..ae2b4600 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -235,7 +235,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
235 | // | 235 | // |
236 | initialize: { | 236 | initialize: { |
237 | value: function(file, uuid, iframe, callback) { | 237 | value: function(file, uuid, iframe, callback) { |
238 | //console.log('allow'); | 238 | this.application.ninja.documentController._hackRootFlag = false; |
239 | // | 239 | // |
240 | this._userDocument = file; | 240 | this._userDocument = file; |
241 | // | 241 | // |
@@ -363,7 +363,8 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
363 | // | 363 | // |
364 | handleEvent: { | 364 | handleEvent: { |
365 | value: function(event){ | 365 | value: function(event){ |
366 | 366 | this.application.ninja.documentController._hackRootFlag = true; | |
367 | //console.log(this._userDocument.root, this); | ||
367 | //TODO: Clean up, using for prototyping save | 368 | //TODO: Clean up, using for prototyping save |
368 | this._templateDocument = {}; | 369 | this._templateDocument = {}; |
369 | this._templateDocument.head = this.iframe.contentWindow.document.getElementById("userHead");; | 370 | this._templateDocument.head = this.iframe.contentWindow.document.getElementById("userHead");; |
diff --git a/js/document/text-document.js b/js/document/text-document.js index 6f8efaad..3e20e1f6 100755 --- a/js/document/text-document.js +++ b/js/document/text-document.js | |||
@@ -6,9 +6,10 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
6 | 6 | ||
7 | //BaseDocument Object for all files types and base class for HTML documents. | 7 | //BaseDocument Object for all files types and base class for HTML documents. |
8 | 8 | ||
9 | var Montage = require("montage/core/core").Montage; | 9 | var Montage = require("montage/core/core").Montage, |
10 | Component = require("montage/ui/component").Component; | ||
10 | 11 | ||
11 | var TextDocument = exports.TextDocument = Montage.create(Montage, { | 12 | var TextDocument = exports.TextDocument = Montage.create(Component, { |
12 | 13 | ||
13 | 14 | ||
14 | //TODO: Clean up, test | 15 | //TODO: Clean up, test |
diff --git a/js/io/ui/cloudpopup.reel/cloudpopup.html b/js/io/ui/cloudpopup.reel/cloudpopup.html index 2c1c169a..e58041ec 100755 --- a/js/io/ui/cloudpopup.reel/cloudpopup.html +++ b/js/io/ui/cloudpopup.reel/cloudpopup.html | |||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | <p>Connection to the Cloud Server was not detected. Please verify <br />that the server is running and the URL below is correct.</p> | 37 | <p>Connection to the Cloud Server was not detected. Please verify <br />that the server is running and the URL below is correct.</p> |
38 | 38 | ||
39 | <label for="cloud_url">Cloud Server URL:</label><input type="text" id="cloud_url" class="cloud_url" value="http://localhost:16380" /> | 39 | <label for="cloud_url">Cloud Server URL:</label><input type="text" id="cloud_url" class="cloud_url" value="" /> |
40 | 40 | ||
41 | <button class="btn_test nj-skinned">Test</button> | 41 | <button class="btn_test nj-skinned">Test</button> |
42 | 42 | ||