diff --git a/calendar/day.php b/calendar/day.php index 2f5774aa21..aaa59e85a7 100644 --- a/calendar/day.php +++ b/calendar/day.php @@ -83,7 +83,7 @@ $phpgw->template->set_var("bg_text",$phpgw_info["theme"]["bg_text"]); $m = mktime(2,0,0,$thismonth,1,$thisyear); - $phpgw->template->set_var("date",lang(strftime("%B",$m))." ".$thisday.", ".$thisyear); + $phpgw->template->set_var("date",lang(date("F",$m))." ".$thisday.", ".$thisyear); $phpgw->template->set_var("username",$phpgw->common->display_fullname($id,$fn,$ln)); $phpgw->template->set_var("daily_events",$phpgw->calendar->print_day_at_a_glance($now,$owner)); $phpgw->template->set_var("small_calendar",$phpgw->calendar->pretty_small_calendar($now["day"],$now["month"],$now["year"],"day.php")); diff --git a/calendar/edit_entry.php b/calendar/edit_entry.php index fdc97194db..a0f89c8e98 100755 --- a/calendar/edit_entry.php +++ b/calendar/edit_entry.php @@ -101,7 +101,7 @@ $phpgw->template->parse("output","list",True); // Date - $phpgw->template->set_var("field",lang("Date")); + $phpgw->template->set_var("field",lang("Start Date")); $day_html = "pm"; } +// End Date $phpgw->template->set_var("data",$str); $phpgw->template->parse("output","list",True); -// Duration - $phpgw->template->set_var("field",lang("Duration")); - $phpgw->template->set_var("data","duration?0:$cal_info->duration)."\"> ".lang("minutes")); + $phpgw->template->set_var("field",lang("End Date")); + + $day_html = ""; + + $month_html = ""; + + $year_html = ""; + + $phpgw->template->set_var("data",$phpgw->common->dateformatorder($year_html,$month_html,$day_html)); + $phpgw->template->parse("output","list",True); + +// End Time + $phpgw->template->set_var("field",lang("End Time")); + + $amsel = "checked"; $pmsel = ""; + if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") { + if ($cal_info->end_ampm == "pm") { + $amsel = ""; $pmsel = "checked"; + } else { + $amsel = "checked"; $pmsel = ""; + } + } + $str = "common->show_date($cal_info->edatetime,"H")."\" maxlength=\"2\">:common->show_date($cal_info->edatetime,"i")."\" maxlength=\"2\">"; + if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") { + $str .= "am"; + $str .= "pm"; + } + + $phpgw->template->set_var("data",$str); $phpgw->template->parse("output","list",True); // Priority diff --git a/calendar/edit_entry_handler.php b/calendar/edit_entry_handler.php index 0a89b1a07c..df11f0048f 100755 --- a/calendar/edit_entry_handler.php +++ b/calendar/edit_entry_handler.php @@ -33,7 +33,7 @@ $cal_info->owner = $cal_info->participants[0]; } $phpgw->common->appsession($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->duration,$cal_info->participants,$cal_info->id); + $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->id); } else { $cal_info = $phpgw->common->appsession(); } @@ -50,6 +50,12 @@ $time = $phpgw->calendar->fixtime($cal_info->hour,$cal_info->minute,$cal_info->ampm); $calendar_overlaps = $phpgw->calendar->getevent($overlapping_events); + if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") { + $format = "h:i:s a"; + } else { + $format = "H:i:s"; + } + $overlap = ""; for($i=0;$icalendar->link_to_entry($cal_over->id,"circle.gif",$cal_over->name); - $disp_start_time = $phpgw->calendar->build_time_for_display($phpgw->calendar->fixtime($cal_over->hour,$cal_over->minute,$cal_over->ampm)); - $disp_stop_time = $phpgw->calendar->build_time_for_display($phpgw->calendar->addduration($cal_over->hour,$cal_over->minute,$cal_over->ampm,$cal_over->duration)); - $overlap .= " (".$disp_start_time." - ".$disp_stop_time.")
"; + $overlap .= " (".$phpgw->common->show_date($cal_over->datetime,$format)." - ".$phpgw->common->show_date($cal_over->edatetime,$format).")
"; } } if(strlen($overlap)) { diff --git a/calendar/inc/header.inc.php b/calendar/inc/header.inc.php index f26d306ba7..f877f6a00c 100644 --- a/calendar/inc/header.inc.php +++ b/calendar/inc/header.inc.php @@ -1,6 +1,7 @@ - +
- + + " method="POST"> + + +
  @@ -58,8 +67,9 @@ /view.gif" alt="" border="0"> -
