aboutsummaryrefslogtreecommitdiff
path: root/js/io
diff options
context:
space:
mode:
Diffstat (limited to 'js/io')
-rwxr-xr-xjs/io/document/base-document.js5
-rwxr-xr-xjs/io/document/document-controller.js91
-rwxr-xr-xjs/io/document/html-document.js12
-rwxr-xr-xjs/io/document/text-document.js12
-rwxr-xr-xjs/io/system/coreioapi.js30
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.css (renamed from js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.css)0
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.html (renamed from js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.html)2
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js (renamed from js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.js)2
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.css (renamed from js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.css)0
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.html (renamed from js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.html)8
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js (renamed from js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js)10
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-workflow-controller.js (renamed from js/io/workflow/newFileDialog/new-file-workflow-controller.js)6
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-workflow-model.js (renamed from js/io/workflow/newFileDialog/new-file-workflow-model.js)0
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.css (renamed from js/io/workflow/save-as-dialog.reel/save-as-dialog.css)34
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.html (renamed from js/io/workflow/save-as-dialog.reel/save-as-dialog.html)6
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.js (renamed from js/io/workflow/save-as-dialog.reel/save-as-dialog.js)8
-rw-r--r--js/io/utils/file-utils.js76
-rwxr-xr-xjs/io/workflow/new-project-manager.js136
-rwxr-xr-xjs/io/workflow/newProjectNavigator.js75
-rwxr-xr-xjs/io/workflow/newProjectNavigator.reel/newProjectNavigator.css32
-rwxr-xr-xjs/io/workflow/newProjectNavigator.reel/newProjectNavigator.html32
21 files changed, 149 insertions, 428 deletions
diff --git a/js/io/document/base-document.js b/js/io/document/base-document.js
index 44f54f78..d3601de5 100755
--- a/js/io/document/base-document.js
+++ b/js/io/document/base-document.js
@@ -31,6 +31,11 @@ var BaseDocument = exports.BaseDocument = Montage.create(Montage, {
31 set: function(value) { this._uri = value; } 31 set: function(value) { this._uri = value; }
32 }, 32 },
33 33
34 externalUri: {
35 get: function() { return this._externalUri; },
36 set: function(value) { this._externalUri = value; }
37 },
38
34 documentType: { 39 documentType: {
35 get: function() { return this._documentType; }, 40 get: function() { return this._documentType; },
36 set: function(value) { this._documentType = value; } 41 set: function(value) { this._documentType = value; }
diff --git a/js/io/document/document-controller.js b/js/io/document/document-controller.js
index bba7e0e7..8ce43dcc 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, "uri": 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
@@ -143,7 +141,9 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
143 newDoc = Montage.create(TextDocument, { 141 newDoc = Montage.create(TextDocument, {
144 "source": { value: doc.source } 142 "source": { value: doc.source }
145 }); 143 });
146 newDoc.initialize(doc, Uuid.generate(), this._createTextAreaElement()); 144 var docUuid = Uuid.generate();
145 var textArea = this.application.ninja.stage.stageView.createTextAreaElement(docUuid);
146 newDoc.initialize(doc, docUuid, textArea, textArea.parentNode);
147 147
148 // Tmp this will be filled with the real content 148 // Tmp this will be filled with the real content
149 newDoc.textArea.innerHTML = doc.source; //this.tmpSourceForTesting; 149 newDoc.textArea.innerHTML = doc.source; //this.tmpSourceForTesting;
@@ -158,18 +158,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
158 } 158 }
159 }, 159 },
160 160
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: { 161 textDocumentOpened: {
174 value: function(doc) { 162 value: function(doc) {
175 163
@@ -209,13 +197,31 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
209 197
210 closeDocument: { 198 closeDocument: {
211 value: function(id) { 199 value: function(id) {
200
201 //if file dirty then save
202
212 var doc = this._findDocumentByUUID(id); 203 var doc = this._findDocumentByUUID(id);
213 this._removeDocumentView(doc.container); 204 this._removeDocumentView(doc.container);
214 205
215 this._documents.splice(this._findIndexByUUID(id), 1); 206 this._documents.splice(this._findIndexByUUID(id), 1);
216 207
217 if(this.activeDocument.uuid === id && this._documents.length > 0) { 208 if(this.activeDocument.uuid === id && this._documents.length > 0) {
209
210 var closeDocumentIndex = this._findIndexByUUID(id);
211 var nextDocumentIndex = -1 ;
212 if((this._documents.length > 0) && (closeDocumentIndex === 0)){
213 nextDocumentIndex = 1;
214 }else if((this._documents.length > 0) && (closeDocumentIndex > 0)){
215 nextDocumentIndex = closeDocumentIndex - 1;
216 }
217
218 //remove the codemirror div if this is for a code view
219 /////test
220
221 ////end- test
222
218 this.switchDocument(this._documents[0].uuid); 223 this.switchDocument(this._documents[0].uuid);
224
219 } 225 }
220 } 226 }
221 }, 227 },
@@ -238,6 +244,9 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
238 244
239 switchViews: { 245 switchViews: {
240 value: function() { 246 value: function() {
247
248 //save file if dirty
249
241 this.application.ninja.stage.saveScroll(); 250 this.application.ninja.stage.saveScroll();
242 this._hideCurrentDocument(); 251 this._hideCurrentDocument();
243 252
@@ -250,19 +259,20 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
250 259
251 } else { 260 } else {
252 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe 261 this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe
253 var codeview = this._createTextAreaElement(); 262
254 this._textHolder.style.display = "block"; 263 var codeview = this.activeDocument.container;
255 codeview.firstChild.innerHTML = this.activeDocument.iframe.contentWindow.document.body.parentNode.innerHTML; 264 //this._textHolder.style.display = "block";
256 265 //codeview.firstChild.innerHTML = this.activeDocument.iframe.contentWindow.document.body.parentNode.innerHTML;
257 this._codeEditor.editor = CodeMirror.fromTextArea(codeview.firstChild, { 266
258 lineNumbers: true, 267// this._codeEditor.editor = CodeMirror.fromTextArea(codeview.firstChild, {
259 mode: "htmlmixed", 268// lineNumbers: true,
260 onCursorActivity: function() { 269// mode: "htmlmixed",
261 DocumentController._codeEditor.editor.setLineClass(DocumentController._codeEditor.hline, null); 270// onCursorActivity: function() {
262 DocumentController._codeEditor.hline = DocumentController._codeEditor.editor.setLineClass(DocumentController._codeEditor.editor.getCursor().line, "activeline"); 271// DocumentController._codeEditor.editor.setLineClass(DocumentController._codeEditor.hline, null);
263 } 272// DocumentController._codeEditor.hline = DocumentController._codeEditor.editor.setLineClass(DocumentController._codeEditor.editor.getCursor().line, "activeline");
264 }); 273// }
265 this._codeEditor.hline = DocumentController._codeEditor.editor.setLineClass(0, "activeline"); 274// });
275// this._codeEditor.hline = DocumentController._codeEditor.editor.setLineClass(0, "activeline");
266 } 276 }
267 } 277 }
268 }, 278 },
@@ -405,26 +415,5 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
405 value: function() { 415 value: function() {
406 return "userDocument_" + (this._iframeCounter++); 416 return "userDocument_" + (this._iframeCounter++);
407 } 417 }
408 },
409
410 /**
411 * Creates a text area which will contain the content of the opened text document.
412 */
413_createTextAreaElement: {
414 value: function() {
415 var codeMirrorDiv = document.createElement("div");
416 codeMirrorDiv.id = "codeMirror_" + (this._codeMirrorCounter++);