</SELECT></TD></TR>
<?php } ?>
<TR><TD CLASS=CR><?php echo get_vocab("duration");?></TD>
<TD colspan="3" CLASS=CL><INPUT NAME="duration" SIZE=7 VALUE="<?php echo $duration;?>">
<SELECT NAME="dur_units">
<?php
if( $enable_periods )
$units = array("periods", "days");
else
$units = array("minutes", "hours", "days", "weeks");
while (list(,$unit) = each($units))
{
echo "<OPTION VALUE=$unit";
if ($dur_units == get_vocab($unit)) echo " SELECTED";
echo ">".get_vocab($unit);
}
?>
</SELECT>
<INPUT NAME="all_day" TYPE="checkbox" VALUE="yes" onClick="OnAllDayClick(this)"><?php echo get_vocab("all_day"); ?></TD></TR>

<?php
# Determine the area id of the room in question first
$sql = "select area_id from $tbl_room where id=$room_id";
$res = sql_query($sql);
$row = sql_row($res, 0);
$area_id = $row[0];
# determine if there is more than one area
$sql = "select id from $tbl_area";
$res = sql_query($sql);
$num_areas = sql_count($res);
# if there is more than one area then give the option
# to choose areas.
if( $num_areas > 1 ) {
?>
<script language="JavaScript">
<!--
function changeRooms( formObj )
{
areasObj = eval( "formObj.areas" );
area = areasObj[areasObj.selectedIndex].value
roomsObj = eval( "formObj.elements['rooms[]']" )
// remove all entries
for (i=0; i < (roomsObj.length); i++)
{
roomsObj.options[i] = null
}
// add entries based on area selected
switch (area){
<?php
# get the area id for case statement
$sql = "select id, area_name from $tbl_area order by area_name";
$res = sql_query($sql);
if ($res) for ($i = 0; ($row = sql_row($res, $i)); $i++)
{
print " case \"".$row[0]."\":\n";
# get rooms for this area
$sql2 = "select id, room_name from $tbl_room where area_id='".$row[0]."' order by room_name";
$res2 = sql_query($sql2);
if ($res2) for ($j = 0; ($row2 = sql_row($res2, $j)); $j++)
{
print " roomsObj.options[$j] = new Option(\"".str_replace('"','\\"',$row2[1])."\",".$row2[0] .")\n";
}
# select the first entry by default to ensure
# that one room is selected to begin with
print " roomsObj.options[0].selected = true\n";
print " break\n";
}
?>
} //switch
}
// create area selector if javascript is enabled as this is required
// if the room selector is to be updated.
this.document.writeln("<tr><td class=CR><?php echo get_vocab("areas") ?>:</td><td class=CL valign=top>");
this.document.writeln(" <select name=\"areas\" onChange=\"changeRooms(this.form)\">");
<?php
# get list of areas
$sql = "select id, area_name from $tbl_area order by area_name";
$res = sql_query($sql);
if ($res) for ($i = 0; ($row = sql_row($res, $i)); $i++)
{
$selected = "";
if ($row[0] == $area_id) {
$selected = "SELECTED";
}
print "this.document.writeln(\" <option $selected value=\\\"".$row[0]."\\\">".$row[1]."\")\n";
}
?>
this.document.writeln(" </select>");
this.document.writeln("</td></tr>");
// -->
</script>
<?php
} # if $num_areas
?>
<tr><td class=CR><?php echo get_vocab("rooms") ?>:</td>
<td colspan="3" valign=top class=CL><table><tr><td><select name="rooms[]" multiple="yes">
<?php
# select the rooms in the area determined above
$sql = "select id, room_name from $tbl_room where area_id=$area_id order by room_name";
$res = sql_query($sql);

