From d61a01d48fa9d58a7fdd5a99e7943b7dcaa94178 Mon Sep 17 00:00:00 2001 From: philippe_mingo Date: Tue, 22 Jan 2002 08:27:21 +0000 Subject: [PATCH] Michal Szczotka Calendar plugin. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2196 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- plugins/calendar/README | 25 ++++ plugins/calendar/calendar.php | 140 +++++++++++++++++++ plugins/calendar/calendar_data.php | 113 ++++++++++++++++ plugins/calendar/day.php | 137 +++++++++++++++++++ plugins/calendar/event_create.php | 123 +++++++++++++++++ plugins/calendar/event_delete.php | 101 ++++++++++++++ plugins/calendar/event_edit.php | 209 +++++++++++++++++++++++++++++ plugins/calendar/functions.php | 146 ++++++++++++++++++++ plugins/calendar/setup.php | 24 ++++ 9 files changed, 1018 insertions(+) create mode 100644 plugins/calendar/README create mode 100644 plugins/calendar/calendar.php create mode 100644 plugins/calendar/calendar_data.php create mode 100644 plugins/calendar/day.php create mode 100644 plugins/calendar/event_create.php create mode 100644 plugins/calendar/event_delete.php create mode 100644 plugins/calendar/event_edit.php create mode 100644 plugins/calendar/functions.php create mode 100644 plugins/calendar/setup.php diff --git a/plugins/calendar/README b/plugins/calendar/README new file mode 100644 index 00000000..f7e55505 --- /dev/null +++ b/plugins/calendar/README @@ -0,0 +1,25 @@ +SQCalendar 0.1 +GPL (C) 2001 Michal Szczotka +http://www.tuxy.org/index.php?path=/projects/sqcalendar/index.php + +********** DESCRIPTION ************ + +Simple calendar plugin for Squirrel Mail (squirrelmail.org). As of now it has +month view and day view. Events can be created, deleted and updated. + + +********** REQUIREMENTS ********** + +It works with squirrelmail 1.0.6 and 1.2.0-rc2 which are latest at the time +of writing + +********** INSTALLATION ********** + +SEE INSTALL + +*************** TODO ************** + +- single entry of repetitve events (ex. birthday repeats every year) +- reminder email/javascript/etc +- weekly view + diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php new file mode 100644 index 00000000..442ab314 --- /dev/null +++ b/plugins/calendar/calendar.php @@ -0,0 +1,140 @@ + + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * Displays the main calendar page (month view). + * + * 18 Jan 2002 Adapted to official SM rules philippe@squirrelmail.org. + */ + +require_once('calendar_data.php'); +require_once('functions.php'); +chdir('..'); +require_once('../src/validate.php'); +require_once('../functions/strings.php'); +require_once('../functions/date.php'); +require_once('../config/config.php'); +require_once('../functions/page_header.php'); +require_once('../src/load_prefs.php'); + +//display upper part of month calendar view +function startcalendar() { + global $year, $month, $day, $color; + + $prev_date = mktime(0, 0, 0, $month - 1, 1, $year); + $act_date = mktime(0, 0, 0, $month, 1, $year); + $next_date = mktime(0, 0, 0, $month + 1, 1, $year); + $prev_month = date( 'm', $prev_date ); + $next_month = date( 'm', $next_date); + $prev_year = date( 'Y', $prev_date); + $next_year = date( 'Y', $next_date ); + + echo "" . + "" . + ''. + "\n". + "\n". + "\n" . + "". + "". + ''. + "'. + "'. + "'. + "'. + "'. + "'. + "'. + ''; + +} + +//main logic for month view of calendar +function drawmonthview() { + global $year, $month, $day, $color, $calendardata, $todayis; + + $aday = 1 - date('w', mktime(0, 0, 0, $month, 1, $year)); + $days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year)); + while ($aday <= $days_in_month) { + echo ''; + for ($j=1; $j<=7; $j++) { + $cdate="$month"; + ($aday<10)?$cdate=$cdate."0$aday":$cdate=$cdate."$aday"; + $cdate=$cdate."$year"; + if ( $aday <= $days_in_month && $aday > 0){ + echo "\n"; + $aday++; + } + echo ''; + } +} + +//end of monthly view and form to jump to any month and year +function endcalendar() { + global $year, $month, $day, $color; + + echo " \n". + "
<< ".($year-1)."< " . + date_intl( 'M', $prev_date). "" . + date_intl( 'F Y', $act_date ) . "" . + date_intl( 'M', $next_date) . " >".($year+1)." >>
" . _("Sunday") . '" . _("Monday") . '" . _("Tuesday") . '" . _("Wednesday") . '" . _("Thursday") . '" . _("Friday") . '" . _("Saturday") . '
\n" . + "
"; + echo(($cdate==$todayis) ? "[ " . _("TODAY") . " ] " : ""); + echo "$aday
"; + } else { + echo "
\n". + " "; + } + if (isset($calendardata[$cdate])){ + $i=0; + while ($calfoo = each($calendardata[$cdate])) { + $calbar = $calendardata[$cdate][$calfoo[key]]; + echo ($calbar[priority]==1) ? "$calbar[title]
\n" : "$calbar[title]
\n"; + $i=$i+1; + if($i==2){ + break; + } + } + } + echo "\n
\n". + "
\n". + " \n". + " \n". + ' \n". + "
\n". + "
\n"; +} + + +if($month <= 0){ + $month = date( 'm' ); +} +if($year <= 0){ + $year = date( 'Y' ); +} +if($day <= 0){ + $day = date( 'd' ); +} + +$todayis = date( 'mdY' ); +$calself=basename($PHP_SELF); + +displayPageHeader($color, 'None'); +calendar_header(); +readcalendardata(); +startcalendar(); +drawmonthview(); +endcalendar(); + +?> + \ No newline at end of file diff --git a/plugins/calendar/calendar_data.php b/plugins/calendar/calendar_data.php new file mode 100644 index 00000000..737537ec --- /dev/null +++ b/plugins/calendar/calendar_data.php @@ -0,0 +1,113 @@ + + + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * functions to operate on calendar data files. + * + * 18 Jan 2002 Adapted to official SM rules philippe@squirrelmail.org. + */ + +// this is array that contains all events +// it is three dimensional array with fallowing structure +// $calendardata[date][time] = array(length,priority,title,message); +$calendardata = array(); + +//read events into array +//data is | delimited, just like addresbook +//files are structured like this: +//date|time|length|priority|title|message); +//files are divide by year for performance increase +function readcalendardata() { + global $calendardata, $username, $data_dir, $year; + + $filename = getHashedFile($username, $data_dir, "$username.$year.cal"); + + if (file_exists($filename)){ + $fp = fopen ($filename,'r'); + } + if ($fp){ + while ($fdata = fgetcsv ($fp, 4096, '|')) { + $calendardata[$fdata[0]][$fdata[1]] = array( 'length' => $fdata[2], + 'priority' => $fdata[3], + 'title' => $fdata[4], + 'message' => $fdata[5], + 'reminder' => $fdata[6] ); + } + fclose ($fp); + } +} + +//makes events persistant +function writecalendardata() { + global $calendardata, $username, $data_dir, $year; + + $filetmp = getHashedFile($username, $data_dir, "$username.$year.cal.tmp"); + $filename = getHashedFile($username, $data_dir, "$username.$year.cal"); + $fp = fopen ($filetmp,"w"); + if ($fp) { + while ( $calfoo = each ($calendardata)) { + while ( $calbar = each ($calfoo[value])) { + $calfoobar = $calendardata[$calfoo[key]][$calbar[key]]; + $calstr = "$calfoo[key]|$calbar[key]|$calfoobar[length]|$calfoobar[priority]|$calfoobar[title]|$calfoobar[message]|$calfoobar[reminder]\n"; + fwrite($fp, $calstr, 4096); + } + + } + fclose ($fp); + rename($filetmp,$filename); + } +} + +//deletes event from file +function delete_event($date, $time) { + global $calendardata, $username, $data_dir, $year; + + $filename = getHashedFile($username, $data_dir, "$username.$year.cal"); + $fp = fopen ($filename,'r'); + if ($fp){ + while ($fdata = fgetcsv ($fp, 4096, "|")) { + if (($fdata[0]==$date) && ($fdata[1]==$time)){ + // do nothing + } else { + $calendardata[$fdata[0]][$fdata[1]] = array( 'length' => $fdata[2], + 'priority' => $fdata[3], + 'title' => $fdata[4], + 'message' => $fdata[5], + 'reminder' => $fdata[6] ); + } + } + fclose ($fp); + } + writecalendardata(); + +} + +// same as delete but not saves calendar +// saving is done inside event_edit.php +function update_event($date, $time) { + global $calendardata, $username, $data_dir, $year; + + $filename = getHashedFile($username, $data_dir, "$username.$year.cal"); + $fp = fopen ($filename,'r'); + if ($fp){ + while ($fdata = fgetcsv ($fp, 4096, '|')) { + if (($fdata[0]==$date) && ($fdata[1]==$time)){ + // do nothing + } else { + $calendardata[$fdata[0]][$fdata[1]] = array( 'length' => $fdata[2], + 'priority' => $fdata[3], + 'title' => $fdata[4], + 'message' => $fdata[5], + 'reminder' => $fdata[6] ); + } + } + fclose ($fp); + } +} + + +?> diff --git a/plugins/calendar/day.php b/plugins/calendar/day.php new file mode 100644 index 00000000..44d60447 --- /dev/null +++ b/plugins/calendar/day.php @@ -0,0 +1,137 @@ + + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * Displays the day page (day view). + * + * 18 Jan 2002 Adapted to official SM rules philippe@squirrelmail.org. + */ + +require_once('calendar_data.php'); +require_once('functions.php'); +chdir('..'); +require_once('../src/validate.php'); +require_once('../functions/strings.php'); +require_once('../functions/date.php'); +require_once('../config/config.php'); +require_once('../functions/page_header.php'); +require_once('../src/load_prefs.php'); + +//displays head of day calendar view +function day_header() { + global $color, $month, $day, $year, $prev_year, $prev_month, $prev_day, + $prev_date, $next_month, $next_day, $next_year, $next_date; + + echo " " . + " \n" . + " \n" . + " \n" . + " \n"; +} + +//events for specific day are inserted into "daily" array +function initialize_events() { + global $daily_events, $calendardata, $month, $day, $year; + + for ($i=7;$i<23;$i++){ + if ($i<10){ + $evntime = '0' . $i . '00'; + } else { + $evntime = $i . '00'; + } + $daily_events[$evntime] = 'empty'; + } + + $cdate = $month . $day . $year; + + if (isset($calendardata[$cdate])){ + while ( $calfoo = each($calendardata[$cdate])){ + $daily_events["$calfoo[key]"] = $calendardata[$cdate][$calfoo[key]]; + } + } +} + +//main loop for displaying daily events +function display_events() { + global $daily_events, $month, $day, $year, $color; + + ksort($daily_events,SORT_STRING); + $eo=0; + while ($calfoo = each($daily_events)){ + if ($eo==0){ + $eo=4; + } else { + $eo=0; + } + + $ehour = substr($calfoo[key],0,2); + $eminute = substr($calfoo[key],2,2); + if (!is_array($calfoo[value])){ + echo " \n" . + " \n" . + " \n"; + } else { + $calbar=$calfoo[value]; + if ($calbar[length]!=0){ + $elength = '-'.date('H:i',mktime($ehour,$eminute+$calbar[length],0,1,1,0)); + } else { + $elength=''; + } + echo " \n" . + " \n" . + " \n"; + } + $i++; +} + + +} + +if ($month <= 0){ + $month = date( 'm'); +} +if ($year <= 0){ + $year = date( 'Y'); +} +if ($day <= 0){ + $day = date( 'd'); +} + +$prev_date = mktime(0, 0, 0, $month , $day - 1, $year); +$next_date = mktime(0, 0, 0, $month , $day + 1, $year); +$prev_day = date ('d',$prev_date); +$prev_month = date ('m',$prev_date); +$prev_year = date ('Y',$prev_date); +$next_day = date ('d',$next_date); +$next_month = date ('m',$next_date); +$next_year = date ('Y',$next_date); + +$calself=basename($PHP_SELF); + +$daily_events = array(); + +displayPageHeader($color, 'None'); +calendar_header(); +readcalendardata(); +day_header(); +initialize_events(); +display_events(); + + +?> +
< ". + date_intl('D',$prev_date)."" . + date_intl( 'l, F d Y', mktime(0, 0, 0, $month, $day, $year)) . "". + date_intl('D',$next_date)." >
$ehour:$eminute ". + _("ADD") . "
$ehour:$eminute$elength["; + echo ($calbar[priority]==1) ? "$calbar[title]" : "$calbar[title]"; + echo"] $calbar[message] \n" . + "". + _("EDIT") . " | \n" . + "" . + _("DEL") . '' . + "
+ diff --git a/plugins/calendar/event_create.php b/plugins/calendar/event_create.php new file mode 100644 index 00000000..14ee40d9 --- /dev/null +++ b/plugins/calendar/event_create.php @@ -0,0 +1,123 @@ + + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * functions to create a event for calendar. + * + * 18 Jan 2002 Adapted to official SM rules philippe@squirrelmail.org. + */ + +require_once('calendar_data.php'); +require_once('functions.php'); +chdir('..'); +require_once('../src/validate.php'); +require_once('../functions/strings.php'); +require_once('../functions/date.php'); +require_once('../config/config.php'); +require_once('../functions/page_header.php'); +require_once('../src/load_prefs.php'); + +//main form to gather event info +function show_event_form() { + global $color, $editor_size, $year, $day, $month, $hour; + + echo "\n
\n". + " \n". + " \n". + " \n". + " " . ("Start time:") . "\n". + " \n". + " \n" . + "  : \n" . + " \n". + " \n". + " " . _("Length:") . "\n". + " \n". + " \n". + " \n". + " " . _("Priority:") . "\n". + " \n". + " \n". + " \n". + " " . _("Title:") . "\n". + " \n". + "
\n". + " \n". + " \n". + " \n". + " \n". + " \n"; + echo "
\n"; +} + + +if ($month <= 0){ + $month = date( 'm' ); +} +if ($year <= 0){ + $year = date( 'Y' ); +} +if ($day <= 0){ + $day = date( 'd' ); +} +if ($hour <= 0){ + $hour = '08'; +} + +$calself=basename($PHP_SELF); + + +displayPageHeader($color, 'None'); +//load calendar menu +calendar_header(); + + +echo "" . + "" . + ''; +//if form has not been filled in +if(!isset($event_text)){ + show_event_form(); +} else { + readcalendardata(); + //make sure that event text is fittting in one line + $event_text=nl2br($event_text); + $event_text=ereg_replace ("\n", "", $event_text); + $event_text=ereg_replace ("\r", "", $event_text); + $calendardata["$month$day$year"]["$event_hour$event_minute"] = array("length"=>"$event_length","priority"=>"$event_priority","title"=>"$event_title","message"=>"$event_text"); + //save + writecalendardata(); + echo "
' . + date_intl( 'l, F d Y', mktime(0, 0, 0, $month, $day, $year)) . + '
\n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + "
\n". + _("Event Has been added!") . "
\n". + "
" . _("Date:") . "$month/$day/$year
" . _("Time:") . "$event_hour:$event_minute
" . _("Title:") . "$event_title
" . _("Message:") . "$event_text
\n". + "" . _("Day View") . "\n". + "
\n"; +} + +?> + + \ No newline at end of file diff --git a/plugins/calendar/event_delete.php b/plugins/calendar/event_delete.php new file mode 100644 index 00000000..a683f200 --- /dev/null +++ b/plugins/calendar/event_delete.php @@ -0,0 +1,101 @@ + + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * Functions to delete a event. + * + * 18 Jan 2002 Adapted to official SM rules philippe@squirrelmail.org. + */ + +require_once('calendar_data.php'); +require_once('functions.php'); +chdir('..'); +require_once('../src/validate.php'); +require_once('../functions/strings.php'); +require_once('../functions/date.php'); +require_once('../config/config.php'); +require_once('../functions/page_header.php'); +require_once('../src/load_prefs.php'); + +function confirm_deletion() +{ + global $calself, $dyear, $dmonth, $dday, $dhour, $dminute, $calendardata, $color, $year, $month, $day; + + $tmparray = $calendardata["$dmonth$dday$dyear"]["$dhour$dminute"]; + + echo " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + "
\n". + _("Do you really want to delete this event?") . "
" . _("Date:") . "$dmonth/$dday/$dyear
" . _("Time:") . "$dhour:$dminute
" . _("Title:") . "$tmparray[title]
" . _("Message:") . "$tmparray[message]
\n". + "
\n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + "
\n". + "
\n". + "
\n". + " \n". + " \n". + " \n". + " \n". + "
\n". + "
\n"; + + +} + +if ($month <= 0){ + $month = date( 'm' ); +} +if ($year <= 0){ + $year = date( 'Y' ); +} +if ($day <= 0){ + $day = date( 'd' ); +} + +$calself=basename($PHP_SELF); + +displayPageHeader($color, 'None'); +//load calendar menu +calendar_header(); + +echo "". + "". + '
'. + date_intl( 'l, F d Y', mktime(0, 0, 0, $month, $day, $year)); +if (isset($dyear) && isset($dmonth) && isset($dday) && isset($dhour) && isset($dminute)){ + if (isset($confirmed)){ + delete_event("$dmonth$dday$dyear", "$dhour$dminute"); + echo '

