diff --git a/getentity.php b/getentity.php index 3060e7b3b9c6d2a908ff86b5689391a9ced89875..c3056f8a0ed691cbec66ab3334061a99dcb19d96 100644 --- a/getentity.php +++ b/getentity.php @@ -8,26 +8,10 @@ $xml = new SimpleXmlElement($feed); $entities = $xml->xpath("//md:EntityDescriptor"); $entityid = $_GET["id"]; -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <script type="text/javascript" src="shCore.js"></script> - <script type="text/javascript" src="shBrushXml.js"></script> - <link type="text/css" rel="stylesheet" href="shCoreDefault.css"/> - <script type="text/javascript">SyntaxHighlighter.all();</script> -</head> -<body style="background: white; font-family: Helvetica; font-size: 10pt"> -<pre class="brush: xml;"> -<?php foreach($entities as $entity) { if ((string) $entity["entityID"] == $entityid) { print $entity->asXML(); } } ?> -</pre> - -</html> diff --git a/modules/entity/index.php b/modules/entity/index.php index 051d68b2ab647955f98c8bbaff3de360aeab2803..77eae2046abef5d0dadbfe38d5e506b11c9e2cbd 100644 --- a/modules/entity/index.php +++ b/modules/entity/index.php @@ -9,6 +9,9 @@ $mod_details = parse_ini_file("module.ini"); <script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script> <script src="module.js"></script> <script type="text/javascript" src="https://www.google.com/jsapi"></script> + <script type="text/javascript" src="../../shCore.js"></script> + <script type="text/javascript" src="../../shBrushXml.js"></script> + <link type="text/css" rel="stylesheet" href="../../shCoreDefault.css"/> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(draw_<?= $mod_details["name"] ?>); @@ -18,21 +21,22 @@ $mod_details = parse_ini_file("module.ini"); a { text-decoration: none; color: #696969; } a:hover { text-decoration: underline; } a:visited { color: #696969; } - #<?= $mod_details["name"] ?>_graph { width: 400px; height: 500px; } - #<?= $mod_details["name"] ?>_details { height: 500px; overflow: auto; } - iframe { height: 400px; width: 100%; overflow: auto; border: 0px; } + #<?= $mod_details["name"] ?>_graph { width: 400px; height: 500px; float: left; } + #<?= $mod_details["name"] ?>_details { height: 500px; width: auto; overflow: auto; } + #entityframe { height: 420px; width: 100%; border: 1px solid red; overflow: hidden; border: 0px; } + .entitylist { display: block; } + .highlight { background-color: lightgrey; } </style> </head> <body> <h1><?= $mod_details["description"] ?></h1> <h3><a href="../../">IDEM Statistics</a> | <a href="#">Module <?= $mod_details["name"] ?></a></h3> <hr/> - <table border="0" cellspacing="0" cellpadding="0"> <tr> - <td height="500"><div id="<?= $mod_details["name"] ?>_graph"></div></td> - <td height="500"><div id="<?= $mod_details["name"] ?>_details"></div></td> + <div id="<?= $mod_details["name"] ?>_graph"></div> + <div id="<?= $mod_details["name"] ?>_details"></div> </tr></table> <hr/> - <iframe id="entityframe"></iframe> + <pre id="entityframe"></pre> </body> </html> diff --git a/modules/entity/module.js b/modules/entity/module.js index 4b3c89b77e60e8cb5998245e41d7a97505b1302e..8422c234ee684af20dd34103ddd7feb736e7ca4b 100644 --- a/modules/entity/module.js +++ b/modules/entity/module.js @@ -16,7 +16,7 @@ function draw_entity() { var options = { title: 'IDEM entities by type', pieHole: 0.4, - legend: { "position": "bottom" } + legend: { "position": "top" } }; entity_chart = new google.visualization.PieChart(document.getElementById('entity_graph')); entity_chart.draw(entity_data, options); @@ -40,15 +40,28 @@ function select_entity() { var html = "<h3>List of all the " + value + " of the IDEM federation:</h3><ul>"; for (var i = 0; i < entities.length; ++i) { - html += "<li><a href=\"#\" onclick=\"show_entity('" + entities[i]["id"] + "');\">" + entities[i]["name"] + "</a></li>"; + html += "<li class='entitylist'><a href=\"#\" onclick=\"return show_entity(this, '" + entities[i]["id"] + "');\">" + entities[i]["name"] + "</a></li>"; } html += "</ul>"; $("#entity_details").append(html); + } else { + document.getElementById('entityframe').innerHTML = ''; } } -function show_entity(entityId) { - var url = "../../getentity.php?id=" + entityId; - $("#entityframe").attr('src', url); +function show_entity(entitylist, entityId) { + $('.entitylist').removeClass('highlight'); + entitylist.className = 'entitylist highlight'; + + $.ajax({ + url: "../../getentity.php?id=" + entityId, + success: function(data) { + var brush = new SyntaxHighlighter.brushes.Xml(); + brush.init({ toolbar: false }); + var html = brush.getHtml(data); + document.getElementById('entityframe').innerHTML = html; + } + }); + return false; } diff --git a/modules/info_page/index.php b/modules/info_page/index.php index 051d68b2ab647955f98c8bbaff3de360aeab2803..77eae2046abef5d0dadbfe38d5e506b11c9e2cbd 100644 --- a/modules/info_page/index.php +++ b/modules/info_page/index.php @@ -9,6 +9,9 @@ $mod_details = parse_ini_file("module.ini"); <script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script> <script src="module.js"></script> <script type="text/javascript" src="https://www.google.com/jsapi"></script> + <script type="text/javascript" src="../../shCore.js"></script> + <script type="text/javascript" src="../../shBrushXml.js"></script> + <link type="text/css" rel="stylesheet" href="../../shCoreDefault.css"/> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(draw_<?= $mod_details["name"] ?>); @@ -18,21 +21,22 @@ $mod_details = parse_ini_file("module.ini"); a { text-decoration: none; color: #696969; } a:hover { text-decoration: underline; } a:visited { color: #696969; } - #<?= $mod_details["name"] ?>_graph { width: 400px; height: 500px; } - #<?= $mod_details["name"] ?>_details { height: 500px; overflow: auto; } - iframe { height: 400px; width: 100%; overflow: auto; border: 0px; } + #<?= $mod_details["name"] ?>_graph { width: 400px; height: 500px; float: left; } + #<?= $mod_details["name"] ?>_details { height: 500px; width: auto; overflow: auto; } + #entityframe { height: 420px; width: 100%; border: 1px solid red; overflow: hidden; border: 0px; } + .entitylist { display: block; } + .highlight { background-color: lightgrey; } </style> </head> <body> <h1><?= $mod_details["description"] ?></h1> <h3><a href="../../">IDEM Statistics</a> | <a href="#">Module <?= $mod_details["name"] ?></a></h3> <hr/> - <table border="0" cellspacing="0" cellpadding="0"> <tr> - <td height="500"><div id="<?= $mod_details["name"] ?>_graph"></div></td> - <td height="500"><div id="<?= $mod_details["name"] ?>_details"></div></td> + <div id="<?= $mod_details["name"] ?>_graph"></div> + <div id="<?= $mod_details["name"] ?>_details"></div> </tr></table> <hr/> - <iframe id="entityframe"></iframe> + <pre id="entityframe"></pre> </body> </html> diff --git a/modules/info_page/module.js b/modules/info_page/module.js index f34f3f7912fcbe3ab7ac71a07f45dcc9bbbbb1ef..ef14e9078bdf37bbc6471d45a09c0feb9d516b90 100644 --- a/modules/info_page/module.js +++ b/modules/info_page/module.js @@ -18,7 +18,7 @@ function draw_info_page() { var options = { title: 'Information Pages stats', pieHole: 0.4, - legend: { "position": "bottom" } + legend: { "maxLines": 2, "position": "top" } }; info_page_chart = new google.visualization.PieChart(document.getElementById('info_page_graph')); info_page_chart.draw(info_page_data, options); @@ -40,17 +40,30 @@ function select_info_page() { var entities = info_page_data.getValue(selectedItem.row || 0, 2); //console.log('The user selected ' + value); - var html = "<h3>List of entities with " + value + ":</h3><ul>"; + var html = "<h3>List of entities with " + value.toLowerCase() + ":</h3><ul>"; for (var i = 0; i < entities.length; ++i) { - html += "<li><a href=\"#\" onclick=\"show_entity('" + entities[i]["id"] + "');\">" + entities[i]["name"] + "</a></li>"; + html += "<li class='entitylist'><a href=\"#\" onclick=\"return show_entity(this, '" + entities[i]["id"] + "');\">" + entities[i]["name"] + "</a></li>"; } html += "</ul>"; $("#info_page_details").append(html); + } else { + document.getElementById('entityframe').innerHTML = ''; } } -function show_entity(entityId) { - var url = "../../getentity.php?id=" + entityId; - $("#entityframe").attr('src', url); +function show_entity(entitylist, entityId) { + $('.entitylist').removeClass('highlight'); + entitylist.className = 'highlight entitylist'; + + $.ajax({ + url: "../../getentity.php?id=" + entityId, + success: function(data) { + var brush = new SyntaxHighlighter.brushes.Xml(); + brush.init({ toolbar: false }); + var html = brush.getHtml(data); + document.getElementById('entityframe').innerHTML = html; + } + }); + return false; } diff --git a/modules/privacy_page/index.php b/modules/privacy_page/index.php index 051d68b2ab647955f98c8bbaff3de360aeab2803..77eae2046abef5d0dadbfe38d5e506b11c9e2cbd 100644 --- a/modules/privacy_page/index.php +++ b/modules/privacy_page/index.php @@ -9,6 +9,9 @@ $mod_details = parse_ini_file("module.ini"); <script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script> <script src="module.js"></script> <script type="text/javascript" src="https://www.google.com/jsapi"></script> + <script type="text/javascript" src="../../shCore.js"></script> + <script type="text/javascript" src="../../shBrushXml.js"></script> + <link type="text/css" rel="stylesheet" href="../../shCoreDefault.css"/> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(draw_<?= $mod_details["name"] ?>); @@ -18,21 +21,22 @@ $mod_details = parse_ini_file("module.ini"); a { text-decoration: none; color: #696969; } a:hover { text-decoration: underline; } a:visited { color: #696969; } - #<?= $mod_details["name"] ?>_graph { width: 400px; height: 500px; } - #<?= $mod_details["name"] ?>_details { height: 500px; overflow: auto; } - iframe { height: 400px; width: 100%; overflow: auto; border: 0px; } + #<?= $mod_details["name"] ?>_graph { width: 400px; height: 500px; float: left; } + #<?= $mod_details["name"] ?>_details { height: 500px; width: auto; overflow: auto; } + #entityframe { height: 420px; width: 100%; border: 1px solid red; overflow: hidden; border: 0px; } + .entitylist { display: block; } + .highlight { background-color: lightgrey; } </style> </head> <body> <h1><?= $mod_details["description"] ?></h1> <h3><a href="../../">IDEM Statistics</a> | <a href="#">Module <?= $mod_details["name"] ?></a></h3> <hr/> - <table border="0" cellspacing="0" cellpadding="0"> <tr> - <td height="500"><div id="<?= $mod_details["name"] ?>_graph"></div></td> - <td height="500"><div id="<?= $mod_details["name"] ?>_details"></div></td> + <div id="<?= $mod_details["name"] ?>_graph"></div> + <div id="<?= $mod_details["name"] ?>_details"></div> </tr></table> <hr/> - <iframe id="entityframe"></iframe> + <pre id="entityframe"></pre> </body> </html> diff --git a/modules/privacy_page/module.js b/modules/privacy_page/module.js index fe03fb945a80f7fa0efdbd581bc3becfcd3bd11f..bd622efe9563fdec5b503d99dabb66cb246b0f4c 100644 --- a/modules/privacy_page/module.js +++ b/modules/privacy_page/module.js @@ -18,7 +18,7 @@ function draw_privacy_page() { var options = { title: 'Information Pages stats', pieHole: 0.4, - legend: { "position": "bottom" } + legend: { "maxLines": 2, "position": "top" } }; privacy_page_chart = new google.visualization.PieChart(document.getElementById('privacy_page_graph')); privacy_page_chart.draw(privacy_page_data, options); @@ -40,17 +40,30 @@ function select_privacy_page() { var entities = privacy_page_data.getValue(selectedItem.row || 0, 2); //console.log('The user selected ' + value); - var html = "<h3>List of entities with " + value + ":</h3><ul>"; + var html = "<h3>List of entities with " + value.toLowerCase() + ":</h3><ul>"; for (var i = 0; i < entities.length; ++i) { - html += "<li><a href=\"#\" onclick=\"show_entity('" + entities[i]["id"] + "');\">" + entities[i]["name"] + "</a></li>"; + html += "<li class='entitylist'><a href=\"#\" onclick=\"return show_entity(this, '" + entities[i]["id"] + "');\">" + entities[i]["name"] + "</a></li>"; } html += "</ul>"; $("#privacy_page_details").append(html); + } else { + document.getElementById('entityframe').innerHTML = ''; } } -function show_entity(entityId) { - var url = "../../getentity.php?id=" + entityId; - $("#entityframe").attr('src', url); +function show_entity(entitylist, entityId) { + $('.entitylist').removeClass('highlight'); + entitylist.className = 'highlight entitylist'; + + $.ajax({ + url: "../../getentity.php?id=" + entityId, + success: function(data) { + var brush = new SyntaxHighlighter.brushes.Xml(); + brush.init({ toolbar: false }); + var html = brush.getHtml(data); + document.getElementById('entityframe').innerHTML = html; + } + }); + return false; } diff --git a/shCoreDefault.css b/shCoreDefault.css index 08f9e10e4ea57944826f5c22baedbd1dc1627771..76ced8945073eb2df0f31b51fcfa41ed57d2a014 100644 --- a/shCoreDefault.css +++ b/shCoreDefault.css @@ -54,6 +54,7 @@ .syntaxhighlighter { width: 100% !important; + height: 400px; margin: 1em 0 1em 0 !important; position: relative !important; overflow: auto !important;