summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2014-06-24 14:21:14 +0200
committerThomas Bruederli <thomas@roundcube.net>2014-06-24 14:21:14 +0200
commit71a522f103a41b2f38f5d96ab476384efe3002e8 (patch)
treeac29d78305921f3c3f500641b051968834153b7a /program
parent36a10247c0b05d518f4c2c8f7bf74e3181ea5050 (diff)
Separate list of saved searched from addressbooks list
Diffstat (limited to 'program')
-rw-r--r--program/js/app.js35
-rw-r--r--program/steps/addressbook/func.inc43
2 files changed, 57 insertions, 21 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 61698b83f..7e67a9c88 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -414,6 +414,17 @@ function rcube_webmail()
this.command('list');
}
+ if (this.gui_objects.savedsearchlist) {
+ this.savedsearchlist = new rcube_treelist_widget(this.gui_objects.savedsearchlist, {
+ id_prefix: 'rcmli',
+ id_encode: this.html_identifier_encode,
+ id_decode: this.html_identifier_decode
+ });
+
+ this.savedsearchlist.addEventListener('select', function(node) {
+ ref.triggerEvent('selectfolder', { folder:node.id, prefix:'rcmli' }); });
+ }
+
this.set_page_buttons();
if (this.env.cid) {
@@ -554,6 +565,7 @@ function rcube_webmail()
// init treelist widget
if (this.gui_objects.folderlist && window.rcube_treelist_widget) {
this.treelist = new rcube_treelist_widget(this.gui_objects.folderlist, {
+ selectable: true,
id_prefix: 'rcmli',
id_encode: this.html_identifier_encode,
id_decode: this.html_identifier_decode,
@@ -4760,7 +4772,8 @@ function rcube_webmail()
$(this.gui_objects.addresslist_title).html(this.get_label('contacts'));
}
- this.select_folder(folder, '', true);
+ if (!this.env.search_id)
+ this.select_folder(folder, '', true);
// load contacts remotely
if (this.gui_objects.contactslist) {
@@ -5184,7 +5197,7 @@ function rcube_webmail()
// find list (UL) element
if (type == 'contactsearch')
- ul = this.gui_objects.folderlist;
+ ul = this.gui_objects.savedsearchlist;
else
ul = $('ul.groups', this.get_folder_li(this.env.source,'',true));
@@ -5285,7 +5298,7 @@ function rcube_webmail()
.html(prop.name);
this.env.contactfolders[key] = this.env.contactgroups[key] = prop;
- this.treelist.insert({ id:key, html:link, classes:['contactgroup'] }, prop.source, true);
+ this.treelist.insert({ id:key, html:link, classes:['contactgroup'] }, prop.source, 'contactgroup');
this.triggerEvent('group_insert', { id:prop.id, source:prop.source, name:prop.name, li:this.treelist.get_item(key) });
};
@@ -5567,7 +5580,7 @@ function rcube_webmail()
.html(name),
prop = { name:name, id:id };
- this.treelist.insert({ id:key, html:link, classes:['contactsearch'] }, null, 'contactsearch');
+ this.savedsearchlist.insert({ id:key, html:link, classes:['contactsearch'] }, null, 'contactsearch');
this.select_folder(key,'',true);
this.enable_command('search-delete', true);
this.env.search_id = id;
@@ -5593,7 +5606,7 @@ function rcube_webmail()
this.remove_search_item = function(id)
{
var li, key = 'S'+id;
- if (this.treelist.remove(key)) {
+ if (this.savedsearchlist.remove(key)) {
this.triggerEvent('search_delete', { id:id, li:li });
}
@@ -5613,7 +5626,13 @@ function rcube_webmail()
}
this.reset_qsearch();
- this.select_folder('S'+id, '', true);
+
+ if (this.savedsearchlist) {
+ this.treelist.select('');
+ this.savedsearchlist.select('S'+id);
+ }
+ else
+ this.select_folder('S'+id, '', true);
// reset vars
this.env.current_page = 1;
@@ -6478,6 +6497,10 @@ function rcube_webmail()
// mark a mailbox as selected and set environment variable
this.select_folder = function(name, prefix, encode)
{
+ if (this.savedsearchlist) {
+ this.savedsearchlist.select('');
+ }
+
if (this.treelist) {
this.treelist.select(name);
}
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index 8955488bd..f09deeb10 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -112,7 +112,7 @@ if ($undo = $_SESSION['contact_undo']) {
// register UI objects
$OUTPUT->add_handlers(array(
'directorylist' => 'rcmail_directory_list',
-// 'groupslist' => 'rcmail_contact_groups',
+ 'savedsearchlist' => 'rcmail_savedsearch_list',
'addresslist' => 'rcmail_contacts_list',
'addresslisttitle' => 'rcmail_contacts_list_title',
'addressframe' => 'rcmail_contact_frame',
@@ -251,6 +251,26 @@ function rcmail_directory_list($attrib)
$out .= '</li>';
}
+ $OUTPUT->set_env('contactgroups', $jsdata);
+ $OUTPUT->set_env('collapsed_abooks', (string)$RCMAIL->config->get('collapsed_abooks',''));
+ $OUTPUT->add_gui_object('folderlist', $attrib['id']);
+ $OUTPUT->include_script('treelist.js');
+
+ // add some labels to client
+ $OUTPUT->add_label('deletegroupconfirm', 'groupdeleting', 'addingmember', 'removingmember');
+
+ return html::tag('ul', $attrib, $out, html::$common_attrib);
+}
+
+
+function rcmail_savedsearch_list($attrib)
+{
+ global $RCMAIL, $OUTPUT;
+
+ if (!$attrib['id'])
+ $attrib['id'] = 'rcmsavedsearchlist';
+
+ $out = '';
$line_templ = html::tag('li', array(
'id' => 'rcmli%s', 'class' => '%s'),
html::a(array('href' => '#', 'rel' => 'S%s',
@@ -263,26 +283,19 @@ function rcmail_directory_list($attrib)
$js_id = rcube::JQ($id);
// set class name(s)
- $class_name = 'contactsearch';
- if ($current === $id)
- $class_name .= ' selected';
- if ($source['class_name'])
- $class_name .= ' ' . $source['class_name'];
+ $classes = array('contactsearch');
+ if (!empty($source['class_name']))
+ $classes[] = $source['class_name'];
$out .= sprintf($line_templ,
rcube_utils::html_identifier('S'.$id, true),
- $class_name,
+ join(' ', $classes),
$id,
- $js_id, (!empty($source['name']) ? rcube::Q($source['name']) : rcube::Q($id)));
+ $js_id, (!empty($source['name']) ? rcube::Q($source['name']) : rcube::Q($id))
+ );
}
- $OUTPUT->set_env('contactgroups', $jsdata);
- $OUTPUT->set_env('collapsed_abooks', (string)$RCMAIL->config->get('collapsed_abooks',''));
- $OUTPUT->add_gui_object('folderlist', $attrib['id']);
- $OUTPUT->include_script('treelist.js');
-
- // add some labels to client
- $OUTPUT->add_label('deletegroupconfirm', 'groupdeleting', 'addingmember', 'removingmember');
+ $OUTPUT->add_gui_object('savedsearchlist', $attrib['id']);
return html::tag('ul', $attrib, $out, html::$common_attrib);
}