Permalink
Browse files

Merge branch 'pre-amd' into stable

  • Loading branch information...
2 parents cda2096 + bc10bed commit baf43d2950852760f4b78d44ef06a7b13b8f19b8 Brett van de Sande committed Mar 22, 2017
Showing with 605 additions and 1,617 deletions.
  1. +3 −1 Help/Commands.cl
  2. +30 −44 LogProcessing/Web-Interface/CountErrors.php
  3. +13 −24 LogProcessing/Web-Interface/CountSteps.php
  4. +49 −77 LogProcessing/Web-Interface/ErrorProcessing.php
  5. +0 −4 LogProcessing/Web-Interface/FindTime.html
  6. +26 −37 LogProcessing/Web-Interface/FindTime.php
  7. +31 −46 LogProcessing/Web-Interface/HintProcessing.php
  8. +0 −806 LogProcessing/Web-Interface/JSON.php
  9. +26 −61 LogProcessing/Web-Interface/OpenTrace.php
  10. +13 −34 LogProcessing/Web-Interface/RecordUpdate.php
  11. +228 −290 LogProcessing/Web-Interface/ReviewProcess.php
  12. +30 −52 LogProcessing/Web-Interface/Save.php
  13. +4 −2 LogProcessing/Web-Interface/ShowErrors.html
  14. +55 −77 LogProcessing/Web-Interface/commentProcessing.php
  15. +4 −2 LogProcessing/Web-Interface/comments.html
  16. +36 −0 LogProcessing/Web-Interface/db-login.php
  17. +2 −1 LogProcessing/Web-Interface/formFields.js
  18. +1 −1 LogProcessing/Web-Interface/index.html
  19. +5 −3 LogProcessing/Web-Interface/xml-scripts.js
  20. +1 −0 LogProcessing/database/AndesDatabaseCreationSQL.sql
  21. +1 −1 LogProcessing/database/create_PROBLEM_ATTEMPT.sql
  22. +4 −4 LogProcessing/database/create_REVIEWED_PROBLEMS.sql
  23. +10 −0 LogProcessing/database/create_SOLUTION_COPY.sql
  24. +0 −15 LogProcessing/database/modify_CLASS_INFORMATION.sql
  25. +0 −5 LogProcessing/database/modify_PROBLEM_ATTEMPT.sql
  26. +2 −8 documentation/install.md
  27. +11 −20 documentation/server.md
  28. +19 −1 web-UI/client_log.php
  29. +1 −1 web-UI/login.html
