aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAnanya Sen2012-01-30 14:18:21 -0800
committerAnanya Sen2012-01-30 14:18:21 -0800
commit92161460a6cbbdebfd1b0263ec6eb790091920a9 (patch)
tree48136ac734f6e46d902b720387ac5693ed29ee8d /js
parent9c46c73141259ab4478935033cb4d8dda43f6bf2 (diff)
downloadninja-92161460a6cbbdebfd1b0263ec6eb790091920a9.tar.gz
Moving changes from Gerrit, on 1/27, to the github branch:
- added file existence check and validation to save as dialog - minor css fix for file picker, new file dialog Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js')
-rw-r--r--[-rwxr-xr-x]js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css1
-rw-r--r--[-rwxr-xr-x]js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js11
-rw-r--r--[-rwxr-xr-x]js/components/ui/icon-list-basic/icon.reel/icon.css9
-rw-r--r--js/io/utils/file-utils.js75
-rw-r--r--[-rwxr-xr-x]js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js41
-rw-r--r--[-rwxr-xr-x]js/io/workflow/save-as-dialog.reel/save-as-dialog.css6
-rw-r--r--[-rwxr-xr-x]js/io/workflow/save-as-dialog.reel/save-as-dialog.html4
-rw-r--r--[-rwxr-xr-x]js/io/workflow/save-as-dialog.reel/save-as-dialog.js138
8 files changed, 211 insertions, 74 deletions
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css
index 61328ce0..93578ec1 100755..100644
--- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css
+++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css
@@ -63,6 +63,7 @@
63 63
64.picker .driversList:hover{ 64.picker .driversList:hover{
65 cursor:pointer; 65 cursor:pointer;
66 background-color: #444444;
66} 67}
67 68
68.picker .highlighted{ 69.picker .highlighted{
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
index eec7c8e8..268ec41a 100755..100644
--- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
+++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
@@ -621,6 +621,16 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
621 this.currentSelectedNode = evt.target; 621 this.currentSelectedNode = evt.target;
622 622
623 }else{ 623 }else{
624
625
626 //test: highlight non-selectable icons too
627 if(!evt.target.classList.contains("selected")){
628 evt.target.classList.add("selected");
629 }
630 this.currentSelectedNode = evt.target;
631 //end- test
632
633
624 //disable OK 634 //disable OK
625 if(!this.okButton.hasAttribute("disabled")){ 635 if(!this.okButton.hasAttribute("disabled")){
626 this.okButton.setAttribute("disabled", "true"); 636 this.okButton.setAttribute("disabled", "true");
@@ -776,6 +786,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
776 this.pickerModel.callback.call(this.pickerModel.callbackScope, {"uri":this.selectedItems}); 786 this.pickerModel.callback.call(this.pickerModel.callbackScope, {"uri":this.selectedItems});
777 }catch(e){ 787 }catch(e){
778 success = false; 788 success = false;
789 console.log("[Error] Failed to open "+ this.selectedItems.toString());
779 console.log(e.stack); 790 console.log(e.stack);
780 } 791 }
781 }else{//else send an event with the selected files 792 }else{//else send an event with the selected files
diff --git a/js/components/ui/icon-list-basic/icon.reel/icon.css b/js/components/ui/icon-list-basic/icon.reel/icon.css
index ca591aff..4d71f6b8 100755..100644
--- a/js/components/ui/icon-list-basic/icon.reel/icon.css
+++ b/js/components/ui/icon-list-basic/icon.reel/icon.css
@@ -17,15 +17,18 @@
17} 17}
18 18
19.icon .selected{ 19.icon .selected{
20 /*background-color: #d1d1d1;*/
21 background-color: #919191; 20 background-color: #919191;
22} 21}
23 22
23/*highlight on hover*/
24.icon:hover{
25 background-color: #919191;
26}
27/*end- test*/
28
24.icon .iconImg{ 29.icon .iconImg{
25 width:35px; 30 width:35px;
26 height:35px; 31 height:35px;
27 /*border: 1px solid #000000;
28 box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.8);*/
29 margin-left: 20px; 32 margin-left: 20px;
30 margin-top: 10px; 33 margin-top: 10px;
31} 34}
diff --git a/js/io/utils/file-utils.js b/js/io/utils/file-utils.js
new file mode 100644
index 00000000..c43fb41c
--- /dev/null
+++ b/js/io/utils/file-utils.js
@@ -0,0 +1,75 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7var fileSystem = require("js/io/system/filesystem").FileSystem;
8
9var FileUtils = exports.FileUtils = Object.create(Object.prototype, {
10
11 /***
12 * checks for valid uri pattern
13 * also flags if Windows uri pattern and Unix uri patterns are mixed
14 */
15 isValidUri:{
16 value: function(uri){
17 var isWindowsUri=false, isUnixUri=false,status=false;
18 if(uri !== ""){
19 uri = uri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces
20
21 //for local machine folder uri
22 isWindowsUri = /^([a-zA-Z]:)(\\[^<>:"/\\|?*]+)*\\?$/gi.test(uri);
23 isUnixUri = /^(\/)?(\/(?![.])[^/]*)*\/?$/gi.test(uri);//folders beginning with . are hidden on Mac / Unix
24 status = isWindowsUri || isUnixUri;
25 if(isWindowsUri && isUnixUri){status = false;}
26 }
27 return status;
28 }
29 },
30
31 /***
32 * file name validation
33 */
34 isValidFileName:{
35 value: function(fileName){
36 var status = false;
37 if(fileName !== ""){
38 fileName = fileName.replace(/^\s+|\s+$/g,"");
39 status = !(/[/\\]/g.test(fileName));
40 if(status && navigator.userAgent.indexOf("Macintosh") != -1){//for Mac files beginning with . are hidden
41 status = !(/^\./g.test(fileName));
42 }
43 }
44 return status;
45 }
46 },
47
48 /***
49 * check if the file exists
50 */
51 checkFileExists:{
52 value: function(fileUri, folderUri, fileType){
53 var uri = "", response=null, status=true;
54
55 //prepare absolute uri
56 if(/[^/\\]$/g.test(folderUri)){
57 folderUri = folderUri + "/";
58 }
59
60 //todo:add file extension check if fileType present
61
62 uri = ""+folderUri+fileUri;
63
64 response = fileSystem.shellApiHandler.fileExists({"uri":uri});
65 if(!!response && response.success && (response.status === 204)){
66 status = true;
67 }else if(!!response && response.success && (response.status === 404)){
68 status = false;
69 }else{
70 status = false;
71 }
72 return status;
73 }
74 }
75}); \ No newline at end of file
diff --git a/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js b/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js
index 61b963b3..7702b1a2 100755..100644
--- a/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js
+++ b/js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js
@@ -9,7 +9,7 @@ var Montage = require("montage/core/core").Montage,
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/workflow/newFileDialog/new-file-workflow-controller"), 11 newFileLocationSelectionModule = require("js/io/workflow/newFileDialog/new-file-workflow-controller"),
12 fileSystem = require("js/io/system/filesystem").FileSystem; 12 fileUtils = require("js/io/utils/file-utils").FileUtils;
13 13
14var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(Component, { 14var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(Component, {
15 15
@@ -244,7 +244,6 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
244 this.okButton.setAttribute("disabled", "true"); 244 this.okButton.setAttribute("disabled", "true");
245 } 245 }
246 } 246 }
247
248 } 247 }
249 }, 248 },
250 249
@@ -336,16 +335,8 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C
336 335
337 isValidUri:{ 336 isValidUri:{
338 value: function(uri){ 337 value: function(uri){
339 var isWindowsUri=false, isUnixUri=false,status=false; 338 var status= fileUtils.isValidUri(uri);
340 if(uri !== ""){ 339 if(uri !== ""){
341 uri = uri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces
342
343 //for local machine folder uri
344 isWindowsUri = /^([a-zA-Z]:)(\\[^<>:"/\\|?*]+)*\\?$/gi.test(uri);
345 isUnixUri = /^(\/)?(\/(?![.])[^/]*)*\/?$/gi.test(uri);//folders beginning with . are hidden on Mac / Unix
346 status = isWindowsUri || isUnixUri;
347 if(isWindowsUri && isUnixUri){status = false;}
348
349 if(!status){ 340 if(!status){
350