table.select('tr').invoke('remove');
ev.at.each(function(attendee) {
var tr = new Element('tr'), i;
- this.fbLoading++;
- this.doAction('GetFreeBusy',
- { email: attendee.e },
- function(r) {
- this.fbLoading--;
- if (!this.fbLoading) {
- $('kronolithFBLoading').hide();
- }
- if (Object.isUndefined(r.response.fb)) {
- return;
- }
- this.freeBusy.set(attendee.e, [ tr, r.response.fb ]);
- this.insertFreeBusy(attendee.e);
- }.bind(this));
- tr.insert(new Element('td').writeAttribute('title', attendee.l).insert(attendee.e.escapeHTML()));
+ if (attendee.e) {
+ this.fbLoading++;
+ this.doAction('GetFreeBusy',
+ { email: attendee.e },
+ function(r) {
+ this.fbLoading--;
+ if (!this.fbLoading) {
+ $('kronolithFBLoading').hide();
+ }
+ if (Object.isUndefined(r.response.fb)) {
+ return;
+ }
+ this.freeBusy.set(attendee.e, [ tr, r.response.fb ]);
+ this.insertFreeBusy(attendee.e);
+ }.bind(this));
+ }
+ tr.insert(new Element('td').writeAttribute('title', attendee.l).insert(attendee.e ? attendee.e.escapeHTML() : attendee.l));
for (i = 0; i < 24; i++) {
tr.insert(new Element('td', { className: 'kronolithFBUnknown' }));
}
/**
* Inserts rows with free/busy information into the attendee table.
*
+ * @todo Update when changing dates; only show free time for fb times we
+ * actually received.
+ *
* @param string email An email address as the free/busy identifier.
*/
insertFreeBusy: function(email)
var fb = this.freeBusy.get(email)[1],
tr = this.freeBusy.get(email)[0],
td = tr.select('td')[1],
- div = td.down('div');
+ div = td.down('div'),
+ i = 0;
if (!td.getWidth()) {
this.insertFreeBusy.bind(this, email).defer();
return;
}
tr.select('td').each(function(td, i) {
if (i != 0) {
- td.addClassName('kronolithFBFree');
+ td.className = 'kronolithFBFree';
}
+ i++;
});
if (div) {
div.remove();
if ($this->attendees) {
$attendees = array();
foreach ($this->attendees as $email => $info) {
- $attendees[] = array('e' => $email,
- 'l' => empty($info['name']) ? $email : ($info['name'] . ' <' . $email . '>'),
- 'a' => $info['attendance'],
- 'r' => $info['response']);
+ $attendee = array('a' => $info['attendance'],
+ 'r' => $info['response'],
+ 'l' => empty($info['name']) ? $email : Horde_Mime_Address::trimAddress($info['name'] . (strpos($email, '@') === false ? '' : ' <' . $email . '>')));
+ if (strpos($email, '@') !== false) {
+ $attendee['e'] = $email;
+ }
+ $attendees[] = $attendee;
}
$json->at = $attendees;
}
function toJson($fb)
{
$json = new stdClass;
- $json->e = $fb->getEmail();
$start = $fb->getStart();
if ($start) {
$start = new Horde_Date($start);
$json->s = $start->dateString();
}
- $end = $fb->getStart();
+ $end = $fb->getEnd();
if ($end) {
$end = new Horde_Date($end);
$json->e = $end->dateString();