<?php
////////////////////////////////////////////////////////////////////////
// Restrict Page Access //
// Breeze Website Builder
// Copyright EB Dynamics, Inc., Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 4/9/2010
// Revised: 2/9/2012	ELL
// Added table prefix handling.
	
	include ("check_session.php");
		
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Breeze Website Builder</title>
<link rel="stylesheet" href="manager.css" type="text/css">
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">

<script language="JavaScript"  type="text/javascript">
	
	function OpenHelpWindow()
	{
		window.open("http://breezewebsitebuilder.com/docs/cms/help.html#restrict_editing", "Help", "scrollbars=1,resizable=1,status=0,toolbar=0,menubar=0,location=0,height=700,width=800");
	}
	
	function SelectAll()
	{
		var frm = document.getElementById('frm_restrict_editing');
		for (var i =0; i < frm.elements.length; i++) 
		{
		 	frm.elements[i].checked = true;
		}
	}
	
	function ClearAll()
	{
		var frm = document.getElementById('frm_restrict_editing');
		for (var i =0; i < frm.elements.length; i++) 
		{
		 	frm.elements[i].checked = false;
		}
	}
</script>
</head>

<body>

<div align="center">
<p class="title">Restrict Access to Editing Pages for Restricted Users</p>
<form action="save_restrict_editing.php" method="post" enctype="multipart/form-data" name="frm_restrict_editing" id="frm_restrict_editing">
<table width="80%" border="0">
<tr bgcolor='#CCCCCC'>
	<td><b>Page</b></td><td><b>Restricted</b></td>
<?php
	$query = "SELECT * FROM " . BWB_TABLE_PREFIX . "page_data ORDER BY page_name";
	$result = mysql_query($query, $bwb_link);
	while($row = mysql_fetch_array($result))
	{
		if ($bgclr == "#DDDDDD")
			$bgclr = "#EEEEEE";
		else
			$bgclr = "#DDDDDD";
			
		$page_name = $row["page_name"];
		$restricted = $row["restricted"];
		if ($restricted == 1)
			echo "<tr bgcolor='$bgclr'><td>$page_name</td><td><input name='$page_name' id='$page_name' type='checkbox' value='1' checked /></td></tr>\n";
		else
			echo "<tr bgcolor='$bgclr'><td>$page_name</td><td><input name='$page_name' id='$page_name' type='checkbox' value='1' /></td></tr>\n";
	}
?>
</tr>
</table>

<table width="80%" border="0" cellspacing="0" cellpadding="0">
 <tr>
   <td colspan="4">&nbsp;</td>
   <td align="center" valign="top" rowspan="2">
    <div id="help_button" onClick="OpenHelpWindow();">
    &nbsp;
    </div>
   </td>
 </tr>
 <tr>
   <td align="center">
    <input type="button" value="Select All" name="select_all" onclick="SelectAll();" />
   </td>
   <td align="center">
    <input type="button" value="Clear All" name="clear_all" onclick="ClearAll();" />
   </td>
   <td align="center">
    <input type="submit" value="Save" name="submit" />
   </td>
   <td align="center">
     <input type="button" name="Back" value="Back to Main Menu" onClick="window.location.href='main.php?mode=admin';" />
   </td> 
 </tr>
</table>
</form> 
</div>

</body>
</html>