diff --git a/composer.json b/composer.json index 391d7de4984c1c6598578cc7a218ae10a41faef8..6693de3bd22716f6a29f37d752e1930fec3ebf6e 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "require": { - "twig/twig": "^3.0", - "spomky-labs/otphp": "^10.0", + "twig/twig": "^3.14", + "spomky-labs/otphp": "^11.3", "chillerlan/php-qrcode": "^4.3" } } diff --git a/database/2.6.3-2.6.4.sql b/database/2.6.3-2.6.4.sql new file mode 100644 index 0000000000000000000000000000000000000000..f5dbc8feb18b8ca3c606f6a1a5932bdbc5d4661e --- /dev/null +++ b/database/2.6.3-2.6.4.sql @@ -0,0 +1,5 @@ +# Run this when updating from version 2.6.2 to 2.6.3 + +ALTER TABLE `eccs_stat` ADD `update_date` DATE DEFAULT NULL; +ALTER TABLE `entity_details` ADD `eccs_status_date` DATE DEFAULT NULL; + diff --git a/database/edugain_schema.sql b/database/edugain_schema.sql index 311a7c747cf0dde4b1213d62e2df06592126d15c..e2f491f141e184a0ec03dab81f2ddf82e8448b70 100644 --- a/database/edugain_schema.sql +++ b/database/edugain_schema.sql @@ -80,6 +80,7 @@ DROP TABLE IF EXISTS `eccs_stat`; CREATE TABLE `eccs_stat` ( `entityid` char(255) COLLATE utf8_unicode_ci DEFAULT NULL, `status` int(1) DEFAULT NULL, + `update_date` DATE DEFAULT NULL,, UNIQUE KEY `entityid` (`entityid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -235,6 +236,7 @@ CREATE TABLE `entity_details` ( `roles` tinyint(4) DEFAULT NULL, `saml2_support` tinyint(4) DEFAULT '0', `eccs_status` int(1) DEFAULT '0', + `eccs_status_date` DATE DEFAULT NULL, `validator_status` bigint(20) DEFAULT NULL, `clash` int(1) DEFAULT '0', `coco_status` int(1) DEFAULT NULL, diff --git a/database/update_role_details.sql b/database/update_role_details.sql index d00f3936f93626ba11eb59964ca4a1ca86e35b5c..6b3a41d126284707313faaa8a981504aae981880 100644 --- a/database/update_role_details.sql +++ b/database/update_role_details.sql @@ -2,52 +2,49 @@ delimiter // CREATE PROCEDURE `update_role_details`() begin DELETE FROM entity_details; -INSERT INTO entity_details (entity_id, displayname) select entity_id,group_concat(concat(lang,';',displayname) ORDER BY lang separator '==') FROM entity_organization GROUP BY entity_id; +INSERT INTO entity_details (entity_id, displayname) SELECT entity_id,group_concat(concat(lang,';',displayname) ORDER BY lang separator '==') FROM entity_organization GROUP BY entity_id; -INSERT INTO entity_details (entity_id, entity_cat) select entity_id,group_concat(entityattributes_dict_id separator ';') FROM entity_attributes GROUP BY entity_id ON duplicate key UPDATE entity_cat=values(entity_cat); +INSERT INTO entity_details (entity_id, entity_cat) SELECT entity_id,group_concat(entityattributes_dict_id separator ';') FROM entity_attributes GROUP BY entity_id ON duplicate key UPDATE entity_cat=VALUES(entity_cat); -INSERT INTO entity_details (entity_id,saml2_support) select entity_id, max(saml2) AS saml2_e FROM (select entity_roles.entity_id AS entity_id, max(entity_protocolsupport.value regexp ':2\\\\.0:') AS saml2 FROM entity_protocolsupport JOIN entity_roles ON entity_protocolsupport.entityrole_id = entity_roles.id GROUP BY entity_protocolsupport.entityrole_id) AS r GROUP BY entity_id ON duplicate key UPDATE saml2_support=values(saml2_support); +INSERT INTO entity_details (entity_id,saml2_support) SELECT entity_id, max(saml2) AS saml2_e FROM (SELECT entity_roles.entity_id AS entity_id, max(entity_protocolsupport.value regexp ':2\\\\.0:') AS saml2 FROM entity_protocolsupport JOIN entity_roles ON entity_protocolsupport.entityrole_id = entity_roles.id GROUP BY entity_protocolsupport.entityrole_id) AS r GROUP BY entity_id ON duplicate key UPDATE saml2_support=VALUES(saml2_support); -INSERT INTO entity_details (entity_id, clash) select entity_id,count(code) FROM entity_duplication GROUP BY entity_id ON duplicate key UPDATE clash=values(clash); +INSERT INTO entity_details (entity_id, clash) SELECT entity_id,count(code) FROM entity_duplication GROUP BY entity_id ON duplicate key UPDATE clash=VALUES(clash); -UPDATE entity_details JOIN entities ON entity_details.entity_id=entities.id JOIN eccs_stat ON entities.entityid = eccs_stat.entityid set entity_details.eccs_status=eccs_stat.status; +UPDATE entity_details JOIN entities ON entity_details.entity_id=entities.id JOIN eccs_stat ON entities.entityid = eccs_stat.entityid set entity_details.eccs_status=eccs_stat.status, entity_details.eccs_status_date=eccs_stat.update_date; UPDATE entity_details JOIN entities ON entity_details.entity_id=entities.id JOIN coco_stat ON entities.entityid = coco_stat.entityid set entity_details.coco_status=coco_stat.status, entity_details.coco_id=coco_stat.coco_id; -create temporary table entity_warn_tmp as (select entities.id as entity_id, BIT_OR(ifnull(1<<entity_role_warnings.warning_id,0))|BIT_OR(ifnull(1<<entity_warnings.warning_id,0)) as warn FROM entities LEFT JOIN entity_warnings ON entities.id=entity_warnings.entity_id LEFT JOIN entity_roles ON entity_roles.entity_id = entities.id LEFT JOIN entity_role_warnings ON entity_role_warnings.entityrole_id=entity_roles.id GROUP BY entities.id); +CREATE TEMPORARY TABLE entity_warn_tmp as (SELECT entities.id as entity_id, BIT_OR(ifnull(1<<entity_role_warnings.warning_id,0))|BIT_OR(ifnull(1<<entity_warnings.warning_id,0)) as warn FROM entities LEFT JOIN entity_warnings ON entities.id=entity_warnings.entity_id LEFT JOIN entity_roles ON entity_roles.entity_id = entities.id LEFT JOIN entity_role_warnings ON entity_role_warnings.entityrole_id=entity_roles.id GROUP BY entities.id); UPDATE entity_details JOIN entity_warn_tmp ON entity_details.entity_id=entity_warn_tmp.entity_id set entity_details.validator_status=entity_warn_tmp.warn; -CREATE temporary table sirtfi_tmp AS (SELECT entity_id from entity_attributes where entityattributes_dict_id = 76); -CREATE temporary table sirtfi2_tmp AS (SELECT entity_id from entity_attributes where entityattributes_dict_id = 198); - +CREATE TEMPORARY TABLE sirtfi_tmp AS (SELECT entity_id from entity_attributes where entityattributes_dict_id = 76); +CREATE TEMPORARY TABLE sirtfi2_tmp AS (SELECT entity_id from entity_attributes where entityattributes_dict_id = 198); UPDATE entity_details JOIN sirtfi_tmp ON entity_details.entity_id=sirtfi_tmp.entity_id SET entity_details.sirtfi = 1; UPDATE entity_details JOIN sirtfi2_tmp ON entity_details.entity_id=sirtfi2_tmp.entity_id SET entity_details.sirtfi2 = 1; - UPDATE entity_details JOIN entity_warnings ON entity_details.entity_id = entity_warnings.entity_id SET entity_details.sirtfi=2 WHERE entity_warnings.warning_id >= 50 AND entity_warnings.warning_id <= 51; -drop table entity_warn_tmp; -drop table sirtfi_tmp; -drop table sirtfi2_tmp; +DROP TABLE entity_warn_tmp; +DROP TABLE sirtfi_tmp; +DROP TABLE sirtfi2_tmp; DELETE FROM federation_warnings; INSERT INTO federation_warnings (code,warnings) SELECT mds_data.code, bit_or(entity_details.validator_status) FROM mds_data JOIN entities ON mds_data.reg_auth = entities.regauth JOIN entity_details ON entity_details.entity_id = entities.id GROUP BY mds_data.reg_auth; DELETE FROM role_details; -INSERT INTO role_details (entityrole_id, entity_id, roledesc) select id,entity_id,roledesc FROM entity_roles; - -INSERT INTO role_details (entityrole_id, role_display_name) select entity_roles.id, group_concat(concat(entity_info.lang,';',entity_info.value) ORDER BY lang separator '==') FROM entity_roles JOIN entity_info ON entity_roles.id=entityrole_id WHERE entity_info.type='DisplayName' GROUP BY entity_roles.id ON duplicate key UPDATE role_display_name=values(role_display_name); +INSERT INTO role_details (entityrole_id, entity_id, roledesc) SELECT id,entity_id,roledesc FROM entity_roles; -INSERT INTO role_details (entityrole_id, role_service_name) select entity_roles.id, group_concat(concat(entity_info.lang,';',entity_info.value) ORDER BY lang separator '==') FROM entity_roles JOIN entity_info ON entity_roles.id=entityrole_id WHERE entity_info.type='ServiceName' GROUP BY entity_roles.entity_id ON duplicate key UPDATE role_service_name=values(role_service_name); +INSERT INTO role_details (entityrole_id, role_display_name) SELECT entity_roles.id, group_concat(concat(entity_info.lang,';',entity_info.value) ORDER BY lang separator '==') FROM entity_roles JOIN entity_info ON entity_roles.id=entityrole_id WHERE entity_info.type='DisplayName' GROUP BY entity_roles.id ON duplicate key UPDATE role_display_name=VALUES(role_display_name); -INSERT INTO role_details (entityrole_id, scopes) SELECT entityrole_id, group_concat(scope separator '==') FROM entity_scopes GROUP BY entityrole_id ON duplicate key UPDATE scopes=values(scopes); +INSERT INTO role_details (entityrole_id, role_service_name) SELECT entity_roles.id, group_concat(concat(entity_info.lang,';',entity_info.value) ORDER BY lang separator '==') FROM entity_roles JOIN entity_info ON entity_roles.id=entityrole_id WHERE entity_info.type='ServiceName' GROUP BY entity_roles.entity_id ON duplicate key UPDATE role_service_name=VALUES(role_service_name); -INSERT INTO entity_details (entity_id,roles) select entity_id,sum(role_code) AS entity_roles FROM role_details JOIN role_names ON role_details.roledesc = role_names.roledesc GROUP BY entity_id ON duplicate key UPDATE roles=values(roles); +INSERT INTO role_details (entityrole_id, scopes) SELECT entityrole_id, group_concat(scope separator '==') FROM entity_scopes GROUP BY entityrole_id ON duplicate key UPDATE scopes=VALUES(scopes); -DELETE FROM entity_fulltext_index WHERE entity_id NOT IN (select id FROM entities); -DELETE FROM entity_fulltext_index WHERE entity_id in (select id FROM entities WHERE modified = 1); -INSERT INTO entity_fulltext_index (entity_id,txt) select id,ExtractValue(entity_txt,'//*[not(self::ds:X509Certificate) and not(self::mdui:Logo)]') FROM entities WHERE modified=1; +INSERT INTO entity_details (entity_id,roles) SELECT entity_id,sum(role_code) AS entity_roles FROM role_details JOIN role_names ON role_details.roledesc = role_names.roledesc GROUP BY entity_id ON duplicate key UPDATE roles=VALUES(roles); +DELETE FROM entity_fulltext_index WHERE entity_id NOT IN (SELECT id FROM entities); +DELETE FROM entity_fulltext_index WHERE entity_id in (SELECT id FROM entities WHERE modified = 1); +INSERT INTO entity_fulltext_index (entity_id,txt) SELECT id,ExtractValue(entity_txt,'//*[not(self::ds:X509Certificate) and not(self::mdui:Logo)]') FROM entities WHERE modified=1; UPDATE entity_history SET tmp_status=1; INSERT INTO entity_history (entityid,last_seen,status,tmp_status) SELECT entityid,CURRENT_TIMESTAMP,0,0 FROM entities ON DUPLICATE KEY UPDATE last_seen=CURRENT_TIMESTAMP, status=0, tmp_status=0; UPDATE entity_history SET status=1 WHERE tmp_status = 1 AND status = 0; diff --git a/lib/eduGAIN_entity.php b/lib/eduGAIN_entity.php index 1395e28180d33613ea372d09d3df03088b5e9615..ba09626cbc9c4057fcb92898bfebaf3d0724d8eb 100644 --- a/lib/eduGAIN_entity.php +++ b/lib/eduGAIN_entity.php @@ -305,7 +305,9 @@ class eduGAIN_entity extends eduGAIN { $obj['org'] = $org; $obj['contacts'] = $this->getEntityContacts($entity_row_id); $obj['coco_status'] = $this->getEntityCoCo($entity_row_id); - $obj['eccs_status'] = $this->getEntityECCS($entity_row_id); + $eccs = $this->getEntityECCS($entity_row_id); + $obj['eccs_status'] = $eccs['eccs_status']; + $obj['eccs_status_date'] = $eccs['eccs_status_date']; $obj['sirtfi_status'] = $this->getEntitySIRTFI($entity_row_id); $obj['validator_warnings'] = $this->getEntityWarnings($entity_row_id); return($obj); @@ -692,11 +694,10 @@ class eduGAIN_entity extends eduGAIN { private function getEntityECCS($entity_row_id) { if (!is_numeric($entity_row_id)) exit; - $q = "SELECT eccs_status FROM entity_details WHERE entity_id = $entity_row_id"; + $q = "SELECT eccs_status, eccs_status_date FROM entity_details WHERE entity_id = $entity_row_id"; $result = $this->databaseQuery($q); $obj = $result->fetch_assoc(); - $out = $obj['eccs_status']; - return($out); + return($obj); } private function getEntityWarnings($entity_row_id) { @@ -814,6 +815,7 @@ class eduGAIN_entity extends eduGAIN { case 'IDPSSODescriptor': $entity['role'][$roledesc]['type'] = 'IdP'; $entity['eccs_status'] = $R['eccs_status']; + $entity['eccs_status_date'] = $R['eccs_status_date']; break; case 'AttributeAuthorityDescriptor': $entity['role'][$roledesc]['type'] = 'AA'; @@ -945,7 +947,7 @@ class eduGAIN_entity extends eduGAIN { if ($V['type'] == 'IdP' && $entity['eccs_status'] != 0) { $td_s = "background:".Constants::ECCS_Colours[$entity['eccs_status']][1]."; text-align:center"; $a_s = "color:".Constants::ECCS_Colours[$entity['eccs_status']][0]; - $eccs = "<div class='status_box' style='$td_s'><a style='$a_s' href='javascript:show_eccs(\"" . urlencode($entity['entityid']) . "\")'>ECCS</a></div>"; + $eccs = "<div title='Status <b>".Constants::ECCS_Colours[$entity['eccs_status']][2]."</b> from test on ".$entity['eccs_status_date'].".<br> Click the link for more details.' class='eccs_status_box' style='$td_s'><a style='$a_s' href='javascript:show_eccs(\"" . urlencode($entity['entityid']) . "\", \"" . $entity['eccs_status_date'] . "\")'>ECCS</a></div>"; } else { $eccs = ''; } @@ -958,7 +960,7 @@ class eduGAIN_entity extends eduGAIN { $td_s = "background:red; text-align:center"; $a_s = "color:white"; } - $clash = "<div class='status_box' style='$td_s'><a class='clash' style='$a_s' href='javascript:show_clash(" . $entity['id'] . ")'>CLASH</a></div>"; + $clash = "<div class='clash_status_box' title='". $entity['id'] ."' style='$td_s'>CLASH</div>"; } else { $clash = ''; } @@ -1123,10 +1125,10 @@ class eduGAIN_entity extends eduGAIN { } switch ($sirtfi) { case 1 : - $search_filter .= " AND entity_details.sirtfi > 0"; + $search_filter .= " AND entity_details.sirtfi > 0"; // SIRTFI asserted break; case 2 : - $search_filter .= " AND entity_details.sirtfi = 2"; + $search_filter .= " AND entity_details.sirtfi = 2"; // SIRTFI errors break; default : break; @@ -1164,7 +1166,7 @@ class eduGAIN_entity extends eduGAIN { $search_filter .= " AND entity_history.status = 0 AND entity_history.first_seen <= '$endDate' AND entity_history.first_seen >= '$startDate'"; } - $q = "SELECT entities.id AS id,entities.entityid AS entityid,roles,regauth,entity_details.displayname AS e_displayname,entity_cat,roledesc,role_details.role_display_name as r_displayname, role_details.role_description AS r_description, role_details.role_service_name, entity_details.eccs_status AS eccs_status, entity_details.clash AS clash, entity_details.validator_status AS validator_status, entity_details.coco_status AS coco_status, entity_details.coco_id AS coco_id, entity_details.sirtfi AS sirtfi_status, mds_data.code AS code, role_details.scopes AS scopes, entity_history.first_seen AS first_seen FROM entities JOIN mds_data ON entities.regauth=mds_data.reg_auth LEFT JOIN entity_details ON entities.id=entity_details.entity_id LEFT JOIN role_details ON entities.id=role_details.entity_id $cat_join $search_filter ORDER BY entities.entityid,roledesc"; + $q = "SELECT entities.id AS id,entities.entityid AS entityid,roles,regauth,entity_details.displayname AS e_displayname,entity_cat,roledesc,role_details.role_display_name as r_displayname, role_details.role_description AS r_description, role_details.role_service_name, entity_details.eccs_status AS eccs_status, entity_details.eccs_status_date AS eccs_status_date, entity_details.clash AS clash, entity_details.validator_status AS validator_status, entity_details.coco_status AS coco_status, entity_details.coco_id AS coco_id, entity_details.sirtfi AS sirtfi_status, mds_data.code AS code, role_details.scopes AS scopes, entity_history.first_seen AS first_seen FROM entities JOIN mds_data ON entities.regauth=mds_data.reg_auth LEFT JOIN entity_details ON entities.id=entity_details.entity_id LEFT JOIN role_details ON entities.id=role_details.entity_id $cat_join $search_filter ORDER BY entities.entityid,roledesc"; Utils::debug(4, "database query: $q\n"); Utils::debug(4, "join: $cat_join\n"); Utils::debug(4, "filter:$search_filter\n"); diff --git a/lib/eduGAIN_entityDetails.php b/lib/eduGAIN_entityDetails.php index fe6fca7edd40cae5daaf822752574633f28f2f9c..b5381efa1d119347f520cb2802385ff8a434839c 100644 --- a/lib/eduGAIN_entityDetails.php +++ b/lib/eduGAIN_entityDetails.php @@ -289,7 +289,7 @@ class eduGAIN_entityDetails extends eduGAIN_entity { public function printEntity($row_id, $e_id='NOTSET') { $out = ''; $this->entity = $this->showEntityDetails($row_id, $e_id); - $out .= "<script>var entityid='" . urlencode($this->entity['entityid']) . "'; var eccs_status=" . $this->entity['eccs_status'] . ";</script>"; + $out .= "<script>var entityid='" . urlencode($this->entity['entityid']) . "'; var eccs_status=" . $this->entity['eccs_status'] . "; var eccs_date='" . $this->entity['eccs_status_date'] . "';</script>"; $out .= "<table class='entity_details'>\n"; $out .= "<tr><td class='details_header' colspan=2>Entity information</td></tr>\n"; $out .= "<tr><th>Entity ID:</th><td>" . $this->entity['entityid'] . "</td></tr>"; diff --git a/scripts/ECCSinterface.php b/scripts/ECCSinterface.php new file mode 100644 index 0000000000000000000000000000000000000000..f06e4b69c6f23825b2fc86a270b6323dece63d7d --- /dev/null +++ b/scripts/ECCSinterface.php @@ -0,0 +1,59 @@ +<?php +/* + * ECCS update should probably be done by the ECCS process itself, + * therefore this is most likely a temporary solution + */ +require "../lib/config.php"; +require(eduGAIN_config."eccs_update.php"); + +class ECCSinterface { + public function __construct() { + $mysqli = new mysqli(DB_HOST, USER, PASSWORD, DB_DATABASE); + if ($mysqli->connect_error) { + die("Not connected"); + } + $mysqli->set_charset('utf8'); + $this->mysqli = $mysqli; + } + + public function databaseQuery($q) { + $result = $this->mysqli->query($q); + if (!$result) { + error_log("database query problem: $q"); + die("database query problem"); + } + return($result); + } + + public function load_eccs() { + $j = file_get_contents(ECCS_URL.'/api/eccsresults?format=simple'); + $e = json_decode($j); + $Colors = [ + 'OK' => 1, + 'DISABLED' => 2, + 'ERROR' => 3, + 'UNKNOWN' => 4, + ]; + foreach ($e as $r) { + $this->ECCS[$r->entityID] = $Colors[$r->status]; + } + } + + public $ECCS; +} + +$e = new ECCSinterface(); +$e->load_eccs(); +$date = gmdate("Y-m-d", time()); + +foreach ($e->ECCS as $e_id => $s) { + + $q = "INSERT INTO eccs_stat (entityid,status,update_date) VALUES ('$e_id',$s, '$date') ON DUPLICATE KEY UPDATE status=$s, update_date='$date'"; + $e->databaseQuery($q); + $e->databaseQuery("LOCK TABLE entity_details WRITE, entity_warn_tmp WRITE"); + $e->databaseQuery("LOCK TABLE entity_details WRITE"); + $q = "UPDATE entity_details JOIN entity_warn_tmp ON entity_details.entity_id=entity_warn_tmp.entity_id set entity_details.validator_status=entity_warn_tmp.warn"; + $e->databaseQuery($q); + $e->databaseQuery("UNLOCK TABLES"); +} +?> diff --git a/scripts/update_eccs.sh b/scripts/update_eccs.sh new file mode 100755 index 0000000000000000000000000000000000000000..35fdd38dea6bf3fbb6ea20c49c2dbb3687cdf62e --- /dev/null +++ b/scripts/update_eccs.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# this is a temporary solution for ECCS status updates +# the paths might needed to be changed +# +# The script should be started soon after the ECCS run starts +# it will then test /opt/eccs-deployment/debug/eccs_status for +# existence of the 'end ECCS' line as a signal that the ECCS +# run is done. +# Changes introduced by ECCS will only be seen after the next aggregation run + +if [ ! -f /opt/eccs-deployment/debug/eccs_status ] ; then + exit +fi + +date >> /var/log/eccs_error.log +echo Starting >> /var/log/eccs_error.log +while ! grep -q 'end ECCS' /opt/eccs-deployment/debug/eccs_status ; do + sleep 10 +done +spath="$(readlink -n -f "$0")" +cd "$(dirname "$spath")" +/usr/bin/php ECCSinterface.php 2>&1 >>/var/log/eccs_error.log +date >> /var/log/eccs_error.log +echo Done >> /var/log/eccs_error.log \ No newline at end of file diff --git a/templates/js/entities.js b/templates/js/entities.js index 992512027360f621f8a578a8b12491b144fa7d40..276eb9acee30dfbc1d2d0054b5d00332b0d71ad5 100644 --- a/templates/js/entities.js +++ b/templates/js/entities.js @@ -1,5 +1,4 @@ <script tyle="text/javascript"> - var xx; var yy; var link; @@ -57,14 +56,14 @@ $(function(){ win.focus(); }) - function show_eccs(e_id) { - var win = window.open(eccs_url+"?idp="+e_id,'_blank'); + function show_eccs(e_id, date) { + var win = window.open(eccs_url+"?idp="+e_id+"&date="+date,'_blank'); win.focus(); } $("#show_eccs").click(function(event) { event.preventDefault(); - show_eccs(entityid); + show_eccs(entityid, eccs_date); }); function show_coco(c_id) { @@ -79,15 +78,6 @@ $(function(){ show_coco(coco_id); }); - function show_clash(id) { - $.get("api.php",{action: 'show_entity_clashes', row_id: id}, function(data) { - var h = "<p>supplying federation: <strong>"+data.fed+"</strong><p>other federations: <strong>"+data.other_fed.join('</strong>, <strong>')+"<p>click the tooltip to close.</strong>"; - $("#clash_info").html(h); - $("#clash_info").css({'left':xx,'top':yy}); - $("#clash_info").show(); - }, 'json'); - } - $("#clash_info").on("click",function(event) { $(this).hide(); }); @@ -167,13 +157,26 @@ $("#clash_info").on("click",function(event) { $("#stat_sp").html(data.stats.sp); $("#stat_aa").html(data.stats.aa); $("#entities").html(data.html); -// $("body").css("cursor", "default"); - $("body").removeClass("busy"); + $("body").removeClass("busy"); $("#loading").hide(); - $("#list_entities").removeClass("busy"); - },'json'); - }); + $("#list_entities").removeClass("busy"); + $("div.eccs_status_box").tooltip({ + content: function() { + return '<div><strong>ECCS information</strong><p>'+$( this ).attr( "title" )+'</div>'; + } + }); + + $("div.clash_status_box").tooltip({ + content: function(result){ + $.get("api.php",{action: 'show_entity_clashes', row_id: $(this).attr('title')}, function(data) { + var h = "<strong>Clash information</strong><p>Supplying federation: <strong>"+data.fed+"</strong><p>other federations: <strong>"+data.other_fed.join('</strong>; <strong>')+"</strong>"; + result('<div>'+h+'</div>'); + }, 'json'); + } + }); + }); + }); $("#download_entities").click(function(event) { var ec = 0; @@ -275,7 +278,6 @@ $("#entity_cat").change(function(event) { $("#entity_cat_uri").html(id); $("#entity_cat_legend").css("visibility","visible"); } -//alert("ecs="+entity_cat_support[id]+"; ec="+entity_cat[id]); if(entity_cat_support[id] > 0 && entity_cat[id] > 0) { $("#category_type_selection").show(); } else { @@ -297,7 +299,6 @@ $("#entity_cat").change(function(event) { $("input[name=search_type]").bind("change",function(event) { var type = $('input[name=search_type]:checked').val(); -//alert(type); var txt; var hlp; if(type == 'entityid') { @@ -348,5 +349,4 @@ $("input[name=new_entities]").on("click",function(event) { $( "#datepicker" ).val(""); } ); - </script>