<!--
Copyright by Thomas Bley 2002-2003
thomas.bley@simple-groupware.de

http://www.simple-groupware.de
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
  <meta http-equiv="content-type" content="text/html;charset=UTF-8">
  <title>Calendar by Thomas Bley - Simple Groupware Solutions - more.groupware - {$dcalendar_display}</title>
  <link rel="stylesheet" type="text/css" href="{$rooturl}modules/general/templates/{$theme}/css/{$skin}" />
  <link rel="stylesheet" type="text/css" href="templates/default/css/default.css">

	<script type="text/javascript" src="templates/default/js/autocomplete.js"></script>

	<script type="text/javascript" src="templates/default/htmlarea/htmlarea.js"></script>
	<script type="text/javascript" src="templates/default/htmlarea/htmlarea-lang-en.js"></script>
	<script type="text/javascript" src="templates/default/htmlarea/dialog.js"></script>

	<script type="text/javascript">
		var custom_font = '{$custom_font}';
		var custom_font_size = '{$custom_font_size}';
	</script>
	
{literal}
	<script type="text/javascript">
		function adder2(this2) {
		  autoComplete(this2,this2.form.options,'text',false)
		}

		function adder(this1,this2) {
		  if (this1.form.options.selectedIndex != -1) {
		    if (this2.value != '' && this1.form.options[this1.form.options.selectedIndex].value != '') this2.value+=', '; 
		    this2.value+=this1.form.options[this1.form.options.selectedIndex].value; 
		  }
		}  

		var editor = null;
		function initEditor() {
		  editor = new HTMLArea("ddesc");

		var config = editor.config;

		config.toolbar = [
			 [ "fontname", "space" ],
			 [ "fontsize", "space" ],
			 [ "bold", "italic", "underline", "separator" ],
			 [ "justifyleft", "justifycenter", "justifyfull", "separator" ],
			 [ "insertunorderedlist" ],
			 [ "forecolor", "hilitecolor" ],
			 [ "createlink", "htmlmode"]
		];

//		  cfg.pageStyle = "body { background-color: #DFDFDF; color: #000080; }";
		  editor.generate();
		}

	    function dsummary_ok() {
{/literal}
		  field = document.forms['nd'].elements['start_year'];
		  start = field.options[field.selectedIndex]['value'];

		  field = document.forms['nd'].elements['start_month'];
		  start += field.options[field.selectedIndex]['value'];

		  field = document.forms['nd'].elements['start_day'];
		  start += field.options[field.selectedIndex]['value'];
		  
		  field = document.forms['nd'].elements['dstart'];
		  start += field.options[field.selectedIndex]['value'];

	
		  field = document.forms['nd'].elements['end_year'];
		  end = field.options[field.selectedIndex]['value'];

		  field = document.forms['nd'].elements['end_month'];
		  end += field.options[field.selectedIndex]['value'];

		  field = document.forms['nd'].elements['end_day'];
		  end += field.options[field.selectedIndex]['value'];

		  field = document.forms['nd'].elements['dend'];
		  end += field.options[field.selectedIndex]['value'];

		  field = document.forms['nd'].elements['dsummary'];

		  if (field.value == '') alert('{$hashmap.emptysummary|addslash}');
		  if (start > end) alert('{$hashmap.wrongdate|addslash}');

		  if (field.value != '' && start <= end) return true;
		  
		  return false;
{literal}
		}
	</script>
{/literal}

  <link rel="stylesheet" type="text/css" media="all" href="templates/default/jscalendar/calendar-win2k-cold-1.css" title="win2k-cold-1" />

  <script type="text/javascript" src="templates/default/jscalendar/calendar.js"></script>
  <script type="text/javascript" src="templates/default/jscalendar/lang/calendar-en.js"></script>
{literal}
  <script>
	function onSelect2(calendar, date) {
	  if (calendar.dateClicked) {
	    var year = date.substr(6,4);
	    var month = date.substr(3,2);
	    var day = date.substr(0,2);
		var val = 'start';
		
		if (calendar.params.inputField.id == 'f_trigger_b_b') val = 'end';
		if (calendar.params.inputField.id == 'f_trigger_c_c') val = 'rep';
		
		document.forms['nd'].elements[calendar.params.inputField.id].value = day+"-"+month+"-"+year;
		
		field = document.forms['nd'].elements[val+'_year'];
	    for (var i = 0; i < field.options.length; i++) {
		  if (field.options[i]['value'] == year) field.selectedIndex = i;
		}
		
		field = document.forms['nd'].elements[val+'_month'];
	    for (var i = 0; i < field.options.length; i++) {
		  if (field.options[i]['value'] == month) field.selectedIndex = i;
		}

		field = document.forms['nd'].elements[val+'_day'];
	    for (var i = 0; i < field.options.length; i++) {
		  if (field.options[i]['value'] == day) field.selectedIndex = i;
		}

	    calendar.callCloseHandler(); // this calls "onClose" (see above)
	  }
	};
  </script>
{/literal}
	  
  <script type="text/javascript" src="templates/default/jscalendar/calendar-setup.js"></script>

