Changing the interface for monthly reccurences + adding functionality to handle it.
This commit is contained in:
parent
a08a91e8bb
commit
dd5e0e7d98
3 changed files with 53 additions and 3 deletions
|
@ -345,7 +345,8 @@ class kolab_calendar
|
|||
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
|
||||
|
@ -404,7 +405,7 @@ class kolab_calendar
|
|||
//weekly
|
||||
|
||||
if ($ra['FREQ']=='WEEKLY'){
|
||||
$daymap = array('MO'=>'monday','TU'=>'tuesday','WE'=>'wednesday','TH'=>'thursday','FR'=>'friday','SA'=>'saturday','SU'=>'sunday');
|
||||
|
||||
$weekdays = split(",",$ra['BYDAY']);
|
||||
foreach ($weekdays as $days){
|
||||
$weekly[]=$daymap[$days];
|
||||
|
@ -413,8 +414,37 @@ class kolab_calendar
|
|||
$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
|
||||
if ($ra['FREQ']=='YEARLY'){
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//exclusion
|
||||
$object['recurrence']['type']=array(split(',',$ra['UNTIL']));
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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';
|
||||
|
|
Loading…
Add table
Reference in a new issue