aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-01 13:31:35 -0800
committerJose Antonio Marquez2012-02-01 13:31:35 -0800
commit54ccd309722797e79ca35fe115b0372e86850551 (patch)
tree097e82c393a5c1d7d45cc207d114b225a2557459
parentfb5d5994b8d729ce6233549844817d2b7043d8a5 (diff)
downloadninja-54ccd309722797e79ca35fe115b0372e86850551.tar.gz
Removing filesytem class, no longer used
Also cleaning up cloud popup IU.
-rwxr-xr-xjs/io/system/filesystem.js715
-rwxr-xr-xjs/io/ui/cloudpopup.reel/cloudpopup.html2
-rw-r--r--js/io/ui/cloudpopup.reel/css/cloudpopup.css13
-rwxr-xr-xjs/io/ui/cloudpopup.reel/css/cloudpopup.scss1
4 files changed, 7 insertions, 724 deletions
<
diff --git a/js/io/system/filesystem.js b/js/io/system/filesystem.js
deleted file mode 100755
index cd158812..00000000
--- a/js/io/system/filesystem.js
+++ /dev/null
@@ -1,715 +0,0 @@
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 FileIo = require("js/io/system/fileio").FileIo,
11 ProjectIo = require("js/io/system/projectio").ProjectIo,
12 CoreIoApi = require("js/io/system/coreioapi").CoreIoApi;
13////////////////////////////////////////////////////////////////////////
14//Exporting as File System
15exports.FileSystem = Montage.create(Object.prototype, {
16 ////////////////////////////////////////////////////////////////////
17 //
18
19
20 shellApiHandler :{
21 enumerable:true,
22 writable:false,
23 value:CoreIoApi
24 },
25
26
27 ////////////////////////////////////////////////////////////////////
28 //
29 cloud: {
30 enumerable: false,
31 value: false
32 },
33 ////////////////////////////////////////////////////////////////////
34 //
35 cloud: {
36 enumerable: false,
37 get: function() {
38 return this._cloud;
39 },
40 set: function(value) {
41 this._cloud = value
42 }
43 },
44
45
46
47
48
49
50 ////////////////////////////////////////////////////////////////////
51 //
52 _documentType: {
53 enumerable: false,
54 value: function () {
55 //return DocumentManagerModule.DocumentManager.activeDocument.documentType; // this._documentType()
56 }
57 },
58
59
60
61 ////////////////////////////////////////////////////////////////////
62 //
63 newFile: {
64 enumerable: false,
65 value: function (template) {
66 //Checking for cloud (to be added later)
67 if (this.cloud) {
68 //TODO: Add cloud integration
69 console.log("[CLOUD] New File");
70 //documentManagerModule.DocumentManager.openDocument({"type": "html"});
71 } else {
72 //
73 var file = {uri: CoreIoApi.openShellDialog({type: 'file', action: 'new'})}, type;
74 var check = CoreIoApi.fileExists(file);
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89 //TODO: implement createFile to avoid duplicate funtionality
90 if (check.success) {
91 switch (check.status) {
92 case 204:
93 //TODO: Add logic for already existing file
94 window.alert('Error Code 204: File already exists.');
95 break;
96 case 404:
97 //File does not exists, ready to be created
98
99
100 //TODO: The type (template) should be sent into this routine via the UI of file I/O (not by file extension as now)
101 if (template) {
102 type = template;
103 } else {
104 type = file.uri.split('.');
105 type = type[type.length-1];
106 }
107 //
108
109
110 //TODO: Improve logic
111 //Checking for file to exist in files template folder
112 var templateCheck = CoreIoApi.fileExists({uri: window.NativeShellApp.GetKnownFolder('appsource')+'\\document-templates\\files\\template.'+type}), content;
113 //
114 if (templateCheck.success) {
115 switch (check.status) {
116 case 204:
117 //Template exists, so opening and getting contents to be used when creating file
118 content = CoreIoApi.openFile({uri: 'template.'+type});
119 if (content.content) {
120 file.content = content.content;
121 } else {
122 file.content = "";
123 }
124 break;
125 case 404:
126 //No template
127 file.content = "";
128 break;
129 case 500:
130 //Error
131 break;
132 default:
133 //Error
134 break;
135 }
136 } else {
137
138 }
139
140
141 /*
142switch (type.toLowerCase()) {
143 case 'html':
144 break;
145 case 'css':
146 break;
147 case 'js':
148 break;
149 case 'xml':
150 break;
151 case 'json':
152 break;
153 default:
154 break;
155 }
156*/
157
158
159
160
161
162
163
164 var create = CoreIoApi.createFile(file);
165 if (create.success) {
166 switch (create.status) {
167 case 201:
168 //File was created, opening created file
169 this.openFile(file);
170 break;
171 case 400:
172 //TODO: Add error handling
173 //window.alert('Error Code 400: File already exists.');
174 break;
175 case 500:
176 //TODO: Add error handling
177 //window.alert('Error Code 500: An error occurred while creating a new file.');
178 break;
179 default:
180 //TODO: Add error handling
181 //window.alert('Unknown Error: An error occurred while creating a new file.');
182 break;
183 }
184 } else {
185 //window.alert('Unknown Error: An error occurred while creating a new file.');
186 }
187
188
189
190
191
192
193
194
195
196
197
198
199 break;
200 case 500:
201 //TODO: Add error handling
202 //window.alert('Error Code 500: An error occurred while creating a new file.');
203 break;
204 default:
205 //TODO: Add error handling
206 //window.alert('Unknown Error: An error occurred while creating a new file.');
207 break;
208 }
209 } else {
210 //TODO: Add error handling
211 //window.alert('Unknown Error: An error occurred while creating a new file.');
212 }
213 }
214
215 }
216 },
217
218
219
220
221