WebCalendar PHP Cross Reference Groupware Applications

Source: /edit_entry.php - 1644 lines - 62641 bytes - Summary - Text - Print

   1  <?php
   2  /* $Id: edit_entry.php,v 1.203.2.13 2012/02/28 02:49:39 cknudsen Exp $
   3   *
   4   * Description:
   5   * Presents page to edit/add an event/task/journal
   6   *
   7   * Notes:
   8   * A SysAdmin can enable HTML for event full descriptions. If one of the
   9   * supported HTML edit widgets is also installed, users can use WYSIWYG editing.
  10   * See the WebCalendar page at
  11   * http://www.k5n.us/webcalendar.php?topic=Add-Ons
  12   * for download and install instructions for these packages.
  13   */
  14  include_once  'includes/init.php';
  15  
  16  /* Generate HTML for a time selection for use in a form.
  17   *
  18   * @param string $prefix Prefix to use in front of form element names
  19   * @param string $time   Currently selected time in HHMMSS
  20   * @param bool $trigger  Add onchange event trigger that
  21   *                       calls javascript function $prefix_timechanged ()
  22   *
  23   * @return string HTML for the selection box
  24   */
  25  function time_selection ( $prefix, $time = '', $trigger = false ) {
  26    global $checked, $ENTRY_SLOTS, $selected, $TIME_FORMAT, $WORK_DAY_START_HOUR;
  27  
  28    $amsel = $pmsel = $ret = '';
  29    $trigger_str = ( $trigger ? 'onchange="' . $prefix . 'timechanged() ' : '' );
  30  
  31    if ( ! isset ( $time ) && $time != 0 ) {
  32      $hour = $WORK_DAY_START_HOUR;
  33      $minute = 0;
  34    } else {
  35      $hour = floor ( $time / 10000 );
  36      $minute = ( ( $time / 100 ) % 100 ) % 60;
  37    }
  38    if ( $TIME_FORMAT == '12' ) {
  39      $maxhour = 12;
  40      if ( $hour < 12 || $hour == 24 )
  41        $amsel = $checked;
  42      else
  43        $pmsel = $checked;
  44  
  45      $hour %= 12;
  46      if ( $hour == 0 )
  47        $hour = 12;
  48    } else {
  49      $maxhour = 24;
  50      $hour = sprintf ( "%02d", $hour );
  51    }
  52    $minute = sprintf ( "%02d", $minute );
  53    $ret .= '
  54              <select ' . 'name="' . $prefix . 'hour" id="' . $prefix . 'hour" '
  55     . $trigger_str . '>';
  56    for ( $i = 0; $i < $maxhour; $i++ ) {
  57      $ihour = ( $TIME_FORMAT == '24' ? sprintf ( "%02d", $i ) : $i );
  58      if ( $i == 0 && $TIME_FORMAT == '12' )
  59        $ihour = 12;
  60  
  61      $ret .= '
  62                <option value="' . "$i\"" . ( $ihour == $hour ? $selected : '' )
  63       . ">$ihour" . '</option>';
  64    }
  65    $ret .= '
  66              </select>:
  67              <select ' . 'name="' . $prefix . 'minute" id="' . $prefix
  68     . 'minute" ' . $trigger_str . '>';
  69    // We use $TIME_SLOTS to populate the minutes pulldown.
  70    $found = false;
  71    for ( $i = 0; $i < 60; ) {
  72      $imin = sprintf ( "%02d", $i );
  73      $isselected = '';
  74      if ( $imin == $minute ) {
  75        $found = true;
  76        $isselected = $selected;
  77      }
  78      $ret .= '
  79                <option value="' . "$i\"$isselected>$imin" . '</option>';
  80      $i += ( 1440 / $ENTRY_SLOTS );
  81    }
  82    // We'll add an option with the exact time if not found above.
  83    return $ret . ( $found ? '' : '
  84                <option value="' . "$minute\" $selected>$minute" . '</option>' ) . '
  85              </select>' . ( $TIME_FORMAT == '12' ? '
  86              <label><input type="radio" name="' . $prefix . 'ampm" id="'
  87       . $prefix . 'ampmA" value="0" ' . $amsel . ' />&nbsp;' . translate ( 'am' )
  88       . '</label>
  89              <label><input type="radio" name="' . $prefix . 'ampm" id="'
  90       . $prefix . 'ampmP" value="12" ' . $pmsel . ' />&nbsp;' . translate ( 'pm' )
  91       . '</label>' : '
  92              <input type="hidden" name="' . $prefix . 'ampm" value="0" />' );
  93  }
  94  
  95  $daysStr = translate ( 'days' );
  96  $hoursStr = translate ( 'hours' );
  97  $minutStr = translate ( 'minutes' );
  98  $saveStr = translate ( 'Save' );
  99  
 100  load_user_categories ();
 101  
 102  // Default for using tabs is enabled.
 103  if ( empty ( $EVENT_EDIT_TABS ) )
 104    $EVENT_EDIT_TABS = 'Y'; // default
 105  
 106  $useTabs = ( $EVENT_EDIT_TABS == 'Y' );
 107  // Make sure this is not a read-only calendar.
 108  $can_edit = false;
 109  $others_complete = 'yes';
 110  $checked = ' checked="checked"';
 111  $selected = ' selected="selected"';
 112  
 113  // Public access can only add events, not edit.
 114  if ( empty ( $login ) || ( $login == '__public__' && $id > 0 ) )
 115    $id = 0;
 116  
 117  $eType = getGetValue ( 'eType' );
 118  if ( empty ( $eType ) )
 119    $eType = 'event';
 120  
 121  $copy = getValue ( 'copy', '[01]' );
 122  $date = getValue ( 'date', '-?[0-9]+' );
 123  $day = getValue ( 'day', '-?[0-9]+' );
 124  $month = getValue ( 'month', '-?[0-9]+' );
 125  $year = getValue ( 'year', '-?[0-9]+' );
 126  
 127  if ( empty ( $date ) && empty ( $month ) ) {
 128    if ( empty ( $year ) )
 129      $year = date ( 'Y' );
 130  
 131    $month = date ( 'm' );
 132  
 133    if ( empty ( $day ) )
 134      $day = date ( 'd' );
 135  
 136    $date = sprintf ( "%04d%02d%02d", $year, $month, $day );
 137  }
 138  
 139  $BodyX = 'onload="onLoad();"';
 140  $INC = array ( 'js/edit_entry.php/false/' . $user, 'js/visible.php' );
 141  $textareasize = '15';
 142  
 143  // Can we use HTMLArea or FCKEditor? (Relax! That's the authors initials.)
 144  // Note: HTMLArea has been discontinued, so FCKEditor is preferred.
 145  $use_fckeditor = $use_htmlarea = false;
 146  
 147  if ( $ALLOW_HTML_DESCRIPTION == 'Y' ) {
 148    // Allow HTML in description.
 149    // If they have installed an HTML edit widget, make use of it.
 150    if ( file_exists ( 'includes/FCKeditor-2.0/fckeditor.js' ) &&
 151        file_exists ( 'includes/FCKeditor-2.0/fckconfig.js' ) ) {
 152      $textareasize = '20';
 153      $use_fckeditor = true;
 154    } else
 155    if ( file_exists ( 'includes/htmlarea/htmlarea.php' ) ) {
 156      $BodyX = 'onload="onLoad();initEditor();';
 157      $INC[] = 'htmlarea/core.php/true';
 158      $INC[] = 'htmlarea/htmlarea.php/true';
 159      $use_htmlarea = true;
 160    }
 161  }
 162  
 163  $byday = $bymonth = $bymonthday = $bysetpos = $participants = array ();
 164  $exceptions = $inclusions = $reminder = array ();
 165  $byweekno = $byyearday = $catList = $catNames = $external_users = $rpt_count = '';
 166  
 167  $create_by = $login;
 168  
 169  //This is the default per RFC2445
 170  //We could override it and use $byday_names[$WEEK_START]
 171  $wkst = 'MO';
 172  
 173  $real_user = ( ( ! empty ( $user ) && strlen ( $user ) ) &&
 174    ( $is_assistant || $is_admin ) ) ? $user : $login;
 175  
 176  print_header ( $INC, '', $BodyX, false, false, false, true );
 177  
 178  ob_start ();
 179  
 180  if ( $readonly == 'Y' || $is_nonuser )
 181    $can_edit = false;
 182  else
 183  if ( ! empty ( $id ) && $id > 0 ) {
 184    // First see who has access to edit this entry.
 185    if ( $is_admin )
 186      $can_edit = true;
 187  
 188    $res = dbi_execute ( 'SELECT cal_create_by, cal_date, cal_time, cal_mod_date,
 189      cal_mod_time, cal_duration, cal_priority, cal_type, cal_access, cal_name,
 190      cal_description, cal_group_id, cal_location, cal_due_date, cal_due_time,
 191      cal_completed, cal_url FROM webcal_entry WHERE cal_id = ?', array ( $id ) );
 192    if ( $res ) {
 193      $row = dbi_fetch_row ( $res );
 194      // If current user is creator of event, then they can edit.
 195      if ( $row[0] == $login )
 196        $can_edit = true;
 197  
 198      $cal_date = ( ! empty ( $override ) && ! empty ( $date )
 199        ? $date // Leave $cal_date to what was set in URL with date=YYYYMMDD.
 200        : $row[1] );
 201  
 202      $create_by = $row[0];
 203      if ( ( $user == $create_by ) && ( $is_assistant || $is_nonuser_admin ) )
 204        $can_edit = true;
 205  
 206      $cal_time = sprintf ( "%06d", $row[2] );
 207      $due_date = $row[13];
 208      $due_time = $row[14];
 209  
 210      $calTS = date_to_epoch ( $cal_date . $cal_time );
 211      // Don't adjust for All Day entries.
 212      if ( $cal_time > 0 || ( $cal_time == 0 && $row[5] != 1440 ) ) {
 213        $cal_date = date ( 'Ymd', $calTS );
 214        $cal_time = date ( 'His', $calTS );
 215      }
 216      $hour = floor ( $cal_time / 10000 );
 217      $minute = ( $cal_time / 100 ) % 100;
 218  
 219      $dueTS = date_to_epoch ( $due_date . $due_time );
 220      $due_date = date ( 'Ymd', $dueTS );
 221      $due_time = date ( 'His', $dueTS );
 222      $due_hour = floor ( $due_time / 10000 );
 223      $due_minute = ( $due_time / 100 ) % 100;
 224  
 225      $priority = $row[6];
 226      $type = $row[7];
 227      $access = $row[8];
 228      $name = $row[9];
 229      $description = $row[10];
 230      $parent = $row[11];
 231      $location = $row[12];
 232      $completed = ( empty ( $row[15] ) ? date ( 'Ymd' ) : $row[15] );
 233      $cal_url = $row[16];
 234  
 235      // What kind of entry are we dealing with?
 236      if ( strpos ( 'EM', $type ) !== false )
 237        $eType = 'event';
 238      elseif ( strpos ( 'JO', $type ) !== false )
 239        $eType = 'journal';
 240      elseif ( strpos ( 'NT', $type ) !== false )
 241        $eType = 'task';
 242  
 243      // Public access has no access to tasks.
 244      // translate ( 'You are not authorized to edit this task' )
 245      if ( $login == '__public__' && $eType == 'task' )
 246        echo str_replace ( 'XXX', translate ( 'task' ),
 247          translate ( 'You are not authorized to edit this XXX.' ) );
 248  
 249      // Check UAC.
 250      if ( access_is_enabled () )
 251        $can_edit =
 252        access_user_calendar ( 'edit', $create_by, $login, $type, $access );
 253  
 254      $day = $cal_date % 100;
 255      $month = ( $cal_date / 100 ) % 100;
 256      $year = intval ( $cal_date / 10000 );
 257  
 258      $time = $row[2];
 259  
 260      if ( $time >= 0 )
 261        $duration = $row[5];
 262      else {
 263        $duration = '';
 264        $hour = -1;
 265      }
 266  
 267      // Check for repeating event info...
 268      // but not if we're overriding a single entry of an already repeating event...
 269      // confusing, eh?
 270      if ( ! empty ( $override ) ) {
 271        $rpt_end = 0;
 272        $rpt_end_date = $cal_date;
 273        $rpt_freq = 1;
 274        $rpt_type = 'none';
 275      } else {
 276        $res = dbi_execute ( 'SELECT cal_id, cal_type, cal_end, cal_endtime,
 277          cal_frequency, cal_byday, cal_bymonth, cal_bymonthday, cal_bysetpos,
 278          cal_byweekno, cal_byyearday, cal_wkst, cal_count
 279          FROM webcal_entry_repeats WHERE cal_id = ?', array ( $id ) );
 280        if ( $res ) {
 281          if ( $row = dbi_fetch_row ( $res ) ) {
 282            $rpt_type = $row[1];
 283            $rpt_end = ( $row[2] > 0 ? date_to_epoch ( $row[2] . $row[3] ) : 0 );
 284  
 285            if ( empty ( $row[2] ) ) {
 286              $rpt_end_date = $cal_date;
 287              $rpt_end_time = $cal_time;
 288            } else {
 289              $rpt_endTS = date_to_epoch ( $row[2] . $row[3] );
 290              $rpt_end_date = date ( 'Ymd', $rpt_endTS );
 291              $rpt_end_time = date ( 'His', $rpt_endTS );
 292            }
 293            $rpt_freq = $row[4];
 294            if ( ! empty ( $row[5] ) )
 295              $byday = explode ( ',', $row[5] );
 296  
 297            $bydayStr = $row[5];
 298            if ( ! empty ( $row[6] ) )
 299              $bymonth = explode ( ',', $row[6] );
 300  
 301            if ( ! empty ( $row[7] ) )
 302              $bymonthday = explode ( ',', $row[7] );
 303  
 304            $bymonthdayStr = $row[7];
 305            if ( ! empty ( $row[8] ) )
 306              $bysetpos = explode ( ',', $row[8] );
 307  
 308            $bysetposStr = $row[8];
 309            $byweekno = $row[9];
 310            $byyearday = $row[10];
 311            $wkst = $row[11];
 312            $rpt_count = $row[12];
 313  
 314            // Check to see if Weekends Only is applicable.
 315            $weekdays_only = ( $rpt_type == 'daily' && $byday == 'MO,TU,WE,TH,FR' );
 316          }
 317          dbi_free_result ( $res );
 318        }
 319      }
 320  
 321      $res = dbi_execute ( 'SELECT cal_login, cal_percent, cal_status
 322        FROM webcal_entry_user WHERE cal_id = ?', array ( $id ) );
 323      if ( $res ) {
 324        while ( $row = dbi_fetch_row ( $res ) ) {
 325          $overall_percent[] = $row;
 326          if ( $login == $row[0] || ( $is_admin && $user == $row[0] ) ) {
 327            $task_percent = $row[1];
 328            $task_status = $row[2];
 329          }
 330        }
 331        dbi_free_result ( $res );
 332      }
 333  
 334      // Determine if Expert mode needs to be set.
 335      $expert_mode = ( count ( $byday ) || count ( $bymonth ) ||
 336        count ( $bymonthday ) || count ( $bysetpos ) ||
 337        isset ( $byweekno ) || isset ( $byyearday ) || isset ( $rpt_count ) );
 338  
 339      // Get Repeat Exceptions.
 340      $res = dbi_execute ( 'SELECT cal_date, cal_exdate
 341        FROM webcal_entry_repeats_not WHERE cal_id = ?', array ( $id ) );
 342      if ( $res ) {
 343        while ( $row = dbi_fetch_row ( $res ) ) {
 344          if ( $row[1] == 1 )
 345            $exceptions[] = $row[0];
 346          else
 347            $inclusions[] = $row[0];
 348        }
 349        dbi_free_result ( $res );
 350      }
 351    }
 352    if ( $CATEGORIES_ENABLED == 'Y' ) {
 353      $catById = get_categories_by_id ( $id, $real_user, true );
 354      if ( ! empty ( $catById ) ) {
 355        $catNames = implode ( ', ', $catById );
 356        $catList = implode ( ',', array_keys ( $catById ) );
 357      }
 358    } //end CATEGORIES_ENABLED test
 359  
 360    // Get reminders.
 361    $reminder = getReminders ( $id );
 362    $reminder_offset = ( empty ( $reminder ) ? 0 : $reminder['offset'] );
 363      
 364      $rem_status = ( count ( $reminder ));
 365    $rem_use_date = ( ! empty ( $reminder['date'] ) );
 366  
 367    // Get participants.
 368    $res = dbi_execute ( 'SELECT cal_login, cal_status FROM webcal_entry_user WHERE cal_id = ?
 369      AND cal_status IN ( \'A\', \'W\' )', array ( $id ) );
 370    if ( $res ) {
 371      while ( $row = dbi_fetch_row ( $res ) ) {
 372        $participants[$row[0]] = 1;
 373        $selectedStatus[$row[0]] = $row[1];
 374      }
 375      dbi_free_result ( $res );
 376    }
 377    // Not allowed for tasks or journals.
 378    if ( $eType == 'event' && !
 379      empty ( $ALLOW_EXTERNAL_USERS ) && $ALLOW_EXTERNAL_USERS == 'Y' )
 380      $external_users = event_get_external_users ( $id );
 381  } else {
 382    // ##########   New entry   ################
 383    $id = 0; // To avoid warnings below about use of undefined var.
 384  
 385    // We'll use $WORK_DAY_START_HOUR and $WORK_DAY_END_HOUR
 386    // as our starting and due times.
 387    $cal_time = $WORK_DAY_START_HOUR . '0000';
 388    $completed = '';
 389    $due_hour = $WORK_DAY_END_HOUR;
 390    $due_minute = $task_percent = 0;
 391    $due_time = $WORK_DAY_END_HOUR . '0000';
 392    $overall_percent = array ();
 393  
 394    // Get category if passed in URL as cat_id.
 395    $cat_id = getValue ( 'cat_id', '-?[0-9,\-]*', true );
 396    if ( ! empty ( $cat_id ) ) {
 397      $res = dbi_execute ( 'SELECT cat_name FROM webcal_categories
 398        WHERE cat_id = ? AND ( cat_owner = ? OR cat_owner IS NULL )',
 399        array ( $cat_id, $real_user ) );
 400      if ( $res ) {
 401        $row = dbi_fetch_row ( $res );
 402        $catNames = $row[0];
 403        $catList = $cat_id;
 404      }
 405    }
 406  
 407    // Reminder settings.
 408    $reminder_offset = ( $REMINDER_WITH_DATE == 'N' ? $REMINDER_OFFSET : 0 );
 409  
 410      $rem_status = ( $REMINDER_DEFAULT == 'Y' );
 411    $rem_use_date = ( $reminder_offset == 0 && $REMINDER_WITH_DATE == 'Y' );
 412              
 413    if ( $eType == 'task' )
 414      $hour = $WORK_DAY_START_HOUR;
 415  
 416    // Anything other then testing for strlen breaks either hour=0 or no hour in URL.
 417    if ( strlen ( $hour ) )
 418      $time = $hour * 100;
 419    else
 420      $hour = $time = -1;
 421  
 422    if ( ! empty ( $defusers ) ) {
 423      $tmp_ar = explode ( ',', $defusers );
 424      for ( $i = 0, $cnt = count ( $tmp_ar ); $i < $cnt; $i++ ) {
 425        $participants[$tmp_ar[$i]] = 1;
 426      }
 427    }
 428  
 429    //Add the logged in user if none other supplied
 430    if ( count ( $participants )  == 0 )
 431      $participants[$login] = 1;
 432  
 433    if ( $readonly == 'N' ) {
 434      // Is public allowed to add events?
 435      if ( $login == '__public__'  && $PUBLIC_ACCESS_CAN_ADD != 'Y' )
 436          $can_edit = false;
 437      else
 438        $can_edit = true;
 439    }
 440  }
 441  $dateYmd = date ( 'Ymd' );
 442  $thisday = $day;
 443  $thismonth = $month;
 444  $thisyear = $year;
 445  if ( empty ( $rpt_type ) || ! $rpt_type )
 446    $rpt_type = 'none';
 447  
 448  // Avoid error for using undefined vars.
 449  if ( ! isset ( $hour ) && $hour != 0 )
 450    $hour = -1;
 451  else
 452  if ( isset ( $hour ) && $hour >= 0 )
 453    $cal_time = ( $hour * 10000 ) + ( isset ( $minute ) ? $minute * 100 : 0 );
 454  
 455  if ( empty ( $access ) )
 456    $access = '';
 457  
 458  if ( empty ( $cal_url ) )
 459    $cal_url = '';
 460  
 461  if ( empty ( $description ) || $description == '<br />' )
 462    $description = '';
 463  
 464  if ( empty ( $duration ) )
 465    $duration = 0;
 466  
 467  if ( $duration == 1440 && $time == 0 ) {
 468    $duration = $hour = $minute = '';
 469    $allday = 'Y';
 470  } else
 471    $allday = 'N';
 472  
 473  if ( empty ( $location ) )
 474    $location = '';
 475  
 476  if ( empty ( $name ) )
 477    $name = '';
 478  
 479  if ( empty ( $priority ) )
 480    $priority = 5;
 481  
 482  if ( empty ( $rpt_end_date ) )
 483    $rpt_end_date = 0;
 484  
 485  if ( empty ( $rpt_end_time ) )
 486    $rpt_end_time = 0;
 487  
 488  if ( empty ( $rpt_freq ) )
 489    $rpt_freq = 0;
 490  
 491  if ( empty ( $cal_date ) ) {
 492    $cal_date = ( ! empty ( $date ) && $eType != 'task' ? $date : $dateYmd );
 493  
 494    if ( empty ( $due_date ) )
 495      $due_date = $dateYmd;
 496  }
 497  if ( empty ( $thisyear ) )
 498    $thisdate = $dateYmd;
 499  else {
 500    $thisdate = sprintf ( "%04d%02d%02d", $thisyear,
 501      empty ( $thismonth ) ? date ( 'm' ) : $thismonth,
 502      empty ( $thisday ) ? date ( 'd' ) : $thisday );
 503  }
 504  
 505  if ( empty ( $cal_date ) || ! $cal_date )
 506    $cal_date = $thisdate;
 507  
 508  if ( empty ( $due_date ) || ! $due_date )
 509    $due_date = $thisdate;
 510  
 511  // Setup to display user's timezone difference if Admin or Assistant.
 512  // Even though event is stored in GMT,
 513  // an Assistant may need to know that the boss is in a different Timezone.
 514  if ( $is_assistant || $is_admin && ! empty ( $user ) ) {
 515    $tz_offset = date ( 'Z', date_to_epoch ( $cal_date . $cal_time ) );
 516    $user_TIMEZONE = get_pref_setting ( $user, 'TIMEZONE' );
 517    set_env ( 'TZ', $user_TIMEZONE );
 518    $user_tz_offset = date ( 'Z', date_to_epoch ( $cal_date . $cal_time ) );
 519    if ( $tz_offset != $user_tz_offset ) { // Different TZ_Offset.
 520      user_load_variables ( $user, 'temp' );
 521      $tz_diff = ( $user_tz_offset - $tz_offset ) / 3600;
 522      $abs_diff = abs ( $tz_diff );
 523      // translate ( 'is in a different timezone than you are. Currently' )
 524      // translate ( 'hour ahead of you' ) translate ( 'hour behind you' )
 525      // translate ( 'hours ahead of you' ) translate ( 'hours behind you' )
 526      // translate ( 'XXX is in a different timezone (ahead)' )
 527      // translate ( 'XXX is in a different timezone (behind)' )
 528      // Line breaks in translates below are to bypass update_translation.pl.
 529      $TZ_notice = str_replace ( 'XXX',
 530        array ( $tempfullname,
 531          // TODO show hh:mm instead of abs.
 532          $abs_diff . ' ' . translate ( 'hour'
 533             . ( $abs_diff == 1 ? '' : 's' ) ),
 534          translate ( 'Time entered here is based on your Timezone.' ) ),
 535        translate ( 'XXX is in a different timezone ('
 536           . ( $tz_diff > 0 ? 'ahead)' : 'behind)' ) ) );
 537    }
 538    // Return to $login TIMEZONE.
 539    set_env ( 'TZ', $TIMEZONE );
 540  }
 541  
 542  $eType_label = ' ( ' . translate ( $eType ) . ' )';
 543  
 544  echo '
 545      <h2>' . ( $id ? translate ( 'Edit Entry' ) : translate ( 'Add Entry' ) )
 546   . $eType_label . '&nbsp;<img src="images/help.gif" alt="' . translate ( 'Help' )
 547   . '" class="help" onclick="window.open( \'help_edit_entry.php'
 548   . ( empty ( $id ) ? '?add=1' : '' )
 549   . '\', \'cal_help\', \'dependent,menubar,scrollbars,height=400,width=400,'
 550   . 'innerHeight=420,outerWidth=420\' );" /></h2>';
 551  
 552  if ( $can_edit ) {
 553    $tabs_ar = array ( 'details', translate ( 'Details' ) );
 554    if ( $DISABLE_PARTICIPANTS_FIELD != 'Y' ) {
 555      $tabs_ar[] = 'participants';
 556      $tabs_ar[] = translate ( 'Participants' );
 557    }
 558    if ( $DISABLE_REPEATING_FIELD != 'Y' ) {
 559      $tabs_ar[] = 'pete';
 560      $tabs_ar[] = translate ( 'Repeat' );
 561    }
 562    if ( $DISABLE_REMINDER_FIELD != 'Y' ) {
 563      $tabs_ar[] = 'reminder';
 564      $tabs_ar[] = translate ( 'Reminders' );
 565    }
 566  
 567    $tabs = '';
 568    for ( $i = 0, $cnt = count ( $tabs_ar ); $i < $cnt; $i++ ) {
 569      $tabs .= '
 570          <span class="tab'
 571       . ( $i > 0 ? 'bak' : 'for' )
 572       . '" id="tab_' . $tabs_ar[$i]
 573       . '"><a href="#tab' . $tabs_ar[$i] . '" onclick="return showTab( \''
 574       . $tabs_ar[$i] . '\' )">' . $tabs_ar[++$i] . '</a></span>';
 575    }
 576    echo '
 577      <form action="edit_entry_handler.php" method="post" name="editentryform" '
 578     . 'id="editentryform">
 579        <input type="hidden" name="eType" value="' . $eType . '" />'
 580     . ( ! empty ( $id ) && ( empty ( $copy ) || $copy != '1' ) ? '
 581        <input type="hidden" name="cal_id" value="' . $id . '" />' : '' )
 582    /* We need an additional hidden input field. */ . '
 583        <input type="hidden" name="entry_changed" value="" />'
 584    // Are we overriding an entry from a repeating event...
 585    . ( empty ( $override ) ? '' : '
 586        <input type="hidden" name="override" value="1" />
 587        <input type="hidden" name="override_date" value="' . $cal_date . '" />' )
 588    // If assistant, need to remember boss = user.
 589    . ( $is_assistant || $is_nonuser_admin || ! empty ( $user ) ? '
 590        <input type="hidden" name="user" value="' . $user . '" />' : '' )
 591    // If has cal_group_id was set, need to set parent = $parent.
 592    . ( empty ( $parent ) ? '' : '
 593        <input type="hidden" name="parent" value="' . $parent . '" />' ) . '
 594  
 595  <!-- TABS -->' . ( $useTabs ? '
 596        <div id="tabs">' . $tabs . '
 597        </div>' : '' ) . '
 598  
 599  <!-- TABS BODY -->' . ( $useTabs ? '
 600        <div id="tabscontent">
 601  <!-- DETAILS -->
 602          <a name="tabdetails"></a>
 603          <div id="tabscontent_details">' : '
 604        <fieldset>
 605          <legend>' . translate ( 'Details' ) . '</legend>' ) . '
 606            <table border="0" summary="">
 607              <tr>
 608                <td style="width:14%;" class="tooltip" title="'
 609     . tooltip ( 'brief-description-help' ) . '"><label for="entry_brief">'
 610     . translate ( 'Brief Description' ) . ':</label></td>
 611                <td colspan="2"><input type="text" name="name" id="entry_brief" '
 612     . 'size="25" value="' . htmlspecialchars ( $name ) . '" /></td>
 613              </tr>
 614              <tr>
 615                <td class="tooltip aligntop" title="'
 616     . tooltip ( 'full-description-help' ) . '"><label for="entry_full">'
 617     . translate ( 'Full Description' ) . ':</label></td>
 618                <td><textarea name="description" id="entry_full" rows="'
 619     . $textareasize . '" cols="50"' . '>' . htmlspecialchars ( $description )
 620     . '</textarea></td>' . ( $use_fckeditor || $use_htmlarea ? '
 621              </tr>
 622              <tr>
 623                <td colspan="2"' : '
 624                <td' ) . ' class="aligntop">'
 625     . ( ! empty ( $categories ) || $DISABLE_ACCESS_FIELD != 'Y' ||
 626      ( $DISABLE_PRIORITY_FIELD != 'Y' )
 627      /* New table for extra fields. */ ? '
 628                  <table border="0" width="90%" summary="">' : '' )
 629     . ( $DISABLE_ACCESS_FIELD != 'Y' ? '
 630                    <tr>
 631                      <td class="tooltip" title="' . tooltip ( 'access-help' )
 632       . '"><label for="entry_access">' . translate ( 'Access' ) . ':</label></td>
 633                      <td width="80%">
 634                        <select name="access" id="entry_access">
 635                          <option value="P"' . ( $access == 'P' || !
 636        strlen ( $access ) ? $selected : '' ) . '>' . translate ( 'Public' )
 637       . '</option>
 638                          <option value="R"' . ( $access == 'R' ? $selected : '' )
 639       . '>' . translate ( 'Private' ) . '</option>
 640                          <option value="C"' . ( $access == 'C' ? $selected : '' )
 641       . '>' . translate ( 'Confidential' ) . '</option>
 642                        </select>
 643                      </td>
 644                    </tr>' : '' );
 645  
 646    if ( $DISABLE_PRIORITY_FIELD != 'Y' ) {
 647      echo '
 648                    <tr>
 649                      <td class="tooltip" title="' . tooltip ( 'priority-help' )
 650       . '"><label for="entry_prio">' . translate ( 'Priority' )
 651       . ':&nbsp;</label></td>
 652                      <td>
 653                        <select name="priority" id="entry_prio">';
 654      $pri = array ( '',
 655        translate ( 'High' ),
 656        translate ( 'Medium' ),
 657        translate ( 'Low' ) );
 658  
 659      for ( $i = 1; $i <= 9; $i++ ) {
 660        echo '
 661                          <option value="' . $i . '"'
 662         . ( $priority == $i ? $selected : '' )
 663         . '>' . $i . '-' . $pri[ceil ( $i / 3 )] . '</option>';
 664      }
 665      echo '
 666                        </select>
 667                      </td>
 668                    </tr>';
 669    }
 670    echo ( ! empty ( $categories ) && $CATEGORIES_ENABLED == 'Y' ? '
 671                    <tr>
 672                      <td class="tooltip" title="' . tooltip ( 'category-help' )
 673       . '" valign="top">
 674                        <label for="entry_categories">' . translate ( 'Category' )
 675       . ':<br /></label>
 676                        <input type="button" value="' . translate ( 'Edit' )
 677       . '" onclick="editCats( event )" />
 678                      </td>
 679                      <td valign="top">
 680                        <input readonly="readonly" type="text" name="catnames" '
 681       . 'id="entry_categories" value="' . $catNames
 682       . '" size="30" onclick="editCats( event )"/>
 683                        <input type="hidden" name="cat_id" value="' . $catList
 684       . '" />
 685                      </td>
 686                    </tr>' : '' )
 687     . ( ! empty ( $categories ) || $DISABLE_ACCESS_FIELD != 'Y' ||
 688      ( $DISABLE_PRIORITY_FIELD != 'Y' ) ? '
 689                  </table>' : '' );
 690  
 691    if ( $eType == 'task' ) { // Only for tasks.
 692      $completed_visible = ( strlen ( $completed ) ? 'visible' : 'hidden' );
 693      echo '<br />
 694                  <table border="0" summary="">
 695                    <tr id="completed">
 696                      <td class="tooltip" title="' . tooltip ( 'completed-help' )
 697       . '"><label for="task_percent">' . translate ( 'Date Completed' )
 698       . ':&nbsp;</label></td>
 699                      <td>' . date_selection ( 'completed_', $completed ) . '</td>
 700                    </tr>
 701                    <tr>
 702                      <td class="tooltip" title="' . tooltip ( 'percent-help' )
 703       . '"><label for="task_percent">' . translate ( 'Percent Complete' )
 704       . ':&nbsp;</label></td>
 705                      <td>
 706                        <select name="percent" id="task_percent" '
 707       . 'onchange="completed_handler()">';
 708      for ( $i = 0; $i < 101; $i += 10 ) {
 709        echo '
 710                          <option value="' . "$i\" "
 711         . ( $task_percent == $i ? $selected : '' )
 712         . '>' . $i . '</option>';
 713      }
 714      echo '
 715                        </select>
 716                      </td>
 717                    </tr>';
 718  
 719      if ( ! empty ( $overall_percent ) ) {
 720        echo '
 721                    <tr>
 722                      <td colspan="2">
 723                        <table width="100%" border="0" cellpadding="2" '
 724         . 'cellspacing="5" summary="">
 725                          <tr>
 726                            <td colspan="2">' . translate ( 'All Percentages' )
 727         . '</td>
 728                          </tr>';
 729        $others_complete = 'yes';
 730        for ( $i = 0, $cnt = count ( $overall_percent ); $i < $cnt; $i++ ) {
 731          user_load_variables ( $overall_percent[$i][0], 'percent' );
 732          echo '
 733                          <tr>
 734                            <td>' . $percentfullname . '</td>
 735                            <td>' . $overall_percent[$i][1] . '</td>
 736                          </tr>';
 737          if ( $overall_percent[$i][0] != $real_user &&
 738            $overall_percent[$i][1] < 100 )
 739            $others_complete = 'no';
 740        }
 741        echo '
 742                        </table>';
 743      }
 744      echo '
 745                      </td>
 746                    </tr>
 747                  </table>
 748                  <input type="hidden" name="others_complete" value="'
 749       . $others_complete . '" />';
 750    } //end tasks only
 751  
 752    echo '
 753                </td>
 754              </tr>' . ( $DISABLE_LOCATION_FIELD != 'Y' ? '
 755              <tr>
 756                <td class="tooltip" title="' . tooltip ( 'location-help' )
 757       . '"><label for="entry_location">' . translate ( 'Location' )
 758       . ':</label></td>
 759                <td colspan="2"><input type="text" name="location" '
 760       . 'id="entry_location" size="55" value="' . htmlspecialchars ( $location )
 761       . '" /></td>
 762              </tr>' : '' ) . ( $DISABLE_URL_FIELD != 'Y' ? '
 763              <tr>
 764                <td class="tooltip" title="' . tooltip ( 'url-help' )
 765       . '"><label for="entry_url">' . translate ( 'URL' ) . ':</label></td>
 766                <td colspan="2"><input type="text" name="entry_url" id="entry_url" '
 767       . 'size="100" value="' . htmlspecialchars ( $cal_url ) . '" /></td>
 768              </tr>' : '' ) . '
 769              <tr>
 770                <td class="tooltip" title="' . tooltip ( 'date-help' )
 771     . '"><label>'
 772     . ( $eType == 'task' ? translate ( 'Start Date' ) : translate ( 'Date' ) )
 773     . ':</label></td>
 774                <td colspan="2">' . date_selection ( '', $cal_date ) . '</td>
 775              </tr>
 776              <tr>
 777                <td';
 778  
 779    if ( $eType != 'task' ) {
 780      $dur_h = intval ( $duration / 60 );
 781  
 782      echo '>&nbsp;</td>
 783                <td colspan="2">
 784                  <select name="timetype" onchange="timetype_handler()">
 785                    <option value="U" '
 786       . ( $allday != 'Y' && $hour == -1 ? $selected : '' ) . '>'
 787       . translate ( 'Untimed event' ) . '</option>
 788                    <option value="T" '
 789       . ( $allday != 'Y' && $hour >= 0 ? $selected : '' ) . '>'
 790       . translate ( 'Timed event' ) . '</option>
 791                    <option value="A" '
 792       . ( $allday == 'Y' ? $selected : '' ) . '>'
 793       . translate ( 'All day event' ) . '</option>
 794                  </select>
 795                </td>
 796              </tr>' . ( empty ( $TZ_notice ) ? '' : '
 797              <tr id="timezonenotice">
 798                <td class="tooltip" title="'
 799         . tooltip ( 'Time entered here is based on your Timezone.' ) . '">'
 800         . translate ( 'Timezone Offset' ) . ':</td>
 801                <td colspan="2">' . $TZ_notice . '</td>
 802              </tr>' ) . '
 803              <tr id="timeentrystart" style="visibility:hidden;">
 804                <td class="tooltip" title="' . tooltip ( 'time-help' ) . '">'
 805       . translate ( 'Time' ) . ':' . '</td>
 806                <td colspan="2">' . time_selection ( 'entry_', $cal_time );
 807  
 808      if ( $TIMED_EVT_LEN != 'E' ) {
 809        echo '
 810                </td>
 811              </tr>
 812              <tr id="timeentryduration" style="visibility:hidden;">
 813                <td><span class="tooltip" title="' . tooltip ( 'duration-help' )
 814         . '">' . translate ( 'Duration' ) . ':&nbsp;</span></td>
 815                <td colspan="2">
 816                  <input type="text" name="duration_h" id="duration_h" size="2" '
 817         . 'maxlength="2" value="';
 818        if ( $allday != 'Y' )
 819          printf ( "%d", $dur_h );
 820  
 821        echo '" />:
 822                  <input type="text" name="duration_m" id="duration_m" size="2" '
 823         . 'maxlength="2" value="';
 824        if ( $allday != 'Y' )
 825          printf ( "%02d", $duration - ( $dur_h * 60 ) );
 826  
 827        echo '" />&nbsp;(<label for="duration_h">' . $hoursStr
 828         . '</label>: <label for="duration_m">' . $minutStr
 829         . '</label>)
 830                </td>
 831              </tr>';
 832      } else
 833        echo '
 834              <span id="timeentryend" class="tooltip" title="'
 835         . tooltip ( 'end-time-help' ) . '">&nbsp;-&nbsp;'
 836         . time_selection ( 'end_',
 837          ( $id ? add_duration ( $cal_time, $duration ) : $cal_time ) ) . '</span>
 838            </td>
 839          </tr>';
 840    } else { // eType == task
 841      echo ' class="tooltip" title="' . tooltip ( 'time-help' ) . '">'
 842       . translate ( 'Start Time' ) . ':</td>
 843            <td colspan="2">' . time_selection ( 'entry_', $cal_time ) . '</td>
 844          </tr>
 845          <tr>
 846            <td colspan="3">&nbsp;</td>
 847          </tr>
 848          <tr>
 849            <td class="tooltip" title="' . tooltip ( 'date-help' ) . '">'
 850       . translate ( 'Due Date' ) . ':</td>
 851            <td colspan="2">' . date_selection ( 'due_', $due_date ) . '</td>
 852          </tr>
 853          <tr>
 854            <td class="tooltip" title="' . tooltip ( 'time-help' ) . '">'
 855       . translate ( 'Due Time' ) . ':</td>
 856            <td colspan="2">' . time_selection ( 'due_', $due_time ) . '</td>
 857          </tr>';
 858    }
 859  
 860    // Site-specific extra fields (see site_extras.php).
 861    // load and display any site-specific fields.
 862    if ( $id > 0 )
 863      $extras = get_site_extra_fields ( $id );
 864  
 865    $site_extracnt = count ( $site_extras );
 866    echo '
 867        </table>' . ( $site_extracnt ? ( ! empty ( $site_extras[0]['FIELDSET'] ) ? '
 868        <div>
 869          <fieldset>
 870            <legend>' . translate ( 'Site Extras' ) . '</legend>' : '' ) . '
 871            <table summary="">' : '' );
 872  
 873    for ( $i = 0; $i < $site_extracnt; $i++ ) {
 874      if ( $site_extras[$i] == 'FIELDSET' )
 875        continue;
 876  
 877      $extra_name = $site_extras[$i][0];
 878      $extra_descr = $site_extras[$i][1];
 879      $extra_type = $site_extras[$i][2];
 880      $extra_arg1 = $site_extras[$i][3];
 881      $extra_arg2 = $site_extras[$i][4];
 882      // Default value if needed.
 883      $defIdx = ( empty ( $extras[$extra_name]['cal_data'] )
 884        ? $extra_arg2 : $extras[$extra_name]['cal_data'] );
 885  
 886      echo '
 887              <tr>
 888                <td class="aligntop bold">'
 889       . ( $extra_type == EXTRA_MULTILINETEXT ? '<br />' : '' )
 890       . translate ( $extra_descr ) . ':</td>
 891                <td>';
 892  
 893      if ( $extra_type == EXTRA_URL )
 894        echo '
 895                  <input type="text" size="50" name="' . $extra_name . '" value="'
 896         . ( empty ( $extras[$extra_name]['cal_data'] )
 897          ? '' : htmlspecialchars ( $extras[$extra_name]['cal_data'] ) ) . '" />';
 898      elseif ( $extra_type == EXTRA_EMAIL )
 899        echo '
 900                  <input type="text" size="30" name="' . $extra_name . '" value="'
 901         . ( empty ( $extras[$extra_name]['cal_data'] )
 902          ? '' : htmlspecialchars ( $extras[$extra_name]['cal_data'] ) ) . '" />';
 903      elseif ( $extra_type == EXTRA_DATE )
 904        echo date_selection ( $extra_name,
 905          ( empty ( $extras[$extra_name]['cal_date'] )
 906            ? $cal_date : $extras[$extra_name]['cal_date'] ) );
 907      elseif ( $extra_type == EXTRA_TEXT ) {
 908        $size = ( $extra_arg1 > 0 ? $extra_arg1 : 50 );
 909        echo '
 910                  <input type="text" size="' . $size . '" name="' . $extra_name
 911         . '" value="' . ( empty ( $extras[$extra_name]['cal_data'] )
 912          ? '' : htmlspecialchars ( $extras[$extra_name]['cal_data'] ) ) . '" />';
 913      } elseif ( $extra_type == EXTRA_MULTILINETEXT )
 914        echo '
 915                  <textarea rows="' . ( $extra_arg2 > 0 ? $extra_arg2 : 5 )
 916         . '" cols="' . ( $extra_arg1 > 0 ? $extra_arg1 : 50 ) . '" name="'
 917         . $extra_name . '">' . ( empty ( $extras[$extra_name]['cal_data'] )
 918          ? '' : htmlspecialchars ( $extras[$extra_name]['cal_data'] ) )
 919         . '</textarea>';
 920      elseif ( $extra_type == EXTRA_USER ) {
 921        // Show list of calendar users...
 922        echo '
 923                  <select name="' . $extra_name . '">
 924                    <option value="">None</option>';
 925        $userlist = get_my_users ( get_my_users );
 926        $usercnt = count ( $userlist );
 927        for ( $j = 0; $j < $usercnt; $j++ ) {
 928          if ( access_is_enabled () && !
 929              access_user_calendar ( 'view', $userlist[$j]['cal_login'] ) )
 930            continue; // Cannot view calendar so cannot add to their cal.
 931  
 932          echo '
 933                    <option value="' . $userlist[$j]['cal_login'] . '"'
 934           . ( ! empty ( $extras[$extra_name]['cal_data'] ) &&
 935            ( $userlist[$j]['cal_login'] == $extras[$extra_name]['cal_data'] )
 936            ? $selected : '' )
 937           . '>' . $userlist[$j]['cal_fullname'] . '</option>';
 938        }
 939        echo '
 940                  </select>';
 941      } elseif ( $extra_type == EXTRA_SELECTLIST ) {
 942        // Show custom select list.
 943        $extraSelectArr = $isMultiple = $multiselect = '';
 944        if ( is_array ( $extra_arg1 ) ) {
 945          $extra_arg1cnt = count ( $extra_arg1 );
 946          if ( $extra_arg2 > 0 ) {
 947            $multiselect = ' multiple="multiple" size="'
 948             . min ( $extra_arg2, $extra_arg1cnt ) . '" ';
 949            $isMultiple = '[]';
 950            if ( ! empty ( $extras ) )
 951              $extraSelectArr = explode ( ',', $extras[$extra_name]['cal_data'] );
 952          }
 953  
 954          echo '
 955                  <select name="' . $extra_name . $isMultiple . '"'
 956           . $multiselect . '>';
 957          for ( $j = 0; $j < $extra_arg1cnt; $j++ ) {
 958            echo '
 959                    <option value="' . $extra_arg1[$j] . '" ';
 960  
 961            if ( ! empty ( $extras[$extra_name]['cal_data'] ) ) {
 962              if ( $extra_arg2 == 0 &&
 963                $extra_arg1[$j] == $extras[$extra_name]['cal_data'] )
 964                echo $selected;
 965              else
 966              if ( $extra_arg2 > 0 &&
 967                in_array ( $extra_arg1[$j], $extraSelectArr ) )
 968                echo $selected;
 969            } else
 970              echo ( $j == 0 ? $selected : '' );
 971  
 972            echo '>' . $extra_arg1[$j] . '</option>';
 973          }
 974        }
 975        echo '
 976                    </select>';
 977      } elseif ( $extra_type == EXTRA_RADIO )
 978        // Show custom radio selections.
 979        echo print_radio ( $extra_name, $extra_arg1, '', $defIdx );
 980      elseif ( $extra_type == EXTRA_CHECKBOX )
 981        // Show custom checkbox option.
 982        echo print_checkbox ( array ( $extra_name, $extra_arg1, '', $defIdx ) );
 983  
 984      echo '
 985                  </td>
 986                </tr>';
 987    }
 988    if ( $site_extracnt ) {
 989      echo '
 990            </table>' . ( empty ( $site_extras[0]['FIELDSET'] ) ? '' : '
 991          </fieldset>
 992        </div>' );
 993    }
 994    // end site-specific extra fields
 995  
 996    echo ( $useTabs ? '
 997      </div>' : '
 998      </fieldset>' ) . '
 999  
1000  <!-- PARTICIPANTS -->' . ( $useTabs ? '
1001      <a name="tabparticipants"></a>
1002      <div id="tabscontent_participants">' : '
1003      <fieldset>
1004        <legend>' . translate ( 'Participants' ) . '</legend>' ) . '
1005        <table>';
1006    // .
1007    // Only ask for participants if we are multi-user.
1008    $show_participants = ( $DISABLE_PARTICIPANTS_FIELD != 'Y' );
1009    if ( $is_admin )
1010      $show_participants = true;
1011  
1012    if ( $login == '__public__' && $PUBLIC_ACCESS_OTHERS != 'Y' )
1013      $show_participants = false;
1014  
1015    if ( $single_user == 'N' && $show_participants ) {
1016      $userlist = get_my_users ( $create_by, 'invite' );
1017      if ( $NONUSER_ENABLED == 'Y' ) {
1018        // Include public NUCs.
1019        $nonusers = get_my_nonusers ( $real_user, false );
1020        $userlist = ( $NONUSER_AT_TOP == 'Y'
1021          ? array_merge ( $nonusers, $userlist )
1022          : array_merge ( $userlist, $nonusers ) );
1023      }
1024      $num_users = $size = 0;
1025      $usercnt = count ( $userlist );
1026      $users = '';
1027      for ( $i = 0; $i < $usercnt; $i++ ) {
1028        $l = $userlist[$i]['cal_login'];
1029        $size++;
1030        $users .= '
1031                <option value="' . $l . '"';
1032        if ( $id > 0 ) {
1033          if ( ! empty ( $participants[$l] ) )
1034            $users .= $selected;
1035        } else {
1036          if ( ! empty ( $defusers ) && ! empty ( $participants[$l] ) )
1037            // Default selection of participants was in the URL.
1038            $users .= $selected;
1039  
1040          if ( ( $l == $login && ! $is_assistant && ! $is_nonuser_admin ) ||
1041              ( ! empty ( $user ) && $l == $user ) )
1042            $users .= $selected;
1043  
1044          if ( $l == '__public__' && !
1045            empty ( $PUBLIC_ACCESS_DEFAULT_SELECTED ) &&
1046              $PUBLIC_ACCESS_DEFAULT_SELECTED == 'Y' )
1047            $users .= $selected;
1048        }
1049        $users .= '>' . $userlist[$i]['cal_fullname'] . '</option>';
1050      }
1051  
1052      if ( $size > 50 )
1053        $size = 50;
1054      elseif ( $size > 20 )
1055        $size = 20;
1056      elseif ( $size > 5 )
1057        $size = 5;
1058  
1059      echo '
1060          <tr title="' . tooltip ( 'participants-help' ) . '">
1061            <td class="tooltipselect"><label for="entry_part">'
1062       . translate ( 'Participants' ) . ':</label></td>
1063            <td>
1064              <select name="participants[]" id="entry_part" size="' . $size
1065       . '" multiple="multiple">' . $users . '
1066              </select>' . ( $GROUPS_ENABLED == 'Y' ? '
1067              <input type="button" onclick="selectUsers()" value="'
1068         . translate ( 'Select' ) . '..." />' : '' ) . '
1069              <input type="button" onclick="showSchedule()" value="'
1070       . translate ( 'Availability' ) . '..." />
1071            </td>
1072          </tr>'
1073      // External users.
1074      . ( ! empty ( $ALLOW_EXTERNAL_USERS ) && $ALLOW_EXTERNAL_USERS == 'Y' ? '
1075          <tr title="' . tooltip ( 'external-participants-help' ) . '">
1076            <td class="tooltip aligntop"><label for="entry_extpart">'
1077         . translate ( 'External Participants' ) . ':</label></td>
1078            <td><textarea name="externalparticipants" id="entry_extpart" rows="5" '
1079         . 'cols="40">' . $external_users . '</textarea></td>
1080          </tr>' : '' );
1081    }
1082    echo '
1083        </table>' . ( $useTabs ? '
1084      </div>' : '
1085      </fieldset>' ) . '
1086  
1087  <!-- REPEATING INFO -->';
1088    if ( $DISABLE_REPEATING_FIELD != 'Y' ) {
1089      echo ( $useTabs ? '
1090      <a name="tabpete"></a>
1091      <div id="tabscontent_pete">' : '
1092      <fieldset>
1093        <legend>' . translate ( 'Repeat' ) . '</legend>' ) . '
1094        <table border="0" cellspacing="0" cellpadding="3" summary="">
1095          <tr>
1096            <td class="tooltip" title="' . tooltip ( 'repeat-type-help' )
1097       . '"><label for="rpttype">' . translate ( 'Type' ) . ':</label></td>
1098            <td colspan="2">
1099              <select name="rpt_type" id="rpttype" '
1100       . 'onchange="rpttype_handler(); rpttype_weekly()">
1101                <option value="none"' . ( strcmp ( $rpt_type, 'none' ) == 0
1102        ? $selected : '' ) . '>' . translate ( 'None' ) . '</option>
1103                <option value="daily"' . ( strcmp ( $rpt_type, 'daily' ) == 0
1104        ? $selected : '' ) . '>' . translate ( 'Daily' ) . '</option>
1105                <option value="weekly"' . ( strcmp ( $rpt_type, 'weekly' ) == 0
1106        ? $selected : '' ) . '>' . translate ( 'Weekly' ) . '</option>
1107                <option value="monthlyByDay"'
1108       . ( strcmp ( $rpt_type, 'monthlyByDay' ) == 0 ? $selected : '' )
1109       // translate ( 'Monthly' ) translate ( 'by day' ) translate ( 'by date' )
1110       // translate ( 'by position' )
1111       . '>' . translate ( 'Monthly (by day)' ) . '</option>
1112                <option value="monthlyByDate"'
1113       . ( strcmp ( $rpt_type, 'monthlyByDate' ) == 0 ? $selected : '' )
1114       . '>' . translate ( 'Monthly (by date)' ) . '</option>
1115                <option value="monthlyBySetPos"'
1116       . ( strcmp ( $rpt_type, 'monthlyBySetPos' ) == 0 ? $selected : '' )
1117       . '>' . translate ( 'Monthly (by position)' ) . '</option>
1118                <option value="yearly"' . ( strcmp ( $rpt_type, 'yearly' ) == 0
1119        ? $selected : '' ) . '>' . translate ( 'Yearly' ) . '</option>
1120                <option value="manual"'
1121       . ( strcmp ( $rpt_type, 'manual' ) == 0 ? $selected : '' )
1122       . '>' . translate ( 'Manual' ) . '</option>
1123              </select>&nbsp;&nbsp;&nbsp;<label id="rpt_mode"><input '
1124       . 'type="checkbox" name="rptmode" id="rptmode" value="y" '
1125       . 'onclick="rpttype_handler()" '
1126       . ( empty ( $expert_mode ) ? '' : $checked )
1127       . '/>' . translate ( 'Expert Mode' ) . '</label>
1128            </td>
1129          </tr>
1130          <tr id="rptenddate1" style="visibility:hidden;">
1131            <td class="tooltip" title="' . tooltip ( 'repeat-end-date-help' )
1132       . '" rowspan="3"><label for="rpt_day">' . translate ( 'Ending' )
1133       . ':</label></td>
1134            <td colspan="2" class="boxtop boxright boxleft"><input type="radio" '
1135       . 'name="rpt_end_use" id="rpt_untilf" value="f" '
1136       . ( empty ( $rpt_end ) && empty ( $rpt_count ) ? $checked : '' )
1137       . ' onclick="toggle_until()" /><label for="rpt_untilf">'
1138       . translate ( 'Forever' ) . '</label></td>
1139          </tr>
1140          <tr id="rptenddate2" style="visibility:hidden;">
1141            <td class="boxleft"><input type="radio" name="rpt_end_use" '
1142       . 'id="rpt_untilu" value="u" ' . ( empty ( $rpt_end ) ? '' : $checked )
1143       . ' onclick="toggle_until()" />&nbsp;<label for="rpt_untilu">'
1144       . translate ( 'Use end date' ) . '</label></td>
1145            <td class="boxright"><span class="end_day_selection" '
1146       . 'id="rpt_end_day_select">'
1147       . date_selection ( 'rpt_', ( $rpt_end_date ? $rpt_end_date : $cal_date ) )
1148       . '</span><span id="rpt_until_time_date"><br />' . time_selection ( 'rpt_', $rpt_end_time ) . '</span></td>
1149          </tr>
1150          <tr id="rptenddate3" style="visibility:hidden;">
1151            <td class="boxbottom boxleft"><input type="radio" name="rpt_end_use" '
1152       . 'id="rpt_untilc" value="c" ' . ( empty ( $rpt_count ) ? '' : $checked )
1153       . ' onclick="toggle_until()" />&nbsp;<label for="rpt_untilc">'
1154       . translate ( 'Number of times' ) . '</label></td>
1155            <td class="boxright boxbottom"><input type="text" name="rpt_count" '
1156       . 'id="rpt_count" size="4" maxlength="4" value="' . $rpt_count . '" /></td>
1157          </tr>
1158          <tr id="rptfreq" style="visibility:hidden;" title="'
1159       . tooltip ( 'repeat-frequency-help' ) . '">
1160            <td class="tooltip"><label for="entry_freq">'
1161       . translate ( 'Frequency' ) . ':</label></td>
1162            <td colspan="2">
1163              <input type="text" name="rpt_freq" id="entry_freq" size="4" '
1164       . 'maxlength="4" value="' . $rpt_freq . '" />&nbsp;&nbsp;&nbsp;&nbsp;
1165              <label id="weekdays_only"><input type="checkbox" '
1166       . 'name="weekdays_only" value="y" '
1167       . ( empty ( $weekdays_only ) ? '' : $checked ) . ' />'
1168       . translate ( 'Weekdays Only' )
1169       . '</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
1170              <span id="rptwkst">
1171                <select name="wkst">';
1172      for ( $i = 0; $i < 7; $i++ ) {
1173        echo '
1174                  <option value="' . $byday_names[$i] . '" '
1175                   . ( $wkst ==$byday_names[$i] ? $selected : '' )
1176         . '>' . translate ( $byday_names[$i] ) . '</option>';
1177                }
1178      echo '
1179                </select>&nbsp;&nbsp;<label for="rptwkst">'
1180       . translate ( 'Week Start' ) . '</label>
1181              </span>
1182            </td>
1183          </tr>
1184          <tr>
1185            <td colspan="4"></td>
1186          </tr>
1187          <tr id="rptbydayextended" style="visibility:hidden;" title="'
1188       . tooltip ( 'repeat-bydayextended-help' ) . '">
1189            <td class="tooltip"><label>' . translate ( 'ByDay' ) . ':</label></td>
1190            <td colspan="2" class="boxall">
1191              <input type="hidden" name="bydayList" value="'
1192       . ( empty ( $bydayStr ) ? '' : $bydayStr ) . '" />
1193              <input type="hidden" name="bymonthdayList" value="'
1194       . ( empty ( $bymonthdayStr ) ? '' : $bymonthdayStr ) . '" />
1195              <input type="hidden" name="bysetposList" value="'
1196       . ( empty ( $bysetposStr ) ? '' : $bysetposStr ) . '" />
1197              <table class="byxxx" cellpadding="2" cellspacing="2" '
1198       . 'border="1" summary="">
1199                <tr>
1200                  <td></td>';
1201      // Display byday extended selection.
1202      // We use BUTTONS in a triple state configuration, and store the values in
1203      // a javascript array until form submission. We then set the hidden field
1204      // bydayList to the string value of the array.
1205      for ( $rpt_byday_label = $WEEK_START; 
1206            $rpt_byday_label <= ( $WEEK_START + 6); $rpt_byday_label++ ) {
1207              $rpt_byday_mod = $rpt_byday_label %7;
1208              $class = ( is_weekend ( $rpt_byday_mod ) ? ' class="weekend" ' : '' );
1209        echo '
1210                  <th width="50px"' .$class . '><label>'
1211         . translate ( $weekday_names[$rpt_byday_mod] ) . '</label></th>';
1212      }
1213      echo '
1214                </tr>
1215                <tr>
1216                  <th>' . translate ( 'All' ) . '</th>';
1217      for ( $rpt_byday_single = $WEEK_START; 
1218            $rpt_byday_single <= ( $WEEK_START + 6); $rpt_byday_single++ ) {
1219              $rpt_byday_mod = $rpt_byday_single %7;
1220        echo '
1221                  <td><input type="checkbox" name="bydayAll[]" id="'
1222         . $byday_names[$rpt_byday_mod] . '" value="'
1223         . "$byday_names[$rpt_byday_mod]\""
1224         . ( in_array ( $byday_names[$rpt_byday_mod], $byday ) ? $checked : '' )
1225         . ' /></td>';
1226      }
1227      echo '
1228                </tr>
1229                <tr id="rptbydayln" style="visibility:hidden;">';
1230      for ( $loop_ctr = 1; $loop_ctr < 6; $loop_ctr++ ) {
1231        echo '
1232                  <th><label>' . $loop_ctr . '/' . ( $loop_ctr - 6 )
1233         . '</label></th>';
1234        for ( $rpt_byday = $WEEK_START; 
1235                $rpt_byday <= ( $WEEK_START + 6); $rpt_byday++ ) {
1236                  $rpt_byday_mod = $rpt_byday %7;
1237          $buttonvalue = ( in_array ( $loop_ctr
1238               . $byday_names[$rpt_byday_mod], $byday )
1239            ? $loop_ctr . translate ( $byday_names[$rpt_byday_mod] )
1240            : ( in_array ( ( $loop_ctr - 6 ) 
1241                      . $byday_names[$rpt_byday_mod], $byday )
1242            ? ( $loop_ctr - 6 )
1243            . translate ( $byday_names[$rpt_byday_mod] ) : '        ' ) );
1244  
1245          echo '
1246                  <td><input type="button" name="byday" id="_' . $loop_ctr
1247           . $rpt_byday_mod . '" value="' . $buttonvalue
1248           . '" onclick="toggle_byday( this )" /></td>';
1249        }
1250        echo '
1251                </tr>';
1252        if ( $loop_ctr < 5 )
1253          echo '
1254                <tr id="rptbydayln' . $loop_ctr . '" style="visibility:hidden;">';
1255      }
1256      echo '
1257              </table>
1258            </td>
1259          </tr>
1260          <tr>
1261            <td colspan="4"></td>
1262          </tr>
1263          <tr id="rptbymonth" style="visibility:hidden;" title="'
1264       . tooltip ( 'repeat-month-help' ) . '">
1265            <td class="tooltip">' . translate ( 'ByMonth' ) . ':&nbsp;</td>
1266            <td colspan="2" class="boxall">'
1267      /* Display bymonth selection. */ . '
1268              <table cellpadding="5" cellspacing="0" summary="">
1269                <tr>';
1270      for ( $rpt_month = 1; $rpt_month < 13; $rpt_month++ ) {
1271        echo '
1272                  <td><label><input type="checkbox" name="bymonth[]" value="'
1273         . $rpt_month . '"' . ( in_array ( $rpt_month, $bymonth ) ? $checked : '' )
1274         . ' />&nbsp;' . translate (
1275          date ( 'M', mktime ( 0, 0, 0, $rpt_month, 1 ) ) )
1276         . '</label></td>' . ( $rpt_month == 6 ? '
1277                </tr>
1278                <tr>' : '' );
1279      }
1280      echo '
1281                </tr>
1282              </table>
1283            </td>
1284          </tr>
1285          <tr>
1286            <td colspan="4"></td>
1287          </tr>
1288          <tr id="rptbysetpos" style="visibility:hidden;" title="'
1289       . tooltip ( 'repeat-bysetpos-help' ) . '">
1290            <td class="tooltip" id="BySetPoslabel">' . translate ( 'BySetPos' )
1291       . ':&nbsp;</td>
1292            <td colspan="2" class="boxall">'
1293      /* Display bysetpos selection. */ . '
1294              <table class="byxxx" cellpadding="2" cellspacing="0" '
1295       . 'border="1" summary="">
1296                <tr>
1297                  <td></td>';
1298      for ( $rpt_bysetpos_label = 1; $rpt_bysetpos_label < 11;
1299        $rpt_bysetpos_label++ ) {
1300        echo '
1301                  <th width="37px"><label>' . $rpt_bysetpos_label
1302         . '</label></th>';
1303      }
1304      echo '
1305                </tr>
1306                <tr>';
1307      for ( $loop_ctr = 1; $loop_ctr < 32; $loop_ctr++ ) {
1308        $buttonvalue = ( in_array ( $loop_ctr, $bysetpos )
1309          ? ( $loop_ctr ) : ( in_array ( ( $loop_ctr -32 ), $bysetpos )
1310            ? ( $loop_ctr -32 ) : '      ' ) );
1311        echo ( $loop_ctr == 1 || $loop_ctr == 11 || $loop_ctr == 21 ? '
1312                  <th><label>' . $loop_ctr . '-' . ( $loop_ctr + 9 )
1313           . '</label></th>' : '' ) . ( $loop_ctr == 31 ? '
1314                  <th><label>31</label></th>' : '' ) . '
1315                  <td><input type="button" name="bysetpos" id="bysetpos'
1316         . $loop_ctr . '" value="' . $buttonvalue
1317         . '" onclick="toggle_bysetpos( this )" /></td>'
1318         . ( $loop_ctr % 10 == 0 ? '
1319                </tr>
1320              <tr>' : '' );
1321      }
1322      echo '
1323              </tr>
1324            </table>
1325          </td>
1326        </tr>
1327        <tr>
1328          <td colspan="4"></td>
1329        </tr>
1330        <tr id="rptbymonthdayextended" style="visibility:hidden;" title="'
1331       . tooltip ( 'repeat-bymonthdayextended-help' ) . '">
1332          <td class="tooltip" id="ByMonthDaylabel">' . translate ( 'ByMonthDay' )
1333       . ':&nbsp;</td>
1334          <td colspan="2" class="boxall">'
1335      /* Display bymonthday extended selection. */ . '
1336            <table class="byxxx" cellpadding="2" cellspacing="0" '
1337       . 'border="1" summary="">
1338              <tr>
1339                <td></td>';
1340      for ( $rpt_bymonthday_label = 1; $rpt_bymonthday_label < 11;
1341        $rpt_bymonthday_label++ ) {
1342        echo '
1343                <th width="37px"><label>' . $rpt_bymonthday_label
1344         . '</label></th>';
1345      }
1346      echo '
1347              </tr>
1348              <tr>';
1349      for ( $loop_ctr = 1; $loop_ctr < 32; $loop_ctr++ ) {
1350        $buttonvalue = ( in_array ( $loop_ctr, $bymonthday )
1351          ? ( $loop_ctr ) : ( in_array ( ( $loop_ctr -32 ), $bymonthday )
1352            ? ( $loop_ctr - 32 ) : '      ' ) );
1353        echo ( $loop_ctr == 1 || $loop_ctr == 11 || $loop_ctr == 21 ? '
1354              <th><label>' . $loop_ctr . '-' . ( $loop_ctr + 9 )
1355           . '</label></th>' : '' )
1356         . ( $loop_ctr == 31 ? '
1357              <th><label>31</label></th>' : '' ) . '
1358              <td><input type="button" name="bymonthday" id="bymonthday'
1359         . $loop_ctr . '" value="' . $buttonvalue
1360         . '" onclick="toggle_bymonthday( this )" /></td>'
1361         . ( $loop_ctr % 10 == 0 ? '
1362            </tr>
1363            <tr>' : '' );
1364      }
1365      echo '
1366            </tr>
1367          </table>';
1368  
1369      // Populate Repeat Exceptions data for later use.
1370      $excepts = '';
1371      $exceptcnt = count ( $exceptions );
1372      for ( $i = 0; $i < $exceptcnt; $i++ ) {
1373        $excepts .= '
1374                    <option value="-' . $exceptions[$i] . '">-' . $exceptions[$i]
1375         . '</option>';
1376      }
1377      // Populate Repeat Inclusions data for later use
1378      $includecnt = count ( $inclusions );
1379      for ( $i = 0; $i < $includecnt; $i++ ) {
1380        $excepts .= '
1381                    <option value="+' . $inclusions[$i] . '">+' . $inclusions[$i]
1382         . '</option>';
1383      }
1384  
1385      echo '
1386         </td>
1387        </tr>
1388        <tr id="rptbyweekno" style="visibility:hidden;" title="'
1389       . tooltip ( 'repeat-byweekno-help' ) . '">
1390          <td class="tooltip">' . translate ( 'ByWeekNo' ) . ':</td>
1391          <td colspan="2"><input type="text" name="byweekno" id="byweekno" '
1392       . 'size="50" maxlength="100" value="' . $byweekno . '" /></td>
1393        </tr>
1394        <tr id="rptbyyearday" style="visibility:hidden;" title="'
1395       . tooltip ( 'repeat-byyearday-help' ) . '">
1396          <td class="tooltip">' . translate ( 'ByYearDay' ) . ':</td>
1397          <td colspan="2"><input type="text" name="byyearday" id="byyearday" '
1398       . 'size="50" maxlength="100" value="' . $byyearday . '" /></td>
1399        </tr>
1400        <tr id="rptexceptions" style="visibility:visible;" title="'
1401       . tooltip ( 'repeat-exceptions-help' ) . '">
1402          <td class="tooltip"><label>' . translate ( 'Exclusions' ) . '/<br />'
1403       . translate ( 'Inclusions' ) . ':</label></td>
1404          <td colspan="2" class="boxtop boxright boxbottom boxleft">
1405            <table border="0" width="250px" summary="">
1406              <tr>
1407                <td colspan="2">'
1408       . date_selection ( 'except_', $rpt_end_date ? $rpt_end_date : $cal_date )
1409       . '</td>
1410              </tr>
1411              <tr>
1412                <td align="right" valign="top" width="100">
1413                  <label id="select_exceptions_not" style="visibility:'
1414       . ( empty ( $excepts ) ? 'visible' : 'hidden' ) . ';"></label>
1415                  <select id="select_exceptions" name="exceptions[]" '
1416       . 'multiple="multiple" style="visibility:'
1417       . ( empty ( $excepts ) ? 'hidden' : 'visible' )
1418       . ';" size="4">' . $excepts . '
1419                  </select>
1420                </td>
1421                <td valign="top">
1422                  <input align="left" type="button" name="addException" value="'
1423       . translate ( 'Add Exception' ) . '" onclick="add_exception(0)" /><br />
1424                  <input align="left" type="button" name="addInclusion" value="'
1425       . translate ( 'Add Inclusion' ) . '" onclick="add_exception(1)" /><br />
1426                  <input align="left" type="button" name="delSelected" value="'
1427       . translate ( 'Delete Selected' ) . '" onclick="del_selected()" />
1428                </td>
1429              </tr>
1430            </table>
1431          </td>
1432        </tr>
1433      </table>' . ( $useTabs ? '
1434      </div> <!-- End tabscontent_pete -->' : '
1435      </fieldset>' );
1436    }
1437  
1438    echo '
1439  
1440  <!-- REMINDER INFO -->';
1441    if ( $DISABLE_REMINDER_FIELD != 'Y' ) {
1442      $rem_minutes = $reminder_offset;
1443      // Will be specified in total minutes.
1444      $rem_days = intval ( $rem_minutes / 1440 );
1445      $rem_minutes -= ( $rem_days * 1440 );
1446      $rem_hours = intval ( $rem_minutes / 60 );
1447      $rem_minutes -= ( $rem_hours * 60 );
1448  
1449      $rem_before =
1450      ( empty ( $reminder['before'] ) || $reminder['before'] == 'Y' );
1451      $rem_related =
1452      ( empty ( $reminder['related'] ) || $reminder['related'] == 'S' );
1453  
1454      // Reminder Repeats.
1455      $rem_rep_count =
1456      ( isset ( $reminder['repeats'] ) ? $reminder['repeats'] : 0 );
1457      $rem_rep_minutes =
1458      ( isset ( $reminder['duration'] ) ? $reminder['duration'] : 0 );
1459  
1460      // Will be specified in total minutes.
1461      $rem_rep_days = intval ( $rem_rep_minutes / 1440 );
1462      $rem_rep_minutes -= ( $rem_rep_days * 1440 );
1463      $rem_rep_hours = intval ( $rem_rep_minutes / 60 );
1464      $rem_rep_minutes -= ( $rem_rep_hours * 60 );
1465  
1466      echo ( $useTabs ? '
1467      <a name="tabreminder"></a>
1468      <div id="tabscontent_reminder">' : '
1469      <fieldset>
1470        <legend>' . translate ( 'Reminders' ) . '</legend>' ) . '
1471        <table border="0" cellspacing="0" cellpadding="3" summary="">
1472          <thead>
1473            <tr>
1474              <td class="tooltip"><label>' . translate ( 'Send Reminder' )
1475       . ':</label></td>
1476              <td colspan="3">
1477                <input type="hidden" name="rem_action" value="'
1478       . ( empty ( $reminder['action'] ) ? 'EMAIL' : $reminder['action'] ) . '" />
1479                <input type="hidden" name="rem_last_sent" value="'
1480       . ( empty ( $reminder['last_sent'] ) ? 0 : $reminder['last_sent'] ) . '" />
1481                <input type="hidden" name="rem_times_sent" value="'
1482       . ( empty ( $reminder['times_sent'] ) ? 0 : $reminder['times_sent'] )
1483       . '" />
1484                  <label><input type="radio" name="reminder" '
1485       . 'id="reminderYes" value="1"'
1486       . ( $rem_status ? $checked : '' ) . ' onclick="toggle_reminders()" />'
1487       . translate ( 'Yes' ) . '</label>&nbsp;
1488                  <label><input type="radio" name="reminder" '
1489       . 'id="reminderNo" value="0"'
1490       . ( $rem_status ? '' : $checked ) . ' onclick="toggle_reminders()" />'
1491       . translate ( 'No' ) . '</label>
1492              </td>
1493            </tr>
1494          </thead>
1495          <tbody id="reminder_when">
1496            <tr>
1497              <td class="tooltip" rowspan="6"><label>' . translate ( 'When' )
1498       . ':</label></td>
1499              <td class="boxtop boxleft" width="20%"><label><input type="radio" '
1500       . 'name="rem_when" id="rem_when_date" value="Y" '
1501       . ( $rem_use_date ? $checked : '' ) . ' onclick="toggle_rem_when()" />'
1502       . translate ( 'Use Date/Time' ) . '&nbsp;</label></td>
1503              <td class="boxtop boxright" nowrap="nowrap" colspan="2">'
1504       . date_selection ( 'reminder_', ( empty ( $reminder['date'] )
1505          ? $cal_date : $reminder['date'] ) ) . '</td>
1506            </tr>
1507            <tr>
1508              <td class="boxleft">&nbsp;</td>
1509              <td class="boxright" colspan="2" nowrap="nowrap">'
1510       . time_selection ( 'reminder_', ( empty ( $reminder['time'] )
1511          ? $cal_time : $reminder['time'] ) ) . '</td>
1512            </tr>
1513            <tr>
1514              <td class="boxright boxleft" height="20px" colspan="3">&nbsp;</td>
1515            </tr>
1516            <tr>
1517              <td class="boxleft"><label><input type="radio" name="rem_when" '
1518       . 'id="rem_when_offset" value="N" ' . ( $rem_use_date ? '' : $checked )
1519       . ' onclick="toggle_rem_when()" />' . translate ( 'Use Offset' )
1520       . '&nbsp;</label></td>
1521              <td class="boxright" nowrap="nowrap" colspan="2">
1522                <label><input type="text" size="2" name="rem_days" value="'
1523       . $rem_days . '" />' . $daysStr . '</label>&nbsp;
1524                <label><input type="text" size="2" name="rem_hours" '
1525       . 'value="' .$rem_hours . '" />' . $hoursStr . '</label>&nbsp;
1526                <label><input type="text" size="2" name="rem_minutes" value="'
1527       . $rem_minutes . '" />' . $minutStr . '</label>
1528              </td>
1529            </tr>
1530            <tr>
1531              <td class="boxleft">&nbsp;</td>
1532              <td><label><input type="radio" name="rem_before" '
1533       . 'id="rem_beforeY" value="Y"'
1534       . ( $rem_before ? $checked : '' ) . ' />' . translate ( 'Before' )
1535       . '</label>&nbsp;</td>
1536              <td class="boxright"><label><input type="radio" name="rem_before" '
1537       . 'id="rem_beforeN" value="N"' . ( $rem_before ? '' : $checked ) . ' />'
1538       . translate ( 'After' ) . '</label></td>
1539            </tr>
1540            <tr>
1541              <td class="boxbottom boxleft">&nbsp;</td>
1542              <td class="boxbottom"><label><input type="radio" '
1543       . 'name="rem_related" id="rem_relatedS" value="S"'
1544       . ( $rem_related ? $checked : '' ) . ' />'
1545       . translate ( 'Start' ) . '</label>&nbsp;</td>
1546              <td class="boxright boxbottom"><label><input type="radio" '
1547       . 'name="rem_related" id="rem_relatedE" value="E"'
1548       . ( $rem_related ? '' : $checked ) . ' />' . translate ( 'End/Due' )
1549       . '</label></td>
1550            </tr>
1551            <tr>
1552              <td colspan="4"></td>
1553            </tr>
1554          </tbody>
1555          <tbody id="reminder_repeat">
1556            <tr>
1557              <td class="tooltip" rowspan="2"><label>' . translate ( 'Repeat' )
1558       . ':</label></td>
1559              <td class="boxtop boxleft">&nbsp;&nbsp;&nbsp;<label>'
1560       . translate ( 'Times' ) . '</label></td>
1561              <td class="boxtop boxright" colspan="2"><input type="text" '
1562       . 'size="2" name="rem_rep_count" value="' . $rem_rep_count
1563       . '" onchange="toggle_rem_rep();" /></td>
1564            </tr>
1565            <tr id="rem_repeats">
1566              <td class="boxbottom boxleft">&nbsp;&nbsp;&nbsp;<label>'
1567       . translate ( 'Every' ) . '</label></td>
1568              <td class="boxbottom boxright" colspan="2">
1569                <label><input type="text" size="2" name="rem_rep_days" value="'
1570       . $rem_rep_days . '" />' . $daysStr . '</label>&nbsp;
1571                <input type="text" size="2" name="rem_rep_hours" value="'
1572       . $rem_rep_hours . '" /><label>' . $hoursStr . '</label>&nbsp;
1573                <input type="text" size="2" name="rem_rep_minutes" value="'
1574       . $rem_rep_minutes . '" /><label>' . $minutStr . '</label>
1575              </td>
1576            </tr>
1577          </tbody>
1578        </table>' . ( $useTabs ? '
1579      </div>
1580  <!-- End tabscontent_pete -->' : '
1581      </fieldset>' );
1582    }
1583  
1584    if ( file_exists ( 'includes/classes/captcha/captcha.php' ) &&
1585        $login == '__public__' && !
1586        empty ( $ENABLE_CAPTCHA ) && $ENABLE_CAPTCHA == 'Y' ) {
1587      if ( function_exists ( 'imagecreatetruecolor' ) ) {
1588        include_once  'includes/classes/captcha/captcha.php';
1589        echo captcha::form ();
1590      } else
1591        etranslate ( 'CAPTCHA Warning' );
1592    }
1593    echo '
1594      </div>
1595  <!-- End tabscontent -->';
1596  
1597    echo '
1598        <table summary="">
1599          <tr>
1600            <td>
1601              <script type="text/javascript">
1602  <!-- <![CDATA[
1603                document.writeln ( \'<input type="button" value="'
1604       . $saveStr . '" onclick="validate_and_submit()" />\' )
1605  //]]> -->
1606              </script>
1607              <noscript><input type="submit" value="' . $saveStr
1608       . '" /></noscript>
1609            </td>
1610          </tr>
1611        </table>
1612        <input type="hidden" name="participant_list" value="" />'
1613    // This bit should be moved to a webcal_fckconfig.js file.
1614    // Then the current FCKEditor SVN version would probably work.
1615         . ( $use_fckeditor ? '
1616        <script type="text/javascript" '
1617       . 'src="includes/FCKeditor-2.0/fckeditor.js"></script>
1618        <script type="text/javascript">
1619          var myFCKeditor = new FCKeditor ( \'description\' );
1620  
1621          myFCKeditor.BasePath = \'includes/FCKeditor-2.0/\';
1622          myFCKeditor.ToolbarSet = \'Medium\';
1623          myFCKeditor.Config[\'SkinPath\'] = \'./skins/office2003/\';
1624          myFCKeditor.ReplaceTextarea ();
1625        </script>' : '' ) . '
1626      </form>';
1627  
1628    if ( $id > 0 && ( $login == $create_by || $single_user == 'Y' || $is_admin ) )
1629      echo '
1630      <a href="del_entry.php?id=' . $id . '" onclick="return confirm( \''
1631       . str_replace ( 'XXX', translate ( 'entry' ),
1632        translate ( 'Are you sure you want to delete this XXX?' ) ) . '\' );">'
1633       . translate ( 'Delete entry' ) . '</a><br />';
1634  } else
1635    // translate ( 'You are not authorized to edit this entry.' )
1636    echo str_replace ( 'XXX', translate ( 'entry' ),
1637      translate ( 'You are not authorized to edit this XXX.' ) );
1638  // end if ( $can_edit )
1639  
1640  ob_end_flush ();
1641  
1642  echo print_trailer ();
1643  
1644  ?>

title

Description

title

Description

title

Description

title

title

Body