Skip to content
Snippets Groups Projects
Commit a6cede63 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Added sorting of columns on ldapstatus page...

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1361 44740490-163a-0410-bde0-09ae8108e29a
parent 4ec2368a
No related branches found
No related tags found
No related merge requests found
......@@ -31,17 +31,17 @@ $this->includeAtTemplateBase('includes/header.php');
<table class="attributes" style="font-size: small; width: 100%; border: 1px solid #aaa">
<tr>
<th>Name of institusion</th>
<th>Conf</th>
<th>Ping</th>
<th colspan="3">Cert</th>
<th>Admin</th>
<th>S=bogus</th>
<th>test</th>
<th>S=test</th>
<th>T-bind()</th>
<th>Org-info</th>
<th>Meta</th>
<th>Time</th>
<th><a href="?sort=conf">Conf</a></th>
<th><a href="?sort=ping">Ping</a></th>
<th colspan="3"><a href="?sort=cert">Cert</a></th>
<th><a href="?sort=adminBind">Admin</a></th>
<th><a href="?sort=ldapSearchBogus">S=bogus</a></th>
<th><a href="?sort=configTest">test</a></th>
<th><a href="?sort=ldapSearchTestUser">S=test</a></th>
<th><a href="?sort=ldapBindTestUser">T-bind()</a></th>
<th><a href="?sort=getTestOrg">Org-info</a></th>
<th><a href="?sort=configMeta">Meta</a></th>
<th><a href="?sort=time">Time</a></th>
</tr>
<?php
......@@ -116,8 +116,14 @@ foreach($this->data['sortedOrgIndex'] as $orgkey) {
showRes('configMeta', $res, $this);
if ($res['time'] > 2.0) {
echo('<td style="text-align: right; color: #700">' . ceil($res['time']*1000) . '&nbsp;ms</td>');
} else if ($res['time'] > 0.3) {
echo('<td style="text-align: right">' . ceil($res['time']*1000) . '&nbsp;ms</td>');
} else {
echo('<td style="text-align: right; color: #060">' . ceil($res['time']*1000) . '&nbsp;ms</td>');
}
echo('<td style="text-align: right">' . ceil($res['time']*1000) . '&nbsp;ms</td>');
echo('</tr>');
if ($this->data['showcomments'] && array_key_exists('comment', $this->data['orgconfig'][$orgkey])) {
......
......@@ -170,10 +170,45 @@ $session->setData('module:ldapstatus', 'results', $results);
$lightCounter = array(0,0,0);
function resultCode($res) {
function resultCode($res, $sortby = NULL) {
global $lightCounter;
$code = '';
$columns = array('config', 'ping', 'cert', 'adminBind', 'ldapSearchBogus', 'configTest', 'ldapSearchTestUser', 'ldapBindTestUser', 'getTestOrg', 'configMeta');
if (!empty($sortby) && in_array($sortby, $columns)) {
if (array_key_exists($sortby, $res)) {
if ($res[$sortby][0]) {
$code .= '0';
} else {
$code .= '2';
}
} else {
$code .= '1';
}
if ($sortby == 'cert') {
if (array_key_exists($sortby, $res) && isset($res[$sortby]['expire']))
$code .= sprintf("%05s", (99999 - $res[$sortby]['expire']) );
else
$code .= '-----';
}
$code .= '|';
}
if ($sortby === 'time') {
if (array_key_exists($sortby, $res))
$code .= sprintf("%05s", floor(1000*$res[$sortby]) );
else
$code .= '-----';
$code .= '|';
}
foreach ($columns AS $c) {
if (array_key_exists($c, $res)) {
if ($res[$c][0]) {
......@@ -195,7 +230,7 @@ function resultCode($res) {
$ressortable = array();
foreach ($results AS $key => $res) {
$ressortable[$key] = resultCode($res[0]);
$ressortable[$key] = resultCode($res[0], (isset($_REQUEST['sort']) ? $_REQUEST['sort'] : NULL));
}
arsort($ressortable);
#echo '<pre>'; print_r($ressortable); exit;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment