aboutsummaryrefslogtreecommitdiff
path: root/js/components/ui/FilePicker/file-picker-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/components/ui/FilePicker/file-picker-controller.js')
-rwxr-xr-xjs/components/ui/FilePicker/file-picker-controller.js50
1 files changed, 19 insertions, 31 deletions
diff --git a/js/components/ui/FilePicker/file-picker-controller.js b/js/components/ui/FilePicker/file-picker-controller.js
index e71d1460..0ff20cc8 100755
--- a/js/components/ui/FilePicker/file-picker-controller.js
+++ b/js/components/ui/FilePicker/file-picker-controller.js
@@ -39,30 +39,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
39 }, 39 },
40 40
41 /** 41 /**
42 * this will be stored in the local storage and in the cloud may be, for the cloud one.
43 */
44 _lastOpenedFolderURI:{
45 writable:true,
46 enumerable:true,
47 value:{
48 lastFolderUri_local:null,
49 lastFolderUri_cloud:null
50 }
51 },
52
53 /**
54 * this will be stored in the local storage and in the cloud may be, for the cloud one.
55 */
56 _lastSavedFolderURI:{
57 writable:true,
58 enumerable:true,
59 value:{
60 lastSavedFolderUri_local:null,
61 lastSavedFolderUri_cloud:null
62 }
63 },
64
65 /**
66 *this function is used to create an instance of a file picker 42 *this function is used to create an instance of a file picker
67 * 43 *
68 * parameters: 44 * parameters:
@@ -87,7 +63,6 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
87 var callback, callbackScope, pickerMode, currentFilter, allFileFilters, inFileMode, allowNewFileCreation, allowMultipleSelections, pickerName; 63 var callback, callbackScope, pickerMode, currentFilter, allFileFilters, inFileMode, allowNewFileCreation, allowMultipleSelections, pickerName;
88 if(!!settings){ 64 if(!!settings){
89 if(typeof settings.callback !== "undefined"){callback = settings.callback;} 65 if(typeof settings.callback !== "undefined"){callback = settings.callback;}
90 if(typeof settings.callbackScope !== "undefined"){callbackScope = settings.callbackScope;}
91 if(typeof settings.pickerMode !== "undefined"){pickerMode = settings.pickerMode;} 66 if(typeof settings.pickerMode !== "undefined"){pickerMode = settings.pickerMode;}
92 if(typeof settings.currentFilter !== "undefined"){currentFilter = settings.currentFilter;} 67 if(typeof settings.currentFilter !== "undefined"){currentFilter = settings.currentFilter;}
93 if(typeof settings.allFileFilters !== "undefined"){allFileFilters = settings.allFileFilters;} 68 if(typeof settings.allFileFilters !== "undefined"){allFileFilters = settings.allFileFilters;}
@@ -97,6 +72,12 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
97 if(typeof settings.pickerName !== "undefined"){this.filePickerPopupType = settings.pickerName;} 72 if(typeof settings.pickerName !== "undefined"){this.filePickerPopupType = settings.pickerName;}
98 } 73 }
99 74
75 if(settings.pickerName === "saveAsDirectoryPicker"){//need to set the picker mode in a better way
76 pickerMode = "write";
77 }else{
78 pickerMode = "read";
79 }
80
100 var aModel = filePickerModelModule.FilePickerModel.create(); 81 var aModel = filePickerModelModule.FilePickerModel.create();
101 82
102 var topLevelDirectories = null; 83 var topLevelDirectories = null;
@@ -131,13 +112,20 @@ var FilePickerController = exports.FilePickerController = Montage.create(require
131 } 112 }
132 113
133 //populate the last opened folder first, if none then populate default root 114 //populate the last opened folder first, if none then populate default root
134 var sessionStorage = window.sessionStorage;
135 var storedUri = null; 115 var storedUri = null;
136 116 var sessionStorage = window.sessionStorage;
137 if(pickerMode === "write"){ 117 try{
138 storedUri = sessionStorage.getItem("lastSavedFolderURI"); 118 if(pickerMode === "write"){
139 }else{ 119 storedUri = sessionStorage.getItem("lastSavedFolderURI");
140 storedUri = sessionStorage.getItem("lastOpenedFolderURI"); 120 }else if(inFileMode === true){
121 storedUri = sessionStorage.getItem("lastOpenedFolderURI_fileSelection");
122 }else if(inFileMode === false){
123 storedUri = sessionStorage.getItem("lastOpenedFolderURI_folderSelection");
124 }
125 }catch(e){
126 if(e.code == 22){
127 sessionStorage.clear();
128 }
141 } 129 }
142 130
143 if(!!storedUri){ 131 if(!!storedUri){