<?php
if (!isset($_SESSION['FirstName'])) {
	session_start();
}
if ($_SESSION['FirstName'] == "") {
	echo 'You are not authorized to view this page. <br><br>You may <a href="index.php"><font color="blue">log in here.</font></a>';
	exit;
}
include ('includes/db1config.php');
include ('../includes/mysql_connect.php');
include("seo_functions.php");

$qry = "select * from seo_checklist where active=1";
$rs = mysql_query($qry);
echo "<table><tr><td>Task <td>Status <td>Last tested <td>";
while($nt=mysql_fetch_array($rs))
{
	if(empty($nt['status']) || $nt['status']==""){
		$status = "<font color='red'>Not tested</font>";
	} else {
		if( $nt['status'] == 'Actions recommended' ){
			$status = '<a href="javascript:void(0);" class="popup" >'.$nt['status'].'</a>';
		} else {
			$status = $nt['status'];
		}
	}
	echo "<tr><td><b>".$nt['task']."</b> <td>".$status."<td>".$nt['last_checked']."<td><a href='javascript:void(0);' class='Page_Titles'><font color='blue'><u>Test now</u></font></a>";
}

echo "</table>";
//include("seo_functions.php");
?>

<?php include("admin_globals.php"); ?>

</div>


<style type="text/css" media="screen">
	.ui-dialog{
		display: block;
	    height: auto;
	    left: 523.5px;
	    outline: 0 none;
	    position: absolute;
	    top: 50.5px;
	    width: 200px;
	    z-index: 1002;
	}
</style>

<div id="dialog" class="test_result" title="Page Title results" style="width:50%;height:400px;display:none;">
  <iframe style="width:100%;height:400px;" src="showResults.php" id="iframe-add" class="menu-item-iframe"></iframe>
</div>

<div id="loading" class="" title="Testing..." style="width:200px !important;height:400px;display:none;">
	<center><h2>Performing tests ...</h2></center>
</div>

<script>
	$(document).ready(function() {
		$(document).on('click', '.Page_Titles', function() {
			$( "#loading" ).dialog();
			$(".ui-dialog").css("width","200px");
			$.ajax({
				url  : '/cmsadmin/seo_functions.php',
				type : 'POST',
				dataType : 'json',
				data: {
					category : 'Page titles'
				},
			}).done(function(res) {

				$( "#loading" ).html('<center><h2>Test complete...</h2></center>');
				$( "#loading" ).dialog();
				$( '#loading' ).on('dialogclose', function(event) {
					window.location.reload();	
				});

			});
		});

		$(document).on('click', '.popup', function(event) {
			$( "#dialog" ).dialog();
			$(".ui-dialog").css({"width":"700px",'left':'320px'});
		});
    
	});

</script>

<div style="clear: both;">&nbsp;</div>
			  <div style="text-align:center;"><?php echo $bottom_links; ?></div>