" method="POST"> + " name="filtermethod" method="POST"> +
+ : @@ -67,12 +77,39 @@ - + + + + +
+ + + + + + + + + + + > "> - -
diff --git a/calendar/index.php b/calendar/index.php index dfb24871c6..ca0db9463d 100755 --- a/calendar/index.php +++ b/calendar/index.php @@ -1,4 +1,3 @@ - db; - $phpgw->db->query("SELECT cal_datetime, cal_mdatetime, cal_id FROM calendar_entry ORDER BY cal_id",__LINE__,__FILE__); + $phpgw->db->query("SELECT cal_datetime, cal_mdatetime, cal_id, cal_owner FROM calendar_entry ORDER BY cal_id",__LINE__,__FILE__); if($phpgw->db->num_rows()) { while($phpgw->db->next_record()) { - $datetime = $phpgw->db->f("cal_datetime") - ((60*60) * $phpgw_info["user"]["preferences"]["common"]["tz_offset"]); - $mdatetime = $phpgw->db->f("cal_mdatetime") - ((60*60) * $phpgw_info["user"]["preferences"]["common"]["tz_offset"]); + $db2->query("SELECT preference_value FROM preferences WHERE preference_name='tz_offset' AND preference_appname='common' AND preference_owner=".$db->("cal_owner"),__LINE__,__FILE__); + $db2->next_record(); + $tz = $db2->f("preference_value"); + $datetime = $phpgw->db->f("cal_datetime") + ((60*60) * $tz); + $mdatetime = $phpgw->db->f("cal_mdatetime") + ((60*60) * $tz); $db2->query("UPDATE calendar_entry SET cal_datetime=".$datetime.", cal_mdatetime=".$mdatetime." WHERE cal_id=".$phpgw->db->f("cal_id"),__LINE__,__FILE__); } } diff --git a/calendar/search.php b/calendar/search.php index d51e520eb1..2a76a21cfc 100755 --- a/calendar/search.php +++ b/calendar/search.php @@ -17,7 +17,7 @@ $phpgw_info["flags"] = array("currentapp" => "calendar", "enable_calendar_class" => True, "enable_nextmatchs_class" => True); if (! $keywords) { - // If we reach this it becuase they didn't search for anything, + // If we reach this, it is because they didn't search for anything, // attempt to send them back to where they where. Header("Location: " . $phpgw->link($from,"date=$datemonth=$month&day=$day&year=$year")); } @@ -46,14 +46,33 @@ . "WHERE " . "(UPPER(calendar_entry.cal_name) LIKE UPPER('%".$words[$i]."%') OR " . " UPPER(calendar_entry.cal_description) LIKE UPPER('%".$words[$i]."%')) AND " - . "calendar_entry_user.cal_id=calendar_entry.cal_id AND " - . "(((calendar_entry_user.cal_login=".$phpgw_info["user"]["account_id"].") AND " - . "(calendar_entry.cal_access='private')) " - . $phpgw->calendar->group_search() - . "OR calendar_entry.cal_access='public') " - . "ORDER BY cal_datetime"; + . "calendar_entry_user.cal_id=calendar_entry.cal_id AND "; - $phpgw->db->query($sql); + $sqlfilter = ""; +// Private + if($phpgw->calendar->filter==" all " || strpos($phpgw->calendar->filter,"private")) { + $sqlfilter .= "(calendar_entry_user.cal_login = ".$phpgw_info["user"]["account_id"]." AND calendar_entry.cal_access='private') "; + } + +// Group Public + if($phpgw->calendar->filter==" all " || strpos($phpgw->calendar->filter,"group")) { + if($sqlfilter) + $sqlfilter .= "OR "; + $sqlfilter .= $phpgw->calendar->group_search($phpgw_info["user"]["account_id"])." "; + } + +// Global Public + if($phpgw->calendar->filter==" all " || strpos($phpgw->calendar->filter,"public")) { + if($sqlfilter) + $sqlfilter .= "OR "; + $sqlfilter .= "calendar_entry.cal_access='public' "; + } + $orderby = " ORDER BY calendar_entry.cal_datetime ASC"; + + if($sqlfilter) $sql .= "(".$sqlfilter.") "; + $sql .= $orderby; + + $phpgw->db->query($sql,__LINE__,__FILE__); while ($phpgw->db->next_record()) { $matches++; $ids[strval( $phpgw->db->f(0) )]++; diff --git a/calendar/templates/default/edit.tpl b/calendar/templates/default/edit.tpl index 38480c5f29..aabd7b9fe1 100755 --- a/calendar/templates/default/edit.tpl +++ b/calendar/templates/default/edit.tpl @@ -23,6 +23,20 @@ function validate_and_submit() { document.addform.minute.focus(); return false; } + h = parseInt(document.addform.end_hour.value); + m = parseInt(document.addform.end_minute.value); + if (h < 0 || h > 23) { + alert ("{time_error}"); + document.addform.end_hour.select(); + document.addform.end_hour.focus(); + return false; + } + if (m < 0 || m > 59) { + alert ("{time_error}"); + document.addform.end_minute.select(); + document.addform.end_minute.focus(); + return false; + } // would be nice to also check date to not allow Feb 31, etc... document.addform.submit(); // return true; diff --git a/calendar/view.php b/calendar/view.php index 3fa3990d85..c5c97b5791 100755 --- a/calendar/view.php +++ b/calendar/view.php @@ -76,20 +76,21 @@ $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")); - if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") { - $format .= "h:i:s a"; - } else { - $format .= "H:i:s"; - } $phpgw->template->set_var("data",$phpgw->common->show_date($cal_info->datetime,$format)); $phpgw->template->parse("output","list",True); } - if ($cal_info->duration > 0) { - $phpgw->template->set_var("field",lang("Duration")); - $phpgw->template->set_var("data",$cal_info->duration." ".lang("minutes")); + 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); } diff --git a/doc/CHANGELOG b/doc/CHANGELOG index d81c002a94..6cd756d4aa 100755 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -34,6 +34,8 @@ - Fix possible problem connecting to LDAP server. - Fix home page display of calendar events. - Added ability to set users defaut calendar view of top icon. + - Changed calednar duration to a true date/time. + - Added ability to filter calendar events based on access. [0.9.6] - Fix user permissions where not being checked properly. diff --git a/setup/inc/functions.inc.php b/setup/inc/functions.inc.php index 2073b3e136..8f13922b42 100644 --- a/setup/inc/functions.inc.php +++ b/setup/inc/functions.inc.php @@ -225,7 +225,8 @@ echo "\n"; echo "\n"; echo ''; - }elseif ($stage == 2.5) { + } + if ($stage == 2.5) { echo 'O'; echo "\n"; echo " \n"; diff --git a/setup/sql/mysql_newtables.inc.php b/setup/sql/mysql_newtables.inc.php index 5b419e817b..52e7fd36fa 100644 --- a/setup/sql/mysql_newtables.inc.php +++ b/setup/sql/mysql_newtables.inc.php @@ -179,7 +179,7 @@ cal_group varchar(255), cal_datetime int(11), cal_mdatetime int(11), - cal_duration int(11) DEFAULT '0' NOT NULL, + cal_duration int(11), cal_priority int(11) DEFAULT '2' NOT NULL, cal_type varchar(10), cal_access varchar(10), diff --git a/setup/sql/mysql_upgrade_beta.inc.php b/setup/sql/mysql_upgrade_beta.inc.php index ad8e23eb80..8f1cb607fa 100644 --- a/setup/sql/mysql_upgrade_beta.inc.php +++ b/setup/sql/mysql_upgrade_beta.inc.php @@ -686,6 +686,28 @@ update_version_table(); } + if ($currentver == "0.9.7pre2") { + $db2 = $db; + $sql = "ALTER TABLE calendar_entry CHANGE cal_duration cal_edatetime int(11)"; + $db->query($sql,__LINE__,__FILE__); + + $db->query("SELECT cal_id,cal_datetime,cal_owner,cal_edatetime,cal_mdatetime FROM calendar_entry ORDER BY cal_id",__LINE__,__FILE__); + if($db->num_rows()) { + while($db->next_record()) { + $db2->query("SELECT preference_value FROM preferences WHERE preference_name='tz_offset' AND preference_appname='common' AND preference_owner=".$db->("cal_owner"),__LINE__,__FILE__); + $db2->next_record(); + $tz = $db2->f("preference_value"); + $cal_id = $db->f("cal_id"); + $datetime = $db->f("cal_datetime") - ((60 * 60) * $tz); + $mdatetime = $db->f("cal_mdatetime") - ((60 * 60) * $tz); + $edatetime = $datetime + (60 * $db->f("cal_edatetime")); + $db2->query("UPDATE calendar_entry SET cal_datetime=".$datetime.", cal_edatetime=".$edatetime.", cal_mdatetime=".$mdatetime." WHERE cal_id=".$cal_id,__LINE__,__FILE__); + } + } + $currentver = "0.9.7pre3"; + update_version_table(); + } + if ($oldversion != $currentver){ echo " \n"; diff --git a/setup/sql/pgsql_newtables.inc.php b/setup/sql/pgsql_newtables.inc.php index fec3ba0081..8a6cb222d4 100644 --- a/setup/sql/pgsql_newtables.inc.php +++ b/setup/sql/pgsql_newtables.inc.php @@ -157,7 +157,7 @@ cal_group varchar(255), cal_datetime int4, cal_mdatetime int4, - cal_duration int DEFAULT 0 NOT NULL, + cal_edatetime int4, cal_priority int DEFAULT 2, cal_type varchar(10), cal_access varchar(10), @@ -265,4 +265,4 @@ $currentver = "0.9.7pre2"; $oldversion = $currentver; update_version_table(); -?> \ No newline at end of file +?> diff --git a/setup/sql/pgsql_upgrade_beta.inc.php b/setup/sql/pgsql_upgrade_beta.inc.php index 4df43760ee..95fc934e33 100644 --- a/setup/sql/pgsql_upgrade_beta.inc.php +++ b/setup/sql/pgsql_upgrade_beta.inc.php @@ -679,6 +679,54 @@ update_version_table(); } + if ($currentver == "0.9.7pre2") { + $db2 = $db; + $sql = "CREATE TABLE TEMP AS SELECT * FROM calendar_entry"; + $db->query($sql,__LINE__,__FILE__); + + $sql = "DROP TABLE calendar_entry"; + $db->query($sql,__LINE__,__FILE__); + + $sql = "CREATE TABLE calendar_entry ( + cal_id serial, + cal_owner int DEFAULT 0 NOT NULL, + cal_group varchar(255) NULL, + cal_datetime int4, + cal_mdatetime int4, + cal_edatetime int4, + cal_priority int DEFAULT 2, + cal_type varchar(10), + cal_access varchar(10), + cal_name varchar(80) NOT NULL, + cal_description text)"; + $db->query($sql,__LINE__,__FILE__); + $db->query("SELECT cal_id,cal_owner,cal_group,cal_datetime,cal_mdatetime,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description FROM TEMP ORDER BY cal_id",__LINE__,__FILE__); + while($db->next_record()) { + $db2->query("SELECT preference_value FROM preferences WHERE preference_name='tz_offset' AND preference_appname='common' AND preference_owner=".$db->f("cal_owner"),__LINE__,__FILE__); + $db2->next_record(); + $tz = $db2->f("preference_value"); + $cal_id = $db->f("cal_id"); + $cal_owner = $db->f("cal_owner"); + $cal_group = $db->f("cal_group"); + $cal_datetime = $db->f("cal_datetime") - ((60 * 60) * $tz); + $cal_mdatetime = $db->f("cal_mdatetime") - ((60 * 60) * $tz); + $cal_edatetime = $cal_datetime + (60 * $db->f("cal_duration")); + $cal_priority = $db->f("cal_priority"); + $cal_type = $db->f("cal_type"); + $cal_access = $db->f("cal_access"); + $cal_name = $db->f("cal_name"); + $cal_description = $db->f("cal_description"); + $db2->query("INSERT INTO calendar_entry(cal_id,cal_owner,cal_group,cal_datetime,cal_mdatetime,cal_edatetime,cal_priority,cal_type,cal_access,cal_name,cal_description) VALUES(".$cal_id.",".$cal_owner.",'".$cal_group."',".cal_datetime.",".$cal_mdatetime.",".$cal_edatetime.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')",__LINE__,__FILE__); + } + } + + $sql = "DROP TABLE TEMP"; + $db->query($sql,__LINE__,__FILE__); + + $currentver = "0.9.7pre3"; + update_version_table(); + } + if ($oldversion != $currentver){ echo " \n"; diff --git a/version.inc.php b/version.inc.php index 91d0787646..eddb02c559 100644 --- a/version.inc.php +++ b/version.inc.php @@ -11,5 +11,5 @@ /* $Id$ */ - $phpgw_info["server"]["version"] = "0.9.7pre2"; + $phpgw_info["server"]["version"] = "0.9.7pre3"; $phpgw_info["server"]["current_header_version"] = "1.4";
 $subtitle
\n"; echo "
\n"; echo "