<?PHP
// Select (potential) meeting locations
//
// Version: $Revision: 1.3 $
// Date: $Date: 2006/12/09 22:03:47 $
//
// Copyright (c) 2006 Benjamin Oshrin
// License restrictions apply, see LICENSE for details.
$auth_required = 1;
include "../lib/mrsbs.inc";
$pgtitle = $tx['where.edit'];
$pgtype = "schedule";
if(!authorize("schedule", "where", $rvar_mtgid))
mexit($tx['op.err.perm'], 1);
$mtg = get_meeting_info($rvar_mtgid);
if(!$mtg)
mexit($tx['op.err.nomtg'], 1);
if(isset($rvar_next))
$nexturi = $rvar_next;
else
$nexturi = "review.php?mtgid=" . $rvar_mtgid;
?>
<HTML>
<HEAD>
<TITLE><?PHP print $pgtitle;?></TITLE>
</HEAD>
<BODY>
<TABLE CLASS="main">
<?PHP include "../lib/titlebar.php";?>
<TR>
<TD CLASS="main">
<TABLE CLASS="form">
<TR>
<TD CLASS="formheader">
<?PHP print $tx['sd.mtgid'] . ' <A HREF="review.php?mtgid=' .
hstr($rvar_mtgid) . '">' . hstr($rvar_mtgid) . "</A>";?>
</TD>
</TR>
<FORM NAME="where" ACTION="schedule-op-handler.php" METHOD="post">
<INPUT TYPE="hidden" NAME="op" VALUE="where">
<INPUT TYPE="hidden" NAME="mtgid" VALUE="<?PHP print hstr($rvar_mtgid);?>">
<INPUT TYPE="hidden" NAME="return" VALUE="<?PHP print hstr($nexturi);?>">
<TR>
<TD CLASS="formheader2">
<?PHP print $tx['sd.locs'];?><BR>
<FONT CLASS="note"><?PHP print $tx['sd.locs.desc'];?></FONT>
</TD>
</TR>
<TR>
<TD CLASS="formfield2">
<TABLE CLASS="form">
<TR>
<?PHP
$locval = "l";
if($mtg['location'] == -1)
$locval = "n";
elseif($mtg['location'] == -2)
$locval = "t";
elseif($mtg['location'] > 0 && $mtg['locations']['count'] == 0)
$locval = "u";
$locs = get_permitted_locations($_SESSION['contactid'],
$_SESSION['groups']);
?>
<TD CLASS="formfield">
<INPUT TYPE="radio" NAME="loc" VALUE="n"
<?PHP if($locval=="n") print " CHECKED"; ?>>
</TD>
<TD CLASS="formfield">
<?PHP print $tx['sd.locs.no'];?>
</TD>
</TR>
<TR>
<TD CLASS="formfield">
<INPUT TYPE="radio" NAME="loc" VALUE="t"
<?PHP if($locval=="t") print " CHECKED"; ?>>
</TD>
<TD CLASS="formfield">
<?PHP print $tx['sd.locs.tbd'];?>
</TD>
</TR>
<TR>
<TD CLASS="formfield">
<INPUT TYPE="radio" NAME="loc" VALUE="u"
<?PHP if($locval=="u") print " CHECKED"; ?>>
</TD>
<TD CLASS="formfield">
<?PHP print $tx['sd.locs.use'];?>
<SELECT NAME="locuse" ONCLICK='document.where.loc[2].checked="true"'>
<?PHP
if($locs)
{
for($i = 0;$i < $locs['count'];$i++)
{
print '<OPTION VALUE="' . $locs[$i]['locationid'] . '"'
. ($mtg['location'] == $locs[$i]['locationid'] ? " SELECTED" : "")
. ">" . $locs[$i]['description'] . "</OPTION>\n";
}
}
?>
</SELECT>
</TD>
</TR>
<TR>
<TD CLASS="formfield">
<INPUT TYPE="radio" NAME="loc" VALUE="l"
<?PHP if($locval=="l") print " CHECKED"; ?>>
</TD>
<TD CLASS="formfield">
<?PHP print $tx['sd.locs.best'];?><BR />
<TABLE CLASS="formfield">
<TR>
<TD CLASS="formheader">
<?PHP print $tx['sd.loc']; ?>
</TD>
<TD CLASS="formheader">
<?PHP print $tx['sd.pref']; ?>
</TD>
<TD CLASS="formheader">
<?PHP print $tx['lc.capacity']; ?>
</TD>
</TR>
<?PHP
if($locs)
{
for($i = 0;$i < $locs['count'];$i++)
{
// Determine which value is selected, starting with default
// behavior
$prefval = 1;
if($locs[$i]['capacity'] < $mtg['invitees']['count'])
$prefval = 0;
// and overriding if already selected
for($j = 0;$j < $mtg['locations']['count'];$j++)
{
if($mtg['locations'][$j]['locationid'] ==
$locs[$i]['locationid'])
$prefval = $mtg['locations'][$j]['pref'];
}
print '
<TR>
<TD CLASS="formfield">
<INPUT TYPE="hidden" NAME="locid[]" VALUE="' .
$locs[$i]['locationid'] . '">' . $locs[$i]['description'] . '
</TD>
<TD CLASS="formfield">
<SELECT NAME="locpref[]"
ONCLICK=\'document.where.loc[3].checked="true"\'>
<OPTION VALUE="0"' . ($prefval == 0 ? " SELECTED" : "") .
'>' . $tx['sd.locs.unac'] . '</OPTION>
<OPTION VALUE="1"' . ($prefval == 1 ? " SELECTED" : "") .
'>' . $tx['sd.locs.acpt'] . '</OPTION>
<OPTION VALUE="2"' . ($prefval == 2 ? " SELECTED" : "") .
'>' . $tx['sd.locs.pref'] . '</OPTION>
</SELECT>
</TD>
<TD CLASS="formfield">
' . $locs[$i]['capacity'] . '
</TD>
</TR>
';
}
}
?>
</TABLE>
</SELECT>
<BR>
<A HREF="../admin/location.php?locationid=new&return=<?PHP print urlencode("../schedule/where.php?mtgid=" . $rvar_mtgid);?>">[+]
<?PHP print $tx['lc.loc.new'];?></A>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD CLASS="formfield2">
<INPUT TYPE="submit" VALUE="<?PHP print $tx['op.continue'];?>">
</TD>
</TR>
</FORM>
</TABLE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>