mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-16 10:21:23 +01:00
* Api: Add search feature into file select dialog
This commit is contained in:
parent
a753296d69
commit
82e08cc60b
@ -17,6 +17,7 @@
|
||||
app.classes.vfsSelectUI = (function(){ "use strict"; return AppJS.extend(
|
||||
{
|
||||
appname: 'filemanager',
|
||||
dirContent: {},
|
||||
vfsSelectWidget: {},
|
||||
path_widget: {},
|
||||
/**
|
||||
@ -54,6 +55,7 @@ app.classes.vfsSelectUI = (function(){ "use strict"; return AppJS.extend(
|
||||
et2_ready: function(et2,name)
|
||||
{
|
||||
this.path_widget = this.et2.getWidgetById('path');
|
||||
this.dirContent = this.et2.getArrayMgr('content').data.dir;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -310,5 +312,41 @@ app.classes.vfsSelectUI = (function(){ "use strict"; return AppJS.extend(
|
||||
}
|
||||
|
||||
this.vfsSelectWidget._content(arrMgrs.content.data, _callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* search through dir content and set its content base on searched query
|
||||
* @returns
|
||||
*/
|
||||
search: function(_widget)
|
||||
{
|
||||
var dir = this.et2.getWidgetById('dir');
|
||||
var query = _widget.get_value();
|
||||
if (query == "")
|
||||
{
|
||||
dir.set_value({content: this.dirContent});
|
||||
return;
|
||||
}
|
||||
var self = this;
|
||||
var searchQuery = function (_query)
|
||||
{
|
||||
var result = {};
|
||||
var reg = RegExp("^"+_query, 'ig');
|
||||
var key = 0;
|
||||
for (var i in self.dirContent)
|
||||
{
|
||||
if (typeof self.dirContent[i]['name'] != 'undefined' && self.dirContent[i]['name'].match(reg))
|
||||
{
|
||||
result[key] = self.dirContent[i];
|
||||
key++;
|
||||
}
|
||||
else if (typeof self.dirContent[i]['name'] == 'undefined' && isNaN(i))
|
||||
{
|
||||
result[i] = self.dirContent[i];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
dir.set_value({content: searchQuery(query)});
|
||||
}
|
||||
});}).call(this);
|
||||
});}).call(this);
|
@ -2961,4 +2961,16 @@ div.eml div.emlDelete:hover, div.eml div.emlEdit:hover {
|
||||
margin-left: 0;
|
||||
}
|
||||
#api\.vfsSelectUI_app {width:177px}
|
||||
#api\.vfsSelectUI_name {padding-right: 4px;}
|
||||
#api\.vfsSelectUI_name {
|
||||
padding-right: 0;
|
||||
margin-right:0;
|
||||
}
|
||||
#api\.vfsSelectUI_search.et2_searchbox .flex{
|
||||
width: 122px;
|
||||
padding-right: 0px;
|
||||
}
|
||||
#api\.vfsSelectUI_path {width:100%;}
|
||||
#api\.vfsSelectUI_path .et2_textbox.et2_vfs {
|
||||
padding-right: 0px;
|
||||
margin-right: 0px;
|
||||
}
|
@ -19,6 +19,7 @@
|
||||
<select width="175" id="app" empty_label="Applications" no_lang="1" onchange="app.vfsSelectUI.do_action('app', widget)"/>
|
||||
<buttononly statustext="Create directory" id="createdir" class="createDir" onclick="app.vfsSelectUI.createdir" image="button_createdir" ro_image="createdir_disabled" background_image="1"/>
|
||||
<file id='upload_file' statustext="upload file" progress_dropdownlist = "true" multiple="true" onFinish="app.vfsSelectUI.storeFile"/>
|
||||
<searchbox id="search" onchange="app.vfsSelectUI.search"/>
|
||||
<vfs-name id="path" class="et2_fullWidth selectPath" align="left" onchange="app.vfsSelectUI.do_action('path', widget)"/>
|
||||
</box>
|
||||
</row>
|
||||
|
Loading…
Reference in New Issue
Block a user