From bf4bf34a37ef486bf8cb77bf8f6759b865572bc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no> Date: Mon, 19 Jan 2009 18:18:52 +0000 Subject: [PATCH] Improved UI, and using configuration file for ping command. (ldapstatus module) git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1166 44740490-163a-0410-bde0-09ae8108e29a --- .../config-templates/module_ldapstatus.php | 18 ++++++++++++++++++ .../templates/default/ldapstatus.php | 9 +++++---- modules/ldapstatus/www/index.php | 8 ++++++-- 3 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 modules/ldapstatus/config-templates/module_ldapstatus.php diff --git a/modules/ldapstatus/config-templates/module_ldapstatus.php b/modules/ldapstatus/config-templates/module_ldapstatus.php new file mode 100644 index 000000000..728ac26a1 --- /dev/null +++ b/modules/ldapstatus/config-templates/module_ldapstatus.php @@ -0,0 +1,18 @@ +<?php +/* + * Configuration for the module ldapstatus. + * + * $Id$ + */ + +$config = array ( + + // Ping command in Debian + Ubuntu + 'ping' => 'ping -W 1 -c 1', + + // Ping command in Mac OS X + //'ping' => 'ping -t 1 -c 1', + +); + +?> diff --git a/modules/ldapstatus/templates/default/ldapstatus.php b/modules/ldapstatus/templates/default/ldapstatus.php index 19043223f..a82b6cb4f 100644 --- a/modules/ldapstatus/templates/default/ldapstatus.php +++ b/modules/ldapstatus/templates/default/ldapstatus.php @@ -8,7 +8,7 @@ $this->includeAtTemplateBase('includes/header.php'); <h2>LDAP test</h2> -<table style="width: 100%"> +<table class="attributes" style="width: 100%; border: 1px solid #aaa"> <tr> <th>Name of institusion</th> <th>Conf</th> @@ -38,15 +38,16 @@ function showRes($key, $res, $template) { />'; } } else { - echo('<span style="color: #eee;">NA</span>'); + echo('<span style="color: #b4b4b4; font-size: x-small">NA</span>'); } echo('</td>'); } +$i = 0; +$classes = array('odd', 'even'); foreach($this->data['results'] as $orgkey => $res) { - echo('<tr>'); -# print_r($this->data['orgconfig']); exit; + echo('<tr class="' . ($classes[($i++ % 2)]) . '">'); echo('<td>' . htmlspecialchars($this->getTranslation($this->data['orgconfig'][$orgkey]['description'])) . '</td>'); showRes('config', $res, $this); showRes('configMeta', $res, $this); diff --git a/modules/ldapstatus/www/index.php b/modules/ldapstatus/www/index.php index da693640b..d272f8dd2 100644 --- a/modules/ldapstatus/www/index.php +++ b/modules/ldapstatus/www/index.php @@ -12,8 +12,9 @@ if (!$session->isValid('login-admin') ) { $ldapconfig = $config->copyFromBase('loginfeide', 'config-login-feide.php'); +$ldapStatusConfig = $config->copyFromBase('ldapstatus', 'module_ldapstatus.php'); - +$pingcommand = $ldapStatusConfig->getValue('ping'); $orgs = $ldapconfig->getValue('orgldapconfig'); @@ -45,7 +46,10 @@ foreach ($orgs AS $orgkey => $orgconfig) { $pingreturn = NULL; $pingoutput = NULL; - exec('ping -W 1 -c 1 ' . escapeshellcmd($url['host']), $pingoutput, $pingreturn); + +# echo 'Ping command: ' . $pingcommand; exit; + + exec($pingcommand . ' ' . escapeshellcmd($url['host']), $pingoutput, $pingreturn); # echo $pingreturn; exit; -- GitLab