aboutsummaryrefslogtreecommitdiff
path: root/js/io/ui/file-picker/file-picker-controller.js
diff options
context:
space:
mode:
authorPushkar Joshi2012-02-28 14:01:05 -0800
committerPushkar Joshi2012-02-28 14:01:05 -0800
commit63307c9abf120985d979a40a53a0598d3f0d5c5a (patch)
tree57d9cffd7aa0959ea31fe0fa2d89a9080198bcb3 /js/io/ui/file-picker/file-picker-controller.js
parente1a65d0c2a13e12ee53be98c731616e35aa07a41 (diff)
parent7c9291a5bab4abd849547f8878f6fb962fc88250 (diff)
downloadninja-63307c9abf120985d979a40a53a0598d3f0d5c5a.tar.gz
Merge branch 'master' into pentool
Conflicts: manifest.json
Diffstat (limited to 'js/io/ui/file-picker/file-picker-controller.js')
-rwxr-xr-xjs/io/ui/file-picker/file-picker-controller.js36
1 files changed, 10 insertions, 26 deletions
diff --git a/js/io/ui/file-picker/file-picker-controller.js b/js/io/ui/file-picker/file-picker-controller.js
index 129bebad..3b19de83 100755
--- a/js/io/ui/file-picker/file-picker-controller.js
+++ b/js/io/ui/file-picker/file-picker-controller.js
@@ -19,25 +19,21 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
19 writable:false, 19 writable:false,
20 enumerable:true, 20 enumerable:true,
21 value:function(){ 21 value:function(){
22 var that = this; 22 this.eventManager.addEventListener("openFilePicker", this, false);
23
24 this.eventManager.addEventListener("openFilePicker", function(evt){
25 var settings;
26 if(typeof evt._event.settings !== "undefined"){
27 settings = evt._event.settings;
28 }
29 that.showFilePicker(settings);
30 }, false);
31
32 } 23 }
33 }, 24 },
34 25
35 filePickerPopupType:{ 26 filePickerPopupType:{
36 writable: true,
37 enumerable: false, 27 enumerable: false,
38 value: "filePicker" 28 value: "filePicker"
39 }, 29 },
40 30
31 handleOpenFilePicker: {
32 value: function(evt) {
33 this.showFilePicker(evt.detail);
34 }
35 },
36
41 /** 37 /**
42 *this function is used to create an instance of a file picker 38 *this function is used to create an instance of a file picker
43 * 39 *
@@ -129,7 +125,9 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
129 } 125 }
130 126
131 if(!!storedUri){ 127 if(!!storedUri){
132 aModel.currentRoot = unescape(storedUri); 128 // This is depracated -- use decodeURI instead
129 //aModel.currentRoot = unescape(storedUri);
130 aModel.currentRoot = decodeURI(storedUri);
133 } 131 }
134 132
135 if(!!allFileFilters){aModel.fileFilters = allFileFilters;} 133 if(!!allFileFilters){aModel.fileFilters = allFileFilters;}
@@ -138,7 +136,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
138 if(typeof pickerMode !== "undefined"){aModel.pickerMode = pickerMode;} 136 if(typeof pickerMode !== "undefined"){aModel.pickerMode = pickerMode;}
139 137
140 138
141
142 //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. 139 //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.
143 this.openFilePickerAsModal(callback, aModel); 140 this.openFilePickerAsModal(callback, aModel);
144 141
@@ -152,15 +149,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
152 writable:false, 149 writable:false,
153 enumerable:true, 150 enumerable:true,
154 value:function(callback, aModel){ 151 value:function(callback, aModel){
155 //render modal dialog
156 var pickerNavContent = document.createElement("div");
157 pickerNavContent.id = "filePicker";
158
159 pickerNavContent.style.color = "#fff";
160
161 //hack (elements needs to be on DOM to be drawn)
162 document.getElementById('modalContainer').appendChild(pickerNavContent);
163
164 var pickerNavChoices = Montage.create(pickerNavigatorReel); 152 var pickerNavChoices = Montage.create(pickerNavigatorReel);
165 var initUri = aModel.currentRoot; 153 var initUri = aModel.currentRoot;
166 154
@@ -171,10 +159,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
171 159
172 pickerNavChoices.mainContentData = this.prepareContentList(initUri, aModel); 160 pickerNavChoices.mainContentData = this.prepareContentList(initUri, aModel);
173 pickerNavChoices.pickerModel = aModel; 161 pickerNavChoices.pickerModel = aModel;
174 pickerNavChoices.element = pickerNavContent;
175
176 //hack - remove after rendering and add in modal dialog
177 document.getElementById('modalContainer').removeChild(pickerNavContent);
178 162
179 var popup = Popup.create(); 163 var popup = Popup.create();
180 popup.content = pickerNavChoices; 164 popup.content = pickerNavChoices;