<?php
echo <<<EOT
<html>

<link rel="stylesheet" type="text/css" media="screen" href="jqueryui/css/redmond/jquery-ui-1.7.2.custom.css"> 
<link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" media="screen" href="report_engine.css" />


<body>

EOT;
echo "<div class=\"ui-widget-header\">Web Dashboards - Ready to View - Click on any</div>";
echo "			 <div class=\"ui-widget\">
			   <div class=\"ui-widget-content\">";

  if ($handle = opendir("dash/"))
      {
         
            

			echo "
			     <ul>";
			 
            /* This is the correct way to loop over the directory. */
			$cnt=0;
            while (false !== ($file = readdir($handle)))
            {
			  if ($file=="." || $file=="..") continue;
                echo "<li><a class=\"ui-state-default ui-corner-all\"  href=\"report_engine.php?report=dash/".$file."\" target=\"{$file}\" >View {$file}</a> <br>";
				$cnt++;
            }
			if ($cnt==0) echo "<li>No Dashboards to view...";
			echo "</ul>";
			     
			 


      }
	  else
	  {
	    echo "no dashboards to view..<br>";
	  }

			echo "			
			 </div>
			   </div>";


			   
echo "<div class=\"ui-widget-header \">Raw Dashboard Definitions - Click to Convert them to Web based</div>";
echo "			 <div class=\"ui-widget\">
			   <div class=\"ui-widget-content\">";

  if ($handle = opendir("raw_uploaded/"))
      {
         
            

			echo "
			     <ul>";
			 
            /* This is the correct way to loop over the directory. */
			$cnt=0;
            while (false !== ($file = readdir($handle)))
            {
			  if ($file=="." || $file=="..") continue;
                echo "<li><a class=\"ui-state-default ui-corner-all\"  href=\"convert2web.php?raw_file=raw_uploaded/".$file."\" target=\"{$file}\" >Convert {$file}</a> <br>";
				$cnt++;
            }
			if ($cnt==0) echo "<li>No raw dashboard to convert...Go to Designer and publish your dashboards";
			echo "</ul>";
			     
			 


      }
	  else
	  {
	    echo "no dashboards to view..<br>";
	  }

			echo "			
			 </div>
			   </div>";

			   
			   
			   
echo "</html></div></body>";
?>