From 075252ad893452df446566f01d0b26eeab08be3d Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 15 Feb 2012 23:07:00 -0800 Subject: Setting up webGL library copy on save --- js/io/system/coreioapi.js | 20 +++----------------- js/io/system/ninjalibrary.js | 25 ++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 20 deletions(-) (limited to 'js/io') diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js index 507804fd..a75b59bb 100755 --- a/js/io/system/coreioapi.js +++ b/js/io/system/coreioapi.js @@ -40,6 +40,7 @@ exports.CoreIoApi = Montage.create(Component, { //////////////////////////////////////////////////////////// //Instance of ninja library this.ninjaLibrary = NinjaLibrary; + this.ninjaLibrary.coreApi = this; //Getting reference of chrome file system API this.chromeFileSystem = ChromeApi; //Sending size in MBs for file system storage @@ -62,6 +63,7 @@ exports.CoreIoApi = Montage.create(Component, { this.chromeFileSystem.removeEventListener('ready', this, false); //Listening for library to be copied event (builds list) this.chromeFileSystem.addEventListener('library', this, false); + //TODO: Add sync loading screen logic (Add screen here) } }, //////////////////////////////////////////////////////////////////// @@ -86,23 +88,7 @@ exports.CoreIoApi = Montage.create(Component, { console.log('Ninja Local Library: Ready'); //Removing events this.ninjaLibrary.removeEventListener('sync', this, false); - this.ninjaLibrary.coreApi = this; - //TODO: Add sync loading screen logic - - //TODO: Remove test - //this.ninjaLibrary.copyLibToCloud('Users/kgq387/Desktop/Ninja Cloud/Disk', 'montage0.6.0'); - //this.ninjaLibrary.deleteLibraries(); - /* -window.hack = function (name, type) { - this.application.ninja.ioMediator.fileNew('Users/kgq387/Desktop/Ninja Cloud/Disk/'+name+'.'+type, '/js/io/templates/files/'+type+'.txt', function (status) {console.log(status)}); - }.bind(this); -*/ - /* -window.hack = function (path) { - // - this.application.ninja.ioMediator.fileOpen('Users/kgq387/Desktop/Ninja Cloud/Disk/'+path, function (result) {console.log(result)}); - }.bind(this); -*/ + //TODO: Add sync loading screen logic (Remove screen here) } }, //////////////////////////////////////////////////////////////////// diff --git a/js/io/system/ninjalibrary.js b/js/io/system/ninjalibrary.js index fc943323..8c58883a 100644 --- a/js/io/system/ninjalibrary.js +++ b/js/io/system/ninjalibrary.js @@ -51,6 +51,23 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { }, //////////////////////////////////////////////////////////////////// // + _libs: { + enumerable: false, + value: null + }, + //////////////////////////////////////////////////////////////////// + // + libs: { + enumerable: false, + get: function() { + return this._libs; + }, + set: function(value) { + this._libs = value; + } + }, + //////////////////////////////////////////////////////////////////// + // _libsToSync: { enumerable: false, value: 0 @@ -67,14 +84,14 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { enumerable: false, value: function (path, libName) { // - if(this.coreApi.directoryExists({uri: '/'+path+'/'+libName+'/'}).status === 404) { + if(this.coreApi.directoryExists({uri: path+libName}).status === 404) { this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) { for (var i in contents) { if (libName === contents[i].name) { //Getting contents of library to be copied this.chromeApi.directoryContents(contents[i], function (lib) { //Creating directory structure from subfolders - this.copyDirectoryToCloud(path, contents[i], '/'+path, function (status) {console.log(status)}); + this.copyDirectoryToCloud(path, contents[i], path, function (status) {console.log(status)}); }.bind(this)); break; } @@ -99,7 +116,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { dir = folder.name; } // - if (!this.coreApi.createDirectory({uri: '/'+dir+'/'})) { + if (!this.coreApi.createDirectory({uri: dir})) { //Error occured while creating folders return; } @@ -140,6 +157,8 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { //Parsing json libraries libs = JSON.parse(xhr.response); // + this.libs = libs.libraries; + // if (chromeLibs.length > 0) { // for (i=0; chromeLibs[i]; i++) { -- cgit v1.2.3