aboutsummaryrefslogtreecommitdiff
path: root/js/io/ui/new-file-dialog/new-file-options-navigator.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/io/ui/new-file-dialog/new-file-options-navigator.reel')
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js24
1 files changed, 20 insertions, 4 deletions
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 467c5452..f17b15d5 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
@@ -8,8 +8,7 @@ var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component, 8 Component = require("montage/ui/component").Component,
9 iconsListModule = require("js/components/ui/icon-list-basic/iconsList.reel"), 9 iconsListModule = require("js/components/ui/icon-list-basic/iconsList.reel"),
10 treeModule = require("js/components/ui/tree-basic/tree.reel"), 10 treeModule = require("js/components/ui/tree-basic/tree.reel"),
11 newFileLocationSelectionModule = require("js/io/ui/new-file-dialog/new-file-workflow-controller"), 11 newFileLocationSelectionModule = require("js/io/ui/new-file-dialog/new-file-workflow-controller");
12 nj= require("js/lib/NJUtils.js").NJUtils;
13 12
14var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(Component, { 13var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(Component, {
15 14
@@ -364,7 +363,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
364 }, 363 },
365 isValidFileName:{ 364 isValidFileName:{
366 value: function(fileName){ 365 value: function(fileName){
367 var status = nj.isValidFileName(fileName); 366 var status = this.isValidFileName(fileName);
368 if(fileName !== ""){ 367 if(fileName !== ""){
369 if(!status){ 368 if(!status){
370 this.showError("! Invalid file name."); 369 this.showError("! Invalid file name.");
@@ -391,6 +390,23 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
391 this.okButton.setAttribute("disabled", "true"); 390 this.okButton.setAttribute("disabled", "true");
392 } 391 }
393 } 392 }
394 } 393 },
394
395 /***
396 * file name validation
397 */
398 isValidFileName:{
399 value: function(fileName){
400 var status = false;
401 if(fileName !== ""){
402 fileName = fileName.replace(/^\s+|\s+$/g,"");
403 status = !(/[/\\]/g.test(fileName));
404 if(status && navigator.userAgent.indexOf("Macintosh") != -1){//for Mac files beginning with . are hidden
405 status = !(/^\./g.test(fileName));
406 }
407 }
408 return status;
409 }
410 }
395 411
396}); \ No newline at end of file 412}); \ No newline at end of file