<?php include 'settings.php'?>
<!DOCTYPE html>
<head>
  <title>Vista Dictionary Viewer</title>
  <link rel="icon" type="image/png" href="favicon.png">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <style>
    a { colorblack; }
    body { font-size:14px; }
  </style>

<?php
  $fn = $_GET['fn']; $fn = htmlspecialchars($fn);
  $ien = $_GET['ien']; $ien = htmlspecialchars($ien);
  switch ($fn)
    {
    case "list":
      logit("app_dictionarylist");
      echo "</head>\n";
      echo "<body>\n";
      echo "<table>\n";
      getit("localhost:8090/dict/list");
      echo "</table>\n";
      echo "</body>\n";
      echo "</html>\n";
      break;

    case "stan":
      logit("app_dictionarystan");
      echo "</head>\n";
      echo "<body>\n";
      echo "<pre>\n";
      getit("localhost:8090/dict/stan/" . $ien);
      echo "</pre>\n";
      echo "</body>\n";
      echo "</html>\n";
      break;

    case "glob":
      logit("app_dictionaryglob");
      echo "</head>\n";
      echo "<body>\n";
      echo "<pre>\n";
      getit("localhost:8090/dict/glob/" . $ien);
      echo "</pre>\n";
      echo "</body>\n";
      echo "</html>\n";
      break;

    default:
      logit("app_dictionary");
      echo "  <script type=\"text/javascript\">\n";
      echo "    function resizeIframes()\n";
      echo "      {\n";
      echo "      heightPct=.95;\n";
      echo "      widthPct=.95;\n";
      echo "      widthFileList=475;\n";
      echo "      document.getElementById(\"list\").height=window.innerHeight*heightPct;\n";
      echo "      document.getElementById(\"list\").width=widthFileList;\n";
      echo "      document.getElementById(\"main\").height=window.innerHeight*heightPct;\n";
      echo "      document.getElementById(\"main\").width=(window.innerWidth-widthFileList)*widthPct;\n";
      echo "      }\n";
      echo "  </script>\n";
      echo "</head>\n";
      echo "<body onresize=\"resizeIframes()\">\n";
      echo "  <table style=\"width:100%\">\n";
      echo "    <tr>\n";
      echo "      <td><iframe src=\"dictionary.php?fn=list\" name=\"list\" id=\"list\"></iframe></td>\n";
      echo "      <td><iframe name=\"main\" id=\"main\"></iframe></td>\n";
      echo "    </tr>\n";
      echo "  </table>\n";
      echo "</body>\n";
      echo "   <script type=\"text/javascript\">\n";
      echo "    resizeIframes();\n";
      echo "  </script>\n";
      echo "</html>\n";
      break;
    }
?>