<?php
	if(!isset($_SESSION)) session_start();
	//include("loginCheckPoint.php");
	require_once("demosettings.php");
	//$dcid = $_REQUEST["dcid"];

?>
<!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>
<title>IntuScan - Document Analysis View</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="style.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<!-- CuFon: Enables smooth pretty custom font rendering. 100% SEO friendly. To disable, remove this section -->
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/arial.js"></script>
<script type="text/javascript" src="js/cuf_run.js"></script>

 <script src="jquery/jquery.js" type="text/javascript"></script>
  <script src="jquery/jquery-ui.custom.js" type="text/javascript"></script>
  <script src="jquery/jquery.cookie.js" type="text/javascript"></script>
  <script src="jquery-ui/development-bundle/ui/jquery.ui.tabs.js"></script>
  <script src="jquery-ui/development-bundle/ui/jquery.effects.core.js"></script>
<script src="jquery-ui/development-bundle/ui/jquery.effects.blind.js"></script>

<link type="text/css" href="jquery-ui/css/ui-lightness/jquery-ui-1.8.17.custom.css" rel="stylesheet" />
<script type="text/javascript" src="jquery-ui/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="jquery-ui/js/jquery-ui-1.8.17.custom.min.js"></script>

  <link href="src/skin/ui.dynatree.css" rel="stylesheet" type="text/css" id="skinSheet">
  <script src="src/jquery.dynatree.js" type="text/javascript"></script>
  <style>
 td {
	border-right: 0px solid #C1DAD7;
	border-bottom: 0px solid #C1DAD7;
	background: #fff;
	padding: 6px 6px 6px 12px;
	color: #4f6b72;
}
.filestdhd{
	color:gray;
	font-weight:bold;
	background:lightgray;
}
.filestdev{
	color:white;
	background:#e58a42;
}
.filestdod{
	color:white;
	background:#e58a42;
}

  </style>

<script type="text/javascript">
function analyseCatalogFile(fileName){
	document.getElementById("l").style.visibility='visible';
	document.getElementById("catalogfile").value=fileName;
	//alert(document.catform.catalogfile.value);
	document.forms["form0"].submit();
};
  $(function(){
  	function runEffect(element) {
			var options = {};
			element.show( "blind", options, 500, function(){ } );
		};

	   $( "#textbut" ).click(function() {
	   		if($("#loadtextdiv").is(":visible") == false){
	   			$( "#loadfilediv" ).hide();
				$( "#loadurldiv" ).hide();
				$( "#catalogdiv" ).hide();
				runEffect($("#loadtextdiv"));
			}
			return false;
		});
		$( "#urlbut" ).click(function() {
			$( "#loadfilediv" ).hide();
			$( "#loadtextdiv" ).hide();
			$( "#catalogdiv" ).hide();
			if($("#loadurldiv").is(":visible") == false){
				runEffect($("#loadurldiv"));
			}
			return false;
		});
		$( "#filebut" ).click(function() {
			$( "#loadurldiv" ).hide();
			$( "#loadtextdiv" ).hide();
			$( "#catalogdiv" ).hide();
			if($("#loadfilediv").is(":visible") == false){
				runEffect($("#loadfilediv"));
			}
			return false;
		});
		$( "#catalogbut" ).click(function() {
			$( "#loadurldiv" ).hide();
			$( "#loadtextdiv" ).hide();
			$( "#loadfilediv" ).hide();
			if($("#catalogdiv").is(":visible") == false){
				runEffect($("#catalogdiv"));
			}
			return false;
		});

		$( "#loadfilediv" ).hide();
		$( "#loadurldiv" ).hide();
		$( "#loadtextdiv" ).hide();

  });

</script>
</head>
<body onunload="">
 <div class="top-banner">
	 <a href="senddoc.php"><img src="images/intuscan-img.png" style="border:0;"/></a>
	 <p style="padding:0 10px 10px 10px; float:right;"><b>1.2.0.8 (demo version)</b></p>
	 <p style="padding:0 10px 10px 10px; float:right;">Hi, <?php echo $_SESSION["username"] ?></p>
	 <p style="padding:0 10px 10px 10px; float:right;"><a style="color:red;" href="logoff.php">logoff</a></p>
 </div>
