Consolidate changelog dialog labels and use libkolab's singelton getter for the Bonnie API
This commit is contained in:
parent
a2a55110be
commit
09fe27d5a6
19 changed files with 98 additions and 64 deletions
|
@ -124,6 +124,11 @@ source_file = plugins/tasklist/helpdocs/po/overview.pot
|
|||
source_lang = en_US
|
||||
type = PO
|
||||
|
||||
[kolab.libkolab]
|
||||
file_filter = plugins/libkolab/localization/<lang>.inc
|
||||
source_file = plugins/libkolab/localization/en_US.inc
|
||||
source_lang = en_US
|
||||
|
||||
[kolab.libcalendaring]
|
||||
file_filter = plugins/libcalendaring/localization/<lang>.inc
|
||||
source_file = plugins/libcalendaring/localization/en_US.inc
|
||||
|
|
|
@ -71,8 +71,7 @@ class kolab_driver extends calendar_driver
|
|||
}
|
||||
|
||||
// get configuration for the Bonnie API
|
||||
if ($bonnie_config = $this->cal->rc->config->get('kolab_bonnie_api', false))
|
||||
$this->bonnie_api = new kolab_bonnie_api($bonnie_config);
|
||||
$this->bonnie_api = libkolab::get_bonnie_api();
|
||||
|
||||
// calendar uses fully encoded identifiers
|
||||
kolab_storage::$encode_ids = true;
|
||||
|
|
|
@ -278,15 +278,6 @@ $labels['birthdayage'] = 'Age $age';
|
|||
// history dialog
|
||||
$labels['objectchangelog'] = 'Change History';
|
||||
$labels['objectdiff'] = 'Changes from $rev1 to $rev2';
|
||||
$labels['revision'] = 'Revision';
|
||||
$labels['user'] = 'User';
|
||||
$labels['operation'] = 'Action';
|
||||
$labels['actionappend'] = 'Saved';
|
||||
$labels['actionmove'] = 'Moved';
|
||||
$labels['actiondelete'] = 'Deleted';
|
||||
$labels['compare'] = 'Compare';
|
||||
$labels['showrevision'] = 'Show this version';
|
||||
$labels['restore'] = 'Restore this version';
|
||||
$labels['objectnotfound'] = 'Failed to load event data';
|
||||
$labels['objectchangelognotavailable'] = 'Change history is not available for this event';
|
||||
$labels['objectdiffnotavailable'] = 'No comparison possible for the selected revisions';
|
||||
|
|
|
@ -335,8 +335,8 @@
|
|||
</div>
|
||||
|
||||
<div id="eventhistory" class="uidialog" aria-hidden="true">
|
||||
<roundcube:object name="plugin.object_changelog_table" id="event-changelog-table" class="records-table changelog-table" domain="calendar" />
|
||||
<div class="compare-button"><input type="button" class="button" value="↳ <roundcube:label name='calendar.compare' />" /></div>
|
||||
<roundcube:object name="plugin.object_changelog_table" id="event-changelog-table" class="records-table changelog-table" />
|
||||
<div class="compare-button"><input type="button" class="button" value="↳ <roundcube:label name='libkolab.compare' />" /></div>
|
||||
</div>
|
||||
|
||||
<div id="calendarform" class="uidialog" aria-hidden="true">
|
||||
|
|
|
@ -77,9 +77,7 @@ class kolab_addressbook extends rcube_plugin
|
|||
$this->register_action('plugin.contact-restore', array($this, 'contact_restore'));
|
||||
|
||||
// get configuration for the Bonnie API
|
||||
if ($bonnie_config = $this->rc->config->get('kolab_bonnie_api', false)) {
|
||||
$this->bonnie_api = new kolab_bonnie_api($bonnie_config);
|
||||
}
|
||||
$this->bonnie_api = libkolab::get_bonnie_api();
|
||||
|
||||
// Load UI elements
|
||||
if ($this->api->output->type == 'html') {
|
||||
|
@ -547,12 +545,13 @@ class kolab_addressbook extends rcube_plugin
|
|||
$result = $uid && $mailbox ? $this->bonnie_api->changelog('contact', $uid, $mailbox, $msguid) : null;
|
||||
if (is_array($result) && $result['uid'] == $uid) {
|
||||
if (is_array($result['changes'])) {
|
||||
$rcmail = $this->rc;
|
||||
$dtformat = $this->rc->config->get('date_format') . ' ' . $this->rc->config->get('time_format');
|
||||
array_walk($result['changes'], function(&$change) use ($dtformat) {
|
||||
array_walk($result['changes'], function(&$change) use ($rcmail, $dtformat) {
|
||||
if ($change['date']) {
|
||||
$dt = rcube_utils::anytodatetime($change['date']);
|
||||
if ($dt instanceof DateTime) {
|
||||
$change['date'] = $this->rc->format_date($dt, $dtformat);
|
||||
$change['date'] = $rcmail->format_date($dt, $dtformat);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -113,17 +113,11 @@ class kolab_addressbook_ui
|
|||
|
||||
$this->rc->output->add_label(
|
||||
'kolab_addressbook.showhistory',
|
||||
'kolab_addressbook.compare',
|
||||
'kolab_addressbook.objectchangelog',
|
||||
'kolab_addressbook.objectdiff',
|
||||
'kolab_addressbook.showrevision',
|
||||
'kolab_addressbook.actionappend',
|
||||
'kolab_addressbook.actionmove',
|
||||
'kolab_addressbook.actiondelete',
|
||||
'kolab_addressbook.objectdiffnotavailable',
|
||||
'kolab_addressbook.objectchangelognotavailable',
|
||||
'kolab_addressbook.revisionrestoreconfirm',
|
||||
'close'
|
||||
'kolab_addressbook.revisionrestoreconfirm'
|
||||
);
|
||||
|
||||
$this->plugin->add_hook('render_page', array($this, 'render_audittrail_page'));
|
||||
|
|
|
@ -53,14 +53,8 @@ $labels['noaddressbooksfound'] = 'No address books found';
|
|||
|
||||
// history dialog
|
||||
$labels['showhistory'] = 'Show History';
|
||||
$labels['compare'] = 'Compare';
|
||||
$labels['objectchangelog'] = 'Change History';
|
||||
$labels['objectdiff'] = 'Changes from $rev1 to $rev2';
|
||||
$labels['actionappend'] = 'Saved';
|
||||
$labels['actionmove'] = 'Moved';
|
||||
$labels['actiondelete'] = 'Deleted';
|
||||
$labels['showrevision'] = 'Show this version';
|
||||
$labels['restore'] = 'Restore this version';
|
||||
$labels['revisionrestoreconfirm'] = 'Do you really want to restore revision $rev of this contact? This will replace the current contact with the old version.';
|
||||
$labels['objectnotfound'] = 'Failed to load contact data';
|
||||
$labels['objectchangelognotavailable'] = 'Change history is not available for this contact';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div id="contacthistory" class="uidialog" aria-hidden="true">
|
||||
<roundcube:object name="plugin.object_changelog_table" class="records-table changelog-table" domain="calendar" />
|
||||
<div class="compare-button"><input type="button" class="button" value="↳ <roundcube:label name='kolab_addressbook.compare' />" /></div>
|
||||
<roundcube:object name="plugin.object_changelog_table" class="records-table changelog-table" />
|
||||
<div class="compare-button"><input type="button" class="button" value="↳ <roundcube:label name='libkolab.compare' />" /></div>
|
||||
</div>
|
||||
|
||||
<div id="contactdiff" class="uidialog contentbox" aria-hidden="true">
|
||||
|
|
|
@ -112,9 +112,7 @@ class kolab_notes extends rcube_plugin
|
|||
}
|
||||
|
||||
// get configuration for the Bonnie API
|
||||
if ($bonnie_config = $this->rc->config->get('kolab_bonnie_api', false)) {
|
||||
$this->bonnie_api = new kolab_bonnie_api($bonnie_config);
|
||||
}
|
||||
$this->bonnie_api = libkolab::get_bonnie_api();
|
||||
|
||||
// notes use fully encoded identifiers
|
||||
kolab_storage::$encode_ids = true;
|
||||
|
@ -640,12 +638,13 @@ class kolab_notes extends rcube_plugin
|
|||
case 'changelog':
|
||||
$data = $this->get_changelog($note);
|
||||
if (is_array($data) && !empty($data)) {
|
||||
$dtformat = $this->rc->config->get('date_format') . ' ' . $this->rc->config->get('time_format');
|
||||
array_walk($data, function(&$change) use ($lib, $dtformat) {
|
||||
$rcmail = $this->rc;
|
||||
$dtformat = $rcmail->config->get('date_format') . ' ' . $this->rc->config->get('time_format');
|
||||
array_walk($data, function(&$change) use ($lib, $rcmail, $dtformat) {
|
||||
if ($change['date']) {
|
||||
$dt = rcube_utils::anytodatetime($change['date']);
|
||||
if ($dt instanceof DateTime) {
|
||||
$change['date'] = $this->rc->format_date($dt, $dtformat);
|
||||
$change['date'] = $rcmail->format_date($dt, $dtformat);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -58,14 +58,8 @@ $labels['aclnorights'] = 'You do not have administrator rights for this notebook
|
|||
|
||||
// history dialog
|
||||
$labels['showhistory'] = 'Show History';
|
||||
$labels['compare'] = 'Compare';
|
||||
$labels['objectchangelog'] = 'Change History';
|
||||
$labels['objectdiff'] = 'Changes from $rev1 to $rev2';
|
||||
$labels['actionappend'] = 'Saved';
|
||||
$labels['actionmove'] = 'Moved';
|
||||
$labels['actiondelete'] = 'Deleted';
|
||||
$labels['showrevision'] = 'Show this version';
|
||||
$labels['restore'] = 'Restore this version';
|
||||
$labels['objectnotfound'] = 'Failed to load note data';
|
||||
$labels['objectchangelognotavailable'] = 'Change history is not available for this note';
|
||||
$labels['objectdiffnotavailable'] = 'No comparison possible for the selected revisions';
|
||||
|
|
|
@ -110,8 +110,8 @@
|
|||
|
||||
<roundcube:if condition="config:kolab_bonnie_api" />
|
||||
<div id="notehistory" class="uidialog" aria-hidden="true">
|
||||
<roundcube:object name="plugin.object_changelog_table" class="records-table changelog-table" domain="calendar" />
|
||||
<div class="compare-button"><input type="button" class="button" value="↳ <roundcube:label name='kolab_notes.compare' />" /></div>
|
||||
<roundcube:object name="plugin.object_changelog_table" class="records-table changelog-table" />
|
||||
<div class="compare-button"><input type="button" class="button" value="↳ <roundcube:label name='libkolab.compare' />" /></div>
|
||||
</div>
|
||||
|
||||
<div id="notediff" class="uidialog contentbox" aria-hidden="true">
|
||||
|
|
|
@ -163,9 +163,17 @@ libkolab_audittrail.render_changelog = function(data, object, folder)
|
|||
var i, change, accessible, op_append,
|
||||
first = data.length - 1, last = 0,
|
||||
is_writeable = !!folder.editable,
|
||||
op_labels = { RECEIVE: 'actionreceive', APPEND: 'actionappend', MOVE: 'actionmove', DELETE: 'actiondelete', READ: 'actionread', FLAGSET: 'actionflagset', FLAGCLEAR: 'actionflagclear' },
|
||||
actions = '<a href="#show" class="iconbutton preview" title="'+ rcmail.gettext('showrevision',data.module) +'" data-rev="{rev}" /> ' +
|
||||
(is_writeable ? '<a href="#restore" class="iconbutton restore" title="'+ rcmail.gettext('restore',data.module) + '" data-rev="{rev}" />' : ''),
|
||||
op_labels = {
|
||||
RECEIVE: 'actionreceive',
|
||||
APPEND: 'actionappend',
|
||||
MOVE: 'actionmove',
|
||||
DELETE: 'actiondelete',
|
||||
READ: 'actionread',
|
||||
FLAGSET: 'actionflagset',
|
||||
FLAGCLEAR: 'actionflagclear'
|
||||
},
|
||||
actions = '<a href="#show" class="iconbutton preview" title="'+ rcmail.gettext('showrevision','libkolab') +'" data-rev="{rev}" /> ' +
|
||||
(is_writeable ? '<a href="#restore" class="iconbutton restore" title="'+ rcmail.gettext('restore','libkolab') + '" data-rev="{rev}" />' : ''),
|
||||
tbody = $dialog.find('.changelog-table tbody').html('');
|
||||
|
||||
for (i=first; i >= 0; i--) {
|
||||
|
@ -190,7 +198,7 @@ libkolab_audittrail.render_changelog = function(data, object, folder)
|
|||
.append('<td class="revision">' + Q(i+1) + '</td>')
|
||||
.append('<td class="date">' + Q(change.date || '') + '</td>')
|
||||
.append('<td class="user">' + Q(change.user || 'undisclosed') + '</td>')
|
||||
.append('<td class="operation" title="' + op_append + '">' + Q(rcmail.gettext(op_labels[change.op] || '', data.module) + op_append) + '</td>')
|
||||
.append('<td class="operation" title="' + op_append + '">' + Q(rcmail.gettext(op_labels[change.op] || '', 'libkolab') + op_append) + '</td>')
|
||||
.append('<td class="actions">' + (accessible && change.op != 'DELETE' ? actions.replace(/\{rev\}/g, change.rev) : '') + '</td>')
|
||||
.appendTo(tbody);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class libkolab extends rcube_plugin
|
|||
kolab_format::$timezone = new DateTimeZone('GMT');
|
||||
}
|
||||
|
||||
$this->add_texts('localization/', $rcmail->output->type == 'html' && $rcmail->task == 'mail');
|
||||
$this->add_texts('localization/', false);
|
||||
|
||||
// embed scripts and templates for email message audit trail
|
||||
if ($rcmail->task == 'mail' && self::get_bonnie_api()) {
|
||||
|
@ -241,6 +241,19 @@ class libkolab extends rcube_plugin
|
|||
$table->add_header('operation', $rcube->gettext('operation', $attrib['domain']));
|
||||
$table->add_header('actions', ' ');
|
||||
|
||||
$rcube->output->add_label(
|
||||
'libkolab.showrevision',
|
||||
'libkolab.actionreceive',
|
||||
'libkolab.actionappend',
|
||||
'libkolab.actionmove',
|
||||
'libkolab.actiondelete',
|
||||
'libkolab.actionread',
|
||||
'libkolab.actionflagset',
|
||||
'libkolab.actionflagclear',
|
||||
'libkolab.objectchangelog',
|
||||
'close'
|
||||
);
|
||||
|
||||
return $table->show($attrib);
|
||||
}
|
||||
|
||||
|
|
25
plugins/libkolab/localization/de_DE.inc
Normal file
25
plugins/libkolab/localization/de_DE.inc
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Localizations for the Kolab libkolab plugin
|
||||
*
|
||||
* Copyright (C) 2015, Kolab Systems AG
|
||||
*
|
||||
* For translation see https://www.transifex.com/projects/p/kolab/resource/libkolab/
|
||||
*/
|
||||
|
||||
$labels = array();
|
||||
$labels['showhistory'] = 'Historie anzeigen';
|
||||
$labels['compare'] = 'Vergleichen';
|
||||
$labels['objectchangelog'] = 'Historie';
|
||||
$labels['objectdiff'] = 'Änderungen aus $rev1 nach $rev2';
|
||||
$labels['revision'] = 'Version';
|
||||
$labels['user'] = 'Benutzer';
|
||||
$labels['operation'] = 'Aktion';
|
||||
$labels['actionappend'] = 'Gespeichert';
|
||||
$labels['actionmove'] = 'Verschoben';
|
||||
$labels['actiondelete'] = 'Gelöscht';
|
||||
$labels['showrevision'] = 'Diese Version anzeigen';
|
||||
$labels['restore'] = 'Diese Version wiederherstellen';
|
||||
$labels['objectchangelognotavailable'] = 'Änderungshistorie ist nicht verfügbar für diese Nachricht';
|
||||
|
|
@ -27,6 +27,5 @@ $labels['actionflagset'] = 'Flag set';
|
|||
$labels['actionflagclear'] = 'Flag removed';
|
||||
$labels['showrevision'] = 'Show this version';
|
||||
$labels['restore'] = 'Restore this version';
|
||||
$labels['objectnotfound'] = 'Failed to load history data';
|
||||
$labels['objectchangelognotavailable'] = 'History is not available for this message';
|
||||
|
||||
|
|
22
plugins/libkolab/localization/fr_FR.inc
Normal file
22
plugins/libkolab/localization/fr_FR.inc
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Localizations for the Kolab libkolab plugin
|
||||
*
|
||||
* Copyright (C) 2015, Kolab Systems AG
|
||||
*
|
||||
* For translation see https://www.transifex.com/projects/p/kolab/resource/libkolab/
|
||||
*/
|
||||
|
||||
$labels = array();
|
||||
$labels['compare'] = 'Comparer';
|
||||
$labels['objectchangelog'] = 'Historique';
|
||||
$labels['revision'] = 'Version';
|
||||
$labels['user'] = 'Utilisateur';
|
||||
$labels['operation'] = 'Action';
|
||||
$labels['actionappend'] = 'Sauvegardé';
|
||||
$labels['actionmove'] = 'Déplacé';
|
||||
$labels['actiondelete'] = 'Supprimé';
|
||||
$labels['showrevision'] = 'Afficher cette version';
|
||||
$labels['restore'] = 'Restaurer cette version';
|
||||
|
|
@ -57,9 +57,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
|||
kolab_storage::$encode_ids = true;
|
||||
|
||||
// get configuration for the Bonnie API
|
||||
if ($bonnie_config = $this->rc->config->get('kolab_bonnie_api', false)) {
|
||||
$this->bonnie_api = new kolab_bonnie_api($bonnie_config);
|
||||
}
|
||||
$this->bonnie_api = libkolab::get_bonnie_api();
|
||||
|
||||
$this->_read_lists();
|
||||
|
||||
|
|
|
@ -156,12 +156,6 @@ $labels['saveintasklist'] = 'save in ';
|
|||
$labels['taskhistory'] = 'History';
|
||||
$labels['objectchangelog'] = 'Change History';
|
||||
$labels['objectdiff'] = 'Changes from $rev1 to $rev2';
|
||||
$labels['actionappend'] = 'Saved';
|
||||
$labels['actionmove'] = 'Moved';
|
||||
$labels['actiondelete'] = 'Deleted';
|
||||
$labels['compare'] = 'Compare';
|
||||
$labels['showrevision'] = 'Show this version';
|
||||
$labels['restore'] = 'Restore this version';
|
||||
$labels['objectnotfound'] = 'Failed to load task data';
|
||||
$labels['objectchangelognotavailable'] = 'Change history is not available for this task';
|
||||
$labels['objectdiffnotavailable'] = 'No comparison possible for the selected revisions';
|
||||
|
|
|
@ -244,8 +244,8 @@
|
|||
|
||||
<roundcube:if condition="env:tasklist_driver == 'kolab' && config:kolab_bonnie_api" />
|
||||
<div id="taskhistory" class="uidialog" aria-hidden="true">
|
||||
<roundcube:object name="plugin.object_changelog_table" class="records-table changelog-table" domain="calendar" />
|
||||
<div class="compare-button"><input type="button" class="button" value="↳ <roundcube:label name='tasklist.compare' />" /></div>
|
||||
<roundcube:object name="plugin.object_changelog_table" class="records-table changelog-table" />
|
||||
<div class="compare-button"><input type="button" class="button" value="↳ <roundcube:label name='libkolab.compare' />" /></div>
|
||||
</div>
|
||||
|
||||
<div id="taskdiff" class="uidialog taskshow" aria-hidden="true">
|
||||
|
|
Loading…
Add table
Reference in a new issue