aboutsummaryrefslogtreecommitdiff
path: root/js/io
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-01 23:31:36 -0800
committerJose Antonio Marquez2012-02-01 23:31:36 -0800
commit33e655cbbb0816340c5a2e5d5cc0a6b0c7d9f53c (patch)
tree0bc03653f9739ff09d1e14ddf061a147b9dc383d /js/io
parentb354ea65f7c53ce05aff6a204853e666f084950f (diff)
downloadninja-33e655cbbb0816340c5a2e5d5cc0a6b0c7d9f53c.tar.gz
File IO clean up and setting up
Cleaned up file IO templates and removed app-caching from Ninja since it would be needed. Setting up io-mediator to hook up to controller. Still need to address naming conventions and clean up more in the io directory.
Diffstat (limited to 'js/io')
-rwxr-xr-xjs/io/system/projectio.js70
-rw-r--r--js/io/templates/descriptor.json51
-rwxr-xr-xjs/io/templates/files/_bin/template.css0
-rwxr-xr-xjs/io/templates/files/_bin/template.html0
-rwxr-xr-xjs/io/templates/files/_bin/template.js0
-rwxr-xr-xjs/io/templates/files/_bin/template.json0
-rwxr-xr-xjs/io/templates/files/_bin/template.php0
-rwxr-xr-xjs/io/templates/files/_bin/template.pl0
-rwxr-xr-xjs/io/templates/files/_bin/template.py0
-rwxr-xr-xjs/io/templates/files/_bin/template.rb0
-rwxr-xr-xjs/io/templates/files/_bin/template.xml0
-rwxr-xr-xjs/io/templates/files/_bin/xml.txt0
12 files changed, 96 insertions, 25 deletions
diff --git a/js/io/system/projectio.js b/js/io/system/projectio.js
index 822fd385..ad4cf151 100755
--- a/js/io/system/projectio.js
+++ b/js/io/system/projectio.js
@@ -4,56 +4,76 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */ 5</copyright> */
6 6
7var FileIo = require("js/io/system/fileio").FileIo;
8//////////////////////////////////////////////////////////////////////// 7////////////////////////////////////////////////////////////////////////
9//Exporting as Project I/O 8//
10exports.ProjectIo = (require("montage/core/core").Montage).create(Object.prototype, { 9var Montage = require("montage/core/core").Montage,
10 FileIo = require("js/io/system/fileio").FileIo;
11////////////////////////////////////////////////////////////////////////
12//
13exports.ProjectIo = = Montage.create(Object.prototype, {
11 //////////////////////////////////////////////////////////////////// 14 ////////////////////////////////////////////////////////////////////
12 // 15 //
13 create: { 16 newProject: {
14 enumerable: false, 17 enumerable: false,
15 value: function () { 18 value: function () {
19 //Checking for API to be available
20 if (!this.application.ninja.coreIoApi.cloudAvailable()) {
21 //API not available, no IO action taken
22 return null;
23 }
24 //
16 } 25 }
17 }, 26 },
18 //////////////////////////////////////////////////////////////////// 27 ////////////////////////////////////////////////////////////////////
19 // 28 //
20 open: { 29 readProject: {
21 enumerable: false, 30 enumerable: false,
22 value: function(e) { 31 value: function(e) {
23 //TODO: Add functionality 32 //Checking for API to be available
24 console.log('ProjectIO: open'); 33 if (!this.application.ninja.coreIoApi.cloudAvailable()) {
34 //API not available, no IO action taken
35 return null;
36 }
37 //
25 } 38 }
26 }, 39 },
27 //////////////////////////////////////////////////////////////////// 40 ////////////////////////////////////////////////////////////////////
28 // 41 //
29 save: { 42 saveProject: {
30 enumerable: false, 43 enumerable: false,
31 value: function(type, id, components) { 44 value: function() {
32 // 45 //Checking for API to be available
33 var rObj; 46 if (!this.application.ninja.coreIoApi.cloudAvailable()) {
47 //API not available, no IO action taken
48 return null;
49 }
34 // 50 //
35 switch (type) { 51 }
36 case 'montageapp': 52 },
37 // 53 ////////////////////////////////////////////////////////////////////
38 var css = FileIo.save('css', id); 54 //
39 var html = FileIo.save('html', id, components); 55 copyProject: {
40 // 56 enumerable: false,
41 rObj = {html: html, css: css}; 57 value: function(e) {
42 break; 58 //Checking for API to be available
43 default: 59 if (!this.application.ninja.coreIoApi.cloudAvailable()) {
44 break; 60 //API not available, no IO action taken
61 return null;
45 } 62 }
46 // 63 //
47 return rObj;
48 } 64 }
49 }, 65 },
50 //////////////////////////////////////////////////////////////////// 66 ////////////////////////////////////////////////////////////////////
51 // 67 //
52 saveAs: { 68 infoProject: {
53 enumerable: false, 69 enumerable: false,
54 value: function(e) { 70 value: function(e) {
55 //TODO: Add functionality 71 //Checking for API to be available
56 console.log('ProjectIO: saveAs'); 72 if (!this.application.ninja.coreIoApi.cloudAvailable()) {
73 //API not available, no IO action taken
74 return null;
75 }
76 //
57 } 77 }
58 } 78 }
59 //////////////////////////////////////////////////////////////////// 79 ////////////////////////////////////////////////////////////////////
diff --git a/js/io/templates/descriptor.json b/js/io/templates/descriptor.json
new file mode 100644
index 00000000..3d8391c5
--- /dev/null
+++ b/js/io/templates/descriptor.json
@@ -0,0 +1,51 @@
1{
2 "categories":{
3 "children":["newFile"]
4 },
5 "newFile":{
6 "name":"Blank Template",
7 "uri":"/",
8 "type":"directory",
9 "children":["html", "js", "css", "json", "php", "pl", "py", "rb"]
10 },
11 "html":{
12 "name":"HTML",
13 "uri":"files/html.txt",
14 "type":"file"
15 },
16 "js":{
17 "name":"JavaScript",
18 "uri":"files/js.txt",
19 "type":"file"
20 },
21 "css":{
22 "name":"Cascading Style Sheets",
23 "uri":"files/css.txt",
24 "type":"file"
25 },
26 "json":{
27 "name":"JSON",
28 "uri":"files/json.txt",
29 "type":"file"
30 },
31 "php":{
32 "name":"PHP",
33 "uri":"files/php.txt",
34 "type":"file"
35 },
36 "pl":{
37 "name":"Perl",
38 "uri":"files/pl.txt",
39 "type":"file"
40 },
41 "py":{
42 "name":"Python",
43 "uri":"files/py.txt",
44 "type":"file"
45 },
46 "rb":{
47 "name":"Ruby",
48 "uri":"files/rb.txt",
49 "type":"file"
50 }
51} \ No newline at end of file
diff --git a/js/io/templates/files/_bin/template.css b/js/io/templates/files/_bin/template.css
deleted file mode 100755
index e69de29b..00000000
--- a/js/io/templates/files/_bin/template.css
+++ /dev/null
diff --git a/js/io/templates/files/_bin/template.html b/js/io/templates/files/_bin/template.html
deleted file mode 100755
index e69de29b..00000000
--- a/js/io/templates/files/_bin/template.html
+++ /dev/null
diff --git a/js/io/templates/files/_bin/template.js b/js/io/templates/files/_bin/template.js
deleted file mode 100755
index e69de29b..00000000
--- a/js/io/templates/files/_bin/template.js
+++ /dev/null
diff --git a/js/io/templates/files/_bin/template.json b/js/io/templates/files/_bin/template.json
deleted file mode 100755
index e69de29b..00000000
--- a/js/io/templates/files/_bin/template.json
+++ /dev/null
diff --git a/js/io/templates/files/_bin/template.php b/js/io/templates/files/_bin/template.php
deleted file mode 100755
index e69de29b..00000000
--- a/js/io/templates/files/_bin/template.php
+++ /dev/null
diff --git a/js/io/templates/files/_bin/template.pl b/js/io/templates/files/_bin/template.pl
deleted file mode 100755
index e69de29b..00000000
--- a/js/io/templates/files/_bin/template.pl
+++ /dev/null
diff --git a/js/io/templates/files/_bin/template.py b/js/io/templates/files/_bin/template.py
deleted file mode 100755
index e69de29b..00000000
--- a/js/io/templates/files/_bin/template.py
+++ /dev/null
diff --git a/js/io/templates/files/_bin/template.rb b/js/io/templates/files/_bin/template.rb
deleted file mode 100755
index e69de29b..00000000
--- a/js/io/templates/files/_bin/template.rb
+++ /dev/null
diff --git a/js/io/templates/files/_bin/template.xml b/js/io/templates/files/_bin/template.xml
deleted file mode 100755
index e69de29b..00000000
--- a/js/io/templates/files/_bin/template.xml
+++ /dev/null
diff --git a/js/io/templates/files/_bin/xml.txt b/js/io/templates/files/_bin/xml.txt
deleted file mode 100755
index e69de29b..00000000
--- a/js/io/templates/files/_bin/xml.txt
+++ /dev/null