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

This commit is contained in:
Aleksander Machniak (Kolab Systems) 2011-06-18 21:10:35 +02:00
commit e23dfba50b
3 changed files with 92 additions and 6 deletions

View file

@ -120,6 +120,7 @@ class kolab_calendar
$events = array();
foreach ($this->events as $id => $event) {
// TODO: filter events by search query
if (!empty($search)) {
}
@ -338,13 +339,16 @@ class kolab_calendar
);
}
/**
/**
* Convert the given event record into a data structure that can be passed to Kolab_Storage backend for saving
* (opposite of self::_to_rcube_event())
*/
private function _from_rcube_event($event)
{
$priority_map = $this->priority_map;
$daymap = array('MO'=>'monday','TU'=>'tuesday','WE'=>'wednesday','TH'=>'thursday','FR'=>'friday','SA'=>'saturday','SU'=>'sunday');
$object = array
(
// kolab => roundcube
@ -356,7 +360,7 @@ class kolab_calendar
'end-date'=>$event['end'],
'sensitivity'=>$this->sensitivity_map[$event['sensitivity']],
'show-time-as' => $event['free_busy'],
'priority' => $this->priority_map[$event['priority']]
'priority' => isset($priority_map[$event['priority']]) ? $priority_map[$event['priority']] : 1
);
@ -383,9 +387,71 @@ class kolab_calendar
$object['alarm'] = $avalue;
}
}
//recurr object/array
if (count($event['recurrence'])>1){
$ra = $event['recurrence'];
//Frequency abd interval
$object['recurrence']['cycle'] = strtolower($ra['FREQ']);
$object['recurrence']['interval'] = intval($ra['INTERVAL']);
//Range Type
if($ra['UNTIL']){
$object['recurrence']['range-type']='date';
$object['recurrence']['range']=$ra['UNTIL'];
}
if($ra['COUNT']){
$object['recurrence']['range-type']='number';
$object['recurrence']['range']=$ra['COUNT'];
}
//weekly
if ($ra['FREQ']=='WEEKLY'){
$weekdays = split(",",$ra['BYDAY']);
foreach ($weekdays as $days){
$weekly[]=$daymap[$days];
}
$object['recurrence']['day']=$weekly;
}
//monthly (temporary hack to follow current Horde logic)
if ($ra['FREQ']=='MONTHLY'){
if($ra['BYDAY']=='NaN'){
$object['recurrence']['daynumber']=1;
$object['recurrence']['day']=array(date('L',$event['start']));
$object['recurrence']['cycle']='monthly';
$object['recurrence']['type']='weekday';
}
else {
$object['recurrence']['daynumber']=date('j',$event['start']);
$object['recurrence']['cycle']='monthly';
$object['recurrence']['type']="daynumber";
}
}
//year
//exclusion
$object['recurrence']['type']=array(split(',',$ra['UNTIL']));
}
//whole dday event
if($event['allday']==1)
$object['_is_all_day']=1;
return $object;
}

View file

@ -311,7 +311,7 @@ class calendar_ui
$select->add($this->calendar->gettext('daily'), 'DAILY');
$select->add($this->calendar->gettext('weekly'), 'WEEKLY');
$select->add($this->calendar->gettext('monthly'), 'MONTHLY');
$select->add($this->calendar->gettext('yearly'), 'YEARLY');
// $select->add($this->calendar->gettext('yearly'), 'YEARLY');
$html = html::label('edit-frequency', $this->calendar->gettext('frequency')) . $select->show('');
break;
@ -341,7 +341,23 @@ class calendar_ui
$select = $this->interval_selector(array('name' => 'interval', 'class' => 'edit-recurrence-interval', 'id' => 'edit-recurrence-interval-monthly'));
$html = html::div($attrib, html::label(null, $this->calendar->gettext('every')) . $select->show(1) . html::span('label-after', $this->calendar->gettext('months')));
// day of month selection
$checkbox = new html_checkbox(array('name' => 'bymonthday', 'class' => 'edit-recurrence-monthly-bymonthday'));
//hidden fields to emulate user selection:
$input_bymonthday = new html_hiddenfield(array('name' => 'bymonthday', 'value' => 1));
$input_byday = new html_hiddenfield(array('name' => 'byday', 'value' => 1));
$input_bydayp = new html_hiddenfield(array('name' => 'bydayprefix', 'value' => 1));
$radio = new html_radiobutton(array('name' => 'repeatmode', 'class' => 'edit-recurrence-monthly-mode'));
$table = new html_table(array('cols' => 2, 'border' => 0, 'cellpadding' => 0, 'class' => 'formtable'));
$table->add('label', html::label(null, $radio->show('', array('value' => 'BYDAY')) . ' ' . $this->calendar->gettext('on_the_same_weekday')));
$table->add('label', html::label(null, $radio->show('', array('value' => 'BYMONTHDAY')) . ' ' . $this->calendar->gettext('on_the_same_date')));
$html .= $input_byday->show();
$html .= $input_bymonthday->show();
$html .= $input_bydayp->show();
$html .= html::div($attrib, $table->show());
/*
$checkbox = new html_radiobutton(array('name' => 'bymonthday', 'class' => 'edit-recurrence-monthly-bymonthday'));
for ($monthdays = '', $d = 1; $d <= 31; $d++) {
$monthdays .= html::label(array('class' => 'monthday'), $checkbox->show('', array('value' => $d)) . $d);
$monthdays .= $d % 7 ? ' ' : html::br();
@ -356,6 +372,7 @@ class calendar_ui
$table->add(null, $this->rrule_selectors($attrib['part']));
$html .= html::div($attrib, $table->show());
*/
break;
// annually recurrence form

View file

@ -58,6 +58,9 @@ $labels['prev_month'] = 'Previous month';
$labels['next_year'] = 'Next year';
$labels['next_month'] = 'Next month';
$labels['choose_date'] = 'Choose date';
$labels['on_the_same_date'] = 'on the same date';
$labels['on_the_same_weekday'] = 'on the same weekday';
// alarm/reminder settings
$labels['alarmemail'] = 'Send E-mail';