T1362: Fix title/tooltip text on attendee, localize the status text
Moved shared code and localization to libcalendaring plugin. Fixes T1362.
This commit is contained in:
parent
047c9352a2
commit
fdda23c8ff
7 changed files with 55 additions and 45 deletions
|
@ -308,7 +308,6 @@ class calendar extends rcube_plugin
|
|||
|
||||
$this->ui->init_templates();
|
||||
$this->rc->output->add_label('lowest','low','normal','high','highest','delete','cancel','uploading','noemailwarning','close');
|
||||
$this->rc->output->add_label('libcalendaring.itipaccepted','libcalendaring.itiptentative','libcalendaring.itipdeclined','libcalendaring.itipdelegated','libcalendaring.expandattendeegroup','libcalendaring.expandattendeegroupnodata');
|
||||
|
||||
// initialize attendees autocompletion
|
||||
$this->rc->autocomplete_init();
|
||||
|
|
|
@ -526,7 +526,7 @@ function rcube_calendar_ui(settings)
|
|||
}
|
||||
}
|
||||
|
||||
line = event_attendee_html(data);
|
||||
line = rcube_libcalendaring.attendee_html(data);
|
||||
|
||||
if (morelink)
|
||||
overflow += line;
|
||||
|
@ -671,24 +671,6 @@ function rcube_calendar_ui(settings)
|
|||
rcmail.enable_command('event-history', calendar.history)
|
||||
};
|
||||
|
||||
// render HTML code for displaying an attendee record
|
||||
var event_attendee_html = function(data)
|
||||
{
|
||||
var dispname = Q(data.name || data.email), tooltip = '';
|
||||
|
||||
if (data.email) {
|
||||
tooltip = data.email + '; ' + data.status;
|
||||
dispname = '<a href="mailto:' + data.email + '" class="mailtolink" data-cutype="' + data.cutype + '">' + dispname + '</a>';
|
||||
}
|
||||
|
||||
if (data['delegated-to'])
|
||||
tooltip = rcmail.gettext('delegatedto', 'calendar') + data['delegated-to'];
|
||||
else if (data['delegated-from'])
|
||||
tooltip = rcmail.gettext('delegatedfrom', 'calendar') + data['delegated-from'];
|
||||
|
||||
return '<span class="attendee ' + String(data.role == 'ORGANIZER' ? 'organizer' : data.status).toLowerCase() + '" title="' + Q(tooltip) + '">' + dispname + '</span> ';
|
||||
};
|
||||
|
||||
// event handler for clicks on an attendee link
|
||||
var event_attendee_click = function(e)
|
||||
{
|
||||
|
@ -1115,8 +1097,8 @@ function rcube_calendar_ui(settings)
|
|||
}
|
||||
// format attendees struct
|
||||
else if (prop == 'attendees') {
|
||||
if (change['old']) change.old_ = event_attendee_html(change['old']);
|
||||
if (change['new']) change.new_ = event_attendee_html($.extend({}, change['old'] || {}, change['new']));
|
||||
if (change['old']) change.old_ = rcube_libcalendaring.attendee_html(change['old']);
|
||||
if (change['new']) change.new_ = rcube_libcalendaring.attendee_html($.extend({}, change['old'] || {}, change['new']));
|
||||
html = true;
|
||||
}
|
||||
// localize priority values
|
||||
|
|
|
@ -1004,6 +1004,37 @@ function rcube_libcalendaring(settings)
|
|||
|
||||
////// static methods
|
||||
|
||||
// render HTML code for displaying an attendee record
|
||||
rcube_libcalendaring.attendee_html = function(data)
|
||||
{
|
||||
var name, tooltip = '', context = 'libcalendaring',
|
||||
dispname = data.name || data.email,
|
||||
status = data.role == 'ORGANIZER' ? 'ORGANIZER' : data.status;
|
||||
|
||||
if (status)
|
||||
status = status.toLowerCase();
|
||||
|
||||
if (data.email) {
|
||||
tooltip = data.email;
|
||||
name = $('<a>').attr({href: 'mailto:' + data.email, 'class': 'mailtolink', 'data-cutype': data.cutype})
|
||||
|
||||
if (status)
|
||||
tooltip += ' (' + rcmail.gettext('status' + status, context) + ')';
|
||||
}
|
||||
else {
|
||||
name = $('<span>');
|
||||
}
|
||||
|
||||
if (data['delegated-to'])
|
||||
tooltip = rcmail.gettext('delegatedto', context) + data['delegated-to'];
|
||||
else if (data['delegated-from'])
|
||||
tooltip = rcmail.gettext('delegatedfrom', context) + data['delegated-from'];
|
||||
|
||||
return $('<span>').append(
|
||||
$('<span>').attr({'class': 'attendee ' + status, title: tooltip}).append(name.text(dispname))
|
||||
).html();
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -131,6 +131,14 @@ class libcalendaring extends rcube_plugin
|
|||
$this->rc->output->set_env('libcal_settings', $this->load_settings());
|
||||
$this->include_script('libcalendaring.js');
|
||||
$this->include_stylesheet($this->local_skin_path() . '/libcal.css');
|
||||
|
||||
$this->rc->output->add_label(
|
||||
'libcalendaring.itipaccepted', 'libcalendaring.itiptentative', 'libcalendaring.itipdeclined',
|
||||
'libcalendaring.itipdelegated', 'libcalendaring.expandattendeegroup', 'libcalendaring.expandattendeegroupnodata',
|
||||
'libcalendaring.statusorganizer', 'libcalendaring.statusaccepted', 'libcalendaring.statusdeclined',
|
||||
'libcalendaring.statusdelegated', 'libcalendaring.statusunknown', 'libcalendaring.statusneeds-action',
|
||||
'libcalendaring.statustentative'
|
||||
);
|
||||
}
|
||||
|
||||
if ($args['task'] == 'mail') {
|
||||
|
|
|
@ -88,6 +88,14 @@ $labels['dayofmonth'] = 'Day of month';
|
|||
$labels['addrdate'] = 'Add repeat date';
|
||||
$labels['except'] = 'except';
|
||||
|
||||
$labels['statusorganizer'] = 'Organizer';
|
||||
$labels['statusaccepted'] = 'Accepted';
|
||||
$labels['statustentative'] = 'Tentative';
|
||||
$labels['statusdeclined'] = 'Declined';
|
||||
$labels['statusdelegated'] = 'Delegated';
|
||||
$labels['statusneeds-action'] = 'Needs action';
|
||||
$labels['statusunknown'] = 'Unknown';
|
||||
|
||||
// itip related labels
|
||||
$labels['itipinvitation'] = 'Invitation to';
|
||||
$labels['itipupdate'] = 'Update of';
|
||||
|
|
|
@ -2053,7 +2053,7 @@ function rcube_tasklist_ui(settings)
|
|||
rsvp = mystatus;
|
||||
}
|
||||
|
||||
line = task_attendee_html(data);
|
||||
line = rcube_libcalendaring.attendee_html(data);
|
||||
|
||||
if (morelink)
|
||||
overflow += line;
|
||||
|
@ -2107,7 +2107,7 @@ function rcube_tasklist_ui(settings)
|
|||
$('#task-rsvp .itip-reply-comment textarea').hide().val('');
|
||||
|
||||
if (rec.organizer && !organizer) {
|
||||
$('#task-organizer').show().children('.task-text').html(task_attendee_html($.extend(rec.organizer, { role:'ORGANIZER' })));
|
||||
$('#task-organizer').show().children('.task-text').html(rcube_libcalendaring.attendee_html($.extend(rec.organizer, { role:'ORGANIZER' })));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2163,24 +2163,6 @@ function rcube_tasklist_ui(settings)
|
|||
me.dialog_resize($dialog.get(0), $dialog.height(), 580);
|
||||
}
|
||||
|
||||
// render HTML code for displaying an attendee record
|
||||
function task_attendee_html(data)
|
||||
{
|
||||
var dispname = Q(data.name || data.email), tooltip = '';
|
||||
|
||||
if (data.email) {
|
||||
tooltip = data.email;
|
||||
dispname = '<a href="mailto:' + data.email + '" class="mailtolink" data-cutype="' + data.cutype + '">' + dispname + '</a>';
|
||||
}
|
||||
|
||||
if (data['delegated-to'])
|
||||
tooltip = rcmail.gettext('delegatedto', 'tasklist') + data['delegated-to'];
|
||||
else if (data['delegated-from'])
|
||||
tooltip = rcmail.gettext('delegatedfrom', 'tasklist') + data['delegated-from'];
|
||||
|
||||
return '<span class="attendee ' + String(data.role == 'ORGANIZER' ? 'organizer' : data.status).toLowerCase() + '" title="' + Q(tooltip) + '">' + dispname + '</span> ';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -2285,8 +2267,8 @@ function rcube_tasklist_ui(settings)
|
|||
}
|
||||
// format attendees struct
|
||||
else if (prop == 'attendees') {
|
||||
if (change['old']) change.old_ = task_attendee_html(change['old']);
|
||||
if (change['new']) change.new_ = task_attendee_html($.extend({}, change['old'] || {}, change['new']));
|
||||
if (change['old']) change.old_ = rcube_libcalendaring.attendee_html(change['old']);
|
||||
if (change['new']) change.new_ = rcube_libcalendaring.attendee_html($.extend({}, change['old'] || {}, change['new']));
|
||||
html = true;
|
||||
}
|
||||
// localize status
|
||||
|
|
|
@ -1472,7 +1472,7 @@ class tasklist extends rcube_plugin
|
|||
$this->rc->output->set_env('autocomplete_threads', (int)$this->rc->config->get('autocomplete_threads', 0));
|
||||
$this->rc->output->set_env('autocomplete_max', (int)$this->rc->config->get('autocomplete_max', 15));
|
||||
$this->rc->output->set_env('autocomplete_min_length', $this->rc->config->get('autocomplete_min_length'));
|
||||
$this->rc->output->add_label('autocompletechars', 'autocompletemore', 'delete', 'close', 'libcalendaring.expandattendeegroup', 'libcalendaring.expandattendeegroupnodata');
|
||||
$this->rc->output->add_label('autocompletechars', 'autocompletemore', 'delete', 'close');
|
||||
|
||||
$this->rc->output->set_pagetitle($this->gettext('navtitle'));
|
||||
$this->rc->output->send('tasklist.mainview');
|
||||
|
|
Loading…
Add table
Reference in a new issue