From 3a754133dbc138390503341fd2e9beba3e43aa4b Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Fri, 27 Jan 2012 12:05:17 -0800 Subject: Merged old FileIO --- js/lib/NJUtils.js | 0 js/lib/nj-base.js | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 js/lib/NJUtils.js mode change 100644 => 100755 js/lib/nj-base.js (limited to 'js/lib') diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js old mode 100644 new mode 100755 diff --git a/js/lib/nj-base.js b/js/lib/nj-base.js old mode 100644 new mode 100755 -- cgit v1.2.3 From 553fce7721cacfd13b6013fdcdd0243c90083b5e Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 1 Feb 2012 11:59:11 -0800 Subject: fixed reference to coreioapi cleaning up opening code view tabs Signed-off-by: Ananya Sen --- js/lib/NJUtils.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/lib') diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js index d6548871..56c74b3b 100755 --- a/js/lib/NJUtils.js +++ b/js/lib/NJUtils.js @@ -206,6 +206,8 @@ exports.NJUtils = Object.create(Object.prototype, { ///// Return the last part of a path (e.g. filename) getFileNameFromPath : { value: function(path) { + path = path.replace(/[/\\]$/g,""); + path = path.replace(/\\/g,"/"); return path.substr(path.lastIndexOf('/') + 1); } } -- cgit v1.2.3 From 0e595c4e11ce9b44eff157de8616ed15fcd5d6fc Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 2 Feb 2012 12:37:29 -0800 Subject: refactoring some file names and locations, change made to maintain only one codemirror div. Signed-off-by: Ananya Sen --- js/lib/NJUtils.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'js/lib') diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js index 56c74b3b..960c832f 100755 --- a/js/lib/NJUtils.js +++ b/js/lib/NJUtils.js @@ -210,6 +210,43 @@ exports.NJUtils = Object.create(Object.prototype, { path = path.replace(/\\/g,"/"); return path.substr(path.lastIndexOf('/') + 1); } + }, + + /*** + * checks for valid uri pattern + * also flags if Windows uri pattern and Unix uri patterns are mixed + */ + isValidUri:{ + value: function(uri){ + var isWindowsUri=false, isUnixUri=false,status=false; + if(uri !== ""){ + uri = uri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces + + //for local machine folder uri + isWindowsUri = /^([a-zA-Z]:)(\\[^<>:"/\\|?*]+)*\\?$/gi.test(uri); + isUnixUri = /^(\/)?(\/(?![.])[^/]*)*\/?$/gi.test(uri);//folders beginning with . are hidden on Mac / Unix + status = isWindowsUri || isUnixUri; + if(isWindowsUri && isUnixUri){status = false;} + } + return status; + } + }, + + /*** + * file name validation + */ + isValidFileName:{ + value: function(fileName){ + var status = false; + if(fileName !== ""){ + fileName = fileName.replace(/^\s+|\s+$/g,""); + status = !(/[/\\]/g.test(fileName)); + if(status && navigator.userAgent.indexOf("Macintosh") != -1){//for Mac files beginning with . are hidden + status = !(/^\./g.test(fileName)); + } + } + return status; + } } }); -- cgit v1.2.3 From 476a25e8a662270dfe5b37c560e4235f02b146e4 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 2 Feb 2012 12:59:41 -0800 Subject: uri validation moved to file io apis Signed-off-by: Ananya Sen --- js/lib/NJUtils.js | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'js/lib') diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js index 960c832f..74039e64 100755 --- a/js/lib/NJUtils.js +++ b/js/lib/NJUtils.js @@ -211,27 +211,6 @@ exports.NJUtils = Object.create(Object.prototype, { return path.substr(path.lastIndexOf('/') + 1); } }, - - /*** - * checks for valid uri pattern - * also flags if Windows uri pattern and Unix uri patterns are mixed - */ - isValidUri:{ - value: function(uri){ - var isWindowsUri=false, isUnixUri=false,status=false; - if(uri !== ""){ - uri = uri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces - - //for local machine folder uri - isWindowsUri = /^([a-zA-Z]:)(\\[^<>:"/\\|?*]+)*\\?$/gi.test(uri); - isUnixUri = /^(\/)?(\/(?![.])[^/]*)*\/?$/gi.test(uri);//folders beginning with . are hidden on Mac / Unix - status = isWindowsUri || isUnixUri; - if(isWindowsUri && isUnixUri){status = false;} - } - return status; - } - }, - /*** * file name validation */ -- cgit v1.2.3