View
@@ -270,7 +270,9 @@
:Assoc '((handle-link . stale))))))
(defun string-responder (str &key explain-more)
- (cond
+ (cond
+ ((equal str "generate-lisp-error")
+ (error "Generate lisp error, for testing."))
((is-a-question str)
(make-end-dialog-turn
(strcat "Sorry, I don't know how to answer your question.  "
@@ -1,72 +1,58 @@
<?php
-$dbuser= $_POST['dbuser'];
-$dbserver= "localhost";
-$dbpass= $_POST['passwd'];
-$dbname= "andes3";
-
-function_exists('mysql_connect') or die ("Missing mysql extension");
-mysql_connect($dbserver, $dbuser, $dbpass)
- or die ("UNABLE TO CONNECT TO DATABASE at $dbserver");
-mysql_select_db($dbname)
- or die ("UNABLE TO SELECT DATABASE $dbname");
+require "db-login.php";
$userSection = $_POST['userSection'];
if($userSection=='study-e')
$userName="P1.userName LIKE 'ThesisE%' AND";
- else if($userSection=='study-c')
- $userName="P1.userName LIKE 'ThesisC%' AND";
- else
- $userName="";
+else if($userSection=='study-c')
+ $userName="P1.userName LIKE 'ThesisC%' AND";
+else
+ $userName="";
-$userProblemQ="SELECT DISTINCT (userProblem) FROM OPEN_PROBLEM_ATTEMPT AS P1 WHERE $userName P1.userSection='$userSection'";
-$userProbResult=mysql_query($userProblemQ);
+$userProblemQ = $db->prepare("SELECT DISTINCT (userProblem) FROM OPEN_PROBLEM_ATTEMPT AS P1 WHERE $userName P1.userSection='$userSection'");
+$userProblemQ->execute();
-if ($myProbs = mysql_fetch_array($userProbResult)){
- do{
+if ($myProbs = $userProblemQ->fetch()) {
+ do {
$curProb=$myProbs["userProblem"];
echo "<BR>Problem Name : '$curProb'<BR>";
$userProblem="P1.userProblem = '$curProb' AND";
- $sql = "SELECT P1.userName,COUNT(*) FROM OPEN_PROBLEM_ATTEMPT AS P1,STEP_TRANSACTION AS P2 WHERE $userName $userProblem P1.userSection='$userSection' AND P1.clientID = P2.clientID AND P2.server LIKE '%\"mode\":\"incorrect\"%' GROUP BY P1.userName ORDER BY P1.startTime";
- $sqlTot = "SELECT P1.userName,COUNT(*) FROM OPEN_PROBLEM_ATTEMPT AS P1,STEP_TRANSACTION AS P2 WHERE $userName $userProblem P1.userSection='$userSection' AND P1.clientID = P2.clientID GROUP BY(P1.userName) ORDER BY(P1.startTime)";
+ $sql = $db->prepare("SELECT P1.userName,COUNT(*) FROM OPEN_PROBLEM_ATTEMPT AS P1,STEP_TRANSACTION AS P2 WHERE $userName $userProblem P1.userSection='$userSection' AND P1.clientID = P2.clientID AND P2.server LIKE '%\"mode\":\"incorrect\"%' GROUP BY P1.userName ORDER BY P1.startTime");
+ $sqlTot = $db->prepare("SELECT P1.userName,COUNT(*) FROM OPEN_PROBLEM_ATTEMPT AS P1,STEP_TRANSACTION AS P2 WHERE $userName $userProblem P1.userSection='$userSection' AND P1.clientID = P2.clientID GROUP BY(P1.userName) ORDER BY(P1.startTime)");
- $result = mysql_query($sql);
- $cResult = mysql_query($sqlTot);
+ $sql->execute();
+ $sqlTot->execute();
$sum=0;
- if ($myrow = mysql_fetch_array($cResult)) {
+ if ($myrow = $sqlTot->fetch()) {
echo "<table border=1>";
echo "<tr><th>User Name</th><th>Total Number of Entries</th></tr>";
- do{
+ do {
$user=$myrow["userName"];
$count=$myrow["COUNT(*)"];
$sum=$sum+$count;
echo "<tr><td align='center'>$user</td><td align='center'>$count</td></tr>";
- }
- while ( ($myrow = mysql_fetch_array($cResult)) );
+ } while ($myrow = $sqlTot->fetch());
echo "</table>";
echo "<BR>Total is $sum<BR>";
}
- if ($myrow = mysql_fetch_array($result)) {
- echo "<table border=1>";
- echo "<tr><th>User Name</th><th>Number of Red Entries</th></tr>";
- $sum=0;
- do{
- $user=$myrow["userName"];
- $count=$myrow["COUNT(*)"];
- $sum=$sum+$count;
- echo "<tr><td align='center'>$user</td><td align='center'>$count</td></tr>";
- }
- while ( ($myrow = mysql_fetch_array($result)) );
- echo "</table>";
- echo "<BR>Total is $sum<BR>";
- }
- }while($myProbs = mysql_fetch_array($userProbResult));
+ if ($myrow = $sql->fetch()) {
+ echo "<table border=1>";
+ echo "<tr><th>User Name</th><th>Number of Red Entries</th></tr>";
+ $sum=0;
+ do {
+ $user=$myrow["userName"];
+ $count=$myrow["COUNT(*)"];
+ $sum=$sum+$count;
+ echo "<tr><td align='center'>$user</td><td align='center'>$count</td></tr>";
+ } while ($myrow = $sql->fetch());
+ echo "</table>";
+ echo "<BR>Total is $sum<BR>";
+ }
+ } while($myProbs = $userProblemQ->fetch());
}
-mysql_close();
-
?>
-
@@ -1,15 +1,6 @@
<?php
-$dbuser= $_POST['dbuser'];
-$dbserver= "localhost";
-$dbpass= $_POST['passwd'];
-$dbname= "andes3";
-
-function_exists('mysql_connect') or die ("Missing mysql extension");
-mysql_connect($dbserver, $dbuser, $dbpass)
- or die ("UNABLE TO CONNECT TO DATABASE at $dbserver");
-mysql_select_db($dbname)
- or die ("UNABLE TO SELECT DATABASE $dbname");
+require "db-login.php";
$userSection = $_POST['userSection'];
@@ -20,34 +11,32 @@ function_exists('mysql_connect') or die ("Missing mysql extension");
else
$userName="";
-$userProblemQ="SELECT DISTINCT (userProblem) FROM OPEN_PROBLEM_ATTEMPT AS P1 WHERE $userName P1.userSection='$userSection'";
-$userProbResult=mysql_query($userProblemQ);
+$userProblemQ = $db->prepare("SELECT DISTINCT (userProblem) FROM OPEN_PROBLEM_ATTEMPT AS P1 WHERE $userName P1.userSection='$userSection'");
+$userProblemQ->execute();
-if ($myProbs = mysql_fetch_array($userProbResult)){
- do{
+if ($myProbs = $userProblemQ->fetch()) {
+ do {
$curProb=$myProbs["userProblem"];
echo "<BR>Problem Name : '$curProb'<BR>";
$userProblem="P1.userProblem = '$curProb' AND";
-
- $sqlTot = "SELECT P1.userName,COUNT(*) FROM OPEN_PROBLEM_ATTEMPT AS P1,STEP_TRANSACTION AS P2 WHERE $userName $userProblem P1.userSection='$userSection' AND P1.clientID = P2.clientID GROUP BY(P1.userName) ORDER BY(P1.startTime)";
- $cResult = mysql_query($sqlTot);
+ $sqlTot = $db->prepare("SELECT P1.userName,COUNT(*) FROM OPEN_PROBLEM_ATTEMPT AS P1,STEP_TRANSACTION AS P2 WHERE $userName $userProblem P1.userSection='$userSection' AND P1.clientID = P2.clientID GROUP BY(P1.userName) ORDER BY(P1.startTime)");
+
+ $sqlTot->execute();
- if ($myrow = mysql_fetch_array($cResult)) {
+ if ($myrow = $sqlTot->fetch()) {
echo "<table border=1>";
echo "<tr><th>User Name</th><th>Total Number of Steps</th></tr>";
-
- do{
+
+ do {
$user=$myrow["userName"];
$count=$myrow["COUNT(*)"];
echo "<tr><td align='center'>$user</td><td align='center'>$count</td></tr>";
- }
- while ($myrow = mysql_fetch_array($cResult));
+ } while ($myrow = $sqlTot->fetch());
echo "</table>";
}
- }while($myProbs = mysql_fetch_array($userProbResult));
+ } while($myProbs = $userProblemQ->fetch());
}
-mysql_close();
?>
@@ -1,120 +1,93 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Andes Errors</title>
<LINK REL=StyleSheet HREF="log.css" TYPE="text/css">
<script type="text/javascript" src='xml-scripts.js'></script>
<script type="text/javascript">
- function openTrace(url){
- window.open(url);
- }
+ function openTrace(url) {
+ window.open(url);
+ }
</script>
</head>
<body>
<?php
-$dbname= $_POST['dbname'];
-$dbuser= $_POST['dbuser'];
-$dbserver= "localhost";
-$dbpass= $_POST['passwd'];
-if(strcmp($dbuser,'open')==0){
- $problem_attempt='OPEN_PROBLEM_ATTEMPT';
- } else {
- $problem_attempt='PROBLEM_ATTEMPT';
- }
-
-function_exists('mysql_connect') or die ("Missing mysql extension");
-mysql_connect($dbserver, $dbuser, $dbpass)
- or die ("UNABLE TO CONNECT TO DATABASE at $dbserver");
-mysql_select_db($dbname)
- or die ("UNABLE TO SELECT DATABASE $dbname");
+require "db-login.php";
+
+if(strcmp($dbuser,'open')==0) {
+ $problem_attempt='OPEN_PROBLEM_ATTEMPT';
+} else {
+ $problem_attempt='PROBLEM_ATTEMPT';
+}
+
+$adminSection = $_POST['adminSection'];
$adminName=$_POST['adminName'];
$startDate = $_POST['startDate'];
$endDate = $_POST['endDate'];
$errorType=$_POST['errorType'];
$problem=$_POST['problem'];
- if($startDate){
- $startDatec = "P1.startTime >= '$startDate' AND";
- } else {
- $startDatec = "";
- }
- if($endDate){
- $endDatec = "P1.startTime <= '$endDate' AND";
- } else {
- $endDatec = "";
- }
- if($errorType){
- $errorTypec = "P2.server REGEXP '\"error-type\":\"$errorType\"' AND";
- } else {
- $errorTypec = "";
- }
- if($problem){
- $problemc = "P1.userProblem = '$problem' AND";
- } else {
- $problemc = "";
- }
-
+if($startDate) {
+ $startDatec = "P1.startTime >= '$startDate' AND";
+} else {
+ $startDatec = "";
+}
+if($endDate) {
+ $endDatec = "P1.startTime <= '$endDate' AND";
+} else {
+ $endDatec = "";
+}
+if($errorType) {
+ $errorTypec = "P2.server REGEXP '\"error-type\":\"$errorType\"' AND";
+} else {
+ $errorTypec = "";
+}
+if($problem) {
+ $problemc = "P1.userProblem = '$problem' AND";
+} else {
+ $problemc = "";
+}
+
echo "<h2>The Errors and Warnings are as given below:</h2>";
echo "<table border=1>\n";
echo "<tr><th>Starting Time</th><th>Input</th><th>Error Type</th><th>Message</th><th>Tag</th><th>View</th></tr>\n";
-
-// Newer versions of php have json decoder built-in. Should
-// eventually have test for php version and use built-in, when possible.
-include 'JSON.php';
-// However, this is really slow. For now, just increase time limit:
-set_time_limit(300);
-$json = new Services_JSON();
-
-$sqlOld="SELECT startTime,userName,userProblem,userSection,tID,command,P1.clientID from $problem_attempt AS P1,PROBLEM_ATTEMPT_TRANSACTION AS P2 WHERE $startDatec $endDatec $problemc $errorTypec P2.initiatingParty='server' AND P2.command like '%\"error\":%' AND P2.clientID=P1.clientID AND P1.extra=0 order by P2.tID";
-$sql="SELECT startTime,userName,userProblem,userSection,tID,client,server,P1.clientID from $problem_attempt AS P1,STEP_TRANSACTION AS P2 WHERE $startDatec $endDatec $problemc $errorTypec P2.server like '%\"log\":\"server\"%' AND P2.clientID=P1.clientID AND (P1.extra IS NULL OR P1.extra=0) order by P2.tID";
+$sql = $db->prepare("SELECT startTime,userName,userProblem,userSection,tID,client,server,P1.clientID from $problem_attempt AS P1,STEP_TRANSACTION AS P2 WHERE $startDatec $endDatec $problemc $errorTypec P2.server like '%\"log\":\"server\"%' AND P2.clientID=P1.clientID AND (P1.extra IS NULL OR P1.extra=0) order by P2.tID");
// echo "<pre>$sql</pre><br>\n";
-$resultOld=mysql_query($sqlOld);
-$result=mysql_query($sql);
+$sql->execute();
$ecount=0;
-while (($myrow = mysql_fetch_array($resultOld)) ||
- ($myrow = mysql_fetch_array($result))) {
+while ($myrow = $sql->fetch()) {
$ecount++;
$tID=$myrow["tID"];
$clientID=$myrow["clientID"];
$userName=$myrow["userName"];
$userProblem=$myrow["userProblem"];
$userSection=$myrow["userSection"];
$startTime=$myrow["startTime"];
- if(isset($myrow["command"])){
- $usertID=$tID-3;
- $cc=$myrow["command"];
- $userSql="SELECT command,tID from PROBLEM_ATTEMPT_TRANSACTION WHERE clientID='$clientID' AND tID<$tID ORDER BY tID DESC LIMIT 1";
- $userResult=mysql_query($userSql);
- $myResult=mysql_fetch_array($userResult);
- $ttID=$myResult["tID"]; // tID associated with row, for focusing.
- $userCommand=$myResult["command"];
- } else {
- $usertID=$tID-1;
- $ttID=$tID;
- $cc=$myrow["server"];
- $userCommand=$myrow["client"];
- }
- $command=$json->decode($cc);
- $a=$json->decode($userCommand);
+ $usertID=$tID-1;
+ $ttID=$tID;
+ $cc=$myrow["server"];
+ $userCommand=$myrow["client"];
+ $command=json_decode($cc);
+ $a=json_decode($userCommand);
$method=$a->method; // Changed if reply parse fails.
$yy=array();
- if($command && isset($command->result)){
+ if($command && isset($command->result)) {
// Don't know why I can't just use $command->result in the foreach
$zz=$command->result;
foreach($zz as $bb) {
if($bb->action == "log" &&
// New or old style logging
((isset($bb->log) && strcmp($bb->log,"server")==0) ||
- isset($bb->error))){
+ isset($bb->error))) {
$key1="error-type"; // work-around for the dash
$errorType=$bb->$key1;
// New or old style logging
@@ -145,7 +118,7 @@ function_exists('mysql_connect') or die ("Missing mysql extension");
// $lastID=$tID-1;
// $userSql="select command from PROBLEM_ATTEMPT_TRANSACTION where tID=$lastID";
- $aa=$json->encode($a->params);
+ $aa=json_encode($a->params);
// Escape html codes so actual text is seen.
$aa=str_replace("&","&amp;",$aa);
$aa=str_replace(">","&gt;",$aa);
@@ -159,18 +132,17 @@ function_exists('mysql_connect') or die ("Missing mysql extension");
echo "<td rowspan=\"$nr\">$aa</td>";
echo array_shift($yy);
- echo "<td rowspan=\"$nr\"><a href=\"javascript:;\" onclick=\"openTrace('OpenTrace.php?x=$dbuser&amp;sv=$dbserver&amp;pwd=$dbpass&amp;d=$dbname&amp;cid=$clientID&amp;u=$userName&amp;p=$userProblem&amp;s=$userSection&amp;t=$ttID');\">Session&nbsp;log</a><br><a href=\"javascript:;\" onclick=\"copyRecord('\Save.php?x=$dbuser&amp;sv=$dbserver&amp;pwd=$dbpass&amp;d=$dbname&amp;a=$adminName&amp;a=$adminName&amp;&cid=$clientID&u=$userName&amp;p=$userProblem&amp;s=$userSection&amp;t=$usertID');\">Copy&nbsp;Session</a></td></tr>\n";
+ echo "<td rowspan=\"$nr\"><a href=\"javascript:;\" onclick=\"openTrace('OpenTrace.php?x=$dbuser&amp;sv=$dbserver&amp;pwd=$dbpass&amp;d=$dbname&amp;cid=$clientID&amp;u=$userName&amp;p=$userProblem&amp;s=$userSection&amp;t=$ttID');\">Session&nbsp;log</a><br><a href=\"javascript:;\" onclick=\"copyRecord('Save.php?x=$dbuser&amp;sv=$dbserver&amp;pwd=$dbpass&amp;d=$dbname&amp;au=$adminName&amp;as=$adminSection&amp;&cid=$clientID&u=$userName&amp;p=$userProblem&amp;s=$userSection&amp;t=$usertID');\">Copy&nbsp;Session</a></td></tr>\n";
foreach ($yy as $bb) {
echo "<tr class=\"$method\">$bb</tr>\n";
}
- }
+}
echo "</table>\n";
-echo "<p>total of $ecount errors.\n";
+echo "<p>total of $ecount errors.</p>\n";
-mysql_close();
?>
</body>
</html>
@@ -28,10 +28,6 @@
<label>DB Password</label>:&nbsp;
<input name="passwd" type="password" size="6"/><br>
-<script language=JavaScript>
-document.HintForm.passwd.value=getCookie("passWord");
-</script>
-
<br/>
<input type="submit"/>
Oops, something went wrong.

0 comments on commit baf43d2

Please sign in to comment.