diff options
author | Ananya Sen | 2012-01-30 16:02:15 -0800 |
---|---|---|
committer | Ananya Sen | 2012-01-30 16:02:15 -0800 |
commit | 63bfd3bd4a3165d83893c67cd4e6442a4794c0fb (patch) | |
tree | 625ad71e46ed7976c75806ceaaa45197cf42ddc1 /js | |
parent | 1fd16ce7052853719ec27527157f38b2fc87b077 (diff) | |
parent | fcd9d2f2fd63c11160fcabdc8a554a1b2a81cc47 (diff) | |
download | ninja-63bfd3bd4a3165d83893c67cd4e6442a4794c0fb.tar.gz |
Merge branch 'refs/heads/IOWorkflow' into FileIO
Diffstat (limited to 'js')
-rwxr-xr-x | js/components/ui/FilePicker/file-picker-controller.js | 10 | ||||
-rw-r--r--[-rwxr-xr-x] | js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js | 11 | ||||
-rw-r--r--[-rwxr-xr-x] | js/components/ui/icon-list-basic/icon.reel/icon.css | 9 | ||||
-rw-r--r-- | js/io/utils/file-utils.js | 75 | ||||
-rw-r--r--[-rwxr-xr-x] | js/io/workflow/newFileDialog/new-file-options-navigator.reel/new-file-options-navigator.js | 41 | ||||
-rw-r--r--[-rwxr-xr-x] | js/io/workflow/save-as-dialog.reel/save-as-dialog.css | 6 | ||||
-rw-r--r--[-rwxr-xr-x] | js/io/workflow/save-as-dialog.reel/save-as-dialog.html | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | js/io/workflow/save-as-dialog.reel/save-as-dialog.js | 138 |
9 files changed, 216 insertions, 79 deletions
diff --git a/js/components/ui/FilePicker/file-picker-controller.js b/js/components/ui/FilePicker/file-picker-controller.js index f14857ac..635da3a2 100755 --- a/js/components/ui/FilePicker/file-picker-controller.js +++ b/js/components/ui/FilePicker/file-picker-controller.js | |||
@@ -8,7 +8,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
8 | var Montage = require("montage/core/core").Montage, | 8 | var Montage = require("montage/core/core").Montage, |
9 | pickerNavigatorReel = require("js/components/ui/FilePicker/pickerNavigator.reel").PickerNavigator, | 9 | pickerNavigatorReel = require("js/components/ui/FilePicker/pickerNavigator.reel").PickerNavigator, |
10 | filePickerModelModule = require("js/components/ui/FilePicker/file-picker-model"), | 10 | filePickerModelModule = require("js/components/ui/FilePicker/file-picker-model"), |
11 | fileSystem = require("js/io/system/filesystem").FileSystem, | 11 | fileSystem = require("js/io/system/coreioapi").CoreIoApi, |
12 | Popup = require("montage/ui/popup/popup.reel").Popup; | 12 | Popup = require("montage/ui/popup/popup.reel").Popup; |
13 | 13 | ||
14 | //singleton with functions to create a new file picker instance and utilities to format or filter the model data | 14 | //singleton with functions to create a new file picker instance and utilities to format or filter the model data |
@@ -101,7 +101,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
101 | var aModel = filePickerModelModule.FilePickerModel.create(); | 101 | var aModel = filePickerModelModule.FilePickerModel.create(); |
102 | 102 | ||
103 | var topLevelDirectories = null; | 103 | var topLevelDirectories = null; |
104 | var driveData = fileSystem.shellApiHandler.getDirectoryContents({uri:"", recursive:false, returnType:"all"}); | 104 | var driveData = fileSystem.getDirectoryContents({uri:"", recursive:false, returnType:"all"}); |
105 | if(driveData.success){ | 105 | if(driveData.success){ |
106 | topLevelDirectories = (JSON.parse(driveData.content)).children; | 106 | topLevelDirectories = (JSON.parse(driveData.content)).children; |
107 | }else{ | 107 | }else{ |
@@ -244,7 +244,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
244 | || !this._directoryContentCache[folderUri].children){ | 244 | || !this._directoryContentCache[folderUri].children){ |
245 | //get data using IO api | 245 | //get data using IO api |
246 | try{ | 246 | try{ |
247 | var iodata = fileSystem.shellApiHandler.getDirectoryContents({uri:folderUri, recursive:false, returnType:"all"}); | 247 | var iodata = fileSystem.getDirectoryContents({uri:folderUri, recursive:false, returnType:"all"}); |
248 | //console.log("IO:getDirectoryContents:Response:\n"+"uri="+folderUri+"\n status="+iodata.status+"\n content= "+iodata.content); | 248 | //console.log("IO:getDirectoryContents:Response:\n"+"uri="+folderUri+"\n status="+iodata.status+"\n content= "+iodata.content); |
249 | if(iodata.success && (iodata.status === 200) && (iodata.content !== null)){ | 249 | if(iodata.success && (iodata.status === 200) && (iodata.content !== null)){ |
250 | folderContent = JSON.parse(iodata.content); | 250 | folderContent = JSON.parse(iodata.content); |
@@ -456,7 +456,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
456 | //check for directory staleness.... if stale query filesystem | 456 | //check for directory staleness.... if stale query filesystem |
457 | if((new Date()).getTime() > (this._directoryContentCache[folderUri].queriedTimeStamp + this.cacheStaleTime)){ | 457 | if((new Date()).getTime() > (this._directoryContentCache[folderUri].queriedTimeStamp + this.cacheStaleTime)){ |
458 | try{ | 458 | try{ |
459 | var ifModifiedResponse = fileSystem.shellApiHandler.isDirectoryModified({uri:folderUri, recursive:false, returnType:"all"}, this._directoryContentCache[folderUri].queriedTimeStamp); | 459 | var ifModifiedResponse = fileSystem.isDirectoryModified({uri:folderUri, recursive:false, returnType:"all"}, this._directoryContentCache[folderUri].queriedTimeStamp); |
460 | //console.log("ifModifiedResponse"); | 460 | //console.log("ifModifiedResponse"); |
461 | //console.log(ifModifiedResponse); | 461 | //console.log(ifModifiedResponse); |
462 | }catch(e){ | 462 | }catch(e){ |
@@ -468,7 +468,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
468 | wasStale = true; | 468 | wasStale = true; |
469 | //uri has changed. so update cache | 469 | //uri has changed. so update cache |
470 | try{ | 470 | try{ |
471 | var iodata = fileSystem.shellApiHandler.getDirectoryContents({uri:folderUri, recursive:false, returnType:"all"}); | 471 | var iodata = fileSystem.getDirectoryContents({uri:folderUri, recursive:false, returnType:"all"}); |
472 | //console.log("IO:getDirectoryContents:Response:\n"+"uri="+folderUri+"\n status="+iodata.status+"\n content= "+iodata.content); | 472 | //console.log("IO:getDirectoryContents:Response:\n"+"uri="+folderUri+"\n status="+iodata.status+"\n content= "+iodata.content); |
473 | if(iodata.success && (iodata.status === 200) && (iodata.content !== null)){ | 473 | if(iodata.success && (iodata.status === 200) && (iodata.content !== null)){ |
474 | folderContent = JSON.parse(iodata.content); | 474 | folderContent = JSON.parse(iodata.content); |
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..0afdffc6 --- /dev/null +++ b/js/io/utils/file-utils.js | |||
@@ -0,0 +1,75 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No 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 | |||
7 | var fileSystem = require("js/io/system/coreioapi").CoreIoApi; | ||
8 | |||
9 | var 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 | |||