aboutsummaryrefslogtreecommitdiff
path: root/js/io/ui
diff options
context:
space:
mode:
Diffstat (limited to 'js/io/ui')
-rw-r--r--js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js24
-rw-r--r--js/io/ui/save-as-dialog.reel/save-as-dialog.js24
2 files changed, 40 insertions, 8 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
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 b20bed87..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
@@ -5,8 +5,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
5</copyright> */ 5</copyright> */
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= require("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