aboutsummaryrefslogtreecommitdiff
path: root/js/io
diff options
context:
space:
mode:
authorAnanya Sen2012-02-16 17:32:57 -0800
committerAnanya Sen2012-02-16 17:32:57 -0800
commit4641dbefb6e8cb41f1f3d7f4d070d50bcaed94be (patch)
tree6bddeaa15e7d7b2100f501fa3f3396cdf88d18d2 /js/io
parenta9c369c2e5d8f6fc8d936f7e1e6b84f693226ddf (diff)
downloadninja-4641dbefb6e8cb41f1f3d7f4d070d50bcaed94be.tar.gz
remove similar function from coreioapi.js
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/io')
-rwxr-xr-xjs/io/system/coreioapi.js31
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js21
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.js21
3 files changed, 38 insertions, 35 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index 507804fd..b8aa8890 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -1110,37 +1110,6 @@ window.hack = function (path) {
1110 } 1110 }
1111 return status; 1111 return status;
1112 } 1112 }
1113 },
1114
1115 ////////////////////////////////////////////////////////////////////
1116 /***
1117 * check if the file exists
1118 */
1119 checkFileExists:{
1120 value: function(fileName, folderUri, fileType){
1121 var uri = "", response=null, status=true;
1122
1123 //prepare absolute uri
1124 if(/[^/\\]$/g.test(folderUri)){
1125 folderUri = folderUri + "/";
1126 }
1127
1128 if(!!fileType && (fileName.lastIndexOf(fileType) !== (fileName.length - fileType.length))){
1129 fileName = fileName+fileType;
1130 }
1131
1132 uri = ""+folderUri+fileName;
1133
1134 response = this.fileExists({"uri":uri});
1135 if(!!response && response.success && (response.status === 204)){
1136 status = true;
1137 }else if(!!response && response.success && (response.status === 404)){
1138 status = false;
1139 }else{
1140 status = false;
1141 }
1142 return status;
1143 }
1144 } 1113 }
1145 //////////////////////////////////////////////////////////////////// 1114 ////////////////////////////////////////////////////////////////////
1146}); 1115});
diff --git a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
index f5ab0027..11b322fe 100644
--- a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
+++ b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js
@@ -386,8 +386,25 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
386 } 386 }
387 }, 387 },
388 checkFileExists:{ 388 checkFileExists:{
389 value: function(fileUri, folderUri, fileType){ 389 value: function(fileName, folderUri, fileType){
390 var status= this.application.ninja.coreIoApi.checkFileExists(fileUri, folderUri, fileType); 390 var uri = "", response=null, status=true;
391 //prepare absolute uri
392 if(/[^/\\]$/g.test(folderUri)){
393 folderUri = folderUri + "/";
394 }
395 if(!!fileType && (fileName.lastIndexOf(fileType) !== (fileName.length - fileType.length))){
396 fileName = fileName+fileType;
397 }
398 uri = ""+folderUri+fileName;
399 response= this.application.ninja.coreIoApi.fileExists({"uri":uri});
400 if(!!response && response.success && (response.status === 204)){
401 status = true;
402 }else if(!!response && response.success && (response.status === 404)){
403 status = false;
404 }else{
405 status = false;
406 }
407
391 if(status){ 408 if(status){
392 this.showError("! File already exists."); 409 this.showError("! File already exists.");
393 } 410 }
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 786ef5c9..55a09fa8 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
@@ -175,8 +175,25 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, {
175 } 175 }
176 }, 176 },
177 checkFileExists:{ 177 checkFileExists:{
178 value: function(fileUri, folderUri, fileType){ 178 value: function(fileName, folderUri, fileType){
179 var status= this.application.ninja.coreIoApi.checkFileExists(fileUri, folderUri, fileType); 179 var uri = "", response=null, status=true;
180 //prepare absolute uri
181 if(/[^/\\]$/g.test(folderUri)){
182 folderUri = folderUri + "/";
183 }
184 if(!!fileType && (fileName.lastIndexOf(fileType) !== (fileName.length - fileType.length))){
185 fileName = fileName+fileType;
186 }
187 uri = ""+folderUri+fileName;
188 response= this.application.ninja.coreIoApi.fileExists({"uri":uri});
189 if(!!response && response.success && (response.status === 204)){
190 status = true;
191 }else if(!!response && response.success && (response.status === 404)){
192 status = false;
193 }else{
194 status = false;
195 }
196
180 if(status){ 197 if(status){
181 this.showError("! File already exists."); 198 this.showError("! File already exists.");
182 } 199 }