<div class="main">
  <div class="header">
    <div class="header_block">

      <div class="clr"></div>
    </div>
    <div class="clr"></div>
  </div>
  <div class="content">
      <div class="mainbar">
      <?php
      	$err = $_REQUEST["err"];
      	if($err > 0){
      		if($err == 1){
      			$msg = "The input file exceeded the size limit. Please select a file with size up to 1 MBytes and try again.";
      		}else if($err == 2){
      			$msg = "Nothing to process. Please provide input data and try again.";
      		}
      	}
      	if(strlen($msg) > 0){
      		echo "<div class=\"errmsg\"><b>". $msg . "</b></div>";
      	}
      ?>
        <div class="article">
        	<div>
        		<table align="center">
        			<tr>
        				<td align="center"><p><b>Files Catalog</b></p><p id="catalogbut"><a href=""><img onmouseover="this.src='images/catalog-icon.png';"
        									onmouseout="this.src='images/catalog-icon-bw.png';" src="images/catalog-icon-bw.png"/></a></p></td>
        				<td align="center"><p><b>Text</b></p><p id="textbut"><a href=""><img onmouseover="this.src='images/text-icon.png';"
        									onmouseout="this.src='images/text-icon-bw.png';" src="images/text-icon-bw.png"/></a></p></td>
        				<td align="center"><p><b>Upload File</b></p><p id="filebut"><a href=""><img onmouseover="this.src='images/file-icon.png';"
        									onmouseout="this.src='images/file-icon-bw.png';" src="images/file-icon-bw.png"/></a></p></td>
        				<td align="center"><p><b>URL</b></p><p id="urlbut"><a href=""><img onmouseover="this.src='images/web-icon.png';"
        									onmouseout="this.src='images/web-icon-bw.png';" src="images/web-icon-bw.png"/></a></p></td>
        			</tr>
        		</table>
        	</div>

				 <div id="catalogdiv">

				 	<form action="senddocEngAjx.php" method="post" name="catform" id="form0" enctype="multipart/form-data">
				 		<table style="padding: 5px 5px 5px 5px;">
				 			<tr>
				 				<td class="filestdhd">Languages</td>
				 				<td class="filestdhd">Format</td>
				 				<td class="filestdhd">Description</td>
				 				<td class="filestdhd">Download</td>
				 				<td class="filestdhd" style="background:red; color:white;">Analyze</td>
				 				<td></td>
				 			</tr>
				 		<?php
				 			$mysqli = new mysqli($databaseHost, $databaseUser, $databasePass, $databaseName);				 			
							$res = $mysqli->query("SELECT * FROM filescatalog");
							while ($row = $res->fetch_object()) {
								$id = $row->id;
								$description = $row->description;
								$type = $row->type;
								$language = $row->language;
								$filename = $row->filename;
								echo "<tr>";
								echo "<td>" . $language . "</td>";
								echo "<td>" . $type . "</td>";
								echo "<td>" . $description . "</td>";
								echo "<td><a href=\"download.php?filename=files/" . $filename . "\"><img src=\"images/download-icon-bw.png\" width=\"24\"
											onmouseover=\"this.src='images/download-icon.png'; this.style.cursor='hand';\"
        									onmouseout=\"this.src='images/download-icon-bw.png';\"/></a></td>";
								echo "<td><a href=\"javascript:analyseCatalogFile('" . $filename . "');\"><img style=\"border:0;\" src=\"images/analyze-icon-bw.png\" width=\"24\"
											onmouseover=\"this.src='images/analyze-icon.png';\"
        									onmouseout=\"this.src='images/analyze-icon-bw.png';\"/></a></td>";
								echo "</tr>";
							}

				 		?>
				 		</table>
				 		<input id="catalogfile" name="catalogfile" type="hidden" />
          		 	</form>
          		 </div>
				 <div id="loadfilediv">

				 	<form action="senddocEngAjx.php" method="post" id="form1" enctype="multipart/form-data">
				 		<ol><li>
				 			<label for="name">Upload file</label>
            				<input id="file" name="file" type="file" class="text" />
          		 		</li><li>
            				<input type="submit" name="imageField" id="imageField" src="images/submit.gif" class="send" OnClick="l.style.visibility='visible';"/>
            				<div class="clr"></div>
          				</li></ol>
          		 	</form>
          		 </div>
          		 <div id="loadurldiv">
          		 	<form action="senddocEngAjx.php" method="post" id="form2" enctype="multipart/form-data">
          		 		<ol><li>
				 			<label for="name">Paste a URL</label>
            				<input id="url" name="url" class="text" />
          		 		</li><li>
            				<input type="submit" name="imageField" id="imageField" src="images/submit.gif" class="send" OnClick="l.style.visibility='visible';" />
            				<div class="clr"></div>
          				</li></ol>
          		 	</form>
          		 </div>
          		 <div id="loadtextdiv">
          		 	<form action="senddocEngAjx.php" method="post" id="form2" enctype="multipart/form-data">
          		 		<ol><li>
            				<label for="message">Paste some text</label>
            				<textarea id="message" name="message" rows="8" cols="50"></textarea>
          				</li><li>
            				<input type="submit" name="imageField" id="imageField" src="images/submit.gif" class="send" OnClick="l.style.visibility='visible';" />
            				<div class="clr"></div>
          				</li></ol>
          			</form>
          		</div>
          		<p id="l" name="l" style="visibility:hidden;"><img src="images/loader-banner.gif"/></p>
        </div>
      </div>
      <div class="sidebar">
			<div class="explanation">
			<b>IntuScan™</b> is an integrated <b>semantics-driven</b> engine for real-time exploitation of unstructured textual documents, which integrates intuition and knowledge of seasoned experts into an automated process.
			<br><br>For more information please refer to <a style="color:#83D4B1;" target="_blank" href="files/IntuSca-DOCEX-formatted.pdf">IntuScan™ Whitepaper</a>
			</div>
			<div class="clr"></div>
			<br>
			<div>
				<h2>How to use this demonstration?</h2><br>
				<table style="padding:0;">
					<tr>
						<td><img width="30" src="images/arrow-left.png"/></td>
						<td><b>1. Select input method and submit</b></td>
					</tr>
				</table>
				<table>
					<tr>
						<td></td>
						<td><font style="color:red;">Files Catalog:</font> selected random files</td>
					</tr>
					<tr>
						<td></td>
						<td><font style="color:red;">Text:</font> paste your own text (up to 1000 characters)</td>
					</tr>
					<tr>
						<td></td>
						<td><font style="color:red;">Upload File:</font> upload a textual file (text, pdf, MS Word or html. Up to 1 MByte)</td>
					</tr>
					<tr>
						<td></td>
						<td><font style="color:red;">URL:</font> paste a url for an online page (page content not exceeding 1 MByte of text)</td>
					</tr>
				</table>
				<table style="padding:0;">
					<tr>
						<td><img width="30" src="images/arrow-right.png"/></td>
						<td><b>2. View the results</b></td>
					</tr>
				</table>
				<table>
					<tr>
						<td></td>
						<td><font style="color:red;">Text Annotations:</font> extracted text, annotated with semantic information</td>
					</tr>
					<tr>
						<td></td>
						<td><font style="color:red;">Summary:</font> a complete summary of the processed text</td>
					</tr>
				</table>
			</div>

      </div>
      <div class="clr"></div>
  </div>
</div>
<div class="footer">
    <div class="footer_resize">
    	<p>
    	<div class="logo">
    		<img src="images/logo.jpg" width="100"/>
    	</div>
    	</p>
    	<p class="lf">© Copyright <a href="#">www.intuview.com</a></p>
      <div class="clr"></div>
    </div>
  </div>
</body>
</html>