if ($res) for ($i = 0; ($row = sql_row($res, $i)); $i++)
{
$selected = "";
if ($row[0] == $room_id) {
$selected = "SELECTED";
}
echo "<option $selected value=\"".$row[0]."\">".$row[1];
// store room names for emails
$room_names[$i] = $row[1];
}
?>
</select></td><td><?php echo get_vocab("ctrl_click") ?></td></tr></table> </td></tr>
<TR><TD CLASS=CR><?php echo get_vocab("type")?></TD>
<TD colspan="3" CLASS=CL><SELECT NAME="type">
<?php
for ($c = "A"; $c <= "Z"; $c++)
{
if (!empty($typel[$c]))
echo "<OPTION VALUE=$c" . ($type == $c ? " SELECTED" : "") . ">$typel[$c]\n";
}
?></SELECT></TD></TR>
<?php if($edit_type == "series") { ?>
<TR>
<TD CLASS=CR><?php echo get_vocab("rep_type")?></TD>
<TD colspan="3" CLASS=CL>
<?php
for($i = 0; isset($vocab["rep_type_$i"]); $i++)
{
echo "<INPUT NAME=\"rep_type\" TYPE=\"RADIO\" VALUE=\"" . $i . "\"";
if($i == $rep_type)
echo " CHECKED";
echo ">" . get_vocab("rep_type_$i") . "\n";
}
?> </TD>
</TR>
<TR>
<TD CLASS=CR><?php echo get_vocab("rep_end_date")?></TD>
<TD colspan="3" CLASS=CL><?php genDateSelector("rep_end_", $rep_end_day, $rep_end_month, $rep_end_year) ?></TD>
</TR>
<TR>
<TD CLASS=CR><?php echo get_vocab("rep_rep_day")?> <?php echo get_vocab("rep_for_weekly")?></TD>
<TD colspan="3" CLASS=CL>
<?php
# Display day name checkboxes according to language and preferred weekday start.
for ($i = 0; $i < 7; $i++)
{
$wday = ($i + $weekstarts) % 7;
echo "<INPUT NAME=\"rep_day[$wday]\" TYPE=CHECKBOX";
if ($rep_day[$wday]) echo " CHECKED";
echo ">" . day_name($wday) . "\n";
}
?> </TD>
</TR>
<?php
}
else
{
$key = "rep_type_" . (isset($rep_type) ? $rep_type : "0");
echo "<tr><td class=\"CR\">".get_vocab("rep_type")."</td><td class=\"CL\">".get_vocab($key)."</td></tr>\n";
if(isset($rep_type) && ($rep_type != 0))
{
$opt = "";
if ($rep_type == 2)
{
# Display day names according to language and preferred weekday start.
for ($i = 0; $i < 7; $i++)
{
$wday = ($i + $weekstarts) % 7;
if ($rep_opt[$wday]) $opt .= day_name($wday) . " ";
}
}
if($opt)
echo "<tr><td class=\"CR\">".get_vocab("rep_rep_day")."</td><td class=\"CL\">$opt</td></tr>\n";
echo "<tr><td class=\"CR\">".get_vocab("rep_end_date")."</td><td class=\"CL\">$rep_end_date</td></tr>\n";
}
}
/* We display the rep_num_weeks box only if:
- this is a new entry ($id is not set)
Xor
- we are editing an existing repeating entry ($rep_type is set and
$rep_type != 0 and $edit_type == "series" )
*/
if ( ( !isset( $id ) ) Xor ( isset( $rep_type ) && ( $rep_type != 0 ) && ( "series" == $edit_type ) ) )
{
?>
<TR>
<TD CLASS=CR><?php echo get_vocab("rep_num_weeks")?> <?php echo get_vocab("rep_for_nweekly")?></TD>
<TD colspan="3" CLASS=CL>


<INPUT TYPE=TEXT NAME="rep_num_weeks" VALUE="<?php echo $rep_num_weeks?>">
</p> </TR>
<?php } ?>
<TR><TD CLASS=CR></SELECT>
<?php echo get_vocab("lavf"); ?>
<input name="lavf" type="checkbox" value="Si" onclick="lavf" />
</TD>
<TD CLASS=CR></SELECT>
<?php echo get_vocab("lavl"); ?>
<input name="lavl" type="checkbox" value="Si" onclick="lavl" />
</TD>
<TD CLASS=CR></SELECT>
<?php echo get_vocab("proie"); ?>
<input name="proie" type="checkbox" value="Si" onclick="proie" />
</TD>
<TD CLASS=CR></SELECT>
<?php echo get_vocab("ampli"); ?>
<input name="ampli" type="checkbox" value="Si" onclick="ampli" />
</TD>
<TR><TD CLASS=CR></SELECT>
<?php echo get_vocab("aconf"); ?>
<input name="aconf" type="checkbox" value="Si" onclick="aconf" />
</TD>
<TD CLASS=CR></SELECT>
<?php echo get_vocab("vconf"); ?>
<input name="vconf" type="checkbox" value="Si" onclick="vconf" />
</TD>
<TD CLASS=CR></SELECT>
<?php echo get_vocab("presi"); ?>
<input name="presi" type="checkbox" value="Si" onclick="presi" />
</TD>
<TD CLASS=CR></SELECT>
<?php echo get_vocab("puli"); ?>
<input name="puli" type="checkbox" value="Si" onclick="puli" />
</TD>
<TR>
<TD colspan=4 align=center>
<SCRIPT LANGUAGE="JavaScript">
document.writeln ( '<INPUT TYPE="button" NAME="save_button" VALUE="<?php echo get_vocab("save")?>" ONCLICK="validate_and_submit()">' );
</SCRIPT>
<NOSCRIPT>
<INPUT TYPE="submit" VALUE="<?php echo get_vocab("save")?>">
</NOSCRIPT> </TD></TR>
</TABLE>
<INPUT TYPE=HIDDEN NAME="returl" VALUE="<?php echo $HTTP_REFERER?>">

<INPUT TYPE=HIDDEN NAME="create_by" VALUE="<?php echo $create_by?>">
<INPUT TYPE=HIDDEN NAME="rep_id" VALUE="<?php echo $rep_id?>">
<INPUT TYPE=HIDDEN NAME="edit_type" VALUE="<?php echo $edit_type?>">
<?php if(isset($id)) echo "<INPUT TYPE=HIDDEN NAME=\"id\" VALUE=\"$id\">\n";
?>
</FORM>
<?php include "trailer.inc" ?>



grazie