92610e0631296cd69fdb84a0c146769650f15694
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 create a event for calendar.
16 require_once('calendar_data.php');
17 require_once('functions.php');
19 define('SM_PATH','../');
21 /* SquirrelMail required files. */
22 require_once(SM_PATH
. 'include/validate.php');
23 require_once(SM_PATH
. 'functions/strings.php');
24 require_once(SM_PATH
. 'functions/date.php');
25 require_once(SM_PATH
. 'config/config.php');
26 require_once(SM_PATH
. 'functions/page_header.php');
27 require_once(SM_PATH
. 'include/load_prefs.php');
28 require_once(SM_PATH
. 'functions/html.php');
30 //main form to gather event info
31 function show_event_form() {
32 global $color, $editor_size, $year, $day, $month, $hour;
34 echo "\n<FORM name=eventscreate action=\"event_create.php\" METHOD=POST >\n".
35 " <INPUT TYPE=hidden NAME=\"year\" VALUE=\"$year\">\n".
36 " <INPUT TYPE=hidden NAME=\"month\" VALUE=\"$month\">\n".
37 " <INPUT TYPE=hidden NAME=\"day\" VALUE=\"$day\">\n".
39 html_tag( 'td', _("Start time:"), 'right', $color[4] ) . "\n" .
40 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
41 " <SELECT NAME=\"event_hour\">\n";
42 select_option_hour($hour);
45 " <SELECT NAME=\"event_minute\">\n";
46 select_option_minute("00");
50 html_tag( 'td', _("Length:"), 'right', $color[4] ) . "\n" .
51 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
52 " <SELECT NAME=\"event_length\">\n";
53 select_option_length("0");
57 html_tag( 'td', _("Priority:"), 'right', $color[4] ) . "\n" .
58 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
59 " <SELECT NAME=\"event_priority\">\n";
60 select_option_priority("0");
64 html_tag( 'td', _("Title:"), 'right', $color[4] ) . "\n" .
65 html_tag( 'td', '', 'left', $color[4] ) . "\n" .
66 " <INPUT TYPE=text NAME=\"event_title\" VALUE=\"\" SIZE=30 MAXLENGTH=50><BR>\n".
70 "<TEXTAREA NAME=\"event_text\" ROWS=5 COLS=\"$editor_size\" WRAP=HARD></TEXTAREA>" ,
71 'left', $color[4], 'colspan="2"' )
75 "<INPUT TYPE=SUBMIT NAME=send VALUE=\"" .
76 _("Set Event") . "\">" ,
77 'left', $color[4], 'colspan="2"' )
83 if ( !isset($month) ||
$month <= 0){
86 if ( !isset($year) ||
$year <= 0){
89 if (!isset($day) ||
$day <= 0){
92 if (!isset($hour) ||
$hour <= 0){
96 $calself=basename($PHP_SELF);
99 displayPageHeader($color, 'None');
103 echo html_tag( 'tr', '', '', $color[0] ) .
104 html_tag( 'td', '', 'left' ) .
105 html_tag( 'table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) .
107 html_tag( 'td', date_intl( _("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)), 'left', '', 'colspan="2"' )
109 //if form has not been filled in
110 if(!isset($event_text)){
114 //make sure that event text is fittting in one line
115 $event_text=nl2br($event_text);
116 $event_text=ereg_replace ("\n", "", $event_text);
117 $event_text=ereg_replace ("\r", "", $event_text);
118 $calendardata["$month$day$year"]["$event_hour$event_minute"] =
119 array( 'length' => $event_length,
120 'priority' => $event_priority,
121 'title' => $event_title,
122 'message' => $event_text,
126 echo html_tag( 'table',
128 html_tag( 'th', _("Event Has been added!") . "<br>\n", '', $color[4], 'colspan="2"' )
131 html_tag( 'td', _("Date:"), 'right', $color[4] ) . "\n" .
132 html_tag( 'td', $month .'/'.$day.'/'.$year, 'left', $color[4] ) . "\n"
135 html_tag( 'td', _("Time:"), 'right', $color[4] ) . "\n" .
136 html_tag( 'td', $event_hour.':'.$event_minute, 'left', $color[4] ) . "\n"
139 html_tag( 'td', _("Title:"), 'right', $color[4] ) . "\n" .
140 html_tag( 'td', $event_title, 'left', $color[4] ) . "\n"
143 html_tag( 'td', _("Message:"), 'right', $color[4] ) . "\n" .
144 html_tag( 'td', $event_text, 'left', $color[4] ) . "\n"
148 "<a href=\"day.php?year=$year&month=$month&day=$day\">" . _("Day View") . "</a>\n" ,
149 'left', $color[4], 'colspan="2"' ) . "\n"
151 '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"' ) ."\n";
155 </table
></td
></tr
></table
>