From e065244ac75d1d0f25fd5c75cb58e714a13fe16b Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Wed, 14 Mar 2012 08:59:17 -0700 Subject: Squashed commit of the following: merge master into timeline Signed-off-by: Jonathan Duran --- js/io/system/ninjalibrary.js | 10 ++++++---- js/io/system/ninjalibrary.json | 2 +- js/io/ui/file-picker/file-picker-controller.js | 2 +- js/io/ui/file-picker/file-picker-model.js | 6 ++++++ js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js | 7 ++++++- js/io/ui/save-as-dialog.reel/save-as-dialog.js | 4 ++-- 6 files changed, 22 insertions(+), 9 deletions(-) (limited to 'js/io') diff --git a/js/io/system/ninjalibrary.js b/js/io/system/ninjalibrary.js index 960bdef9..201598fc 100644 --- a/js/io/system/ninjalibrary.js +++ b/js/io/system/ninjalibrary.js @@ -82,7 +82,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { // copyLibToCloud: { enumerable: false, - value: function (path, libName) { + value: function (path, libName, callback) { // if(this.coreApi.directoryExists({uri: path+libName}).status === 404) { this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) { @@ -91,7 +91,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { //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, callback); }.bind(this)); break; } @@ -116,7 +116,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { dir = folder.name; } // - if (!this.coreApi.createDirectory({uri: dir})) { + if (!this.coreApi.createDirectory({uri: dir.replace(/\/\//gi, '/')})) { //Error occured while creating folders return; } @@ -132,12 +132,14 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { this.chromeApi.fileContent(contents[i].fullPath, function (result) { // //this.coreApi.createFile({uri: fileRoot+result.file.fullPath, contents: blob.getBlob(result.data.type), contentType: result.data.type}); - this.coreApi.createFile({uri: fileRoot+result.file.fullPath, contents: result.content}); + this.coreApi.createFile({uri: (fileRoot+result.file.fullPath).replace(/\/\//gi, '/'), contents: result.content}); }.bind(this)); } } }.bind(this)); } + //TODO Add logic for proper callback status(es) + if (callback) callback(true); } }, //////////////////////////////////////////////////////////////////// diff --git a/js/io/system/ninjalibrary.json b/js/io/system/ninjalibrary.json index a61c30d1..00ee7ed2 100644 --- a/js/io/system/ninjalibrary.json +++ b/js/io/system/ninjalibrary.json @@ -1,6 +1,6 @@ { "libraries": [ {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.6.0.0"}, - {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.0.1"} + {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.1.0"} ] } \ No newline at end of file diff --git a/js/io/ui/file-picker/file-picker-controller.js b/js/io/ui/file-picker/file-picker-controller.js index 3b19de83..105dc223 100755 --- a/js/io/ui/file-picker/file-picker-controller.js +++ b/js/io/ui/file-picker/file-picker-controller.js @@ -104,7 +104,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require aModel.topLevelDirectories = topLevelDirectories; if(!!topLevelDirectories && !!topLevelDirectories[0]){ - aModel.currentRoot = topLevelDirectories[0].uri; + aModel.currentRoot = aModel.currentLogicalDrive = topLevelDirectories[0].uri; } //populate the last opened folder first, if none then populate default root diff --git a/js/io/ui/file-picker/file-picker-model.js b/js/io/ui/file-picker/file-picker-model.js index 09c3ae9c..c92ec586 100755 --- a/js/io/ui/file-picker/file-picker-model.js +++ b/js/io/ui/file-picker/file-picker-model.js @@ -73,6 +73,12 @@ exports.FilePickerModel = (require("montage/core/core").Montage).create(require( value:"" }, + currentLogicalDrive:{ + writable:true, + enumerable:true, + value:"" + }, + callback:{ writable:true, enumerable:true, diff --git a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js index 3d99ae4d..7a9d90b4 100644 --- a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js +++ b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js @@ -346,6 +346,11 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { var arr = []; var temp = new String(uri); while(temp.indexOf("/") != -1){ + + if(""+temp === this.pickerModel.currentLogicalDrive){//stop at the logical drive + break; + } + temp = temp.substring(0, temp.lastIndexOf("/")); //populate dropdown irrespective of validity @@ -560,7 +565,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { enumerable: true, writable: false, value : function(evt, dirObj){ - this.currentURI = dirObj.uri; + this.currentURI = this.pickerModel.currentLogicalDrive = dirObj.uri; var status = this.pickerViews()[this.selectedPickerView].call(this, dirObj.uri);//dynamically calls the update function of the current picker view diff --git a/js/io/ui/save-as-dialog.reel/save-as-dialog.js b/js/io/ui/save-as-dialog.reel/save-as-dialog.js index 0a322b99..c60a92f9 100644 --- a/js/io/ui/save-as-dialog.reel/save-as-dialog.js +++ b/js/io/ui/save-as-dialog.reel/save-as-dialog.js @@ -111,7 +111,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { handleOkButtonAction:{ value: function(evt){ var filename = this.fileName, - newFileDirectory = this.newFileDirectory, + newFileDirectory = this.folderUri, success = true; if(this.isValidFileName(this.fileName) && this.isValidUri(this.folderUri) && !this.checkFileExists(this.fileName, this.folderUri)){ try{ @@ -128,7 +128,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { } }catch(e){ success = false; - console.log("[ERROR] Failed to save: "+ this.fileName + " at "+ this.newFileDirectory); + console.log("[ERROR] Failed to save: "+ this.fileName + " at "+ newFileDirectory); console.log(e.stack); } -- cgit v1.2.3