aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjs/io/system/coreioapi.js2
-rw-r--r--js/io/templates/descriptor.json16
-rw-r--r--js/mediators/io-mediator.js37
3 files changed, 43 insertions, 12 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index 0e721500..bdba5240 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -16,7 +16,7 @@ var Montage = require("montage/core/core").Montage,
16 Component = require("montage/ui/component").Component, 16 Component = require("montage/ui/component").Component,
17 Popup = require("js/components/popup.reel").Popup, 17 Popup = require("js/components/popup.reel").Popup,
18 CloudPopup = require("js/io/ui/cloudpopup.reel").CloudPopup, 18 CloudPopup = require("js/io/ui/cloudpopup.reel").CloudPopup,
19 ChromeApi = require("js/io/system/chromeapi").ChromeApi; 19 ChromeApi = require("js/io/system/chromeapi").ChromeApi,
20 NinjaLibrary = require("js/io/system/ninjalibrary").NinjaLibrary; 20 NinjaLibrary = require("js/io/system/ninjalibrary").NinjaLibrary;
21//////////////////////////////////////////////////////////////////////// 21////////////////////////////////////////////////////////////////////////
22//Exporting as Project I/O 22//Exporting as Project I/O
diff --git a/js/io/templates/descriptor.json b/js/io/templates/descriptor.json
index d8fb7da4..f28455fa 100644
--- a/js/io/templates/descriptor.json
+++ b/js/io/templates/descriptor.json
@@ -10,56 +10,56 @@
10 }, 10 },
11 "files/html.txt":{ 11 "files/html.txt":{
12 "name":"HTML", 12 "name":"HTML",
13 "uri":"files/html.txt", 13 "uri":"/js/io/templates/files/html.txt",
14 "type":"file", 14 "type":"file",
15 "fileExtension":".html", 15 "fileExtension":".html",
16 "children":["defaultTemplate"] 16 "children":["defaultTemplate"]
17 }, 17 },
18 "files/js.txt":{ 18 "files/js.txt":{
19 "name":"JavaScript", 19 "name":"JavaScript",
20 "uri":"files/js.txt", 20 "uri":"/js/io/templates/files/files/js.txt",
21 "type":"file", 21 "type":"file",
22 "fileExtension":".js", 22 "fileExtension":".js",
23 "children":["defaultTemplate"] 23 "children":["defaultTemplate"]
24 }, 24 },
25 "files/css.txt":{ 25 "files/css.txt":{
26 "name":"Cascading Style Sheets", 26 "name":"Cascading Style Sheets",
27 "uri":"files/css.txt", 27 "uri":"/js/io/templates/files/css.txt",
28 "type":"file", 28 "type":"file",
29 "fileExtension":".css", 29 "fileExtension":".css",
30 "children":["defaultTemplate"] 30 "children":["defaultTemplate"]
31 }, 31 },
32 "files/json.txt":{ 32 "files/json.txt":{
33 "name":"JSON", 33 "name":"JSON",
34 "uri":"files/json.txt", 34 "uri":"/js/io/templates/files/json.txt",
35 "type":"file", 35 "type":"file",
36 "fileExtension":".json", 36 "fileExtension":".json",
37 "children":["defaultTemplate"] 37 "children":["defaultTemplate"]
38 }, 38 },
39 "files/php.txt":{ 39 "files/php.txt":{
40 "name":"PHP", 40 "name":"PHP",
41 "uri":"files/php.txt", 41 "uri":"/js/io/templates/files/php.txt",
42 "type":"file", 42 "type":"file",
43 "fileExtension":".php", 43 "fileExtension":".php",
44 "children":["defaultTemplate"] 44 "children":["defaultTemplate"]
45 }, 45 },
46 "files/pl.txt":{ 46 "files/pl.txt":{
47 "name":"Perl", 47 "name":"Perl",
48 "uri":"files/pl.txt", 48 "uri":"/js/io/templates/files/pl.txt",
49 "type":"file", 49 "type":"file",
50 "fileExtension":".pl", 50 "fileExtension":".pl",
51 "children":["defaultTemplate"] 51 "children":["defaultTemplate"]
52 }, 52 },
53 "files/py.txt":{ 53 "files/py.txt":{
54 "name":"Python", 54 "name":"Python",
55 "uri":"files/py.txt", 55 "uri":"/js/io/templates/files/py.txt",
56 "type":"file", 56 "type":"file",
57 "fileExtension":".py", 57 "fileExtension":".py",
58 "children":["defaultTemplate"] 58 "children":["defaultTemplate"]
59 }, 59 },
60 "files/rb.txt":{ 60 "files/rb.txt":{
61 "name":"Ruby", 61 "name":"Ruby",
62 "uri":"files/rb.txt", 62 "uri":"/js/io/templates/files/rb.txt",
63 "type":"file", 63 "type":"file",
64 "fileExtension":".rb", 64 "fileExtension":".rb",
65 "children":["defaultTemplate"] 65 "children":["defaultTemplate"]
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index fbabd780..b6d0e598 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -7,21 +7,52 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
7//////////////////////////////////////////////////////////////////////// 7////////////////////////////////////////////////////////////////////////
8// 8//
9var Montage = require("montage/core/core").Montage, 9var Montage = require("montage/core/core").Montage,
10 Component = require("montage/ui/component").Component,
10 FileIo = require("js/io/system/fileio").FileIo, 11 FileIo = require("js/io/system/fileio").FileIo,
11 ProjectIo = require("js/io/system/projectio").ProjectIo; 12 ProjectIo = require("js/io/system/projectio").ProjectIo;
12//////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////
13// 14//
14exports.IoMediator = Montage.create(require("montage/ui/component").Component, { 15exports.IoMediator = Montage.create(Component, {
16 ////////////////////////////////////////////////////////////////////
17 //
18 deserializedFromTemplate: {
19 enumerable: false,
20 value: function () {
21 }
22 },
23 ////////////////////////////////////////////////////////////////////
24 //
25 fio: {
26 enumerable: false,
27 value: FileIo
28 },
15 //////////////////////////////////////////////////////////////////// 29 ////////////////////////////////////////////////////////////////////
16 // 30 //
17 fileNew: { 31 fileNew: {
18 enumerable: false, 32 enumerable: false,
19 value: function (file, template, callback) { 33 value: function (file, template, callback) {
20 // 34 //
35 var xhr = new XMLHttpRequest();
36 xhr.open("GET", template, false);
37 xhr.send();
38 if (xhr.readyState === 4) {
39 //
40 console.log(this.fio.newFile({uri: file, contents: xhr.response}));
41 } else {
42 //Error
43 }
44
45
46
47
48
49
21 50
22 51 //callback('win');
23 var returnObj = null; //like {"uri": "/gfdg/gdf/dfg.js", "success": true,...} 52 /*
53var returnObj = null; //like {"uri": "/gfdg/gdf/dfg.js", "success": true,...}
24 callback(returnObj); 54 callback(returnObj);
55*/
25 } 56 }
26 }, 57 },
27 //////////////////////////////////////////////////////////////////// 58 ////////////////////////////////////////////////////////////////////