diff options
Diffstat (limited to 'js')
-rwxr-xr-x | js/io/system/coreioapi.js | 1 | ||||
-rwxr-xr-x | js/io/system/fileio.js | 22 | ||||
-rwxr-xr-x | js/io/system/filesystem.js | 715 | ||||
-rwxr-xr-x | js/io/system/projectio.js | 70 | ||||
-rw-r--r-- | js/io/templates/descriptor.json | 51 | ||||
-rwxr-xr-x | js/io/templates/files/_bin/template.css | 0 | ||||
-rwxr-xr-x | js/io/templates/files/_bin/template.html | 0 | ||||
-rwxr-xr-x | js/io/templates/files/_bin/template.js | 0 | ||||
-rwxr-xr-x | js/io/templates/files/_bin/template.json | 0 | ||||
-rwxr-xr-x | js/io/templates/files/_bin/template.php | 0 | ||||
-rwxr-xr-x | js/io/templates/files/_bin/template.pl | 0 | ||||
-rwxr-xr-x | js/io/templates/files/_bin/template.py | 0 | ||||
-rwxr-xr-x | js/io/templates/files/_bin/template.rb | 0 | ||||
-rwxr-xr-x | js/io/templates/files/_bin/template.xml | 0 | ||||
-rwxr-xr-x | js/io/templates/files/_bin/xml.txt | 0 | ||||
-rwxr-xr-x | js/io/ui/cloudpopup.reel/cloudpopup.html | 2 | ||||
-rwxr-xr-x | js/io/ui/cloudpopup.reel/cloudpopup.js | 15 | ||||
-rw-r--r-- | js/io/ui/cloudpopup.reel/css/cloudpopup.css | 13 | ||||
-rwxr-xr-x | js/io/ui/cloudpopup.reel/css/cloudpopup.scss | 1 | ||||
-rw-r--r-- | js/mediators/io-mediator.js | 27 |
20 files changed, 165 insertions, 752 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js index 7839acee..f4ab56b6 100755 --- a/js/io/system/coreioapi.js +++ b/js/io/system/coreioapi.js | |||
@@ -207,7 +207,6 @@ exports.CoreIoApi = Montage.create(Component, { | |||
207 | directoryServiceURL: { | 207 | directoryServiceURL: { |
208 | enumerable: false, | 208 | enumerable: false, |
209 | get: function() { | 209 | get: function() { |
210 | console.log(this); | ||
211 | return String(this.rootUrl+this._directoryServiceURL); | 210 | return String(this.rootUrl+this._directoryServiceURL); |
212 | }, | 211 | }, |
213 | set: function(value) { | 212 | set: function(value) { |
diff --git a/js/io/system/fileio.js b/js/io/system/fileio.js index ac5812e9..f40aa96b 100755 --- a/js/io/system/fileio.js +++ b/js/io/system/fileio.js | |||
@@ -11,7 +11,7 @@ NOTES: | |||
11 | empty file will be created. 'contents' should be a string to be saved | 11 | empty file will be created. 'contents' should be a string to be saved |
12 | as the file. 'contentType' is the mime type of the file. | 12 | as the file. 'contentType' is the mime type of the file. |
13 | 13 | ||
14 | coreIoApi: this.application.ninja.coreIoApi | 14 | Core API reference in NINJA: this.application.ninja.coreIoApi |
15 | 15 | ||
16 | //////////////////////////////////////////////////////////////////////// | 16 | //////////////////////////////////////////////////////////////////////// |
17 | ///////////////////////////////////////////////////////////////////// */ | 17 | ///////////////////////////////////////////////////////////////////// */ |
@@ -65,24 +65,44 @@ exports.FileIo = Montage.create(Object.prototype, { | |||
65 | readFile: { | 65 | readFile: { |
66 | enumerable: true, | 66 | enumerable: true, |
67 | value: function() { | 67 | value: function() { |
68 | //Checking for API to be available | ||
69 | if (!this.application.ninja.coreIoApi.cloudAvailable()) { | ||
70 | //API not available, no IO action taken | ||
71 | return null; | ||
72 | } | ||
68 | // | 73 | // |
69 | } | 74 | } |
70 | }, | 75 | }, |
71 | saveFile: { | 76 | saveFile: { |
72 | enumerable: true, | 77 | enumerable: true, |
73 | value: function() { | 78 | value: function() { |
79 | //Checking for API to be available | ||
80 | if (!this.application.ninja.coreIoApi.cloudAvailable()) { | ||
81 | //API not available, no IO action taken | ||
82 | return null; | ||
83 | } | ||
74 | // | 84 | // |
75 | } | 85 | } |
76 | }, | 86 | }, |
77 | copyFile: { | 87 | copyFile: { |
78 | enumerable: true, | 88 | enumerable: true, |
79 | value: function() { | 89 | value: function() { |
90 | //Checking for API to be available | ||
91 | if (!this.application.ninja.coreIoApi.cloudAvailable()) { | ||
92 | //API not available, no IO action taken | ||
93 | return null; | ||
94 | } | ||
80 | // | 95 | // |
81 | } | 96 | } |
82 | }, | 97 | }, |
83 | infoFile: { | 98 | infoFile: { |
84 | enumerable: true, | 99 | enumerable: true, |
85 | value: function() { | 100 | value: function() { |
101 | //Checking for API to be available | ||
102 | if (!this.application.ninja.coreIoApi.cloudAvailable()) { | ||
103 | //API not available, no IO action taken | ||
104 | return null; | ||
105 | } | ||
86 | // | 106 | // |
87 | } | 107 | } |
88 | } | 108 | } |
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> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No 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 | // | ||
9 | var 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 | ||
15 | exports.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 = ""; | ||