aboutsummaryrefslogtreecommitdiff
path: root/js/io/system
diff options
context:
space:
mode:
authorAnanya Sen2012-02-17 14:26:56 -0800
committerAnanya Sen2012-02-17 14:26:56 -0800
commit2980816130a44cd478b2a9d6606e021efbcebd4a (patch)
tree762d98ba8852b858c03760f4b9bef294fae6486c /js/io/system
parent96178309ddcdb54c0c451b69ea6fb8cdf76fcf62 (diff)
parenta42c536c2b3209afc058eabd31167bd0aa6f71c8 (diff)
downloadninja-2980816130a44cd478b2a9d6606e021efbcebd4a.tar.gz
Merge branch 'refs/heads/FileIO-jose' into FileIO
Conflicts: css/ninja.css js/controllers/document-controller.js Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/io/system')
-rwxr-xr-xjs/io/system/coreioapi.js20
-rw-r--r--js/io/system/ninjalibrary.js27
-rw-r--r--js/io/system/ninjalibrary.json4
3 files changed, 29 insertions, 22 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index b8aa8890..2051da43 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -40,6 +40,7 @@ exports.CoreIoApi = Montage.create(Component, {
40 //////////////////////////////////////////////////////////// 40 ////////////////////////////////////////////////////////////
41 //Instance of ninja library 41 //Instance of ninja library
42 this.ninjaLibrary = NinjaLibrary; 42 this.ninjaLibrary = NinjaLibrary;
43 this.ninjaLibrary.coreApi = this;
43 //Getting reference of chrome file system API 44 //Getting reference of chrome file system API
44 this.chromeFileSystem = ChromeApi; 45 this.chromeFileSystem = ChromeApi;
45 //Sending size in MBs for file system storage 46 //Sending size in MBs for file system storage
@@ -62,6 +63,7 @@ exports.CoreIoApi = Montage.create(Component, {
62 this.chromeFileSystem.removeEventListener('ready', this, false); 63 this.chromeFileSystem.removeEventListener('ready', this, false);
63 //Listening for library to be copied event (builds list) 64 //Listening for library to be copied event (builds list)
64 this.chromeFileSystem.addEventListener('library', this, false); 65 this.chromeFileSystem.addEventListener('library', this, false);
66 //TODO: Add sync loading screen logic (Add screen here)
65 } 67 }
66 }, 68 },
67 //////////////////////////////////////////////////////////////////// 69 ////////////////////////////////////////////////////////////////////
@@ -86,23 +88,7 @@ exports.CoreIoApi = Montage.create(Component, {
86 console.log('Ninja Local Library: Ready'); 88 console.log('Ninja Local Library: Ready');
87 //Removing events 89 //Removing events
88 this.ninjaLibrary.removeEventListener('sync', this, false); 90 this.ninjaLibrary.removeEventListener('sync', this, false);
89 this.ninjaLibrary.coreApi = this; 91 //TODO: Add sync loading screen logic (Remove screen here)
90 //TODO: Add sync loading screen logic
91
92 //TODO: Remove test
93 //this.ninjaLibrary.copyLibToCloud('Users/kgq387/Desktop/Ninja Cloud/Disk', 'montage0.6.0');
94 //this.ninjaLibrary.deleteLibraries();
95 /*
96window.hack = function (name, type) {
97 this.application.ninja.ioMediator.fileNew('Users/kgq387/Desktop/Ninja Cloud/Disk/'+name+'.'+type, '/js/io/templates/files/'+type+'.txt', function (status) {console.log(status)});
98 }.bind(this);
99*/
100 /*
101window.hack = function (path) {
102 //
103 this.application.ninja.ioMediator.fileOpen('Users/kgq387/Desktop/Ninja Cloud/Disk/'+path, function (result) {console.log(result)});
104 }.bind(this);
105*/
106 } 92 }
107 }, 93 },
108 //////////////////////////////////////////////////////////////////// 94 ////////////////////////////////////////////////////////////////////
diff --git a/js/io/system/ninjalibrary.js b/js/io/system/ninjalibrary.js
index fc943323..960bdef9 100644
--- a/js/io/system/ninjalibrary.js
+++ b/js/io/system/ninjalibrary.js
@@ -51,6 +51,23 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
51 }, 51 },
52 //////////////////////////////////////////////////////////////////// 52 ////////////////////////////////////////////////////////////////////
53 // 53 //
54 _libs: {
55 enumerable: false,
56 value: null
57 },
58 ////////////////////////////////////////////////////////////////////
59 //
60 libs: {
61 enumerable: false,
62 get: function() {
63 return this._libs;
64 },
65 set: function(value) {
66 this._libs = value;
67 }
68 },
69 ////////////////////////////////////////////////////////////////////
70 //
54 _libsToSync: { 71 _libsToSync: {
55 enumerable: false, 72 enumerable: false,
56 value: 0 73 value: 0
@@ -67,14 +84,14 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
67 enumerable: false, 84 enumerable: false,
68 value: function (path, libName) { 85 value: function (path, libName) {
69 // 86 //
70 if(this.coreApi.directoryExists({uri: '/'+path+'/'+libName+'/'}).status === 404) { 87 if(this.coreApi.directoryExists({uri: path+libName}).status === 404) {
71 this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) { 88 this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) {
72 for (var i in contents) { 89 for (var i in contents) {
73 if (libName === contents[i].name) { 90 if (libName === contents[i].name) {
74 //Getting contents of library to be copied 91 //Getting contents of library to be copied
75 this.chromeApi.directoryContents(contents[i], function (lib) { 92 this.chromeApi.directoryContents(contents[i], function (lib) {
76 //Creating directory structure from subfolders 93 //Creating directory structure from subfolders
77 this.copyDirectoryToCloud(path, contents[i], '/'+path, function (status) {console.log(status)}); 94 this.copyDirectoryToCloud(path, contents[i], path, function (status) {console.log(status)});
78 }.bind(this)); 95 }.bind(this));
79 break; 96 break;
80 } 97 }
@@ -99,7 +116,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
99 dir = folder.name; 116 dir = folder.name;
100 } 117 }
101 // 118 //
102 if (!this.coreApi.createDirectory({uri: '/'+dir+'/'})) { 119 if (!this.coreApi.createDirectory({uri: dir})) {
103 //Error occured while creating folders 120 //Error occured while creating folders
104 return; 121 return;
105 } 122 }
@@ -128,6 +145,8 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
128 synchronize: { 145 synchronize: {
129 enumerable: true, 146 enumerable: true,
130 value: function(chromeLibs, chrome) { 147 value: function(chromeLibs, chrome) {
148 //TODO: Remove
149 window.wipeLibrary = this.deleteLibraries.bind(this);
131 // 150 //
132 this.chromeApi = chrome; 151 this.chromeApi = chrome;
133 // 152 //
@@ -140,6 +159,8 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
140 //Parsing json libraries 159 //Parsing json libraries
141 libs = JSON.parse(xhr.response); 160 libs = JSON.parse(xhr.response);
142 // 161 //
162 this.libs = libs.libraries;
163 //
143 if (chromeLibs.length > 0) { 164 if (chromeLibs.length > 0) {
144 // 165 //
145 for (i=0; chromeLibs[i]; i++) { 166 for (i=0; chromeLibs[i]; i++) {
diff --git a/js/io/system/ninjalibrary.json b/js/io/system/ninjalibrary.json
index 272cc2c7..a61c30d1 100644
--- a/js/io/system/ninjalibrary.json
+++ b/js/io/system/ninjalibrary.json
@@ -1,6 +1,6 @@
1{ 1{
2 "libraries": [ 2 "libraries": [
3 {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.6.0"}, 3 {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.6.0.0"},
4 {"name": "RDGE", "path": "/js/helper-classes/RDGE/rdge-compiled.js", "version": "0.6.0", "file": "rdge-compiled.js"} 4 {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.0.1"}
5 ] 5 ]
6} \ No newline at end of file 6} \ No newline at end of file