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 --- .../file-input-field.reel/file-input-field.css | 28 +++++ .../file-input-field.reel/file-input-field.html | 31 ++++++ .../file-input-field.reel/file-input-field.js | 121 +++++++++++++++++++++ .../ui/FilePicker/file-picker-controller.js | 106 ++++++++++-------- js/components/ui/FilePicker/file-picker-model.js | 6 + .../pickerNavigator.reel/pickerNavigator.css | 30 +++++ .../pickerNavigator.reel/pickerNavigator.html | 31 +++++- .../pickerNavigator.reel/pickerNavigator.js | 67 ++++++------ js/components/ui/color-chip.reel/color-chip.css | 0 js/components/ui/color-chip.reel/color-chip.html | 0 js/components/ui/color-chip.reel/color-chip.js | 0 js/components/ui/file-input.reel/file-input.css | 0 js/components/ui/file-input.reel/file-input.html | 0 js/components/ui/file-input.reel/file-input.js | 0 .../ui/icon-list-basic/icon.reel/icon.css | 0 .../ui/icon-list-basic/icon.reel/icon.html | 0 js/components/ui/icon-list-basic/icon.reel/icon.js | 0 .../icon-list-basic/iconsList.reel/iconsList.css | 0 .../icon-list-basic/iconsList.reel/iconsList.html | 0 .../ui/icon-list-basic/iconsList.reel/iconsList.js | 0 js/components/ui/input-group.reel/input-group.css | 0 js/components/ui/input-group.reel/input-group.html | 0 js/components/ui/input-group.reel/input-group.js | 0 .../ui/modalDialog/modal-dialog-manager.js | 0 js/components/ui/modalDialog/modalDialogHeader.js | 0 .../modalDialogHeader.reel/modalDialogHeader.css | 0 .../modalDialogHeader.reel/modalDialogHeader.html | 0 .../ui/property-control.reel/property-control.css | 0 .../ui/property-control.reel/property-control.html | 0 .../ui/property-control.reel/property-control.js | 0 .../ui/radio-button.reel/radio-button.html | 0 js/components/ui/radio-button.reel/radio-button.js | 0 .../ui/row-renderer.reel/row-renderer.html | 0 js/components/ui/row-renderer.reel/row-renderer.js | 0 js/components/ui/tree-basic/tree.reel/tree.css | 0 js/components/ui/tree-basic/tree.reel/tree.html | 10 ++ js/components/ui/tree-basic/tree.reel/tree.js | 12 ++ .../ui/tree-basic/treeItem.reel/treeItem.css | 0 .../ui/tree-basic/treeItem.reel/treeItem.html | 0 .../ui/tree-basic/treeItem.reel/treeItem.js | 23 +++- 40 files changed, 380 insertions(+), 85 deletions(-) create mode 100755 js/components/ui/FilePicker/file-input-field.reel/file-input-field.css create mode 100755 js/components/ui/FilePicker/file-input-field.reel/file-input-field.html create mode 100755 js/components/ui/FilePicker/file-input-field.reel/file-input-field.js mode change 100644 => 100755 js/components/ui/FilePicker/file-picker-controller.js mode change 100644 => 100755 js/components/ui/FilePicker/file-picker-model.js mode change 100644 => 100755 js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css mode change 100644 => 100755 js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html mode change 100644 => 100755 js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.js mode change 100644 => 100755 js/components/ui/color-chip.reel/color-chip.css mode change 100644 => 100755 js/components/ui/color-chip.reel/color-chip.html mode change 100644 => 100755 js/components/ui/color-chip.reel/color-chip.js mode change 100644 => 100755 js/components/ui/file-input.reel/file-input.css mode change 100644 => 100755 js/components/ui/file-input.reel/file-input.html mode change 100644 => 100755 js/components/ui/file-input.reel/file-input.js mode change 100644 => 100755 js/components/ui/icon-list-basic/icon.reel/icon.css mode change 100644 => 100755 js/components/ui/icon-list-basic/icon.reel/icon.html mode change 100644 => 100755 js/components/ui/icon-list-basic/icon.reel/icon.js mode change 100644 => 100755 js/components/ui/icon-list-basic/iconsList.reel/iconsList.css mode change 100644 => 100755 js/components/ui/icon-list-basic/iconsList.reel/iconsList.html mode change 100644 => 100755 js/components/ui/icon-list-basic/iconsList.reel/iconsList.js mode change 100644 => 100755 js/components/ui/input-group.reel/input-group.css mode change 100644 => 100755 js/components/ui/input-group.reel/input-group.html mode change 100644 => 100755 js/components/ui/input-group.reel/input-group.js mode change 100644 => 100755 js/components/ui/modalDialog/modal-dialog-manager.js mode change 100644 => 100755 js/components/ui/modalDialog/modalDialogHeader.js mode change 100644 => 100755 js/components/ui/modalDialog/modalDialogHeader.reel/modalDialogHeader.css mode change 100644 => 100755 js/components/ui/modalDialog/modalDialogHeader.reel/modalDialogHeader.html mode change 100644 => 100755 js/components/ui/property-control.reel/property-control.css mode change 100644 => 100755 js/components/ui/property-control.reel/property-control.html mode change 100644 => 100755 js/components/ui/property-control.reel/property-control.js mode change 100644 => 100755 js/components/ui/radio-button.reel/radio-button.html mode change 100644 => 100755 js/components/ui/radio-button.reel/radio-button.js mode change 100644 => 100755 js/components/ui/row-renderer.reel/row-renderer.html mode change 100644 => 100755 js/components/ui/row-renderer.reel/row-renderer.js mode change 100644 => 100755 js/components/ui/tree-basic/tree.reel/tree.css mode change 100644 => 100755 js/components/ui/tree-basic/tree.reel/tree.html mode change 100644 => 100755 js/components/ui/tree-basic/tree.reel/tree.js mode change 100644 => 100755 js/components/ui/tree-basic/treeItem.reel/treeItem.css mode change 100644 => 100755 js/components/ui/tree-basic/treeItem.reel/treeItem.html mode change 100644 => 100755 js/components/ui/tree-basic/treeItem.reel/treeItem.js (limited to 'js/components/ui') diff --git a/js/components/ui/FilePicker/file-input-field.reel/file-input-field.css b/js/components/ui/FilePicker/file-input-field.reel/file-input-field.css new file mode 100755 index 00000000..91e412f8 --- /dev/null +++ b/js/components/ui/FilePicker/file-input-field.reel/file-input-field.css @@ -0,0 +1,28 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +.fileInputField{ + display:inline; +} + +.fileInputField .newFileDirectory{ + width:70%; + margin-left:5px; +} + + +.fileInputField .findDirectory{ + display:inline; + width: 17px; + height:17px; + vertical-align: bottom; + background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%04%00%00%00%B5%FA7%EA%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%03%18iCCPPhotoshop%20ICC%20profile%00%00x%DAc%60%60%9E%E0%E8%E2%E4%CA%24%C0%C0PPTR%E4%1E%E4%18%19%11%19%A5%C0~%9E%81%8D%81%99%81%81%81%81%81!1%B9%B8%C01%20%C0%87%81%81%81!%2F%3F%2F%95%01%15020%7C%BB%C6%C0%C8%C0%C0%C0pY%D7%D1%C5%C9%95%814%C0%9A%5CPT%C2%C0%C0p%80%81%81%C1(%25%B58%99%81%81%E1%0B%03%03CzyIA%09%03%03c%0C%03%03%83HRvA%09%03%03c%01%03%03%83HvH%903%03%03c%0B%03%03%13OIjE%09%03%03%03%83s~AeQfzF%89%82%A1%A5%A5%A5%82cJ~R%AABpeqIjn%B1%82g%5Er~QA~QbIj%0A%03%03%03%D4%0E%06%06%06%06%5E%97%FC%12%05%F7%C4%CC%3C%05%23%03U%06*%83%88%C8(%05%08%0B%11%3E%081%04H.-*%83%07%25%03%83%00%83%02%83%01%83%03C%00C%22C%3D%C3%02%86%A3%0Co%18%C5%19%5D%18K%19W0%DEc%12c%0Ab%9A%C0t%81Y%989%92y!%F3%1B%16K%96%0E%96%5B%ACz%AC%AD%AC%F7%D8%2C%D9%A6%B1%7Dc%0Fg%DF%CD%A1%C4%D1%C5%F1%853%91%F3%02%97%23%D7%16nM%EE%05%3CR%3CSy%85x'%F1%09%F3M%E3%97%E1_%2C%A0%23%B0C%D0U%F0%8AP%AA%D0%0F%E1%5E%11%15%91%BD%A2%E1%A2_%C4%26%89%1B%89_%91%A8%90%94%93%3C%26%95%2F--%7DB%A6LV%5D%F6%96%5C%9F%BC%8B%FC%1F%85%AD%8A%85JzJo%95%D7%AA%14%A8%9A%A8%FET%3B%A8%DE%A5%11%AA%A9%A4%F9A%EB%80%F6%24%9DT%5D%2B%3DA%BDW%FAG%0C%16%18%D6%1A%C5%18%DB%9A%C8%9B2%9B%BE4%BB%60%BE%D3b%89%E5%04%AB%3A%EB%5C%9B8%DB%40%3BW%7Bk%07cG%1D'5g%25%17%05Wy7%05we%0FuO%5D%2F%13o%1B%1Fw%DF%60%BF%04%FF%FC%80%FA%C0%89AK%83w%85%5C%0C%7D%19%CE%14!%17i%15%15%11%5D%1133vO%DC%83%04%B6D%DD%A4%B0%E4%86%945%A97%D392%2C23%B3%E6f_%CCe%CF%B3%CF%AF(%D8T%F8%AEX%BB%24%ABtU%D9%9B%0A%FD%CA%92%AA%5D5%8C%B5%5EuS%EB%1F6%EA5%D54%9Fm%95k%2Bl%3F%DA)%DDU%D4%7D%BAW%B5%AF%B1%FF%EED%9BI%B3'%FF%9D%1A%3F%ED%F0%0C%8D%99%FD%B3%BE%CFI%98%7Bz%BE%F9%82%A5%8BD%16%B7.%F9%B6%2Cs%F9%BD%95!%ABN%AFqY%BBo%BD%E5%86m%9BL6o%D9j%B2m%FB%0E%AB%9D%FBw%BB%EE9%BB%2Fl%FF%83%839%87~%1Ei%3F%26~%7C%C5I%EBS%E7%CE%24%9F%FDu~%D2E%EDKG%AF%24%5E%FDw%7D%CEM%9B%5Bw%EF%D4%DFS%BE%7F%E2a%DEc%B1'%FB%9Fe%BE%10yy%F0u%FE%5B%F9w%17%3E4%7D2%FD%FC%EA%EB%82%EF%E1%3F%05~%9D%FA%D3%FA%CF%F1%FF%7F%00%0D%00%0F4%FA%96%F1%5D%00%00%00%20cHRM%00%00z%25%00%00%80%83%00%00%F9%FF%00%00%80%E9%00%00u0%00%00%EA%60%00%00%3A%98%00%00%17o%92_%C5F%00%00%01%3AIDATx%DA%84%91MK%02a%14%85%9Fwf%98%60%C4%CA%24BL%A4%E8%CBV%FD%82V%B5%0A%8A%DAD%05%AD%DA%B5%C9%A0%96%EDBw%FD%82VQ%B8%0C%FFB%CB%3E(%8A%24%A8%C4%5C%18L%86%18%D6%E8%A8o%8B%99a%B0%85%9D%ED%3D%3C%F7%9C%7B%85%A4%BB4%00%81%3D%A1%EE%C9%10%9A%CCh%19%7F(%01%05%C0%9Al%A7%EBa%F3%EA%B3%D8%DA%7F%5ED%ED%40H%24_%C7%D5%F3%D84%B3%CCg%0F%CD%8B%B9%88g%91H%87P%1F%CC%5D%16%A3%18%D8%E9%9B%BA%26F1%10%1E%C0Y%A1%C8qT%0A%3Cl%D5Pr%06%C1%3F!%0B%D9%E1%ED%D3%B7%F2%FBr%5C%EC%98w%BA%86%8E%C0%AD'%24%20%86R%1BK%2BzS%D3%1A%F7%CD)%CB%3A98%BA%A6%ED%B4p%0CA%C6%06%A21%9Br%3C%9CJ%E9%01%EB%E5qw%F5%09%E9%1BT%FA%89%12BAYO%247%03%7D%8D%D2%CC%02%DFR%BA%19hQ%A1%81I%0F%F2%CC%AC%B4%93k%A5Wb%14%F8%F1%08n%1E%04%02%83%11%12%F4%92%E7V~x%04%FF.P%23O%93%08U%9A~%8B%CE%FF(%F4%60%D0%A2%26m%D7%D0M%CA%3Fs~%07%00f%81qU%9E%9B%ECi%00%00%00%00IEND%AEB%60%82"); + background-size:17px 17px; + background-position: -2px -1px; + background-repeat: no-repeat; + padding-right: 12px; + cursor:pointer; +} diff --git a/js/components/ui/FilePicker/file-input-field.reel/file-input-field.html b/js/components/ui/FilePicker/file-input-field.reel/file-input-field.html new file mode 100755 index 00000000..46dd5c69 --- /dev/null +++ b/js/components/ui/FilePicker/file-input-field.reel/file-input-field.html @@ -0,0 +1,31 @@ + + + + + + + + + +
+ + +
+ + \ No newline at end of file diff --git a/js/components/ui/FilePicker/file-input-field.reel/file-input-field.js b/js/components/ui/FilePicker/file-input-field.reel/file-input-field.js new file mode 100755 index 00000000..f832e618 --- /dev/null +++ b/js/components/ui/FilePicker/file-input-field.reel/file-input-field.js @@ -0,0 +1,121 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; + +var FileInputField = exports.FileInputField = Montage.create(Component, { + + hasReel: { + value: true + }, + + willDraw: { + enumerable: false, + value: function() {} + }, + draw: { + enumerable: false, + value: function() {} + }, + didDraw: { + enumerable: false, + value: function() { + var that = this; + this.findDirectory.identifier = "findDirectory"; + this.findDirectory.addEventListener("click", function(evt){that.handleFindDirectoryClick(evt);}, false); + + this.eventManager.addEventListener("pickerSelectionsDone", function(evt){that.handleFileInputPickerSelectionsDone(evt);}, false); + + this.newFileDirectory.addEventListener("blur", function(evt){that.handleNewFileDirectoryOnblur(evt);}, false); + } + }, + + /** + * Either selectDirectory OR selectFile can be true + * If both are false then the file picker will default to file selection mode + */ + + selectDirectory:{ + writable: true, + enumerable:false, + value: false + }, + + pickerName:{ + writable: true, + enumerable:false, + value: null + }, + + selectFile:{ + writable: true, + enumerable:false, + value: false + }, + + + handleFindDirectoryClick: { + value: function(evt){ + var openFilePicker = document.createEvent("Events"); + openFilePicker.initEvent("openFilePicker", false, false); + var settings = {}; + if(this.selectDirectory === true){ + settings.inFileMode = false; + settings.pickerName = this.pickerName || "newFileDirectorySelector"; + }else{ + settings.inFileMode = true; + settings.pickerName = this.pickerName || "fileSelector"; + } + settings.callback = this.filePickerCallback; + settings.callbackScope = this; + openFilePicker.settings = settings; + this.eventManager.dispatchEvent(openFilePicker); + } + }, + + handleNewFileDirectoryOnblur:{ + value:function(evt){ + if(this.newFileDirectory.value !== ""){ + var newFileDirectorySetEvent = document.createEvent("Events"); + newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); + newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; + this.eventManager.dispatchEvent(newFileDirectorySetEvent); + } + } + }, + + handleFileInputPickerSelectionsDone:{ + value: function(evt){ + var selectedUri = ""; + if(!!evt._event.selectedItems && evt._event.selectedItems.length > 0){ + selectedUri = evt._event.selectedItems[0]; + this.newFileDirectory.value = selectedUri; + + var newFileDirectorySetEvent = document.createEvent("Events"); + newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); + newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; + this.eventManager.dispatchEvent(newFileDirectorySetEvent); + } + } + }, + + filePickerCallback:{ + value: function(obj){ + var selectedUri = ""; + if(!!obj && obj.uri && obj.uri.length > 0){ + selectedUri = obj.uri[0]; + this.newFileDirectory.value = selectedUri; + + var newFileDirectorySetEvent = document.createEvent("Events"); + newFileDirectorySetEvent.initEvent("newFileDirectorySet", false, false); + newFileDirectorySetEvent.newFileDirectory = this.newFileDirectory.value; + this.eventManager.dispatchEvent(newFileDirectorySetEvent); + } + } + } + +}); \ No newline at end of file diff --git a/js/components/ui/FilePicker/file-picker-controller.js b/js/components/ui/FilePicker/file-picker-controller.js old mode 100644 new mode 100755 index 526578d1..f14857ac --- a/js/components/ui/FilePicker/file-picker-controller.js +++ b/js/components/ui/FilePicker/file-picker-controller.js @@ -21,38 +21,24 @@ var FilePickerController = exports.FilePickerController = Montage.create(require enumerable:true, value:function(){ var that = this; - this.eventManager.addEventListener("executeFileOpen", function(evt){ - var callback, pickerMode, currentFilter, allFileFilters,inFileMode, allowNewFileCreation, allowMultipleSelections; - - if(!!evt.callback){ - callback = evt.callback; - } - if(!!evt.pickerMode){ - pickerMode = evt.pickerMode; - } - if(!!evt.currentFilter){ - currentFilter = evt.currentFilter; - } - if(!!evt.inFileMode){ - inFileMode = evt.inFileMode; - } - if(!!evt.allFileFilters){ - allFileFilters = evt.allFileFilters; + this.eventManager.addEventListener("openFilePicker", function(evt){ + var settings; + if(typeof evt._event.settings !== "undefined"){ + settings = evt._event.settings; } - if(!!evt.allowNewFileCreation){ - allowNewFileCreation = evt.allowNewFileCreation; - } - if(!!evt.allowMultipleSelections){ - allowMultipleSelections = evt.allowMultipleSelections; - } - - that.showFilePicker(callback, pickerMode, currentFilter, allFileFilters,inFileMode, allowNewFileCreation, allowMultipleSelections); - + that.showFilePicker(settings); }, false); + } }, + filePickerPopupType:{ + writable: true, + enumerable: false, + value: "filePicker" + }, + /** * this will be stored in the local storage and in the cloud may be, for the cloud one. */ @@ -81,14 +67,16 @@ var FilePickerController = exports.FilePickerController = Montage.create(require *this function is used to create an instance of a file picker * * parameters: - * callback: the call back function which will be used to send the selected URIs back - * pickerMode: ["read", "write"] : specifies if the file picker is opened to read a file/folder or to save a file - * currentFilter: if a current filter needs to be applied [ex: .psd] - * allFileFilters: list of filters that user can use to filter the view - * inFileMode: true => allow file selection , false => allow directory selection - * allowNewFileCreation: flag to specify whether or not it should return URI(s) to item(s) that do not exist. i.e. a user can type a filename to a new file that doesn't yet exist in the file system. - * allowMultipleSelections: allowMultipleSelections - *rootDirectories: invoker of this function can mention a subset of the allowed root directories to show in the file picker + * settings is an object containing : + * callback [optional]: the call back function which will be used to send the selected URIs back. If undefined then an event is fired with the selected uri + * callbackScope : required if callback is set + * pickerMode [optional]: ["read", "write"] : specifies if the file picker is opened to read a file/folder or to save a file + * currentFilter [optional]: if a current filter needs to be applied [ex: .psd] + * allFileFilters [optional]: list of filters that user can use to filter the view + * inFileMode [optional]: true => allow file selection , false => allow directory selection + * allowNewFileCreation [optional]: flag to specify whether or not it should return URI(s) to item(s) that do not exist. i.e. a user can type a filename to a new file that doesn't yet exist in the file system. + * allowMultipleSelections [optional]: allowMultipleSelections + * pickerName: name for montage custom popup * * return: none */ @@ -96,7 +84,19 @@ var FilePickerController = exports.FilePickerController = Montage.create(require showFilePicker:{ writable:false, enumerable:true, - value:function(callback, pickerMode, currentFilter, allFileFilters,inFileMode, allowNewFileCreation, allowMultipleSelections){ + value:function(settings){ + var callback, callbackScope, pickerMode, currentFilter, allFileFilters, inFileMode, allowNewFileCreation, allowMultipleSelections, pickerName; + if(!!settings){ + if(typeof settings.callback !== "undefined"){callback = settings.callback;} + if(typeof settings.callbackScope !== "undefined"){callbackScope = settings.callbackScope;} + if(typeof settings.pickerMode !== "undefined"){pickerMode = settings.pickerMode;} + if(typeof settings.currentFilter !== "undefined"){currentFilter = settings.currentFilter;} + if(typeof settings.allFileFilters !== "undefined"){allFileFilters = settings.allFileFilters;} + if(typeof settings.inFileMode !== "undefined"){inFileMode = settings.inFileMode;} + if(typeof settings.allowNewFileCreation !== "undefined"){allowNewFileCreation = settings.allowNewFileCreation;} + if(typeof settings.allowMultipleSelections !== "undefined"){allowMultipleSelections = settings.allowMultipleSelections;} + if(typeof settings.pickerName !== "undefined"){this.filePickerPopupType = settings.pickerName;} + } var aModel = filePickerModelModule.FilePickerModel.create(); @@ -114,8 +114,17 @@ var FilePickerController = exports.FilePickerController = Montage.create(require aModel.fatalError = " ** Unable to get files [Error: "+ errorCause +"]"; } - aModel.currentFilter = currentFilter; - aModel.inFileMode = inFileMode; + //dummy data - TODO:remove after testing + //aModel.currentFilter = "*.html, *.png"; + //aModel.currentFilter = "*.jpg"; + aModel.currentFilter = "*.*"; + aModel.inFileMode = true; + aModel.fileFilters = [".html, .htm", ".jpg, .jpeg, .png, .gif", ".js, .json", ".css", ".txt, .rtf", ".doc, .docx", ".pdf", ".avi, .mov, .mpeg, .ogg, .webm", "*.*"]; + //-end - dummy data + + if(!!currentFilter){aModel.currentFilter = currentFilter;} + if(typeof inFileMode !== "undefined"){aModel.inFileMode = inFileMode;} + aModel.topLevelDirectories = topLevelDirectories; if(!!topLevelDirectories && !!topLevelDirectories[0]){ @@ -136,17 +145,12 @@ var FilePickerController = exports.FilePickerController = Montage.create(require aModel.currentRoot = unescape(storedUri); } - aModel.fileFilters = allFileFilters; - aModel.callback = callback; - aModel.pickerMode = pickerMode; + if(!!allFileFilters){aModel.fileFilters = allFileFilters;} + if(!!callback){aModel.callback = callback;} + if(!!callbackScope){aModel.callbackScope = callbackScope;} + if(typeof pickerMode !== "undefined"){aModel.pickerMode = pickerMode;} + - //dummy data - TODO:remove after testing - //aModel.currentFilter = "*.html, *.png"; - //aModel.currentFilter = "*.jpg"; - aModel.currentFilter = "*.*"; - aModel.inFileMode = true; - aModel.fileFilters = [".html, .htm", ".jpg, .jpeg, .png, .gif", ".js, .json", ".css", ".txt, .rtf", ".doc, .docx", ".pdf", ".avi, .mov, .mpeg, .ogg, .webm", "*.*"]; - //-end - dummy data //logic: get file content data onDemand from the REST api for the default or last opened root. Cache the data in page [in local cache ? dirty fs? ]. Filter on client side to reduce network calls. this.openFilePickerAsModal(callback, aModel); @@ -172,6 +176,12 @@ var FilePickerController = exports.FilePickerController = Montage.create(require var pickerNavChoices = Montage.create(pickerNavigatorReel); var initUri = aModel.currentRoot; + + //remove extra / at the end + if((initUri.length > 1) && (initUri.charAt(initUri.length - 1) === "/")){ + initUri = initUri.substring(0, (initUri.length - 1)); + } + pickerNavChoices.mainContentData = this.prepareContentList(initUri, aModel); pickerNavChoices.pickerModel = aModel; pickerNavChoices.element = pickerNavContent; @@ -182,8 +192,8 @@ var FilePickerController = exports.FilePickerController = Montage.create(require var popup = Popup.create(); popup.content = pickerNavChoices; popup.modal = true; + popup.type = this.filePickerPopupType;//should be set always to not default to the single custom popup layer popup.show(); - pickerNavChoices.popup = popup;//handle to be used for hiding the popup } }, diff --git a/js/components/ui/FilePicker/file-picker-model.js b/js/components/ui/FilePicker/file-picker-model.js old mode 100644 new mode 100755 index b1df3b4e..d9cf02ed --- a/js/components/ui/FilePicker/file-picker-model.js +++ b/js/components/ui/FilePicker/file-picker-model.js @@ -79,6 +79,12 @@ exports.FilePickerModel = (require("montage/core/core").Montage).create(require( value:null }, + callbackScope:{ + writable:true, + enumerable:true, + value:null + }, + /** * stores the previously viewed directory uris in an array [FILO] per file picker instance */ diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css old mode 100644 new mode 100755 index 2d9f1189..61328ce0 --- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css +++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.css @@ -195,6 +195,36 @@ .picker .okButton{ margin-right:25px; + -webkit-box-align: center; + text-align: center; + cursor: default; + padding: 0px 6px 0px; + border:2px solid #d1d1d1; + background-color: #e1e1e1; + box-sizing: border-box; + border-radius:10px; + background-image: -webkit-linear-gradient(bottom, #e1e1e1 13%, #d1d1d1 58%, #e1e1e1 40%); + cursor:pointer; +} + +.picker .cancelButton{ + -webkit-box-align: center; + text-align: center; + cursor: default; + padding: 0px 6px 0px; + border:2px solid #d1d1d1; + background-color: #e1e1e1; + box-sizing: border-box; + border-radius:10px; + background-image: -webkit-linear-gradient(bottom, #e1e1e1 13%, #d1d1d1 58%, #e1e1e1 40%); + cursor:pointer; +} + +.picker input[type="button"]:disabled{ + background-color: #a1a1a1; + border:2px solid #a1a1a1; + background-image:none; + cursor:auto; } diff --git a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html old mode 100644 new mode 100755 index bf421247..b4aee4b2 --- a/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html +++ b/js/components/ui/FilePicker/pickerNavigator.reel/pickerNavigator.html @@ -10,6 +10,35 @@