4 * Presents page to edit/add an event
7 * If htmlarea is installed, users can use WYSIWYG editing.
8 * SysAdmin must enable HTML for event full descriptions.
9 * The htmlarea files should be installed so that the htmlarea.php
10 * file is in ../includes/htmlarea/htmlarea.php
11 * The htmlarea code can be downloaded from:
12 * http://www.htmlarea.com
14 * This file will not pass XHTML validation with HTMLArea enabled
16 include_once $gfplugins.'webcalendar/www/includes/init.php';
17 include_once $gfplugins.'webcalendar/www/includes/site_extras.php';
19 load_user_categories ();
21 // Default for using tabs is enabled
22 if ( empty ( $EVENT_EDIT_TABS ) )
23 $EVENT_EDIT_TABS = 'Y'; // default
24 $useTabs = ( $EVENT_EDIT_TABS == 'Y' );
26 // make sure this is not a read-only calendar
29 // Public access can only add events, not edit.
30 if ( $login == "__public__" && $id > 0 ) {
35 $participants = array ();
37 if ( $readonly == 'Y' ) {
39 } else if ( ! empty ( $id ) && $id > 0 ) {
40 // first see who has access to edit this entry
45 if ( $readonly == "N" || $is_admin ) {
46 $sql = "SELECT webcal_entry.cal_id FROM webcal_entry, " .
47 "webcal_entry_user WHERE webcal_entry.cal_id = " .
48 "webcal_entry_user.cal_id AND webcal_entry.cal_id = $id " .
49 "AND (webcal_entry.cal_create_by = '$login' " .
50 "OR webcal_entry_user.cal_login = '$login')";
51 $res = dbi_query ( $sql );
53 $row = dbi_fetch_row ( $res );
54 if ( $row && $row[0] > 0 )
56 dbi_free_result ( $res );
60 $sql = "SELECT cal_create_by, cal_date, cal_time, cal_mod_date, " .
61 "cal_mod_time, cal_duration, cal_priority, cal_type, cal_access, " .
62 "cal_name, cal_description, cal_group_id FROM webcal_entry WHERE cal_id = " . $id;
63 $res = dbi_query ( $sql );
65 $row = dbi_fetch_row ( $res );
66 if ( ! empty ( $override ) && ! empty ( $date ) ) {
67 // Leave $cal_date to what was set in URL with date=YYYYMMDD
73 if (( $user == $create_by ) && ( $is_assistant || $is_nonuser_admin )) $can_edit = true;
75 $year = (int) ( $cal_date / 10000 );
76 $month = ( $cal_date / 100 ) % 100;
77 $day = $cal_date % 100;
79 // test for AllDay event, if so, don't adjust time
80 if ( $time > 0 || ( $time == 0 && $row[5] != 1440 ) ) { /* -1 = no time specified */
81 $time += ( ! empty ( $TZ_OFFSET )?$TZ_OFFSET : 0) * 10000;
82 if ( $time > 240000 ) {
84 $gmt = mktime ( 3, 0, 0, $month, $day, $year );
86 $month = date ( "m", $gmt );
87 $day = date ( "d", $gmt );
88 $year = date ( "Y", $gmt );
89 } else if ( $time < 0 ) {
91 $gmt = mktime ( 3, 0, 0, $month, $day, $year );
93 $month = date ( "m", $gmt );
94 $day = date ( "d", $gmt );
95 $year = date ( "Y", $gmt );
98 $cal_date = sprintf("%04d%02d%02d",$year,$month,$day);
101 $hour = floor($time / 10000);
102 $minute = ( $time / 100 ) % 100;
112 $description = $row[10];
114 // check for repeating event info...
115 // but not if we are overriding a single entry of an already repeating
116 // event... confusing, eh?
117 if ( ! empty ( $override ) ) {
120 $rpt_end_date = $cal_date;
122 $rpt_days = "nnnnnnn";
123 $rpt_sun = $rpt_mon = $rpt_tue = $rpt_wed =
124 $rpt_thu = $rpt_fri = $rpt_sat = false;
126 $res = dbi_query ( "SELECT cal_id, cal_type, cal_end, " .
127 "cal_frequency, cal_days FROM webcal_entry_repeats " .
128 "WHERE cal_id = $id" );
130 if ( $row = dbi_fetch_row ( $res ) ) {
133 $rpt_end = date_to_epoch ( $row[2] );
136 $rpt_end_date = $row[2];
139 $rpt_sun = ( substr ( $rpt_days, 0, 1 ) == 'y' );
140 $rpt_mon = ( substr ( $rpt_days, 1, 1 ) == 'y' );
141 $rpt_tue = ( substr ( $rpt_days, 2, 1 ) == 'y' );
142 $rpt_wed = ( substr ( $rpt_days, 3, 1 ) == 'y' );
143 $rpt_thu = ( substr ( $rpt_days, 4, 1 ) == 'y' );
144 $rpt_fri = ( substr ( $rpt_days, 5, 1 ) == 'y' );
145 $rpt_sat = ( substr ( $rpt_days, 6, 1 ) == 'y' );
151 $sql = "SELECT cal_login, cal_category FROM webcal_entry_user WHERE cal_id = $id";
152 $res = dbi_query ( $sql );
154 while ( $row = dbi_fetch_row ( $res ) ) {
155 $participants[$row[0]] = 1;
156 if ($login == $row[0]) $cat_id = $row[1];
157 if ( ( $is_assistant || $is_admin ) && $user == $row[0]) $cat_id = $row[1];
160 if ( ! empty ( $allow_external_users ) && $allow_external_users == "Y" ) {
161 $external_users = event_get_external_users ( $id );
165 $id = 0; // to avoid warnings below about use of undefined var
166 // Anything other then testing for strlen breaks either hour=0 or no hour in URL
167 if ( strlen ( $hour ) ) {
173 if ( ! empty ( $defusers ) ) {
174 $tmp_ar = explode ( ",", $defusers );
175 for ( $i = 0; $i < count ( $tmp_ar ); $i++ ) {
176 $participants[$tmp_ar[$i]] = 1;
179 if ( $readonly == "N" ) {
180 // If public, then make sure we can add events
181 if ( $login == '__public__' ) {
182 if ( $public_access_can_add )
190 if ( ! empty ( $year ) && $year )
192 if ( ! empty ( $month ) && $month )
194 if ( ! empty ( $day ) && $day )
196 if ( empty ( $rpt_type ) || ! $rpt_type )
199 // avoid error for using undefined vars
200 if ( ! isset ( $hour ) )
202 if ( empty ( $duration ) )
204 if ( $duration == ( 24 * 60 ) ) {
205 $hour = $minute = $duration = "";
209 if ( empty ( $name ) )
211 if ( empty ( $description ) )
213 if ( empty ( $priority ) )
215 if ( empty ( $access ) )
217 if ( empty ( $rpt_freq ) )
219 if ( empty ( $rpt_end_date ) )
222 if ( ( empty ( $year ) || ! $year ) &&
223 ( empty ( $month ) || ! $month ) &&
224 ( ! empty ( $date ) && strlen ( $date ) ) ) {
225 $thisyear = $year = substr ( $date, 0, 4 );
226 $thismonth = $month = substr ( $date, 4, 2 );
227 $thisday = $day = substr ( $date, 6, 2 );
230 if ( empty ( $cal_date ) )
231 $cal_date = date ( "Ymd" );
233 if ( empty ( $thisyear ) )
234 $thisdate = date ( "Ymd" );
236 $thisdate = sprintf ( "%04d%02d%02d",
237 empty ( $thisyear ) ? date ( "Y" ) : $thisyear,
238 empty ( $thismonth ) ? date ( "m" ) : $thismonth,
239 empty ( $thisday ) ? date ( "d" ) : $thisday );
241 if ( empty ( $cal_date ) || ! $cal_date )
242 $cal_date = $thisdate;
244 if ( $allow_html_description == "Y" ){
245 // Allow HTML in description
246 // If they have installed the htmlarea widget, make use of it
247 $textareasize = 'rows="15" cols="50"';
248 if ( file_exists ( "includes/htmlarea/htmlarea.php" ) ) {
249 $BodyX = 'onload="initEditor();timetype_handler();rpttype_handler()"';
250 $INC = array ( 'htmlarea/htmlarea.php', 'js/edit_entry.php',
251 'js/visible.php', 'htmlarea/core.php' );
253 // No htmlarea files found...
254 $BodyX = 'onload="timetype_handler();rpttype_handler()"';
255 $INC = array ( 'js/edit_entry.php', 'js/visible.php' );
258 $textareasize = 'rows="5" cols="40"';
259 $BodyX = 'onload="timetype_handler();rpttype_handler()"';
260 $INC = array('js/edit_entry.php','js/visible.php');
263 print_header ( $INC, '', $BodyX );
267 <h2><?php if ( $id ) echo translate("Edit Entry"); else echo translate("Add Entry"); ?> <img src="help.gif" alt="<?php etranslate("Help")?>" class="help" onclick="window.open ( 'help_edit_entry.php<?php if ( empty ( $id ) ) echo "?add=1"; ?>', 'cal_help', 'dependent,menubar,scrollbars,height=400,width=400,innerHeight=420,outerWidth=420');" /></h2>
273 <form action="edit_entry_handler.php" method="post" name="editentryform">
276 if ( ! empty ( $id ) && ( empty ( $copy ) || $copy != '1' ) ) echo "<input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
277 // we need an additional hidden input field
278 echo "<input type=\"hidden\" name=\"entry_changed\" value=\"\" />\n";
280 // are we overriding an entry from a repeating event...
281 if ( ! empty ( $override ) ) {
282 echo "<input type=\"hidden\" name=\"override\" value=\"1\" />\n";
283 echo "<input type=\"hidden\" name=\"override_date\" value=\"$cal_date\" />\n";
285 // if assistant, need to remember boss = user
286 if ( $is_assistant || $is_nonuser_admin || ! empty ( $user ) )
287 echo "<input type=\"hidden\" name=\"user\" value=\"$user\" />\n";
289 // if has cal_group_id was set, need to send parent = $parent
290 if ( ! empty ( $parent ) )
291 echo "<input type=\"hidden\" name=\"parent\" value=\"$parent\" />\n";
296 <?php if ( $useTabs ) { ?>
298 <span class="tabfor" id="tab_details"><a href="#tabdetails" onclick="return showTab('details')"><?php etranslate("Details") ?></a></span>
299 <?php if ( $disable_participants_field != "Y" ) { ?>
300 <span class="tabbak" id="tab_participants"><a href="#tabparticipants" onclick="return showTab('participants')"><?php etranslate("Participants") ?></a></span>
302 <?php if ( $disable_repeating_field != "Y" ) { ?>
303 <span class="tabbak" id="tab_pete"><a href="#tabpete" onclick="return showTab('pete')"><?php etranslate("Repeat") ?></a></span>
309 <?php if ( $useTabs ) { ?>
310 <div id="tabscontent">
312 <a name="tabdetails"></a>
313 <div id="tabscontent_details">
315 <table style="border-width:0px;">
316 <tr><td style="width:14%;" class="tooltip" title="<?php etooltip("brief-description-help")?>">
317 <label for="entry_brief"><?php etranslate("Brief Description")?>:</label></td><td>
318 <input type="text" name="name" id="entry_brief" size="25" value="<?php
319 echo htmlspecialchars ( $name );
320 ?>" /></td><td style="width:35%;">
322 <tr><td style="vertical-align:top;" class="tooltip" title="<?php etooltip("full-description-help")?>">
323 <label for="entry_full"><?php etranslate("Full Description")?>:</label></td><td>
324 <textarea name="description" id="entry_full" <?php
327 echo htmlspecialchars ( $description );
328 ?></textarea></td><td style="vertical-align:top;">
330 <?php if (( ! empty ( $categories ) ) || ( $disable_access_field != "Y" ) ||
331 ( $disable_priority_field != "Y" ) ){ // new table for extra fields ?>
334 <?php if ( $disable_access_field != "Y" ) { ?>
335 <tr><td class="tooltip" title="<?php etooltip("access-help")?>">
336 <label for="entry_access"><?php etranslate("Access")?>:</label></td><td>
337 <select name="access" id="entry_access">
338 <option value="P"<?php if ( $access == "P" || ! strlen ( $access ) ) echo " selected=\"selected\"";?>><?php etranslate("Public")?></option>
339 <option value="R"<?php if ( $access == "R" ) echo " selected=\"selected\"";?>><?php etranslate("Confidential")?></option>
343 <?php if ( $disable_priority_field != "Y" ) { ?>
344 <tr><td class="tooltip" title="<?php etooltip("priority-help")?>">
345 <label for="entry_prio"><?php etranslate("Priority")?>: </label></td><td>
346 <select name="priority" id="entry_prio">
347 <option value="1"<?php if ( $priority == 1 ) echo " selected=\"selected\"";?>><?php etranslate("Low")?></option>
348 <option value="2"<?php if ( $priority == 2 || $priority == 0 ) echo " selected=\"selected\"";?>><?php etranslate("Medium")?></option>
349 <option value="3"<?php if ( $priority == 3 ) echo " selected=\"selected\"";?>><?php etranslate("High")?></option>
353 <?php if ( ! empty ( $categories ) ) { ?>
354 <tr><td class="tooltip" title="<?php etooltip("category-help")?>">
355 <label for="entry_categories"><?php etranslate("Category")?>: </label></td><td>
356 <select name="cat_id" id="entry_categories">
357 <option value=""><?php etranslate("None")?></option>
359 foreach( $categories as $K => $V ){
360 echo " <option value=\"$K\"";
361 if ( $cat_id == $K ) echo " selected=\"selected\"";
362 echo ">$V</option>\n";
367 <?php } //end if (! empty ($categories)) ?>
368 <?php if (( ! empty ( $categories ) ) || ( $disable_access_field != "Y" ) ||
369 ( $disable_priority_field != "Y" ) ){ // end the table ?>
374 <tr><td class="tooltip" title="<?php etooltip("date-help")?>">
375 <?php etranslate("Date")?>:</td><td colspan="2">
377 print_date_selection ( "", $cal_date );
380 <tr><td> </td><td colspan="2">
381 <select name="timetype" onchange="timetype_handler()">
382 <option value="U" <?php if ( $allday != "Y" && $hour == -1 ) echo " selected=\"selected\""?>><?php etranslate("Untimed event"); ?></option>
383 <option value="T" <?php if ( $allday != "Y" && $hour >= 0 ) echo " selected=\"selected\""?>><?php etranslate("Timed event"); ?></option>
384 <option value="A" <?php if ( $allday == "Y" ) echo " selected=\"selected\""?>><?php etranslate("All day event"); ?></option>
387 <tr id="timeentrystart"><td class="tooltip" title="<?php etooltip("time-help")?>">
388 <?php echo translate("Time") . ":"; ?></td><td colspan="2">
391 $amsel = " checked=\"checked\""; $pmsel = "";
392 if ( $TIME_FORMAT == "12" ) {
394 $amsel = " checked=\"checked\""; $pmsel = "";
396 $amsel = ""; $pmsel = " checked=\"checked\"";
399 if ( $h12 == 0 ) $h12 = 12;
404 <input type="text" name="hour" size="2" value="<?php
405 if ( $time >= 0 && $allday != 'Y' ) echo $h12;
406 ?>" maxlength="2" />:<input type="text" name="minute" size="2" value="<?php
407 if ( $time >= 0 && $allday != "Y" ) printf ( "%02d", $minute );
410 if ( $TIME_FORMAT == "12" ) {
411 echo "<label><input type=\"radio\" name=\"ampm\" value=\"am\" $amsel /> " .
412 translate("am") . "</label>\n";
413 echo "<label><input type=\"radio\" name=\"ampm\" value=\"pm\" $pmsel /> " .
414 translate("pm") . "</label>\n";
419 $dur_h = (int)( $duration / 60 );
420 $dur_m = $duration % 60;
422 if ($GLOBALS['TIMED_EVT_LEN'] != 'E') { ?>
424 <tr id="timeentryduration"><td>
425 <span class="tooltip" title="<?php
426 etooltip("duration-help")
428 etranslate("Duration")
429 ?>: </span></td><td colspan="2">
430 <input type="text" name="duration_h" id="duration_h" size="2" maxlength="2" value="<?php
431 if ( $allday != "Y" ) printf ( "%d", $dur_h );
432 ?>" />:<input type="text" name="duration_m" id="duration_m" size="2" maxlength="2" value="<?php
433 if ( $allday != "Y" )
434 printf ( "%02d", $dur_m );
435 ?>" /> (<label for="duration_h"><?php
436 echo translate("hours")
437 ?></label>: <label for="duration_m"><?php
438 echo translate("minutes")
444 if ( $TIME_FORMAT == "12" ) {
445 // Convert to a twenty-four hour time scale
446 if ( !empty ( $amsel ) && $t_h12 == 12 )
448 if ( !empty ( $pmsel ) && $t_h12 < 12 )
450 } //end 12-hour time format
453 $endhour = $t_h12 + $dur_h;
454 $endminute = $minute + $dur_m;
455 $endhour = $endhour + (int)( $endminute / 60 );
458 if ( $TIME_FORMAT == "12" ) {
459 // Convert back to a standard time format
460 if ( $endhour < 12 ) {
461 $endamsel = " checked=\"checked\""; $endpmsel = "";
463 $endamsel = ""; $endpmsel = " checked=\"checked\"";
464 } //end if ( $endhour < 12 )
466 if ( $endhour == 0 ) $endhour = 12;
467 } //end if ( $TIME_FORMAT == "12" )
470 $endminute = $minute;
474 if ( $allday != "Y" && $hour == -1 ) {
477 } //end if ( $allday != "Y" && $hour == -1 )
479 <span id="timeentryend" class="tooltip" title="<?php etooltip("end-time-help")?>"> -
480 <input type="text" name="endhour" size="2" value="<?php
481 if ( $allday != "Y" ) echo $endhour;
482 ?>" maxlength="2" />:<input type="text" name="endminute" size="2" value="<?php
483 if ( $time >= 0 && $allday != "Y" ) printf ( "%02d", $endminute );
486 if ( $TIME_FORMAT == "12" ) {
487 echo "<label><input type=\"radio\" name=\"endampm\" value=\"am\" $endamsel /> " .
488 translate("am") . "</label>\n";
489 echo "<label><input type=\"radio\" name=\"endampm\" value=\"pm\" $endpmsel /> " .
490 translate("pm") . "</label>\n";
499 // site-specific extra fields (see site_extras.php)
500 // load any site-specific fields and display them
502 $extras = get_site_extra_fields ( $id );
503 for ( $i = 0; $i < count ( $site_extras ); $i++ ) {
504 $extra_name = $site_extras[$i][0];
505 $extra_descr = $site_extras[$i][1];
506 $extra_type = $site_extras[$i][2];
507 $extra_arg1 = $site_extras[$i][3];
508 $extra_arg2 = $site_extras[$i][4];
509 //echo "<tr><td>Extra " . $extra_name . " - " . $site_extras[$i][2] .
510 // " - " . $extras[$extra_name]['cal_name'] .
511 // "arg1: $extra_arg1, arg2: $extra_arg2 </td></tr>\n";
512 if ( $extra_type == $EXTRA_MULTILINETEXT )
513 echo "<tr><td style=\"vertical-align:top; font-weight:bold;\"><br />\n";
515 echo "<tr><td style=\"font-weight:bold;\">";
516 echo translate ( $extra_descr ) . ":</td><td>\n";
517 if ( $extra_type == $EXTRA_URL ) {
518 echo "<input type=\"text\" size=\"50\" name=\"" . $extra_name .
519 "\" value=\"" . ( empty ( $extras[$extra_name]['cal_data'] ) ?
520 "" : htmlspecialchars ( $extras[$extra_name]['cal_data'] ) ) . "\" />";
521 } else if ( $extra_type == $EXTRA_EMAIL ) {
522 echo "<input type=\"text\" size=\"30\" name=\"" . $extra_name . "\" value=\"" . ( empty ( $extras[$extra_name]['cal_data'] ) ?
523 "" : htmlspecialchars ( $extras[$extra_name]['cal_data'] ) ) . "\" />";
524 } else if ( $extra_type == $EXTRA_DATE ) {
525 if ( ! empty ( $extras[$extra_name]['cal_date'] ) )
526 print_date_selection ( $extra_name, $extras[$extra_name]['cal_date'] );
528 print_date_selection ( $extra_name, $cal_date );
529 } else if ( $extra_type == $EXTRA_TEXT ) {
530 $size = ( $extra_arg1 > 0 ? $extra_arg1 : 50 );
531 echo "<input type=\"text\" size=\"" . $size . "\" name=\"" . $extra_name .
532 "\" value=\"" . ( empty ( $extras[$extra_name]['cal_data'] ) ?
533 "" : htmlspecialchars ( $extras[$extra_name]['cal_data'] ) ) . "\" />";
534 } else if ( $extra_type == $EXTRA_MULTILINETEXT ) {
535 $cols = ( $extra_arg1 > 0 ? $extra_arg1 : 50 );
536 $rows = ( $extra_arg2 > 0 ? $extra_arg2 : 5 );
537 echo "<textarea rows=\"" . $rows . "\" cols=\"" . $cols . "\" name=\"" . $extra_name . "\">" . ( empty ( $extras[$extra_name]['cal_data'] ) ?
538 "" : htmlspecialchars ( $extras[$extra_name]['cal_data'] ) ) . "</textarea>";
539 } else if ( $extra_type == $EXTRA_USER ) {
540 // show list of calendar users...
541 echo "<select name=\"" . $extra_name . "\">\n";
542 echo "<option value=\"\">None</option>\n";
543 $userlist = get_my_users ();
544 for ( $j = 0; $j < count ( $userlist ); $j++ ) {
545 echo "<option value=\"" . $userlist[$j]['cal_login'] . "\"";
546 if ( ! empty ( $extras[$extra_name]['cal_data'] ) &&
547 $userlist[$j]['cal_login'] == $extras[$extra_name]['cal_data'] )
548 echo " selected=\"selected\"";
549 echo ">" . $userlist[$j]['cal_fullname'] . "</option>\n";
552 } else if ( $extra_type == $EXTRA_REMINDER ) {
553 $rem_status = 0; // don't send
554 echo "<label><input type=\"radio\" name=\"" . $extra_name . "\" value=\"1\"";
555 if ( empty ( $id ) ) {
556 // adding event... check default
557 if ( ( $extra_arg2 & $EXTRA_REMINDER_DEFAULT_YES ) > 0 )
560 // editing event... check status
561 if ( ! empty ( $extras[$extra_name]['cal_remind'] ) )
565 echo " checked=\"checked\"";
567 etranslate ( "Yes" );
568 echo "</label> <label><input type=\"radio\" name=\"" . $extra_name . "\" value=\"0\"";
570 echo " checked=\"checked\"";
573 echo "</label> ";
574 if ( ( $extra_arg2 & $EXTRA_REMINDER_WITH_DATE ) > 0 ) {
575 if ( ! empty ( $extras[$extra_name]['cal_date'] ) &&
576 $extras[$extra_name]['cal_date'] > 0 )
577 print_date_selection ( $extra_name, $extras[$extra_name]['cal_date'] );
579 print_date_selection ( $extra_name, $cal_date );
580 } else if ( ( $extra_arg2 & $EXTRA_REMINDER_WITH_OFFSET ) > 0 ) {
581 if ( ! empty ( $extras[$extra_name]['cal_data'] ) )
582 $minutes = $extras[$extra_name]['cal_data'];
584 $minutes = $extra_arg1;
585 // will be specified in total minutes
586 $d = (int) ( $minutes / ( 24 * 60 ) );
587 $minutes -= ( $d * 24 * 60 );
588 $h = (int) ( $minutes / 60 );
589 $minutes -= ( $h * 60 );
590 echo "<label><input type=\"text\" size=\"2\" name=\"" . $extra_name .
591 "_days\" value=\"$d\" /> " . translate("days") . "</label> \n";
592 echo "<label><input type=\"text\" size=\"2\" name=\"" . $extra_name .
593 "_hours\" value=\"$h\" /> " . translate("hours") . "</label> \n";
594 echo "<label><input type=\"text\" size=\"2\" name=\"" . $extra_name .
595 "_minutes\" value=\"$minutes\" /> " . translate("minutes") . " " . translate("before event") . "</label>";
597 } else if ( $extra_type == $EXTRA_SELECTLIST ) {
598 // show custom select list.
599 echo "<select name=\"" . $extra_name . "\">\n";
600 if ( is_array ( $extra_arg1 ) ) {
601 for ( $j = 0; $j < count ( $extra_arg1 ); $j++ ) {
603 if ( ! empty ( $extras[$extra_name]['cal_data'] ) &&
604 $extra_arg1[$j] == $extras[$extra_name]['cal_data'] )
605 echo " selected=\"selected\"";
606 echo ">" . $extra_arg1[$j] . "</option>\n";
613 // end site-specific extra fields
616 <?php if ( $useTabs ) { ?>
618 <?php } /* $useTabs */ ?>
620 <!-- PARTICIPANTS -->
621 <?php if ( $useTabs ) { ?>
622 <a name="tabparticipants"></a>
623 <div id="tabscontent_participants">
624 <?php } /* $useTabs */ ?>
627 // Only ask for participants if we are multi-user.
628 $show_participants = ( $disable_participants_field != "Y" );
630 $show_participants = true;
631 if ( $login == "__public__" && $public_access_others != "Y" )
632 $show_participants = false;
634 if ( $single_user == "N" && $show_participants ) {
635 $userlist = get_my_users ();
636 if ($nonuser_enabled == "Y" ) {
637 $nonusers = get_nonuser_cals ();
638 $userlist = ($nonuser_at_top == "Y") ? array_merge($nonusers, $userlist) : array_merge($userlist, $nonusers);
643 for ( $i = 0; $i < count ( $userlist ); $i++ ) {
644 $l = $userlist[$i]['cal_login'];
646 $users .= "<option value=\"" . $l . "\"";
648 if ( ! empty ($participants[$l]) )
649 $users .= " selected=\"selected\"";
651 if ( ! empty ($defusers) ) {
652 // default selection of participants was in the URL
653 if ( ! empty ( $participants[$l] ) )
654 $users .= " selected=\"selected\"";
656 if ( ($l == $login && ! $is_assistant && ! $is_nonuser_admin) || (! empty ($user) && $l == $user) )
657 $users .= " selected=\"selected\"";
659 if ( $l == '__public__' &&
660 ! empty ($public_access_default_selected) &&
661 $public_access_default_selected == 'Y' )
662 $users .= " selected=\"selected\"";
664 $users .= ">" . $userlist[$i]['cal_fullname'] . "</option>\n";
669 else if ( $size > 5 )
671 print "<tr title=\"" .
672 tooltip("participants-help") . "\"><td class=\"tooltipselect\">\n<label for=\"entry_part\">" .
673 translate("Participants") . ":</label></td><td>\n";
674 print "<select name=\"participants[]\" id=\"entry_part\" size=\"$size\" multiple=\"multiple\">$users\n";
676 if ( $groups_enabled == "Y" ) {
677 echo "<input type=\"button\" onclick=\"selectUsers()\" value=\"" .
678 translate("Select") . "...\" />\n";
680 echo "<input type=\"button\" onclick=\"showSchedule()\" value=\"" .
681 translate("Availability") . "...\" />\n";
682 print "</td></tr>\n";
685 if ( ! empty ( $allow_external_users ) && $allow_external_users == "Y" ) {
686 print "<tr title=\"" .
687 tooltip("external-participants-help") . "\"><td style=\"vertical-align:top;\" class=\"tooltip\">\n<label for=\"entry_extpart\">" .
688 translate("External Participants") . ":</label></td><td>\n";
689 print "<textarea name=\"externalparticipants\" id=\"entry_extpart\" rows=\"5\" cols=\"40\">";
690 print $external_users . "</textarea>\n</td></tr>\n";
695 <?php if ( $useTabs ) { ?>
697 <?php } /* $useTabs */ ?>
699 <!-- REPEATING INFO -->
700 <?php if ( $disable_repeating_field != "Y" ) { ?>
701 <?php if ( $useTabs ) { ?>
702 <a name="tabpete"></a>
703 <div id="tabscontent_pete">
704 <?php } /* $useTabs */ ?>
706 <tr style="vertical-align:top;"><td class="tooltip" title="<?php etooltip("repeat-type-help")?>">
707 <label for="rpttype"><?php etranslate("Repeat Type")?>:</label></td><td>
708 <select name="rpt_type" id="rpttype" onchange="rpttype_handler()">
710 echo " <option value=\"none\"" .
711 ( strcmp ( $rpt_type, 'none' ) == 0 ? " selected=\"selected\"" : "" ) . ">" .
714 echo " <option value=\"daily\"" .
715 ( strcmp ( $rpt_type, 'daily' ) == 0 ? " selected=\"selected\"" : "" ) . ">" .
718 echo " <option value=\"weekly\"" .
719 ( strcmp ( $rpt_type, 'weekly' ) == 0 ? " selected=\"selected\"" : "" ) . ">" .
720 translate("Weekly") .
722 echo " <option value=\"monthlyByDay\"" .
723 ( strcmp ( $rpt_type, 'monthlyByDay' ) == 0 ? " selected=\"selected\"" : "" ) . ">" .
724 translate("Monthly") . " (" . translate("by day") . ")" . "
726 echo " <option value=\"monthlyByDayR\"" .
727 ( strcmp ( $rpt_type, 'monthlyByDayR' ) == 0 ? " selected=\"selected\"" : "" ) . ">" .
728 translate("Monthly") . " (" . translate("by day (from end)") . ")" .
730 echo " <option value=\"monthlyByDate\"" .
731 ( strcmp ( $rpt_type, 'monthlyByDate' ) == 0 ? " selected=\"selected\"" : "" ) . ">" .
732 translate("Monthly") . " (" . translate("by date") . ")" .
734 echo " <option value=\"yearly\"" .
735 ( strcmp ( $rpt_type, 'yearly' ) == 0 ? " selected=\"selected\"" : "" ) . ">" .
736 translate("Yearly") .
741 <tr id="rptenddate" style="visibility:hidden;"><td class="tooltip" title="<?php etooltip("repeat-end-date-help")?>">
742 <?php etranslate("Repeat End Date")?>:</td><td>
743 <label><input type="checkbox" name="rpt_end_use" value="y" <?php
744 echo ( ! empty ( $rpt_end ) ? " checked=\"checked\"" : "" );
745 ?> /> <?php etranslate("Use end date")?></label>
747 <span class="end_day_selection"><?php
748 print_date_selection ( "rpt_", $rpt_end_date ? $rpt_end_date : $cal_date )
751 <tr id="rptfreq" style="visibility:hidden;" title="<?php etooltip("repeat-frequency-help")?>"><td class="tooltip">
752 <label for="entry_freq"><?php etranslate("Frequency")?>:</label></td><td>
753 <input type="text" name="rpt_freq" id="entry_freq" size="4" maxlength="4" value="<?php echo $rpt_freq; ?>" />
755 <tr id="rptday" style="visibility:hidden;" title="<?php etooltip("repeat-day-help")?>"><td class="tooltip">
756 <?php etranslate("Repeat Day")?>: </td><td>
758 if( $WEEK_START != 1)
759 echo "<label><input type=\"checkbox\" name=\"rpt_sun\" value=\"y\""
760 . (!empty($rpt_sun)?" checked=\"checked\"":"") . " /> " . translate("Sunday") .
762 echo "<label><input type=\"checkbox\" name=\"rpt_mon\" value=\"y\""
763 . (!empty($rpt_mon)?" checked=\"checked\"":"") . " /> " . translate("Monday") .
765 echo "<label><input type=\"checkbox\" name=\"rpt_tue\" value=\"y\""
766 . (!empty($rpt_tue)?" checked=\"checked\"":"") . " /> " . translate("Tuesday") .
768 echo "<label><input type=\"checkbox\" name=\"rpt_wed\" value=\"y\""
769 . (!empty($rpt_wed)?" checked=\"checked\"":"") . " /> " . translate("Wednesday") .
771 echo "<label><input type=\"checkbox\" name=\"rpt_thu\" value=\"y\""
772 . (!empty($rpt_thu)?" checked=\"checked\"":"") . " /> " . translate("Thursday") .
774 echo "<label><input type=\"checkbox\" name=\"rpt_fri\" value=\"y\""
775 . (!empty($rpt_fri)?" checked=\"checked\"":"") . " /> " . translate("Friday") .
777 echo "<label><input type=\"checkbox\" name=\"rpt_sat\" value=\"y\""
778 . (!empty($rpt_sat)?" checked=\"checked\"":"") . " /> " . translate("Saturday") .
780 if( $WEEK_START == 1)
781 echo "<label><input type=\"checkbox\" name=\"rpt_sun\" value=\"y\""
782 . (!empty($rpt_sun)?" checked=\"checked\"":"") . " /> " . translate("Sunday") .
787 <?php if ( $useTabs ) { ?>
788 </div> <!-- End tabscontent_pete -->
789 <?php } /* $useTabs */ ?>
791 </div> <!-- End tabscontent -->
792 <table style="border-width:0px;">
794 <script type="text/javascript">
796 document.writeln ( '<input type="button" value="<?php etranslate("Save")?>" onclick="validate_and_submit()" />' );
800 <input type="submit" value="<?php etranslate("Save")?>" />
804 <input type="hidden" name="participant_list" value="" />
807 <?php if ( $id > 0 && ( $login == $create_by || $single_user == "Y" || $is_admin ) ) { ?>
808 <a href="del_entry.php?id=<?php echo $id;?>" onclick="return confirm('<?php etranslate("Are you sure you want to delete this entry?")?>');"><?php etranslate("Delete entry")?></a><br />
810 } //end if clause for delete link
812 echo translate("You are not authorized to edit this entry") . ".";
813 } //end if ( $can_edit )
816 <?php print_trailer(); ?>