Include CardDAV URL menu item in contextmenu; fix menu ID check
This commit is contained in:
parent
6eb9ccf3e8
commit
cba0d9d606
2 changed files with 21 additions and 4 deletions
|
@ -29,18 +29,33 @@ if (window.rcmail) {
|
||||||
menu
|
menu
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (rcmail.env.kolab_addressbook_carddav_url) {
|
||||||
|
rcm_contextmenu_register_command(
|
||||||
|
'book-showurl',
|
||||||
|
function(cmd,el){ rcmail.book_showurl() },
|
||||||
|
'kolab_addressbook.bookshowurl',
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
menu
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// adjust menu items when shown
|
// adjust menu items when shown
|
||||||
rcmail.addEventListener('contextmenu_show', function(p){
|
rcmail.addEventListener('contextmenu_show', function(p){
|
||||||
if (p.menu.attr('id') != '#rcmGroupMenu')
|
if (p.menu.attr('id') != 'rcmGroupMenu')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var m = String(p.src.attr('id')).match(/rcmli([a-z0-9\-_=]+)/i),
|
var m = String(p.src.attr('id')).match(/rcmli([a-z0-9\-_=]+)/i),
|
||||||
source = m && m.length ? rcmail.html_identifier_decode(m[1]) : null,
|
source = m && m.length ? rcmail.html_identifier_decode(m[1]) : null,
|
||||||
sources = rcmail.env.address_sources,
|
sources = rcmail.env.address_sources,
|
||||||
editable = source && sources[source] && sources[source].kolab && sources[source].editable;
|
editable = source && sources[source] && sources[source].kolab && sources[source].editable,
|
||||||
|
showurl = source && sources[source] && sources[source].carddavurl;
|
||||||
|
|
||||||
if (p.menu) {
|
if (p.menu) {
|
||||||
p.menu[editable?'enableContextMenuItems':'disableContextMenuItems']('#book-edit,#book-delete');
|
p.menu[editable ? 'enableContextMenuItems' : 'disableContextMenuItems']('#book-edit,#book-delete');
|
||||||
|
p.menu[showurl ? 'enableContextMenuItems' : 'disableContextMenuItems']('#book-showurl');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@ class kolab_addressbook_ui
|
||||||
|
|
||||||
if ($this->rc->config->get('kolab_addressbook_carddav_url')) {
|
if ($this->rc->config->get('kolab_addressbook_carddav_url')) {
|
||||||
$options[] = 'book-showurl';
|
$options[] = 'book-showurl';
|
||||||
|
$this->rc->output->set_env('kolab_addressbook_carddav_url', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($options as $command) {
|
foreach ($options as $command) {
|
||||||
|
@ -89,7 +90,8 @@ class kolab_addressbook_ui
|
||||||
'kolab_addressbook.bookdeleting', 'kolab_addressbook.bookshowurl',
|
'kolab_addressbook.bookdeleting', 'kolab_addressbook.bookshowurl',
|
||||||
'kolab_addressbook.carddavurldescription',
|
'kolab_addressbook.carddavurldescription',
|
||||||
'kolab_addressbook.bookedit',
|
'kolab_addressbook.bookedit',
|
||||||
'kolab_addressbook.bookdelete');
|
'kolab_addressbook.bookdelete',
|
||||||
|
'kolab_addressbook.bookshowurl');
|
||||||
}
|
}
|
||||||
// book create/edit form
|
// book create/edit form
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue