diff options
Diffstat (limited to 'js/io/ui')
8 files changed, 181 insertions, 46 deletions
diff --git a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js index 651fd7fa..46e8b386 100755 --- a/js/io/ui/file-picker/file-input-field.reel/file-input-field.js +++ b/js/io/ui/file-picker/file-input-field.reel/file-input-field.js | |||
@@ -20,6 +20,7 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { | |||
20 | this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false); | 20 | this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false); |
21 | 21 | ||
22 | this.newFileDirectory.addEventListener("keyup", function(evt){that.handleNewFileDirectoryOnkeyup(evt);}, false); | 22 | this.newFileDirectory.addEventListener("keyup", function(evt){that.handleNewFileDirectoryOnkeyup(evt);}, false); |
23 | this.newFileDirectory.addEventListener("paste", this, false); | ||
23 | } | 24 | } |
24 | }, | 25 | }, |
25 | 26 | ||
@@ -63,12 +64,21 @@ var FileInputField = exports.FileInputField = Montage.create(Component, { | |||
63 | } | 64 | } |
64 | }, | 65 | }, |
65 | 66 | ||
67 | handlePaste:{ | ||
68 | value:function(evt){ | ||
69 | evt.preventDefault(); | ||
70 | evt.target.value = evt.clipboardData.getData("Text"); | ||
71 | this.handleNewFileDirectoryOnkeyup(evt); | ||
72 | } | ||
73 | }, | ||
74 | |||
66 | handleNewFileDirectoryOnkeyup:{ | 75 | handleNewFileDirectoryOnkeyup:{ |
67 | value:function(evt){ | 76 | value:function(evt){ |
68 | if(this.newFileDirectory.value !== ""){ | 77 | if(this.newFileDirectory.value !== ""){ |
69 | var newFileDirectorySetEvent = document.createEvent("Events"); | 78 | var newFileDirectorySetEvent = document.createEvent("Events"); |
70 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); | 79 | newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); |
71 | newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; | 80 | newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; |
81 | newFileDirectorySetEvent.keyCode = evt.keyCode; | ||
72 | this.eventManager.dispatchEvent(newFileDirectorySetEvent); | 82 | this.eventManager.dispatchEvent(newFileDirectorySetEvent); |
73 | } | 83 | } |
74 | } | 84 | } |
diff --git a/js/io/ui/file-picker/file-picker-controller.js b/js/io/ui/file-picker/file-picker-controller.js index 3b19de83..436a50f3 100755 --- a/js/io/ui/file-picker/file-picker-controller.js +++ b/js/io/ui/file-picker/file-picker-controller.js | |||
@@ -23,6 +23,11 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
23 | } | 23 | } |
24 | }, | 24 | }, |
25 | 25 | ||
26 | pickerNavChoices:{ | ||
27 | enumerable: true, | ||
28 | value: null | ||
29 | }, | ||
30 | |||
26 | filePickerPopupType:{ | 31 | filePickerPopupType:{ |
27 | enumerable: false, | 32 | enumerable: false, |
28 | value: "filePicker" | 33 | value: "filePicker" |
@@ -104,7 +109,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
104 | aModel.topLevelDirectories = topLevelDirectories; | 109 | aModel.topLevelDirectories = topLevelDirectories; |
105 | 110 | ||
106 | if(!!topLevelDirectories && !!topLevelDirectories[0]){ | 111 | if(!!topLevelDirectories && !!topLevelDirectories[0]){ |
107 | aModel.currentRoot = topLevelDirectories[0].uri; | 112 | aModel.currentRoot = aModel.currentLogicalDrive = topLevelDirectories[0].uri; |
108 | } | 113 | } |
109 | 114 | ||
110 | //populate the last opened folder first, if none then populate default root | 115 | //populate the last opened folder first, if none then populate default root |
@@ -125,8 +130,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
125 | } | 130 | } |
126 | 131 | ||
127 | if(!!storedUri){ | 132 | if(!!storedUri){ |
128 | // This is depracated -- use decodeURI instead | ||
129 | //aModel.currentRoot = unescape(storedUri); | ||
130 | aModel.currentRoot = decodeURI(storedUri); | 133 | aModel.currentRoot = decodeURI(storedUri); |
131 | } | 134 | } |
132 | 135 | ||
@@ -149,7 +152,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require | |||
149 | writable:false, | 152 | writable:false, |
150 | enumerable:true, | 153 | enumerable:true, |
151 | value:function(callback, aModel){ | 154 | value:function(callback, aModel){ |
152 | var pickerNavChoices = Montage.create(pickerNavigatorReel); | 155 | var pickerNavChoices = this.pickerNavChoices = Montage.create(pickerNavigatorReel); |
153 | var initUri = aModel.currentRoot; | 156 | var initUri = aModel.currentRoot; |
154 | 157 | ||
155 | //remove extra / at the end | 158 | //remove extra / at the end |
diff --git a/js/io/ui/file-picker/file-picker-model.js b/js/io/ui/file-picker/file-picker-model.js index 09c3ae9c..c92ec586 100755 --- a/js/io/ui/file-picker/file-picker-model.js +++ b/js/io/ui/file-picker/file-picker-model.js | |||
@@ -73,6 +73,12 @@ exports.FilePickerModel = (require("montage/core/core").Montage).create(require( | |||
73 | value:"" | 73 | value:"" |
74 | }, | 74 | }, |
75 | 75 | ||
76 | currentLogicalDrive:{ | ||
77 | writable:true, | ||
78 | enumerable:true, | ||
79 | value:"" | ||
80 | }, | ||
81 | |||
76 | callback:{ | 82 | callback:{ |
77 | writable:true, | 83 | writable:true, |
78 | enumerable:true, | 84 | enumerable:true, |
diff --git a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js index 3d99ae4d..945b0301 100644 --- a/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js +++ b/js/io/ui/file-picker/picker-navigator.reel/picker-navigator.js | |||
@@ -258,12 +258,20 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { | |||
258 | this.element.addEventListener("refreshTreeSegment", function(evt){that.handlePickerNavRefreshTreeSegment(evt);}, false); | 258 | this.element.addEventListener("refreshTreeSegment", function(evt){that.handlePickerNavRefreshTreeSegment(evt);}, false); |
259 | this.resultsArea.addEventListener("click", function(evt){that.handleResultsAreaClick(evt);}, false); | 259 | this.resultsArea.addEventListener("click", function(evt){that.handleResultsAreaClick(evt);}, false); |
260 | this.element.addEventListener("click", function(evt){that.handlePickerNavClick(evt);}, false); | 260 | this.element.addEventListener("click", function(evt){that.handlePickerNavClick(evt);}, false); |
261 | |||
262 | this.okButton.addEventListener("click", function(evt){that.handleOkButtonAction(evt);}, false); | 261 | this.okButton.addEventListener("click", function(evt){that.handleOkButtonAction(evt);}, false); |
263 | this.cancelButton.addEventListener("click", function(evt){that.handleCancelButtonAction(evt);}, false); | 262 | this.cancelButton.addEventListener("click", function(evt){that.handleCancelButtonAction(evt);}, false); |
264 | 263 | ||
264 | this.element.addEventListener("keyup", function(evt){ | ||
265 | if(evt.keyCode == 27) { | ||
266 | if(that.application.ninja.filePickerController.pickerNavChoices !== null){ | ||
267 | that.handleCancelButtonAction(); | ||
268 | } | ||
269 | } | ||
270 | }, true); | ||
271 | |||
265 | //ready to show picker now | 272 | //ready to show picker now |
266 | this.element.style.visibility = "visible"; | 273 | this.element.style.visibility = "visible"; |
274 | this.element.focus(); | ||
267 | } | 275 | } |
268 | }, | 276 | }, |
269 | 277 | ||
@@ -346,6 +354,11 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { | |||
346 | var arr = []; | 354 | var arr = []; |
347 | var temp = new String(uri); | 355 | var temp = new String(uri); |
348 | while(temp.indexOf("/") != -1){ | 356 | while(temp.indexOf("/") != -1){ |
357 | |||
358 | if(""+temp === this.pickerModel.currentLogicalDrive){//stop at the logical drive | ||
359 | break; | ||
360 | } | ||
361 | |||
349 | temp = temp.substring(0, temp.lastIndexOf("/")); | 362 | temp = temp.substring(0, temp.lastIndexOf("/")); |
350 | 363 | ||
351 | //populate dropdown irrespective of validity | 364 | //populate dropdown irrespective of validity |
@@ -496,7 +509,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { | |||
496 | metadata = "Name: "+data.name; | 509 | metadata = "Name: "+data.name; |
497 | } | 510 | } |
498 | metadata = metadata + "<br />" + "Type: "+data.type; | 511 | metadata = metadata + "<br />" + "Type: "+data.type; |
499 | if(data.size){metadata = metadata + "<br />" + "Size: "+data.size;} | 512 | if(data.size){metadata = metadata + "<br />" + "Size: "+data.size+" bytes";} |
500 | if(data.creationDate){metadata = metadata + "<br />" + "Creation date: "+ this.formatTimestamp(data.creationDate);} | 513 | if(data.creationDate){metadata = metadata + "<br />" + "Creation date: "+ this.formatTimestamp(data.creationDate);} |
501 | if(data.modifiedDate){metadata = metadata + "<br />" + "Modified date: "+ this.formatTimestamp(data.modifiedDate);} | 514 | if(data.modifiedDate){metadata = metadata + "<br />" + "Modified date: "+ this.formatTimestamp(data.modifiedDate);} |
502 | } | 515 | } |
@@ -560,7 +573,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { | |||
560 | enumerable: true, | 573 | enumerable: true, |
561 | writable: false, | 574 | writable: false, |
562 | value : function(evt, dirObj){ | 575 | value : function(evt, dirObj){ |
563 | this.currentURI = dirObj.uri; | 576 | this.currentURI = this.pickerModel.currentLogicalDrive = dirObj.uri; |
564 | 577 | ||
565 | var status = this.pickerViews()[this.selectedPickerView].call(this, dirObj.uri);//dynamically calls the update function of the current picker view | 578 | var status = this.pickerViews()[this.selectedPickerView].call(this, dirObj.uri);//dynamically calls the update function of the current picker view |
566 | 579 | ||
@@ -1066,6 +1079,7 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { | |||
1066 | //clear memory - TODO:check for more memory leaks | 1079 | //clear memory - TODO:check for more memory leaks |
1067 | this.pickerModel = null; | 1080 | this.pickerModel = null; |
1068 | this.application.ninja.filePickerController._directoryContentCache = {}; | 1081 | this.application.ninja.filePickerController._directoryContentCache = {}; |
1082 | this.application.ninja.filePickerController.pickerNavChoices = null; | ||
1069 | //remove listeners | 1083 | //remove listeners |
1070 | this.element.removeEventListener("openFolder", this, false);//add icon double click event listener to reload iconList with new set of data | 1084 | this.element.removeEventListener("openFolder", this, false);//add icon double click event listener to reload iconList with new set of data |
1071 | this.element.removeEventListener("selectedItem", this, false);//for single selection only | 1085 | this.element.removeEventListener("selectedItem", this, false);//for single selection only |
diff --git a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js index 0e1e09a4..02579676 100755 --- a/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js +++ b/js/io/ui/new-file-dialog/new-file-location.reel/new-file-location.js | |||
@@ -23,6 +23,17 @@ var NewFileLocation = exports.NewFileLocation = Montage.create(Component, { | |||
23 | this.fileInputField.selectDirectory = true; |