summaryrefslogtreecommitdiff
path: root/plugins/kolab_files/lib/kolab_files_engine.php
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2013-02-21 14:05:57 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2013-02-21 14:05:57 (GMT)
commit5e9256e8563ae16a16667d470fc6a259e49ba9d3 (patch)
treee909df8c8b22ddb7c17c3e98ddf720767d666708 /plugins/kolab_files/lib/kolab_files_engine.php
parentfd3b78960ce0d49144903fb4f23e11e424d7bfa0 (diff)
downloadroundcubemail-plugins-kolab-5e9256e8563ae16a16667d470fc6a259e49ba9d3.tar.gz
Implemented searching in file selector dialog
Diffstat (limited to 'plugins/kolab_files/lib/kolab_files_engine.php')
-rw-r--r--plugins/kolab_files/lib/kolab_files_engine.php37
1 files changed, 36 insertions, 1 deletions
diff --git a/plugins/kolab_files/lib/kolab_files_engine.php b/plugins/kolab_files/lib/kolab_files_engine.php
index 84d34e8..addd9d9 100644
--- a/plugins/kolab_files/lib/kolab_files_engine.php
+++ b/plugins/kolab_files/lib/kolab_files_engine.php
@@ -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'])) {
@@ -114,6 +115,40 @@ class kolab_files_engine
}
/**
+ * 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
*/
protected function get_api_token()