Calendar recurrence horizont configurable; fix recur_enddate issue

This commit is contained in:
Jörg Lehrke 2010-05-03 16:43:42 +00:00
parent 587439511d
commit ec48d32681
3 changed files with 29 additions and 16 deletions

View File

@ -25,8 +25,13 @@
<td>{lang_Timeout_for_application_session_data_in_seconds_(default_86400_=_1_day)}:</td>
<td><input size="8" name="newsettings[sessions_app_timeout]" value="{value_sessions_app_timeout}"></td>
</tr>
<tr class="row_off">
<td>{lang_Calendar_recurrence_horizont_in_days_(default_1000)}:</td>
<td><input size="5" name="newsettings[calendar_horizont]" value="{value_calendar_horizont}"></td>
</tr>
<tr class="row_on">
<td>{lang_Would_you_like_to_show_each_application's_upgrade_status_?}:</td><td>
<select name="newsettings[checkappversions]">
<option value="">{lang_No}</option>
@ -36,7 +41,7 @@
</td>
</tr>
<tr class="row_on">
<tr class="row_off">
<td>{lang_Would_you_like_to_automaticaly_load_new_langfiles_(at_login-time)_?}:</td>
<td>
<select name="newsettings[disable_autoload_langfiles]">
@ -46,7 +51,7 @@
</td>
</tr>
<tr class="row_off">
<tr class="row_on">
<td>{lang_Should_the_login_page_include_a_language_selectbox_(useful_for_demo-sites)_?}:</td>
<td>
<select name="newsettings[login_show_language_selection]">
@ -56,7 +61,7 @@
</td>
</tr>
<tr class="row_on">
<tr class="row_off">
<td>{lang_How_should_EMail_addresses_for_new_users_be_constructed?}:</td>
<td>
<select name="newsettings[email_address_format]">
@ -75,7 +80,7 @@
</td>
</tr>
<tr class="row_off">
<tr class="row_on">
<td>{lang_Enter_the_VFS-Path_where_additional_images,_icons_or_logos_can be_placed_(and_found_by_EGroupwares_applications)._The_path_MUST_start_with_/,and_be_readable_by_all_users}:</td>
<td><input name="newsettings[vfs_image_dir]" value="{value_vfs_image_dir}"></td>
</tr>

View File

@ -622,16 +622,21 @@ class calendar_bo
}
$new_horizont = $this->date2ts($new_horizont,true); // now we are in server-time, where this function operates
if ($new_horizont > time()+1000*DAY_s) // some user tries to "look" more then 1000 days in the future
{
if ($this->debug == 'check_move_horizont') $this->debug_message('bocal::check_move_horizont(%1) horizont=%2 new horizont more then 1000 days from now --> ignoring it',true,$new_horizont,$this->config['horizont']);
return;
}
if ($new_horizont <= $this->config['horizont']) // no move necessary
{
if ($this->debug == 'check_move_horizont') $this->debug_message('bocal::check_move_horizont(%1) horizont=%2 is bigger ==> nothing to do',true,$new_horizont,$this->config['horizont']);
return;
}
if (!empty($GLOBALS['egw_info']['server']['calendar_horizont']))
{
$maxdays = abs($GLOBALS['egw_info']['server']['calendar_horizont']);
}
if (empty($maxdays)) $maxdays = 1000; // old default
if ($new_horizont > time()+$maxdays*DAY_s) // some user tries to "look" more then the maximum number of days in the future
{
if ($this->debug == 'check_move_horizont') $this->debug_message('bocal::check_move_horizont(%1) horizont=%2 new horizont more then 1000 days from now --> ignoring it',true,$new_horizont,$this->config['horizont']);
$new_horizont = time()+$maxdays*DAY_s;
}
if ($new_horizont < time()+31*DAY_s)
{
$new_horizont = time()+31*DAY_s;
@ -747,10 +752,13 @@ class calendar_bo
$time = new egw_time($event['recurrence'], egw_time::$server_timezone);
$time =& $this->so->startOfDay($time, $event['tzid']);
$event['recurrence'] = egw_time::to($time, $date_format);
$time = new egw_time($event['recur_enddate'], egw_time::$server_timezone);
$time =& $this->so->startOfDay($time, $event['tzid']);
$time->setTime(23, 59, 59);
$event['recur_enddate'] = egw_time::to($time, $date_format);
if (!empty($event['recur_enddate']))
{
$time = new egw_time($event['recur_enddate'], egw_time::$server_timezone);
$time =& $this->so->startOfDay($time, $event['tzid']);
$time->setTime(23, 59, 59);
$event['recur_enddate'] = egw_time::to($time, $date_format);
}
$timestamps = array('modified','created');
}
else

View File

@ -405,7 +405,7 @@ class calendar_so
switch($filter)
{
case 'showonlypublic':
$where[] = "cal_public=1";
$where[] = 'cal_public=1';
$where[] = "cal_status != 'R'"; break;
case 'deleted':
$where[] = 'cal_deleted='.$this->db->quote(true,'bool');
@ -2116,7 +2116,7 @@ ORDER BY cal_user_type, cal_usre_id
*
* @return DateTime
*/
function &startOfDay(egw_time $time, $tz_id)
function &startOfDay(egw_time $time, $tz_id=null)
{
if (empty($tz_id))
{