Commit 42ee8cfc authored by Benoit Mortier's avatar Benoit Mortier

adding a listing for the service on the servers

parent e1b82df6
......@@ -96,6 +96,8 @@ class systemManagement extends management
// Build headpage
$headpage = new listing(get_template_path("system-list.xml", true));
$headpage->registerElementFilter("systemRelease", "systemManagement::systemRelease");
$headpage->registerElementFilter("ipOf", "systemManagement::ipOf");
$headpage->registerElementFilter("listServices", "systemManagement::listServices");
$headpage->setFilter($filter);
$filter->setConverter('INCOMING', 'systemManagement::incomingFilterConverter');
......@@ -1377,6 +1379,57 @@ class systemManagement extends management
return(" ");
}
static function listServices($dn)
{
global $config;
// Load information if needed
$ldap = $config->get_ldap_link();
$ldap->cd($dn);
$ldap->search("(objectClass=*)",array('objectClass'));
$str = " ";
$services = array();
$services_class = array (
"FAIrepositoryServer" => "repository",
"goLdapServer" => "ldap",
"dNSZone" => "dns",
"goNtpServer" => "ntp",
"dhcpServer" => "dhcp",
"goVirusServer" => "antivirus",
"goSpamServer" => "spamassassin",
"goShareServer" => "file",
"goCupsServer" => "print",
"goImapServer" => "imap",
"goTerminalServer" => "terminal",
"goMailServer" => "smtp"
);
while($attrs = $ldap->fetch()){
unset($attrs['objectClass']['count']);
foreach($attrs['objectClass'] as $class) {
if(isset($services_class[$class])) {
$services[$services_class[$class]] =" <img class='center' src='plugins/systems/images/service_".$services_class[$class].".png' alt='".$services_class[$class]."' title ='".$services_class[$class]."'/>";
}
}
}
$str = implode("",$services);
return($str);
}
static function ipOf($dn)
{
global $config;
// Load information if needed
$ldap = $config->get_ldap_link();
$ldap->cd($dn);
$ldap->search("(ipHostNumber=*)",array('ipHostNumber'));
$str = "&nbsp;";
if($attrs = $ldap->fetch()){
$str = $attrs['ipHostNumber'][0];
}
return($str);
}
/*! \brief !! Incoming dummy acls, required to defined acls for incoming objects
*/
......
......@@ -190,20 +190,12 @@ class termDNS extends plugin
*/
$deps = array();
$ou = preg_replace("/,.*$/","",get_ou("systemRDN"));
$a_ous = array(get_ou("serverRDN"),
get_ou("terminalRDN"),
get_ou("workstationRDN"),
get_ou("printerRDN"),
get_ou("phoneRDN"),
get_ou("componentRDN"));
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
$ldap->search("(&(objectClass=organizationalUnit)(".$ou."))",array("dn"));
while($attrs = $ldap->fetch()){
foreach($a_ous as $allowed){
$deps[] = $allowed.$attrs['dn'];
}
$deps[] = $attrs['dn'];
}
foreach($deps as $dep){
......@@ -302,6 +294,7 @@ class termDNS extends plugin
/* Check for autonet button */
if (isset($_POST['autonet']) && ($this->acl_is_writeable("ipHostNumber") || $this->acl_is_writeable("macAddress"))){
if(class_available("supportDaemon")){
/*
$d= new supportDaemon(TRUE, 0.5);
$res= $d->_send("<xml><header>gosa_network_completition</header>".
"<source>GOSA</source><target>GOSA</target><hostname>".$this->cn."</hostname></xml>", TRUE);
......@@ -311,6 +304,9 @@ class termDNS extends plugin
if (isset($res['XML']['MAC']) && $this->acl_is_writeable("macAddress")){
$this->macAddress= $res['XML']['MAC'];
}
*/
msg_dialog::display(_("Error"), _("NOT IMPLEMENTED"), ERROR_DIALOG);
}
}
......@@ -1147,19 +1143,19 @@ class termDNS extends plugin
// Search the next free and valid ip.
while(in_array(implode(".",$ip_data),$list) || $ip_data[3] <= 1){
$ip_data[3] ++ ;
if($ip_data[3] > 255){
if($ip_data[3] >= 255){
$ip_data[3] = 1 ;
$ip_data[2] ++ ;
}
if($ip_data[2] > 255){
if($ip_data[2] >= 255){
$ip_data[2] = 1 ;
$ip_data[1] ++ ;
}
if($ip_data[1] > 255){
if($ip_data[1] >= 255){
$ip_data[1] = 1 ;
$ip_data[0] ++ ;
}
if($ip_data[0] > 255) break;
if($ip_data[0] >= 255) break;
}
return(implode(".",$ip_data));
......
......@@ -106,27 +106,23 @@
{if $ZoneCnt}
{render acl=$dnsSetupACL}
{if $DNS_is_account == true}
{if $DNS_is_account == true}
{if $hide_dns_check_box}
<input type="hidden" name="DNS_is_account" value="1">
<input type="checkbox" name="dummy" value="1" disabled
checked="checked" />
{else}
<input type="checkbox" name="DNS_is_account" value="1"
checked="checked" onclick="$('test2').toggle(); $('propose_ip').toggle();"/>
{/if}
<input type="checkbox" name="DNS_is_account" id="DNS_is_account" value="1" checked="checked"
{if $hide_dns_check_box}disabled
{else}onclick="$('test2').toggle(); $('propose_ip').toggle();"{/if}
/>
{else}
<input type="checkbox" name="DNS_is_account" value="1"
onclick="
$('test2').toggle();
$('propose_ip').toggle();
"/>
{/if}
{else}
<input type="checkbox" name="DNS_is_account" id="DNS_is_account" value="1"
onclick="
$('test2').toggle();
$('propose_ip').toggle();
"/>
{/if}
{/render}
{t}Enable DNS for this device{/t}
<label for="DNS_is_account">{t}Enable DNS for this device{/t}</label>
<input type='image' src='images/lists/reload.png' class='center' name="reloadThisDNSStuff" >
{if $DNS_is_account == true}
<div style="padding-left:20px" id="test2">
......@@ -137,34 +133,34 @@
<tr>
<td><LABEL for="zoneName">{t}Zone{/t}</LABEL></td>
<td>
{render acl=$dnsSetupACL}
{render acl=$dnsSetupACL}
<select name="zoneName" id="zoneName">
{html_options values=$ZoneKeys output=$Zones selected=$zoneName}
</select>
{/render}
{/render}
</td>
</tr>
<tr>
<td>{t}TTL{/t}</td>
<td><label for ="dNSTTL">{t}TTL{/t}</label></td>
<td>
{render acl=$dnsSetupACL}
<input type="text" name="dNSTTL" value="{$dNSTTL}" id="dNSTTL" >
{/render}
{render acl=$dnsSetupACL}
<input type="text" name="dNSTTL" value="{$dNSTTL}" id="dNSTTL" >
{/render}
</td>
</tr>
<tr>
<td valign="top">{t}Dns records{/t}</td>
<td>
{render acl=$dnsSetupACL}
{$records}
{/render}
{render acl=$dnsSetupACL}
{$records}
{/render}
</td>
</tr>
</table>
</div>
{else}
<input type="checkbox" name="dummy" value="1" disabled class='center' {if $DNS_is_account} checked {/if}>
{t}Enable DNS for this device{/t} ({t}not configured{/t})
<input type="checkbox" name="dummy" id="DNS_is_account" value="1" disabled class='center' {if $DNS_is_account} checked {/if}>
<label for="DNS_is_account">{t}Enable DNS for this device{/t} ({t}not configured{/t})</label>
<input type='image' src='images/lists/reload.png' class='center'>
{/if}
......
......@@ -150,7 +150,7 @@
</definition>
<table>
<layout>|20px;c|||80px|170px;r|</layout>
<layout>|20px;c||90px||80px|80px|170px;r|</layout>
<department>
<value>%{filter:objectType(dn,objectClass)}</value>
......@@ -173,6 +173,14 @@
<export>true</export>
</column>
<column>
<label>IP</label>
<sortAttribute>ip</sortAttribute>
<sortType>string</sortType>
<value>%{filter:ipOf(dn)}</value>
<export>true</export>
</column>
<column>
<label>Description</label>
<sortAttribute>description</sortAttribute>
......@@ -181,6 +189,14 @@
<export>true</export>
</column>
<column>
<label>Services</label>
<sortAttribute>services</sortAttribute>
<sortType>string</sortType>
<value>%{filter:listServices(dn)}</value>
<export>true</export>
</column>
<column>
<label>Release</label>
<sortAttribute>description</sortAttribute>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment