From f86577d5083aeed2de7a932fe4147e9002e91554 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 21 Feb 2012 21:11:54 -0800 Subject: cleanup - Removing temporary div to render the popups We don't need to render the popup before opening them. Removing that hack. Signed-off-by: Valerio Virgillito --- js/io/ui/file-picker/file-picker-controller.js | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'js/io/ui/file-picker/file-picker-controller.js') diff --git a/js/io/ui/file-picker/file-picker-controller.js b/js/io/ui/file-picker/file-picker-controller.js index 129bebad..5e4d0be8 100755 --- a/js/io/ui/file-picker/file-picker-controller.js +++ b/js/io/ui/file-picker/file-picker-controller.js @@ -33,7 +33,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require }, filePickerPopupType:{ - writable: true, enumerable: false, value: "filePicker" }, @@ -152,15 +151,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require writable:false, enumerable:true, value:function(callback, aModel){ - //render modal dialog - var pickerNavContent = document.createElement("div"); - pickerNavContent.id = "filePicker"; - - pickerNavContent.style.color = "#fff"; - - //hack (elements needs to be on DOM to be drawn) - document.getElementById('modalContainer').appendChild(pickerNavContent); - var pickerNavChoices = Montage.create(pickerNavigatorReel); var initUri = aModel.currentRoot; @@ -171,10 +161,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require pickerNavChoices.mainContentData = this.prepareContentList(initUri, aModel); pickerNavChoices.pickerModel = aModel; - pickerNavChoices.element = pickerNavContent; - - //hack - remove after rendering and add in modal dialog - document.getElementById('modalContainer').removeChild(pickerNavContent); var popup = Popup.create(); popup.content = pickerNavChoices; -- cgit v1.2.3 From 067ebae166ff82ae113a91517dfa59e7de5ae3d3 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 21 Feb 2012 22:36:54 -0800 Subject: cleanup - using montage functions handlers and using the NJevent Signed-off-by: Valerio Virgillito --- js/io/ui/file-picker/file-picker-controller.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'js/io/ui/file-picker/file-picker-controller.js') diff --git a/js/io/ui/file-picker/file-picker-controller.js b/js/io/ui/file-picker/file-picker-controller.js index 5e4d0be8..3b19de83 100755 --- a/js/io/ui/file-picker/file-picker-controller.js +++ b/js/io/ui/file-picker/file-picker-controller.js @@ -19,16 +19,7 @@ var FilePickerController = exports.FilePickerController = Montage.create(require writable:false, enumerable:true, value:function(){ - var that = this; - - this.eventManager.addEventListener("openFilePicker", function(evt){ - var settings; - if(typeof evt._event.settings !== "undefined"){ - settings = evt._event.settings; - } - that.showFilePicker(settings); - }, false); - + this.eventManager.addEventListener("openFilePicker", this, false); } }, @@ -37,6 +28,12 @@ var FilePickerController = exports.FilePickerController = Montage.create(require value: "filePicker" }, + handleOpenFilePicker: { + value: function(evt) { + this.showFilePicker(evt.detail); + } + }, + /** *this function is used to create an instance of a file picker * @@ -128,7 +125,9 @@ var FilePickerController = exports.FilePickerController = Montage.create(require } if(!!storedUri){ - aModel.currentRoot = unescape(storedUri); + // This is depracated -- use decodeURI instead + //aModel.currentRoot = unescape(storedUri); + aModel.currentRoot = decodeURI(storedUri); } if(!!allFileFilters){aModel.fileFilters = allFileFilters;} @@ -137,7 +136,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require if(typeof pickerMode !== "undefined"){aModel.pickerMode = pickerMode;} - //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); -- cgit v1.2.3