{literal}
<style>

@import url(templates/default/htmlarea/htmlarea.css);

.formhead2
{color:#333333;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
font-weight:bold;
text-decoration:none;}

.tab2
{color:#333333;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
font-weight:normal;
text-decoration:none;}

.styletextfield {
  width:390px;
  font-size: 12px;
  font-family: verdana;
}

.styletextfield2 {
  font-size: 12px;
  font-family: verdana;
}

</style>
{/literal}

</head>
<body bgcolor="#eeeeee" style="background-color: #C8C9D4;" onload="initEditor()" topmargin="0" marginheight="0" bottommargin="0">
<center>
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="calborder">
	<tr>
		<td align="left" valign="top" width="1%" class="sideback"><img src="templates/default/media/spacer.gif" width="1" height="20" alt=" "></td>
		<td align="center" width="98%" class="sideback"><span class="G10BOLD">{$hashmap.calendar_lang} - {if $id neq ""}{$dsummary}{else}{$hashmap.create_appointment}{/if}</span></td>
		<td align="right" valign="top" width="1%" class="sideback"></td>
	</tr>
	<tr>
		<td colspan="3"><img src="templates/default/media/spacer.gif" width="1" height="1" alt=" "></td>
	</tr>
	<tr>
		<td colspan="3">

<form name="nd" action="event.php" method="POST">
<input type="hidden" name="{$SESSIONNAME}" value="{$SESSIONID}">
<input type="hidden" name="id" value="{$id}">
<input type="hidden" id="f_trigger_a_a" value="{$start_day}-{$start_month}-{$start_year}">
<input type="hidden" id="f_trigger_b_b" value="{$end_day}-{$end_month}-{$end_year}">
<input type="hidden" id="f_trigger_c_c" value="{$rep_day}-{$rep_month}-{$rep_year}">

