diff options
Diffstat (limited to 'js/io/ui/save-as-dialog.reel/save-as-dialog.js')
-rw-r--r-- | js/io/ui/save-as-dialog.reel/save-as-dialog.js | 25 |
1 files changed, 22 insertions, 3 deletions
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 de5266a5..d1f1c26b 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 | |||
@@ -6,7 +6,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
6 | 6 | ||
7 | var Montage = require("montage/core/core").Montage, | 7 | var Montage = require("montage/core/core").Montage, |
8 | Component = require("montage/ui/component").Component; | 8 | Component = require("montage/ui/component").Component; |
9 | //nj= ("js/lib/NJUtils.js").NJUtils; | ||
10 | 9 | ||
11 | var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | 10 | var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { |
12 | 11 | ||
@@ -58,6 +57,9 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
58 | this.newFileName.addEventListener("blur", function(evt){self.handleNewFileNameOnblur(evt);}, false); | 57 | this.newFileName.addEventListener("blur", function(evt){self.handleNewFileNameOnblur(evt);}, false); |
59 | this.eventManager.addEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false); | 58 | this.eventManager.addEventListener("newFileDirectorySet", function(evt){self.handleNewFileDirectorySet(evt);}, false); |
60 | 59 | ||
60 | this.okButton.addEventListener("click", function(evt){self.handleOkButtonAction(evt);}, false); | ||
61 | this.cancelButton.addEventListener("click", function(evt){self.handleCancelButtonAction(evt);}, false); | ||
62 | |||
61 | this.enableOk(); | 63 | this.enableOk(); |
62 | } | 64 | } |
63 | }, | 65 | }, |
@@ -163,7 +165,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
163 | }, | 165 | }, |
164 | isValidFileName:{ | 166 | isValidFileName:{ |
165 | value: function(fileName){ | 167 | value: function(fileName){ |
166 | var status = nj.isValidFileName(fileName); | 168 | var status = this.isValidFileName(fileName); |
167 | if(fileName !== ""){ | 169 | if(fileName !== ""){ |
168 | if(!status){ | 170 | if(!status){ |
169 | this.showError("! Invalid file name."); | 171 | this.showError("! Invalid file name."); |
@@ -191,6 +193,23 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
191 | this.okButton.setAttribute("disabled", "true"); | 193 | this.okButton.setAttribute("disabled", "true"); |
192 | } | 194 | } |
193 | } | 195 | } |
194 | } | 196 | }, |
197 | |||
198 | /*** | ||
199 | * file name validation | ||
200 | */ | ||
201 | isValidFileName:{ | ||
202 | value: function(fileName){ | ||
203 | var status = false; | ||
204 | if(fileName !== ""){ | ||
205 | fileName = fileName.replace(/^\s+|\s+$/g,""); | ||
206 | status = !(/[/\\]/g.test(fileName)); | ||
207 | if(status && navigator.userAgent.indexOf("Macintosh") != -1){//for Mac files beginning with . are hidden | ||
208 | status = !(/^\./g.test(fileName)); | ||
209 | } | ||
210 | } | ||
211 | return status; | ||
212 | } | ||
213 | } | ||
195 | 214 | ||
196 | }); \ No newline at end of file | 215 | }); \ No newline at end of file |