aboutsummaryrefslogtreecommitdiff
path: root/js/io/ui/save-as-dialog.reel/save-as-dialog.js
diff options
context:
space:
mode:
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.js22
1 files changed, 19 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..1de2eaf1 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
7var Montage = require("montage/core/core").Montage, 7var 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
11var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { 10var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, {
12 11
@@ -163,7 +162,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, {
163 }, 162 },
164 isValidFileName:{ 163 isValidFileName:{
165 value: function(fileName){ 164 value: function(fileName){
166 var status = nj.isValidFileName(fileName); 165 var status = this.isValidFileName(fileName);
167 if(fileName !== ""){ 166 if(fileName !== ""){
168 if(!status){ 167 if(!status){
169 this.showError("! Invalid file name."); 168 this.showError("! Invalid file name.");
@@ -191,6 +190,23 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, {
191 this.okButton.setAttribute("disabled", "true"); 190 this.okButton.setAttribute("disabled", "true");
192 } 191 }
193 } 192 }
194 } 193 },
194
195 /***
196 * file name validation
197 */
198 isValidFileName:{
199 value: function(fileName){
200 var status = false;
201 if(fileName !== ""){
202 fileName = fileName.replace(/^\s+|\s+$/g,"");
203 status = !(/[/\\]/g.test(fileName));
204 if(status && navigator.userAgent.indexOf("Macintosh") != -1){//for Mac files beginning with . are hidden
205 status = !(/^\./g.test(fileName));
206 }
207 }
208 return status;
209 }
210 }
195 211
196}); \ No newline at end of file 212}); \ No newline at end of file