aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/document/document-html.js102
-rwxr-xr-xjs/document/helpers/url-parser.js24
-rwxr-xr-xjs/document/models/base.js34
-rwxr-xr-xjs/document/views/base.js53
-rwxr-xr-xjs/document/views/design.js49
-rwxr-xr-xjs/io/system/fileio.js4
-rw-r--r--js/io/system/ninjalibrary.js2
-rw-r--r--js/mediators/io-mediator.js4
8 files changed, 203 insertions, 69 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js
index 89717dd6..28406ee8 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -18,25 +18,33 @@ exports.HtmlDocument = Montage.create(Component, {
18 enumerable: false, 18 enumerable: false,
19 value: false 19 value: false
20 }, 20 },
21 21 ////////////////////////////////////////////////////////////////////
22 //
22 model: { 23 model: {
24 enumerable: false,
23 value: null 25 value: null
24 }, 26 },
25 27 ////////////////////////////////////////////////////////////////////
28 //
26 loadDelegate: { 29 loadDelegate: {
30 enumerable: false,
27 value: null 31 value: null
28 }, 32 },
29 33 ////////////////////////////////////////////////////////////////////
34 //
30 delegateContext: { 35 delegateContext: {
36 enumerable: false,
31 value: null 37 value: null
32 }, 38 },
33 39 ////////////////////////////////////////////////////////////////////
40 //
34 exclusionList: { 41 exclusionList: {
42 enumerable: false,
35 value: ["HTML", "BODY"] 43 value: ["HTML", "BODY"]
36 }, 44 },
37 45 ////////////////////////////////////////////////////////////////////
38 // Getters for the model. 46 ////////////////////////////////////////////////////////////////////
39 // TODO: Change how these properties are accessed through Ninja 47 //TODO: Remove these setters/getters, should call model directly
40 name: { 48 name: {
41 get: function() { 49 get: function() {
42 return this.model._name; 50 return this.model._name;
@@ -45,7 +53,7 @@ exports.HtmlDocument = Montage.create(Component, {
45 this.model._name = value; 53 this.model._name = value;
46 } 54 }
47 }, 55 },
48 56 //
49 isActive: { 57 isActive: {
50 get: function() { 58 get: function() {
51 return this.model._isActive; 59 return this.model._isActive;
@@ -54,7 +62,7 @@ exports.HtmlDocument = Montage.create(Component, {
54 this.model._isActive = value; 62 this.model._isActive = value;
55 } 63 }
56 }, 64 },
57 65 //
58 needsSave: { 66 needsSave: {
59 get: function() { 67 get: function() {
60 return this.model._needsSave; 68 return this.model._needsSave;
@@ -63,82 +71,62 @@ exports.HtmlDocument = Montage.create(Component, {
63 this.model._needsSave = value; 71 this.model._needsSave = value;
64 } 72 }
65 }, 73 },
66 74 //
67 // View Properties
68 // TODO: Move those into a view object - for now dump it here
69 iframe: {
70 value: null
71 },
72
73 uuid: { 75 uuid: {
74 get: function() { 76 get: function() {
75 return this._uuid; 77 return this._uuid;
76 } 78 }
77 }, 79 },
78 80 //
79 currentView: { 81 currentView: {
80 value: "design" 82 value: "design"
81 }, 83 },
82 //////////////////////////////////////////////////////////////////// 84 ////////////////////////////////////////////////////////////////////
83 //////////////////////////////////////////////////////////////////// 85 ////////////////////////////////////////////////////////////////////
84 init: { 86 //
85 value:function(file, context, callback) { 87 iframe: { //MOVE TO: base.js in views
86 this.model = Montage.create(HtmlDocumentModel, { 88 value: null
87 file: {
88 value: file
89 }
90 });
91
92 this.name = file.name;
93
94 // this.init(file.name, file.uri, file.extension, iframe, uuid, callback);
95
96
97 this.iframe = this.createView();
98
99 //this.selectionExclude = ["HTML", "BODY", "Viewport", "UserContent", "stageBG"];
100 //this.currentView = "design";
101 //
102
103 this.delegateContext = context;
104 this.loadDelegate = callback;
105 }
106 }, 89 },
107 90 //
108 // Create View 91 createView: { //MOVE TO: design.js in views
109 // Move this into a base view object
110 createView: {
111 value: function() { 92 value: function() {
112 var ifr = document.createElement("iframe"); 93 var ifr = document.createElement("iframe");
94 //
113 ifr.id = "document_" + this._uuid; 95 ifr.id = "document_" + this._uuid;
114
115
116 ifr.style.border = "none"; 96 ifr.style.border = "none";
117 ifr.style.background = "#FFF"; 97 ifr.style.background = "#FFF";
118 ifr.style.height = "100%"; 98 ifr.style.height = "100%";
119 ifr.style.width = "100%"; 99 ifr.style.width = "100%";
120 100 //
121 // TODO: Reable opacity to display only when done loading
122// ifr.style.opacity = 0;
123
124 ifr.src = "js/document/templates/montage-web/index.html"; 101 ifr.src = "js/document/templates/montage-web/index.html";
125 ifr.addEventListener("load", this.handleWebTemplateLoad.bind(this), true); 102 ifr.addEventListener("load", this.handleWebTemplateLoad.bind(this), true);
126 103 //
127 return document.getElementById("iframeContainer").appendChild(ifr); 104 return document.getElementById("iframeContainer").appendChild(ifr);
128 } 105 }
129 }, 106 },
130 107 ////////////////////////////////////////////////////////////////////
108 ////////////////////////////////////////////////////////////////////
109 //
110 init: {
111 value:function(file, context, callback) {
112 this.model = Montage.create(HtmlDocumentModel, {
113 file: {
114 value: file
115 }
116 });
117 this.name = file.name;
118 this.iframe = this.createView();
119 this.delegateContext = context;
120 this.loadDelegate = callback;
121 }
122 },
123 ////////////////////////////////////////////////////////////////////
124 //
131 handleWebTemplateLoad: { 125 handleWebTemplateLoad: {
132 value: function(event) { 126 value: function(event) {
133 //TODO: Remove, also for prototyping 127 //TODO: Remove, also for prototyping
134 this.application.ninja.documentController._hackRootFlag = true; 128 this.application.ninja.documentController._hackRootFlag = true;
135 129
136
137 //TODO: Clean up, using for prototyping save
138// this._templateDocument = {};
139// this._templateDocument.html = this.iframe.contentWindow.document;
140// this._templateDocument.body =
141
142 this._window = this.iframe.contentWindow; 130 this._window = this.iframe.contentWindow;
143 this._document = this.iframe.contentWindow.document; 131 this._document = this.iframe.contentWindow.document;
144 this.documentRoot = this.iframe.contentWindow.document.body; 132 this.documentRoot = this.iframe.contentWindow.document.body;
diff --git a/js/document/helpers/url-parser.js b/js/document/helpers/url-parser.js
new file mode 100755
index 00000000..878c79e9
--- /dev/null
+++ b/js/document/helpers/url-parser.js
@@ -0,0 +1,24 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No 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
7////////////////////////////////////////////////////////////////////////
8//
9var Montage = require("montage/core/core").Montage,
10 Component = require("montage/ui/component").Component;
11////////////////////////////////////////////////////////////////////////
12//
13exports.UrlParser = Montage.create(Component, {
14 ////////////////////////////////////////////////////////////////////
15 //
16 hasTemplate: {
17 enumerable: false,
18 value: false
19 }
20 ////////////////////////////////////////////////////////////////////
21 ////////////////////////////////////////////////////////////////////
22});
23////////////////////////////////////////////////////////////////////////
24//////////////////////////////////////////////////////////////////////// \ No newline at end of file
diff --git a/js/document/models/base.js b/js/document/models/base.js
index f237e793..f4dbbc0b 100755
--- a/js/document/models/base.js
+++ b/js/document/models/base.js
@@ -21,20 +21,28 @@ exports.BaseDocumentModel = Montage.create(Montage, {
21 file: { 21 file: {
22 value: null 22 value: null
23 }, 23 },
24 24 ////////