<?php
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright EB Dynamics, Inc., Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 9/9/2008
// Revised: 2/8/2012	ELL
// Added table prefix handling.
	
	include ("check_session.php");
		
	$selected_page_name = $_REQUEST['selected_page_name'];
		
//	include "../connect/db_connection.php";
	if ($selected_page_name)
	{
		$query = "SELECT * FROM " . BWB_TABLE_PREFIX . "meta_tags WHERE page_name = '$selected_page_name'";
		$result = mysql_query($query, $bwb_link);
		if ($row = mysql_fetch_array($result))
		{
			$owner = $row["owner"];
			$author = $row["author"];
			$lanquage = $row["lanquage"];
			$copyright = $row["copyright"];
			$description = $row["description"];
			$abstract = $row["abstract"];
			$keywords = $row["keywords"];
			$subject = $row["subject"];
			$robots_index = $row["robots_index"];
			$robots_follow = $row["robots_follow"];
			$robots_revisit = $row["robots_revisit"];
		}
		else
		{
			$owner = "";
			$author = "";
			$lanquage = "ENGLISH";
			$copyright = "";
			$description = "";
			$abstract = "";
			$keywords = "";
			$subject = "";
			$robots_index = 1;
			$robots_follow = 1;
			$robots_revisit = 30;
		}
	}
	else
	{
		$owner = "";
		$author = "";
		$lanquage = "ENGLISH";
		$copyright = "";
		$description = "";
		$abstract = "";
		$keywords = "";
		$subject = "";
		$robots_index = 1;
		$robots_follow = 1;
		$robots_revisit = 30;
	}
?>
<html>
<head>
<title>EB Content Manager</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<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 GetPageMetatags(page_name)
{
	location.href="edit_meta_tags.php?selected_page_name=" + page_name;	
}

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

<body>
<form name="formEditMetatags" method="post" action="save_meta_tags.php">
<div align="center">
<table width="80%" border="1" cellspacing="0" cellpadding="0" bgcolor="#EEEEEE">
  <tr>
    <td colspan="4" align="center" width="90%">
    <table width="100%" border="0"><tr>
      <td width="90%">
	  <p class="title" style="padding-left:5px;">EB Content Manager - Meta-Tags Editor</p>
	  <p style="padding-left:5px;">Select a page:
	        <select name="page_name" id="page_name" OnChange="GetPageMetatags(this.options[this.selectedIndex].value);">
		      <?php
			$query = "SELECT page_name FROM " . BWB_TABLE_PREFIX . "page_data ORDER BY page_name";
			$result2 = mysql_query($query, $bwb_link);
			$num_results = mysql_num_rows($result2);
			for ($i = 0; $i < $num_results; $i++)
			{
				$row2 = mysql_fetch_array($result2);
				$page_name = $row2["page_name"];
				if (($page_name == $selected_page_name) || (!$selected_page_name && !$page_selected))
				{
				if ($page_name == "index")
						echo "<option value='$page_name' selected='selected'>$page_name (Home)</option>";
					else
						echo "<option value='$page_name' selected='selected'>$page_name</option>";
					$page_selected = 1;
				}
				else
				{
					if ($page_name == "index")
						echo "<option value='$page_name'>$page_name (Home)</option>";
					else
						echo "<option value='$page_name'>$page_name</option>";
				}
			}
			
		?>
            </select>
	        </p>
       </td>
       <td valign="top">
       	<div id="help_button" onClick="OpenHelpWindow();">
        &nbsp;
        </div>
       </td>
       </tr></table>
       </td>
    </tr>
  <tr>
    <td style="padding-left:5px;">Owner:</td>
	<td>
      <input name="owner" type="text" id="owner" value="<?php echo $owner; ?>"></td>
    <td style="padding-left:5px;">Author:</td> 
	<td>
      <input name="author" type="text" id="author" value="<?php echo $author; ?>"></td>
    </tr>
  <tr>
    <td style="padding-left:5px;">Lanquage:</td> 
	<td>
      <input name="lanquage" type="text" id="lanquage" value="<?php echo $lanquage; ?>"></td>
    <td style="padding-left:5px;">Copyright:</td>
	<td> 
      <input name="copyright" type="text" id="copyright" value="<?php echo $copyright; ?>"></td>
    </tr>
  <tr>
    <td style="padding-left:5px;">Description:</td>
    <td colspan="3"><textarea name="description" cols="100" id="description"><?php echo $description; ?></textarea></td>
    </tr>
  <tr>
    <td style="padding-left:5px;">Abstract:</td>
    <td colspan="3"><textarea name="abstract" cols="100" id="abstract"><?php echo $abstract; ?></textarea></td>
    </tr>
  <tr>
    <td style="padding-left:5px;">Keywords:</td>
    <td colspan="3"><textarea name="keywords" cols="100" id="keywords"><?php echo $keywords; ?></textarea>
	<br>
    <span class="small_message">Note: Use comma &quot; , &quot; to separate key words and key phrases.</span></td>
    </tr>
  <tr>
    <td style="padding-left:5px;">Subject:</td>
    <td colspan="3"><textarea name="subject" cols="100" id="subject"><?php echo $subject; ?></textarea></td>
    </tr>
  <tr>
    <td style="padding-left:5px;">Robots:</td>
    <td style="padding-left:5px;"><input name="robots_index" type="checkbox" id="robots_index" value="checkbox" <?php if ($robots_index == 1) echo "checked"; ?>>
      Index</td>
    <td style="padding-left:5px;"><input name="robots_follow" type="checkbox" id="robots_follow" value="checkbox" <?php if ($robots_follow == 1) echo "checked"; ?>> 
      Follow</td>
    <td style="padding-left:5px;">Revisit: 
      <input name="robots_revisit" type="text" id="robots_revisit" value="<?php echo $robots_revisit; ?>"> 
      days</td>
  </tr>
  <tr>
    <td colspan="2" align="center">
	  <br>
        <input type="submit" name="Submit" value="Submit">
      <br>
	  </td>
	  <td  colspan="2" align="center">
	  <br>
	  <input type="button" name="Back" value="Back to Main Menu" onClick="window.location.href='main.php?mode=title';">
	  <br>
	  </td>
    </tr>
</table>
</div>
</form>

</body>
</html>
