diff options
Diffstat (limited to 'js')
9 files changed, 124 insertions, 33 deletions
diff --git a/js/components/layout/documents-tab.reel/documents-tab.js b/js/components/layout/documents-tab.reel/documents-tab.js index e874a73c..982f6ecd 100755 --- a/js/components/layout/documents-tab.reel/documents-tab.js +++ b/js/components/layout/documents-tab.reel/documents-tab.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 = require("js/io/document/document-controller"); | ||
11 | |||
12 | exports.DocumentsTab = Montage.create(Component, { | 10 | exports.DocumentsTab = Montage.create(Component, { |
13 | 11 | ||
14 | openDocuments: { | 12 | openDocuments: { |
@@ -19,7 +17,7 @@ exports.DocumentsTab = Montage.create(Component, { | |||
19 | enumerable: false, | 17 | enumerable: false, |
20 | value: function() { | 18 | value: function() { |
21 | // console.log("Change this to be inside the Ninja Reel"); | 19 | // console.log("Change this to be inside the Ninja Reel"); |
22 | this.openDocuments = documentManagerModule.DocumentController._documents; | 20 | this.openDocuments = this.application.ninja.documentController._documents; |
23 | // this.eventManager.addEventListener( "appLoaded", this, false); | 21 | // this.eventManager.addEventListener( "appLoaded", this, false); |
24 | } | 22 | } |
25 | }, | 23 | }, |
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html index b4aee4b2..b5da0e6e 100755 --- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html +++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html | |||
@@ -97,8 +97,8 @@ | |||
97 | <div id="right-bottom" class="right-bottom"></div> | 97 | <div id="right-bottom" class="right-bottom"></div> |
98 | </div> | 98 | </div> |
99 | <div class="buttons"> | 99 | <div class="buttons"> |
100 | <input id="cancelButton" type="button" value="CANCEL" class="cancelButton" /> | 100 | <input id="cancelButton" type="button" value="CANCEL" class="cancelButton nj-skinned" /> |
101 | <input id="okButton" disabled="true" type="button" value="OK" class="okButton" /> | 101 | <input id="okButton" disabled="true" type="button" value="OK" class="okButton nj-skinned" /> |
102 | </div> | 102 | </div> |
103 | <div id="filters" class="filters" style="display:block;"> | 103 | <div id="filters" class="filters" style="display:block;"> |
104 | <div class="dropdown hide"></div> | 104 | <div class="dropdown hide"></div> |
diff --git a/js/io/document/base-document.js b/js/io/document/base-document.js index 44f54f78..af96c851 100755 --- a/js/io/document/base-document.js +++ b/js/io/document/base-document.js | |||
@@ -12,6 +12,7 @@ var BaseDocument = exports.BaseDocument = Montage.create(Montage, { | |||
12 | /** Private Members **/ | 12 | /** Private Members **/ |
13 | _name: { value: null, enumerable: false }, | 13 | _name: { value: null, enumerable: false }, |
14 | _uri: { value: null, enumerable: false }, | 14 | _uri: { value: null, enumerable: false }, |
15 | _externalUri: {value: null, enumerable:false}, | ||
15 | _documentType: { value: null, enumerable: false }, | 16 | _documentType: { value: null, enumerable: false }, |
16 | _container: {value: null, enumerable: false }, | 17 | _container: {value: null, enumerable: false }, |
17 | _uuid: { value: null, enumerable: false }, | 18 | _uuid: { value: null, enumerable: false }, |
@@ -31,6 +32,11 @@ var BaseDocument = exports.BaseDocument = Montage.create(Montage, { | |||
31 | set: function(value) { this._uri = value; } | 32 | set: function(value) { this._uri = value; } |
32 | }, | 33 | }, |
33 | 34 | ||
35 | externalUri: { | ||
36 | get: function() { return this._externalUri; }, | ||
37 | set: function(value) { this._externalUri = value; } | ||
38 | }, | ||
39 | |||
34 | documentType: { | 40 | documentType: { |
35 | get: function() { return this._documentType; }, | 41 | get: function() { return this._documentType; }, |
36 | set: function(value) { this._documentType = value; } | 42 | set: function(value) { this._documentType = value; } |
@@ -68,13 +74,18 @@ var BaseDocument = exports.BaseDocument = Montage.create(Montage, { | |||
68 | 74 | ||
69 | /** Base Methods **/ | 75 | /** Base Methods **/ |
70 | init: { | 76 | init: { |
71 | value: function(name, uri, type, container, uuid, callback) { | 77 | value: function(name, uri, type, container, uuid, callback, externalUri) { |
72 | this.name = name; | 78 | this.name = name; |
73 | this.uri = uri; | 79 | this.uri = uri; |
74 | this.documentType = type; | 80 | this.documentType = type; |
75 | this.container = container; | 81 | this.container = container; |
76 | this.uuid = uuid; | 82 | this.uuid = uuid; |
77 | this.callback = callback; | 83 | this.callback = callback; |
84 | if(!!externalUri){ | ||
85 | this.externalUri = externalUri; | ||
86 | this.container.setAttribute("data-uri", externalUri); | ||
87 | } | ||
88 | |||
78 | } | 89 | } |
79 | }, | 90 | }, |
80 | 91 | ||
diff --git a/js/io/document/document-controller.js b/js/io/document/document-controller.js index bba7e0e7..7fe94c12 100755 --- a/js/io/document/document-controller.js +++ b/js/io/document/document-controller.js | |||
@@ -99,9 +99,8 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
99 | if(!!uriArrayObj && !!uriArrayObj.uri && (uriArrayObj.uri.length > 0)){ | 99 | if(!!uriArrayObj && !!uriArrayObj.uri && (uriArrayObj.uri.length > 0)){ |
100 | uri = uriArrayObj.uri[0]; | 100 | uri = uriArrayObj.uri[0]; |
101 | } | 101 | } |
102 | console.log("URI is: ", uri); | 102 | //console.log("URI is: ", uri); |
103 | 103 | ||
104 | // Get file from Jose Code with a callback to here | ||
105 | if(!!uri){ | 104 | if(!!uri){ |
106 | response = this.application.ninja.coreIoApi.openFile({"uri":uri}); | 105 | response = this.application.ninja.coreIoApi.openFile({"uri":uri}); |
107 | if((response.success === true) && ((response.status === 200) || (response.status === 304))){ | 106 | if((response.success === true) && ((response.status === 200) || (response.status === 304))){ |
@@ -113,7 +112,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
113 | if(uri.indexOf('.') != -1){ | 112 | if(uri.indexOf('.') != -1){ |
114 | fileType = uri.substr(uri.lastIndexOf('.') + 1); | 113 | fileType = uri.substr(uri.lastIndexOf('.') + 1); |
115 | } | 114 | } |
116 | this.openDocument({"type": ""+fileType, "name": ""+filename, "source": fileContent}); | 115 | this.openDocument({"type": ""+fileType, "name": ""+filename, "source": fileContent, "externalUri": uri}); |
117 | } | 116 | } |
118 | 117 | ||
119 | } | 118 | } |
@@ -124,7 +123,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
124 | value: function(uri) { | 123 | value: function(uri) { |
125 | console.log("URI is: ", uri); | 124 | console.log("URI is: ", uri); |
126 | 125 | ||
127 | // Get project from Jose Code with a callback to here | ||
128 | } | 126 | } |
129 | }, | 127 | }, |
130 | 128 | ||
@@ -158,18 +156,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
158 | } | 156 | } |
159 | }, | 157 | }, |
160 | 158 | ||
161 | // Document has been loaded into the Iframe. Dispatch the event. | ||
162 | // Event Detail: Contains the current ActiveDocument | ||
163 | _onOpenDocument: { | ||
164 | value: function(doc){ | ||
165 | |||
166 | DocumentController.activeDocument = doc; | ||
167 | |||
168 | NJevent("onOpenDocument", doc); | ||
169 | |||
170 | } | ||
171 | }, | ||
172 | |||
173 | textDocumentOpened: { | 159 | textDocumentOpened: { |
174 | value: function(doc) { | 160 | value: function(doc) { |
175 | 161 | ||
@@ -209,13 +195,31 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
209 | 195 | ||
210 | closeDocument: { | 196 | closeDocument: { |
211 | value: function(id) { | 197 | value: function(id) { |
198 | |||
199 | //if file dirty then save | ||
200 | |||
212 | var doc = this._findDocumentByUUID(id); | 201 | var doc = this._findDocumentByUUID(id); |
213 | this._removeDocumentView(doc.container); | 202 | this._removeDocumentView(doc.container); |
214 | 203 | ||
215 | this._documents.splice(this._findIndexByUUID(id), 1); | 204 | this._documents.splice(this._findIndexByUUID(id), 1); |
216 | 205 | ||
217 | if(this.activeDocument.uuid === id && this._documents.length > 0) { | 206 | if(this.activeDocument.uuid === id && this._documents.length > 0) { |
207 | |||
208 | var closeDocumentIndex = this._findIndexByUUID(id); | ||
209 | var nextDocumentIndex = -1 ; | ||
210 | if((this._documents.length > 0) && (closeDocumentIndex === 0)){ | ||
211 | nextDocumentIndex = 1; | ||
212 | }else if((this._documents.length > 0) && (closeDocumentIndex > 0)){ | ||
213 | nextDocumentIndex = closeDocumentIndex - 1; | ||
214 | } | ||
215 | |||
216 | //remove the codemirror div if this is for a code view | ||
217 | /////test | ||
218 | |||
219 | ////end- test | ||
220 | |||
218 | this.switchDocument(this._documents[0].uuid); | 221 | this.switchDocument(this._documents[0].uuid); |
222 | |||
219 | } | 223 | } |
220 | } | 224 | } |
221 | }, | 225 | }, |
diff --git a/js/io/document/text-document.js b/js/io/document/text-document.js index 599d311c..a9081cb5 100755 --- a/js/io/document/text-document.js +++ b/js/io/document/text-document.js | |||
@@ -45,10 +45,10 @@ var TextDocument = exports.TextDocument = Montage.create(baseDocumentModule.Base | |||
45 | // PUBLIC METHODS | 45 | // PUBLIC METHODS |
46 | initialize: { | 46 | initialize: { |
47 | value: function(doc, uuid, textArea, callback) { | 47 | value: function(doc, uuid, textArea, callback) { |
48 | this.init(doc.name, doc.uri, doc.type, textArea, uuid); | 48 | this.init(doc.name, doc.uri, doc.type, textArea, uuid, null, doc.externalUri); |
49 | |||
50 | this.currentView = "code"; | 49 | this.currentView = "code"; |
51 | this.textArea = textArea; | 50 | this.textArea = textArea; |
51 | |||
52 | // this._loadContent(); | 52 | // this._loadContent(); |
53 | } | 53 | } |
54 | }, | 54 | }, |
diff --git a/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.html b/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.html index 36e937e0..dc090b99 100755 --- a/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.html +++ b/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.html | |||
@@ -84,8 +84,8 @@ | |||
84 | </di |