MDL-31901: moved select-file panel outside of filepicker/filemanager for better UI

This commit is contained in:
Marina Glancy 2012-05-09 11:25:14 +08:00
parent 5cf44c1f1f
commit 55089a9d01
4 changed files with 58 additions and 48 deletions

View file

@ -26,6 +26,9 @@
* this.filecount, how many files in this filemanager
* this.maxfiles
* this.maxbytes
* this.filemanager, contains reference to filemanager Node
* this.selectnode, contains referenct to select-file Node
* this.selectui, YUI Panel to select the file
*
* FileManager options:
* =====
@ -97,17 +100,18 @@ M.form_filemanager.init = function(Y, options) {
this.pathbar.removeChild(this.pathnode);
}
// initialize 'select file' panel
var fpselectnode = Y.Node.create(M.form_filemanager.templates.fileselectlayout);
this.filemanager.appendChild(fpselectnode);
this.selectnode = Y.Node.create(M.form_filemanager.templates.fileselectlayout);
this.selectnode.generateID();
Y.one(document.body).appendChild(this.selectnode);
this.selectui = new Y.Panel({
srcNode : fpselectnode,
srcNode : this.selectnode,
zIndex : 600000,
centered : true,
modal : true,
close : true,
render : true
});
this.selectui.plug(Y.Plugin.Drag,{handles:['.yui3-widget-hd']});
this.selectui.plug(Y.Plugin.Drag,{handles:['#'+this.selectnode.get('id')+' .yui3-widget-hd']});
this.selectui.hide();
this.setup_select_file();
// setup buttons onclick events
@ -542,7 +546,7 @@ M.form_filemanager.init = function(Y, options) {
}
var list = ['/'];
appendfilepaths(list, tree);
var selectnode = this.filemanager.one('.fp-select');
var selectnode = this.selectnode;
node = selectnode.one('.fp-path select');
node.setContent('');
for (var i in list) {
@ -551,7 +555,7 @@ M.form_filemanager.init = function(Y, options) {
}
},
update_file: function() {
var selectnode = this.filemanager.one('.fp-select');
var selectnode = this.selectnode;
var fileinfo = this.selectui.fileinfo;
var newfilename = Y.Lang.trim(selectnode.one('.fp-saveas input').get('value'));
@ -614,7 +618,7 @@ M.form_filemanager.init = function(Y, options) {
});
},
setup_select_file: function() {
var selectnode = this.filemanager.one('.fp-select');
var selectnode = this.selectnode;
// bind labels with corresponding inputs
selectnode.all('.fp-saveas,.fp-path,.fp-author,.fp-license').each(function (node) {
node.all('label').set('for', node.one('input,select').generateID());
@ -740,7 +744,7 @@ M.form_filemanager.init = function(Y, options) {
return node.filepath;
},
select_file: function(node) {
var selectnode = this.filemanager.one('.fp-select');
var selectnode = this.selectnode;
selectnode.removeClass('loading').removeClass('fp-folder').
removeClass('fp-file').removeClass('fp-zip').removeClass('fp-cansetmain');
if (node.type == 'folder' || node.type == 'zip') {selectnode.addClass('fp-'+node.type);}