aboutsummaryrefslogtreecommitdiff
path: root/js/components/ui/FilePicker/pickerNavigator.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/components/ui/FilePicker/pickerNavigator.reel')
-rw-r--r--js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css31
-rwxr-xr-x[-rw-r--r--]js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html7
-rw-r--r--js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js110
3 files changed, 94 insertions, 54 deletions
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css
index 2d9f1189..93578ec1 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{
@@ -195,6 +196,36 @@
195 196
196.picker .okButton{ 197.picker .okButton{
197 margin-right:25px; 198 margin-right:25px;
199 -webkit-box-align: center;
200 text-align: center;
201 cursor: default;
202 padding: 0px 6px 0px;
203 border:2px solid #d1d1d1;
204 background-color: #e1e1e1;
205 box-sizing: border-box;
206 border-radius:10px;
207 background-image: -webkit-linear-gradient(bottom, #e1e1e1 13%, #d1d1d1 58%, #e1e1e1 40%);
208 cursor:pointer;
209}
210
211.picker .cancelButton{
212 -webkit-box-align: center;
213 text-align: center;
214 cursor: default;
215 padding: 0px 6px 0px;
216 border:2px solid #d1d1d1;
217 background-color: #e1e1e1;
218 box-sizing: border-box;
219 border-radius:10px;
220 background-image: -webkit-linear-gradient(bottom, #e1e1e1 13%, #d1d1d1 58%, #e1e1e1 40%);
221 cursor:pointer;
222}
223
224.picker input[type="button"]:disabled{
225 background-color: #a1a1a1;
226 border:2px solid #a1a1a1;
227 background-image:none;
228 cursor:auto;
198} 229}
199 230
200 231
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html
index bf421247..bd427f97 100644..100755
--- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html
+++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html
@@ -10,7 +10,6 @@
10 <link rel="stylesheet" type="text/css" href="pickerNavigator.css"> 10 <link rel="stylesheet" type="text/css" href="pickerNavigator.css">
11 <script type="text/montage-serialization"> 11 <script type="text/montage-serialization">
12 { 12 {
13
14 "owner":{ 13 "owner":{
15 "module": "js/components/ui/FilePicker/pickerNavigator.reel", 14 "module": "js/components/ui/FilePicker/pickerNavigator.reel",
16 "name":"PickerNavigator", 15 "name":"PickerNavigator",
@@ -68,10 +67,10 @@
68 <div id="right-bottom" class="right-bottom"></div> 67 <div id="right-bottom" class="right-bottom"></div>
69 </div> 68 </div>
70 <div class="buttons"> 69 <div class="buttons">
71 <input id="cancelButton" type="button" value="CANCEL" class="cancelButton" /> 70 <input id="cancelButton" type="button" value="CANCEL" class="cancelButton nj-skinned" />
72 <input id="okButton" disabled="true" type="button" value="OK" class="okButton" /> 71 <input id="okButton" disabled="true" type="button" value="OK" class="okButton nj-skinned" />
73 </div> 72 </div>
74 <div id="filters" class="filters"> 73 <div id="filters" class="filters" style="display:block;">
75 <div class="dropdown hide"></div> 74 <div class="dropdown hide"></div>
76 <span class="dropdownArrow">&#9660</span> 75 <span class="dropdownArrow">&#9660</span>
77 <span id="filterVal" class="filterVal">*.*</span> 76 <span id="filterVal" class="filterVal">*.*</span>
diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
index 299d44f5..ff9c7073 100644
--- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
+++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js
@@ -7,7 +7,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
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 iconsListModule = require("js/components/ui/icon-list-basic/iconsList.reel"), 9 iconsListModule = require("js/components/ui/icon-list-basic/iconsList.reel"),
10 filePickerControllerModule = require("js/components/ui/FilePicker/file-picker-controller"),
11 treeModule = require("js/components/ui/tree-basic/tree.reel"); 10 treeModule = require("js/components/ui/tree-basic/tree.reel");
12 11
13var PickerNavigator = exports.PickerNavigator = Montage.create(Component, { 12var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
@@ -209,26 +208,27 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
209 this.refreshButton.addEventListener("click", this, false);//refresh - gets from file system directly 208 this.refreshButton.addEventListener("click", this, false);//refresh - gets from file system directly
210 this.backArrow.addEventListener("click", this, false); 209 this.backArrow.addEventListener("click", this, false);
211 this.forwardArrow.addEventListener("click", this, false); 210 this.forwardArrow.addEventListener("click", this, false);
212 this.okButton.addEventListener("click", this, false);
213 this.cancelButton.addEventListener("click", this, false);
214
215 //populate filters
216 var filtersDD = this.element.querySelector(".filters .dropdown");
217 if(!!this.pickerModel.fileFilters
218 && (typeof this.pickerModel.fileFilters === "object")
219 && ('splice' in this.pickerModel.fileFilters)
220 && ('join' in this.pickerModel.fileFilters)){
221 this.pickerModel.fileFilters.forEach(function(aFilter){
222 var newDiv = document.createElement("div");
223 newDiv.innerHTML = aFilter;
224 filtersDD.appendChild(newDiv);
225 newDiv.addEventListener("click", function(evt){that.handleFilterClick(evt, aFilter, filtersDD)}, false);
226 }, this);
227 }
228 211
229 var renderedWidth = this.getComputedWidth(filtersDD); 212 //populate filters if in file selection mode
230 this.filters.style.width = "" + (parseInt((renderedWidth.substring(0, (renderedWidth.length - 2)))) + 20) + "px"; 213 if(this.pickerModel.inFileMode === true){
214 var filtersDD = this.element.querySelector(".filters .dropdown");
215 if(!!this.pickerModel.fileFilters
216 && (typeof this.pickerModel.fileFilters === "object")
217 && ('splice' in this.pickerModel.fileFilters)
218 && ('join' in this.pickerModel.fileFilters)){
219 this.pickerModel.fileFilters.forEach(function(aFilter){
220 var newDiv = document.createElement("div");
221 newDiv.innerHTML = aFilter;
222 filtersDD.appendChild(newDiv);
223 newDiv.addEventListener("click", function(evt){that.handleFilterClick(evt, aFilter, filtersDD)}, false);
224 }, this);
225 }
231 226
227 var renderedWidth = this.getComputedWidth(filtersDD);
228 this.filters.style.width = "" + (parseInt((renderedWidth.substring(0, (renderedWidth.length - 2)))) + 20) + "px";
229 }else{
230 this.filters.style.display = "none";
231 }
232 /** 232 /**
233 * attach click event listeners to the addressbar dropdown arrows 233 * attach click event listeners to the addressbar dropdown arrows
234 */ 234 */
@@ -244,6 +244,9 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
244 this.resultsArea.addEventListener("click", function(evt){that.handleResultsAreaClick(evt);}, false); 244 this.resultsArea.addEventListener("click", function(evt){that.handleResultsAreaClick(evt);}, false);
245 this.element.addEventListener("click", function(evt){that.handlePickerNavClick(evt);}, false); 245 this.element.addEventListener("click", function(evt){that.handlePickerNavClick(evt);}, false);
246 246
247 this.okButton.addEventListener("click", function(evt){that.handleOkButtonAction(evt);}, false);
248 this.cancelButton.addEventListener("click", function(evt){that.handleCancelButtonAction(evt);}, false);
249
247 //ready to show picker now 250 //ready to show picker now
248 this.element.style.visibility = "visible"; 251 this.element.style.visibility = "visible";
249 } 252 }
@@ -263,11 +266,11 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
263 } 266 }
264 }, 267 },
265 268
266 //TODO: add uri pattern validation 269 cleanupUri:{
267 validateUri:{
268 writable: false, 270 writable: false,
269 enumerable:true, 271 enumerable:true,
270 value: function(folderUri){ 272 value: function(folderUri){
273 folderUri = folderUri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces
271 //remove unnecessary / from end - for Win and Mac .... don't trim for the root 274 //remove unnecessary / from end - for Win and Mac .... don't trim for the root
272 if(((folderUri.charAt(folderUri.length - 1) === "/") || (folderUri.charAt(folderUri.length - 1) === "\\")) && (folderUri !== "/")){ 275 if(((folderUri.charAt(folderUri.length - 1) === "/") || (folderUri.charAt(folderUri.length - 1) === "\\")) && (folderUri !== "/")){
273 folderUri = folderUri.substring(0, (folderUri.length - 1)); 276 folderUri = folderUri.substring(0, (folderUri.length - 1));
@@ -324,14 +327,14 @@ var PickerNavigator = exports.PickerNavigator = Montage.create(Component, {
324 writable:false, 327 writable:false,
325 enumerable:true, 328 enumerable:true,
326 value:function(uri){ 329 value:function(uri){
327 uri = this.validateUri(uri); 330 uri = this.cleanupUri(uri);
328 var arr = []; 331 var arr = [];
329 var temp = new String(uri); 332 var temp = new String(uri);
330 while(temp.indexOf("/") != -1){ 333 while(temp.indexOf("/") != -1){
331 temp = temp.substring(0, temp.lastIndexOf("/")); 334 temp = temp.substring(0, temp.lastIndexOf("/"));
332 335
333 //populate dropdown irrespective of validity 336 //populate dropdown irrespective of validity
334// if(!!filePickerControllerModule.FilePickerController._directoryContentCache[temp]){//check