' . _("Event deleted!") . "
\n"; + echo "Day View\n"; + } else { + readcalendardata(); + confirm_deletion(); + } +} else { + echo '
' . _("Nothing to delete!"); +} + +?> +
+ \ No newline at end of file diff --git a/plugins/calendar/event_edit.php b/plugins/calendar/event_edit.php new file mode 100644 index 00000000..c8e9c0df --- /dev/null +++ b/plugins/calendar/event_edit.php @@ -0,0 +1,209 @@ + + + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * Functions to edit an event. + * + * 18 Jan 2002 Adapted to official SM rules philippe@squirrelmail.org. + */ + +require_once('calendar_data.php'); +require_once('functions.php'); +chdir('..'); +require_once('../src/validate.php'); +require_once('../functions/strings.php'); +require_once('../functions/date.php'); +require_once('../config/config.php'); +require_once('../functions/page_header.php'); +require_once('../src/load_prefs.php'); + +// update event info +function show_event_form() { + global $color, $editor_size, $year, $day, $month, $hour, $minute, $calendardata; + + $tmparray = $calendardata["$month$day$year"]["$hour$minute"]; + echo "\n
\n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " " . _("Date:") . "\n". + " \n". + " \n" . + "   \n" . + " \n". + "   \n". + " \n". + " \n". + " " . _("Time:") . "\n". + " \n". + " \n". + "  : \n". + " \n". + " \n". + " " . _("Length:") . "\n". + " \n". + " \n". + " \n". + " " . _("Priority:") . "\n". + " \n". + " \n". + " \n". + " " . _("Title:") . "\n". + " \n". + "
\n". + " \n". + " \n". + " \n". + " \n". + " \n". + "
\n"; +} + +// self explenatory +function confirm_update() { + 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; + + $tmparray = $calendardata["$month$day$year"]["$hour$minute"]; + + echo " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + "
\n". + _("Do you really want to change this event from:") . "
\n". + "
" . _("Date:") . "$month/$day/$year
" . _("Time:") . "$hour:$minute
" . _("Priority:") . "$tmparray[priority]
" . _("Title:") . "$tmparray[title]
" . _("Message:") . "$tmparray[message]
\n". + _("to:") . "
\n". + "
" . _("Date:") . "$event_month/$event_day/$event_year
" . ("Time:") . "$event_hour:$event_minute
" . _("Priority:") . "$event_priority
" . _("Title:") . "$event_title
" . _("Message:") . "$event_text
\n". + "
\n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + " \n". + ' \n". + "
\n". + "
\n". + "
\n". + " \n". + " \n". + " \n". + ' \n". + "
\n". + "
\n"; + +} + +if ($month <= 0){ + $month = date( 'm' ); +} +if ($year <= 0){ + $year = date( 'Y' ); +} +if ($day <= 0){ + $day = date( 'd' ); +} +if ($hour <= 0){ + $hour = '08'; +} + +$calself=basename($PHP_SELF); + +displayPageHeader($color, 'None'); +//load calendar menu +calendar_header(); + +echo "" . + "" . + '\n"; + echo "\n"; + $fixdate = date( "mdY", mktime(0, 0, 0, $event_month, $event_day, $event_year)); + //if event has been moved to different year then act accordingly + if ($year==$event_year){ + $calendardata["$fixdate"]["$event_hour$event_minute"] = array("length"=>"$event_length","priority"=>"$event_priority","title"=>"$event_title","message"=>"$event_text"); + writecalendardata(); + } else { + writecalendardata(); + $year=$event_year; + $calendardata = array(); + readcalendardata(); + $calendardata["$fixdate"]["$event_hour$event_minute"] = array("length"=>"$event_length","priority"=>"$event_priority","title"=>"$event_title","message"=>"$event_text"); + writecalendardata(); + } + } +} + +?> +
' . + date_intl( 'l, F d Y', mktime(0, 0, 0, $month, $day, $year)); +?>
Event updated!
Day View
+ + diff --git a/plugins/calendar/functions.php b/plugins/calendar/functions.php new file mode 100644 index 00000000..d6d3087b --- /dev/null +++ b/plugins/calendar/functions.php @@ -0,0 +1,146 @@ + + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * miscelenous functions. + * + * 18 Jan 2002 Adapted to official SM rules philippe@squirrelmail.org. + */ + + +function calendar_header() { + //Add Second layer ofCalendar links to upper menu + global $color,$year,$day,$month; + + echo "". + "'; + +} + +function select_option_length($selected) { + + $eventlength = array( + "0" => _("0 min."), + "15" => _("15 min."), + "30" => _("35 min."), + "45" => _("45 min."), + "60" => _("1 hr."), + "90" => _("1.5 hr."), + "120" => _("2 hr."), + "150" => _("2.5 hr."), + "180" => _("3 hr."), + "210" => _("3.5 hr."), + "240" => _("4 hr."), + "300" => _("5 hr."), + "360" => _("6 hr.") + ); + + while( $bar = each($eventlength)) { + if($selected==$bar[key]){ + echo " \n"; + } else { + echo " \n"; + } + } +} + +function select_option_minute($selected) { + $eventminute = array( + "00"=>"00", + "05"=>"05", + "10"=>"10", + "15"=>"15", + "20"=>"20", + "25"=>"25", + "30"=>"30", + "35"=>"35", + "40"=>"40", + "45"=>"45", + "50"=>"50", + "55"=>"55" + ); + + while ( $bar = each($eventminute)) { + if ($selected==$bar[key]){ + echo " \n"; + } else { + echo " \n"; + } + } +} + +function select_option_hour($selected) { + + for ($i=0;$i<24;$i++){ + ($i<10)? $ih = "0" . $i : $ih = $i; + if ($ih==$selected){ + echo " \n"; + } else { + echo " \n"; + } + } +} + +function select_option_priority($selected) { + $eventpriority = array( + "0" => _("Normal"), + "1" => _("High"), + ); + + while( $bar = each($eventpriority)) { + if($selected==$bar[key]){ + echo " \n"; + } else { + echo " \n"; + } + } +} + +function select_option_year($selected) { + + for ($i=1900;$i<2100;$i++){ + if ($i==$selected){ + echo " \n"; + } else { + echo " \n"; + } + } +} + +function select_option_month($selected) { + + for ($i=1;$i<13;$i++){ + $im=date('m',mktime(0,0,0,$i,1,1)); + $is = substr( _( date('F',mktime(0,0,0,$i,1,1)) ), 0, 3 ); + if ($im==$selected){ + echo " \n"; + } else { + echo " \n"; + } + } +} + +function select_option_day($selected) { + + for ($i=1;$i<32;$i++){ + ($i<10)? $ih="0".$i : $ih=$i; + if ($i==$selected){ + echo " \n"; + } else { + echo " \n"; + } + } +} + +?> \ No newline at end of file diff --git a/plugins/calendar/setup.php b/plugins/calendar/setup.php new file mode 100644 index 00000000..ed27dea8 --- /dev/null +++ b/plugins/calendar/setup.php @@ -0,0 +1,24 @@ + + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * init plugin into squirrelmail + * + */ + + +function squirrelmail_plugin_init_calendar() { + global $squirrelmail_plugin_hooks; + $squirrelmail_plugin_hooks['menuline']['calendar'] = 'calendar'; +} + +function calendar() { + //Add Calendar link to upper menu + displayInternalLink('plugins/calendar/calendar.php',_("Calendar"),'right'); + echo "  \n"; +} + +?> \ No newline at end of file -- 2.25.1
"; + + displayInternalLink("plugins/calendar/calendar.php?year=$year&month=$month",_("Month View"),"right"); + echo "  \n"; + displayInternalLink("plugins/calendar/day.php?year=$year&month=$month&day=$day",_("Day View"),"right"); + echo "  \n"; + // displayInternalLink("plugins/calendar/event_create.php?year=$year&month=$month&day=$day",_("Add Event"),"right"); + // echo "  \n"; + echo '