Separate list of saved searched from addressbooks list

pull/198/head
Thomas Bruederli 11 years ago
parent 36a10247c0
commit 71a522f103

@ -414,6 +414,17 @@ function rcube_webmail()
this.command('list'); 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(); this.set_page_buttons();
if (this.env.cid) { if (this.env.cid) {
@ -554,6 +565,7 @@ function rcube_webmail()
// init treelist widget // init treelist widget
if (this.gui_objects.folderlist && window.rcube_treelist_widget) { if (this.gui_objects.folderlist && window.rcube_treelist_widget) {
this.treelist = new rcube_treelist_widget(this.gui_objects.folderlist, { this.treelist = new rcube_treelist_widget(this.gui_objects.folderlist, {
selectable: true,
id_prefix: 'rcmli', id_prefix: 'rcmli',
id_encode: this.html_identifier_encode, id_encode: this.html_identifier_encode,
id_decode: this.html_identifier_decode, id_decode: this.html_identifier_decode,
@ -4760,6 +4772,7 @@ function rcube_webmail()
$(this.gui_objects.addresslist_title).html(this.get_label('contacts')); $(this.gui_objects.addresslist_title).html(this.get_label('contacts'));
} }
if (!this.env.search_id)
this.select_folder(folder, '', true); this.select_folder(folder, '', true);
// load contacts remotely // load contacts remotely
@ -5184,7 +5197,7 @@ function rcube_webmail()
// find list (UL) element // find list (UL) element
if (type == 'contactsearch') if (type == 'contactsearch')
ul = this.gui_objects.folderlist; ul = this.gui_objects.savedsearchlist;
else else
ul = $('ul.groups', this.get_folder_li(this.env.source,'',true)); ul = $('ul.groups', this.get_folder_li(this.env.source,'',true));
@ -5285,7 +5298,7 @@ function rcube_webmail()
.html(prop.name); .html(prop.name);
this.env.contactfolders[key] = this.env.contactgroups[key] = prop; 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) }); 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), .html(name),
prop = { name:name, id:id }; 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.select_folder(key,'',true);
this.enable_command('search-delete', true); this.enable_command('search-delete', true);
this.env.search_id = id; this.env.search_id = id;
@ -5593,7 +5606,7 @@ function rcube_webmail()
this.remove_search_item = function(id) this.remove_search_item = function(id)
{ {
var li, key = 'S'+id; var li, key = 'S'+id;
if (this.treelist.remove(key)) { if (this.savedsearchlist.remove(key)) {
this.triggerEvent('search_delete', { id:id, li:li }); this.triggerEvent('search_delete', { id:id, li:li });
} }
@ -5613,6 +5626,12 @@ function rcube_webmail()
} }
this.reset_qsearch(); this.reset_qsearch();
if (this.savedsearchlist) {
this.treelist.select('');
this.savedsearchlist.select('S'+id);
}
else
this.select_folder('S'+id, '', true); this.select_folder('S'+id, '', true);
// reset vars // reset vars
@ -6478,6 +6497,10 @@ function rcube_webmail()
// mark a mailbox as selected and set environment variable // mark a mailbox as selected and set environment variable
this.select_folder = function(name, prefix, encode) this.select_folder = function(name, prefix, encode)
{ {
if (this.savedsearchlist) {
this.savedsearchlist.select('');
}
if (this.treelist) { if (this.treelist) {
this.treelist.select(name); this.treelist.select(name);
} }

@ -112,7 +112,7 @@ if ($undo = $_SESSION['contact_undo']) {
// register UI objects // register UI objects
$OUTPUT->add_handlers(array( $OUTPUT->add_handlers(array(
'directorylist' => 'rcmail_directory_list', 'directorylist' => 'rcmail_directory_list',
// 'groupslist' => 'rcmail_contact_groups', 'savedsearchlist' => 'rcmail_savedsearch_list',
'addresslist' => 'rcmail_contacts_list', 'addresslist' => 'rcmail_contacts_list',
'addresslisttitle' => 'rcmail_contacts_list_title', 'addresslisttitle' => 'rcmail_contacts_list_title',
'addressframe' => 'rcmail_contact_frame', 'addressframe' => 'rcmail_contact_frame',
@ -251,6 +251,26 @@ function rcmail_directory_list($attrib)
$out .= '</li>'; $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( $line_templ = html::tag('li', array(
'id' => 'rcmli%s', 'class' => '%s'), 'id' => 'rcmli%s', 'class' => '%s'),
html::a(array('href' => '#', 'rel' => 'S%s', html::a(array('href' => '#', 'rel' => 'S%s',
@ -263,26 +283,19 @@ function rcmail_directory_list($attrib)
$js_id = rcube::JQ($id); $js_id = rcube::JQ($id);
// set class name(s) // set class name(s)
$class_name = 'contactsearch'; $classes = array('contactsearch');
if ($current === $id) if (!empty($source['class_name']))
$class_name .= ' selected'; $classes[] = $source['class_name'];
if ($source['class_name'])
$class_name .= ' ' . $source['class_name'];
$out .= sprintf($line_templ, $out .= sprintf($line_templ,
rcube_utils::html_identifier('S'.$id, true), rcube_utils::html_identifier('S'.$id, true),
$class_name, join(' ', $classes),
$id, $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->add_gui_object('savedsearchlist', $attrib['id']);
$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); return html::tag('ul', $attrib, $out, html::$common_attrib);
} }

@ -144,7 +144,8 @@
width: 280px; width: 280px;
} }
#directorylist li a #directorylist li a,
#savedsearchlist li a
{ {
cursor: default; cursor: default;
display: block; display: block;
@ -169,7 +170,7 @@
background-position: 22px -143px; background-position: 22px -143px;
} }
#directorylist li.contactsearch a #savedsearchlist li.contactsearch a
{ {
background-position: 6px -162px; background-position: 6px -162px;
} }

@ -61,6 +61,7 @@
<div id="directorylist-title" class="boxtitle"><roundcube:label name="groups" /></div> <div id="directorylist-title" class="boxtitle"><roundcube:label name="groups" /></div>
<div id="directorylist-content" class="boxlistcontent"> <div id="directorylist-content" class="boxlistcontent">
<roundcube:object name="directorylist" id="directorylist" class="treelist" /> <roundcube:object name="directorylist" id="directorylist" class="treelist" />
<roundcube:object name="savedsearchlist" id="savedsearchlist" class="treelist" />
</div> </div>
<div id="directorylist-footer" class="boxfooter"> <div id="directorylist-footer" class="boxfooter">
<roundcube:button command="group-create" type="link" title="newgroup" class="buttonPas addgroup" classAct="button addgroup" content=" " /> <roundcube:button command="group-create" type="link" title="newgroup" class="buttonPas addgroup" classAct="button addgroup" content=" " />

@ -66,6 +66,7 @@
} }
#directorylist li a, #directorylist li a,
.treelist li.contactsearch a,
#contacts-table .contact td.name { #contacts-table .contact td.name {
background-image: url(images/listicons.png); background-image: url(images/listicons.png);
background-position: -100px 0; background-position: -100px 0;
@ -74,46 +75,93 @@
text-overflow: ellipsis; text-overflow: ellipsis;
} }
#directorylist li.virtual {
background-image: none !important;
}
#directorylist li.virtual > a {
color: #aaa;
background-image: none;
height: 16px;
padding-top: 3px;
padding-bottom: 3px;
}
#directorylist li.virtual > .treetoggle {
top: 6px !important;
}
#directorylist ul li.virtual > .treetoggle {
}
#directorylist li.addressbook a { #directorylist li.addressbook a {
background-position: 6px -766px; background-position: 6px -766px;
} }
#directorylist ul li.addressbook a {
background-position: 32px -766px;
}
#directorylist ul ul li.addressbook a {
background-position: 58px -766px;
}
#directorylist li.addressbook.selected > a { #directorylist li.addressbook.selected > a {
background-color: transparent;
background-position: 6px -791px; background-position: 6px -791px;
} }
#directorylist li.addressbook ul.groups li { #directorylist ul li.addressbook.selected > a {
width: 100%; background-position: 32px -791px;
}
#directorylist ul ul li.addressbook.selected > a {
background-position: 58px -791px;
} }
#directorylist li.contactgroup a { #directorylist li.contactgroup a {
background-position: 32px -1555px; background-position: 32px -1555px;
} }
#directorylist ul ul li.contactgroup a {
background-position: 58px -1555px;
}
#directorylist ul ul ul li.contactgroup a {
background-position: 84px -1555px;
}
#directorylist li.contactgroup.selected a { #directorylist li.contactgroup.selected a {
background-position: 32px -1579px; background-position: 32px -1579px;
} }
#directorylist ul ul li.contactgroup.selected a {
background-position: 58px -1579px;
}
#directorylist ul ul ul li.contactgroup.selected a {
background-position: 84px -1579px;
}
#directorylist li.contactgroup input { #directorylist li.contactgroup input {
margin-left: 36px; margin-left: 36px;
} }
#directorylist li.contactsearch a { .treelist li.contactsearch a {
background-position: 6px -1651px; background-position: 6px -1651px;
} }
#directorylist li.contactsearch.selected a { .treelist li.contactsearch.selected a {
background-position: 6px -1675px; background-position: 6px -1675px;
} }
#directorylist li.contactsearch input { .treelist li.contactsearch input {
margin-left: 8px; margin-left: 8px;
} }
#directorylist li.addressbook div.collapsed, #directorylist li.addressbook div.collapsed,
#directorylist li.addressbook div.expanded { #directorylist li.addressbook div.expanded {
top: 15px; top: 15px;
left: 20px;
} }
#contacts-table .contact.readonly td { #contacts-table .contact.readonly td {

