<?php
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created:	2/17/2015	ELL
// 

	include ("check_session.php");
	
	$last_page_edited = $_SESSION['last_page_edited'];
?>

<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Manage Page Attributes | Breeze Website Builder</title>
<link rel="stylesheet" href="theme/<?php echo $theme; ?>/manager.css" type="text/css">

<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/json2.js"></script>
<script src="js/browser_detect.js"></script>
<script src="js/mouse_position.js"></script>
<script src="js/popup_msg.js"></script>
<script src="js/manage_page_attributes.js"></script>

<script>
<?php
	echo "	var MANAGE_PAGE_ATTRIBUTES_ERROR_RETRIEVING_PAGE_ATTRIBUTES_ERR = \"" . MANAGE_PAGE_ATTRIBUTES_ERROR_RETRIEVING_PAGE_ATTRIBUTES_ERR . "\";\n";
	echo "	var MANAGE_PAGE_ATTRIBUTES_PAGE_ATTRIBUTES_SAVED_MSG = \"" . MANAGE_PAGE_ATTRIBUTES_PAGE_ATTRIBUTES_SAVED_MSG . "\";\n";
	echo "	var MANAGE_PAGE_ATTRIBUTES_ERROR_SAVING_PAGE_ATTRIBUTES_ERR = \"" . MANAGE_PAGE_ATTRIBUTES_ERROR_SAVING_PAGE_ATTRIBUTES_ERR . "\";\n";
?>
</script>

<style>
#editor_options_div	{
	display:block;
	position:absolute;
	top:50px;
	left:400px;
}

#save_attributes_btn	{
	position:relative;
	display:block;
	top:50px;
	left:100px;
	width:105px;
}
</style>
</head>

<body onLoad="GetPageAttributes('<?php echo $last_page_edited; ?>', -1); InitializeConsole();">
	<div id="sub_level_1_buttons">
	
        <div class="button_heading_sub_level_1"><div class="button_heading_text_sub_level_1"><?php echo MANAGE_PAGE_ATTRIBUTES_HEADING; ?></div><div class="button_heading_help" onClick="OpenHelpWindow();">&nbsp;</div></div>
		<?php
			if ($access_level == "restricted")
				$query = "SELECT page_name FROM " . BWB_TABLE_PREFIX . "page_data WHERE restricted = 0 ORDER BY page_name";
			else
				$query = "SELECT page_name FROM " . BWB_TABLE_PREFIX . "page_data ORDER BY page_name";
			$result = $bwb_dbh->query($query);
			$num_results = $result->rowCount();
			$i = 0;
			while ($row = $result->fetch(PDO::FETCH_ASSOC))
			{
				$page_name = $row["page_name"];
				if ($page_name == $last_page_edited)
					$selected = " down_sub";
				else
					$selected = "";
				if ($page_name == "index")
					$home = " (Home)";
				else
					$home = "";
				

				echo "<div id='page_name_select$i' class='button_sub_level_1$selected' onClick=\"GetPageAttributes('$page_name', $i);\"><span class='button_text_sub_level_1'>$page_name$home</span></div>\n";
				$i++;
			}
		?>
    </div>
    <div id="editor_options_div">
        <form name="frmPageAttributes" id="frmPageAttributes" action="save_page_attributes.php" method="post" enctype="multipart/form-data">
            <span class="bold"><?php echo MANAGE_PAGE_ATTRIBUTES_EDITOR_OPTIONS; ?></span><br /><br />
            <input type="checkbox" id="use_table_structure" name="use_table_structure" />
            <?php echo MANAGE_PAGE_ATTRIBUTES_USE_PAGE_TABLE_STRUCTURES; ?><br />
            <input type="checkbox" id="use_table_structure_mobile" name="use_table_structure_mobile" />
            <?php echo MANAGE_PAGE_ATTRIBUTES_USE_PAGE_TABLE_STRUCTURES_FOR_MOBILE; ?><br /><br />
            <input type="checkbox" id="body_onload" name="body_onload" />
            <?php echo MANAGE_PAGE_ATTRIBUTES_CALL_BODY_ONLOAD_FUNCTION; ?><br /><br />
            <input type="checkbox" id="disable_site_styles" name="disable_site_styles" />
            <?php echo MANAGE_PAGE_ATTRIBUTES_DISABLE_SITE_STYLES_WHEN_EDITING; ?><br />
            
            <div class='button_console_save' onClick="SavePageAttributes();" id="save_attributes_btn"><span class='button_console_text_w_icon'><?php echo UPDATE_WORD; ?></span></div>
            
            <input type="hidden" name="page_cnt" id="page_cnt" value="<?php echo $num_results; ?>" />
            <input type="hidden" name="page_name" id="selected_page" />
        </form>
    </div>
    
<?php include("lib/popup_msg.html"); ?>

<script language="JavaScript"  type="text/javascript">
	HidePopupMsg();
</script>
</body>
</html>