evaluate.php 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <!DOCTYPE html>
  2. <html>
  3. <meta charset="utf-8">
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  5. <link rel="stylesheet" type="text/css" href="css/style.css">
  6. <head>
  7. <title>An African Language Short Story Competition</title>
  8. </head>
  9. <?php include 'submitdatabaseinfo.php';?>
  10. <body>
  11. <ul>
  12. <li><a id="home" href="index.php">Home</a></li>
  13. <li><a id="original" href="submit.php">Original Story Submission</a></li>
  14. <li><a id="translation" href="submittranslation.php">Translated Story Submission</a></li>
  15. <li><a id="stories" href="displaystories.php">Submitted Stories</a></li>
  16. <li><a id="evaluate" class="active" href="#">Evaluate</a></li>
  17. <li><a id="statistics" href="submissionstatistics.php">Submissions per Language</a></li>
  18. <li><a id="contact" href="contact.php">Contact</a></li>
  19. <li><a id="resources" href="resources.php">Resources</a></li>
  20. <li><a id="flyers" href="flyers.php">Flyers</a></li>
  21. <li><a id="faq" href="faq.php">Frequently Asked Questions</a></li>
  22. <li><a id="privacy" href="privacy.php">Privacy</a></li>
  23. </ul>
  24. <header>
  25. <h1>Tuvute Pamoja
  26. <a href="https://deeplearningindaba.com">
  27. <img src="images/deeplearningindaba.svg" alt="Deeplearning Indaba" style="height:60px">
  28. </a></h1>
  29. </header>
  30. <h1 id="title">An African Language Short Story Competition</h1>
  31. <section>
  32. <h3 id="descriptiontitle">Story Evaluation</h3>
  33. <div>
  34. <p id="descriptiontext1">
  35. If you have made a submission of an original story or a translation, you can evaluate
  36. stories in languages in which you have made a submission. Your evaluation will help
  37. other story writers and translators improve their work. Stories with the highest
  38. scores will win prizes. A prize of $40 will be given to the author of the best
  39. original short story in each language. A prize of $40 will be given to the translator
  40. of the best translated short story in each language. A prize of $40 will be given
  41. to the author of the best translated short story in each language. Please evaluate
  42. stories will based on a 5 point scale (5 excellent, 4 very good, 3 good, 2 average,
  43. 1 improvement needed) on:</p>
  44. <ol type="a">
  45. <li id="descriptiontext2">Grammar and spelling</li><br>
  46. <li id="descriptiontext3">Theme and plot</li><br>
  47. <li id="descriptiontext4">Style</li><br>
  48. <li id="descriptiontext5">Cultural relevance</li><br>
  49. <li id="descriptiontext6">Overall impression</li><br>
  50. </ol>
  51. <p id="descriptiontext7">The average score will be used
  52. to rank stories, in case of a tie, the organizing committee
  53. will randomly choose one story to receive a prize.</p>
  54. </div>
  55. </section>
  56. <section>
  57. <div>
  58. <label id="votecode" for="votecode">Please enter the voting code you received by email
  59. </label><br>
  60. <input type="votecode" id="votecodeinput" name="votecodeinput" style="width:375px"><br>
  61. <p>
  62. <button id="submitvotecode" name="submitvotecode" onclick="checkvotecode()" >Submit vote code
  63. </button>
  64. </p>
  65. </div>
  66. <div id="story">
  67. </div>
  68. <div>
  69. <h3 id="evaluationscaletitle"> Evaluation scale</h3>
  70. <ol>
  71. <li id="evaluation1">Improvement needed</li><br>
  72. <li id="evaluation2">Average</li><br>
  73. <li id="evaluation3">Good</li><br>
  74. <li id="evaluation4">Very good</li><br>
  75. <li id="evaluation5">Excellent</li><br>
  76. </ol>
  77. </div>
  78. <div id="storyevaluation">
  79. <table id="storiestoevaluate" ></table>
  80. </div>
  81. <div id="submissionresponse">
  82. </div>
  83. </section>
  84. <section>
  85. <div id="keyboarddiv">
  86. <?php// include "softkeyboard.php" ;?>
  87. </div>
  88. </section>
  89. </body>
  90. <?php include 'footer.php';?>
  91. <script>
  92. function evaluatestory(id) {
  93. var comment = document.getElementById(id+"C").value;
  94. var grammarandspelling = document.getElementById(id+"GandS").value;
  95. var themeandplot = document.getElementById(id+"TandP").value;
  96. var style = document.getElementById(id+"S").value;
  97. var culturalrelevance = document.getElementById(id+"CR").value;
  98. var overallimpression = document.getElementById(id+"OI").value;
  99. var voterid = document.getElementById(id+"voterid").value;
  100. if ( (grammarandspelling === "" ) ||
  101. (themeandplot === "" ) ||
  102. (style === "" ) ||
  103. (culturalrelevance === "" ) ||
  104. (overallimpression === "" ) ||
  105. (grammarandspelling < 1 ) ||
  106. (themeandplot < 1 ) ||
  107. (style < 1 ) ||
  108. (culturalrelevance < 1 ) ||
  109. (overallimpression < 1 ) ||
  110. (grammarandspelling > 5 ) ||
  111. (themeandplot > 5 ) ||
  112. (style > 5 ) ||
  113. (culturalrelevance > 5 ) ||
  114. (overallimpression > 5 )
  115. )
  116. {
  117. document.getElementById(id+"evalresult").innerHTML = "Please fill all 5 numeric fields with a number between 1 and 5";
  118. }else{
  119. document.getElementById(id+"evalresult").innerHTML = "";
  120. //use ajax to store scores in database
  121. var xmlhttp = new XMLHttpRequest();
  122. xmlhttp.onreadystatechange = function() {
  123. if (this.readyState == 4 && this.status == 200) {
  124. document.getElementById(id+"evalresult").innerHTML = this.responseText;
  125. }
  126. };
  127. xmlhttp.open("POST","submitevaluation.php",true);
  128. xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  129. xmlhttp.send("comment="+comment+"&grammarandspelling="+grammarandspelling+"&themeandplot="+themeandplot+"&style="+style+"&culturalrelevance="+culturalrelevance+"&overallimpression="+overallimpression+"&id="+id+"&voterid="+voterid);
  130. }
  131. }
  132. </script>
  133. <script>
  134. function checkvotecode() {
  135. var votecode = document.getElementById("votecodeinput").value;
  136. //use ajax to check languages can evaluate stories in
  137. var xmlhttp = new XMLHttpRequest();
  138. xmlhttp.onreadystatechange = function() {
  139. if (this.readyState == 4 && this.status == 200) {
  140. document.getElementById("storiestoevaluate").innerHTML = this.responseText;
  141. }
  142. };
  143. xmlhttp.open("POST","votecode.php",true);
  144. xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  145. xmlhttp.send("code="+votecode);
  146. }
  147. </script>
  148. <script>
  149. function addcharacter(id)
  150. {
  151. var charin = document.getElementById(id).value;
  152. //var id = event.srcElement.id;
  153. console.log(id);
  154. console.log(charin);
  155. var text = document.getElementById("draftcomment").value;
  156. var input = document.getElementById("draftcomment");
  157. var cursorpos = input.selectionStart;
  158. // A slow but reliable entry method
  159. var start = text.substring(0,cursorpos);
  160. var end = text.substring(cursorpos,text.length);
  161. if (charin==="")
  162. {
  163. var character="";
  164. }else if (id==="Backspace") {
  165. var character="";
  166. var start = start.substring(0,start.length-1);
  167. }else if ((id==="Enter")||(id==="Tab")){
  168. var character = charin;
  169. }else{
  170. var character = String.fromCharCode(charin);
  171. }
  172. document.getElementById("draftcomment").value = start + character + end;
  173. }
  174. function shiftwrap()
  175. {
  176. var value = document.getElementById("keyboardtype").value;
  177. shift(value);
  178. }
  179. function changecasewrap()
  180. {
  181. var value = document.getElementById("keyboardtype").value;
  182. changecase(value);
  183. }
  184. function altgrwrap()
  185. {
  186. var value = document.getElementById("keyboardtype").value;
  187. altgr(value);
  188. }
  189. function keyboardwrap()
  190. {
  191. var value = document.getElementById("keyboardtype").value;
  192. keyboard(value);
  193. if(value==="ara") {
  194. document.getElementById("draftcomment").dir="rtl";
  195. }else{
  196. document.getElementById("draftcomment").dir="ltr";
  197. }
  198. }
  199. function getstory(storyid) {
  200. //use ajax to get story from database
  201. var xmlhttp = new XMLHttpRequest();
  202. xmlhttp.onreadystatechange = function() {
  203. if (this.readyState == 4 && this.status == 200) {
  204. document.getElementById("story").innerHTML = this.responseText;
  205. }
  206. };
  207. xmlhttp.open("GET","getstory.php?primarykey="+storyid,true);
  208. xmlhttp.send();
  209. }
  210. </script>
  211. <script type="text/javascript" src="js/afrikaanskeys.js"></script>
  212. <script type="text/javascript" src="js/akankeys.js"></script>
  213. <script type="text/javascript" src="js/amharickeys.js"></script>
  214. <script type="text/javascript" src="js/arabickeys.js"></script>
  215. <script type="text/javascript" src="js/bembakeys.js"></script>
  216. <script type="text/javascript" src="js/camerooniankeys.js"></script>
  217. <script type="text/javascript" src="js/dagbanikeys.js"></script>
  218. <script type="text/javascript" src="js/englishkeys.js"></script>
  219. <script type="text/javascript" src="js/ewekeys.js"></script>
  220. <script type="text/javascript" src="js/gakeys.js"></script>
  221. <script type="text/javascript" src="js/hausakeys.js"></script>
  222. <script type="text/javascript" src="js/igbokeys.js"></script>
  223. <script type="text/javascript" src="js/kikuyukeys.js"></script>
  224. <script type="text/javascript" src="js/lingalakeys.js"></script>
  225. <script type="text/javascript" src="js/lugandakeys.js"></script>
  226. <script type="text/javascript" src="js/malikeys.js"></script>
  227. <script type="text/javascript" src="js/sesothokeys.js"></script>
  228. <script type="text/javascript" src="js/togokeys.js"></script>
  229. <script type="text/javascript" src="js/wolofkeys.js"></script>
  230. <script type="text/javascript" src="js/yorubakeys.js"></script>
  231. <script type="text/javascript" src="js/keyboard.js"></script>
  232. </html>