<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr><td class="lines" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr align="left">
    <td class="tab2" height="30"><img src="{$imgpathgeneral}/space.gif" alt="" width="20" height="1" /></td>
    <td class="formhead2">{$hashmap.start}</td>
    <td nowrap class="formhead2">
	  <button type="button" id="f_trigger_a" class="submit">...</button>&nbsp;&nbsp;&nbsp;{$serial_start_day|smarty:nodefaults}&nbsp;&nbsp;{$serial_start_month|smarty:nodefaults}&nbsp;&nbsp;{$serial_start_year|smarty:nodefaults}&nbsp;&nbsp;&nbsp;
	  <select name="dstart" size="1">
	  {section name=hour loop=$dstart}
		<option value="{$dstart[hour].timestamp}"{$dstart[hour].sel}>{$dstart[hour].time_label}</option>	
	  {/section}	    
      </select>	
      &nbsp;&nbsp;&nbsp;
      <input type="checkbox" name="dentireday"{$dentireday}>{$hashmap.entire_day}<img src="{$imgpathgeneral}/space.gif" alt="" width="20" height="1" />
	  {literal}
	  <script>
	  Calendar.setup({
        inputField: "f_trigger_a_a", ifFormat: "dd-mm-y", button: "f_trigger_a", align: "bR", singleClick: true, mondayFirst: true
	  });
  	  </script>	  
	  {/literal}
    </td>
  </tr>
  <tr align="left">
    <td class="tab2" height="30"><img src="{$imgpathgeneral}/space.gif" alt="" width="20" height="1" /></td>
    <td class="formhead2">{$hashmap.end}</td>
    <td nowrap class="formhead2">
	  <button type="button" id="f_trigger_b" class="submit">...</button>&nbsp;&nbsp;&nbsp;{$serial_end_day|smarty:nodefaults}&nbsp;&nbsp;{$serial_end_month|smarty:nodefaults}&nbsp;&nbsp;{$serial_end_year|smarty:nodefaults}&nbsp;&nbsp;&nbsp;
      <select name="dend" size="1">
	  {section name=hour loop=$dend}
		<option value="{$dend[hour].timestamp}"{$dend[hour].sel}>{$dend[hour].time_label}</option>	
	  {/section}	    
      </select>
      &nbsp;&nbsp;&nbsp;
      <select name="dclass">
	  	<option value="private" {if $dclass eq "private"}selected{/if}>{$hashmap.private}
	  	<option value="confidential" {if $dclass eq "confidential"}selected{/if}>{$hashmap.confidential}
	  	<option value="public" {if $dclass eq "public" || $dclass eq ""}selected{/if}>{$hashmap.public}
	  </select>
	  
	  {literal}
	  <script>
	  Calendar.setup({
        inputField: "f_trigger_b_b", ifFormat: "dd-mm-y", button: "f_trigger_b", align: "bR", singleClick: true, mondayFirst: true
	  });
  	  </script>	  
	  {/literal}
    </td>
  </tr>
  <tr><td class="lines2" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr align="left">
    <td class="tab2" height="26"><img src="{$imgpathgeneral}/space.gif" alt="" width="20" height="1" /></td>
    <td class="formhead2" width="80">{$hashmap.summary}</td>
    <td class="tab2"><input class="styletextfield" type="text" value="{$dsummary|escape:"html"}" name="dsummary" maxlength="100" size="80"></td>
  </tr>
  <tr align="left">
    <td class="tab2"><img src="{$imgpathgeneral}/space.gif" alt="" width="20" height="1" /></td>
    <td class="formhead2">{$hashmap.location}</td>
    <td class="tab2"><input class="styletextfield" type="text" value="{$dlocation|escape:"html"}" name="dlocation" maxlength="100" size="80"></td>
  </tr>
  <tr align="left">
    <td class="tab2"><img src="{$imgpathgeneral}/space.gif" alt="" width="20" height="1" /></td>
    <td class="formhead2">{$hashmap.homepage}</td>
    <td class="tab2"><input style="width:390px;" type="text" value="{$dhomepage|escape:"html"}" name="dhomepage" maxlength="100" size="80"></td>
  </tr>
  <tr><td class="lines2" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr><td class="lines" height="5" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="5" /></td></tr>
  <tr align="left">
    <td align="center" valign="top" colspan="3">
		<table width="465" border="0" cellpadding="0" cellspacing="0">
		  <tr>
		    <td>&nbsp; &nbsp;</td>
			<td width="100%">
		    <textarea id="ddesc" class="formtextarea" class="stylemsgbody" style="width:475px; height: 120px;" name="ddesc" rows="4" cols="80">{$ddesc|escape:"html"|smarty:nodefaults}</textarea>
		    </td>
		  </tr>
		</table>
	</td>
  </tr>
  <tr><td class="lines2" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr><td class="lines" height="2" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="2" /></td></tr>
  <tr align="left">
    <td class="tab2" height="1"><img src="{$imgpathgeneral}/space.gif" alt="" width="20" height="1" /></td>
    <td class="formhead2">{$hashmap.repetitions}</td>
    <td class="formhead2">
      <table border="0" cellpadding="0" cellspacing="0">
	<tr class="tab2">
	  <td><input type="radio" name="drep_freq"{if $drep_freq=="none"} checked{/if} value="none"></td><td>{$hashmap.none}</td>
	  <td><img src="{$imgpathgeneral}/space.gif" alt="" width="10" height="1" /></td>
	  <td><input type="radio" name="drep_freq"{if $drep_freq=="daily"} checked{/if} value="daily"></td><td>{$hashmap.daily}</td>
	  <td><img src="{$imgpathgeneral}/space.gif" alt="" width="10" height="1" /></td>
	  <td><input type="radio" name="drep_freq"{if $drep_freq=="weekly"} checked{/if} value="weekly"></td><td>{$hashmap.weekly}</td>
	  <td><img src="{$imgpathgeneral}/space.gif" alt="" width="10" height="1" /></td>
	  <td><input type="radio" name="drep_freq"{if $drep_freq=="monthly"} checked{/if} value="monthly"></td><td>{$hashmap.monthly}</td>
	  <td><img src="{$imgpathgeneral}/space.gif" alt="" width="10" height="1" /></td>
	  <td><input type="radio" name="drep_freq"{if $drep_freq=="yearly"} checked{/if} value="yearly"></td><td>{$hashmap.yearly}</td>
	</tr>
      </table>
    </td>
  </tr>
  <tr><td class="lines" height="3" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="3" /></td></tr>
  <tr align="left">
    <td class="tab2" height="20"><img src="{$imgpathgeneral}/space.gif" alt="" width="20" height="1" /></td>
    <td class="formhead2" width="80">{$hashmap.until}</td>
    <td class="formhead2" width="450">
	  <button type="button" id="f_trigger_c" class="submit">...</button>&nbsp;&nbsp;&nbsp;{$serial_rep_day|smarty:nodefaults}&nbsp;&nbsp;{$serial_rep_month|smarty:nodefaults}&nbsp;&nbsp;{$serial_rep_year|smarty:nodefaults}&nbsp;&nbsp;&nbsp;<input type="Checkbox" name="dforever" value="checked" {$dforever}>{$hashmap.forever}
	  {literal}
	  <script>
	  Calendar.setup({
        inputField: "f_trigger_c_c", ifFormat: "dd-mm-y", button: "f_trigger_c", align: "bR", singleClick: true, mondayFirst: true
	  });
  	  </script>	  
	  {/literal}
	</td>
  </tr>
  <tr><td class="lines" height="3" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="3" /></td></tr>
  <tr align="left">
    <td class="tab2" height="20"><img src="{$imgpathgeneral}/space.gif" alt="" width="20" height="1" /></td>
    <td class="formhead2">{$hashmap.days}</td>
    <td class="formhead2">
      <table border="0" cellpadding="0" cellspacing="0">
  	    <tr class="tab2">
        <td><input type="checkbox" name="drep_day_mo"{$drep_day_mo}></td><td>{$hashmap.dow_lang[0]}</td>
		<td><img src="{$imgpathgeneral}/space.gif" alt="" width="10" height="1" /></td>
        <td><input type="checkbox" name="drep_day_tu"{$drep_day_tu}></td><td>{$hashmap.dow_lang[1]}</td>
		<td><img src="{$imgpathgeneral}/space.gif" alt="" width="10" height="1" /></td>
        <td><input type="checkbox" name="drep_day_we"{$drep_day_we}></td><td>{$hashmap.dow_lang[2]}</td>
		<td><img src="{$imgpathgeneral}/space.gif" alt="" width="10" height="1" /></td>
        <td><input type="checkbox" name="drep_day_th"{$drep_day_th}></td><td>{$hashmap.dow_lang[3]}</td>
		<td><img src="{$imgpathgeneral}/space.gif" alt="" width="10" height="1" /></td>
        <td><input type="checkbox" name="drep_day_fr"{$drep_day_fr}></td><td>{$hashmap.dow_lang[4]}</td>
		<td><img src="{$imgpathgeneral}/space.gif" alt="" width="10" height="1" /></td>
        <td><input type="checkbox" name="drep_day_sa"{$drep_day_sa}></td><td>{$hashmap.dow_lang[5]}</td>
		<td><img src="{$imgpathgeneral}/space.gif" alt="" width="10" height="1" /></td>
        <td><input type="checkbox" name="drep_day_su"{$drep_day_su}></td><td>{$hashmap.dow_lang[6]}</td>
	    </tr>
      </table>
    </td>
  </tr>
  <tr><td class="lines" height="3" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="3" /></td></tr>
  <tr align="left">
    <td class="tab2" height="20"><img src="{$imgpathgeneral}/space.gif" alt="" width="20" height="1" /></td>
    <td class="formhead2">{$hashmap.count}</td>
    <td>
        <table border="0" cellpadding="0" cellspacing="0" class="formhead2"><tr><td><input type="text" value="{$drep_count|escape:"html"}" name="drep_count" maxlength="10" size="4">&nbsp; &nbsp; &nbsp;</td><td>{$hashmap.interval}</td><td>&nbsp; &nbsp;<input type="text" value="{$drep_interval|escape:"html"}" name="drep_interval" maxlength="10" size="2"></td></tr></table>
    </td>
  </tr>
  <tr><td><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="2" /></td></tr>
  <tr><td class="lines2" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr><td class="lines" height="3" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="3" /></td></tr>
  <tr>
    <td class="tab2" height="20"><img src="{$imgpathgeneral}/space.gif" alt="" width="20" height="1" /></td>
    <td class="formhead2" width="80">{$hashmap.search_lang}</td>
    <td class="formhead2">
    <input style="width:135px" ONKEYUP="adder2(this)" type='text' name='toadder' class='styletextfield2' value="">
    <SELECT NAME="options" onChange="this.form.toadder.value=this.options[this.selectedIndex].value" style="width:250px;">
	    <option value="">{$hashmap.calendar_selection}
      {$contacts|smarty:nodefaults}
	</SELECT>
    </td>
  </tr>

  <tr>
    <td class="tab2" height="20"></td>
	<td class="formhead2">{$hashmap.calendar_organizer}</td>
    <td class="formhead2">
	  <input style="width:360px" type='text' name='dorganizer' class='styletextfield2' value="{if $id eq ""}{$username}{/if}{$dorganizer}">      
      <input type="Button" onclick="adder(this,this.form.dorganizer)" class="submit" value="<<"></td>
    </td>
  </tr>

  <tr>
    <td class="tab2" height="20"></td>
	<td class="formhead2">{$hashmap.calendar_attendee}</td>
    <td class="formhead2">
	  <input type='text' name='dattendee' class='styletextfield2' value="{$dattendee}" maxlength="100" size="80" style="width:360px">
      <input type="Button" onclick="adder(this,this.form.dattendee)" class="submit" value="<<"></td>
    </td>
  </tr>

  <tr>
    <td class="tab2" height="20"></td>
	<td class="formhead2">{$hashmap.calendar_attendee_non}</td>
    <td class="formhead2">
	  <input style="width:360px" type='text' name='dattendee_non' class='styletextfield2' value="{$dattendee_non}" maxlength="100" size="80">
      <input type="Button" onclick="adder(this,this.form.dattendee_non)" class="submit" value="<<">
    </td>
  </tr>

  <tr>
    <td class="tab2" height="20"></td>
	<td class="formhead2">{$hashmap.calendar_optional}</td>
    <td class="formhead2">
	  <input style="width:360px" type='text' name='doptional' class='styletextfield2' value="{$doptional}" maxlength="100" size="80">
      <input type="Button" onclick="adder(this,this.form.doptional)" class="submit" value="<<">
    </td>
  </tr>
  <tr><td class="lines" height="3" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="3" /></td></tr>
  <tr><td class="lines2" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr><td class="lines" height="3" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="3" /></td></tr>
  <tr align="left">
    <td class="tab2" height="40"><img src="{$imgpathgeneral}/space.gif" alt="" width="20" height="1" /></td>
    <td class="formhead2" valign="top" width="80">{$hashmap.categories}</td>
    <td class="formhead2" width="450">

	  <table border="0" cellpadding="0" cellspacing="0">
		<tr>
		  <td valign="top" id="cat_table" class="repeat{if $id eq "" or $has_dcategories}_hover{/if}">
            <select name="dcategories[]" size="3" multiple>
            {section name=cat loop=$dcategories_arr}
            <option value="{$dcategories_arr[cat][0]}" {$dcategories_arr[cat][2]}>{$dcategories_arr[cat][1]}
            {/section}
        	</select>
		  </td>	
		  <td>&nbsp; &nbsp;</td>
		  <td valign="top" class="formhead2">{$hashmap.calendar_lang}</td>
		  <td>&nbsp;&nbsp;</td>
		  <td valign="top">
	        <select name="dcalendar" style="width: 160px;">
			
			<optgroup label="{$hashmap.users}">
            {section name=item loop=$cals_users}
            <option value="{$cals_users[item][0]}" {if ($dcalendar eq $cals_users[item][0]) || ($dcalendar eq "" && $username eq $cals_users[item][0])}selected{/if}>{$cals_users[item][1]}
            {/section}

			<optgroup label="{$hashmap.groups}">
            {section name=item loop=$cals_groups}
            <option value="{$cals_groups[item][0]}" {if $dcalendar eq $cals_groups[item][0]}selected{/if}>{$cals_groups[item][1]}
            {/section}

			<optgroup label="{$hashmap.holidays}">
            {section name=item loop=$cals_holidays}
            <option value="{$cals_holidays[item][0]}" {if $dcalendar eq $cals_holidays[item][0]}selected{/if}>{$cals_holidays[item][1]}
            {/section}

			<optgroup label="{$hashmap.others}">
            {section name=item loop=$cals_others}
            <option value="{$cals_others[item][0]}" {if $dcalendar eq $cals_others[item][0]}selected{/if}>{$cals_others[item][1]}
            {/section}

        	</select>
		  </td>
		</tr>
	  </table>

    </td>
  </tr>
  <tr><td class="lines2" height="1" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="1" /></td></tr>
  <tr><td class="lines" height="5" width="1" colspan="3"><img src="{$imgpathgeneral}/space.gif" alt="" width="1" height="5" /></td></tr>
  <tr>
    <td align="center" class="formhead2" colspan="3">
	{if !$disable_btn_change}<input class="submit" onclick="return dsummary_ok();" type="submit" name="submit" value="{if $id neq ""}{$hashmap.change_appointment}{else}{$hashmap.create_appointment}{/if}">{/if}
    
    {if $id neq ""}
		{if !$disable_btn_delete}&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<input class="submit" type="submit" name="delete" value="{$hashmap.delete}" onclick="return confirm('{$hashmap.really_delete}');">{/if}
	{/if}
	<img src="{$imgpathgeneral}/space.gif" alt="" width="10" height="3" /><br>
    </td>
  </tr>
</form>
</table>
</body>
</html>
