diff options
author | Jose Antonio Marquez Russo | 2012-02-18 19:40:43 -0800 |
---|---|---|
committer | Jose Antonio Marquez Russo | 2012-02-18 19:40:43 -0800 |
commit | c466bcf61351b50f678100ca14096f71a0a71bd0 (patch) | |
tree | 4ac283e0e7724e5ede21c1a1e97d121033578c72 /js/io/ui/save-as-dialog.reel | |
parent | e23708721a71ca4c71365f5f8e8ac7d6113926db (diff) | |
parent | 8fdce771bfcf662cf1acc16d45e4361ffd06c53e (diff) | |
download | ninja-c466bcf61351b50f678100ca14096f71a0a71bd0.tar.gz |
Merge pull request #10 from ananyasen/FileIO
FileIO branch pull request
Diffstat (limited to 'js/io/ui/save-as-dialog.reel')
-rw-r--r-- | js/io/ui/save-as-dialog.reel/save-as-dialog.html | 2 | ||||
-rw-r--r-- | js/io/ui/save-as-dialog.reel/save-as-dialog.js | 21 |
2 files changed, 20 insertions, 3 deletions
diff --git a/js/io/ui/save-as-dialog.reel/save-as-dialog.html b/js/io/ui/save-as-dialog.reel/save-as-dialog.html index 4f0d5779..374e3d48 100644 --- a/js/io/ui/save-as-dialog.reel/save-as-dialog.html +++ b/js/io/ui/save-as-dialog.reel/save-as-dialog.html | |||
@@ -11,7 +11,7 @@ | |||
11 | <script type="text/montage-serialization"> | 11 | <script type="text/montage-serialization"> |
12 | { | 12 | { |
13 | "fileInputField":{ | 13 | "fileInputField":{ |
14 | "module": "js/components/ui/FilePicker/file-input-field.reel", | 14 | "module": "js/io/ui/file-picker/file-input-field.reel", |
15 | "name": "FileInputField", | 15 | "name": "FileInputField", |
16 | "properties": { | 16 | "properties": { |
17 | "element": {"#": "fileInputField"} | 17 | "element": {"#": "fileInputField"} |
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 | } |