<?php
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 9/9/2008
// Revised: 2/10/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>Delete Page Select</title>
<link rel="stylesheet" href="manager.css" type="text/css">

<style type="text/css">
#help_button	{	
	position:relative;
	display:block;
	top:-15px;
	left:215px;
	height:31px;
	width:31px;
	z-index:100;
}
#delete_page_btn	{	width:110px;	}
#delete_blog_btn	{	width:110px;	}
</style>

<script language="javascript" type="text/javascript" src="js/browser_detect.js"></script>
<script language="javascript" type="text/javascript" src="js/mouse_position.js"></script>
<script language="javascript" type="text/javascript" src="js/popup_msg.js"></script>
<script language="javascript" type="text/javascript" src="js/delete_page_select.js"></script>
</head>

<body>
<div class="button_heading_sub_level_1" id="delete_page_blog_heading"><div class="button_heading_text_sub_level_1">Delete Page or Blog</div><div class="help_button" id="help_button" onclick="OpenHelpWindow();">&nbsp;</div></div>

<div id="delete_page">
	  <table align="center" border="0" width="80%"><tr><td>
        <table align="center" border="0"><tr>
        <td align="center">Select the page you want to delete: 
            <select name="selectPageToDelete" id="selectPageToDelete" class="page_dropdown">
        <?php    
            $query = "SELECT page_name FROM " . BWB_TABLE_PREFIX . "page_data ORDER BY page_name";
            $result = $bwb_dbh->query($query);
            while ($row = $result->fetch(PDO::FETCH_ASSOC))
			{
                $page_name = $row["page_name"];
                echo "<option value='$page_name'>$page_name</option>";
            }
        ?>
            </select>
          </td>
          </tr>
          <tr>
            <td align="center">
            <div class='button_console_delete' id="delete_page_btn" onClick="DeleteConfirm('page');"><span class='button_console_text_w_icon'>Delete</span></div>
            </td>
          </tr>
          </table>
 </td>
 <td>
      <table aign="center"><tr>
      <td align="center">
     <p align="center">Select the blog post you want to delete: 
		<select name="selectBlogToDelete" id="selectBlogToDelete" class="page_dropdown">
		<?php
			$query = "SELECT * FROM " . BWB_TABLE_PREFIX . "blogs WHERE `owner`='" . $userid . "' ORDER BY revised";
			$result = $bwb_dbh->query($query);
			$num_results = $result->rowCount();
			for ($i = 0; $i < $num_results; $i++)
			{
				$row = $result->fetch(PDO::FETCH_ASSOC);
				$blog_id = $row["id"];
				$blog_page = $row["page_name"];
				$blog_revised = $row["revised"];
				if ($blog_id == $last_blog_edited)
					$selected = " selected='selected'";
				else
					$selected = "";
				
				echo "<option value='" . $blog_id . "'" . $selected . ">" . $blog_page . " " . $blog_revised . "</option>";
			}
			
		?>
		</select>
        </p>
        </td>
        </tr>
        <tr>
            <td align="center">
            <div class='button_console_delete' id="delete_blog_btn" onClick="DeleteConfirm('blog');"><span class='button_console_text_w_icon'>Delete</span></div>
            </td>
          </tr>
		</table>
   </td></tr></table>
      </div>
      
  <?php include("lib/popup_msg.html"); ?>
      
<script language="JavaScript"  type="text/javascript">
HidePopupMsg();
</script>
</body>
</html>