3 * $Id: edit_entry.php,v 1.91.2.2 2006/03/15 03:14:54 umcesrjones Exp $
6 * Presents page to edit/add an event
9 * If htmlarea is installed, users can use WYSIWYG editing.
10 * SysAdmin must enable HTML for event full descriptions.
11 * The htmlarea files should be installed so that the htmlarea.php
12 * file is in ../includes/htmlarea/htmlarea.php
13 * The htmlarea code can be downloaded from:
14 * http://www.htmlarea.com
16 * This file will not pass XHTML validation with HTMLArea enabled
18 include_once 'includes/init.php';
19 include_once 'includes/site_extras.php';
21 load_user_categories ();
23 // Default for using tabs is enabled
24 if ( empty ( $EVENT_EDIT_TABS ) )
25 $EVENT_EDIT_TABS = 'Y'; // default
26 $useTabs = ( $EVENT_EDIT_TABS == 'Y' );
28 // make sure this is not a read-only calendar
31 // Public access can only add events, not edit.
32 if ( $login == "__public__" && $id > 0 ) {
37 $participants = array ();
39 if ( $readonly == 'Y' ) {
41 } else if ( ! empty ( $id ) && $id > 0 ) {
42 // first see who has access to edit this entry
47 if ( $readonly == "N" || $is_admin ) {
48 $sql = "SELECT webcal_entry.cal_id FROM webcal_entry, " .
49 "webcal_entry_user WHERE webcal_entry.cal_id = " .
50 "webcal_entry_user.cal_id AND webcal_entry.cal_id = $id " .
51 "AND (webcal_entry.cal_create_by = '$login' " .
52 "OR webcal_entry_user.cal_login = '$login')";
53 $res = dbi_query ( $sql );
55 $row = dbi_fetch_row ( $res );
56 if ( $row && $row[0] > 0 )
58 dbi_free_result ( $res );
62 $sql = "SELECT cal_create_by, cal_date, cal_time, cal_mod_date, " .
63 "cal_mod_time, cal_duration, cal_priority, cal_type, cal_access, " .
64 "cal_name, cal_description, cal_group_id FROM webcal_entry WHERE cal_id = " . $id;
65 $res = dbi_query ( $sql );
67 $row = dbi_fetch_row ( $res );
68 if ( ! empty ( $override ) && ! empty ( $date ) ) {
69 // Leave $cal_date to what was set in URL with date=YYYYMMDD
75 if (( $user == $create_by ) && ( $is_assistant || $is_nonuser_admin )) $can_edit = true;
77 $year = (int) ( $cal_date / 10000 );
78 $month = ( $cal_date / 100 ) % 100;
79 $day = $cal_date % 100;
81 // test for AllDay event, if so, don't adjust time
82 if ( $time > 0 || ( $time == 0 && $row[5] != 1440 ) ) { /* -1 = no time specified */
83 $time += ( ! empty ( $TZ_OFFSET )?$TZ_OFFSET : 0) * 10000;
84 if ( $time > 240000 ) {
86 $gmt = mktime ( 3, 0, 0, $month, $day, $year );
88 $month = date ( "m", $gmt );
89 $day = date ( "d", $gmt );
90 $year = date ( "Y", $gmt );
91 } else if ( $time < 0 ) {
93 $gmt = mktime ( 3, 0, 0, $month, $day, $year );
95 $month = date ( "m", $gmt );
96 $day = date ( "d", $gmt );
97 $year = date ( "Y", $gmt );
100 $cal_date = sprintf("%04d%02d%02d",$year,$month,$day);
103 $hour = floor($time / 10000);
104 $minute = ( $time / 100 ) % 100;
114 $description = $row[10];
116 // check for repeating event info...
117 // but not if we are overriding a single entry of an already repeating
118 // event... confusing, eh?
119 if ( ! empty ( $override ) ) {
122 $rpt_end_date = $cal_date;
124 $rpt_days = "nnnnnnn";
125 $rpt_sun = $rpt_mon = $rpt_tue = $rpt_wed =
126 $rpt_thu = $rpt_fri = $rpt_sat = false;
128 $res = dbi_query ( "SELECT cal_id, cal_type, cal_end, " .
129 "cal_frequency, cal_days FROM webcal_entry_repeats " .
130 "WHERE cal_id = $id" );
132 if ( $row = dbi_fetch_row ( $res ) ) {
135 $rpt_end = date_to_epoch ( $row[2] );
138 $rpt_end_date = $row[2];
141 $rpt_sun = ( substr ( $rpt_days, 0, 1 ) == 'y' );
142 $rpt_mon = ( substr ( $rpt_days, 1, 1 ) == 'y' );
143 $rpt_tue = ( substr ( $rpt_days, 2, 1 ) == 'y' );
144 $rpt_wed = ( substr ( $rpt_days, 3, 1 ) == 'y' );
145 $rpt_thu = ( substr ( $rpt_days, 4, 1 ) == 'y' );
146 $rpt_fri = ( substr ( $rpt_days, 5, 1 ) == 'y' );
147 $rpt_sat = ( substr ( $rpt_days, 6, 1 ) == 'y' );
153 $sql = "SELECT cal_login, cal_category FROM webcal_entry_user WHERE cal_id = $id";
154 $res = dbi_query ( $sql );
156 while ( $row = dbi_fetch_row ( $res ) ) {
157 $participants[$row[0]] = 1;
158 if ($login == $row[0]) $cat_id = $row[1];
159 if ( ( $is_assistant || $is_admin ) && $user == $row[0]) $cat_id = $row[1];
162 if ( ! empty ( $allow_external_users ) && $allow_external_users == "Y" ) {
163 $external_users = event_get_external_users ( $id );
167 $id = 0; // to avoid warnings below about use of undefined var
168 // Anything other then testing for strlen breaks either hour=0 or no hour in URL
169 if ( strlen ( $hour ) ) {
175 if ( ! empty ( $defusers ) ) {
176 $tmp_ar = explode ( ",", $defusers );
177 for ( $i = 0; $i < count ( $tmp_ar ); $i++ ) {
178 $participants[$tmp_ar[$i]] = 1;
181 if ( $readonly == "N" ) {
182 // If public, then make sure we can add events
183 if ( $login == '__public__' ) {
184 if ( $public_access_can_add )
192 if ( ! empty ( $year ) && $year )
194 if ( ! empty ( $month ) && $month )
196 if ( ! empty ( $day ) && $day )
198 if ( empty ( $rpt_type ) || ! $rpt_type )
201 // avoid error for using undefined vars
202 if ( ! isset ( $hour ) )
204 if ( empty ( $duration ) )
206 if ( $duration == ( 24 * 60 ) ) {
207 $hour = $minute = $duration = "";
211 if ( empty ( $name ) )
213 if ( empty ( $description ) )
215 if ( empty ( $priority ) )
217 if ( empty ( $access ) )
219 if ( empty ( $rpt_freq ) )
221 if ( empty ( $rpt_end_date ) )
224 if ( ( empty ( $year ) || ! $year ) &&
225 ( empty ( $month ) || ! $month ) &&
226 ( ! empty ( $date ) && strlen ( $date ) ) ) {
227 $thisyear = $year = substr ( $date, 0, 4 );
228 $thismonth = $month = substr ( $date, 4, 2 );
229 $thisday = $day = substr ( $date, 6, 2 );
232 if ( empty ( $cal_date ) )
233 $cal_date = date ( "Ymd" );
235 if ( empty ( $thisyear ) )
236 $thisdate = date ( "Ymd" );
238 $thisdate = sprintf ( "%04d%02d%02d",
239 empty ( $thisyear ) ? date ( "Y" ) : $thisyear,
240 empty ( $thismonth ) ? date ( "m" ) : $thismonth,
241 empty ( $thisday ) ? date ( "d" ) : $thisday );
243 if ( empty ( $cal_date ) || ! $cal_date )
244 $cal_date = $thisdate;
246 if ( $allow_html_description == "Y" ){
247 // Allow HTML in description
248 // If they have installed the htmlarea widget, make use of it
249 $textareasize = 'rows="15" cols="50"';
250 if ( file_exists ( "includes/htmlarea/htmlarea.php" ) ) {
251 $BodyX = 'onload="initEditor();timetype_handler();rpttype_handler()"';
252 $INC = array ( 'htmlarea/htmlarea.php', 'js/edit_entry.php',
253 'js/visible.php', 'htmlarea/core.php' );
255 // No htmlarea files found...
256 $BodyX = 'onload="timetype_handler();rpttype_handler()"';
257 $INC = array ( 'js/edit_entry.php', 'js/visible.php' );
260 $textareasize = 'rows="5" cols="40"';
261 $BodyX = 'onload="timetype_handler();rpttype_handler()"';
262 $INC = array('js/edit_entry.php','js/visible.php');
265 print_header ( $INC, '', $BodyX );
269 <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>
275 <form action="edit_entry_handler.php" method="post" name="editentryform">
278 if ( ! empty ( $id ) && ( empty ( $copy ) || $copy != '1' ) ) echo "<input type=\"hidden\" name=\"id\" value=\"$id\" />\n";
279 // we need an additional hidden input field
280 echo "<input type=\"hidden\" name=\"entry_changed\" value=\"\" />\n";
282 // are we overriding an entry from a repeating event...
283 if ( ! empty ( $override ) ) {
284 echo "<input type=\"hidden\" name=\"override\" value=\"1\" />\n";
285 echo "<input type=\"hidden\" name=\"override_date\" value=\"$cal_date\" />\n";
287 // if assistant, need to remember boss = user
288 if ( $is_assistant || $is_nonuser_admin || ! empty ( $user ) )
289 echo "<input type=\"hidden\" name=\"user\" value=\"$user\" />\n";
291 // if has cal_group_id was set, need to send parent = $parent
292 if ( ! empty ( $parent ) )
293 echo "<input type=\"hidden\" name=\"parent\" value=\"$parent\" />\n";
298 <?php if ( $useTabs ) { ?>
300 <span class="tabfor" id="tab_details"><a href="#tabdetails" onclick="return showTab('details')"><?php etranslate("Details") ?></a></span>
301 <?php if ( $disable_participants_field != "Y" ) { ?>
302 <span class="tabbak" id="tab_participants"><a href="#tabparticipants" onclick="return showTab('participants')"><?php etranslate("Participants") ?></a></span>
304 <?php if ( $disable_repeating_field != "Y" ) { ?>
305 <span class="tabbak" id="tab_pete"><a href="#tabpete" onclick="return showTab('pete')"><?php etranslate("Repeat") ?></a></span>
311 <?php if ( $useTabs ) { ?>
312 <div id="tabscontent">
314 <a name="tabdetails"></a>
315 <div id="tabscontent_details">
317 <table style="border-width:0px;">
318 <tr><td style="width:14%;" class="tooltip" title="<?php etooltip("brief-description-help")?>">
319 <label for="entry_brief"><?php etranslate("Brief Description")?>:</label></td><td>
320 <input type="text" name="name" id="entry_brief" size="25" value="<?php
321 echo htmlspecialchars ( $name );
322 ?>" /></td><td style="width:35%;">
324 <tr><td style="vertical-align:top;" class="tooltip" title="<?php etooltip("full-description-help")?>">
325 <label for="entry_full"><?php etranslate("Full Description")?>:</label></td><td>
326 <textarea name="description" id="entry_full" <?php
329 echo htmlspecialchars ( $description );
330 ?></textarea></td><td style="vertical-align:top;">
332 <?php if (( ! empty ( $categories ) ) || ( $disable_access_field != "Y" ) ||
333 ( $disable_priority_field != "Y" ) ){ // new table for extra fields ?>
336 <?php if ( $disable_access_field != "Y" ) { ?>
337 <tr><td class="tooltip" title="<?php etooltip("access-help")?>">
338 <label for="entry_access"><?php etranslate("Access")?>:</label></td><td>
339 <select name="access" id="entry_access">
340 <option value="P"<?php if ( $access == "P" || ! strlen ( $access ) ) echo " selected=\"selected\"";?>><?php etranslate("Public")?></option>
341 <option value="R"<?php if ( $access == "R" ) echo " selected=\"selected\"";?>><?php etranslate("Confidential")?></option>
345 <?php if ( $disable_priority_field != "Y" ) { ?>
346 <tr><td class="tooltip" title="<?php etooltip("priority-help")?>">
347 <label for="entry_prio"><?php etranslate("Priority")?>: </label></td><td>
348 <select name="priority" id="entry_prio">
349 <option value="1"<?php if ( $priority == 1 ) echo " selected=\"selected\"";?>><?php etranslate("Low")?></option>
350 <option value="2"<?php if ( $priority == 2 || $priority == 0 ) echo " selected=\"selected\"";?>><?php etranslate("Medium")?></option>
351 <option value="3"<?php if ( $priority == 3 ) echo " selected=\"selected\"";?>><?php etranslate("High")?></option>
355 <?php if ( ! empty ( $categories ) ) { ?>
356 <tr><td class="tooltip" title="<?php etooltip("category-help")?>">
357 <label for="entry_categories"><?php etranslate("Category")?>: </label></td><td>
358 <select name="cat_id" id="entry_categories">
359 <option value=""><?php etranslate("None")?></option>
361 foreach( $categories as $K => $V ){
362 echo " <option value=\"$K\"";
363 if ( $cat_id == $K ) echo " selected=\"selected\"";
364 echo ">$V</option>\n";
369 <?php } //end if (! empty ($categories)) ?>
370 <?php if (( ! empty ( $categories ) ) || ( $disable_access_field != "Y" ) ||
371 ( $disable_priority_field != "Y" ) ){ // end the table ?>
376 <tr><td class="tooltip" title="<?php etooltip("date-help")?>">
377 <?php etranslate("Date")?>:</td><td colspan="2">
379 print_date_selection ( "", $cal_date );
382 <tr><td> </td><td colspan="2">
383 <select name="timetype" onchange="timetype_handler()">
384 <option value="U" <?php if ( $allday != "Y" && $hour == -1 ) echo " selected=\"selected\""?>><?php etranslate("Untimed event"); ?></option>
385 <option value="T" <?php if ( $allday != "Y" && $hour >= 0 ) echo " selected=\"selected\""?>><?php etranslate("Timed event"); ?></option>
386 <option value="A" <?php if ( $allday == "Y" ) echo " selected=\"selected\""?>><?php etranslate("All day event"); ?></option>
389 <tr id="timeentrystart"><td class="tooltip" title="<?php etooltip("time-help")?>">
390 <?php echo translate("Time") . ":"; ?></td><td colspan="2">
393 $amsel = " checked=\"checked\""; $pmsel = "";
394 if ( $TIME_FORMAT == "12" ) {
396 $amsel = " checked=\"checked\""; $pmsel = "";
398 $amsel = ""; $pmsel = " checked=\"checked\"";
401 if ( $h12 == 0 ) $h12 = 12;
406 <input type="text" name="hour" size="2" value="<?php
407 if ( $time >= 0 && $allday != 'Y' ) echo $h12;
408 ?>" maxlength="2" />:<input type="text" name="minute" size="2" value="<?php
409 if ( $time >= 0 && $allday != "Y" ) printf ( "%02d", $minute );
412 if ( $TIME_FORMAT == "12" ) {
413 echo "<label><input type=\"radio\" name=\"ampm\" value=\"am\" $amsel /> " .
414 translate("am") . "</label>\n";
415 echo "<label><input type=\"radio\" name=\"ampm\" value=\"pm\" $pmsel /> " .
416 translate("pm") . "</label>\n";
421 $dur_h = (int)( $duration / 60 );
422 $dur_m = $duration % 60;
424 if ($GLOBALS['TIMED_EVT_LEN'] != 'E') { ?>
426 <tr id="timeentryduration"><td>
427 <span class="tooltip" title="<?php
428 etooltip("duration-help")
430 etranslate("Duration")
431 ?>: </span></td><td colspan="2">
432 <input type="text" name="duration_h" id="duration_h" size="2" maxlength="2" value="<?php
433 if ( $allday != "Y" ) printf ( "%d", $dur_h );
434 ?>" />:<input type="text" name="duration_m" id="duration_m" size="2" maxlength="2" value="<?php
435 if ( $allday != "Y" )
436 printf ( "%02d", $dur_m );
437 ?>" /> (<label for="duration_h"><?php
438 echo translate("hours")
439 ?></label>: <label for="duration_m"><?php
440 echo translate("minutes")
446 if ( $TIME_FORMAT == "12" ) {
447 // Convert to a twenty-four hour time scale
448 if ( !empty ( $amsel ) && $t_h12 == 12 )
450 if ( !empty ( $pmsel ) && $t_h12 < 12 )
452 } //end 12-hour time format
455 $endhour = $t_h12 + $dur_h;
456 $endminute = $minute + $dur_m;
457 $endhour = $endhour + (int)( $endminute / 60 );
460 if ( $TIME_FORMAT == "12" ) {
461 // Convert back to a standard time format
462 if ( $endhour < 12 ) {
463 $endamsel = " checked=\"checked\""; $endpmsel = "";
465 $endamsel = ""; $endpmsel = " checked=\"checked\"";
466 } //end if ( $endhour < 12 )
468 if ( $endhour == 0 ) $endhour = 12;
469 } //end if ( $TIME_FORMAT == "12" )
472 $endminute = $minute;
476 if ( $allday != "Y" && $hour == -1 ) {
479 } //end if ( $allday != "Y" && $hour == -1 )
481 <span id="timeentryend" class="tooltip" title="<?php etooltip("end-time-help")?>"> -
482 <input type="text" name="endhour" size="2" value="<?php
483 if ( $allday != "Y" ) echo $endhour;
484 ?>" maxlength="2" />:<input type="text" name="endminute" size="2" value="<?php
485 if ( $time >= 0 && $allday != "Y" ) printf ( "%02d", $endminute );
488 if ( $TIME_FORMAT == "12" ) {
489 echo "<label><input type=\"radio\" name=\"endampm\" value=\"am\" $endamsel /> " .
490 translate("am") . "</label>\n";
491 echo "<label><input type=\"radio\" name=\"endampm\" value=\"pm\" $endpmsel /> " .
492 translate("pm") . "</label>\n";
501 // site-specific extra fields (see site_extras.php)
502 // load any site-specific fields and display them
504 $extras = get_site_extra_fields ( $id );
505 for ( $i = 0; $i < count ( $site_extras ); $i++ ) {
506 $extra_name = $site_extras[$i][0];
507 $extra_descr = $site_extras[$i][1];
508 $extra_type = $site_extras[$i][2];
509 $extra_arg1 = $site_extras[$i][3];
510 $extra_arg2 = $site_extras[$i][4];
511 //echo "<tr><td>Extra " . $extra_name . " - " . $site_extras[$i][2] .
512 // " - " . $extras[$extra_name]['cal_name'] .
513 // "arg1: $extra_arg1, arg2: $extra_arg2 </td></tr>\n";
514 if ( $extra_type == $EXTRA_MULTILINETEXT )
515 echo "<tr><td style=\"vertical-align:top; font-weight:bold;\"><br />\n";
517 echo "<tr><td style=\"font-weight:bold;\">";
518 echo translate ( $extra_descr ) . ":</td><td>\n";
519 if ( $extra_type == $EXTRA_URL ) {
520 echo "<input type=\"text\" size=\"50\" name=\"" . $extra_name .
521 "\" value=\"" . ( empty ( $extras[$extra_name]['cal_data'] ) ?
522 "" : htmlspecialchars ( $extras[$extra_name]['cal_data'] ) ) . "\" />";
523 } else if ( $extra_type == $EXTRA_EMAIL ) {
524 echo "<input type=\"text\" size=\"30\" name=\"" . $extra_name . "\" value=\"" . ( empty ( $extras[$extra_name]['cal_data'] ) ?
525 "" : htmlspecialchars ( $extras[$extra_name]['cal_data'] ) ) . "\" />";
526 } else if ( $extra_type == $EXTRA_DATE ) {
527 if ( ! empty ( $extras[$extra_name]['cal_date'] ) )
528 print_date_selection ( $extra_name, $extras[$extra_name]['cal_date'] );
530 print_date_selection ( $extra_name, $cal_date );
531 } else if ( $extra_type == $EXTRA_TEXT ) {
532 $size = ( $extra_arg1 > 0 ? $extra_arg1 : 50 );
533 echo "<input type=\"text\" size=\"" . $size . "\" name=\"" . $extra_name .
534 "\" value=\"" . ( empty ( $extras[$extra_name]['cal_data'] ) ?
535 "" : htmlspecialchars ( $extras[$extra_name]['cal_data'] ) ) . "\" />";
536 } else if ( $extra_type == $EXTRA_MULTILINETEXT ) {
537 $cols = ( $extra_arg1 > 0 ? $extra_arg1 : 50 );
538 $rows = ( $extra_arg2 > 0 ? $extra_arg2 : 5 );
539 echo "<textarea rows=\"" . $rows . "\" cols=\"" . $cols . "\" name=\"" . $extra_name . "\">" . ( empty ( $extras[$extra_name]['cal_data'] ) ?
540 "" : htmlspecialchars ( $extras[$extra_name]['cal_data'] ) ) . "</textarea>";
541 } else if ( $extra_type == $EXTRA_USER ) {
542 // show list of calendar users...
543 echo "<select name=\"" . $extra_name . "\">\n";
544 echo "<option value=\"\">None</option>\n";
545 $userlist = get_my_users ();
546 for ( $j = 0; $j < count ( $userlist ); $j++ ) {
547 echo "<option value=\"" . $userlist[$j]['cal_login'] . "\"";
548 if ( ! empty ( $extras[$extra_name]['cal_data'] ) &&
549 $userlist[$j]['cal_login'] == $extras[$extra_name]['cal_data'] )
550 echo " selected=\"selected\"";
551 echo ">" . $userlist[$j]['cal_fullname'] . "</option>\n";
554 } else if ( $extra_type == $EXTRA_REMINDER ) {
555 $rem_status = 0; // don't send
556 echo "<label><input type=\"radio\" name=\"" . $extra_name . "\" value=\"1\"";
557 if ( empty ( $id ) ) {
558 // adding event... check default
559 if ( ( $extra_arg2 & $EXTRA_REMINDER_DEFAULT_YES ) > 0 )
562 // editing event... check status
563 if ( ! empty ( $extras[$extra_name]['cal_remind'] ) )
567 echo " checked=\"checked\"";
569 etranslate ( "Yes" );
570 echo "</label> <label><input type=\"radio\" name=\"" . $extra_name . "\" value=\"0\"";
572 echo " checked=\"checked\"";
575 echo "</label> ";
576 if ( ( $extra_arg2 & $EXTRA_REMINDER_WITH_DATE ) > 0 ) {
577 if ( ! empty ( $extras[$extra_name]['cal_date'] ) &&
578 $extras[$extra_name]['cal_date'] > 0 )
579 print_date_selection ( $extra_name, $extras[$extra_name]['cal_date'] );
581 print_date_selection ( $extra_name, $cal_date );
582 } else if ( ( $extra_arg2 & $EXTRA_REMINDER_WITH_OFFSET ) > 0 ) {
583 if ( ! empty ( $extras[$extra_name]['cal_data'] ) )
584 $minutes = $extras[$extra_name]['cal_data'];
586 $minutes = $extra_arg1;
587 // will be specified in total minutes
588 $d = (int) ( $minutes / ( 24 * 60 ) );
589 $minutes -= ( $d * 24 * 60 );
590 $h = (int) ( $minutes / 60 );
591 $minutes -= ( $h * 60 );
592 echo "<label><input type=\"text\" size=\"2\" name=\"" . $extra_name .
593 "_days\" value=\"$d\" /> " . translate("days") . "</label> \n";
594 echo "<label><input type=\"text\" size=\"2\" name=\"" . $extra_name .
595 "_hours\" value=\"$h\" /> " . translate("hours") . "</label> \n";
596 echo "<label><input type=\"text\" size=\"2\" name=\"" . $extra_name .
597 "_minutes\" value=\"$minutes\" /> " . translate("minutes") . " " . translate("before event") . "</label>";
599 } else if ( $extra_type == $EXTRA_SELECTLIST ) {
600 // show custom select list.
601 echo "<select name=\"" . $extra_name . "\">\n";
602 if ( is_array ( $extra_arg1 ) ) {
603 for ( $j = 0; $j < count ( $extra_arg1 ); $j++ ) {
605 if ( ! empty ( $extras[$extra_name]['cal_data'] ) &&
606 $extra_arg1[$j] == $extras[$extra_name]['cal_data'] )
607 echo " selected=\"selected\"";
608 echo ">" . $extra_arg1[$j] . "</option>\n";
615 // end site-specific extra fields
618 <?php if ( $useTabs ) { ?>
620 <?php } /* $useTabs */ ?>
622 <!-- PARTICIPANTS -->
623 <?php if ( $useTabs ) { ?>
624 <a name="tabparticipants"></a>
625 <div id="tabscontent_participants">
626 <?php } /* $useTabs */ ?>
629 // Only ask for participants if we are multi-user.
630 $show_participants = ( $disable_participants_field != "Y" );
632 $show_participants = true;
633 if ( $login == "__public__" && $public_access_others != "Y" )
634 $show_participants = false;
636 if ( $single_user == "N" && $show_participants ) {
637 $userlist = get_my_users ();
638 if ($nonuser_enabled == "Y" ) {
639 $nonusers = get_nonuser_cals ();
640 $userlist = ($nonuser_at_top == "Y") ? array_merge($nonusers, $userlist) : array_merge($userlist, $nonusers);
645 for ( $i = 0; $i < count ( $userlist ); $i++ ) {
646 $l = $userlist[$i]['cal_login'];
648 $users .= "<option value=\"" . $l . "\"";
650 if ( ! empty ($participants[$l]) )
651 $users .= " selected=\"selected\"";
653 if ( ! empty ($defusers) ) {
654 // default selection of participants was in the URL
655 if ( ! empty ( $participants[$l] ) )
656 $users .= " selected=\"selected\"";
658 if ( ($l == $login && ! $is_assistant && ! $is_nonuser_admin) || (! empty ($user) && $l == $user) )
659 $users .= " selected=\"selected\"";
661 if ( $l == '__public__' &&
662 ! empty ($public_access_default_selected) &&
663 $public_access_default_selected == 'Y' )
664 $users .= " selected=\"selected\"";
666 $users .= ">" . $userlist[$i]['cal_fullname'] . "</option>\n";
671 else if ( $size > 5 )
673 print "<tr title=\"" .
674 tooltip("participants-help") . "\"><td class=\"tooltipselect\">\n<label for=\"entry_part\">" .
675 translate("Participants") . ":</label></td><td>\n";
676 print "<select name=\"participants[]\" id=\"entry_part\" size=\"$size\" multiple=\"multiple\">$users\n";
678 if ( $groups_enabled == "Y" ) {
679 echo "<input type=\"button\" onclick=\"selectUsers()\" value=\"" .
680 translate("Select") . "...\" />\n";
682 echo "<input type=\"button\" onclick=\"showSchedule()\" value=\"" .
683 translate("Availability") . "...\" />\n";
684 print "</td></tr>\n";
687 if ( ! empty ( $allow_external_users ) && $allow_external_users == "Y" ) {
688 print "<tr title=\"" .
689 tooltip("external-participants-help") . "\"><td style=\"vertical-align:top;\" class=\"tooltip\">\n<label for=\"entry_extpart\">" .
690 translate("External Participants") . ":</label></td><td>\n";
691 print "<textarea name=\"externalparticipants\" id=\"entry_extpart\" rows=\"5\" cols=\"40\">";
692 print $external_users . "</textarea>\n</td></tr>\n";
697 <?php if ( $useTabs ) { ?>
699 <?php } /* $useTabs */ ?>
701 <!-- REPEATING INFO -->
702 <?php if ( $disable_repeating_field != "Y" ) { ?>
703 <?php if ( $useTabs ) { ?>
704 <a name="tabpete"></a>
705 <div id="tabscontent_pete">
706 <?php } /* $useTabs */ ?>
708 <tr style="vertical-align:top;"><td class="tooltip" title="<?php etooltip("repeat-type-help")?>">
709 <label for="rpttype"><?php etranslate("Repeat Type")?>:</label></td><td>
710 <select name="rpt_type" id="rpttype" onchange="rpttype_handler()">
712 echo " <option value=\"none\"" .
713 ( strcmp ( $rpt_type, 'none' ) == 0 ? " selected=\"selected\"" : "" ) . ">" .
716 echo " <option value=\"daily\"" .
717 ( strcmp ( $rpt_type, 'daily' ) == 0 ? " selected=\"selected\"" : "" ) . ">" .
720 echo " <option value=\"weekly\"" .
721 ( strcmp ( $rpt_type, 'weekly' ) == 0 ? " selected=\"selected\"" : "" ) . ">" .
722 translate("Weekly") .
724 echo " <option value=\"monthlyByDay\"" .
725 ( strcmp ( $rpt_type, 'monthlyByDay' ) == 0 ? " selected=\"selected\"" : "" ) . ">" .
726 translate("Monthly") . " (" . translate("by day") . ")" . "
728 echo " <option value=\"monthlyByDayR\"" .
729 ( strcmp ( $rpt_type, 'monthlyByDayR' ) == 0 ? " selected=\"selected\"" : "" ) . ">" .
730 translate("Monthly") . " (" . translate("by day (from end)") . ")" .
732 echo " <option value=\"monthlyByDate\"" .
733 ( strcmp ( $rpt_type, 'monthlyByDate' ) == 0 ? " selected=\"selected\"" : "" ) . ">" .
734 translate("Monthly") . " (" . translate("by date") . ")" .
736 echo " <option value=\"yearly\"" .
737 ( strcmp ( $rpt_type, 'yearly' ) == 0 ? " selected=\"selected\"" : "" ) . ">" .
738 translate("Yearly") .
743 <tr id="rptenddate" style="visibility:hidden;"><td class="tooltip" title="<?php etooltip("repeat-end-date-help")?>">
744 <?php etranslate("Repeat End Date")?>:</td><td>
745 <label><input type="checkbox" name="rpt_end_use" value="y" <?php
746 echo ( ! empty ( $rpt_end ) ? " checked=\"checked\"" : "" );
747 ?> /> <?php etranslate("Use end date")?></label>
749 <span class="end_day_selection"><?php
750 print_date_selection ( "rpt_", $rpt_end_date ? $rpt_end_date : $cal_date )
753 <tr id="rptfreq" style="visibility:hidden;" title="<?php etooltip("repeat-frequency-help")?>"><td class="tooltip">
754 <label for="entry_freq"><?php etranslate("Frequency")?>:</label></td><td>
755 <input type="text" name="rpt_freq" id="entry_freq" size="4" maxlength="4" value="<?php echo $rpt_freq; ?>" />
757 <tr id="rptday" style="visibility:hidden;" title="<?php etooltip("repeat-day-help")?>"><td class="tooltip">
758 <?php etranslate("Repeat Day")?>: </td><td>
760 if( $WEEK_START != 1)
761 echo "<label><input type=\"checkbox\" name=\"rpt_sun\" value=\"y\""
762 . (!empty($rpt_sun)?" checked=\"checked\"":"") . " /> " . translate("Sunday") .
764 echo "<label><input type=\"checkbox\" name=\"rpt_mon\" value=\"y\""
765 . (!empty($rpt_mon)?" checked=\"checked\"":"") . " /> " . translate("Monday") .
767 echo "<label><input type=\"checkbox\" name=\"rpt_tue\" value=\"y\""
768 . (!empty($rpt_tue)?" checked=\"checked\"":"") . " /> " . translate("Tuesday") .
770 echo "<label><input type=\"checkbox\" name=\"rpt_wed\" value=\"y\""
771 . (!empty($rpt_wed)?" checked=\"checked\"":"") . " /> " . translate("Wednesday") .
773 echo "<label><input type=\"checkbox\" name=\"rpt_thu\" value=\"y\""
774 . (!empty($rpt_thu)?" checked=\"checked\"":"") . " /> " . translate("Thursday") .
776 echo "<label><input type=\"checkbox\" name=\"rpt_fri\" value=\"y\""
777 . (!empty($rpt_fri)?" checked=\"checked\"":"") . " /> " . translate("Friday") .
779 echo "<label><input type=\"checkbox\" name=\"rpt_sat\" value=\"y\""
780 . (!empty($rpt_sat)?" checked=\"checked\"":"") . " /> " . translate("Saturday") .
782 if( $WEEK_START == 1)
783 echo "<label><input type=\"checkbox\" name=\"rpt_sun\" value=\"y\""
784 . (!empty($rpt_sun)?" checked=\"checked\"":"") . " /> " . translate("Sunday") .
789 <?php if ( $useTabs ) { ?>
790 </div> <!-- End tabscontent_pete -->
791 <?php } /* $useTabs */ ?>
793 </div> <!-- End tabscontent -->
794 <table style="border-width:0px;">
796 <script type="text/javascript">
798 document.writeln ( '<input type="button" value="<?php etranslate("Save")?>" onclick="validate_and_submit()" />' );
802 <input type="submit" value="<?php etranslate("Save")?>" />
806 <input type="hidden" name="participant_list" value="" />
809 <?php if ( $id > 0 && ( $login == $create_by || $single_user == "Y" || $is_admin ) ) { ?>
810 <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 />
812 } //end if clause for delete link
814 echo translate("You are not authorized to edit this entry") . ".";
815 } //end if ( $can_edit )
818 <?php print_trailer(); ?>