diff --git a/web/eccs2.js b/web/eccs2.js index 5e38bd3473491b4bcb06606df551aaecd551588f..5df89dd914472655ed27c3d2bf160e62f35aa828 100644 --- a/web/eccs2.js +++ b/web/eccs2.js @@ -1,7 +1,35 @@ -// Global URL -//var url = "/eccs2/api/eccsresults?eccsdt=1"; -var url = "/eccs2/api/eccsresults?eccsdt=1&date=" + document.getElementById("myDate").value; +// Needed to draw the ECCS2 DataTable var table; +var url = "/eccs2/api/eccsresults?eccsdt=1"; + +// PHP Variables retrieved from eccs2.php +// idp (entityID of the IdP) +// date (date time of the check) +// reg_auth (the IdP RegistrationAuthority) +// status (the ECCS2 IdP Status) +if (date) { + url = url.concat("&date=" + date); +} +if (reg_auth) { + url = url.concat("®_auth=" + reg_auth); +} +if (idp) { + url = url.concat("&idp=" + idp); +} +if (status) { + url = url.concat("&status=" + status); +} + + +function getPastResults() { + url = "/eccs2/api/eccsresults?eccsdt=1&date=" + document.getElementById("myDate").value; + table.ajax.url( url ).load(); + + var getUrl = window.location; + var baseUrl = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1]; + + document.location.href = baseUrl; +} // use URL constructor and return hostname function getHostname(url) { @@ -59,11 +87,6 @@ function format ( d ) { '</table>'; } -function getPastResults() { - url = "/eccs2/api/eccsresults?eccsdt=1&date=" + document.getElementById("myDate").value; - table.ajax.url( url ).load(); -} - $(document).ready(function() { // Setup - add a text input to each footer cell $('#eccstable thead tr').clone(true).appendTo( '#eccstable thead' ); @@ -87,7 +110,7 @@ $(document).ready(function() { "url": url, "dataSrc": "" }, - "lengthMenu": [[10, 20, 30, 40, 50, 100, -1], [10, 20, 30, 40, 50, 100, "All"]], + "lengthMenu": [[10, 30, 50, 100, -1], [10, 30, 50, 100, "All"]], "autoWidth": false, "dom": '<"top"lip>rt<"bottom"><"clear">', "columns": [ diff --git a/web/index.php b/web/index.php index 25afe88264208b3eebde89e16bf997de4f7a4387..fa3467750bb59ddbe82fb165339bee4aa03fa04a 100644 --- a/web/index.php +++ b/web/index.php @@ -8,8 +8,15 @@ $firstDate = str_replace($str2strip, "", $firstFile); $files = scandir($directory, SCANDIR_SORT_DESCENDING); $lastFile = $files[0]; - $lastDate = str_replace($str2strip, "", $lastFile); + +$data = array(); +$data['firstDate'] = $firstDate; +$data['lastDate'] = $lastDate; +$data['idp'] = htmlspecialchars($_GET["idp"]); +$data['reg_auth'] = htmlspecialchars($_GET["reg_auth"]); +$data['date'] = htmlspecialchars($_GET["date"]); +$data['status'] = htmlspecialchars($_GET["status"]); ?> <!DOCTYPE html> @@ -29,8 +36,8 @@ $lastDate = str_replace($str2strip, "", $lastFile); <input type="checkbox" name="status" value="ERROR">ERROR</input> <input type="checkbox" name="status" value="OK">OK</input> <input type="checkbox" name="status" value="DISABLED">DISABLED</input> - <button style="float:right;" onclick="getPastResults()">Go</button> - <input style="float:right;" type="date" id="myDate" min="<?php echo $firstDate ?>" max="<?php echo $lastDate ?>" value="<?php echo $lastDate ?>"/> + <button id="goButton" onclick="getPastResults()">Go</button> + <input id="myDate" type="date" id="myDate" min="<?php echo $data['firstDate'] ?>" max="<?php echo $data['lastDate'] ?>" value="<?php echo $data['lastDate'] ?>"/> </div> <hr> <button id="btn-show-all-children" type="button">Expand All</button> @@ -50,6 +57,12 @@ $lastDate = str_replace($str2strip, "", $lastFile); </thead> </table> </div> + <script type="text/javascript"> + var date = "<?php echo $data['date'] ?>"; + var reg_auth = "<?php echo $data['reg_auth'] ?>"; + var idp = "<?php echo $data['idp'] ?>"; + var status = "<?php echo $data['status'] ?>"; + </script> <script type="text/javascript" src="script.js" /></script> </body> </html>