6 * Copyright (c) 2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * Originally contrubuted by Michal Szczotka <michal@tuxy.org>
11 * Functions to edit an event.
16 require_once('calendar_data.php');
17 require_once('functions.php');
19 require_once('../src/validate.php');
20 require_once('../functions/strings.php');
21 require_once('../functions/date.php');
22 require_once('../config/config.php');
23 require_once('../functions/page_header.php');
24 require_once('../src/load_prefs.php');
25 require_once('../functions/html.php');
28 function show_event_form() {
29 global $color, $editor_size, $year, $day, $month, $hour, $minute, $calendardata;
31 $tmparray = $calendardata["$month$day$year"]["$hour$minute"];
32 echo "\n<FORM name=eventupdate action=\"event_edit.php\" METHOD=POST >\n".
33 " <INPUT TYPE=hidden NAME=\"year\" VALUE=\"$year\">\n".
34 " <INPUT TYPE=hidden NAME=\"month\" VALUE=\"$month\">\n".
35 " <INPUT TYPE=hidden NAME=\"day\" VALUE=\"$day\">\n".
36 " <INPUT TYPE=hidden NAME=\"hour\" VALUE=\"$hour\">\n".
37 " <INPUT TYPE=hidden NAME=\"minute\" VALUE=\"$minute\">\n".
38 " <INPUT TYPE=hidden NAME=\"updated\" VALUE=\"yes\">\n".
40 html_tag( 'td', _("Date:"), 'right', $color[4] ) . "\n" .
41 html_tag( 'td', '', 'left', $color[4] ) .
42 " <SELECT NAME=\"event_year\">\n";
43 select_option_year($year);
46 " <SELECT NAME=\"event_month\">\n";
47 select_option_month($month);
50 " <SELECT NAME=\"event_day\">\n";
51 select_option_day($day);
55 html_tag( 'td', _("Time:"), 'right', $color[4] ) . "\n" .
56 html_tag( 'td', '', 'left', $color[4] ) .
57 " <SELECT NAME=\"event_hour\">\n";
58 select_option_hour($hour);
61 " <SELECT NAME=\"event_minute\">\n";
62 select_option_minute($minute);
66 html_tag( 'td', _("Length:"), 'right', $color[4] ) . "\n" .
67 html_tag( 'td', '', 'left', $color[4] ) .
68 " <SELECT NAME=\"event_length\">\n";
69 select_option_length($tmparray[length
]);
73 html_tag( 'td', _("Priority:"), 'right', $color[4] ) . "\n" .
74 html_tag( 'td', '', 'left', $color[4] ) .
75 " <SELECT NAME=\"event_priority\">\n";
76 select_option_priority($tmparray[priority
]);
80 html_tag( 'td', _("Title:"), 'right', $color[4] ) . "\n" .
81 html_tag( 'td', '', 'left', $color[4] ) .
82 " <INPUT TYPE=text NAME=\"event_title\" VALUE=\"$tmparray[title]\" SIZE=30 MAXLENGTH=50><BR>\n".
85 " <TEXTAREA NAME=\"event_text\" ROWS=5 COLS=\"$editor_size\" WRAP=HARD>$tmparray[message]</TEXTAREA>\n" ,
86 'left', $color[4], 'colspan="2"' ) .
87 '</tr>' . html_tag( 'tr' ) .
89 "<INPUT TYPE=SUBMIT NAME=send VALUE=\"" .
90 _("Update Event") . "\">\n" ,
91 'left', $color[4], 'colspan="2"' ) .
96 function confirm_update() {
97 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;
99 $tmparray = $calendardata["$month$day$year"]["$hour$minute"];
101 echo html_tag( 'table',
103 html_tag( 'th', _("Do you really want to change this event from:") . "<br>\n", '', $color[4], 'colspan="2"' ) ."\n"
106 html_tag( 'td', _("Date:") , 'right', $color[4] ) ."\n" .
107 html_tag( 'td', $month.'/'.$day.'/'.$year , 'left', $color[4] ) ."\n"
110 html_tag( 'td', _("Time:") , 'right', $color[4] ) ."\n" .
111 html_tag( 'td', $hour.':'.$minute , 'left', $color[4] ) ."\n"
114 html_tag( 'td', _("Priority:") , 'right', $color[4] ) ."\n" .
115 html_tag( 'td', $tmparray[priority
] , 'left', $color[4] ) ."\n"
118 html_tag( 'td', _("Title:") , 'right', $color[4] ) ."\n" .
119 html_tag( 'td', $tmparray[title
] , 'left', $color[4] ) ."\n"
122 html_tag( 'td', _("Message:") , 'right', $color[4] ) ."\n" .
123 html_tag( 'td', $tmparray[message
] , 'left', $color[4] ) ."\n"
126 html_tag( 'th', _("to:") . "<br>\n", '', $color[4], 'colspan="2"' ) ."\n"
130 html_tag( 'td', _("Date:") , 'right', $color[4] ) ."\n" .
131 html_tag( 'td', $event_month.'/'.$event_day.'/'.$event_year , 'left', $color[4] ) ."\n"
134 html_tag( 'td', _("Time:") , 'right', $color[4] ) ."\n" .
135 html_tag( 'td', $event_hour.':'.$event_minute , 'left', $color[4] ) ."\n"
138 html_tag( 'td', _("Priority:") , 'right', $color[4] ) ."\n" .
139 html_tag( 'td', $event_priority , 'left', $color[4] ) ."\n"
142 html_tag( 'td', _("Title:") , 'right', $color[4] ) ."\n" .
143 html_tag( 'td', $event_title , 'left', $color[4] ) ."\n"
146 html_tag( 'td', _("Message:") , 'right', $color[4] ) ."\n" .
147 html_tag( 'td', $event_text , 'left', $color[4] ) ."\n"
151 " <FORM NAME=\"updateevent\" METHOD=POST ACTION=\"$calself\">\n".
152 " <INPUT TYPE=HIDDEN NAME=\"year\" VALUE=\"$year\">\n".
153 " <INPUT TYPE=HIDDEN NAME=\"month\" VALUE=\"$month\">\n".
154 " <INPUT TYPE=HIDDEN NAME=\"day\" VALUE=\"$day\">\n".
155 " <INPUT TYPE=HIDDEN NAME=\"hour\" VALUE=\"$hour\">\n".
156 " <INPUT TYPE=HIDDEN NAME=\"minute\" VALUE=\"$minute\">\n".
157 " <INPUT TYPE=HIDDEN NAME=\"event_year\" VALUE=\"$event_year\">\n".
158 " <INPUT TYPE=HIDDEN NAME=\"event_month\" VALUE=\"$event_month\">\n".
159 " <INPUT TYPE=HIDDEN NAME=\"event_day\" VALUE=\"$event_day\">\n".
160 " <INPUT TYPE=HIDDEN NAME=\"event_hour\" VALUE=\"$event_hour\">\n".
161 " <INPUT TYPE=HIDDEN NAME=\"event_minute\" VALUE=\"$event_minute\">\n".
162 " <INPUT TYPE=HIDDEN NAME=\"event_priority\" VALUE=\"$event_priority\">\n".
163 " <INPUT TYPE=HIDDEN NAME=\"event_length\" VALUE=\"$event_length\">\n".
164 " <INPUT TYPE=HIDDEN NAME=\"event_title\" VALUE=\"$event_title\">\n".
165 " <INPUT TYPE=HIDDEN NAME=\"event_text\" VALUE=\"$event_text\">\n".
166 " <INPUT TYPE=hidden NAME=\"updated\" VALUE=\"yes\">\n".
167 " <INPUT TYPE=HIDDEN NAME=\"confirmed\" VALUE=\"yes\">\n".
168 ' <INPUT TYPE=SUBMIT VALUE="' . _("Yes") . "\">\n".
170 'right', $color[4] ) ."\n" .
172 " <FORM NAME=\"nodelevent\" METHOD=POST ACTION=\"day.php\">\n".
173 " <INPUT TYPE=HIDDEN NAME=\"year\" VALUE=\"$year\">\n".
174 " <INPUT TYPE=HIDDEN NAME=\"month\" VALUE=\"$month\">\n".
175 " <INPUT TYPE=HIDDEN NAME=\"day\" VALUE=\"$day\">\n".
176 ' <INPUT TYPE=SUBMIT VALUE="' . _("No") . "\">\n".
178 'left', $color[4] ) ."\n"
180 '', $color[0], 'border="0" cellpadding="2" cellspacing="1"' );
184 $month = date( 'm' );
196 $calself=basename($PHP_SELF);
198 displayPageHeader($color, 'None');
202 echo html_tag( 'tr', '', '', $color[0] ) .
203 html_tag( 'td', '', 'left' ) .
204 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) .
207 date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)) ,
208 'left', '', 'colspan="2"' );
209 if (!isset($updated)){
210 //get changes to event
214 if (!isset($confirmed)){
217 // strip event text so it fits in one line
218 $event_text=nl2br($event_text);
219 $event_text=ereg_replace ("\n", '', $event_text);
220 $event_text=ereg_replace ("\r", '', $event_text);
223 update_event("$month$day$year", "$hour$minute");
225 html_tag( 'td', _("Event updated!"), 'left' )
229 "<a href=\"day.php?year=$year&month=$month&day=$day\">" .
230 _("Day View") ."</a>",
234 $fixdate = date( 'mdY', mktime(0, 0, 0, $event_month, $event_day, $event_year));
235 //if event has been moved to different year then act accordingly
236 if ($year==$event_year){
237 $calendardata["$fixdate"]["$event_hour$event_minute"] = array("length"=>"$event_length","priority"=>"$event_priority","title"=>"$event_title","message"=>"$event_text");
242 $calendardata = array();
244 $calendardata["$fixdate"]["$event_hour$event_minute"] = array("length"=>"$event_length","priority"=>"$event_priority","title"=>"$event_title","message"=>"$event_text");
251 </table
></td
></tr
></table
>