Improve "send invitation" checkboxes handling/look (#1790)

This commit is contained in:
Aleksander Machniak 2014-07-10 13:33:53 +02:00
parent 2cee869c67
commit 31bd34c5f4
3 changed files with 47 additions and 11 deletions

View file

@ -675,10 +675,20 @@ function rcube_calendar_ui(settings)
var load_attendees_tab = function()
{
var j, data, reply_selected = 0;
if (event.attendees) {
for (var j=0; j < event.attendees.length; j++)
add_attendee(event.attendees[j], !allow_invitations);
for (j=0; j < event.attendees.length; j++) {
data = event.attendees[j];
add_attendee(data, !allow_invitations);
if (allow_invitations && data.role != 'ORGANIZER' && !data.noreply)
reply_selected++;
}
}
// make sure comment box is visible if at least one attendee has reply enabled
// or global "send invitations" checkbox is checked
if (reply_selected || $('#edit-attendees-invite:checked').length)
$('p.attendees-commentbox').show();
// select the correct organizer identity
var identity_id = 0;
@ -772,6 +782,7 @@ function rcube_calendar_ui(settings)
if (v.role != 'ORGANIZER') {
if ($('input.edit-attendee-reply[value="' + v.email + '"]').prop('checked')) {
need_invitation = true;
delete data.attendees[i]['noreply'];
}
else {
data.attendees[i].noreply = 1;
@ -1570,7 +1581,8 @@ function rcube_calendar_ui(settings)
var tooltip = data.status || '';
// send invitation checkbox
var invbox = '<input type="checkbox" class="edit-attendee-reply" value="' + Q(data.email) +'" checked="checked" title="' + Q(rcmail.gettext('calendar.sendinvitations')) + '" />';
var invbox = '<input type="checkbox" class="edit-attendee-reply" value="' + Q(data.email) +'" title="' + Q(rcmail.gettext('calendar.sendinvitations')) + '" '
+ (!data.noreply ? 'checked="checked" ' : '') + '/>';
if (data['delegated-to'])
tooltip = rcmail.gettext('delegatedto', 'calendar') + data['delegated-to'];
@ -1581,7 +1593,8 @@ function rcube_calendar_ui(settings)
'<td class="name">' + dispname + '</td>' +
'<td class="availability"><img src="./program/resources/blank.gif" class="availabilityicon ' + avail + '" data-email="' + data.email + '" alt="" /></td>' +
'<td class="confirmstate"><span class="' + String(data.status).toLowerCase() + '" title="' + Q(tooltip) + '">' + Q(data.status || '') + '</span></td>' +
'<td class="options">' + (organizer || readonly ? '' : dellink + invbox) + '</td>';
(data.cutype != 'RESOURCE' ? '<td class="sendmail">' + (organizer || readonly || !invbox ? '' : invbox) + '</td>' : '') +
'<td class="options">' + (organizer || readonly ? '' : dellink) + '</td>';
var table = rcmail.env.calendar_resources && data.cutype == 'RESOURCE' ? resources_list : attendees_list;
var tr = $('<tr>')
@ -1591,6 +1604,10 @@ function rcube_calendar_ui(settings)
tr.find('a.deletelink').click({ id:(data.email || data.name) }, function(e) { remove_attendee(this, e.data.id); return false; });
tr.find('a.mailtolink').click(event_attendee_click);
tr.find('input.edit-attendee-reply').click(function() {
var enabled = $('#edit-attendees-invite:checked').length || $('input.edit-attendee-reply:checked').length;
$('p.attendees-commentbox')[enabled ? 'show' : 'hide']();
});
// select organizer identity
if (data.identity_id)

View file

@ -693,11 +693,19 @@ class calendar_ui
*/
function attendees_list($attrib = array())
{
$table = new html_table(array('cols' => 5, 'border' => 0, 'cellpadding' => 0, 'class' => 'rectable'));
// add "noreply" checkbox to attendees table only
$invitations = strpos($attrib['id'], 'attend') !== false;
$invite = new html_checkbox(array('value' => 1, 'id' => 'edit-attendees-invite'));
$table = new html_table(array('cols' => 5 + intval($invitations), 'border' => 0, 'cellpadding' => 0, 'class' => 'rectable'));
$table->add_header('role', $this->cal->gettext('role'));
$table->add_header('name', $this->cal->gettext($attrib['coltitle'] ?: 'attendee'));
$table->add_header('availability', $this->cal->gettext('availability'));
$table->add_header('confirmstate', $this->cal->gettext('confirmstate'));
if ($invitations) {
$table->add_header(array('class' => 'sendmail', 'title' => $this->cal->gettext('sendinvitations')), $invite->show(1));
}
$table->add_header('options', '');
return $table->show($attrib);
@ -709,12 +717,10 @@ class calendar_ui
function attendees_form($attrib = array())
{
$input = new html_inputfield(array('name' => 'participant', 'id' => 'edit-attendee-name', 'size' => 30));
$checkbox = new html_checkbox(array('name' => 'invite', 'id' => 'edit-attendees-invite', 'value' => 1));
$textarea = new html_textarea(array('name' => 'comment', 'id' => 'edit-attendees-comment',
'rows' => 4, 'cols' => 55, 'title' => $this->cal->gettext('itipcommenttitle')));
return html::div($attrib,
html::p('attendees-invitebox', html::label(null, $this->cal->gettext('sendinvitations') . $checkbox->show(1))) .
html::div(null, $input->show() . " " .
html::tag('input', array('type' => 'button', 'class' => 'button', 'id' => 'edit-attendee-add', 'value' => $this->cal->gettext('addattendee'))) . " " .
html::tag('input', array('type' => 'button', 'class' => 'button', 'id' => 'edit-attendee-schedule', 'value' => $this->cal->gettext('scheduletime').'...'))) .

View file

@ -865,10 +865,22 @@ td.topalign {
.edit-attendees-table th.options,
.edit-attendees-table td.options {
width: 40px;
width: 16px;
padding: 2px 4px;
}
.edit-attendees-table th.sendmail,
.edit-attendees-table td.sendmail {
width: 50px;
padding: 2px;
}
.edit-attendees-table th.sendmail {
background-image: url(../../../../skins/larry/images/buttons.png);
background-position: 20px 4px;
background-repeat: no-repeat;
}
.edit-attendees-table th.name,
.edit-attendees-table td.name {
width: auto;
@ -893,7 +905,7 @@ td.topalign {
#edit-attendees-form,
#edit-resources-form {
position: relative;
margin-top: 3px;
margin-top: 15px;
}
#edit-attendees-form .attendees-invitebox {
@ -912,7 +924,8 @@ td.topalign {
}
#edit-attendees-form #edit-attendee-schedule {
margin-left: 20px;
position: absolute;
right: 0;
}
.edit-attendees-table select.edit-attendee-role {