Implemented searching in file selector dialog
This commit is contained in:
parent
fd3b78960c
commit
5e9256e856
4 changed files with 96 additions and 3 deletions
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
window.rcmail && rcmail.addEventListener('init', function() {
|
||||
if (rcmail.env.task == 'mail') {
|
||||
if (rcmail.task == 'mail') {
|
||||
// mail compose
|
||||
if (rcmail.env.action == 'compose') {
|
||||
var elem = $('#compose-attachments > div'),
|
||||
|
@ -175,6 +175,18 @@ function kolab_files_ui()
|
|||
rcmail.http_error(request, status, err);
|
||||
};
|
||||
|
||||
this.file_list = function(params)
|
||||
{
|
||||
if (rcmail.task != 'kolab_files')
|
||||
this.file_selector(params);
|
||||
};
|
||||
|
||||
this.folder_list = function(params)
|
||||
{
|
||||
if (rcmail.task != 'kolab_files')
|
||||
this.folder_selector(params);
|
||||
};
|
||||
|
||||
this.folder_selector = function()
|
||||
{
|
||||
this.req = this.set_busy(true, 'loading');
|
||||
|
@ -244,6 +256,9 @@ function kolab_files_ui()
|
|||
|
||||
this.file_selector = function(params)
|
||||
{
|
||||
if (!this.env.folder)
|
||||
return;
|
||||
|
||||
if (!params)
|
||||
params = {};
|
||||
|
||||
|
@ -315,4 +330,25 @@ function kolab_files_ui()
|
|||
this.folder_selector();
|
||||
};
|
||||
|
||||
this.search = function()
|
||||
{
|
||||
var value = $(rcmail.gui_objects.filesearchbox).val();
|
||||
|
||||
if (value) {
|
||||
this.env.search = {name: value};
|
||||
this.file_list({search: this.env.search});
|
||||
}
|
||||
else
|
||||
this.search_reset();
|
||||
};
|
||||
|
||||
this.search_reset = function()
|
||||
{
|
||||
$(rcmail.gui_objects.filesearchbox).val('');
|
||||
|
||||
if (this.env.search) {
|
||||
this.env.search = null;
|
||||
this.file_list();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -66,6 +66,7 @@ class kolab_files_engine
|
|||
// register template objects
|
||||
$this->rc->output->add_handlers(array(
|
||||
'folder-create-form' => array($this, 'folder_create_form'),
|
||||
'file-search-form' => array($this, 'file_search_form'),
|
||||
));
|
||||
// add dialog content at the end of page body
|
||||
$this->rc->output->add_footer(
|
||||
|
@ -90,7 +91,7 @@ class kolab_files_engine
|
|||
/**
|
||||
* Template object for folder creation form in "Save as" dialog
|
||||
*/
|
||||
public function folder_create_form($attr)
|
||||
public function folder_create_form($attrib)
|
||||
{
|
||||
$attrib['name'] = 'folder-create-form';
|
||||
if (empty($attrib['id'])) {
|
||||
|
@ -113,6 +114,40 @@ class kolab_files_engine
|
|||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Template object for file search form in "From cloud" dialog
|
||||
*/
|
||||
public function file_search_form($attrib)
|
||||
{
|
||||
$attrib['name'] = '_q';
|
||||
|
||||
if (empty($attrib['id'])) {
|
||||
$attrib['id'] = 'filesearchbox';
|
||||
}
|
||||
if ($attrib['type'] == 'search' && !$this->rc->output->browser->khtml) {
|
||||
unset($attrib['type'], $attrib['results']);
|
||||
}
|
||||
|
||||
$input_q = new html_inputfield($attrib);
|
||||
$out = $input_q->show();
|
||||
|
||||
// add some labels to client
|
||||
$this->rc->output->add_label('searching');
|
||||
$this->rc->output->add_gui_object('filesearchbox', $attrib['id']);
|
||||
|
||||
// add form tag around text field
|
||||
if (empty($attrib['form'])) {
|
||||
$out = $this->rc->output->form_tag(array(
|
||||
'name' => "filesearchform",
|
||||
'onsubmit' => "file_api.search(); return false",
|
||||
'style' => "display:inline"),
|
||||
$out);
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get API token for current user session, authenticate if needed
|
||||
*/
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#files-compose-dialog #files-folder-selector {
|
||||
right: auto;
|
||||
width: 190px;
|
||||
top: 45px;
|
||||
}
|
||||
|
||||
#files-dialog #files-folder-selector {
|
||||
|
@ -25,7 +26,7 @@
|
|||
|
||||
#files-file-selector {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
top: 45px;
|
||||
bottom: 5px;
|
||||
left: 200px;
|
||||
right: 0;
|
||||
|
@ -66,6 +67,19 @@
|
|||
cursor: default;
|
||||
}
|
||||
|
||||
#files-compose-dialog #searchmenulink {
|
||||
width: 15px;
|
||||
}
|
||||
|
||||
#files-compose-dialog #quicksearchbar {
|
||||
top: 10px;
|
||||
right: 5px;
|
||||
}
|
||||
|
||||
#files-compose-dialog #searchreset {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#filelist table {
|
||||
width: 100%;
|
||||
border-spacing: 0;
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
<div id="files-compose-dialog" class="uidialog">
|
||||
<div id="quicksearchbar" class="searchbox">
|
||||
<roundcube:object name="file-search-form" id="filesearchbox" />
|
||||
<!--
|
||||
<roundcube:button name="searchmenulink" id="searchmenulink" class="iconbutton searchoptions" onclick="UI.show_popup('searchmenu');return false" title="searchmod" content=" " />
|
||||
-->
|
||||
<a id="searchmenulink" class="iconbutton searchoptions"> </a>
|
||||
<a id="searchreset" class="iconbutton reset" title="<roundcube:label name="resetsearch"/>" onclick="file_api.search_reset()"> </a>
|
||||
</div>
|
||||
<div id="files-folder-selector"></div>
|
||||
<div id="files-file-selector">
|
||||
<table id="filelist"><tbody></tbody></table>
|
||||
|
|
Loading…
Add table
Reference in a new issue