aboutsummaryrefslogtreecommitdiff
path: root/js/io
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-01-27 12:05:17 -0800
committerJose Antonio Marquez2012-01-27 12:05:17 -0800
commit3a754133dbc138390503341fd2e9beba3e43aa4b (patch)
treecdeae7d7dd9a30d7b4fab5afb7efad68d4ec7508 /js/io
parentb89a7ee8b956c96a1dcee995ea840feddc5d4b27 (diff)
downloadninja-3a754133dbc138390503341fd2e9beba3e43aa4b.tar.gz
Merged old FileIO
Diffstat (limited to 'js/io')
-rwxr-xr-x[-rw-r--r--]js/io/document/base-document.js0
-rwxr-xr-x[-rw-r--r--]js/io/document/document-controller.js166
-rwxr-xr-x[-rw-r--r--]js/io/document/html-document.js0
-rwxr-xr-x[-rw-r--r--]js/io/document/text-document.js15
-rw-r--r--js/io/system/config.xml6
-rwxr-xr-x[-rw-r--r--]js/io/system/coreioapi.js (renamed from js/io/system/shellapi.js)191
-rwxr-xr-x[-rw-r--r--]js/io/system/fileio.js0
-rwxr-xr-x[-rw-r--r--]js/io/system/filesystem.js78
-rwxr-xr-x[-rw-r--r--]js/io/system/projectio.js0
-rwxr-xr-xjs/io/templates/files/template.css0
-rwxr-xr-xjs/io/templates/files/template.html0
-rwxr-xr-xjs/io/templates/files/template.js0
-rwxr-xr-xjs/io/templates/files/template.json0
-rwxr-xr-xjs/io/templates/files/template.php0
-rwxr-xr-xjs/io/templates/files/template.pl0
-rwxr-xr-xjs/io/templates/files/template.py0
-rwxr-xr-xjs/io/templates/files/template.rb0
-rwxr-xr-xjs/io/templates/files/template.xml0
-rwxr-xr-x[-rw-r--r--]js/io/workflow/new-project-manager.js0
-rwxr-xr-x[-rw-r--r--]js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.css23
-rwxr-xr-x[-rw-r--r--]js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.html61
-rwxr-xr-x[-rw-r--r--]js/io/workflow/newFileDialog/new-file-location.reel/new-file-location.js30
-rwxr-xr-x[-rw-r--r--]js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.css107
-rwxr-xr-x[-rw-r--r--]js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.html45
-rwxr-xr-x[-rw-r--r--]js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js375
-rwxr-xr-x[-rw-r--r--]js/io/workflow/newFileDialog/new-file-workflow-controller.js75
-rwxr-xr-x[-rw-r--r--]js/io/workflow/newFileDialog/new-file-workflow-model.js39
-rwxr-xr-x[-rw-r--r--]js/io/workflow/newProjectNavigator.js0
-rwxr-xr-x[-rw-r--r--]js/io/workflow/newProjectNavigator.reel/newProjectNavigator.css0
-rwxr-xr-x[-rw-r--r--]js/io/workflow/newProjectNavigator.reel/newProjectNavigator.html0
-rwxr-xr-xjs/io/workflow/save-as-dialog.reel/save-as-dialog.css60
-rwxr-xr-xjs/io/workflow/save-as-dialog.reel/save-as-dialog.html84
-rwxr-xr-xjs/io/workflow/save-as-dialog.reel/save-as-dialog.js126
33 files changed, 1181 insertions, 300 deletions
diff --git a/js/io/document/base-document.js b/js/io/document/base-document.js
index 44f54f78..44f54f78 100644..100755
--- a/js/io/document/base-document.js
+++ b/js/io/document/base-document.js
diff --git a/js/io/document/document-controller.js b/js/io/document/document-controller.js
index 99177de0..6f363bc7 100644..100755
--- a/js/io/document/document-controller.js
+++ b/js/io/document/document-controller.js
@@ -12,26 +12,35 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
12@requires js/document/text-document 12@requires js/document/text-document
13*/ 13*/
14 14
15// TODO : Fix deps from Montage V4 Archi
16
17var Montage = require("montage/core/core").Montage, 15var Montage = require("montage/core/core").Montage,
18 Component = require("montage/ui/component").Component, 16 Component = require("montage/ui/component").Component,
19 Uuid = require("montage/core/uuid").Uuid; 17 Uuid = require("montage/core/uuid").Uuid,
18 fileSystem = require("js/io/system/filesystem").FileSystem;
20 19
21var HTMLDocument = require("js/io/document/html-document").HTMLDocument; 20var HTMLDocument = require("js/io/document/html-document").HTMLDocument;
22var TextDocument = require("js/io/document/text-document").TextDocument; 21var TextDocument = require("js/io/document/text-document").TextDocument;
23 22
24var DocumentController = exports.DocumentController = Montage.create(Component, { 23var DocumentController = exports.DocumentController = Montage.create(Component, {
25 hasTemplate: { value: false }, 24 hasTemplate: {
25 value: false
26 },
27
28 _documents: {
29 value: []
30 },
26 31
27 _documents: { value: [] },
28 _documentsHash: { value: {} },
29 _activeDocument: { value: null }, 32 _activeDocument: { value: null },
30 _iframeCounter: { value: 1, enumerable: false }, 33 _iframeCounter: { value: 1, enumerable: false },
31 _iframeHolder: { value: null, enumerable: false }, 34 _iframeHolder: { value: null, enumerable: false },
32 _textHolder: { value: null, enumerable: false }, 35 _textHolder: { value: null, enumerable: false },
33 _codeMirrorCounter: {value: 1, enumerable: false}, 36 _codeMirrorCounter: {value: 1, enumerable: false},
34 37
38 tmpSourceForTesting: {
39 value: "function CodeMirror(place, givenOptions) {" +
40 "// Determine effective options based on given values and defaults." +
41 "var options = {}, defaults = CodeMirror.defaults; }"
42 },
43
35 _codeEditor: { 44 _codeEditor: {
36 value: { 45 value: {
37 "editor": { 46 "editor": {
@@ -50,33 +59,21 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
50 return this._activeDocument; 59 return this._activeDocument;
51 }, 60 },
52 set: function(doc) { 61 set: function(doc) {
53 if(this._activeDocument) { 62 if(this._activeDocument) this._activeDocument.isActive = false;
54 if(this.activeDocument.documentType === "htm" || this.activeDocument.documentType === "html") {
55 // TODO selection should use the document own selectionModel
56 //this._activeDocument.selectionModel = selectionManagerModule.selectionManager._selectedItems;
57 }
58
59 this._activeDocument.isActive = false;
60 }
61 63
62 if(this._documents.indexOf(doc) === -1) { 64 if(this._documents.indexOf(doc) === -1) this._documents.push(doc);
63 //this._documentsHash[doc.uuid] = this._documents.push(doc) - 1;
64 this._documents.push(doc);
65 }
66 65
67 this._activeDocument = doc; 66 this._activeDocument = doc;
68 this._activeDocument.isActive = true; 67 this._activeDocument.isActive = true;
69 68
70 if(this.activeDocument.documentType === "htm" || this.activeDocument.documentType === "html") {
71 // TODO selection should use the document own selectionModel
72 //selectionManagerModule.selectionManager._selectedItems = this._activeDocument.selectionModel;
73 }
74 } 69 }
75 }, 70 },
76 71
77 deserializedFromTemplate: { 72 deserializedFromTemplate: {
78 value: function() { 73 value: function() {
79 this.eventManager.addEventListener("appLoaded", this, false); 74 this.eventManager.addEventListener("appLoaded", this, false);
75
76 this.eventManager.addEventListener("executeFileOpen", this, false);
80 } 77 }
81 }, 78 },
82 79
@@ -86,28 +83,126 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
86 } 83 }
87 }, 84 },
88 85
86 handleExecuteFileOpen: {
87 value: function(event) {
88 var pickerSettings = event._event.settings || {};
89 pickerSettings.callback = this.openFileWithURI;
90 pickerSettings.callbackScope = this;
91 this.application.ninja.filePickerController.showFilePicker(pickerSettings);
92
93 //this.openDocument({"type": "js", "source": this.tmpSourceForTesting});
94 }
95 },
96
97 openFileWithURI: {
98 value: function(uriArrayObj) {
99 var uri = "", fileContent = "", response=null;
100 if(!!uriArrayObj && !!uriArrayObj.uri && (uriArrayObj.uri.length > 0)){
101 uri = uriArrayObj.uri[0];
102 }
103 console.log("URI is: ", uri);
104
105 // Get file from Jose Code with a callback to here
106 if(!!uri){
107 response = fileSystem.shellApiHandler.openFile({"uri":uri});
108 if((response.success === true) && ((response.status === 200) || (response.status === 304))){
109 fileContent = response.content;
110 }
111
112 console.log("$$$ "+uri+"\n content = \n\n\n"+ fileContent+"\n\n\n");
113 this.openDocument({"type": "js", "name": "tmp.js", "source": fileContent});
114 }
115
116 }
117 },
118
119 openProjectWithURI: {
120 value: function(uri) {
121 console.log("URI is: ", uri);
122
123 // Get project from Jose Code with a callback to here
124 }
125 },
126
89 /** Open a Document **/ 127 /** Open a Document **/
90 openDocument: { 128 openDocument: {
91 value: function(doc) { 129 value: function(doc) {
92 var d; 130 var newDoc;
93 131
94 if(!doc) return false; 132 if(!doc) return false;
95 133
96 try { 134 // try {
97 if (doc.type === 'html' || doc.type === 'htm') { 135 if (doc.type === 'html' || doc.type === 'htm') {
98 d = Montage.create(HTMLDocument); 136 newDoc = Montage.create(HTMLDocument);
99 d.initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument); 137 newDoc.initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument);
100 } else { 138 } else {
101 d = Montage.create(TextDocument); 139 newDoc = Montage.create(TextDocument,