aboutsummaryrefslogtreecommitdiff
path: root/js/io
diff options
context:
space:
mode:
authorEric Guzman2012-03-17 00:05:14 -0700
committerEric Guzman2012-03-17 00:05:14 -0700
commita3192d8bc0f8c0698265817c14dcd2284fd89d7d (patch)
tree497ac55f550ed52f9d73b464aafb2aa6cb5f5038 /js/io
parenta6a6f9bcc5ff92f5bb5e9275336dfaec2d8e8f4c (diff)
parent954f5a13e371febcb1c0fb8015c577ee51c23130 (diff)
downloadninja-a3192d8bc0f8c0698265817c14dcd2284fd89d7d.tar.gz
Merge branch 'refs/heads/master' into AddAnimationsLibrary
Conflicts: js/panels/presets/default-transition-presets.js
Diffstat (limited to 'js/io')
-rw-r--r--js/io/system/ninjalibrary.js10
-rw-r--r--js/io/system/ninjalibrary.json2
-rwxr-xr-xjs/io/ui/file-picker/file-picker-controller.js2
-rwxr-xr-xjs/io/ui/file-picker/file-picker-model.js6
-rw-r--r--js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js7
-rwxr-xr-xjs/io/ui/new-file-dialog/new-file-workflow-controller.js11
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.js4
7 files changed, 22 insertions, 20 deletions
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, {
82 // 82 //
83 copyLibToCloud: { 83 copyLibToCloud: {
84 enumerable: false, 84 enumerable: false,
85 value: function (path, libName) { 85 value: function (path, libName, callback) {
86 // 86 //
87 if(this.coreApi.directoryExists({uri: path+libName}).status === 404) { 87 if(this.coreApi.directoryExists({uri: path+libName}).status === 404) {
88 this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) { 88 this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) {
@@ -91,7 +91,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
91 //Getting contents of library to be copied 91 //Getting contents of library to be copied
92 this.chromeApi.directoryContents(contents[i], function (lib) { 92 this.chromeApi.directoryContents(contents[i], function (lib) {
93 //Creating directory structure from subfolders 93 //Creating directory structure from subfolders
94 this.copyDirectoryToCloud(path, contents[i], path, function (status) {console.log(status)}); 94 this.copyDirectoryToCloud(path, contents[i], path, callback);
95 }.bind(this)); 95 }.bind(this));
96 break; 96 break;
97 } 97 }
@@ -116,7 +116,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
116 dir = folder.name; 116 dir = folder.name;
117 } 117 }
118 // 118 //
119 if (!this.coreApi.createDirectory({uri: dir})) { 119 if (!this.coreApi.createDirectory({uri: dir.replace(/\/\//gi, '/')})) {
120 //Error occured while creating folders 120 //Error occured while creating folders
121 return; 121 return;
122 } 122 }
@@ -132,12 +132,14 @@ exports.NinjaLibrary = Montage.create(Object.prototype, {
132 this.chromeApi.fileContent(contents[i].fullPath, function (result) { 132 this.chromeApi.fileContent(contents[i].fullPath, function (result) {
133 // 133 //
134 //this.coreApi.createFile({uri: fileRoot+result.file.fullPath, contents: blob.getBlob(result.data.type), contentType: result.data.type}); 134 //this.coreApi.createFile({uri: fileRoot+result.file.fullPath, contents: blob.getBlob(result.data.type), contentType: result.data.type});
135 this.coreApi.createFile({uri: fileRoot+result.file.fullPath, contents: result.content}); 135 this.coreApi.createFile({uri: (fileRoot+result.file.fullPath).replace(/\/\//gi, '/'), contents: result.content});
136 }.bind(this)); 136 }.bind(this));
137 } 137 }
138 } 138 }
139 }.bind(this)); 139 }.bind(this));
140 } 140 }
141 //TODO Add logic for proper callback status(es)
142 if (callback) callback(true);
141 } 143 }
142 }, 144 },
143 //////////////////////////////////////////////////////////////////// 145 ////////////////////////////////////////////////////////////////////
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 @@
1{ 1{
2 "libraries": [ 2 "libraries": [
3 {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.6.0.0"}, 3 {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.6.0.0"},
4 {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.0.1"} 4 {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.1.0"}
5 ] 5 ]
6} \ No newline at end of file 6} \ 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
104 aModel.topLevelDirectories = topLevelDirectories; 104 aModel.topLevelDirectories = topLevelDirectories;
105 105
106 if(!!topLevelDirectories && !!topLevelDirectories[0]){ 106 if(!!topLevelDirectories && !!topLevelDirectories[0]){
107 aModel.currentRoot = topLevelDirectories[0].uri; 107 aModel.currentRoot = aModel.currentLogicalDrive = topLevelDirectories[0].uri;
108 } 108 }
109 109
110 //populate the last opened folder first, if none then populate default root 110 //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(
73 value:"" 73 value:""
74 }, 74 },
75 75
76 currentLogicalDrive:{
77 writable:true,
78 enumerable:true,
79 value:""
80 },
81
76 callback:{ 82 callback:{
77 writable:true, 83 writable:true,
78 enumerable:true, 84 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, {
346 var arr = []; 346 var arr = [];
347 var temp = new String(uri); 347 var temp = new String(uri);
348 while(temp.indexOf("/") != -1){ 348 while(temp.indexOf("/") != -1){
349
350 if(""+temp === this.pickerModel.currentLogicalDrive){//stop at the logical drive
351 break;
352 }
353
349 temp = temp.substring(0, temp.lastIndexOf("/")); 354 temp = temp.substring(0, temp.lastIndexOf("/"));
350 355
351 //populate dropdown irrespective of validity 356 //populate dropdown irrespective of validity
@@ -560,7 +565,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
560 enumerable: true, 565 enumerable: true,
561 writable: false, 566 writable: false,
562 value : function(evt, dirObj){ 567 value : function(evt, dirObj){
563 this.currentURI = dirObj.uri; 568 this.currentURI = this.pickerModel.currentLogicalDrive = dirObj.uri;
564 569
565 var status = this.pickerViews()[this.selectedPickerView].call(this, dirObj.uri);//dynamically calls the update function of the current picker view 570 var status = this.pickerViews()[this.selectedPickerView].call(this, dirObj.uri);//dynamically calls the update function of the current picker view
566 571
diff --git a/js/io/ui/new-file-dialog/new-file-workflow-controller.js b/js/io/ui/new-file-dialog/new-file-workflow-controller.js
index 901b61c7..d065ca35 100755
--- a/js/io/ui/new-file-dialog/new-file-workflow-controller.js
+++ b/js/io/ui/new-file-dialog/new-file-workflow-controller.js
@@ -70,21 +70,10 @@ var NewFileWorkflowController = exports.NewFileWorkflowController = Montage.cre
70 var fileName = data.fileName || "filename.txt"; 70 var fileName = data.fileName || "filename.txt";
71 var folderUri = data.folderUri || "/Documents"; 71 var folderUri = data.folderUri || "/Documents";
72 72
73 //render modal dialog
74 var saveAsDialogContainer = document.createElement("div");
75 saveAsDialogContainer.id = "saveAsDialog";
76
77 //elements needs to be on DOM to be drawn
78 document.getElementById('modalContainer').appendChild(saveAsDialogContainer);
79
80 var saveAsDialog = saveAsModule.SaveAsDialog.create(); 73 var saveAsDialog = saveAsModule.SaveAsDialog.create();
81 saveAsDialog.fileName = fileName; 74 saveAsDialog.fileName = fileName;
82 saveAsDialog.folderUri = folderUri; 75 saveAsDialog.folderUri = folderUri;
83 saveAsDialog.callback = data.callback; 76 saveAsDialog.callback = data.callback;
84 saveAsDialog.element = saveAsDialogContainer;
85
86 //remove after rendering and add in modal dialog
87 document.getElementById('modalContainer').removeChild(saveAsDialogContainer);
88 77
89 var popup = Popup.create(); 78 var popup = Popup.create();
90 popup.content = saveAsDialog; 79 popup.content = saveAsDialog;
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, {
111 handleOkButtonAction:{ 111 handleOkButtonAction:{
112 value: function(evt){ 112 value: function(evt){
113 var filename = this.fileName, 113 var filename = this.fileName,
114 newFileDirectory = this.newFileDirectory, 114 newFileDirectory = this.folderUri,
115 success = true; 115 success = true;
116 if(this.isValidFileName(this.fileName) && this.isValidUri(this.folderUri) && !this.checkFileExists(this.fileName, this.folderUri)){ 116 if(this.isValidFileName(this.fileName) && this.isValidUri(this.folderUri) && !this.checkFileExists(this.fileName, this.folderUri)){
117 try{ 117 try{
@@ -128,7 +128,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, {
128 } 128 }
129 }catch(e){ 129 }catch(e){
130 success = false; 130 success = false;
131 console.log("[ERROR] Failed to save: "+ this.fileName + " at "+ this.newFileDirectory); 131 console.log("[ERROR] Failed to save: "+ this.fileName + " at "+ newFileDirectory);
132 console.log(e.stack); 132 console.log(e.stack);
133 } 133 }
134 134