<?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>Copy/Rename 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;
}

#copy_rename_btn	{	width:130px;	}
</style>

<script language="javascript" type="text/javascript">
function OpenHelpWindow()
{
	window.open("http://breezewebsitebuilder.com/docs/cms/help.html#copy_rename_page", "Help", "scrollbars=1,resizable=1,status=0,toolbar=0,menubar=0,location=0,height=700,width=800");
}
</script>
</head>

<body>
<div class="button_heading_sub_level_1" id="copy_rename_pages_heading"><div class="button_heading_text_sub_level_1">Copy or Rename Pages</div><div class="help_button" id="help_button" onclick="OpenHelpWindow();">&nbsp;</div></div>

 <div id="copy_rename_page">
	<form name="frmRenamePage" id="frmRenamePage" method="post" action="copy_rename_page.php">
	<p align="center">
        Copy
        <input name="copy_mode" type="radio" value="copy" checked="checked" onClick="EnableDisableCreateNewTemplateCheckbox(this.value);" />
        or Rename
        <input name="copy_mode" type="radio" value="rename" onClick="EnableDisableCreateNewTemplateCheckbox(this.value);" />
	   page
	  <select name="page_name" class="page_dropdown">
		<?php
			$query = "SELECT page_name FROM " . BWB_TABLE_PREFIX . "page_data ORDER BY page_name";
			$result = $bwb_dbh->query($query);
			$num_results = $result->rowCount();
			for ($i = 0; $i < $num_results; $i++)
			{
				$row = $result->fetch(PDO::FETCH_ASSOC);
				$page_name = $row["page_name"];
				echo "<option value='$page_name'>$page_name</option>";
			}
		?>
	  </select>
		to	
		<input type="text" name="new_name" />
	      <br>
          <label id="create_new_template_label">
	      <input type="checkbox" name="create_new_template" id="create_new_template">
	      Discard old page template and create new
          </label>
	</p>
		<center>
          <div class='button_console_edit' id="copy_rename_btn" onClick="document.getElementById('frmRenamePage').submit();"><span class='button_console_text_w_icon'>Copy/Rename</span></div>
		</center>
        <input type="hidden" name="overwrite" value="0" />
        <input type="hidden" name="overwrite_content_only" value="0" />
	  </form>
      <br /><br /><br /><br /><br /><br /><br />
	<span class="small_message">Note: Renaming page will NOT change any links that you have created.
	Menu items will be updated automatically, but you will need to change any
	links that exist on any pages to reference the new page name.</span>
</div>

</body>
</html>