Add a retrain button to the status page V01.01
authorymh <ymh.work@gmail.com>
Wed, 05 May 2010 12:39:45 +0200
changeset 18 73aae689ad5a
parent 17 e9ee4eb533fa
child 19 883be5921fc6
Add a retrain button to the status page
WebContent/WEB-INF/templates/status.ftl
src/fr/iri/thd/sonyengine/Constants.java
--- a/WebContent/WEB-INF/templates/status.ftl	Tue May 04 18:02:19 2010 +0200
+++ b/WebContent/WEB-INF/templates/status.ftl	Wed May 05 12:39:45 2010 +0200
@@ -1,8 +1,35 @@
 <html>
 <head>
   <title>Status</title>
+  <script type="text/javascript">
+  function submit_retrain() {
+	  if (window.XMLHttpRequest)
+		{// code for IE7+, Firefox, Chrome, Opera, Safari
+		  xmlhttp=new XMLHttpRequest();
+		}
+	  else
+		{// code for IE6, IE5
+		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
+		}
+	  xmlhttp.onreadystatechange=function()
+	  {
+	     if (xmlhttp.readyState==4 && xmlhttp.status==200) {
+	    	 window.location.reload();
+	     }
+	     else {
+	    	 document.getElementById("result").style.visibility = "visible";
+	    	 document.getElementById("result").innerHTML=xmlhttp.responseText;
+	     }
+	  }
+	  xmlhttp.open("POST","engine/train",true);
+	  xmlhttp.send();
+
+	  return false;
+  }
+  </script>
 </head>
 <body>
+<div>
     <h1>Informations</h1>
     <table>
     <thead>
@@ -40,5 +67,11 @@
       <td>${tags_nb}</td>
     </tr>    
     </table>
+</div>
+<div id="button_div">
+    <form action="engine/train" method="post" onsubmit="return submit_retrain();"><input type="submit" value="Retrain"/></form>
+</div>
+<div id="result" style="visibility:hidden; color:red;">
+</div>
 </body>
 </html>
\ No newline at end of file
--- a/src/fr/iri/thd/sonyengine/Constants.java	Tue May 04 18:02:19 2010 +0200
+++ b/src/fr/iri/thd/sonyengine/Constants.java	Wed May 05 12:39:45 2010 +0200
@@ -1,5 +1,5 @@
 package fr.iri.thd.sonyengine;
 
 public class Constants {
-	public final static String VERSION = "01.00";
+	public final static String VERSION = "01.01";
 }