Esempio n. 1
0
function toHTML($e)
{
    $code = $e["code"];
    $c = "";
    $h = "";
    if (is_string($code)) {
        $c = $code;
    } else {
        foreach (array("Dolittle", "JavaScript", "C") as $lang) {
            if (isset($code[$lang])) {
                $c .= $code[$lang];
            }
        }
        if (isset($code["HTML"])) {
            $h = $code["HTML"];
        }
    }
    $time = preg_replace("/\\//", "-", $e["date"]) . "T" . $e["time"];
    $n = LogUtil::getFileName($e);
    if (isset($e["score"])) {
        $s = $e["score"];
        $diy = $s["d"] ? "D" : "";
        $diy .= $s["i"] ? "I" : "";
        $diy .= $s["y"] ? "Y" : "";
        $com = $s["com"];
        $score = "<font color=blue>{$diy} {$com}</font><BR>";
    } else {
        $score = "";
    }
    return "<pre>" . mkTimeLink($time) . "<BR>" . "<font color=red>" . $e["detail"] . "</font><BR>" . "<font color=green>" . $e["filename"] . "</font><BR>" . $score . preg_replace("/ /", "&nbsp;", htmlspecialchars($c)) . "<br>HTML:<BR>" . preg_replace("/ /", "&nbsp;", htmlspecialchars($h)) . "<BR>" . "\n</pre><BR>";
}
Esempio n. 2
0
function readJSONLog($file)
{
    global $fs, $min, $max;
    $tlines = explode("\n", $fs->getContent($file));
    $j = new Services_JSON();
    echo "<script>queue.push(function () {\n";
    echo "setUser('{$file}');\n";
    $es = array();
    foreach ($tlines as $tline) {
        $e = $j->decode($tline);
        if ($e) {
            $e["status"] = "NonError";
            if (isset($e["result"]) && strpos($e["result"], "Error")) {
                $e["isError"] = true;
                $e["status"] = "Error";
            } else {
                $e["isError"] = false;
            }
            if (isset($e["score"])) {
                if (isset($e["score"]["d"]) && $e["score"]["d"]) {
                    $e["status"] = "OK";
                } else {
                    $e["status"] = "NG";
                }
            }
            $e["tltime"] = preg_replace("/\\//", "-", $e["date"]) . "T" . $e["time"];
            $es[] = $e;
        }
    }
    //echo ("setColor('green');\n");
    foreach ($es as $e) {
        //if (!$e["isError"]) {
        $tltime = $e["tltime"];
        $fname = LogUtil::getFileName($e);
        $status = $e["status"];
        echo "showLine('{$tltime}','{$fname}','{$status}');\n";
        //}
    }
    /*foreach($es as $e) {
          if ($e["isError"]) {
              $tltime=$e["tltime"];
              $fname=LogUtil::getFileName($e);
              //echo ("setColor('red');\n");
              echo("showLine('$tltime','$fname');\n");
          } else if (isset($e["score"])) {
              if (isset($e["score"]["d"]) && $e["score"]["d"]) {
                  echo ("setColor('blue');\n");
              } else {
                  echo ("setColor('yellow');\n");
              }
              echo("showLine('$tltime','$fname');\n");
          }
      } */
    echo "});</script>\n";
}