5 * Copyright (c) 2001 Michal Szczotka <michal@tuxy.org>
6 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 * Functions to edit an event.
13 require_once('calendar_data.php');
14 require_once('functions.php');
16 require_once('../src/validate.php');
17 require_once('../functions/strings.php');
18 require_once('../functions/date.php');
19 require_once('../config/config.php');
20 require_once('../functions/page_header.php');
21 require_once('../src/load_prefs.php');
24 function show_event_form() {
25 global $color, $editor_size, $year, $day, $month, $hour, $minute, $calendardata;
27 $tmparray = $calendardata["$month$day$year"]["$hour$minute"];
28 echo "\n<FORM name=eventupdate action=\"event_edit.php\" METHOD=POST >\n".
29 " <INPUT TYPE=hidden NAME=\"year\" VALUE=\"$year\">\n".
30 " <INPUT TYPE=hidden NAME=\"month\" VALUE=\"$month\">\n".
31 " <INPUT TYPE=hidden NAME=\"day\" VALUE=\"$day\">\n".
32 " <INPUT TYPE=hidden NAME=\"hour\" VALUE=\"$hour\">\n".
33 " <INPUT TYPE=hidden NAME=\"minute\" VALUE=\"$minute\">\n".
34 " <INPUT TYPE=hidden NAME=\"updated\" VALUE=\"yes\">\n".
35 " <TR><TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>" . _("Date:") . "</TD>\n".
36 " <TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n".
37 " <SELECT NAME=\"event_year\">\n";
38 select_option_year($year);
41 " <SELECT NAME=\"event_month\">\n";
42 select_option_month($month);
45 " <SELECT NAME=\"event_day\">\n";
46 select_option_day($day);
49 " <TR><TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>" . _("Time:") . "</TD>\n".
50 " <TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n".
51 " <SELECT NAME=\"event_hour\">\n";
52 select_option_hour($hour);
55 " <SELECT NAME=\"event_minute\">\n";
56 select_option_minute($minute);
59 " <TR><TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>" . _("Length:") . "</TD>\n".
60 " <TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n".
61 " <SELECT NAME=\"event_length\">\n";
62 select_option_length($tmparray[length
]);
65 " <TR><TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>" . _("Priority:") . "</TD>\n".
66 " <TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n".
67 " <SELECT NAME=\"event_priority\">\n";
68 select_option_priority($tmparray[priority
]);
71 " <TR><TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>" . _("Title:") . "</TD>\n".
72 " <TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n".
73 " <INPUT TYPE=text NAME=\"event_title\" VALUE=\"$tmparray[title]\" SIZE=30 MAXLENGTH=50><BR>\n".
75 " <TR><TD BGCOLOR=\"$color[4]\" ALIGN=LEFT COLSPAN=2>\n".
76 " <TEXTAREA NAME=\"event_text\" ROWS=5 COLS=\"$editor_size\" WRAP=HARD>$tmparray[message]</TEXTAREA>\n".
78 " <TR><TD ALIGN=LEFT BGCOLOR=\"$color[4]\" COLSPAN=2><INPUT TYPE=SUBMIT NAME=send VALUE=\"" .
79 _("Update Event") . "\"></TD></TR>\n".
84 function confirm_update() {
85 global $calself, $year, $month, $day, $hour, $minute, $calendardata, $color, $event_year, $event_month, $event_day, $event_hour, $event_minute, $event_length, $event_priority, $event_title, $event_text;
87 $tmparray = $calendardata["$month$day$year"]["$hour$minute"];
89 echo " <TABLE BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[0]\">\n".
90 " <TR><TH COLSPAN=2 BGCOLOR=\"$color[4]\">\n".
91 _("Do you really want to change this event from:") . "<br>\n".
93 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Date:") . "</TD>\n".
94 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$month/$day/$year</TD></TR>\n".
95 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Time:") . "</TD>\n".
96 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$hour:$minute</TD></TR>\n".
97 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Priority:") . "</TD>\n".
98 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$tmparray[priority]</TD></TR>\n".
99 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Title:") . "</TD>\n".
100 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$tmparray[title]</TD></TR>\n".
101 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Message:") . "</TD>\n".
102 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$tmparray[message]</TD></TR>\n".
103 " <TR><TH COLSPAN=2 BGCOLOR=\"$color[4]\">\n".
106 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Date:") . "</TD>\n".
107 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$event_month/$event_day/$event_year</TD></TR>\n".
108 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . ("Time:") . "</TD>\n".
109 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$event_hour:$event_minute</TD></TR>\n".
110 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Priority:") . "</TD>\n".
111 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$event_priority</TD></TR>\n".
112 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Title:") . "</TD>\n".
113 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$event_title</TD></TR>\n".
114 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">" . _("Message:") . "</TD>\n".
115 " <TD ALIGN=LEFT BGCOLOR=\"$color[4]\">$event_text</TD></TR>\n".
116 " <TR><TD ALIGN=RIGHT BGCOLOR=\"$color[4]\">\n".
117 " <FORM NAME=\"updateevent\" METHOD=POST ACTION=\"$calself\">\n".
118 " <INPUT TYPE=HIDDEN NAME=\"year\" VALUE=\"$year\">\n".
119 " <INPUT TYPE=HIDDEN NAME=\"month\" VALUE=\"$month\">\n".
120 " <INPUT TYPE=HIDDEN NAME=\"day\" VALUE=\"$day\">\n".
121 " <INPUT TYPE=HIDDEN NAME=\"hour\" VALUE=\"$hour\">\n".
122 " <INPUT TYPE=HIDDEN NAME=\"minute\" VALUE=\"$minute\">\n".
123 " <INPUT TYPE=HIDDEN NAME=\"event_year\" VALUE=\"$event_year\">\n".
124 " <INPUT TYPE=HIDDEN NAME=\"event_month\" VALUE=\"$event_month\">\n".
125 " <INPUT TYPE=HIDDEN NAME=\"event_day\" VALUE=\"$event_day\">\n".
126 " <INPUT TYPE=HIDDEN NAME=\"event_hour\" VALUE=\"$event_hour\">\n".
127 " <INPUT TYPE=HIDDEN NAME=\"event_minute\" VALUE=\"$event_minute\">\n".
128 " <INPUT TYPE=HIDDEN NAME=\"event_priority\" VALUE=\"$event_priority\">\n".
129 " <INPUT TYPE=HIDDEN NAME=\"event_length\" VALUE=\"$event_length\">\n".
130 " <INPUT TYPE=HIDDEN NAME=\"event_title\" VALUE=\"$event_title\">\n".
131 " <INPUT TYPE=HIDDEN NAME=\"event_text\" VALUE=\"$event_text\">\n".
132 " <INPUT TYPE=hidden NAME=\"updated\" VALUE=\"yes\">\n".
133 " <INPUT TYPE=HIDDEN NAME=\"confirmed\" VALUE=\"yes\">\n".
134 ' <INPUT TYPE=SUBMIT VALUE="' . _("Yes") . "\">\n".
136 " </TD><TD ALIGN=LEFT BGCOLOR=\"$color[4]\">\n".
137 " <FORM NAME=\"nodelevent\" METHOD=POST ACTION=\"day.php\">\n".
138 " <INPUT TYPE=HIDDEN NAME=\"year\" VALUE=\"$year\">\n".
139 " <INPUT TYPE=HIDDEN NAME=\"month\" VALUE=\"$month\">\n".
140 " <INPUT TYPE=HIDDEN NAME=\"day\" VALUE=\"$day\">\n".
141 ' <INPUT TYPE=SUBMIT VALUE="' . _("No") . "\">\n".
149 $month = date( 'm' );
161 $calself=basename($PHP_SELF);
163 displayPageHeader($color, 'None');
167 echo "<TR BGCOLOR=\"$color[0]\"><TD>" .
168 "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[0]\">" .
169 '<tr><td COLSPAN=2>' .
170 date_intl( 'l, F d Y', mktime(0, 0, 0, $month, $day, $year)) .
172 if (!isset($updated)){
173 //get changes to event
177 if (!isset($confirmed)){
180 // strip event text so it fits in one line
181 $event_text=nl2br($event_text);
182 $event_text=ereg_replace ("\n", '', $event_text);
183 $event_text=ereg_replace ("\r", '', $event_text);
186 update_event("$month$day$year", "$hour$minute");
187 echo "<tr><td>" . _("Event updated!") . "</td></tr>\n";
188 echo "<tr><td><A HREF=\"day.php?year=$year&month=$month&day=$day\">" .
189 _("Day View") ."</A></td></tr>\n";
190 $fixdate = date( 'mdY', mktime(0, 0, 0, $event_month, $event_day, $event_year));
191 //if event has been moved to different year then act accordingly
192 if ($year==$event_year){
193 $calendardata["$fixdate"]["$event_hour$event_minute"] = array("length"=>"$event_length","priority"=>"$event_priority","title"=>"$event_title","message"=>"$event_text");
198 $calendardata = array();
200 $calendardata["$fixdate"]["$event_hour$event_minute"] = array("length"=>"$event_length","priority"=>"$event_priority","title"=>"$event_title","message"=>"$event_text");
207 </table
></td
></tr
></table
>