@ -1334,10 +1334,18 @@ ul.treelist.iconized li a {
padding-left: 36px; padding-left: 36px;
} }
ul.treelist.iconized li ul li a { ul.treelist.iconized ul li a {
padding-left: 62px; padding-left: 62px;
} }
ul.treelist.iconized ul ul li a {
padding-left: 88px;
}
ul.treelist.iconized ul ul ul li a {
padding-left: 114px;
}
ul.treelist li div.treetoggle { ul.treelist li div.treetoggle {
position: absolute; position: absolute;
top: 7px; top: 7px;
@ -1357,8 +1365,12 @@ ul.treelist.iconized li div.treetoggle {
left: 19px; left: 19px;
} }
ul.treelist.iconized li ul li div.treetoggle { ul.treelist.iconized ul li div.treetoggle {
left: 35px; left: 45px;
}
ul.treelist.iconized ul ul li div.treetoggle {
left: 71px;
} }
ul.treelist li div.treetoggle.expanded { ul.treelist li div.treetoggle.expanded {

@ -65,6 +65,8 @@
<h2 id="directorylist-header" class="boxtitle"><roundcube:label name="groups" /></h2> <h2 id="directorylist-header" class="boxtitle"><roundcube:label name="groups" /></h2>
<div id="directorylist-content" class="scroller withfooter"> <div id="directorylist-content" class="scroller withfooter">
<roundcube:object name="directorylist" id="directorylist" class="treelist listing iconized" /> <roundcube:object name="directorylist" id="directorylist" class="treelist listing iconized" />
<h3 class="boxtitle voice"><roundcube:label name="savedsearches" /></h3>
<roundcube:object name="savedsearchlist" id="savedsearchlist" class="treelist listing iconized" />
</div> </div>
<div id="directorylist-footer" class="boxfooter"> <div id="directorylist-footer" class="boxfooter">
<roundcube:button command="group-create" type="link" title="newgroup" class="listbutton add disabled" classAct="listbutton add" innerClass="inner" label="addgroup" /><roundcube:button name="groupoptions" id="groupoptionslink" type="link" title="moreactions" class="listbutton groupactions" onclick="return UI.toggle_popup('groupoptions',event)" innerClass="inner" label="arialabelabookgroupoptions" aria-haspopup="true" aria-expanded="false" aria-owns="groupoptionsmenu" /> <roundcube:button command="group-create" type="link" title="newgroup" class="listbutton add disabled" classAct="listbutton add" innerClass="inner" label="addgroup" /><roundcube:button name="groupoptions" id="groupoptionslink" type="link" title="moreactions" class="listbutton groupactions" onclick="return UI.toggle_popup('groupoptions',event)" innerClass="inner" label="arialabelabookgroupoptions" aria-haspopup="true" aria-expanded="false" aria-owns="groupoptionsmenu" />

Loading…
Cancel
Save