Merge branch 'master' of ssh://git.kolabsys.com/git/roundcube

This commit is contained in:
Thomas Bruederli 2011-07-29 09:19:25 +02:00
commit 92b98ef2ec
4 changed files with 54 additions and 10 deletions

View file

@ -1430,7 +1430,7 @@ class calendar extends rcube_plugin
$status = self::FREEBUSY_FREE;
foreach ($fblist as $slot) {
list($from, $to, $type) = $slot;
if ($from <= $t_end && $to > $t) {
if ($from < $t_end && $to > $t) {
$status = isset($type) ? $type : self::FREEBUSY_BUSY;
break;
}

View file

@ -1538,12 +1538,17 @@ function rcube_calendar_ui(settings)
.data('id', id);
}
if (!cal.readonly && !this.selected_calendar && (!settings.default_calendar || settings.default_calendar == id)) {
if (!cal.readonly && !this.selected_calendar) {
this.selected_calendar = id;
rcmail.enable_command('addevent', true);
}
}
// select default calendar
if (settings.default_calendar && this.calendars[settings.default_calendar] && !this.calendars[settings.default_calendar].readonly)
this.selected_calendar = settings.default_calendar;
// initalize the fullCalendar plugin
var fc = $('#calendar').fullCalendar({
header: {

View file

@ -135,10 +135,17 @@ class kolab_addressbook extends rcube_plugin
// Add personal address sources to the list
if ($abook_prio == self::PERSONAL_FIRST) {
$p['sources'] = array_merge($sources, $p['sources']);
// $p['sources'] = array_merge($sources, $p['sources']);
// Don't use array_merge(), because if you have folders name
// that resolve to numeric identifier it will break output array keys
foreach ($p['sources'] as $idx => $value)
$sources[$idx] = $value;
$p['sources'] = $sources;
}
else {
$p['sources'] = array_merge($p['sources'], $sources);
// $p['sources'] = array_merge($p['sources'], $sources);
foreach ($sources as $idx => $value)
$p['sources'][$idx] = $value;
}
return $p;

View file

@ -279,9 +279,19 @@ class rcube_kolab_contacts extends rcube_addressbook
else
$ids = is_array($this->filter['ids']) ? $this->filter['ids'] : array_keys($this->contacts);
// sort data arrays according to desired list sorting
if ($count = count($ids)) {
uasort($this->contacts, array($this, '_sort_contacts_comp'));
// get sorted IDs
if ($count != count($this->contacts))
$ids = array_intersect(array_keys($this->contacts), $ids);
else
$ids = array_keys($this->contacts);
}
// fill contact data into the current result set
$start_row = $subset < 0 ? $this->result->first + $this->page_size + $subset : $this->result->first;
$last_row = min($subset != 0 ? $start_row + abs($subset) : $this->result->first + $this->page_size, count($ids));
$last_row = min($subset != 0 ? $start_row + abs($subset) : $this->result->first + $this->page_size, $count);
for ($i = $start_row; $i < $last_row; $i++) {
if ($id = $ids[$i])
@ -964,9 +974,6 @@ class rcube_kolab_contacts extends rcube_addressbook
$this->contacts[$id] = $contact;
$this->id2uid[$id] = $record['uid'];
}
// sort data arrays according to desired list sorting
uasort($this->contacts, array($this, '_sort_contacts_comp'));
}
}
@ -975,7 +982,32 @@ class rcube_kolab_contacts extends rcube_addressbook
*/
private function _sort_contacts_comp($a, $b)
{
return strcasecmp($a['name'], $b['name']);
$a_name = $a['name'];
$b_name = $b['name'];
if (!$a_name) {
$a_name = join(' ', array_filter(array($a['prefix'], $a['firstname'],
$a['middlename'], $a['surname'], $a['suffix'])));
if (!$a_name) {
$a_name = is_array($a['email']) ? $a['email'][0] : $a['email'];
}
}
if (!$b_name) {
$b_name = join(' ', array_filter(array($b['prefix'], $b['firstname'],
$b['middlename'], $b['surname'], $b['suffix'])));
if (!$b_name) {
$b_name = is_array($b['email']) ? $b['email'][0] : $b['email'];
}
}
// return strcasecmp($a_name, $b_name);
// make sorting unicode-safe and locale-dependent
if ($a_name == $b_name)
return 0;
$arr = array($a_name, $b_name);
sort($arr, SORT_LOCALE_STRING);
return $a_name == $arr[0] ? -1 : 1;
}
/**