fixed 12 am/pm problem and added defaultfilter preference

This commit is contained in:
skeeter 2000-12-14 02:37:58 +00:00
parent 42acd6d40e
commit 3abcd4897c
8 changed files with 64 additions and 28 deletions

View File

@ -89,7 +89,7 @@
$phpgw->template->set_var("small_calendar",$phpgw->calendar->pretty_small_calendar($now["day"],$now["month"],$now["year"],"day.php"));
if (!$friendly) {
$param = "year=".$now["year"]."&month=".$now["month"]."&day=".$now["day"]."&friendly=1";
$param = "year=".$now["year"]."&month=".$now["month"]."&day=".$now["day"]."&friendly=1&filter=".$filter;
$phpgw->template->set_var("print","<a href=\"".$phpgw->link($PHP_SELF,$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang("Generate printer-friendly version")."'\">[".lang("Printer Friendly")."]</A>");
$phpgw->template->parse("out","day_t");
$phpgw->template->pparse("out","day_t");

View File

@ -57,9 +57,30 @@
if(!$participating && count($cal_info->participants) == 1) {
$cal_info->owner = $cal_info->participants[0];
}
if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
if ($cal_info->ampm == "pm" && $cal_info->hour <> 12) {
$cal_info->hour += 12;
}
if ($cal_info->end_ampm == "pm" && $cal_info->end_hour <> 12) {
$cal_info->end_hour += 12;
}
}
$cal_info->datetime = mktime($cal_info->hour,$cal_info->minute,0,$cal_info->month,$cal_info->day,$cal_info->year) - ((60 * 60) * $phpgw_info["user"]["preferences"]["common"]["tz_offset"]);
$cal_info->edatetime = mktime($cal_info->end_hour,$cal_info->end_minute,0,$cal_info->end_month,$cal_info->end_day,$cal_info->end_year) - ((60 * 60) * $phpgw_info["user"]["preferences"]["common"]["tz_offset"]);
$cal_info->rpt_end = mktime(12,0,0,$cal_info->rpt_month,$cal_info->rpt_day,$cal_info->rpt_year) - ((60 * 60) * $phpgw_info["user"]["preferences"]["common"]["tz_offset"]);
$phpgw->common->appsession($cal_info);
$datetime_check = validate($cal_info);
$overlapping_events = $phpgw->calendar->overlap($cal_info->month,$cal_info->day,$cal_info->year,$cal_info->hour,$cal_info->minute,$cal_info->ampm,$cal_info->end_month,$cal_info->end_day,$cal_info->end_year,$cal_info->end_hour,$cal_info->end_minute,$cal_info->end_ampm,$cal_info->participants,$cal_info->owner,$cal_info->id);
if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
if ($cal_info->hour >= 12) {
$cal_info->ampm = "";
}
if ($cal_info->end_hour >= 12) {
$cal_info->end_ampm = "";
}
}
$cal_info->datetime += ((60 * 60) * $phpgw_info["user"]["preferences"]["common"]["tz_offset"]);
$cal_info->edatetime += ((60 * 60) * $phpgw_info["user"]["preferences"]["common"]["tz_offset"]);
$overlapping_events = $phpgw->calendar->overlap($cal_info->datetime,$cal_info->edatetime,$cal_info->participants,$cal_info->groups,$cal_info->owner,$cal_info->id);
} else {
$cal_info = $phpgw->common->appsession();
}
@ -76,13 +97,13 @@
$phpgw->template->set_var("color",$phpgw_info["theme"]["bg_text"]);
$time = $phpgw->calendar->fixtime($cal_info->hour,$cal_info->minute,$cal_info->ampm);
$calendar_overlaps = $phpgw->calendar->getevent($overlapping_events);
$format = $phpgw_info["user"]["preferences"]["common"]["dateformat"] . " - ";
if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
$format = "h:i:s a";
$format .= "h:i:s a";
} else {
$format = "H:i:s";
$format .= "H:i:s";
}
$overlap = "";
@ -94,11 +115,11 @@
$overlap .= "(PRIVATE)";
else
$overlap .= $phpgw->calendar->link_to_entry($cal_over->id,"circle.gif",$cal_over->name);
$overlap .= " (".$phpgw->common->show_date($cal_over->datetime,$format)." - ".$phpgw->common->show_date($cal_over->edatetime,$format).")<br>";
$overlap .= " (".$phpgw->common->show_date($cal_over->datetime)." - ".$phpgw->common->show_date($cal_over->edatetime).")<br>";
}
}
if(strlen($overlap)) {
$phpgw->template->set_var("overlap_text",lang("Your suggested time of <B> x - x </B> conflicts with the following existing calendar entries:",$phpgw->calendar->build_time_for_display($time),$phpgw->calendar->build_time_for_display($phpgw->calendar->addduration($cal_info->hour,$cal_info->minute,$cal_info->ampm,$cal_info->duration))));
$phpgw->template->set_var("overlap_text",lang("Your suggested time of <B> x - x </B> conflicts with the following existing calendar entries:",date($format,$cal_info->datetime),date($format,$cal_info->edatetime)));
$phpgw->template->set_var("overlap_list",$overlap);
} else {
$phpgw->template->set_var("overlap_text","");

View File

@ -6,6 +6,8 @@
if(!isset($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"]))
$phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] = "Sunday";
if(!isset($filter) || !$filter)
$filter = $phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"];
if (isset($date) && strlen($date) > 0) {
$thisyear = substr($date, 0, 4);
$thismonth = substr($date, 4, 2);

View File

@ -78,7 +78,7 @@
$phpgw->template->set_var("small_calendar_next",$phpgw->calendar->pretty_small_calendar($thisday,$next["month"],$next["year"],"day.php"));
$phpgw->template->set_var("large_month",$phpgw->calendar->display_large_month($thismonth,$thisyear,True,$owner));
if (!$friendly) {
$param = "year=".$now["year"]."&month=".$now["month"]."&friendly=1";
$param = "year=".$now["year"]."&month=".$now["month"]."&friendly=1&filter=".$filter;
$phpgw->template->set_var("print","<a href=\"".$phpgw->link($PHP_SELF,$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window."
. "status = '" . lang("Generate printer-friendly version"). "'\">[". lang("Printer Friendly") . "]</a>");
$phpgw->template->parse("out","index_t");

View File

@ -22,6 +22,7 @@
$phpgw->preferences->change($phpgw_info["user"]["account_id"],"workdaystarts","calendar");
$phpgw->preferences->change($phpgw_info["user"]["account_id"],"workdayends","calendar");
$phpgw->preferences->change($phpgw_info["user"]["account_id"],"defaultcalendar","common");
$phpgw->preferences->change($phpgw_info["user"]["account_id"],"defaultfilter","calendar");
if ($mainscreen_showevents) {
$phpgw->preferences->change($phpgw_info["user"]["account_id"],"mainscreen_showevents","calendar");
} else {
@ -123,6 +124,30 @@
</select>
</td>
</tr>
<?php
$tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color);
?>
<tr bgcolor="<?php echo $tr_color; ?>">
<td><?php echo lang("default calendar filter"); ?></td>
<td align="center">
<select name="defaultfilter">
<?php
$selected = array();
$selected[$phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"]] = " selected";
if (! isset($phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"]) || $phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"] == "private") {
$selected["private"] = " selected";
}
?>
<option value="all"<?php echo $selected["all"].">".lang("all"); ?></option>
<option value="private"<?php echo $selected["private"]. ">".lang("private only"); ?></option>
<option value="public"<?php echo $selected["public"].">".lang("global public only"); ?></option>
<option value="group"<?php echo $selected["group"].">".lang("group public only"); ?></option>
<option value="private+public"<?php echo $selected["private+public"].">".lang("private and global public"); ?></option>
<option value="private+group"<?php echo $selected["private+group"].">".lang("private and group public"); ?></option>
<option value="public+group"<?php echo $selected["public+group"].">".lang("global public and group public") ?></option>
</select>
</td>
</tr>
<tr><td align="center"><input type="submit" name="submit" value="<?php echo lang("submit"); ?>"></td></tr>
</table>
</form>

View File

@ -67,8 +67,8 @@
$phpgw->template->parse("output","list",True);
}
$phpgw->template->set_var("field",lang("Date"));
$phpgw->template->set_var("data",$phpgw->common->show_date($cal_info->datetime,$phpgw_info["user"]["preferences"]["common"]["dateformat"]));
$phpgw->template->set_var("field",lang("Start Date/Time"));
$phpgw->template->set_var("data",$phpgw->common->show_date($cal_info->datetime));
$phpgw->template->parse("output","list",True);
// save date so the trailer links are for the same time period
@ -76,23 +76,9 @@
$thismonth = (int)$cal_info->month;
$thisday = (int)$cal_info->day;
if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
$format = "h:i:s a";
} else {
$format = "H:i:s";
}
if(intval($phpgw->common->show_date($cal_info->datetime,"H")) || intval($phpgw->common->show_date($cal_info->datetime,"i"))) {
$phpgw->template->set_var("field",lang("Time"));
$phpgw->template->set_var("data",$phpgw->common->show_date($cal_info->datetime,$format));
$phpgw->template->parse("output","list",True);
}
if(($cal_info->datetime <> $cal_info->edatetime) && (intval($phpgw->common->show_date($cal_info->datetime,"Hi")) <> 0 && intval($phpgw->common->show_date($cal_info->edatetime,"Hi")) <> 2359)) {
$phpgw->template->set_var("field",lang("End Time"));
$phpgw->template->set_var("data",$phpgw->common->show_date($cal_info->edatetime,$format));
$phpgw->template->parse("output","list",True);
}
$phpgw->template->set_var("field",lang("End Date/Time"));
$phpgw->template->set_var("data",$phpgw->common->show_date($cal_info->edatetime));
$phpgw->template->parse("output","list",True);
$phpgw->template->set_var("field",lang("Priority"));
$phpgw->template->set_var("data",$pri[$cal_info->priority]);

View File

@ -116,7 +116,7 @@
$phpgw->template->set_var("week_display",$phpgw->calendar->display_large_week($thisday,$thismonth,$thisyear,true,$owner));
if (!$friendly) {
$param = "year=".$thisyear."&month=".$thismonth."&day=".$thisday."&friendly=1";
$param = "year=".$thisyear."&month=".$thismonth."&day=".$thisday."&friendly=1&filter=".$filter;
$phpgw->template->set_var("print","<a href=\"".$phpgw->link($PHP_SELF,$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window."
. "status = '" . lang("Generate printer-friendly version"). "'\">[". lang("Printer Friendly") . "]</A>");
$phpgw->template->parse("out","week_t");

View File

@ -28,6 +28,8 @@
- Added in a few preformace tweaks that will use serialize() and unserialize() for
preferences, config
- Changed a few of the icons to our news ones.
- Fixed 12 am/pm problem in calendar.
- Added default filter to calendar preferences.
[0.9.7] - Fixed SQL error in tts
- Fixed table locking in admin -> edit account