Move "Show History" button from contact frame to "More" menu
For simplicity and consistency with Mail UI (and other places in Elastic).
This commit is contained in:
parent
ab3c7e1996
commit
7a7548744c
3 changed files with 42 additions and 48 deletions
|
@ -84,43 +84,36 @@ if (window.rcmail) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// append button to show contact audit trail
|
rcmail.contact_list && rcmail.contact_list.addEventListener('select', function(list) {
|
||||||
if (rcmail.env.action == 'show' && rcmail.env.kolab_audit_trail && rcmail.env.cid) {
|
var source, is_writable = true, is_traceable = false;
|
||||||
$('<a>').attr({href: '#history', 'class': 'btn btn-secondary history contact-history', role: 'button', tabindex: 0})
|
|
||||||
.append($('<span class="inner">').text(rcmail.get_label('kolab_addressbook.showhistory')))
|
// delete/move commands status was set by Roundcube core,
|
||||||
.click(function(e) {
|
// however, for Kolab addressbooks we like to check folder ACL
|
||||||
var rc = rcmail.is_framed() && parent.rcmail.contact_history_dialog ? parent.rcmail : rcmail;
|
if (list.selection.length && rcmail.commands['delete']) {
|
||||||
rc.contact_history_dialog();
|
$.each(rcmail.env.selection_sources, function() {
|
||||||
return false;
|
source = rcmail.env.address_sources[this];
|
||||||
})
|
if (source && source.kolab && source.rights.indexOf('t') < 0) {
|
||||||
.appendTo($('<div>').addClass('formbuttons-secondary-kolab').appendTo('.formbuttons'));
|
return is_writable = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
rcmail.enable_command('delete', 'move', is_writable);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (list.get_single_selection()) {
|
||||||
|
$.each(rcmail.env.selection_sources, function() {
|
||||||
|
source = rcmail.env.address_sources[this];
|
||||||
|
is_traceable = source && !!source.audittrail;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
rcmail.enable_command('contact-history-dialog', is_traceable);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
rcmail.addEventListener('listupdate', function() {
|
rcmail.addEventListener('listupdate', function() {
|
||||||
rcmail.set_book_actions();
|
rcmail.set_book_actions();
|
||||||
});
|
});
|
||||||
|
|
||||||
// wait until rcmail.contact_list is ready and subscribe to 'select' events
|
|
||||||
setTimeout(function() {
|
|
||||||
rcmail.contact_list && rcmail.contact_list.addEventListener('select', function(list) {
|
|
||||||
var source, is_writable = true;
|
|
||||||
|
|
||||||
// delete/move commands status was set by Roundcube core,
|
|
||||||
// however, for Kolab addressbooks we like to check folder ACL
|
|
||||||
if (list.selection.length && rcmail.commands['delete']) {
|
|
||||||
for (n in rcmail.env.selection_sources) {
|
|
||||||
source = rcmail.env.address_sources[n];
|
|
||||||
if (source && source.kolab && source.rights.indexOf('t') < 0) {
|
|
||||||
is_writable = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rcmail.enable_command('delete', 'move', is_writable);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// (De-)activates address book management commands
|
// (De-)activates address book management commands
|
||||||
|
@ -562,21 +555,6 @@ function kolab_addressbook_contextmenu()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (menu.menu_name == 'contactlist' && rcmail.env.kolab_audit_trail) {
|
|
||||||
// add "Show History" item to context menu
|
|
||||||
menu.menu_source.push({
|
|
||||||
label: rcmail.get_label('kolab_addressbook.showhistory'),
|
|
||||||
command: 'contact_history_dialog',
|
|
||||||
classes: 'history'
|
|
||||||
});
|
|
||||||
// enable history item if the contact source supports it
|
|
||||||
menu.addEventListener('activate', function(p) {
|
|
||||||
if (p.command == 'contact_history_dialog') {
|
|
||||||
var source = rcmail.env.address_sources ? rcmail.env.address_sources[rcmail.env.source] : {};
|
|
||||||
return !!source.audittrail;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -84,6 +84,17 @@ class kolab_addressbook extends rcube_plugin
|
||||||
$this->load_config();
|
$this->load_config();
|
||||||
require_once($this->home . '/lib/kolab_addressbook_ui.php');
|
require_once($this->home . '/lib/kolab_addressbook_ui.php');
|
||||||
$this->ui = new kolab_addressbook_ui($this);
|
$this->ui = new kolab_addressbook_ui($this);
|
||||||
|
|
||||||
|
if ($this->bonnie_api) {
|
||||||
|
$this->add_button(array(
|
||||||
|
'command' => 'contact-history-dialog',
|
||||||
|
'class' => 'history contact-history',
|
||||||
|
'classact' => 'history contact-history active',
|
||||||
|
'innerclass' => 'icon inner',
|
||||||
|
'label' => 'kolab_addressbook.showhistory',
|
||||||
|
'type' => 'link-menuitem'
|
||||||
|
), 'contactmenu');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($this->rc->task == 'settings') {
|
else if ($this->rc->task == 'settings') {
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
|
|
||||||
ul.toolbarmenu li a.history span.history {
|
ul.toolbarmenu li a.history {
|
||||||
|
padding: 2px 6px;
|
||||||
|
color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.toolbarmenu li a.history span.icon {
|
||||||
background-image: url('data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAQAAAD8x0bcAAABXUlEQVQoFbXBvUsCYQAH4N/mdm5uN9UStzn1AYG0HC1Jg01tV/9A0NYQ5dRm4BI0VYRYUYOD3CSB2FaLXBJhIXYeXr7veVGd8qus0D6Whp4H+Duq1LnEBDX8jiqz3XpgPzqB3a0zSw3fUetavlux0hkjlc5cnPtut84EBlEJLr1WOoN5RKEiisTylmMHNjX0Pa17rd0TRAFqzOLN8Ma2FN4u+tpVx8Y4Xp1O+y7eaRXroUkFn7xWqYieXFwKfDjek6IxCYAqy6xJ8dBkjatALi4FDfQUN6XIxfEqPJt0bCmkMAuIAXMjx/nnBvPUAGtfip0p9ERmk45tFqDjTQix0TXrzFqg4t3cVhHBh8jECnQqVPAujAS0zqHXOshgQJhKx+ycUUcPx5j33YqFcXwRMo/a94HNMrMsd+58t1gaWsQPMSNlFq7Kvlu7LpaMFGYQwi9U6JjHEgzMQMU/eAHASL3dDo5S4wAAAABJRU5ErkJggg==');
|
background-image: url('data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAQAAAD8x0bcAAABXUlEQVQoFbXBvUsCYQAH4N/mdm5uN9UStzn1AYG0HC1Jg01tV/9A0NYQ5dRm4BI0VYRYUYOD3CSB2FaLXBJhIXYeXr7veVGd8qus0D6Whp4H+Duq1LnEBDX8jiqz3XpgPzqB3a0zSw3fUetavlux0hkjlc5cnPtut84EBlEJLr1WOoN5RKEiisTylmMHNjX0Pa17rd0TRAFqzOLN8Ma2FN4u+tpVx8Y4Xp1O+y7eaRXroUkFn7xWqYieXFwKfDjek6IxCYAqy6xJ8dBkjatALi4FDfQUN6XIxfEqPJt0bCmkMAuIAXMjx/nnBvPUAGtfip0p9ERmk45tFqDjTQix0TXrzFqg4t3cVhHBh8jECnQqVPAujAS0zqHXOshgQJhKx+ycUUcPx5j33YqFcXwRMo/a94HNMrMsd+58t1gaWsQPMSNlFq7Kvlu7LpaMFGYQwi9U6JjHEgzMQMU/eAHASL3dDo5S4wAAAABJRU5ErkJggg==');
|
||||||
background-position: 0px 2px;
|
background-position: 0px 2px;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
|
|
Loading…
Add table
Reference in a new issue