plugins/calendar

Aleksander Machniak machniak at kolabsys.com
Thu Jul 10 13:34:23 CEST 2014


 plugins/calendar/calendar_ui.js           |   25 +++++++++++++++++++++----
 plugins/calendar/lib/calendar_ui.php      |   14 ++++++++++----
 plugins/calendar/skins/larry/calendar.css |   19 ++++++++++++++++---
 3 files changed, 47 insertions(+), 11 deletions(-)

New commits:
commit 31bd34c5f40e2ed025ad327a1fe3b183311496a9
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Thu Jul 10 13:33:53 2014 +0200

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

diff --git a/plugins/calendar/calendar_ui.js b/plugins/calendar/calendar_ui.js
index 44f8479..71134ab 100644
--- a/plugins/calendar/calendar_ui.js
+++ b/plugins/calendar/calendar_ui.js
@@ -675,11 +675,21 @@ 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;
         $.each(settings.identities, function(i,v){
@@ -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)
diff --git a/plugins/calendar/lib/calendar_ui.php b/plugins/calendar/lib/calendar_ui.php
index 635ff53..4d03299 100644
--- a/plugins/calendar/lib/calendar_ui.php
+++ b/plugins/calendar/lib/calendar_ui.php
@@ -693,13 +693,21 @@ 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').'...'))) .
diff --git a/plugins/calendar/skins/larry/calendar.css b/plugins/calendar/skins/larry/calendar.css
index cfba7c1..71f8350 100644
--- a/plugins/calendar/skins/larry/calendar.css
+++ b/plugins/calendar/skins/larry/calendar.css
@@ -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 {




More information about the commits mailing list