diff options
Diffstat (limited to 'ldap-site-mngmt/webinterface/computers')
61 files changed, 9394 insertions, 0 deletions
diff --git a/ldap-site-mngmt/webinterface/computers/computers.dwt b/ldap-site-mngmt/webinterface/computers/computers.dwt new file mode 100644 index 00000000..ec6d0cbc --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/computers.dwt @@ -0,0 +1,79 @@ +<html> + +<head> + <title>{SEITENTITEL}</title> + <link rel='stylesheet' href='../styles.css' type='text/css'></head> +<body> + +<table cellpadding='0' cellspacing='0' border='0' width='95%' height='8%'> + <tr> + <td width='35%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top'> + <td width='1'></td> + <td><h2>Rechner und IP Management</h2></td> + </tr> + </table> + </td> + + <td width='40%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr valign='top' align='left'> + <td> + <h4><a href='../start.php' class='headerlink'>Startseite</a> + >> <a href='../au/au.php' class='headerlink'>{AU}</a> [ {DOMAIN} ]</h4> + </td> + </tr> + </table> + </td> + <td width='25%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%' align='right'> + <tr valign='top' align='right'> + <td> + {LOGIN} + </td> + </tr> + </table> + </td> + </tr> +</table> + +<table cellpadding='5' cellspacing='0' border='0' width='95%' height='7%'> +<tr> + <td>{MAINMENU}</td> +</tr> +</table> + +<hr align='center' width='98%' noshade> + + + +<table cellpadding='5' cellspacing='0' border='0' width='100%' height='85%'> + + <tr valign='top' height='100%'> + <td width='28%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td> + + {NAVIGATION} + + </td></tr> + </table> + </td> + + <td width='72%'> + <table cellpadding='5' cellspacing='0' border='0' width='100%'> + <tr><td> + + {HAUPTFENSTER} + + </td></tr> + </table> + </td> + + </tr> +</table> + +</body> + +</html> diff --git a/ldap-site-mngmt/webinterface/computers/computers.php b/ldap-site-mngmt/webinterface/computers/computers.php new file mode 100644 index 00000000..46b686df --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/computers.php @@ -0,0 +1,28 @@ +<?php +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 0; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "computers_start.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/computers_footer.inc.php b/ldap-site-mngmt/webinterface/computers/computers_footer.inc.php new file mode 100644 index 00000000..311721c5 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/computers_footer.inc.php @@ -0,0 +1,18 @@ +<?php + +$template->assign(array("PFAD" => $START_PATH)); + +# Daten in die Vorlage parsen +$template->parse("LOGIN", "Login"); +$template->parse("MAINMENU", "Mmenu"); +$template->parse("NAVIGATION", "Menu"); +$template->parse("HAUPTFENSTER", "Webseite"); +$template->parse("PAGE", "Vorlage"); + +# Fertige Seite an den Browser senden +$template->FastPrint("PAGE"); + +# Abmelden vom LDAP +ldap_unbind($ds); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/computers_header.inc.php b/ldap-site-mngmt/webinterface/computers/computers_header.inc.php new file mode 100644 index 00000000..d51a42d1 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/computers_header.inc.php @@ -0,0 +1,21 @@ +<?php +include("computers_menu.php"); + +$template = new FastTemplate("."); + +# dem erstellten Template-Objekt eine Vorlage zuweisen +$definedTemplates = array("Vorlage" => "computers.dwt", + "Login" => "../logout_form.inc.dwt", + "Mmenu" => "../hauptmenue.dwt", + "Menu" => "menu.dwt", + "Webseite" => $webseite); +if (isset($additionalTemplates)) { + foreach ($additionalTemplates as $templateKey => $templateFile) { + $definedTemplates[$templateKey] = $templateFile; + } +} +$template->define($definedTemplates); + +$template->assign(array("SEITENTITEL" => $titel, "AU" => $au_ou, "DOMAIN" => $assocdom, "USERCN" => $usercn)); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/computers_menu.php b/ldap-site-mngmt/webinterface/computers/computers_menu.php new file mode 100644 index 00000000..9b681bee --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/computers_menu.php @@ -0,0 +1,382 @@ +<?php + +function createComputersMenu($rollen , $mnr, $auDN, $sbmnr, $mcnr) { + + global $template, $ds, $suffix, $START_PATH; + + # Struktur der Registerkartenleiste + # Hauptmenu + $hauptmenu = array(array("link" => "computers.php", + "text" => "Übersicht", + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")), + array("link" => "hostoverview.php", + "text" => "Rechner", + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")), + array("link" => "groupoverview.php", + "text" => "Rechnergruppen", + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")), + array("link" => "machineconfig_default.php", + "text" => "Default MachineConfigs", + "zugriff" => array("MainAdmin","HostAdmin")), + array("link" => "new_mcdef.php", + "text" => "Neue MachineConfig", + "zugriff" => array("MainAdmin","HostAdmin")), + array("link" => "new_pxe.php", + "text" => "Neues PXE Bootmenü", + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin"))); + + # Submenu + #$comps = array(); + $computers_array = get_hosts($auDN,array("dn","hostname","ou")); + #if (count($computers_array) != 0){ + for($n=0;$n<count($computers_array);$n++){ + $machineconfigs = get_machineconfigs($computers_array[$n]['dn'],array("dn","cn")); + $pxeconfigs = get_pxeconfigs($computers_array[$n]['dn'], array("dn","cn")); + if (count($machineconfigs) != 0){ + $mcc = array(); + for ($m=0;$m<count($machineconfigs);$m++){ + $mcc[] = array("link" => "mcdef.php?dn=".$machineconfigs[$m]['dn']."&mnr=1&sbmnr=".$n."&mcnr=".$m, + "text" => $machineconfigs[$m]['cn'], + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); + } + }else{$mcc = array();} + + if (count($pxeconfigs) != 0){ + $pxec = array(); + for ($p=0;$p<count($pxeconfigs);$p++){ + $z=$m+$p; + $pxec[] = array("link" => "pxe.php?dn=".$pxeconfigs[$p]['dn']."&mnr=1&sbmnr=".$n."&mcnr=".$z, + "text" => $pxeconfigs[$p]['cn'], + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); + } + }else{$pxec = array();} + + + $comps[] = array("link" => "host.php?dn=".$computers_array[$n]['dn']."&sbmnr=".$n, + "text" => $computers_array[$n]['hostname'], + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); + # print_r($comps); echo "<br>"; + $mccpxec = array_merge($mcc,$pxec); + $compmc[] = $mccpxec; + + } + #} + $comps[] = array("link" => "new_host.php?sbmnr=".$n, + "text" => "Neuer Rechner", + "zugriff" => array("MainAdmin","HostAdmin")); + + $groups_array = get_groups($auDN,array("dn","cn")); + for($n=0;$n<count($groups_array);$n++){ + $machineconfigs = get_machineconfigs($groups_array[$n]['dn'],array("dn","cn")); + $pxeconfigs = get_pxeconfigs($groups_array[$n]['dn'],array("dn","cn")); + if (count($machineconfigs) != 0){ + $mcg = array(); + for ($m=0;$m<count($machineconfigs);$m++){ + $mcg[] = array("link" => "mcdef.php?dn=".$machineconfigs[$m]['dn']."&mnr=2&sbmnr=".$n."&mcnr=".$m, + "text" => $machineconfigs[$m]['cn'], + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); + } + }else{$mcg = array();} + + if (count($pxeconfigs) != 0){ + $pxeg = array(); + for ($p=0;$p<count($pxeconfigs);$p++){ + $z=$m+$p; + $pxeg[] = array("link" => "pxe.php?dn=".$pxeconfigs[$p]['dn']."&mnr=2&sbmnr=".$n."&mcnr=".$z, + "text" => $pxeconfigs[$p]['cn'], + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); + } + }else{$pxeg = array();} + $groups = array(); + $groups[] = array("link" => "group.php?dn=".$groups_array[$n]['dn']."&sbmnr=".$n, + "text" => $groups_array[$n]['cn'], + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); + + $mcgpxeg = array_merge($mcg,$pxeg); + $groupmc[] = $mcgpxeg; + } + $groups[] = array("link" => "new_group.php?sbmnr=".$n, + "text" => "Neue Gruppe", + "zugriff" => array("MainAdmin","HostAdmin")); + # print_r($compmc); echo "<br><br>"; + # print_r($groupmc); echo "<br><br>"; + + # default machine-configs + $mcdef_array = get_machineconfigs("cn=computers,".$auDN,array("dn","cn","timerange")); + for($n=0;$n<count($mcdef_array);$n++){ + $defmc [] = array("link" => "mcdef.php?dn=".$mcdef_array[$n]['dn']."&mnr=3&sbmnr=".$n, + "text" => $mcdef_array[$n]['cn'], + "zugriff" => array("MainAdmin","HostAdmin","DhcpAdmin")); + } + + $submenu = array(array(), + $comps, + $groups, + $defmc, + array()); + #echo "submenu: ";print_r($submenu);echo "<br><br>"; + + $subsubmenu = array(array(array(array())), + $compmc, + $groupmc, + array(array(array())), + array(array(array()))); + #echo "subsubmenu: ";print_r($subsubmenu);echo "<br><br>"; + + # Zusammenstellen der Menuleiste + $template->define_dynamic("Hauptmenu", "Menu"); + $template->define_dynamic("Submenu", "Menu"); + $template->define_dynamic("Subsubmenu", "Menu"); + $i=0; + + $maxmenu = count($hauptmenu); + foreach($hauptmenu as $item){ + $template->clear_parse("SUBMENU_LIST"); + + if($item['zugriff'] === "alle" || vergleicheArrays($rollen , $item['zugriff'])) { + + ######################################################################### + # SUBMENU + + $subempty = 0; + $j=0; + $maxsub = count($submenu[$mnr]); + #echo "_"; print_r($maxsub); echo "_"; + if($maxsub > 0){ + foreach($submenu[$mnr] as $item2) { + + $template->clear_parse("SUBSUBMENU_LIST"); + + + if($item2['zugriff'] === "alle" || vergleicheArrays($rollen, $item2['zugriff'])) { + + ######################################################################## + # SUBSUBMENU + $subsubempty = 0; + $k=0; + $maxsubsub = count($subsubmenu[$mnr][$sbmnr]); + #print_r($maxsubsub); + if ($maxsubsub > 0){ + if($sbmnr >= 0){ + + foreach($subsubmenu[$mnr][$sbmnr] as $item3) { + + if($item3['zugriff'] === "alle" || vergleicheArrays($rollen, $item3['zugriff'])) { + + if($j != $sbmnr || $i != $mnr){ + + $template->assign(array("SUBSUB" => "")); + # "LINK_S" => "", + # "TEXT_S" => "")); + $template->parse("SUBSUBMENU_LIST", ".Subsubmenu"); + $template->clear_dynamic("Subsubmenu"); + $template->clear_parse("SUBSUBMENU_LIST"); + } + else{ + if ($k==0) { + if ($mcnr==0) { + if($maxsubsub == 1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $lastaktive=true; + $farb="#505050"; + } + else{ + if($maxsubsub == 1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($mcnr==$k) { + if($maxsubsub == $k+1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $lastaktive=true; + $farb="#505050"; + } + else { + $farb="#A0A0A0"; + if($maxsubsub == $k+1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + # if ($lastaktive) {$zwisch="branch";} + # else {$zwisch="branch";} + $lastaktive=false; + } + } + $htmlcode= " + <tr height='4'> + <td></td><td></td><td align='right'><img src='../pics/line2.gif' height='4'></td><td></td><td></td> + </tr> + <tr> + <td width='8%'> </td> + <td width='8%'> </td> + <td width='5%' align='right'><img src='../pics/".$zwisch.".gif'></td>
+ <td width='69%' align='left' style='border-width:1 1 1 1;border-color:#000000;border-style:solid;padding:2;padding-left:30px;background-color:{FARBE_MC}'> + <a href='".$item3['link']."' style='text-decoration:none'><b class='standard_schrift'>".$item3['text']."</b></a></td> + <td width='10%'> </td> + </tr> + "; + $template->assign(array("SUBSUB" => $htmlcode)); + $template->assign(array("FARBE_MC" => $farb)); + $template->parse("SUBSUBMENU_LIST", ".Subsubmenu"); + $template->clear_dynamic("Subsubmenu"); + + } + } + else { + $subsubempty++; + } + $k=$k+1; + } + } + + if($subsubempty == count($subsubmenu[$mnr][$sbmnr])) { + $template->assign(array("SUBSUB" => "")); + # "LINK_S" => "", + # "TEXT_S" => "")); + $template->parse("SUBSUBMENU_LIST", ".Subsubmenu"); + $template->clear_dynamic("Subsubmenu"); + $template->clear_parse("SUBSUBMENU_LIST"); + } + + } + $template->assign(array("SUBSUB" => "")); + # SUBSUBMENU + ######################################################################## + if($i != $mnr){ + $template->assign(array("SUB" => "")); + # "LINK_S" => "", + # "TEXT_S" => "")); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + else{ + if ($j==0) { + if ($sbmnr==0) { + if($maxsub == 1){$zwisch2="";} + else {$zwisch2="";} + $lastaktive=true; + $farb="#505050"; + } + else{ + if(count($subsubmenu[$i][$j][0]) != 0){ + if($maxsub == 1){$zwisch2="<a href='".$item2['link']."' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + else {$zwisch2="<a href='".$item2['link']."' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + }else{$zwisch2="";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($sbmnr==$j) { + if($maxsub == $j+1){$zwisch2="";} + else {$zwisch2="";} + $lastaktive=true; + $farb="#505050"; + } + else { + if(count($subsubmenu[$i][$j][0]) != 0){ + if($maxsub == $i+1){$zwisch2="<a href='".$item2['link']."' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + else {$zwisch2="<a href='".$item2['link']."' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + }else{$zwisch2="";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + $htmlcode= " + <tr height='4'> + <td></td><td></td><td></td><td></td> + </tr> + <tr> + <td width='8%'> </td> + <td width='8%' align='right'>".$zwisch2."</td> + <td width='5%' align='left' style='border-width:1 0 1 1;border-color:#000000;border-style:solid;padding:3;background-color:{FARBE_S}'> </td>
+ <td width='69%' align='left' style='border-width:1 1 1 0;border-color:#000000;border-style:solid;padding:3;padding-left:15px;background-color:{FARBE_S}'> + <a href='".$item2['link']."' style='text-decoration:none'><b class='standard_schrift'>".$item2['text']."</b></a></td> + <td width='10%'> </td> + </tr> + "; + $template->assign(array("SUB" => $htmlcode)); + $template->assign(array("FARBE_S" => $farb)); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + } + else { + $subempty++; + } + $j=$j+1; + } + } + if($subempty == count($submenu[$mnr])) { + $template->assign(array("SUB" => "")); + # "LINK_S" => "", + # "TEXT_S" => "")); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + + } + $template->assign(array("SUBSUB" => "")); + # SUBMENU + ##################################################################### + + if ($i==0) { + if ($mnr==0) { + if(count($submenu[$i][0]) != 0){ + if($maxmenu == 1){$zwisch="";} # {$zwisch="<img style='border-width:0;border-style=none;' src='../pics/minus2.gif'>";} + else {$zwisch="";} + }else{$zwisch="";} + $lastaktive=true; + $farb="#505050"; + } + else{ + if(count($submenu[$i][0]) != 0){ + if($maxmenu == 1){$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + else {$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + }else{$zwisch="";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($mnr==$i) { + if(count($submenu[$mnr][0]) != 0){ + if($maxmenu == $i+1){$zwisch="";} + else {$zwisch="";} + }else{$zwisch="";} + $lastaktive=true; + $farb="#505050"; + } + else { + + if(count($submenu[$i][0]) != 0){ + if($maxmenu == $i+1){$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + else {$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + }else{$zwisch="";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + $template->assign(array("ICON" => $zwisch, + "FARBE" => $farb, + "LINK_M" => $item["link"], + "TEXT_M" => $item["text"])); + $template->parse("HAUPTMENU_LIST", ".Hauptmenu"); + $template->clear_dynamic("Hauptmenu"); + } + $i=$i+1; + } + if ($lastaktive) {$template->assign(array("ENDE" => ""));} + else{ + $template->assign(array("ENDE" => "")); + } +} +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/computers_menu.save.php b/ldap-site-mngmt/webinterface/computers/computers_menu.save.php new file mode 100644 index 00000000..183d9309 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/computers_menu.save.php @@ -0,0 +1,188 @@ +<?php + +function createComputersMenu($roles , $mnr, $auDN, $sbmnr) { + + global $template, $ds, $suffix, $START_PATH; + + # Struktur der Registerkartenleiste + # Hauptmenu + $hauptmenu = array(array("link" => "computers.php", + "text" => "Übersicht", + "zugriff" => "alle"), + array("link" => "hostoverview.php", + "text" => "Rechner", + "zugriff" => array("MainAdmin")), + array("link" => "computers.php", + "text" => "Neuen Rechner anlegen", + "zugriff" => array("MainAdmin")), + array("link" => "groupoverview.php", + "text" => "Rechnergruppen", + "zugriff" => array("MainAdmin")), + array("link" => "computers.php", + "text" => "Neue Gruppe anlegen", + "zugriff" => array("MainAdmin"))); + + # Submenu + $computers_array = get_hosts($auDN,array("dn","hostname","ou")); + for($n=0;$n<count($computers_array);$n++){ + $comps[] = array("link" => "host.php?dn=".$computers_array[$n]['dn']."&sbmnr=".$n, + "text" => $computers_array[$n]['hostname'], + "zugriff" => array("MainAdmin")); + } + $groups_array = get_groups($auDN,array("dn","cn")); + for($n=0;$n<count($groups_array);$n++){ + $groups[] = array("link" => "group.php?dn=".$groups_array[$n]['dn']."&sbmnr=".$n, + "text" => $groups_array[$n]['cn'], + "zugriff" => array("MainAdmin")); + } + $submenu = array(array(array()), + $comps, + array(array()), + $groups, + array(array())); + + $rollen = array_keys($roles); + + # Zusammenstellen der Menuleiste + $template->define_dynamic("Hauptmenu", "Menu"); + $template->define_dynamic("Submenu", "Menu"); + $i=0; + + $maxmenu = count($hauptmenu); + foreach($hauptmenu as $item){ + $template->clear_parse("SUBMENU_LIST"); + + if($item['zugriff'] === "alle" || vergleicheArrays($rollen , $item['zugriff'])) { + $subempty = 0; + $j=0; + $maxsub = count($submenu[$mnr]); + foreach($submenu[$mnr] as $item2) { + + if($item2['zugriff'] === "alle" || vergleicheArrays($rollen, $item2['zugriff'])) { + if($i != $mnr){ + $template->assign(array("SUB" => "")); + # "LINK_S" => "", + # "TEXT_S" => "")); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + else{ + if ($j==0) { + if ($sbmnr==0) { + if($maxsub == 1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $lastaktive=true; + $farb="#505050"; + } + else{ + if($maxsub == 1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($sbmnr==$j) { + if($maxsub == $j+1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + $lastaktive=true; + $farb="#505050"; + } + else { + $farb="#A0A0A0"; + if($maxsub == $j+1){$zwisch="branchbottom2";} + else {$zwisch="branch2";} + # if ($lastaktive) {$zwisch="branch";} + # else {$zwisch="branch";} + $lastaktive=false; + } + } + $htmlcode= " + <tr height='4'> + <td></td><td align='right'><img src='../pics/line2.gif' height='4'></td><td></td><td></td> + </tr> + <tr> + <td width='10%'> </td> + <td width='15%' align='right'><img src='../pics/".$zwisch.".gif'></td>
+ <td width='65%' align='left' style='border-width:1 1 1 1;border-color:#000000;border-style:solid;padding:5;padding-left:30px;background-color:{FARBE_S}'> + <a href='".$item2['link']."' style='text-decoration:none'><b class='standard_schrift'>".$item2['text']."</b></a></td> + <td width='10%'> </td> + </tr> + "; + $template->assign(array("SUB" => $htmlcode)); + $template->assign(array("FARBE_S" => $farb)); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + } + else { + $subempty++; + } + $j=$j+1; + + } + if($subempty == count($submenu[$mnr])) { + $template->assign(array("SUB" => "")); + # "LINK_S" => "", + # "TEXT_S" => "")); + $template->parse("SUBMENU_LIST", ".Submenu"); + $template->clear_dynamic("Submenu"); + } + + if ($i==0) { + if ($mnr==0) { + if(count($submenu[$i][0]) != 0){ + if($maxmenu == 1){$zwisch="";} # {$zwisch="<img style='border-width:0;border-style=none;' src='../pics/minus2.gif'>";} + else {$zwisch="";} + }else{$zwisch="";} + $lastaktive=true; + $farb="#505050"; + } + else{ + if(count($submenu[$i][0]) != 0){ + if($maxmenu == 1){$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + else {$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + }else{$zwisch="";} + $farb="#A0A0A0"; + $lastaktive=false; + } + } + else { + if ($mnr==$i) { + if(count($submenu[$mnr][0]) != 0){ + if($maxmenu == $i+1){$zwisch="";} + else {$zwisch="";} + }else{$zwisch="";} + $lastaktive=true; + $farb="#505050"; + } + else { + $farb="#A0A0A0"; + if(count($submenu[$i][0]) != 0){ + if($maxmenu == $i+1){$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + else {$zwisch="<a href='{LINK_M}' style='border-style=none;text-decoration:none'> + <img style='border-width:0;border-style=none;' src='../pics/plus2.gif'></a>";} + }else{$zwisch="";} + #if ($lastaktive) {$zwisch="";} + #else {$zwisch="";} + $lastaktive=false; + } + } + $template->assign(array("ICON" => $zwisch, + "FARBE" => $farb, + "LINK_M" => $item["link"], + "TEXT_M" => $item["text"])); + $template->parse("HAUPTMENU_LIST", ".Hauptmenu"); + $template->clear_dynamic("Hauptmenu"); + } + $i=$i+1; + } + if ($lastaktive) {$template->assign(array("ENDE" => ""));} + else{ + $template->assign(array("ENDE" => "")); + } +} +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/computers_start.dwt b/ldap-site-mngmt/webinterface/computers/computers_start.dwt new file mode 100644 index 00000000..09cade01 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/computers_start.dwt @@ -0,0 +1,42 @@ +<table border='0' cellpadding='5' cellspacing='0' width='90%'> + <tr> + <td colspan='2'><h3>Modul - Rechner und Rechnergruppen Management: </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td> + <p>Dieses Modul dient der Verwaltung der Rechner und Rechnergruppen in ihrer Abteilung + (AU), inklusive ihrer spezifischen Rechner- und PXE Boot Konfigurationen<br> + Benutzen Sie die Navigation links, um die einzelnen Verwaltungsbereiche anzusteuern:</p> + <ul> + <li><p><b>Rechner</b></p> + Hier verwalten Sie ihre Rechner (anlegen, bearbeiten, löschen), und können zu dem + einige Hardware-Parameter festlegen. Daneben verwalten Sie hier rechner-spezifische + Computer-Profile (MachineConfig) und PXE Boot Konfigurationen. + </li> + <li><p><b>Rechnergruppen</b></p> + Hier verwalten Sie die Rechnergruppen (anlegen, bearbeiten, löschen), sowie + ihre gemeinsamen Hardware-Parameter. Daneben verwalten Sie hier gruppen-spezifische + Computer-Profile (MachineConfig) und PXE Boot Konfigurationen. + </li> + <li><p><b>Default MachineConfig</b></p> + Hier verwalten Sie ihre Default Computer-Profile (bearbeiten, löschen, kopieren), + d.h. Computer-Profile, die beim booten von Rechnern verwendet werden, für die + keine rechner- oder gruppen-spezifischen MachineConfigs angelegt sind. + </li> + <li><p><b>Neue MachineConfig</b></p> + Hier köennen Sie neue Computer-Profile (MachineConfigs) als rechner-, gruppen- + spezifische, oder Default MachineConfigs anlegen. + </li> + <li><p><b>Neues PXE Bootmenü</b></p> + Hier können Sie neue PXE Bootmenüs (PXEConfigs) für ihre Rechner oder + Rechnergruppen anlegen. + </li> + </ul> + + </td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/delete_confirm.php b/ldap-site-mngmt/webinterface/computers/delete_confirm.php new file mode 100644 index 00000000..c3f2bc8b --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/delete_confirm.php @@ -0,0 +1,39 @@ +<?php +include('../standard_header.inc.php'); + +$dn = $_POST['dn']; +$name = $_POST['name']; +$delurl = $_POST['delurl']; +$backurl = $_POST['backurl']; +$successurl = $_POST['successurl']; + +$pxedn = $_POST['pxedn']; +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> + <tr> + <td> + Wollen Sie das Objekt <b>".$name."</b> wirklich löschen?<br><br> + <form action='".$delurl."' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$dn."'> + <input type='hidden' name='name' value='".$name."'> + <input type='hidden' name='successurl' value='".$successurl."'> + <input type='hidden' name='pxedn' value='".$pxedn."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$backurl."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form> + </td> + </tr> +</table> +</body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/dhcphost.dwt b/ldap-site-mngmt/webinterface/computers/dhcphost.dwt new file mode 100644 index 00000000..8ab5c7af --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/dhcphost.dwt @@ -0,0 +1,84 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='4'><h3>Rechner <code class='font_object'> {HOSTNAME} </code> </h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 1;'><h4>{HOSTLINK} Allgemein </a></h4></td> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 0;'><h4><code class='font_object'>DHCP/RBS</code></h4></td> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 0;'><h4>{HWLINK} Hardware </a></h4></td> + <td> </td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td colspan='4'> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='dhcphost_change.php' method='post'> + + <tr> + <td width='25%' class='tab_h'><h4><b>DHCP Setup</b></h4></td> + <td width='25%' class='tab_h'><b> </b></td> + <td width='50%' class='tab_h'><b> </b></td> + </tr> + + <tr valign='top'> + <td class='tab_d_ohne' colspan='2'><b>Eingebunden in DHCP Dienst: </b> </td> + <td class='tab_d_ohne'> + {DHCPCONT} <br></td> + <td class='tab_d'> + <select name='dhcpcont' size='4' class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Altdhcp --> + <option value='{ALTDN}'>{ALTCN}{ALTAU}</option> + <!-- END DYNAMIC BLOCK: Altdhcp --> + + <option value=''>Kein DHCP</option> + + </select> + </td> + </tr> + + {HOST_DHCPOPT} + + </table></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td colspan='4'> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='35%' class='tab_h'><h4><b>PXE/TFTP Setup</b></h4></td> + <td width='65%' class='tab_h'><b> </b></td> + </tr> + + <tr valign='top'> + + {RBS} + + </tr> + {RBS_DHCPOPT} + + </table></td> + </tr> + + <input type='hidden' name='olddhcp' value='{OLDDHCP}'> + <input type='hidden' name='oldfixadd' value='{OLDFIXADD}'> + <input type='hidden' name='oldrbs' value='{OLDRBS}'> + <input type='hidden' name='hostip' value='{IPADDRESS}'> + <input type='hidden' name='hostdn' value='{HOSTDN}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + + <tr> + <td colspan='4'><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/dhcphost.php b/ldap-site-mngmt/webinterface/computers/dhcphost.php new file mode 100644 index 00000000..5267157c --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/dhcphost.php @@ -0,0 +1,278 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "dhcphost.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$hostDN = $_GET['dn']; + +# Rechner Daten +$attributes = array("hostname","domainname","ipaddress","hwaddress","description","hlprbservice", + "dhcphlpcont","dhcpoptfixed-address","dhcpopthardware","dhcpoptfilename", + "dhcpoptnext-server","hw-mouse","hw-graphic","hw-monitor"); +$host = get_node_data($hostDN,$attributes); +$hostip = explode('_',$host['ipaddress']); +# print_r($hostip); echo "<br><br>"; +$dhcphlpcont = $host['dhcphlpcont']; +$objectDN = $dhcphlpcont; +$rbsDN = $host['hlprbservice']; + +$rbs_dhcpopt = ""; +$host_dhcpopt = ""; + +# DHCP Daten +if ($dhcphlpcont == ""){ + $dhcp = "Rechner ist in keinem DHCP Dienst angemeldet<br></td></tr> + <tr valign='top'><td class='tab_d' colspan='2'> + DHCP Dienst auswählen: "; + $objecttype = "nodhcp"; + $rbs = "<td class='tab_d_ohne' colspan='2'> + Sie müssen den Rechner zuerst in einem DHCP Dienst anmelden, bevor Sie ihn + einem Remote Boot Dienst zuordnen können <br>(DHCP Optionen!!).<br></td> + </tr> + <input type='hidden' name='rbs' value='".$rbsDN."'>"; +}else{ + # Subnet? + $objecttype = "service"; + $dhcp = ""; + $ocarray = get_node_data($dhcphlpcont,array("objectclass","dhcphlpcont")); + #print_r($ocarray); echo "<br>"; + $sub = array_search('dhcpSubnet', $ocarray['objectclass']); + #print_r($sub); + if ($sub !== false ){ + $objecttype = "subnet"; + $exp0 = explode(',',$dhcphlpcont); + $expsub = explode('=',$exp0[0]); $dhcpsub = $expsub[1]; + $dhcp .= "Subnet <b>".$dhcpsub."</b> / "; + $dhcphlpcont = $ocarray['dhcphlpcont']; + } + $exp1 = explode(',',$dhcphlpcont); + $expdhcp = explode('=',$exp1[0]); $dhcpserv = $expdhcp[1]; + $expdhcpau = explode('=',$exp1[2]); $dhcpau = $expdhcpau[1]; + $dhcp .= "Service <b>".$dhcpserv."</b> / AU <b>".$dhcpau."</b><br></td></tr> + <tr valign='top'><td class='tab_d' colspan='2'> + DHCP Dienst ändern: "; + + + $fixedaddselopt = "<option selected value='none'>------------</option>"; + switch ( $host['dhcpoptfixed-address'] ){ + case "": + $fixedaddress = "<b> - </b> <br>(dynamische Vergabe)"; + if ( $hostip[0] != "" ){ + $fixedaddselopt .= "<option value='ip'>".$hostip[0]." (IP Adresse)</option>"; + } + $fixedaddselopt .= "<option value='hostname'>".$host['hostname']." (Hostname)</option>"; + break; + case "ip": + $fixedaddress = "<b>".$hostip[0]."</b><br>(Fixe IP Adresse)"; + $fixedaddselopt .= "<option value='hostname'>".$host['hostname']." (Hostname)</option> + <option value=''>kein Eintrag (dynamische IP Vergabe)</option>"; + break; + case "hostname": + $fixedaddress = "<b>".$host['hostname']."</b><br>(Fixe IP Adresse über Hostnamen aufgelöst)"; + if ( $hostip[0] != "" ){ + $fixedaddselopt .= "<option value='ip'>".$hostip[0]." (IP Adresse)</option>"; + } + $fixedaddselopt .= "<option value=''>kein Eintrag (dynamisch)</option>"; + break; + } + + + $host_dhcpopt = "<tr><td class='tab_d_ohne' colspan='2'><b>DHCP Optionen:</b></td></tr> + <tr valign='top'> + <td class='tab_d_ohne'><b>hardware ethernet: </b> </td> + <td class='tab_d_ohne'><b>".$host['hwaddress']."</b> </td> + <td class='tab_d_ohne'> </td> + </tr> + <tr valign='top'> + <td class='tab_d'><b>fixed-address:</b> </td> + <td class='tab_d'>".$fixedaddress." </td> + <td class='tab_d'> + <select name='fixadd' size='3' class='medium_form_selectbox'> + ".$fixedaddselopt." + </select> + </td> + </tr>"; + + ########################################################### + # RBS Setup + $rbs_selectbox = ""; + $rbs_dhcpopt = ""; + $altrbs = alternative_rbservices($rbsDN); + + if (count($altrbs) != 0){ + $rbs_selectbox .= "<td class='tab_d'> + <select name='rbs' size='4' class='medium_form_selectbox'> + <option selected value='none'>----------</option>"; + + foreach ($altrbs as $item){ + $rbs_selectbox .= " + <option value='".$item['dn']."'>".$item['cn']." ".$item['au']."</option>"; + } + $rbs_selectbox .= "<option value=''>Kein RBS</option> + </select></td>"; + } + + # RBS Daten + if ($rbsDN == ""){ + + $rbs = "<td class='tab_d_ohne'><b>Remote Boot Dienst: </b> </td> + <td class='tab_d_ohne'> + Rechner ist in keinem Remote Boot Dienst angemeldet<br></td></tr> + <tr valign='top'><td class='tab_d'> + RBS auswählen: <br></td>".$rbs_selectbox; + }else{ + + $rbs = ""; + $rbsdata = get_node_data($rbsDN,array("tftpserverip")); + #print_r($rbsdata); echo "<br>"; + $exp2 = explode(',',$host['hlprbservice']); + $exprbs = explode('=',$exp2[0]); $rbserv = $exprbs[1]; + $exprbsau = explode('=',$exp2[2]); $rbsau = $exprbsau[1]; + $rbs .= "<td class='tab_d_ohne'><b>Remote Boot Dienst: </b> </td> + <td class='tab_d_ohne'> + Remote Boot Service <b>".$rbserv."</b> / AU <b>".$rbsau."</b><br> + TFTP (Boot) Server: <b>".$rbsdata['tftpserverip']."</b><br></td></tr> + <tr valign='top'><td class='tab_d'> + RBS ändern: <br></td>".$rbs_selectbox; + + $rbs_dhcpopt = "<tr><td class='tab_d_ohne' colspan='2'><b>DHCP Optionen:</b></td></tr> + <tr> + <td class='tab_d_ohne'><b>next-server</b> (TFTP Server):</td> + <td class='tab_d_ohne'>".$host['dhcpoptnext-server']." </td> + </tr> + <tr> + <td class='tab_d'><b>filename</b> (initiale remote Bootdatei):</td> + <td class='tab_d'>".$host['dhcpoptfilename']." </td> + </tr>"; + } + +} + +$template->assign(array("HOSTDN" => $hostDN, + "HOSTNAME" => $host['hostname'], + "DOMAINNAME" => $host['domainname'], + "HWADDRESS" => $host['hwaddress'], + "IPADDRESS" => $hostip[0], + "DESCRIPTION" => $host['description'], + "OLDDHCP" => $objectDN, + "OLDFIXADD" => $host['dhcpoptfixed-address'], + "OLDRBS" => $rbsDN, + "DHCPCONT" => $dhcp, + "HOST_DHCPOPT" => $host_dhcpopt, + "RBS" => $rbs, + "RBS_DHCPOPT" => $rbs_dhcpopt, + "NEXTSERVER" => $host['dhcpoptnext-server'], + "FILENAME" => $host['dhcpoptfilename'], + "HOSTLINK" => "<a href='host.php?dn=".$hostDN."&sbmnr=".$sbmnr."' class='headerlink'>", + "HWLINK" => "<a href='hwhost.php?dn=".$hostDN."&sbmnr=".$sbmnr."' class='headerlink'>", + "AUDN" => $auDN, + "SBMNR" => $sbmnr)); + + +########################################################## +# DHCP Setup + +$altdhcp = alternative_dhcpobjects($objecttype,$objectDN,$hostip[0]); +#echo "<br><br>";print_r($altdhcp); + +$template->assign(array("ALTDN" => "", + "ALTCN" => "", + "ALTAU" => "")); +if (count($altdhcp) != 0){ +$template->define_dynamic("Altdhcp", "Webseite"); + foreach ($altdhcp as $item){ + + $template->assign(array("ALTDN" => $item['dn'], + "ALTCN" => $item['cn'], + "ALTAU" => $item['au'],)); + $template->parse("ALTDHCP_LIST", ".Altdhcp"); + } +} + + +########################################################### +# RBS Setup + +/*$altrbs = alternative_rbservices($rbsDN); +#print_r($altrbs); echo "<br><br>"; +$template->assign(array("ALTRBSDN" => "", + "ALTRBSCN" => "", + "ALTRBSAU" => "")); +if (count($altrbs) != 0){ +$template->define_dynamic("Altrbs", "Webseite"); + foreach ($altrbs as $item){ + $template->assign(array("ALTRBSDN" => $item['dn'], + "ALTRBSCN" => $item['cn'], + "ALTRBSAU" => $item['au'],)); + $template->parse("ALTRBS_LIST", ".Altrbs"); + } +}*/ + + +################################################################################### + +include("computers_footer.inc.php"); + + + +/* +<tr height='50'> + <td class='tab_d'><b>DHCP Option hardware ethernet: </b> </td> + <td class='tab_d'>{HWADDRESS} + </td> + </tr> + <tr height='50'> + <td class='tab_d'><b>DHCP Option fixed-address: </td> + <td class='tab_d'>{IPADDRESS} + </td> + </tr> + +<td class='tab_d'> + <select name='rbs' size='4' class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Altrbs --> + <option value='{ALTRBSDN}'>{ALTRBSCN} {ALTRBSAU}</option> + <!-- END DYNAMIC BLOCK: Altrbs --> + + <option value=''>Kein RBS</option> + + </select> + </td> + <tr height='50'> + <td class='tab_d'><b>TFTP Server <br>DHCP Option next-server: </b> </td> + <td class='tab_d'>{NEXTSERVER} + </td> + </tr> + <tr height='50'> + <td class='tab_d'><b>PXE initiale Bootdatei <br>DHCP Option filename: </b> </td> + <td class='tab_d'>{FILENAME} + </td> + </tr> + + + */ +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/dhcphost_change.php b/ldap-site-mngmt/webinterface/computers/dhcphost_change.php new file mode 100644 index 00000000..907fae8f --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/dhcphost_change.php @@ -0,0 +1,177 @@ +<?php +include('../standard_header.inc.php'); + +$syntax = new Syntaxcheck; + +$dhcp = $_POST['dhcpcont']; +$olddhcp = $_POST['olddhcp']; +$hostip = $_POST['hostip']; +$fixedaddress = $_POST['fixadd']; +$oldfixedaddress = $_POST['oldfixadd']; + +$rbs = $_POST['rbs']; +$oldrbs = $_POST['oldrbs']; + +$hostDN = $_POST['hostdn']; +$sbmnr = $_POST['sbmnr']; + +$dhcp = htmlentities($dhcp); +$olddhcp = htmlentities($olddhcp); +$rbs = htmlentities($rbs); +$oldrbs = htmlentities($oldrbs); + + +/*echo "new dhcp:"; print_r($dhcp); echo "<br>"; +echo "old dhcp:"; print_r($olddhcp); echo "<br>"; +echo "new rbs:"; print_r($rbs); echo "<br>"; +echo "old rbs:"; print_r($oldrbs); echo "<br>"; +echo "Host DN:"; print_r($hostDN); echo "<br>"; +echo "submenuNR:"; print_r($sbmnr); echo "<br><br>";*/ + + +$seconds = 40; +$url = 'dhcphost.php?dn='.$hostDN.'&sbmnr='.$sbmnr; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +########################################## +# DHCP + +if ($dhcp != "none" && $dhcp != $olddhcp){ + if ($dhcp != ""){ + $exp = ldap_explode_dn($dhcp, 1); + $dhcpcn = $exp[0]; + $dhcpau = $exp[2]; + + $entrydhcp ['dhcphlpcont'] = $dhcp; + if ($olddhcp != ""){ + echo "DHCP replace "; print_r($olddhcp); echo " with "; print_r($entrydhcp); echo "<br>"; + if ($result = ldap_mod_replace($ds,$hostDN,$entrydhcp)){ + $mesg = "Rechner erfolgreich in DHCP <b>".$dhcpcn." [Abt.: ".$dhcpau."]</b> angemeldet<br><br>"; + }else{ + $mesg = "Fehler beim ändern des DHCP Dienstes zu <b>".$dhcpcn."</b>!<br><br>"; + } + }else{ + if ( $hostip != "" ){ + $entrydhcp ['dhcpoptfixed-address'] = "ip"; + } + echo "DHCP add "; print_r($entrydhcp); echo "<br>"; + if ($result = ldap_mod_add($ds,$hostDN,$entrydhcp)){ + $mesg = "Rechner erfolgreich in DHCP <b>".$dhcpcn." [Abt.: ".$dhcpau."]</b> angemeldet<br><br>"; + }else{ + $mesg = "Fehler beim ändern des DHCP Dienstes zu <b>".$dhcpcn."</b>!<br><br>"; + } + } + }else{ + $entrydhcp ['dhcphlpcont'] = array(); + if ( $fixedaddress != "" ){ + $entrydhcp ['dhcpoptfixed-address'] = array(); + } + echo "DHCP delete "; echo "<br>"; + if ($result = ldap_mod_del($ds,$hostDN,$entrydhcp)){ + $mesg = "Rechner erfolgreich aus DHCP gelöscht<br><br>"; + }else{ + $mesg = "Fehler beim löschen aus DHCP Dienst!<br><br>"; + } + } + +} +if ($dhcp == "none"){ + echo " DHCP none <br>"; +} + +# DHCP Option fixed-address +if ($fixedaddress != "none" && $fixedaddress != $oldfixedaddress){ + if ($fixedaddress != ""){ + $entryfixadd ['dhcpoptfixed-address'] = $fixedaddress; + if ($oldfixedaddress != ""){ + echo "Fixed Address ändern"; echo "<br>"; + if ($result = ldap_mod_replace($ds,$hostDN,$entryfixadd)){ + $mesg = "Option Fixed-Address erfolgreich auf <b>".$fixedaddress."</b> geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern der Option Fixed-Address auf <b>".$fixedaddress."</b>!<br><br>"; + } + }else{ + echo "Fixed Address auf IP Adresse setzen"; echo "<br>"; + if ($result = ldap_mod_add($ds,$hostDN,$entryfixadd)){ + $mesg = "Option Fixed-Address erfolgreich auf <b>".$fixedaddress."</b> gesetzt<br><br>"; + }else{ + $mesg = "Fehler beim setzen der Option Fixed-Address auf <b>".$fixedaddress."</b>!<br><br>"; + } + } + }else{ + $entryfixadd ['dhcpoptfixed-address'] = array(); + echo "No Fixed Address"; echo "<br>"; + if ($result = ldap_mod_del($ds,$hostDN,$entryfixadd)){ + $mesg = "Option Fixed-Address erfolgreich gelöscht<br><br>"; + }else{ + $mesg = "Fehler beim löschen der Option Fixed-Address!<br><br>"; + } + } +} + + +########################################## +# RBS + +if ($rbs != "none" && $rbs != $oldrbs){ + if ($rbs != ""){ + $exp = ldap_explode_dn($rbs, 1); + $rbscn = $exp[0]; + $rbsau = $exp[2]; + + $dhcpdata = get_node_data($rbs,array("tftpserverip","initbootfile")); + $entryrbs ['hlprbservice'] = $rbs; + $entryrbs ['dhcpoptnext-server'] = $dhcpdata['tftpserverip']; + $entryrbs ['dhcpoptfilename'] = $dhcpdata['initbootfile']; + if ($oldrbs != ""){ + echo "RBS replace "; print_r($oldrbs); echo " with "; print_r($entryrbs); echo "<br>"; + if ($result = ldap_mod_replace($ds,$hostDN,$entryrbs)){ + rbs_adjust_host($hostDN, $rbs); + $mesg = "Remote Boot Service erfolgreich zu <b>".$rbscn." [Abt.: ".$rbsau."]</b> geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern des Remote Boot Services zu <b>".$rbscn."</b>!<br><br>"; + } + }else{ + echo "RBS add "; print_r($entryrbs); echo "<br>"; + if ($result = ldap_mod_add($ds,$hostDN,$entryrbs)){ + rbs_adjust_host($hostDN, $rbs); + $mesg = "Remote Boot Service erfolgreich zu <b>".$rbscn." [Abt.: ".$rbsau."]</b> geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern des Remote Boot Services zu <b>".$rbscn."</b>!<br><br>"; + } + } + }else{ + $entryrbs ['hlprbservice'] = array(); + $entryrbs ['dhcpoptnext-server'] = array(); + $entryrbs ['dhcpoptfilename'] = array(); + echo "RBS delete "; echo "<br>"; + if ($result = ldap_mod_del($ds,$hostDN,$entryrbs)){ + $mesg = "Rechner erfolgreich aus RBS gelöscht<br><br>"; + }else{ + $mesg = "Fehler beim löschen aus RBS!<br><br>"; + } + } +} +if ($rbs == "none"){ + echo "RBS none <br>"; +} + + +##################### + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/group.dwt b/ldap-site-mngmt/webinterface/computers/group.dwt new file mode 100644 index 00000000..cda53f18 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/group.dwt @@ -0,0 +1,397 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Daten bearbeiten Gruppe <code class='font_object'>{GROUPCN}</code> </h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='group_change.php' method='post'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Gruppenname (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='groupcn' value='{GROUPCN}' size='40' class='medium_form_field'> + <input type='hidden' name='oldgroupcn' value='{GROUPCN}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Beschreibung: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='groupdesc' value='{GROUPDESC}' size='40' class='medium_form_field'> + <input type='hidden' name='oldgroupdesc' value='{GROUPDESC}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Gruppen-Rechner:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + + <b>Aktuelle Mitglieder</b> (zum Löschen bitte Häkchen setzen):<br> + <!-- BEGIN DYNAMIC BLOCK: Members --> + <input type='checkbox' name='delmember[]' value='{MEMBERDN}' size='40' class='medium_form_field'> {MEMBER}<br> + <!-- END DYNAMIC BLOCK: Members --> + <br> + + <b>Als neues Mitglied aufnehmen</b> (Mehrfachauswahl möglich)<br> + <select name='addmember[]' size='{HOSTNUMBER}' multiple class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Hosts --> + <option value='{HDN}_{HN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: Hosts --> + + </select> + </td> + </tr> + + + <input type='hidden' name='groupdn' value='{GROUPDN}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + + <tr> + <td colspan='2'><h4>Gruppe - <code class='font_object'>{GROUPCN}</code> - löschen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='delete_confirm.php' method='post'> + + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Die Rechnergruppe wird komplett gelöscht, <br>d.h. inklusive aller spezifisch für sie angelegten + Hardware-Profile (MachineConfig) und PXE Bootmenüs. + </tr> + + <input type='hidden' name='dn' value='{GROUPDN}'> + <input type='hidden' name='name' value='{GROUPCN}'> + <input type='hidden' name='delurl' value='group_delete.php'> + <input type='hidden' name='backurl' value='group.php?dn={GROUPDN}&sbmnr={SBMNR}'> + + + </table></td> + </tr> + <tr> + <td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td> + </tr> + + + <tr> + <td height='50'></td> + </tr> + + <tr> + <td colspan='2'><h4>Wochen Übersicht Machine Configs Gruppe <code class='font_object'>{GROUPCN}</code> :</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='0' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr align='center'> + <td width='9%' style='border-color: black; border-style: solid; border-width: 2 0 2 2;'><b>Uhrzeit</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Montag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Dienstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Mittwoch</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Donnerstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Freitag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Samstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 2 2 1;'><b>Sonntag</b></td> + </tr> + <tr heigth='2' align='center'> + <td width='9%' style='border-color: black; border-style: solid; border-width: 0 0 0 2;'>0</td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G0}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G1}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>2</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G2}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G3}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>4</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G4}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G5}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>6</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G6}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G7}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>8</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G8}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G9}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>10</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G10}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G11}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>12</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G12}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G13}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>14</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G14}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G15}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>16</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G16}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G17}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>18</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G18}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G19}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>20</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G20}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G21}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>22</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G22}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{A23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{B23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{C23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{D23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{E23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{F23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 2 1;{G23}'> </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='10'></td> + </tr> + <tr> + <td colspan='2'><h4>Legende:</h4></td> + </tr> + <tr><td> + <table cellpadding='3' cellspacing='3' border='1' align='left' width='50%' style='border-width: 0 0 0 0;'> + <tr> + <td width='65%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Machine Config</b></td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Farbe</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>Keine Konfiguration </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 1 1 1;'> </td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Legende --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>{DESCRIPTION} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 1 1 1;background-color:{COLOR};'> </td> + </tr> + <!-- END DYNAMIC BLOCK: Legende --> + + </table></td> + </tr> + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/group.php b/ldap-site-mngmt/webinterface/computers/group.php new file mode 100644 index 00000000..13819e62 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/group.php @@ -0,0 +1,120 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 2; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "group.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$groupDN = $_GET['dn']; + +$group = get_node_data($groupDN,array("cn","description","member","dhcphlpcont")); + +$template->assign(array("GROUPDN" => $groupDN, + "GROUPCN" => $group['cn'], + "GROUPDESC" => $group['description'], + # "MEMBERS" => $anzahlmember, + "MEMBER" => $group['member'], + "DHCPCONT" => $group['dhcphlpcont'], + "AUDN" => $auDN, + "SBMNR" => $sbmnr)); + +$template->define_dynamic("Members", "Webseite"); + +if ( count($group['member']) == 1 ){ + $member = $group['member']; + $group = array(); + $group['member'][] = $member; +} + +if ( count($group['member']) != 0 ){ + sort($group['member']); + foreach ($group['member'] as $member){ + $exp = explode(',',$member); + $memberexp = explode('=',$exp[0]); + $membername = $memberexp[1]; + $template->assign(array("MEMBERDN" => $member, + "MEMBER" => $membername)); + $template->parse("MEMBERS_LIST", ".Members"); + } +} + +############################################## +# neues Member anlegen ... +$hosts_array = get_hosts($auDN,array("dn","hostname")); +# print_r($hosts_array); echo "<br><br>"; +$groups = get_groups($auDN, array("member")); +$template->assign(array("HN" => "")); + +foreach ($groups as $group){ + for ($i=0; $i < count($hosts_array); $i++){ + if (count($group['member']) > 1){ + foreach ($group['member'] as $item){ + if ($hosts_array[$i]['dn'] == $item){ + array_splice($hosts_array, $i, 1); + $i--; # da ja ein Member gelöscht wurde + } + } + } + if (count($group['member']) == 1){ + if ($hosts_array[$i]['dn'] == $group['member']){ + array_splice($hosts_array, $i, 1); + } + } + } +} +#print_r($hosts_array);echo"<br>"; + +$template->define_dynamic("Hosts", "Webseite"); +foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'], + "HOSTNUMBER" => 5)); + $template->parse("HOSTS_LIST", ".Hosts"); +} + + +########################################################## +# MC Wochenübersicht +$mc_array = get_machineconfigs($groupDN,array("dn","cn","timerange","description")); +# print_r($mc_array); +for ($i=0; $i<count($mc_array); $i++){ + # Timerange Komponenten + if (count($mc_array[$i]['timerange']) > 1 ){ + foreach ($mc_array[$i]['timerange'] as $tr){ + $exptime = array_merge(explode('_',$tr),$mc_array[$i]['description']); + $timeranges[$i][] = $exptime; # Für grafische Wo-Ansicht + } + }else{ + $exptime = array_merge(explode('_',$mc_array[$i]['timerange']), $mc_array[$i]['description']); + $timeranges[$i] = $exptime; # Für grafische Wo-Ansicht + } +} +include("mc_wochenplan.php"); + + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/group_add.php b/ldap-site-mngmt/webinterface/computers/group_add.php new file mode 100644 index 00000000..dfc7fbe7 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/group_add.php @@ -0,0 +1,84 @@ +<?php +include('../standard_header.inc.php'); + +$groupcn = $_POST['groupcn']; +$groupdesc = $_POST['groupdesc']; +$addmember = $_POST['addmember']; + +$groupcn = htmlentities($groupcn); +$groupdesc = htmlentities($groupdesc); + +/* +echo "AU dn:"; print_r($auDN); echo "<br>"; +echo "groupcn:"; print_r($groupcn); echo "<br>"; +echo "groupdesc:"; print_r($groupdesc); echo "<br>"; +echo "members to add:"; print_r($addmember); echo "<br>"; +*/ + +$seconds = 2; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if ( $groupcn != ""){ + + # Formulareingaben anpassen + $expgr = explode(" ",$groupcn); + foreach ($expgr as $word){$expuc[] = ucfirst($word);} + $groupcn = implode(" ",$expuc); + $groupcn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $groupcn); + + # Host Objekt anlegen + $brothers = get_hosts($auDN,array("groupcn")); + $brother = 0; + foreach ($brothers as $item){ + if( $item['groupcn'] == $groupcn ){ + $mesg = "Es existiert bereits eine Gruppe mit dem eingegebenen Namen (CN)!<br> + Bitte geben Sie einen anderen Namen (CN) ein.<br><br>"; + $get_groupdesc = str_replace ( " ", "_", $groupdesc ); + $url = "new_group.php?groupcn=Hier_anderen_CN_eingeben&groupdesc=".$get_groupdesc; + $brother = 1; + break; + } + } + if ($brother == 0){ + $groupDN = "cn=".$groupcn.",cn=groups,".$auDN; + # print_r($groupDN); echo "<br>"; + + if (add_group($groupDN,$groupcn,$groupdesc,$addmember)){ + $mesg .= "<br>Neue Rechnergruppe erfolgreich angelegt<br>"; + } + else{ + $mesg .= "<br>Fehler beim anlegen der Rechnergruppe!<br>"; + } + + $url = 'groupoverview.php'; + } +} + + +elseif ( $groupcn == ""){ + + $get_groupdesc = str_replace ( " ", "_", $groupdesc ); + $mesg = "Sie haben den CN der neuen Gruppe nicht angegeben. Dieser ist aber ein notwendiges Attribut.<br> + Bitte geben Sie ihn an.<br><br>"; + $url = "new_group.php?ou=Hier_CN_eingeben&groupdesc=".$get_groupdesc; +} + + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/group_change.php b/ldap-site-mngmt/webinterface/computers/group_change.php new file mode 100644 index 00000000..cb26a429 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/group_change.php @@ -0,0 +1,252 @@ +<?php +include('../standard_header.inc.php'); + +$groupcn = $_POST['groupcn']; +$oldgroupcn = $_POST['oldgroupcn']; +$groupdesc = $_POST['groupdesc']; +$oldgroupdesc = $_POST['oldgroupdesc']; + +$delmember = $_POST['delmember']; + +$addmember = $_POST['addmember']; +$n = array_search('none',$addmember); +if ($n === 0 ){array_splice($addmember, $n, 1);} + +$groupDN = $_POST['groupdn']; +$sbmnr = $_POST['sbmnr']; + +$syntax = new Syntaxcheck; + +$groupcn = htmlentities($groupcn); +$oldgroupcn = htmlentities($oldgroupcn); +$groupdesc = htmlentities($groupdesc); +$oldgroupdesc = htmlentities($oldgroupdesc); + +/* +echo "new groupcn:"; print_r($groupcn); echo "<br>"; +echo "old groupcn:"; print_r($oldgroupcn); echo "<br>"; +echo "new groupdesc:"; print_r($groupdesc); echo "<br>"; +echo "old groupdesc:"; print_r($oldgroupdesc); echo "<br><br>"; + +echo "members to delete:"; print_r($delmember); echo "<br><br>"; +echo "members to add:"; print_r($addmember); echo "<br><br>"; + +echo "Group DN:"; print_r($groupDN); echo "<br>"; +echo "submenuNR:"; print_r($submenu); echo "<br><br>"; +*/ + +$seconds = 2; +$url = 'group.php?dn='.$groupDN.'&sbmnr='.$sbmnr; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +############################################## +# CN (DN) + +if ( $oldgroupcn == $groupcn ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldgroupcn != "" && $groupcn != "" && $oldgroupcn != $groupcn ){ + echo "Gruppenname aendern<br>"; + # hier noch Syntaxcheck + # Formulareingaben anpassen + $expgr = explode(" ",$groupcn); + foreach ($expgr as $word){$expuc[] = ucfirst($word);} + $groupcn = implode(" ",$expuc); + $groupcn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $groupcn); + + + $newgroupDN = "cn=".$groupcn.",cn=groups,".$auDN; + print_r($newgroupDN); echo "<br><br>"; + + modify_group_dn($groupDN, $newgroupDN); + + # newsubmenu holen... + $url = 'group.php?dn='.$newgroupDN.'&sbmnr='.$sbmnr; +} + +if ( $oldgroupcn != "" && $groupcn == "" ){ + echo "Gruppenname loeschen!<br> + Dieses ist Teil des DN, Sie werden die Gruppe komplett löschen<br><br>"; + echo "Wollen Sie die Gruppe <b>".$oldgroupcn."</b>mit seinen Hardware-Profilen (MachineConfigs) + und PXE Bootmenüs wirklich löschen?<br><br> + <form action='group_delete.php' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$groupDN."'> + <input type='hidden' name='name' value='".$oldgroupcn."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$url."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form>"; + $seconds = 600; +} + + +######################################## +# Member löschen/aufnehmen + +if ( count($delmember) == 0 || count($addmember) == 0 ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( count($delmember) != 0 ){ + echo "Gruppen-Mitglieder löschen<br>"; + # hier noch Syntaxcheck + # print_r($delmember); echo "<br><br>"; + + $i = 0; + foreach ($delmember as $member){ + $entry['member'][$i] = $member; + $i++; + } + #print_r($entry); echo "<br><br>"; + + if ($result = ldap_mod_del($ds,$groupDN,$entry)){ + # Fehler hier muessen die verbliebenen Members hin!!! + # Filenames in PXEs die an der Gruppe hängen anpassen + $pxes = get_pxeconfigs($groupDN,array("dn")); + foreach ($pxes as $pxe){ + if ( $entry['member'] > 1 ){ + $j = 0; + foreach ($entry['member'] as $host){ + $macdata = get_node_data($host, array("hwaddress")); + $entryfilename ['filename'][$j] = "01-".$macdata['hwaddress']; + $j++; + } + } + if ( $entry['member'] == 1 ){ + $macdata = get_node_data($entry['member'], array("hwaddress")); + $entryfilename ['filename'] = "01-".$macdata['hwaddress']; + } + ldap_mod_del($ds,$pxe['dn'],$entryfilename); + } + $mesg = "Gruppen-Mitglieder erfolgreich gelöscht<br><br>"; + }else{ + $mesg = "Fehler beim löschen der Gruppen-Mitglieder<br><br>"; + } +} + +if ( count($addmember) != 0 ){ + + echo "Gruppen-Mitglieder anlegen<br>"; + # hier noch Syntaxcheck + $members = get_node_data($groupDN,array("member")); + if ( count($members['member']) == 1 ){ + $member = $members['member']; + $members = array(); + $members['member'][] = $member; + } + if (count($members['member']) != 0){ + foreach ($members['member'] as $member){ + $entry2['member'][] = $member; + } + } + $i = 0; + foreach ($addmember as $member){ + $exp = explode('_',$member); + # Falls ein neues Mitglied keine MAC hat und an der Gruppe PXEs hängen + # dann wird diese nicht aufgenommen ... + $macdata = get_node_data($exp[0], array("hwaddress")); + $pxes = get_pxeconfigs($groupDN,array("dn","filename")); + if ( count($pxes) != 0 && $macdata['hwaddress'] == "" ){ + echo "Rechner ".$exp[1]." hat keine MAC Adresse eingetragen. <br> + Fü die Gruppe sind PXE Bootmenüs definiert. <br> + Da MACs für die PXE Datei notwendig ist wird der Rechner nicht aufgenommen!"; + } + else{ + $entry2['member'][] = $exp[0]; + } + $i++; + + } + + #print_r($entry2); echo "<br><br>"; + + if ($result = ldap_mod_replace($ds, $groupDN, $entry2)){ + + # PXEs die an der Gruppe hängen anpassen + $pxes = get_pxeconfigs($groupDN,array("dn")); + foreach ($pxes as $pxe){ + if ( $entry2['member'] > 1 ){ + $j = 0; + foreach ($entry2['member'] as $host){ + $macdata = get_node_data($host, array("hwaddress")); + $entryfilename ['filename'][$j] = "01-".$macdata['hwaddress']; + $j++; + } + } + if ( $entry2['member'] == 1 ){ + $macdata = get_node_data($entry2['member'], array("hwaddress")); + $entryfilename ['filename'] = "01-".$macdata['hwaddress']; + } + ldap_mod_replace($ds,$pxe['dn'],$entryfilename); + } + $mesg = "Gruppen-Mitglieder erfolgreich angelegt<br><br>"; + }else{ + $mesg = "Fehler beim anlegen der Gruppen-Mitglieder<br><br>"; + } +} + + +##################################### +# Description + +if ( $oldgroupdesc == $groupdesc ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldgroupdesc == "" && $groupdesc != "" ){ + echo "Gruppen-Beschreibung neu anlegen<br>"; + # hier noch Syntaxcheck + $entry['description'] = $groupdesc; + if($result = ldap_mod_add($ds,$groupDN,$entry)){ + $mesg = "Gruppen-Beschreibung erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der Gruppen-Beschreibung<br><br>"; + } +} + +if ( $oldgroupdesc != "" && $groupdesc != "" && $oldgroupdesc != $groupdesc ){ + echo "Gruppen-Beschreibung aendern<br>"; + # hier noch Syntaxcheck + $entry['description'] = $groupdesc; + if($result = ldap_mod_replace($ds,$groupDN,$entry)){ + $mesg = "Gruppen-Beschreibung erfolgreich geaendert<br><br>"; + }else{ + $mesg = "Fehler beim aendern der Gruppen-Beschreibung<br><br>"; + } +} + +if ( $oldgroupdesc != "" && $groupdesc == "" ){ + echo "Gruppen-Beschreibung loeschen<br>"; + # hier noch Syntaxcheck + $entry['description'] = $oldgroupdesc; + if($result = ldap_mod_del($ds,$groupDN,$entry)){ + $mesg = "Gruppen-Beschreibung erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der Gruppen-Beschreibung<br><br>"; + } +} + + + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/group_delete.php b/ldap-site-mngmt/webinterface/computers/group_delete.php new file mode 100644 index 00000000..2a7e3d29 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/group_delete.php @@ -0,0 +1,47 @@ +<?php +include('../standard_header.inc.php'); + +$groupDN = $_POST['dn']; +$groupcn = $_POST['name']; +$groupDN = htmlentities($groupDN); +$groupcn = htmlentities($groupcn); + +/* +echo "AU dn:"; print_r($auDN); echo "<br>"; +echo "groupdn:"; print_r($groupDN); echo "<br>"; +echo "groupcn:"; print_r($groupcn); echo "<br>"; +*/ + +$seconds = 1; +$url = 'groupoverview.php'; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if ( $groupDN != ""){ + + if ( delete_group($groupDN) ){ + $mesg = "Rechnergruppe <b>".$groupcn."</b> erfolgreich gelöscht!<br><br>"; + } + else{ + $mesg = "Fehler beim löschen der Rechnergruppe <b>".$groupcn."</b> !<br><br>"; + } + +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/groupoverview.dwt b/ldap-site-mngmt/webinterface/computers/groupoverview.dwt new file mode 100644 index 00000000..d875c3be --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/groupoverview.dwt @@ -0,0 +1,38 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Rechnergruppen <code class='font_object'>{AU}</code> </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Rechnergruppe</b></td> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Anzahl Rechner</b></td> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>DHCP</b></td> + </tr> + + + + <!-- BEGIN DYNAMIC BLOCK: Gruppen --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{GROUPCN} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{MEMBERS} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{DHCPCONT} </td> + </tr> + <!-- END DYNAMIC BLOCK: Gruppen --> + + </table></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td> + Zum Verwalten einer bestimmten Gruppe, wählen Sie links entsprechenden Submenü-Eintrag.<br> + + </td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/groupoverview.php b/ldap-site-mngmt/webinterface/computers/groupoverview.php new file mode 100644 index 00000000..b9f9ce05 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/groupoverview.php @@ -0,0 +1,64 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 2; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "groupoverview.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$template->assign(array("DN" => "", + "GROUPCN" => "Noch keine Rechnergruppen angelegt", + "GROUPDESC" => "", + "MEMBERS" => "", + "DHCPCONT" => "")); + +$attributes = array("dn","cn","member","description","dhcphlpcont"); +$group_array = get_groups($auDN,$attributes); + +$template->define_dynamic("Gruppen", "Webseite"); + +foreach ($group_array as $group){ + + $anzahlmember = count($group['member']); + + if ( count($group['dhcphlpcont']) != 0 ){ + $subnetCN = explode('cn=',$group['dhcphlpcont']); + $subnet = explode(',', $subnetCN[1]); + $dhcpcont = "Subnet $subnet[0]"; + }else{$dhcpcont = "";} + + $template->assign(array("DN" => $group['dn'], + "GROUPCN" => $group['cn'], + "GROUPDESC" => $group['description'], + "MEMBERS" => $anzahlmember, + # "MEMBER" => $group['member'], + "DHCPCONT" => $dhcpcont, + "AUDN" => $auDN )); + $template->parse("GRUPPEN_LIST", ".Gruppen"); +} + + + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/host.dwt b/ldap-site-mngmt/webinterface/computers/host.dwt new file mode 100644 index 00000000..13d1da11 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/host.dwt @@ -0,0 +1,421 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='4'><h3>Rechner <code class='font_object'> {HOSTNAME} </code> </h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 1;'><h4><code class='font_object'>Allgemein</code></h4></td> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 0;'><h4>{DHCPLINK} DHCP/RBS </a></h4></td> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 0;'><h4>{HWLINK} Hardware </a></h4></td> + <td> </td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td colspan='4'> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='host_change.php' method='post'> + + <tr> + <td width='45%' class='tab_h'><b>Attribut</b></td> + <td width='55%' class='tab_h'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td class='tab_d'><b>Eindeutiger Rechnername (hostname):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td class='tab_d'> + <input type='Text' name='hostname' value='{HOSTNAME}' size='40' class='medium_form_field'> + <input type='hidden' name='oldhostname' value='{HOSTNAME}'> + </td> + </tr> + <tr height='50'> + <td class='tab_d'><b>Rechner Beschreibung: </td> + <td class='tab_d'> + <input type='Text' name='desc' value='{DESCRIPTION}' size='40' class='medium_form_field'> + <input type='hidden' name='olddesc' value='{DESCRIPTION}'> + + </td> + </tr> + <tr height='50'> + <td class='tab_d'><b>MAC Adresse:</b> </td> + <td class='tab_d'> + <input type='Text' name='mac' value='{HWADDRESS}' size='17' maxlength='17' class='medium_form_field'> + <input type='hidden' name='oldmac' value='{HWADDRESS}'> + (Format hex:hex:hex:hex:hex:hex) + </td> + </tr> + <tr height='50'> + <td class='tab_d'><b>IP Adresse:</b> </td> + <td class='tab_d'> + <input type='Text' name='ip' value='{IPADDRESS}' size='15' maxlength='15' class='medium_form_field'> + <input type='hidden' name='oldip' value='{IPADDRESS}'> + (Format xx.xx.xx.xx) + </td> + </tr> + + <input type='hidden' name='dhcphlpcont' value='{DHCPCONT}'> + <input type='hidden' name='dhcptype' value='{DHCPTYPE}'> + <input type='hidden' name='hostdn' value='{HOSTDN}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + + </table></td> + </tr> + <tr> + <td colspan='4'><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + <!--<tr> + <td height='40'></td> + </tr> + + <tr> + <td colspan='4'><h4>Rechner <code class='font_object'>{HOSTNAME}</code> kopieren:</h4> + Geben Sie bitte den eindeutigen, noch nicht verwendeten Namen des neuen Rechnerobjekts an.</td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='host_copy.php' method='post'> + + </table></td> + </tr><tr><td> + <input type='Submit' name='apply' value='kopieren' class='small_loginform_button'> + </form></td></tr> + + <tr>--> + + <tr> + <td height='40'></td> + </tr> + + <tr> + <td colspan='4'><h4>Rechner <code class='font_object'>{HOSTNAME}</code> löschen:</h4></td> + </tr> + <tr> + <td colspan='4'> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='delete_confirm.php' method='post'> + + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Der Rechner wird komplett gelöscht, <br>d.h. inklusive aller spezifisch für ihn angelegten + Hardware-Profile (MachineConfig) und PXE Bootmenüs. + </tr> + + <input type='hidden' name='dn' value='{HOSTDN}'> + <input type='hidden' name='name' value='{HOSTNAME}'> + <input type='hidden' name='delurl' value='host_delete.php'> + <input type='hidden' name='backurl' value='host.php?dn={HOSTDN}&sbmnr={SBMNR}'> + + </table></td> + </tr> + <tr> + <td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td> + </tr> + + + <tr> + <td height='50'></td> + </tr> + + <tr> + <td colspan='4'><h4>Wochen Übersicht Machine Configs Rechner <code class='font_object'>{HOSTNAME}</code> :</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td colspan='4'> + <table cellpadding='0' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr align='center'> + <td width='9%' style='border-color: black; border-style: solid; border-width: 2 0 2 2;'><b>Uhrzeit</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Montag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Dienstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Mittwoch</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Donnerstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Freitag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Samstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 2 2 1;'><b>Sonntag</b></td> + </tr> + <tr heigth='2' align='center'> + <td width='9%' style='border-color: black; border-style: solid; border-width: 0 0 0 2;'>0</td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G0}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G1}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>2</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G2}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G3}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>4</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G4}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G5}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>6</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G6}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G7}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>8</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G8}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G9}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>10</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G10}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G11}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>12</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G12}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G13}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>14</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G14}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G15}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>16</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G16}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G17}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>18</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G18}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G19}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>20</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G20}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G21}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>22</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G22}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{A23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{B23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{C23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{D23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{E23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{F23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 2 1;{G23}'> </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='10'></td> + </tr> + <tr> + <td colspan='4'><h4>Legende:</h4></td> + </tr> + <tr><td colspan='4'> + <table cellpadding='3' cellspacing='3' border='1' align='left' width='50%' style='border-width: 0 0 0 0;'> + <tr> + <td width='65%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Machine Config</b></td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Farbe</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>Keine Konfiguration </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 1 1 1;'> </td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Legende --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>{MCDESC} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 1 1 1;background-color:{COLOR};'> </td> + </tr> + <!-- END DYNAMIC BLOCK: Legende --> + + </table></td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/host.php b/ldap-site-mngmt/webinterface/computers/host.php new file mode 100644 index 00000000..928df62c --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/host.php @@ -0,0 +1,95 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "host.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$hostDN = $_GET['dn']; + +$attributes = array("hostname","domainname","ipaddress","hwaddress","description","dhcphlpcont", + "hw-mouse","hw-graphic","hw-monitor"); +$host = get_node_data($hostDN,$attributes); +$hostip = explode('_',$host['ipaddress']); + +# dhcp Typ +if ($host['dhcphlpcont'] == ""){ + $dhcptype = "nodhcp"; +}else{ + $ocarray = get_node_data($host['dhcphlpcont'],array("objectclass")); + $subnet = array_search('dhcpSubnet', $ocarray['objectclass']); + if ($subnet !== false ){ + $dhcptype = "subnet"; + } + $service = array_search('dhcpService', $ocarray['objectclass']); + if ($service !== false ){ + $dhcptype = "service"; + } +} +#print_r($dhcptype); + +$template->assign(array("HOSTDN" => $hostDN, + "HOSTNAME" => $host['hostname'], + "DOMAINNAME" => $host['domainname'], + "HWADDRESS" => $host['hwaddress'], + "IPADDRESS" => $hostip[0], + "DESCRIPTION" => $host['description'], + "DHCPCONT" => $host['dhcphlpcont'], + "DHCPTYPE" => $dhcptype, + "MOUSE" => $host['hw-mouse'], + "GRAPHIC" => $host['hw-graphic'], + "MONITOR" => $host['hw-monitor'], + "DHCPLINK" => "<a href='dhcphost.php?dn=".$hostDN."&sbmnr=".$sbmnr."' class='headerlink'>", + "HWLINK" => "<a href='hwhost.php?dn=".$hostDN."&sbmnr=".$sbmnr."' class='headerlink'>", + "AUDN" => $auDN, + "SBMNR" => $sbmnr)); + + +########################################################## +# MC Wochenübersicht +$mc_array = get_machineconfigs($hostDN,array("dn","cn","timerange","description")); +# print_r($mc_array); +for ($i=0; $i<count($mc_array); $i++){ + # Timerange Komponenten + if (count($mc_array[$i]['timerange']) > 1 ){ + foreach ($mc_array[$i]['timerange'] as $tr){ + $exptime = array_merge(explode('_',$tr),$mc_array[$i]['description']); + $timeranges[$i][] = $exptime; # Für grafische Wo-Ansicht + } + }else{ + $exptime = array_merge(explode('_',$mc_array[$i]['timerange']), $mc_array[$i]['description']); + $timeranges[$i] = $exptime; # Für grafische Wo-Ansicht + } +} +include("mc_wochenplan.php"); + +########################################################### +# PXE Wochenübersicht + + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/host_add.php b/ldap-site-mngmt/webinterface/computers/host_add.php new file mode 100644 index 00000000..bde6f26a --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/host_add.php @@ -0,0 +1,101 @@ +<?php +include('../standard_header.inc.php'); + +$hostname = $_POST['hostname']; +$hostdesc = $_POST['hostdesc']; +$mac = $_POST['mac']; +$ip = $_POST['ip']; + + +$hostname = htmlentities($hostname); +$hostdesc = htmlentities($hostdesc); +$mac = htmlentities($mac); +$mac = strtolower($mac); +$ip = htmlentities($ip); + +/* +echo "AU dn:"; print_r($auDN); echo "<br>"; +echo "hostname:"; print_r($hostname); echo "<br>"; +echo "hostdesc:"; print_r($hostdesc); echo "<br>"; +echo "mac:"; print_r($mac); echo "<br>"; +echo "ip:"; print_r($ip); echo "<br><br>"; +*/ + +$attribs = $_POST['attribs']; +if (count($attribs) != 0){ + foreach (array_keys($attribs) as $key){ + $atts[$key] = htmlentities($attribs[$key]); + } +} + +$seconds = 2; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if ( $hostname != ""){ + + # Formulareingaben anpassen + $exphn = explode(" ",$hostname); + foreach ($exphn as $word){$expuc[] = ucfirst($word);} + $hostname = implode(" ",$expuc); + $hostname = preg_replace ( '/\s+([0-9A-Z])/', '$1', $hostname); + + # Host Objekt anlegen + $brothers = get_hosts($auDN,array("hostname")); + $brother = 0; + foreach ($brothers as $item){ + if( $item['hostname'] == $hostname ){ + $mesg = "Es existiert bereits ein Rechner mit dem eingegebenen HOSTNAME!<br> + Bitte geben Sie einen anderen HOSTNAME ein.<br><br>"; + $get_hostdesc = str_replace ( " ", "_", $hostdesc ); + $get_mac = str_replace ( " ", "_", $mac ); + $get_ip = str_replace ( " ", "_", $ip ); + $url = "new_host.php?hostname=Hier_anderen_HOSTNAME_eingeben&hostdesc=".$get_hostdesc."&mac=".$get_mac."&ip=".$ip; + $brother = 1; + break; + } + } + if ($brother == 0){ + $hostDN = "HostName=".$hostname.",cn=computers,".$auDN; + # print_r($hostDN); echo "<br>"; + + if (add_host($hostDN,$hostname,$hostdesc,$mac,$ip,$atts)){ + $mesg .= "<br>Neuer Rechner erfolgreich angelegt<br>"; + } + else{ + $mesg .= "<br>Fehler beim anlegen des Rechners!<br>"; + } + + $url = 'hostoverview.php'; + } +} + + +elseif ( $hostname == ""){ + + $get_hostdesc = str_replace ( " ", "_", $hostdesc ); + $get_mac = str_replace ( " ", "_", $mac ); + $get_ip = str_replace ( " ", "_", $ip ); + $mesg = "Sie haben den HOSTNAME des neuen Rechners nicht angegeben. Dieser ist aber ein notwendiges Attribut.<br> + Bitte geben Sie ihn an.<br><br>"; + $url = "new_host.php?ou=Hier_HOSTNAME_eingeben&hostdesc=".$get_hostdesc."&mac=".$get_mac."&ip=".$ip; +} + + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/host_change.php b/ldap-site-mngmt/webinterface/computers/host_change.php new file mode 100644 index 00000000..71c005fa --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/host_change.php @@ -0,0 +1,396 @@ +<?php +include('../standard_header.inc.php'); + +$hostname = $_POST['hostname']; +$oldhostname = $_POST['oldhostname']; +$mac = $_POST['mac']; +$oldmac = $_POST['oldmac']; +$ip = $_POST['ip']; +$oldip = $_POST['oldip']; +$desc = $_POST['desc']; +$olddesc = $_POST['olddesc']; + +$dhcphlpcont = $_POST['dhcphlpcont']; +$dhcptype = $_POST['dhcptype']; +$hostDN = $_POST['hostdn']; +$sbmnr = $_POST['sbmnr']; + +$syntax = new Syntaxcheck; + +$hostname = htmlentities($hostname); +$oldhostname = htmlentities($oldhostname); +$mac = htmlentities($mac); +$mac = strtolower($mac); +$oldmac = htmlentities($oldmac); +$ip = htmlentities($ip); +$oldip = htmlentities($oldip); +$desc = htmlentities($desc); +$olddesc = htmlentities($olddesc); + +/* +# sonstige Attribute +$attribs = $_POST['attribs']; +if (count($attribs) != 0){ + foreach (array_keys($attribs) as $key){ + $atts[$key] = htmlentities($attribs[$key]); + } +} +#print_r($atts); echo "<br><br>"; +$oldattribs = $_POST['oldattribs']; +if (count($oldattribs) != 0){ + foreach (array_keys($oldattribs) as $key){ + $oldatts[$key] = htmlentities($oldattribs[$key]); + } +}*/ +#print_r($oldatts); echo "<br><br>"; + +/* +echo "new hostname:"; print_r($hostname); echo "<br>"; +echo "old hostname:"; print_r($oldhostname); echo "<br>"; +echo "new mac:"; print_r($mac); echo "<br>"; +echo "old mac:"; print_r($oldmac); echo "<br>"; +echo "new ip:"; print_r($ip); echo "<br>"; +echo "old ip:"; print_r($oldip); echo "<br>"; +echo "new desc:"; print_r($desc); echo "<br>"; +echo "old desc:"; print_r($olddesc); echo "<br><br>"; +echo "Host DN:"; print_r($hostDN); echo "<br>"; +echo "submenuNR:"; print_r($submenu); echo "<br><br>"; +*/ + +$seconds = 2; +$url = 'host.php?dn='.$hostDN.'&sbmnr='.$sbmnr; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +############################################## +# Hostname + +if ( $oldhostname == $hostname ){ + $mesg = "keine Aenderung<br>"; +} + +if ( $oldhostname != "" && $hostname != "" && $oldhostname != $hostname ){ + echo "Hostname aendern<br>"; + # hier noch Syntaxcheck + # Formulareingaben anpassen + $exphn = explode(" ",$hostname); + foreach ($exphn as $word){$expuc[] = ucfirst($word);} + $hostname = implode(" ",$expuc); + $hostname = preg_replace ( '/\s+([0-9A-Z])/', '$1', $hostname); + + $newhostDN = "hostname=".$hostname.",cn=computers,".$auDN; + # print_r($newhostDN); echo "<br><br>"; + modify_host_dn($hostDN, $newhostDN); + + # newsubmenu holen...hosts neu holen, sortieren, ->position + #$newhosts = get_hosts($auDN,array("dn")); + #print_r($newhosts); echo "<br><br>"; + #foreach ($newhosts as $item){ + # $newdnarray [] = $item['dn']; + #} + #$key = array_search($newhostDN, $newdnarray); + #print_r($key); echo "<br>"; + + $url = 'host.php?dn='.$newhostDN.'&sbmnr='.$sbmnr; + +} + +if ( $oldhostname != "" && $hostname == "" ){ + echo "Hostname loeschen!<br> + Dies ist Teil des DN, Sie werden den Rechner komplett löschen<br><br>"; + echo "Wollen Sie den Rechner <b>".$oldhostname."</b> mit seinen Hardware-Profilen (MachineConfigs) + und PXE Bootmenüs wirklich löschen?<br><br> + <form action='host_delete.php' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$hostDN."'> + <input type='hidden' name='name' value='".$oldhostname."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$url."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form>"; + $seconds = 600; +} + + + +##################################### +# MAC + +if ( $oldmac == $mac ){ + #$mesg = "keine Aenderung<br>"; +} + +if ( $oldmac == "" && $mac != "" ){ + echo "MAC neu anlegen<br>"; + # hier noch Syntaxcheck + $entry['hwaddress'] = $mac; + $result = ldap_mod_add($ds,$hostDN,$entry); + if($result){ + $mesg = "MAC erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der MAC<br><br>"; + } +} + +if ( $oldmac != "" && $mac != "" && $oldmac != $mac ){ + echo "MAC aendern<br>"; + # hier noch Syntaxcheck + $entry['hwaddress'] = $mac; + $result = ldap_mod_replace($ds,$hostDN,$entry); + if($result){ + # in den PXEs auch ändern + $pxes = get_pxeconfigs($hostDN,array("dn","filename")); + if ( count($pxes) != 0 ){ + foreach ($pxes as $pxe){ + $entrynewmac ['filename'] = "01-".$mac; + ldap_mod_replace($ds,$pxe['dn'],$entrynewmac); + } + } + # und in Gruppen PXEs + $groups = get_groups_member($auDN,array("dn"),$hostDN); + if ( count($groups) != 0 ){ + $pxes = get_pxeconfigs($groups[0]['dn'],array("dn","filename")); + if ( count($pxes) != 0 ){ + foreach ($pxes as $pxe){ + if (count($pxe['filename']) > 1){ + for ($i=0; $i<count($pxe['filename']); $i++){ + if ($pxe['filename'][$i] == $oldmac){ + $entrynewmac ['filename'][$i] = "01-".$mac; + }else{ + $entrynewmac ['filename'][$i] = $pxe['filename'][$i]; + } + } + } + if (count($pxe['filename']) == 1 && $pxe['filename'][$i] == $oldmac){ + $entrynewmac ['filename'] = "01-".$mac; + } + ldap_mod_replace($ds,$pxe['dn'],$entrynewmac); + } + } + } + $mesg = "MAC erfolgreich geaendert<br><br> + Falls Rechner-Konfiguration via File, <b>Client-Conf</b> Dateiname in untergeordneten <br> + PXEs bitte auch ändern"; + }else{ + $mesg = "Fehler beim aendern der MAC<br><br>"; + } +} + +if ( $oldmac != "" && $mac == "" ){ + echo "MAC loeschen<br>"; + # check ob PXEs am Rechnerobjekt hängen + $pxes = get_pxeconfigs($hostDN,array("dn","filename")); + $groups = get_groups_member($auDN,array("dn"),$hostDN); + if ( count($groups) != 0 ){ + $pxes2 = get_pxeconfigs($groups[0]['dn'],array("dn","filename")); + } + if ( count($pxes) != 0 || count($pxes2) != 0){ + echo "Für den Rechner sind PXE Bootmenüs angelegt welche die MAC Adresse als <br> + Dateinamen verwenden. Sie köennen die MAC erst löschen, wenn Sie diese PXEs <br> + entfernt haben.<br><br> + MAC nicht gelöscht!"; + } + else{ + # hier noch Syntaxcheck + $entry['hwaddress'] = $oldmac; + $result = ldap_mod_del($ds,$hostDN,$entry); + if($result){ + $mesg = "MAC erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der MAC<br><br>"; + } + } +} + + +######################################## +# IP + +if ( $oldip == $ip ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldip == "" && $ip != "" ){ + echo "IP neu anlegen<br>"; + # hier noch Syntaxcheck + if( $syntax->check_ip_syntax($ip) ){ + $newip_array = array($ip,$ip); + $newip = implode('_',$newip_array); + # print_r($newip); echo "<br><br>"; + if (new_ip_host($newip,$hostDN,$auDN)){ + $mesg = "IP erfolgreich eingetragen<br><br>"; + if ($dhcptype == "subnet"){ + adjust_hostip_dhcpsubnet($ip,$hostDN,$dhcphlpcont); + } + }else{ + $mesg = "Fehler beim eintragen der IP<br><br>"; + } + } + else{echo "Falsche IP Syntax<br><br>";} +} + +if ( $oldip != "" && $ip != "" && $oldip != $ip ){ + echo "IP aendern<br>"; + # hier noch Syntaxcheck + if( $syntax->check_ip_syntax($ip) ){ + $newip_array = array($ip,$ip); + $newip = implode('_',$newip_array); + # print_r($newip); echo "<br><br>"; + $oldip_array = array($oldip,$oldip); + $oldipp = implode('_',$oldip_array); + if (modify_ip_host($newip,$hostDN,$auDN)){ + $mesg = "IP erfolgreich geaendert<br><br>"; + if ($dhcptype == "subnet"){ + adjust_hostip_dhcpsubnet($ip,$hostDN,$dhcphlpcont); + } + }else{ + $mesg = "Fehler beim aendern der IP<br><br>"; + # oldip die schon gelöscht wurde wieder einfügen + new_ip_host($oldipp,$hostDN,$auDN); + } + } + else{echo "Falsche IP Syntax<br><br>";} +} + +if ( $oldip != "" && $ip == "" ){ + echo "IP loeschen<br>"; + + if(delete_ip_host($hostDN,$auDN)){ + $mesg = "IP erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der IP<br><br>"; + } +} + + +##################################### +# Description + +if ( $olddesc == $desc ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $olddesc == "" && $desc != "" ){ + echo "Rechner-Beschreibung neu anlegen<br>"; + # hier noch Syntaxcheck + $entry['description'] = $desc; + $result = ldap_mod_add($ds,$hostDN,$entry); + if($result){ + $mesg = "Rechner-Beschreibung erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der Rechner-Beschreibung<br><br>"; + } +} + +if ( $olddesc != "" && $desc != "" && $olddesc != $desc ){ + echo "Rechner-Beschreibung aendern<br>"; + # hier noch Syntaxcheck + $entry['description'] = $desc; + $result = ldap_mod_replace($ds,$hostDN,$entry); + if($result){ + $mesg = "Rechner-Beschreibung erfolgreich geaendert<br><br>"; + }else{ + $mesg = "Fehler beim aendern der Rechner-Beschreibung<br><br>"; + } +} + +if ( $olddesc != "" && $desc == "" ){ + echo "Rechner-Beschreibung loeschen<br>"; + # hier noch Syntaxcheck + $entry['description'] = $olddesc; + $result = ldap_mod_del($ds,$hostDN,$entry); + if($result){ + $mesg = "Rechner-Beschreibung erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der Rechner-Beschreibung<br><br>"; + } +} + +#################################### +# restliche Attribute +/* +$entryadd = array(); +$entrymod = array(); +$entrydel = array(); + +foreach (array_keys($atts) as $key){ + + if ( $oldatts[$key] == $atts[$key] ){ + #$mesg = "keine Aenderung<br>"; + } + if ( $oldatts[$key] == "" && $atts[$key] != "" ){ + # hier noch Syntaxcheck + $entryadd[$key] = $atts[$key]; + } + if ( $oldatts[$key] != "" && $atts[$key] != "" && $oldatts[$key] != $atts[$key] ){ + # hier noch Syntaxcheck + $entrymod[$key] = $atts[$key]; + } + if ( $oldatts[$key] != "" && $atts[$key] == "" ){ + # hier noch Syntaxcheck + $entrydel[$key] = $oldatts[$key]; + } +} +#print_r($entryadd); echo "<br>"; +#print_r($entrymod); echo "<br>"; +#print_r($entrydel); echo "<br>"; + +if (count($entryadd) != 0 ){ + #print_r($entryadd); echo "<br>"; + #echo "neu anlegen<br>"; + foreach (array_keys($entryadd) as $key){ + $addatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_add($ds,$hostDN,$entryadd)){ + $mesg = "Attribute ".$addatts." erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der Attribute ".$addatts."<br><br>"; + } +} + +if (count($entrymod) != 0 ){ + #print_r($entrymod); echo "<br>"; + #echo "ändern<br>"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_replace($ds,$hostDN,$entrymod)){ + $mesg = "Attribute ".$modatts." erfolgreich geaendert<br><br>"; + }else{ + $mesg = "Fehler beim aendern der Attribute ".$modatts."<br><br>"; + } +} + +if (count($entrydel) != 0 ){ + #print_r($entrydel); echo "<br>"; + #echo "löschen<br>"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_del($ds,$hostDN,$entrydel)){ + $mesg = "Attribute ".$delatts." erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der Attribute ".$delatts."<br><br>"; + } +} + +*/ + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/host_delete.php b/ldap-site-mngmt/webinterface/computers/host_delete.php new file mode 100644 index 00000000..bcfa0add --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/host_delete.php @@ -0,0 +1,47 @@ +<?php +include('../standard_header.inc.php'); + +$hostDN = $_POST['dn']; +$hostname = $_POST['name']; +$hostDN = htmlentities($hostDN); +$hostname = htmlentities($hostname); + +/* +echo "AU dn:"; print_r($auDN); echo "<br>"; +echo "hostdn:"; print_r($hostDN); echo "<br>"; +echo "hostname:"; print_r($hostname); echo "<br>"; +*/ + +$seconds = 1; +$url = 'hostoverview.php'; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if ( $hostDN != ""){ + + if ( delete_host($hostDN) ){ + $mesg = "Rechner <b>".$hostname."</b> erfolgreich gelöscht!<br><br>"; + } + else{ + $mesg = "Fehler beim löschen von Rechner <b>".$hostname."</b> !<br><br>"; + } + +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/hostoverview.dwt b/ldap-site-mngmt/webinterface/computers/hostoverview.dwt new file mode 100644 index 00000000..87ed24a6 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/hostoverview.dwt @@ -0,0 +1,40 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Rechner <code class='font_object'>{AU}</code> </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr> + <td width='24%' class='tab_h'><b>Rechnername</b></td> + <td width='19%' class='tab_h'><b>MAC Adresse</b></td> + <td width='19%' class='tab_h'><b>IP Adresse</b></td> + <td width='19%' class='tab_h'><b>DHCP</b></td> + <td width='19%' class='tab_h'><b>RBS</b></td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Rechner --> + <tr valign='top' height='45'> + <td class='tab_d'>{HOSTNAME} </td> + <td class='tab_d'>{HWADDRESS} </td> + <td class='tab_d'>{IPADDRESS} </td> + <td class='tab_d'>{DHCPCONT} </td> + <td class='tab_d'>{RBSCONT} </td> + </tr> + <!-- END DYNAMIC BLOCK: Rechner --> + + </table></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td> + Zum Verwalten eines bestimmten Rechners, wählen Sie links entsprechenden Submenü-Eintrag.<br> + Um einen neuen Rechner anzulegen wählen Sie links "Neuer Rechner" + </td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/hostoverview.php b/ldap-site-mngmt/webinterface/computers/hostoverview.php new file mode 100644 index 00000000..c2bec0a2 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/hostoverview.php @@ -0,0 +1,82 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "hostoverview.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$template->assign(array("DN" => "", + "HOSTNAME" => "Noch keine Rechner angelegt", + "DOMAINNAME" => "", + "HWADDRESS" => "", + "IPADDRESS" => "", + "DHCPCONT" => "", + "RBSCONT" => "")); + +$attributes = array("dn","hostname","domainname","hwaddress","ipaddress","dhcphlpcont","hlprbservice"); +$host_array = get_hosts($auDN,$attributes); + +$template->define_dynamic("Rechner", "Webseite"); + +$i = 0; +foreach ($host_array as $host){ + + $hostname = "<a href='host.php?dn=".$host['dn']."&sbmnr=".$i."' class='headerlink'>".$host['hostname']."</a>"; + $hostip = explode('_',$host['ipaddress']); + + $dhcpcont = ""; + if ( count($host['dhcphlpcont']) != 0 ){ + $dhcpexpdn = ldap_explode_dn($host['dhcphlpcont'],1); + $dhcpcn = $dhcpexpdn[0]; + $ocarray = get_node_data($host['dhcphlpcont'],array("objectclass","dhcphlpcont")); + $sub = array_search('dhcpSubnet', $ocarray['objectclass']); + if ($sub !== false ){ + $dhcpcont = "Subnet ".$dhcpexpdn[0]." <br>[".$dhcpexpdn[2]."]"; + }else{ + $dhcpcont = "Service ".$dhcpexpdn[0]." <br>[".$dhcpexpdn[2]."]"; + } + } + + $rbscont = ""; + if ( count($host['hlprbservice']) != 0 ){ + $rbsexpdn = ldap_explode_dn($host['hlprbservice'],1); + $rbscont = $rbsexpdn[0]." <br>[".$rbsexpdn[2]."]"; + } + + $template->assign(array("DN" => $host['dn'], + "HOSTNAME" => $hostname, + "DOMAINNAME" => $host['domainname'], + "HWADDRESS" => $host['hwaddress'], + "IPADDRESS" => $hostip[0], + "DHCPCONT" => $dhcpcont, + "RBSCONT" => $rbscont, + "AUDN" => $auDN )); + $template->parse("RECHNER_LIST", ".Rechner"); + + $i++; +} + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/hwhost.dwt b/ldap-site-mngmt/webinterface/computers/hwhost.dwt new file mode 100644 index 00000000..472b2f3e --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/hwhost.dwt @@ -0,0 +1,60 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='4'><h3>Rechner <code class='font_object'> {HOSTNAME} </code> </h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 1;'><h4>{HOSTLINK} Allgemein </a></h4></td> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 0;'><h4>{DHCPLINK} DHCP/RBS </a></h4></td> + <td align='center' width='15%' style='border-color: black; border-style: solid; border-width: 0 1 0 0;'><h4><code class='font_object'>Hardware</code></h4></td> + <td> </td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr><td colspan='4'> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='hwhost_change.php' method='post'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>HW Mouse: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[hw-mouse]' value='{MOUSE}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[hw-mouse]' value='{MOUSE}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>HW Graphic: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[hw-graphic]' value='{GRAPHIC}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[hw-graphic]' value='{GRAPHIC}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>HW Monitor: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[hw-monitor]' value='{MONITOR}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[hw-monitor]' value='{MONITOR}'> + </td> + </tr> + + <input type='hidden' name='hostdn' value='{HOSTDN}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + + </table></td> + </tr> + <tr> + <td colspan='4'><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/hwhost.php b/ldap-site-mngmt/webinterface/computers/hwhost.php new file mode 100644 index 00000000..e401d5ce --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/hwhost.php @@ -0,0 +1,78 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "hwhost.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$hostDN = $_GET['dn']; + +$attributes = array("hostname","domainname","ipaddress","hwaddress","description","dhcphlpcont", + "hw-mouse","hw-graphic","hw-monitor"); +$host = get_node_data($hostDN,$attributes); +$hostip = explode('_',$host['ipaddress']); + +$template->assign(array("HOSTDN" => $hostDN, + "HOSTNAME" => $host['hostname'], + "DOMAINNAME" => $host['domainname'], + "HWADDRESS" => $host['hwaddress'], + "IPADDRESS" => $hostip[0], + "DESCRIPTION" => $host['description'], + "DHCPCONT" => $host['dhcphlpcont'], + "MOUSE" => $host['hw-mouse'], + "GRAPHIC" => $host['hw-graphic'], + "MONITOR" => $host['hw-monitor'], + "DHCPLINK" => "<a href='dhcphost.php?dn=".$hostDN."&sbmnr=".$sbmnr."' class='headerlink'>", + "HOSTLINK" => "<a href='host.php?dn=".$hostDN."&sbmnr=".$sbmnr."' class='headerlink'>", + "AUDN" => $auDN, + "SBMNR" => $sbmnr)); + + +########################################################## +# MC Wochenübersicht +$mc_array = get_machineconfigs($hostDN,array("dn","cn","timerange","description")); +# print_r($mc_array); +for ($i=0; $i<count($mc_array); $i++){ + # Timerange Komponenten + if (count($mc_array[$i]['timerange']) > 1 ){ + foreach ($mc_array[$i]['timerange'] as $tr){ + $exptime = array_merge(explode('_',$tr),$mc_array[$i]['description']); + $timeranges[$i][] = $exptime; # Für grafische Wo-Ansicht + } + }else{ + $exptime = array_merge(explode('_',$mc_array[$i]['timerange']), $mc_array[$i]['description']); + $timeranges[$i] = $exptime; # Für grafische Wo-Ansicht + } +} +include("mc_wochenplan.php"); + +########################################################### +# PXE Wochenübersicht + + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/hwhost_change.php b/ldap-site-mngmt/webinterface/computers/hwhost_change.php new file mode 100644 index 00000000..7b93f7c9 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/hwhost_change.php @@ -0,0 +1,127 @@ +<?php +include('../standard_header.inc.php'); + +$syntax = new Syntaxcheck; + +$hostDN = $_POST['hostdn']; +$sbmnr = $_POST['sbmnr']; + +# sonstige Attribute +$attribs = $_POST['attribs']; +if (count($attribs) != 0){ + foreach (array_keys($attribs) as $key){ + $atts[$key] = htmlentities($attribs[$key]); + } +} +#print_r($atts); echo "<br><br>"; +$oldattribs = $_POST['oldattribs']; +if (count($oldattribs) != 0){ + foreach (array_keys($oldattribs) as $key){ + $oldatts[$key] = htmlentities($oldattribs[$key]); + } +} +#print_r($oldatts); echo "<br><br>"; + +/* +echo "new hostname:"; print_r($hostname); echo "<br>"; +echo "old hostname:"; print_r($oldhostname); echo "<br>"; +echo "new mac:"; print_r($mac); echo "<br>"; +echo "old mac:"; print_r($oldmac); echo "<br>"; +echo "new ip:"; print_r($ip); echo "<br>"; +echo "old ip:"; print_r($oldip); echo "<br>"; +echo "new desc:"; print_r($desc); echo "<br>"; +echo "old desc:"; print_r($olddesc); echo "<br><br>"; +echo "Host DN:"; print_r($hostDN); echo "<br>"; +echo "submenuNR:"; print_r($submenu); echo "<br><br>"; +*/ + +$seconds = 2; +$url = 'host.php?dn='.$hostDN.'&sbmnr='.$sbmnr; + +echo " +<html> +<head> + <title>AU Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +#################################### +# restliche Attribute + +$entryadd = array(); +$entrymod = array(); +$entrydel = array(); + +foreach (array_keys($atts) as $key){ + + if ( $oldatts[$key] == $atts[$key] ){ + #$mesg = "keine Aenderung<br>"; + } + if ( $oldatts[$key] == "" && $atts[$key] != "" ){ + # hier noch Syntaxcheck + $entryadd[$key] = $atts[$key]; + } + if ( $oldatts[$key] != "" && $atts[$key] != "" && $oldatts[$key] != $atts[$key] ){ + # hier noch Syntaxcheck + $entrymod[$key] = $atts[$key]; + } + if ( $oldatts[$key] != "" && $atts[$key] == "" ){ + # hier noch Syntaxcheck + $entrydel[$key] = $oldatts[$key]; + } +} +#print_r($entryadd); echo "<br>"; +#print_r($entrymod); echo "<br>"; +#print_r($entrydel); echo "<br>"; + +if (count($entryadd) != 0 ){ + #print_r($entryadd); echo "<br>"; + #echo "neu anlegen<br>"; + foreach (array_keys($entryadd) as $key){ + $addatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_add($ds,$hostDN,$entryadd)){ + $mesg = "Attribute ".$addatts." erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der Attribute ".$addatts."<br><br>"; + } +} + +if (count($entrymod) != 0 ){ + #print_r($entrymod); echo "<br>"; + #echo "ändern<br>"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_replace($ds,$hostDN,$entrymod)){ + $mesg = "Attribute ".$modatts." erfolgreich geaendert<br><br>"; + }else{ + $mesg = "Fehler beim aendern der Attribute ".$modatts."<br><br>"; + } +} + +if (count($entrydel) != 0 ){ + #print_r($entrydel); echo "<br>"; + #echo "löschen<br>"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_del($ds,$hostDN,$entrydel)){ + $mesg = "Attribute ".$delatts." erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der Attribute ".$delatts."<br><br>"; + } +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/machineconfig_default.dwt b/ldap-site-mngmt/webinterface/computers/machineconfig_default.dwt new file mode 100644 index 00000000..3596a0ce --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/machineconfig_default.dwt @@ -0,0 +1,323 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Default MachineConfigs (Konfigurationen) <code class='font_object'> {AU} </code> </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Machine Config</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Gültigkeitsdauer (Time Range)</b></td> + </tr> + + + + <!-- BEGIN DYNAMIC BLOCK: Machineconf --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{MCDESC} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>{TRANGES} </td> + </tr> + <!-- END DYNAMIC BLOCK: Machineconf --> + + </table></td> + </tr> + <tr> + <td height='50'></td> + </tr> + + <tr> + <td colspan='2'><h4>Wochen Übersicht:</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='0' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + <tr align='center'> + <td width='9%' style='border-color: black; border-style: solid; border-width: 2 0 2 2;'><b>Uhrzeit</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Montag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Dienstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Mittwoch</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Donnerstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Freitag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 0 2 1;'><b>Samstag</b></td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 2 2 2 1;'><b>Sonntag</b></td> + </tr> + <tr heigth='2' align='center'> + <td width='9%' style='border-color: black; border-style: solid; border-width: 0 0 0 2;'>0</td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F0}'> </td> + <td width='13%' style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G0}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F1}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G1}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>2</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F2}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G2}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F3}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G3}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>4</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F4}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G4}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F5}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G5}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>6</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F6}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G6}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F7}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G7}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>8</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F8}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G8}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F9}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G9}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>10</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F10}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G10}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F11}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G11}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>12</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F12}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G12}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F13}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G13}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>14</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F14}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G14}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F15}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G15}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>16</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F16}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G16}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F17}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G17}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>18</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F18}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G18}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F19}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G19}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>20</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F20}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G20}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{A21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{B21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{C21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{D21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{E21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 1;{F21}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 0 1;{G21}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 2;'>22</td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{A22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{B22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{C22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{D22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{E22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 0 0 1;{F22}'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 2 0 1;{G22}'> </td> + </tr> + <tr heigth='2' align='center'> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 2;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{A23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{B23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{C23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{D23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{E23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 2 1;{F23}'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 2 2 1;{G23}'> </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='10'></td> + </tr> + <tr> + <td colspan='2'><h4>Legende:</h4></td> + </tr> + <tr><td> + <table cellpadding='3' cellspacing='3' border='1' align='left' width='50%' style='border-width: 0 0 0 0;'> + <tr> + <td width='65%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Machine Config</b></td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Farbe</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>Keine Konfiguration </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 1 1 1;'> </td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Legende --> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>{MCDESC} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 1 1 1 1;background-color:{COLOR};'> </td> + </tr> + <!-- END DYNAMIC BLOCK: Legende --> + + </table></td> + </tr> + +</table> diff --git a/ldap-site-mngmt/webinterface/computers/machineconfig_default.php b/ldap-site-mngmt/webinterface/computers/machineconfig_default.php new file mode 100644 index 00000000..ac386a57 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/machineconfig_default.php @@ -0,0 +1,75 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 3; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "machineconfig_default.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$template->assign(array("MCDN" => "", + "MCCN" => "Noch keine Default MachineConfig angelegt", + "TRANGES" => "", + "MCDESC" => "Noch keine Default MachineConfig angelegt")); + + +$mc_array = get_machineconfigs("cn=computers,".$auDN,array("dn","cn","timerange","description")); +# print_r($mc_array); + + +$template->define_dynamic("Machineconf", "Webseite"); + +for ($i=0; $i<count($mc_array); $i++){ + # Timerange Komponenten + $trange = ""; + if (count($mc_array[$i]['timerange']) > 1 ){ + foreach ($mc_array[$i]['timerange'] as $tr){ + $exptime = array_merge(explode('_',$tr),$mc_array[$i]['description']); + $timeranges[$i][] = $exptime; # Für grafische Wo-Ansicht + if ($exptime[0] == "X"){$exptime[0]="täglich";} + # if ($exptime[1] == "X" && $exptime[2] == "X"){$exptime[1] = ""; $exptime[2]= "";} + $trange .= $exptime[0].", von ".$exptime[1].":00 bis ".$exptime[2].":59 / "; + } + }else{ + $exptime = array_merge(explode('_',$mc_array[$i]['timerange']), $mc_array[$i]['description']); + $timeranges[$i] = $exptime; # Für grafische Wo-Ansicht + if ($exptime[0] == "X"){$exptime[0]="täglich";} + # if ($exptime[1] == "X" && $exptime[2] == "X"){$exptime[1] = ""; $exptime[2]= "";} + $trange .= $exptime[0].", von ".$exptime[1].":00 bis ".$exptime[2].":59"; + } + + $template->assign(array("MCDN" => $mc_array[$i]['dn'], + "MCCN" => $mc_array[$i]['cn'], + "TRANGES" => $trange, + "MCDESC" => $mc_array[$i]['description'], + "AUDN" => $auDN)); + $template->parse("MACHINECONF_LIST", ".Machineconf"); +} + +#get_entry_number($mc_array[3]['dn'],"machineconfig"); + +include("mc_wochenplan.php"); + + +################################################################################### + +include("computers_footer.inc.php"); + +?> diff --git a/ldap-site-mngmt/webinterface/computers/mc_wochenplan.php b/ldap-site-mngmt/webinterface/computers/mc_wochenplan.php new file mode 100644 index 00000000..3df7ab82 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/mc_wochenplan.php @@ -0,0 +1,154 @@ +<?php + +##################################### +# Wochenübersicht + +$template->assign(array("A0" => "","B0" => "","C0" => "","D0" => "","E0" => "","F0" => "","G0" => "", + "A1" => "","B1" => "","C1" => "","D1" => "","E1" => "","F1" => "","G1" => "", + "A2" => "","B2" => "","C2" => "","D2" => "","E2" => "","F2" => "","G2" => "", + "A3" => "","B3" => "","C3" => "","D3" => "","E3" => "","F3" => "","G3" => "", + "A4" => "","B4" => "","C4" => "","D4" => "","E4" => "","F4" => "","G4" => "", + "A5" => "","B5" => "","C5" => "","D5" => "","E5" => "","F5" => "","G5" => "", + "A6" => "","B6" => "","C6" => "","D6" => "","E6" => "","F6" => "","G6" => "", + "A7" => "","B7" => "","C7" => "","D7" => "","E7" => "","F7" => "","G7" => "", + "A8" => "","B8" => "","C8" => "","D8" => "","E8" => "","F8" => "","G8" => "", + "A9" => "","B9" => "","C9" => "","D9" => "","E9" => "","F9" => "","G9" => "", + "A10" => "","B10" => "","C10" => "","D10" => "","E10" => "","F10" => "","G10" => "", + "A11" => "","B11" => "","C11" => "","D11" => "","E11" => "","F11" => "","G11" => "", + "A12" => "","B12" => "","C12" => "","D12" => "","E12" => "","F12" => "","G12" => "", + "A13" => "","B13" => "","C13" => "","D13" => "","E13" => "","F13" => "","G13" => "", + "A14" => "","B14" => "","C14" => "","D14" => "","E14" => "","F14" => "","G14" => "", + "A15" => "","B15" => "","C15" => "","D15" => "","E15" => "","F15" => "","G15" => "", + "A16" => "","B16" => "","C16" => "","D16" => "","E16" => "","F16" => "","G16" => "", + "A17" => "","B17" => "","C17" => "","D17" => "","E17" => "","F17" => "","G17" => "", + "A18" => "","B18" => "","C18" => "","D18" => "","E18" => "","F18" => "","G18" => "", + "A19" => "","B19" => "","C19" => "","D19" => "","E19" => "","F19" => "","G19" => "", + "A20" => "","B20" => "","C20" => "","D20" => "","E20" => "","F20" => "","G20" => "", + "A21" => "","B21" => "","C21" => "","D21" => "","E21" => "","F21" => "","G21" => "", + "A22" => "","B22" => "","C22" => "","D22" => "","E22" => "","F22" => "","G22" => "", + "A23" => "","B23" => "","C23" => "","D23" => "","E23" => "","F23" => "","G23" => "")); + +#print_r($timeranges); echo "<br>"; + +# vom spezifischsten zum unspezifischsten : +# FR_0_7 -> FR_X_X -> X_0_7 -> X_X_X +$daytime = array(); +$timex = array(); +$dayx = array(); +$allx = array(); +$legend = array(); +if(count($timeranges) != 0){ +foreach ($timeranges as $tr){ + if (count($tr[0]) > 1){ + foreach ($tr as $item){ + if ($item[0] != "X" && $item[1] != "X" && $item[2] != "X" && ($item[0] == "MO" || $item[0] == "DI" || $item[0] == "MI" || $item[0] == "DO" || $item[0] == "FR" || $item[0] == "SA" || $item[0] == "SO")){ + $daytime[] = $item; + } + if ($item[0] != "X" && $item[1] == "X" && $item[2] == "X"){ + $timex[] = $item; + } + if ($item[0] == "X" && $item[1] != "X" && $item[2] != "X"){ + $dayx[] = $item; + } + if ($item[0] == "X" && $item[1] == "X" && $item[2] == "X"){ + $allx[] = $item; + } + } + }else{ + if ($tr[0] != "X" && $tr[1] != "X" && $tr[2] != "X" && ($tr[0] == "MO" || $tr[0] == "DI" || $tr[0] == "MI" || $tr[0] == "DO" || $tr[0] == "FR" || $tr[0] == "SA" || $tr[0] == "SO")){ + $daytime[] = $tr; + } + if ($tr[0] != "X" && $tr[1] == "X" && $tr[2] == "X"){ + $timex[] = $tr; + } + if ($tr[0] == "X" && $tr[1] != "X" && $tr[2] != "X"){ + $dayx[] = $tr; + } + if ($tr[0] == "X" && $tr[1] == "X" && $tr[2] == "X"){ + $allx[] = $tr; + } + } +} + +#print_r($daytime); echo "<br>"; +#print_r($timex); echo "<br>"; +#print_r($dayx); echo "<br>"; +#print_r($allx); echo "<br>"; + +$daycode = array("MO" => "A", "DI" => "B", "MI" => "C", "DO" => "D", "FR" => "E", "SA" => "F", "SO" => "G"); +$allxcolors = array("#BEBEBE","A0A0A0","#696969","#EEDFCC","#D8BFD8","#505050"); +$dayxcolors = array("#483D8B","#7B68EE","#191970","#8470FF","#708090","#6A5ACD"); +$timexcolors = array("#CDC673","#A2CD5A","#BDB76B","#8B864E","#6B8E23","#CDBE70"); +$daytimecolors = array("880000","#CD6839","#CC3300","#CC6600","#993300","#8B4C39"); + + +if (count($allx) != 0){ + $c = 0; + foreach ($allx as $range){ + foreach ($daycode as $dc){ + for ($i = 0; $i <= 23; $i++){ + $template->assign(array($dc.$i => "background-color:".$allxcolors[$c].";")); + } + } + $legend[] = array($range ,$allxcolors[$c]); + $c++; + } +} + +if (count($dayx) != 0){ + $c = 0; + foreach ($dayx as $range){ + foreach ($daycode as $dc){ + for ($i = $range[1]; $i<= $range[2]; $i++){ + $template->assign(array($dc.$i => "background-color:".$dayxcolors[$c].";")); + } + } + $legend[] = array($range ,$dayxcolors[$c]); + $c++; + } +} + +if (count($timex) != 0){ + $c = 0; + foreach ($timex as $range){ + $dc = $daycode[$range[0]]; + for ($i = 0; $i<= 23; $i++){ + $template->assign(array($dc.$i => "background-color:".$timexcolors[$c].";")); + } + $legend[] = array($range ,$timexcolors[$c]); + $c++; + } +} + +if (count($daytime) != 0){ + $c = 0; + foreach ($daytime as $range){ + $dc = $daycode[$range[0]]; + for ($i = $range[1]; $i<= $range[2]; $i++){ + $template->assign(array($dc.$i => "background-color:".$daytimecolors[$c].";")); + } + $legend[] = array($range ,$daytimecolors[$c]); + $c++; + } +} + +} + +$template->assign(array("MCDESC" => "")); +#print_r($legend); +if (count($legend) != 0){ + $template->define_dynamic("Legende", "Webseite"); + foreach ($legend as $item){ + # Timerange Komponente + $color = $item[1]; + $template->assign(array("TR1" => $item[0][0], + "TR2" => $item[0][1], + "TR3" => $item[0][2], + "MCDESC" => $item[0][3], + "COLOR" => $color)); + $template->parse("LEGENDE_LIST", ".Legende"); + } +} + + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/mcdef.dwt b/ldap-site-mngmt/webinterface/computers/mcdef.dwt new file mode 100644 index 00000000..15f48548 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/mcdef.dwt @@ -0,0 +1,293 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>MachineConfig <code class='font_object'> {MCCN} </code> </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td colspan='2'><h4>Allgemein:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='mcdef_change.php' method='post'> + + <tr> + <td width='25%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Bitte ohne Leerzeichen eingeben) </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + <font size='+2'><b>MC_</b></font><input type='Text' name='mccn' value='{MCCN}' size='50' class='medium_form_field'> + <input type='hidden' name='oldmccn' value='{MCCN}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Machine Config <br>Beschreibung: </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcdesc' value='{MCDESC}' size='60' class='medium_form_field'> + <input type='hidden' name='oldmcdesc' value='{MCDESC}'> + + </td> + </tr> + + + <tr valign='top'> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Gültigkeitsdauer <br>(Time Range(s)): </b> </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Eines der folgenden:<br> + + - <b>Datum</b> (dd.mm, z.B. 21.03/01.11) <br> + - <b>Monatstag</b> (dd, z.B. 01 oder 25) <br> + - <b>Wochentag</b> (MO, DI, ... , SO) <br> + - <b>X</b> für <b>täglich</b> + + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + - <b>Uhrzeit</b> (Format: hh, z.B. 07-19)<br> + - <b>X</b> für rund um die Uhr + + </td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: TRanges --> + <tr valign='top'> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'>Zum Löschen einer Time Range<br>Häkchen setzen </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='checkbox' name='deltr[]' value='{MCDAY}_{MCBEG}_{MCEND}'> + </td> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='mcday[]' value='{MCDAY}' size='5' maxlength='5' class='medium_form_field'> + <input type='hidden' name='oldmcday[]' value='{MCDAY}'> <br> + + + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='mcbeg[]' value='{MCBEG}' size='2' maxlength='2' class='medium_form_field'> + <input type='hidden' name='oldmcbeg[]' value='{MCBEG}'> <b><font size='+1'>:00</b> - </font> + <input type='Text' name='mcend[]' value='{MCEND}' size='2' maxlength='2' class='medium_form_field'> + <input type='hidden' name='oldmcend[]' value='{MCEND}'> <b><font size='+1'>:59</b> Uhr</font><br> + </td> + </tr> + <!-- END DYNAMIC BLOCK: TRanges --> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>Neue Time Range hinzufügen </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='newmcday' value='' size='5' maxlength='5' class='medium_form_field'> + + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='newmcbeg' value='' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:00</b> - </font> + <input type='Text' name='newmcend' value='' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:59</b> Uhr</font><br> + + </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>Dienste:</h4></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='70%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start X: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[start-x]' value='{X}' size='10' maxlength='3' class='medium_form_field'> + <input type='hidden' name='oldattribs[start-x]' value='{X}'> ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start SNMP: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[start-snmp]' value='{SNMP}' size='10' maxlength='3' class='medium_form_field'> + <input type='hidden' name='oldattribs[start-snmp]' value='{SNMP}'> ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start SSHD: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[start-sshd]' value='{SSHD}' size='10' maxlength='3' class='medium_form_field'> + <input type='hidden' name='oldattribs[start-sshd]' value='{SSHD}'> ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start XDMCP: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[start-xdmcp]' value='{XDMCP}' size='10' maxlength='3' class='medium_form_field'> + <input type='hidden' name='oldattribs[start-xdmcp]' value='{XDMCP}'> ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start RWHOD: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[start-rwhod]' value='{RWHOD}' size='10' maxlength='3' class='medium_form_field'> + <input type='hidden' name='oldattribs[start-rwhod]' value='{RWHOD}'> ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start PRINT DAEMON: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[start-printdaemon]' value='{PRINTD}' size='10' maxlength='3' class='medium_form_field'> + <input type='hidden' name='oldattribs[start-printdaemon]' value='{PRINTD}'> ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>TEX Enable: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[tex-enable]' value='{TEX}' size='10' maxlength='3' class='medium_form_field'> + <input type='hidden' name='oldattribs[tex-enable]' value='{TEX}'> ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start CRON: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[start-cron]' value='{CRON}' size='10' maxlength='3' class='medium_form_field'> + <input type='hidden' name='oldattribs[start-cron]' value='{CRON}'> ( yes | no ) + </td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Crontab Entries:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <!-- BEGIN DYNAMIC BLOCK: Crontab --> + <input type='Text' name='crontab[]' value='{CRONTAB}' size='60' class='medium_form_field'> + <input type='hidden' name='oldcrontab[]' value='{CRONTAB}'> <br> + <!-- END DYNAMIC BLOCK: Crontab --> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Language: </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[language]' value='{LANG}' size='10' maxlength='2' class='medium_form_field'> + <input type='hidden' name='oldattribs[language]' value='{LANG}'> + + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>NETBIOS Workgroup: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[netbios-workgroup]' value='{NETBIOS}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[netbios-workgroup]' value='{NETBIOS}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>VMWARE: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[vmware]' value='{VMWARE}' size='40' class='medium_form_field'> + <input type='hidden' name='oldattribs[vmware]' value='{VMWARE}'> + </td> + </tr> + + <input type='hidden' name='nodedn' value='{NODEDN}'> + <input type='hidden' name='mcdn' value='{MCDN}'> + <input type='hidden' name='oldmccn' value='{MCCN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + + <tr> + <td colspan='2'><h4>MachineConfig <code class='font_object'>{MCCN}</code> kopieren:</h4> + Beachten Sie, dass die Time Ranges der Machine Config nicht mit kopiert werden.<br> + Sie müssen diese anschließend neu setzen. <br> + Geben Sie bitte den eindeutigen Namen des neuen MachineConfig-Objektes an. + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='mcdef_copy.php' method='post'> + + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 3 0 1 0;'><b>Ziel Objekt:</b><br> + (Mehrfachauswahl möglich) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + + <select name='copytargets[]' size='10' multiple class='medium_form_selectbox'> + <option selected value='none'>----------------------------</option> + <option value='{DEFDN}'>DEFAULT</option> + + <option value='none'>---- RECHNER -----</option> + <!-- BEGIN DYNAMIC BLOCK: Hosts --> + <option value='{HDN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: Hosts --> + + <option value='none'>---- GRUPPEN -----</option> + <!-- BEGIN DYNAMIC BLOCK: Groups --> + <option value='{GDN}'>{GN}</option> + <!-- END DYNAMIC BLOCK: Groups --> + </select> + </td> + </tr> + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Bitte ohne Leerzeichen eingeben) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <font size='+2'><b>MC_</b></font><input type='Text' name='mccncp' value='{MCCN}' size='50' class='medium_form_field'> + <input type='hidden' name='oldmccncp' value='{MCCN}'> + </td> + </tr> + + <input type='hidden' name='mcdn' value='{MCDN}'> + <input type='hidden' name='oldmccn' value='{MCCN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + <input type='hidden' name='deltr' value='{DELTR}'> + + </table></td> + </tr><tr><td> + <input type='Submit' name='apply' value='kopieren' class='small_loginform_button'> + </form></td></tr> + + <tr> + <td height='40'></td> + </tr> + + <tr> + <td colspan='2'><h4>Default MachineConfig <code class='font_object'>{MCCN}</code> löschen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='delete_confirm.php' method='post'> + + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Die MachineConfig wird komplett gelöscht. + </tr> + + <input type='hidden' name='dn' value='{MCDN}'> + <input type='hidden' name='name' value='{MCCN}'> + <input type='hidden' name='delurl' value='mcdef_delete.php'> + <input type='hidden' name='backurl' value='mcdef.php?dn={MCDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + + + </table></td> + </tr><tr><td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td></tr> + +</table> diff --git a/ldap-site-mngmt/webinterface/computers/mcdef.php b/ldap-site-mngmt/webinterface/computers/mcdef.php new file mode 100644 index 00000000..18e7a0aa --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/mcdef.php @@ -0,0 +1,137 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = -1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "mcdef.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$mcDN = $_GET['dn']; + +$attributes = array("dn","cn","description","timerange","language","start-x","start-snmp","start-sshd", + "start-xdmcp","start-rwhod","start-cron","start-printdaemon","crontab-entries", + "tex-enable","netbios-workgroup","vmware"); +$mc = get_node_data($mcDN,$attributes); +#print_r($mc); + +$exp = explode(',',$mcDN); +$node = array_slice($exp,1); +$nodeDN = implode(',',$node); + +# Timerange Komponenten +$template->define_dynamic("TRanges", "Webseite"); +if (count($mc['timerange']) > 1){ + foreach($mc['timerange'] as $tr){ + $exptime = explode('_',$tr); + $template->assign(array("MCDAY" => $exptime[0], + "MCBEG" => $exptime[1], + "MCEND" => $exptime[2])); + $template->parse("TRANGES_LIST", ".TRanges"); + } +}else{ + $exptime = explode('_',$mc['timerange']); + $template->assign(array("MCDAY" => $exptime[0], + "MCBEG" => $exptime[1], + "MCEND" => $exptime[2])); + $template->parse("TRANGES_LIST", ".TRanges"); +} + +$expcn = explode('_',$mc['cn']); +$name = array_slice($expcn,1); +$mccn = implode('_',$name); + +$template->assign(array("MCDN" => $mcDN, + "MCCN" => $mccn, + "MCDESC" => $mc['description'], + "LANG" => $mc['language'], + "X" => $mc['start-x'], + "SNMP" => $mc['start-snmp'], + "SSHD" => $mc['start-sshd'], + "XDMCP" => $mc['start-xdmcp'], + "RWHOD" => $mc['start-rwhod'], + "CRON" => $mc['start-cron'], + "CRONTAB" => "", + "PRINTD" => $mc['start-printdaemon'], + "TEX" => $mc['tex-enable'], + "NETBIOS" => $mc['netbios-workgroup'], + "VMWARE" => $mc['vmware'], + "NODEDN" => $nodeDN, + "DEFDN" => "cn=computers,".$auDN, + "MNR" => $mnr, + "SBMNR" => $sbmnr, + "MCNR" => $mcnr)); + +$template->define_dynamic("Crontab", "Webseite"); +if ( count($mc['crontab-entries']) != 0 ){ + if ( count($mc['crontab-entries']) > 1 ){ + foreach ($mc['crontab-entries'] as $crontab){ + $template->assign(array("CRONTAB" => $crontab)); + $template->parse("CRONTAB_LIST", ".Crontab"); + } + } + if ( count($mc['crontab-entries']) == 1 ){ + $template->assign(array("CRONTAB" => $mc['crontab-entries'])); + $template->parse("CRONTAB_LIST", ".Crontab"); + } +} +$template->assign(array("CRONTAB" => "")); +$template->parse("CRONTAB_LIST", ".Crontab"); + +################################################ +# MC kopieren + +$hostorgroup = $exp[0]; +$hgexp = explode('=',$exp[0]); + +$hosts_array = get_hosts($auDN,array("dn","hostname")); +$groups_array = get_groups($auDN,array("dn","cn")); + +$template->define_dynamic("Hosts", "Webseite"); +foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'])); + $template->parse("HOSTS_LIST", ".Hosts"); +} +$template->define_dynamic("Groups", "Webseite"); +foreach ($groups_array as $item){ + $template->assign(array("GDN" => $item['dn'], + "GN" => $item['cn'])); + $template->parse("GROUPS_LIST", ".Groups"); +} + + +# falls TR vorhanden dann soll sie gelöscht werden (flag deltr setzen) +if (count($mc['timerange']) != 0){ + $template->assign(array("DELTR" => "1")); +} +else{ + $template->assign(array("DELTR" => "0")); +} + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/mcdef_add.php b/ldap-site-mngmt/webinterface/computers/mcdef_add.php new file mode 100644 index 00000000..efb86e87 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/mcdef_add.php @@ -0,0 +1,160 @@ +<?php +include('../standard_header.inc.php'); + +$mccn = $_POST['mccn']; $mccn = htmlentities($mccn); +$mcdesc = $_POST['mcdesc']; $mcdesc = htmlentities($mcdesc); +$mcday = $_POST['mcday']; $mcday = htmlentities($mcday); +$mcbeg = $_POST['mcbeg']; $mcbeg = htmlentities($mcbeg); +$mcend = $_POST['mcend']; $mcend = htmlentities($mcend); + +$nodeDN = $_POST['nodedn']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$targets = $_POST['targets']; +#print_r($targets); echo "<br>"; +$n = array_keys($targets,'none'); +#print_r($n); echo "<br>"; +for ($i=0; $i<count($n); $i++){ + $match = array_search('none',$targets); + array_splice($targets, $match, 1); +} +#echo "Zielobjekte: ";print_r($targets); echo "<br>"; + +$mcattribs = $_POST['mcattribs']; +if (count($mcattribs) != 0){ + foreach (array_keys($mcattribs) as $key){ + $mcatts[$key] = htmlentities($mcattribs[$key]); + } +} +# print_r($mcatts); echo "<br><br>"; + +$seconds = 2; +$get_mccn = str_replace ( " ", "_", $mccn ); +$get_mcdesc = str_replace ( " ", "_", $mcdesc ); +$get_mcday = str_replace ( " ", "_", $mcday ); +$get_mcbeg = str_replace ( " ", "_", $mcbeg ); +$get_mcend = str_replace ( " ", "_", $mcend ); +$url = "new_mcdef.php?mccn=".$get_mccn."&mcdesc=".$get_mcdesc."&mcday=".$get_mcday."&mcbeg=".$get_mcbeg."&mcend=".$get_mcend."&mnr=".$mnr."&sbmnr=".$sbmnr; + +echo " +<html> +<head> + <title>Computers Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if ( $mccn != "" && $mccn != "Hier_MC_NAME_eintragen"){ + + $mccn = "MC_".$mccn; + # Formulareingaben anpassen + $expmc = explode(" ",$mccn); + foreach ($expmc as $word){$expuc[] = ucfirst($word);} + $mccn = implode(" ",$expuc); + $mccn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $mccn); + + $mctimerange = ""; + + if (count($targets) != 0){ + foreach ($targets as $targetDN){ + + $exptargetdn = ldap_explode_dn($targetDN, 1); + $targetcn = $exptargetdn[0]; + $targettype = $exptargetdn[1]; + + # Check auf eindeutigen MC-Namen am Zielobjekt + $brothers = get_machineconfigs($targetDN,array("cn")); + $brother = 0; + foreach ($brothers as $item){ + if( $item['cn'] == $mccn ){ + $mesg = "Es existiert bereits ein PXE Boot Menü mit dem eingegebenen Namen!<br> + Bitte geben Sie einen anderen Namen ein.<br><br>"; + $url = "new_mcdef.php?mccn=".$get_mccn."&mcday=".$get_mcday."&mcbeg=".$get_mcbeg."&mcend=".$get_mcend."&mnr=".$mnr."&sbmnr=".$sbmnr; + $brother = 1; + break; + } + } + if ($brother == 0){ + + if ( $mcday != "" && $mcbeg != "" && $mcend != "" && $mcbeg <= $mcend ){ + + # TimeRange Syntax checken + $syntax = new Syntaxcheck; + if ($syntax->check_timerange_syntax($mcday,$mcbeg,$mcend)){ + + # in Grossbuchstaben + if (preg_match("/([a-z]+)/",$mcday)){$mcday = strtoupper($mcday);} + if (preg_match("/([a-z]+)/",$mcbeg)){$mcbeg = strtoupper($mcbeg);} + if (preg_match("/([a-z]+)/",$mcend)){$mcend = strtoupper($mcend);} + + # führende Nullen weg + $mcbeg = preg_replace ( '/0([0-9])/', '$1', $mcbeg); + $mcend = preg_replace ( '/0([0-9])/', '$1', $mcend); + + # TimeRange auf Überschneidung mit vorhandenen checken + if(check_timerange($mcday,$mcbeg,$mcend,$targetDN,"")){ + $mctimerange = $mcday."_".$mcbeg."_".$mcend; + } + else{ + $mesg = "Es existiert bereits eine MachineConfig, die sich mit der eingegebenen Time Range + überschneidet!<br> + Die neue MachineConfig wird ohne Time Range angelegt.<br> + Bitte geben Sie diese anschließend ein.<br><br>"; + } + } + else{ + $mesg = "Falsche Syntax in der Time-Range-Eingabe! Die neue MachineConfig wird ohne Time Range angelegt.<br> + Bitte geben Sie diese anschließend ein.<br><br>"; + } + } + else{ + $mesg = "Keine vollständige Time-Range-Eingabe! Die neue MachineConfig wird ohne Time Range angelegt.<br> + Bitte geben Sie diese anschließend ein.<br><br>"; + } + + $mcDN = "cn=".$mccn.",".$targetDN; + print_r($mcDN); echo "<br>"; + + if (add_mc($mcDN,$mccn,$mctimerange,$mcdesc,$mcattribs)){ + $mesg .= "<br>Neue MachineConfig erfolgreich angelegt<br>"; + if ($targettype == "computers"){ + $url = "mcdef.php?dn=".$mcDN."&mnr=1"; + } + if ($targettype == "groups"){ + $url = "mcdef.php?dn=".$mcDN."&mnr=2"; + } + if ($targettype == $au_ou){ + $url = "machineconfig_default.php"; + } + } + else{ + $mesg .= "<br>Fehler beim anlegen der MachineConfig!<br>"; + } + } + } + } + else{ + $mesg .= "<br>Sie haben kein Ziel angegeben!<br>"; + } +} + +elseif ( $mccn == "" || $mccn == "Hier_MC_NAME_eintragen"){ + + $mesg = "Sie haben den Namen der neuen Machine Config nicht angegeben. Dieser ist aber ein notwendiges Attribut.<br> + Bitte geben Sie ihn an.<br><br>"; + $url = "new_mcdef.php?mccn=Hier_MC_NAME_eintragen&mcdesc=".$get_mcdesc."&mcday=".$get_mcday."&mcbeg=".$get_mcbeg."&mcend=".$get_mcend."&mnr=".$mnr."&sbmnr=".$sbmnr; +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/mcdef_change.php b/ldap-site-mngmt/webinterface/computers/mcdef_change.php new file mode 100644 index 00000000..4aaa29fe --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/mcdef_change.php @@ -0,0 +1,402 @@ +<?php +include('../standard_header.inc.php'); + +$mccn = "MC_".$_POST['mccn']; +$mcdesc = $_POST['mcdesc']; $mcdesc = htmlentities($mcdesc); + +$mcday = $_POST['mcday']; +$mcbeg = $_POST['mcbeg']; +$mcend = $_POST['mcend']; +foreach (array_keys($mcday) as $key){ + $mcday[$key] = htmlentities($mcday[$key]); +} +foreach (array_keys($mcbeg) as $key){ + $mcbeg[$key] = htmlentities($mcbeg[$key]); +} +foreach (array_keys($mcend) as $key){ + $mcend[$key] = htmlentities($mcend[$key]); +} + +$deltr = $_POST['deltr']; + +$newmcday = $_POST['newmcday']; $newmcday = htmlentities($newmcday); +$newmcbeg = $_POST['newmcbeg']; $newmcbeg = htmlentities($newmcbeg); +$newmcend = $_POST['newmcend']; $newmcend = htmlentities($newmcend); + +$oldmcdesc = $_POST['oldmcdesc']; $oldmcdesc = htmlentities($oldmcdesc); +$oldmcday = $_POST['oldmcday']; +$oldmcbeg = $_POST['oldmcbeg']; +$oldmcend = $_POST['oldmcend']; + +$crontab = $_POST['crontab']; +$oldcrontab = $_POST['oldcrontab']; +foreach (array_keys($crontab) as $key){ + $crontab[$key] = htmlentities($crontab[$key]); +} + +$mcDN = $_POST['mcdn']; +$oldmccn = "MC_".$_POST['oldmccn']; + +$nodeDN = $_POST['nodedn']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +# sosntige Attribute +$attribs = $_POST['attribs']; +if (count($attribs) != 0){ + foreach (array_keys($attribs) as $key){ + $atts[$key] = htmlentities($attribs[$key]); + } +} +#print_r($atts); echo "<br><br>"; +$oldattribs = $_POST['oldattribs']; +if (count($oldattribs) != 0){ + foreach (array_keys($oldattribs) as $key){ + $oldatts[$key] = htmlentities($oldattribs[$key]); + } +} +#print_r($oldatts); echo "<br><br>"; + + +$seconds = 2; +$url = "mcdef.php?dn=".$mcDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + +echo " +<html> +<head> + <title>Computers Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +############################################## +# MC CN (DN) + +if ( $oldmccn == $mccn ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldmccn != "" && $mccn != "" && $oldmccn != $mccn ){ + echo "Machine Config Name aendern<br>"; + # hier noch Syntaxcheck + # Formulareingaben anpassen + $expmc = explode(" ",$mccn); + foreach ($expmc as $word){$expuc[] = ucfirst($word);} + $mccn = implode(" ",$expuc); + $mccn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $mccn); + + + $newmcDN = "cn=".$mccn.",".$nodeDN; + print_r($newmcDN); echo "<br><br>"; + + if(modify_mc_dn($mcDN, $newmcDN)){ + $mesg = "MC Name erfolgreich geändert<br><br>"; + $mcDN = $newmcDN; + }else{ + $mesg = "Fehler beim ändern des MC Name!<br><br>"; + } + + + # newsubmenu holen... + $url = "mcdef.php?dn=".$newmcDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + +if ( $oldmccn != "" && $mccn == "" ){ + echo "Gruppenname loeschen!<br> + Dieses ist Teil des DN, Sie werden die MachineConfig komplett löschen<br><br>"; + echo "Wollen Sie die MachineConfig <b>".$oldmccn."</b> wirklich löschen?<br><br> + <form action='mcdef_delete.php' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$mcDN."'> + <input type='hidden' name='name' value='".$oldmccn."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$url."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form>"; + $seconds = 600; +} + + +########################################## +# bereits vorhandene TimeRange(s) bearbeiten + +$entrymodtr = array(); +$modtr = 0; +# TimeRanges zusammensetzen +# $t = 0; # Laufvariable für $entrymodtr, da nicht jede Timerange ok sein muss +for ($i=0; $i<count($mcday); $i++){ + +$oldmctimerange = $oldmcday[$i]."_".$oldmcbeg[$i]."_".$oldmcend[$i]; + +if ( ($mcbeg[$i] <= $mcend[$i]) && ( ($mcday[$i] != $oldmcday[$i] && $mcday[$i] != "") || ($mcbeg[$i] != $oldmcbeg[$i] && $mcbeg[$i] != "") || ($mcend[$i] != $oldmcend[$i] && $mcend[$i] != "")) ){ + + + # TimeRange Syntax checken + $syntax = new Syntaxcheck; + if ($syntax->check_timerange_syntax($mcday[$i],$mcbeg[$i],$mcend[$i])){ + + # in Grossbuchstaben + if (preg_match("/([a-z]+)/",$mcday[$i])){$mcday[$i] = strtoupper($mcday[$i]);} + if (preg_match("/([a-z]+)/",$mcbeg[$i])){$mcbeg[$i] = strtoupper($mcbeg[$i]);} + if (preg_match("/([a-z]+)/",$mcend[$i])){$mcend[$i] = strtoupper($mcend[$i]);} + + # führende Nullen weg + $mcbeg[$i] = preg_replace ( '/0([0-9])/', '$1', $mcbeg[$i]); + $mcend[$i] = preg_replace ( '/0([0-9])/', '$1', $mcend[$i]); + + # TimeRange auf Überschneidung mit vorhandenen checken außer mit eigener alter TR da diese + # ja geändert werden soll + if(check_timerange($mcday[$i],$mcbeg[$i],$mcend[$i],$nodeDN,$oldmctimerange)){ + + $mctimerange = $mcday[$i]."_".$mcbeg[$i]."_".$mcend[$i]; + $entrymodtr ['timerange'][$i] = $mctimerange; + $modtr = 1; + + } + else{ + $mesg = "Es existiert bereits eine MachineConfig, die sich mit der eingegebenen Time Range + überschneidet!<br> + Bitte geben Sie eine andere Time Range ein.<br><br>"; + $entrymodtr ['timerange'][$i] = $oldmctimerange; + } + } + else{ + $mesg = "Falsche Syntax in der Timerange-Eingabe!<br> + Bitte geben Sie die erneut Time Range ein.<br><br>"; + $entrymodtr ['timerange'][$i] = $oldmctimerange; + } + +} + + +elseif ( $mcday[$i] == "" || $mcbeg[$i] == "" || $mcend[$i] == "" || $mcbeg[$i] > $mcend[$i]){ + + $mesg = "Sie haben die Time Range <b>Nr.".$i."</b> nicht vollständig angegeben. Diese ist aber ein notwendiges Attribut.<br> + Diese Time Range wird nicht bearbeitet.<br><br>"; + $entrymodtr ['timerange'][$i] = $oldmctimerange; +} + +else{$entrymodtr ['timerange'][$i] = $oldmctimerange;} +} # Ende for-Schleife für jede Timerange +# jetzt noch alle gesammelten Änderungen Durchführen ... +if ($modtr == 1){ + # erst ändern + echo "Ändern: "; print_r($entrymodtr); echo "<br>"; + if($result = ldap_mod_replace($ds,$mcDN,$entrymodtr)){ + $mesg = "TimeRanges erfolgreich geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern der TimeRanges!<br><br>"; + } +} + + +if ( count($deltr) != 0 && $modtr == 0 ){ + # Time Range löschen + $j = 0; + foreach ($deltr as $delrange){ + $entrydeltr ['timerange'][$j] = $delrange; + $j++; + } + # dann löschen + echo "Löschen: "; print_r($entrydeltr); echo "<br>"; + if($result = ldap_mod_del($ds,$mcDN,$entrydeltr)){ + $mesg = "TimeRanges erfolgreich gelöscht<br><br>"; + }else{ + $mesg = "Fehler beim löschen der TimeRanges!<br><br>"; + } +}elseif(count($deltr) != 0 && $modtr == 1){ + echo "Nur Ändern (gleichzeitig Löschen und Ändern geht nicht)"; +} + +##################################### +# TimeRange hinzufügen + +if ( $newmcday != "" && $newmcbeg != "" && $newmcend != "" && $newmcbeg <= $newmcend ){ + + # TimeRange Syntax checken + $syntax = new Syntaxcheck; + if ($syntax->check_timerange_syntax($newmcday,$newmcbeg,$newmcend)){ + + # in Grossbuchstaben + if (preg_match("/([a-z]+)/",$newmcday)){$newmcday = strtoupper($newmcday);} + if (preg_match("/([a-z]+)/",$newmcbeg)){$newmcbeg = strtoupper($newmcbeg);} + if (preg_match("/([a-z]+)/",$newmcend)){$newmcend = strtoupper($newmcend);} + + # führende Nullen weg + $newmcbeg = preg_replace ( '/0([0-9])/', '$1', $newmcbeg); + $newmcend = preg_replace ( '/0([0-9])/', '$1', $newmcend); + + # TimeRange auf Überschneidung mit vorhandenen checken + if(check_timerange($newmcday,$newmcbeg,$newmcend,$nodeDN,"")){ + + $newmctimerange = $newmcday."_".$newmcbeg."_".$newmcend; + $entrytr ['timerange'] = $newmctimerange; + if($result = ldap_mod_add($ds,$mcDN,$entrytr)){ + $mesg = "Zusätzliche TimeRange erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der zusätzlichen TimeRange!<br><br>"; + } + }else{ + $mesg = "Es existiert bereits eine MachineConfig, die sich mit der eingegebenen Time Range + überschneidet!<br> + Bitte geben Sie eine andere Time Range ein.<br><br>"; + } + }else{ + $mesg = "Falsche Syntax in der Timerange-Eingabe!<br> + Bitte geben Sie die erneut Time Range ein.<br><br>"; + } +} + +##################################### +# MC Description + +if ( $oldmcdesc == $mcdesc ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldmcdesc == "" && $mcdesc != "" ){ + echo "MC-Beschreibung neu anlegen<br>"; + # hier noch Syntaxcheck + $entrymc['description'] = $mcdesc; + if(ldap_mod_add($ds,$mcDN,$entrymc)){ + $mesg = "MC-Beschreibung erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der MC-Beschreibung<br><br>"; + } +} + +if ( $oldmcdesc != "" && $mcdesc != "" && $oldmcdesc != $mcdesc ){ + echo "MC-Beschreibung aendern<br>"; + # hier noch Syntaxcheck + $entrymc['description'] = $mcdesc; + if(ldap_mod_replace($ds,$mcDN,$entrymc)){ + $mesg = "MC-Beschreibung erfolgreich geaendert<br><br>"; + }else{ + $mesg = "Fehler beim aendern der MC-Beschreibung<br><br>"; + } +} + +if ( $oldmcdesc != "" && $mcdesc == "" ){ + echo "Rechner-Beschreibung loeschen<br>"; + # hier noch Syntaxcheck + $entrymc['description'] = $oldmcdesc; + if(ldap_mod_del($ds,$mcDN,$entrymc)){ + $mesg = "MC-Beschreibung erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der MC-Beschreibung<br><br>"; + } +} + +##################################### +# Crontab Entries + +if (count($crontab) != 0 && (count(array_diff_assoc($crontab,$oldcrontab)) != 0 || count(array_diff_assoc($oldcrontab,$crontab)) != 0) ){ + + $crontabentry = array(); + foreach ($crontab as $ct){ + if ($ct != ""){ + $crontabentry ['crontab-entries'][] = $ct; + } + } + $oldcrontabentry = array(); + foreach ($oldcrontab as $oldct){ + if ($oldct != ""){ + $oldcrontabentry ['crontab-entries'][] = $oldct; + } + } + + if (count($crontabentry) == 0){ + echo "Crontab Eintrag löschen<br>"; + ldap_mod_del($ds,$mcDN,$oldcrontabentry); + }else{ + echo "Crontab Eintrag ändern<br>"; + print_r($crontabentry); + ldap_mod_replace($ds,$mcDN,$crontabentry); + } +} + +##################################### +# Restliche Attribute + +$entryadd = array(); +$entrymod = array(); +$entrydel = array(); + +foreach (array_keys($atts) as $key){ + + if ( $oldatts[$key] == $atts[$key] ){ + + } + if ( $oldatts[$key] == "" && $atts[$key] != "" ){ + # hier noch Syntaxcheck + $entryadd[$key] = $atts[$key]; + } + if ( $oldatts[$key] != "" && $atts[$key] != "" && $oldatts[$key] != $atts[$key] ){ + # hier noch Syntaxcheck + $entrymod[$key] = $atts[$key]; + } + if ( $oldatts[$key] != "" && $atts[$key] == "" ){ + # hier noch Syntaxcheck + $entrydel[$key] = $oldatts[$key]; + } +} + +#print_r($entryadd); echo "<br>"; +#print_r($entrymod); echo "<br>"; +#print_r($entrydel); echo "<br>"; + + +if (count($entryadd) != 0 ){ + #print_r($entryadd); echo "<br>"; + #echo "neu anlegen<br>"; + foreach (array_keys($entryadd) as $key){ + $addatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_add($ds,$mcDN,$entryadd)){ + $mesg = "Attribute ".$addatts." erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der Attribute ".$addatts."<br><br>"; + } +} + +if (count($entrymod) != 0 ){ + #print_r($entrymod); echo "<br>"; + #echo "ändern<br>"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_replace($ds,$mcDN,$entrymod)){ + $mesg = "Attribute ".$modatts." erfolgreich geaendert<br><br>"; + }else{ + $mesg = "Fehler beim aendern der Attribute ".$modatts."<br><br>"; + } +} + +if (count($entrydel) != 0 ){ + #print_r($entrydel); echo "<br>"; + #echo "löschen<br>"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_del($ds,$mcDN,$entrydel)){ + $mesg = "Attribute ".$delatts." erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der Attribute ".$delatts."<br><br>"; + } +} + + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/mcdef_copy.php b/ldap-site-mngmt/webinterface/computers/mcdef_copy.php new file mode 100644 index 00000000..313b22fc --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/mcdef_copy.php @@ -0,0 +1,111 @@ +<?php +include('../standard_header.inc.php'); + +$mcDN = $_POST['mcdn']; +$mccn = "MC_".$_POST['mccncp']; +$oldmccn = "MC_".$_POST['oldmccncp']; + +$deltr = $_POST['deltr']; + +$nodeDN = $_POST['nodedn']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$copytargets = $_POST['copytargets']; +#print_r($copytargets); echo "<br>"; +$n = array_keys($copytargets,'none'); +#print_r($n); echo "<br>"; +for ($i=0; $i<count($n); $i++){ + $match = array_search('none',$copytargets); + array_splice($copytargets, $match, 1); +} +print_r($copytargets); echo "<br>"; + + +$seconds = 2; +$url = "mcdef.php?dn=".$mcDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + +echo " +<html> +<head> + <title>Computers Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if ( $mccn != ""){ + + # Formulareingaben anpassen + $expmc = explode(" ",$mccn); + foreach ($expmc as $word){$expuc[] = ucfirst($word);} + $mccn = implode(" ",$expuc); + $mccn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $mccn); + + + if (count($copytargets) != 0){ + foreach ($copytargets as $targetDN){ + + $brothers = get_machineconfigs($targetDN,array("cn")); + $brother = 0; + foreach ($brothers as $item){ + if( $item['cn'] == $mccn ){ + $mesg = "Es existiert bereits eine Machine Config mit dem eingegebenen Namen!<br> + Bitte geben Sie einen anderen Namen ein.<br><br>"; + $url = "mcdef.php?dn=".$mcDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + $brother = 1; + break; + } + } + if ($brother == 0){ + + print_r($targetDN); echo "<br>"; + $exptarget = explode(',',$targetDN); + $target = explode('=',$exptarget[0]); + + $newmcDN = "cn=".$mccn.",".$targetDN; + print_r($newmcDN); echo "<br>"; + + + if (dive_into_tree_cp($mcDN,$newmcDN)){ + if($deltr == 1){ + $entrydel ['timerange'] = array(); + # Timeranges im neuen Objekt löschen + if (ldap_mod_del($ds,$newmcDN,$entrydel)){ + $mesg .= "<br>MachineConfig erfolgreich nach ".$target[1]." kopiert<br>"; + } + else{ + ldap_delete($ds,$newmcDN); + $mesg .= "<br>Fehler beim kopieren der MachineConfig nach <b>".$target[1]."</b><br>"; + } + } + } + else{ + $mesg .= "<br>Fehler beim kopieren der MachineConfig nach <b>".$target[1]."</b><br>"; + } + } + } + } + else{ + $mesg .= "<br>Sie haben kein Ziel angegeben!<br>"; + } +} + +elseif ( $mccn == ""){ + + $mesg = "Sie haben den Namen der neuen Machine Config nicht angegeben. Dieser ist aber ein notwendiges Attribut.<br> + Bitte geben Sie ihn an.<br><br>"; + $url = "mcdef.php?dn=".$mcDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/mcdef_delete.php b/ldap-site-mngmt/webinterface/computers/mcdef_delete.php new file mode 100644 index 00000000..e191f703 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/mcdef_delete.php @@ -0,0 +1,40 @@ +<?php +include('../standard_header.inc.php'); + +$mcDN = $_POST['dn']; +$mccn = $_POST['name']; + +$seconds = 1; +$url = 'machineconfig_default.php'; + +echo " +<html> +<head> + <title>Computers Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if ( $mcDN != ""){ + + if ( dive_into_tree_del($mcDN,"") ){ + $mesg = "Machine Config <b>".$mccn."</b> erfolgreich gelöscht!<br><br>"; + } + else{ + $mesg = "Fehler beim löschen der Machine Config <b>".$mccn."</b> !<br><br>"; + } + +} + + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/menu.dwt b/ldap-site-mngmt/webinterface/computers/menu.dwt new file mode 100644 index 00000000..34e02572 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/menu.dwt @@ -0,0 +1,40 @@ + +<table cellpadding='0' cellspacing='0' border='0' width='100%'> + + + <!-- BEGIN DYNAMIC BLOCK: Hauptmenu --> + + <tr valign='middle' align='left'> +
+ <td width='8%' align='right' style="border-style=none;">{ICON}</td> + <td width="8%" align="left" style="border-width:1 0 1 1;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> </td> + <td width="5%" align="left" style="border-width:1 0 1 0;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> </td>
+ <td width="69%" align="left" style="border-width:1 1 1 0;border-color:#000000;border-style:solid;padding:5;background-color:{FARBE}"> + <a href="{LINK_M}" style="text-decoration:none"><b class="standard_schrift">{TEXT_M}</b></a></td>
+ <td width='10%'> </td> + + </tr> + + + + + <!-- BEGIN DYNAMIC BLOCK: Submenu --> + + {SUB} + + <!-- BEGIN DYNAMIC BLOCK: Subsubmenu --> + + {SUBSUB} + + + <!-- END DYNAMIC BLOCK: Subsubmenu --> + + + <!-- END DYNAMIC BLOCK: Submenu --> + + <tr height='5'> + </tr> + +<!-- END DYNAMIC BLOCK: Hauptmenu --> + +</table> diff --git a/ldap-site-mngmt/webinterface/computers/menuentry.dwt b/ldap-site-mngmt/webinterface/computers/menuentry.dwt new file mode 100644 index 00000000..2ad75b93 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/menuentry.dwt @@ -0,0 +1,249 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td height='20'><h4>Zurück zu <a href='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}' class='headerlink'>{PXECN}</a></h4></td> + </tr> + <tr> + <td height='20'> </td> + </tr> + <tr> + <td colspan='2'><h3>Boot Menü Eintrag <code class='font_object'> {MECN} </code> </h3></td> + </tr> + <tr> + <td height='20'> </td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='menuentry_change.php' method='post'> + + <tr> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='60%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mecn' value='{MECN}' size='50' class='medium_form_field'> + <input type='hidden' name='oldmecn' value='{MECN}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Label:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[label]' value='{LABEL}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[label]' value='{LABEL}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Generisches Boot Image: </b><br><br>(Angeboten von) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <h4>{GMECN}</h4> Abteilung: {GMEOU} [Remote Boot Dienst: {GMERBS}] + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Label:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menulabel]' value='{MELABEL}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[menulabel]' value='{MELABEL}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Default:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menudefault]' value='{MEDEF}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[menudefault]' value='{MEDEF}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Passwd:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menupasswd]' value='{MEPASSWD}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[menupasswd]' value='{MEPASSWD}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Hide:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menuhide]' value='{MEHIDE}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[menuhide]' value='{MEHIDE}'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Localboot:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[localboot]' value='{LOCALBOOT}' size='50' class='medium_form_field'> + <input type='hidden' name='oldattribs[localboot]' value='{LOCALBOOT}'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>APPEND Parameter:</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='80%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Client Konfiguration via: </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[clientconfvia]' value='{CCV}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[clientconfvia]' value='{CCV}'> ( dhcp | file | ldap ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>vga: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[vga]' value='{VGA}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[vga]' value='{VGA}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>splash: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[splash]' value='{SPLASH}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[splash]' value='{SPLASH}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>vci: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[vci]' value='{VCI}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[vci]' value='{VCI}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>no ldsc: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[noldsc]' value='{NOLDSC}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[noldsc]' value='{NOLDSC}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>elevator: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[elevator]' value='{ELEVATOR}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[elevator]' value='{ELEVATOR}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>apic: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[apic]' value='{APIC}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[apic]' value='{APIC}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Union FS: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[unionfs]' value='{UNIONFS}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[unionfs]' value='{UNIONFS}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>cowloop: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[cowloop]' value='{COWLOOP}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[cowloop]' value='{COWLOOP}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Debug Level: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[debug]' value='{DEBUG}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[debug]' value='{DEBUG}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menü Position: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='menpos' value='{MENPOS}' size='2' class='medium_form_field'> + <input type='hidden' name='oldmenpos' value='{MENPOS}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Submenü Verweis: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[submenulink]' value='{SUBMENULINK}' size='50' class='medium_form_field'> + <br> + Dieses Feld sollte nur bei Verweisen auf Submenüs den vollständigen Link zu diesen enthalten + <br>(d.h. <TFTP-Server-IP>::/<TFTP-PXE-Pfad>/<Timerange>/<PXE-Dateiname>). <br> + Bei Textzeilen und Leerzeilen muss hier <b>"self"</b> stehen. <br> + Bei normalen Menüeinträgen (inklusive Localboot) muss diese Feld <b>leer</b> sein. + <input type='hidden' name='oldattribs[submenulink]' value='{SUBMENULINK}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Kernel: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[kernel]' value='{KERNEL}' size='50' class='medium_form_field'> + <br> + Angabe hier nur sinnvoll bei Leer-, Textzeilen oder Submenüverweisen, <br> + denn Eingabe wird, wenn der Menüeintrag auf ein generisches Boot Image verweist (siehe oben) <br> + bei der PXE Datei Generierung überschrieben. + <input type='hidden' name='oldattribs[kernel]' value='{KERNEL}'> + </td> + </tr> + + <input type='hidden' name='medn' value='{MEDN}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='timespan' value='{TIMERANGE}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + + <tr> + <td height='40'></td> + </tr> + + <tr> + <td colspan='2'><h4>Boot Menü Eintrag <code class='font_object'>{MECN}</code> löschen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='delete_confirm.php' method='post'> + + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Das generische Boot Image wird komplett gelöscht. + </tr> + + <input type='hidden' name='dn' value='{MEDN}'> + <input type='hidden' name='name' value='{MECN}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='delurl' value='menuentry_delete.php'> + <input type='hidden' name='successurl' value='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + <input type='hidden' name='backurl' value='menuentry.php?dn={MEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + + + </table></td> + </tr> + <tr> + <td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td> + </tr> + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/menuentry.php b/ldap-site-mngmt/webinterface/computers/menuentry.php new file mode 100644 index 00000000..81e1dc63 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/menuentry.php @@ -0,0 +1,170 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = -1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "menuentry.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$meDN = $_GET['dn']; + +$attributes = array("cn","genericmenuentrydn","label","menulabel","menudefault","menupasswd","vga","splash", + "noldsc","elevator","clientconfvia","apic", + "cowloop","unionfs","debug","vci","menuhide","menuposition","localboot","kernel","submenulink"); +$me = get_node_data($meDN,$attributes); +#print_r($me); + +# PXE DN +$exp = explode(',',$meDN); +$node = array_slice($exp,1); +$exppxecn = explode('=',$node[0]); +$pxecn = $exppxecn[1]; +$pxeDN = implode(',',$node); + +# Generic Menu Entry +$expgbm = ldap_explode_dn ($me['genericmenuentrydn'],1); +$gmecn = $expgbm[0]; +$gmerbs = $expgbm[1]; +$gmeou = $expgbm[3]; + +# PXE/RBS Daten +$pxe = get_node_data($pxeDN,array("rbservicedn","timerange")); +$timerange = $pxe['timerange']; +$rbsDN = $pxe['rbservicedn']; +$exp = explode(',',$rbsDN); +$exprbsau = explode('=',$exp[2]); $rbsau = $exprbsau[1]; +$rbsdata = get_node_data($rbsDN,array("cn","nfsserverip","exportpath","tftpserverip","tftppath")); + +# Bootmenu Daten +$template->assign(array("MEDN" => $meDN, + "MECN" => $me['cn'], + "GMECN" => $gmecn, + "GMEOU" => $gmeou, + "GMERBS" => $gmerbs, + "LABEL" => $me['label'], + "MELABEL" => $me['menulabel'], + "MEDEF" => $me['menudefault'], + "MEPASSWD" => $me['menupasswd'], + "MEHIDE" => $me['menuhide'], + "VGA" => $me['vga'], + "SPLASH" => $me['splash'], + "NOLDSC" => $me['noldsc'], + "ELEVATOR" => $me['elevator'], + "VCI" => $me['vci'], + "CCV" => $me['clientconfvia'], + "APIC" => $me['apic'], + "COWLOOP" => $me['cowloop'], + "UNIONFS" => $me['unionfs'], + "DEBUG" => $me['debug'], + "MENPOS" => $me['menuposition'], + "LOCALBOOT" => $me['localboot'], + "KERNEL" => $me['kernel'], + "SUBMENULINK" => $me['submenulink'], + "PXEDN" => $pxeDN, + "PXECN" => $pxecn, + "TIMERANGE" => $timerange, + "MNR" => $mnr, + "SBMNR" => $sbmnr, + "MCNR" => $mcnr)); + +#$template->define_dynamic("Submenulink", "Webseite"); +#if (count($me['submenulink']) != 0){ +# foreach ($me['submenulink'] as $sbml){ +# $template->assign(array("SUBMENULINK" => $sbml)); +# $template->parse("SUBMENULINK_LIST", ".Submenulink"); +# } +#} + +# Alternative RB Dienste holen +$altrbs = get_rbservices($auDN,array("dn","cn")); +if (count($altrbs) != 0){ + for ($i=0; $i < count($altrbs); $i++){ + if ($rbsDN == $altrbs[$i]['dn']){ + array_splice($altrbs, $i, 1); + } + } +} + + +if (count($altrbs) != 0){ +$template->define_dynamic("Altrbs", "Webseite"); + foreach ($altrbs as $item){ + $altrbsexp = explode(',',$item['dn']); + $altrbsau = explode('=',$altrebsexp[2]); + $template->assign(array("ALTRBSDN" => $item['dn'], + "ALTRBSCN" => $item['cn'], + "ALTRBSAU" => "[ ".$altrbsau[1]." ]")); + $template->parse("ALTRBS_LIST", ".Altrbs"); + } +}else{ + $template->assign(array("ALTRBSDN" => "", + "ALTRBSCN" => "", + "ALTRBSAU" => "")); +} + +################################################ +# Bootmenü Einträge + +$menuentries = get_menuentries($pxeDN,array("dn","menuposition","label","menulabel")); +#print_r($menuentries); echo "<br>"; + +$template->define_dynamic("Bootmenu", "Webseite"); + +foreach ($menuentries as $me){ + $template->assign(array("MENDN" => $me['dn'], + "MENULABEL" => $me['menulabel'], + "POSITION" => $me['menuposition'], + "AUDN" => $auDN)); + $template->parse("BOOTMENU_LIST", ".Bootmenu"); +} + + +################################################ +# PXE kopieren + +$hostorgroup = $exp[0]; +$hgexp = explode('=',$exp[0]); + +$hosts_array = get_hosts($auDN,array("dn","hostname")); +$groups_array = get_groups($auDN,array("dn","cn")); + +$template->define_dynamic("Hosts", "Webseite"); +foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'])); + $template->parse("HOSTS_LIST", ".Hosts"); +} +$template->define_dynamic("Groups", "Webseite"); +foreach ($groups_array as $item){ + $template->assign(array("GDN" => $item['dn'], + "GN" => $item['cn'])); + $template->parse("GROUPS_LIST", ".Groups"); +} + +################################################################################### + +include("computers_footer.inc.php"); + +?> diff --git a/ldap-site-mngmt/webinterface/computers/menuentry_add.php b/ldap-site-mngmt/webinterface/computers/menuentry_add.php new file mode 100644 index 00000000..dd10e7c2 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/menuentry_add.php @@ -0,0 +1,263 @@ +<?php +include('../standard_header.inc.php'); + +$mecn = $_POST['mecn']; $mecn = htmlentities($mecn); +$gbmDN = $_POST['gbm']; +$menpos = $_POST['menpos']; +$maxpos = $_POST['maxpos']; + +$typ = $_POST['typ']; +$pxeDN = $_POST['pxedn']; +$timespan = $_POST['timerange']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$meattribs = $_POST['attribs']; +if (count($meattribs) != 0){ + foreach (array_keys($meattribs) as $key){ + $meatts[$key] = htmlentities($meattribs[$key]); + } +} +# print_r($meatts); echo "<br><br>"; + +# PXE Typ (computers/groups) für Submenulinks +$pxearray = ldap_explode_dn($pxeDN, 1); +$pxetype = $pxearray[2]; + +$seconds = 2; +$get_mecn = str_replace ( " ", "_", $mecn ); +$url = "pxe.php?dn=".$pxeDN."&mecn=".$get_mecn."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + +echo " +<html> +<head> + <title>Computers Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; +# switch wäre besser ... +if ($typ == "newme" && $typ != "local" && $typ != "text" && $typ != "leer" && $typ != "submenu" ){ + + if ( $mecn != "" && $mecn != "Hier_NAME_eintragen" && $gbmDN != "none" ){ + + # Formulareingaben anpassen + $expme = explode(" ",$mecn); + foreach ($expme as $word){$expuc[] = ucfirst($word);} + $mecn = implode(" ",$expuc); + $mecn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $mecn); + + if ($menpos != ""){ + # Syntaxcheck Menüposition + #$syntax = new Syntaxcheck; + #if (!($syntax->check_menuposition($menpos))){ + # $menpos = $maxpos; + #} + }else{ + $menpos = $maxpos; + } + if (strlen($menpos) == 1){ + $menpos = "0".$menpos; + } + # nun doch führende Nullen erzwingen + # also obsolet: $menpos = preg_replace ( '/0([0-9])/', '$1', $menpos); + + $meDN = "cn=".$mecn.",".$pxeDN; + + if (add_me($meDN,$mecn,$gbmDN,$menpos,$meatts,$pxeDN)){ + $mesg .= "<br>Neuen Menü Eintrag erfolgreich angelegt<br>"; + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr;; + } + else{ + $mesg .= "<br>Fehler beim anlegen des Menü Eintrags!<br>"; + } + } + + elseif ( $mecn == "" || $mecn == "Hier_NAME_eintragen" || $gbmDN == "none" ){ + + $mesg = "Sie haben den Namen des neuen Menü Eintrags nicht angegeben oder kein + Generisches Boot Image ausgewählt. Beide sind aber ein notwendige Attribute.<br> + Bitte geben Sie sie an.<br><br>"; + $url = "new_menuentry.php?mecn=Hier_NAME_eintragen&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + } +} + +# Localboot Zeile hinzufügen +elseif ($typ == "local" && $typ != "newme" && $typ != "text" && $typ != "leer" && $typ != "submenu" ){ + + # Menu Position + $menpos = $_POST['localpos']; + if ($menpos != ""){ + # Syntaxcheck Menüposition + #$syntax = new Syntaxcheck; + #if (!($syntax->check_menuposition($menpos))){ + # $menpos = $maxpos; + #} + }else{ + $menpos = $maxpos; + } + if (strlen($menpos) == 1){ + $menpos = "0".$menpos; + } + # nun doch führende Nullen erzwingen + # also obsolet: $menpos = preg_replace ( '/0([0-9])/', '$1', $menpos); + + # CN bilden + $brothers = get_menuentries($pxeDN,array("dn","cn")); + $i=1; + $localcn = "localboot".$i; + if(count($brothers) != 0){ + for ($c=0; $c<count($brothers); $c++){ + foreach ($brothers as $item){ + if ($localcn == strtolower($item['cn'])){ + $i++; + $localcn = "localboot".$i; + } + } + } + } + $meDN = "cn=".$localcn.",".$pxeDN; + $entry ['objectclass'][0] = "MenuEntry"; + $entry ['objectclass'][1] = "top"; + $entry ['cn'] = $localcn; + $entry ['menuposition'] = $menpos; + $entry ['label'] = $localcn; + $entry ['menulabel'] = $_POST['locallabel']; + $entry ['menupasswd'] = $_POST['localpasswd']; + $entry ['localboot'] = "level 0"; + $pos = preg_replace ( '/0([0-9])/', '$1', $menpos); + increment_menupositions($pxeDN,$pos); # andere jeweils um 1 erhöhen + if (ldap_add($ds,$meDN,$entry)){ + $mesg .= "Localboot Zeile erfolgeich an Position ".$menpos." eingetragen"; + }else{ + $mesg .= "Fehler beim eintragen der Localboot Zeile!"; + } + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + + +# Text Zeile hinzufügen +elseif ($typ == "text" && $typ != "newme" && $typ != "local" && $typ != "leer" && $typ != "submenu" ){ + + # Menu Position + $menpos = $_POST['textpos']; + if ($menpos != ""){ + # Syntaxcheck Menüposition + #$syntax = new Syntaxcheck; + #if (!($syntax->check_menuposition($menpos))){ + # $menpos = $maxpos; + #} + }else{ + $menpos = $maxpos; + } + if (strlen($menpos) == 1){ + $menpos = "0".$menpos; + } + # nun doch führende Nullen erzwingen + # also obsolet: $menpos = preg_replace ( '/0([0-9])/', '$1', $menpos); + + $text = $_POST['text']; + if($text != "" && $text != "TEXT"){ + $brothers = get_menuentries($pxeDN,array("dn","cn")); + $i=1; + $textcn = "textzeile".$i; + if(count($brothers) != 0){ + for ($c=0; $c<count($brothers); $c++){ + foreach ($brothers as $item){ + if ($textcn == strtolower($item['cn'])){ + $i++; + $textcn = "textzeile".$i; + } + } + } + } + $meDN = "cn=".$textcn.",".$pxeDN; + $entry ['objectclass'][0] = "MenuEntry"; + $entry ['objectclass'][1] = "top"; + $entry ['cn'] = $textcn; + $entry ['menuposition'] = $menpos; + $entry ['label'] = $text; + $entry ['kernel'] = "menu.c32"; + # Submenulink auf sich selbst + $pxedata = get_node_data($pxeDN,array("filename")); + $entry ['submenulink'] = "self"; + + $pos = preg_replace ( '/0([0-9])/', '$1', $menpos); + increment_menupositions($pxeDN,$pos); # andere jeweils um 1 erhöhen + if (ldap_add($ds,$meDN,$entry)){ + $mesg .= "Textzeile erfolgeich an Position ".$menpos." eingetragen"; + }else{ + $mesg .= "Fehler beim eintragen der Textzeile!"; + } + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + } +} + + +elseif ($typ == "leer" && $typ != "newme" && $typ != "local" && $typ != "text" && $typ != "submenu" ){ + + # Menu Position + $menpos = $_POST['leerpos']; + if ($menpos != ""){ + # Syntaxcheck Menüposition + #$syntax = new Syntaxcheck; + #if (!($syntax->check_menuposition($menpos))){ + # $menpos = $maxpos; + #} + }else{ + $menpos = $maxpos; + } + if (strlen($menpos) == 1){ + $menpos = "0".$menpos; + } + # nun doch führende Nullen erzwingen + # also obsolet: $menpos = preg_replace ( '/0([0-9])/', '$1', $menpos); + + # CN bilden + $brothers = get_menuentries($pxeDN,array("dn","cn")); + $i=1; + $leercn = "leerzeile".$i; + if(count($brothers) != 0){ + for ($c=0; $c<count($brothers); $c++){ + foreach ($brothers as $item){ + if ($leercn == strtolower($item['cn'])){ + $i++; + $leercn = "leerzeile".$i; + } + } + } + } + $meDN = "cn=".$leercn.",".$pxeDN; + $entry ['objectclass'][0] = "MenuEntry"; + $entry ['objectclass'][1] = "top"; + $entry ['cn'] = $leercn; + $entry ['menuposition'] = $menpos; + $entry ['kernel'] = "menu.c32"; + # Submenulink auf sich selbst + $pxedata = get_node_data($pxeDN,array("filename")); + $entry ['submenulink'] = "self"; + + # wieder führende Nullen weg für increment_menpos + $pos = preg_replace ( '/0([0-9])/', '$1', $menpos); + increment_menupositions($pxeDN,$pos); # andere jeweils um 1 erhöhen + if (ldap_add($ds,$meDN,$entry)){ + $mesg .= "Leerzeile erfolgeich an Position ".$menpos." eingetragen"; + }else{ + $mesg .= "Fehler beim eintragen der Leerzeile!"; + } + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + + +elseif ($typ == "submenu" && $typ != "newme" && $typ != "local" && $typ != "text" && $typ != "leer" ){ +} + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/menuentry_change.php b/ldap-site-mngmt/webinterface/computers/menuentry_change.php new file mode 100644 index 00000000..bf461f1f --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/menuentry_change.php @@ -0,0 +1,208 @@ +<?php +include('../standard_header.inc.php'); + +$mecn = $_POST['mecn']; $mecn = htmlentities($mecn); +$oldmecn = $_POST['oldmecn']; + +$menpos = $_POST['menpos']; +if (strlen($menpos) == 1){ + $menpos = "0".$menpos; +} +$oldmenpos = $_POST['oldmenpos']; +if (strlen($oldmenpos) == 1){ + $oldmenpos = "0".$oldmenpos; +} + +$meDN = $_POST['medn']; +$pxeDN = $_POST['pxedn']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$attribs = $_POST['attribs']; +if (count($attribs) != 0){ + foreach (array_keys($attribs) as $key){ + $atts[$key] = htmlentities($attribs[$key]); + } +} +# print_r($meatts); echo "<br><br>"; +$oldattribs = $_POST['oldattribs']; +if (count($oldattribs) != 0){ + foreach (array_keys($oldattribs) as $key){ + $oldatts[$key] = htmlentities($oldattribs[$key]); + } +} +#print_r($oldatts); echo "<br><br>"; + + + +$seconds = 2; +$get_mecn = str_replace ( " ", "_", $mecn ); +$url = "menuentry.php?dn=".$meDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + +echo " +<html> +<head> + <title>Computers Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +############################################## +# ME CN (DN) + +if ( $oldmecn == $mecn ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldmecn != "" && $mecn != "" && $oldmecn != $mecn ){ + echo "Menü Eintrag Name aendern<br>"; + # hier noch Syntaxcheck + # Formulareingaben anpassen + $expme = explode(" ",$mecn); + foreach ($expme as $word){$expuc[] = ucfirst($word);} + $mecn = implode(" ",$expuc); + $mecn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $mecn); + + + $newmeDN = "cn=".$mecn.",".$pxeDN; + print_r($newmeDN); echo "<br><br>"; + + if(modify_me_dn($meDN, $newmeDN)){ + $mesg = "Menü Eintrag Name erfolgreich geändert<br><br>"; + $meDN = $newmeDN; + }else{ + $mesg = "Fehler beim ändern des PMenü Eintrag Namen!<br><br>"; + } + + + # newsubmenu holen... + $url = "menuentry.php?dn=".$newmeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + +if ( $oldmecn != "" && $mecn == "" ){ + echo "Menü Eintrag Name loeschen!<br> + Dieses ist Teil des DN, Sie werden den Menü Eintrag komplett löschen<br><br>"; + echo "Wollen Sie den Menü Eintrag <b>".$oldmecn."</b> wirklich löschen?<br><br> + <form action='menuentry_delete.php' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$meDN."'> + <input type='hidden' name='name' value='".$oldmecn."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$url."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form>"; + $seconds = 600; +} + + +################################### +# Menu Position + +if ( $menpos == $oldmenpos || $menpos == "" ){ + # keine Änderung +} + +if ( $menpos != "" && $oldmenpos != $menpos ){ + echo "Menü Position ändern<br><br>"; + # Syntax Check fehlt noch + + # switch partner finden + $secmeDN = get_dn_menuposition($pxeDN,$menpos); + $entrysec ['menuposition'] = $oldmenpos; + if (ldap_mod_replace($ds,$secmeDN,$entrysec)){ + $entry ['menuposition'] = $menpos; + if (ldap_mod_replace($ds,$meDN,$entry)){ + #cleanup_menupositions($pxeDN); + $mesg .= "Menü Position erfolgeich nach <b>".$menpos."</b> geändert"; + }else{ + $mesg .= "Fehler beim ändern der Menü Position!"; + } + }else{ + $mesg .= "Fehler beim ändern der Menü Position!"; + } +} + +################################### +# restliche Attribute + +$entryadd = array(); +$entrymod = array(); +$entrydel = array(); + +foreach (array_keys($atts) as $key){ + + if ( $oldatts[$key] == $atts[$key] ){ + # nix + } + if ( $oldatts[$key] == "" && $atts[$key] != "" ){ + # hier noch Syntaxcheck + $entryadd[$key] = $atts[$key]; + } + if ( $oldatts[$key] != "" && $atts[$key] != "" && $oldatts[$key] != $atts[$key] ){ + # hier noch Syntaxcheck + $entrymod[$key] = $atts[$key]; + } + if ( $oldatts[$key] != "" && $atts[$key] == "" ){ + # hier noch Syntaxcheck + $entrydel[$key] = $oldatts[$key]; + } +} +#print_r($entryadd); echo "<br>"; +#print_r($entrymod); echo "<br>"; +#print_r($entrydel); echo "<br>"; + +if (count($entryadd) != 0 ){ + #print_r($entryadd); echo "<br>"; + #echo "neu anlegen<br>"; + foreach (array_keys($entryadd) as $key){ + $addatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_add($ds,$meDN,$entryadd)){ + $mesg = "Attribute ".$addatts." erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der Attribute ".$addatts."<br><br>"; + } +} + +if (count($entrymod) != 0 ){ + #print_r($entrymod); echo "<br>"; + #echo "ändern<br>"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_replace($ds,$meDN,$entrymod)){ + $mesg = "Attribute ".$modatts." erfolgreich geaendert<br><br>"; + }else{ + $mesg = "Fehler beim aendern der Attribute ".$modatts."<br><br>"; + } +} + +if (count($entrydel) != 0 ){ + #print_r($entrydel); echo "<br>"; + #echo "löschen<br>"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_del($ds,$meDN,$entrydel)){ + $mesg = "Attribute ".$delatts." erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der Attribute ".$delatts."<br><br>"; + } +} + +################################### +# Ende, noch Redirect + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/menuentry_delete.php b/ldap-site-mngmt/webinterface/computers/menuentry_delete.php new file mode 100644 index 00000000..ba06eb55 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/menuentry_delete.php @@ -0,0 +1,41 @@ +<?php +include('../standard_header.inc.php'); + +$meDN = $_POST['dn']; +$mecn = $_POST['name']; + +$pxeDN = $_POST['pxedn']; + +$seconds = 1; +$url = $_POST['successurl']; + +echo " +<html> +<head> + <title>Computers Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if ( $meDN != ""){ + + if ( dive_into_tree_del($meDN,"") ){ + cleanup_menupositions($pxeDN); + $mesg = "Bootmenü Eintrag <b>".$mecn."</b> erfolgreich gelöscht!<br><br>"; + } + else{ + $mesg = "Fehler beim löschen des Bootmenü Eintrags <b>".$mecn."</b> !<br><br>"; + } + +} + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/menuposition_down.php b/ldap-site-mngmt/webinterface/computers/menuposition_down.php new file mode 100644 index 00000000..53e82a21 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/menuposition_down.php @@ -0,0 +1,42 @@ +<?php +include('../standard_header.inc.php'); + +$meDN = $_GET['dn']; +$oldpos = $_GET['pos']; + +$pxeDN = $_GET['pxedn']; +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +$me = get_menuentries($pxeDN,array("cn")); +$maxpos = count($me); + +$oldpos = preg_replace ( '/0([0-9])/', '$1', $oldpos); +if ($oldpos < $maxpos){ + + $newpos = $oldpos +1; + if (strlen($newpos) == 1){ + $newpos = "0".$newpos; + } + if (strlen($oldpos) == 1){ + $oldpos = "0".$oldpos; + } + + if ($secmeDN = get_dn_menuposition($pxeDN,$newpos)){ + #echo "other meDN:"; print_r($secmeDN); echo "<br>"; + $entrysec ['menuposition'] = $oldpos; + if ($result = ldap_mod_replace($ds,$secmeDN,$entrysec)){ + $entrymenu ['menuposition'] = $newpos; + $result = ldap_mod_replace($ds,$meDN,$entrymenu); + } + } +} +$seconds = 0; +$url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr."&#menu"; +$mesg = ""; +#$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> +# Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/menuposition_up.php b/ldap-site-mngmt/webinterface/computers/menuposition_up.php new file mode 100644 index 00000000..4a314aca --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/menuposition_up.php @@ -0,0 +1,40 @@ +<?php +include('../standard_header.inc.php'); + +$meDN = $_GET['dn']; +$oldpos = $_GET['pos']; + +$pxeDN = $_GET['pxedn']; +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +$oldpos = preg_replace ( '/0([0-9])/', '$1', $oldpos); +if ($oldpos != 1){ + + $newpos = $oldpos-1; + if (strlen($newpos) == 1){ + $newpos = "0".$newpos; + } + if (strlen($oldpos) == 1){ + $oldpos = "0".$oldpos; + } + + if ($secmeDN = get_dn_menuposition($pxeDN,$newpos)){ + #echo "other meDN:"; print_r($secmeDN); echo "<br>"; + $entrysec ['menuposition'] = $oldpos; + if ($result = ldap_mod_replace($ds,$secmeDN,$entrysec)){ + $entrymenu ['menuposition'] = $newpos; + $result = ldap_mod_replace($ds,$meDN,$entrymenu); + } + + } +} +$seconds = 0; +$url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr."&#menu"; +$mesg = ""; +#$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> +# Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_group.dwt b/ldap-site-mngmt/webinterface/computers/new_group.dwt new file mode 100644 index 00000000..ea9accf0 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_group.dwt @@ -0,0 +1,101 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Neue Rechnergruppe anlegen:</h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr> + <td colspan='2'><h4>Notwendige Attribute (müssen angegeben werden):</h3></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='group_add.php' method='post'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Gruppen Name (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='groupcn' value='{GROUPCN}' size='40' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='40'></td> + </tr> + <tr> + <td><h4>Optionale Attribute:</h3></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Gruppen-Rechner:</b><br>(Mehrfachauswahl möglich) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <!-- BEGIN DYNAMIC BLOCK: Members --> + + <!-- END DYNAMIC BLOCK: Members --> + + <select name='addmember[]' size='{HOSTNUMBER}' multiple class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Hosts --> + <option value='{HDN}_{HOSTNAME}'>{HOSTNAME}</option> + <!-- END DYNAMIC BLOCK: Hosts --> + + </select> + </td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Gruppen Beschreibung: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='groupdesc' value='{GROUPDESC}' size='40' class='medium_form_field'> + </td> + </tr> + + + </tr> + </table></td> + </tr> + + <tr> + <td height='25'></td> + </tr> + <tr> + <td><h4>Gruppe als Group-Objekt in den DHCP Dienst aufnehmen (optional):</h3></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>DHCP Objekt</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Auswahl</b></td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='5'></td> + </tr> + <tr> + <td style='border-width: 0 0 0 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_group.php b/ldap-site-mngmt/webinterface/computers/new_group.php new file mode 100644 index 00000000..0fcd8bcc --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_group.php @@ -0,0 +1,76 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 2; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "new_group.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + + +$groupcn = str_replace ( "_", " ", $_GET['groupcn']); +$groupdesc = str_replace ( "_", " ", $_GET['groupdesc']); + + + +$template->assign(array("GROUPCN" => $groupcn, + "GROUPDESC" => $groupdesc, + "AUDN" => $auDN)); + +# DHCP Stuff ... + + +############################################## +# neues Member anlegen ... +$hosts_array = get_hosts($auDN,array("dn","hostname")); +# print_r($users_array); echo "<br><br>"; +$groups = get_groups($auDN, array("member")); +# print_r($groups); +$template->assign(array("HOSTNAME" => "")); + +if (count($groups) != 0){ + foreach ($groups as $group){ + for ($i=0; $i < count($hosts_array); $i++){ + foreach ($group['member'] as $item){ # ist hier sicher dass member ein array ist auch bei 1 member? + if ($hosts_array[$i]['dn'] == $item){ + array_splice($hosts_array, $i, 1); + $i--; + } + } + } + } +} +# if (count($users_array) != 0){ + $template->define_dynamic("Hosts", "Webseite"); + foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HOSTNAME" => $item['hostname'], + "HOSTNUMBER" => 5)); + $template->parse("HOSTS_LIST", ".Hosts"); + } + + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_host.dwt b/ldap-site-mngmt/webinterface/computers/new_host.dwt new file mode 100644 index 00000000..32366a42 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_host.dwt @@ -0,0 +1,112 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Neuen Rechner anlegen:</h3></td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr> + <td colspan='2'><h4>Notwendige Attribute (müssen angegeben werden):</h3></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='host_add.php' method='post'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Rechner Name (hostname):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='hostname' value='{HOSTNAME}' size='40' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='25'></td> + </tr> + <tr> + <td><h4>Optionale Attribute:</h3></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Rechner Beschreibung: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='hostdesc' value='{HOSTDESC}' size='40' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>MAC Adresse (HWAddress) :</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mac' value='{MAC}' size='17' maxlength='17' class='medium_form_field'> + Bsp.: 00-12-03-aa-54-e6 + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>IP Adresse:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='ip' value='{IP}' size='15' maxlength='15' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>HW Mouse: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[hw-mouse]' value='{MOUSE}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>HW Graphic: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[hw-graphic]' value='{GRAPHIC}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>HW Monitor: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[hw-monitor]' value='{MONITOR}' size='30' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='25'></td> + </tr> + <tr> + <td><h4>Rechner als Host-Objekt in den DHCP Dienst aufnehmen (optional):</h3></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='45%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>DHCP Objekt</b></td> + <td width='55%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Auswahl</b></td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='5'></td> + </tr> + <tr> + <td style='border-width: 0 0 0 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_host.php b/ldap-site-mngmt/webinterface/computers/new_host.php new file mode 100644 index 00000000..9be7b46e --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_host.php @@ -0,0 +1,53 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "new_host.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + + +$hostname = str_replace ( "_", " ", $_GET['hostname']); +$hostdesc = str_replace ( "_", " ", $_GET['hostdesc']); +$mac = str_replace ( "_", " ", $_GET['mac']); +$ip = str_replace ( "_", " ", $_GET['ip']); + + +$template->assign(array("HOSTNAME" => $hostname, + "HOSTDESC" => $hostdesc, + "MAC" => $mac, + "IP" => $ip, + "MOUSE" => "", + "GRAPHIC" => "", + "MONITOR" => "", + "AUDN" => $auDN)); + + +# DHCP Stuff + + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_mcdef.dwt b/ldap-site-mngmt/webinterface/computers/new_mcdef.dwt new file mode 100644 index 00000000..72ebf72d --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_mcdef.dwt @@ -0,0 +1,184 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Neue Default MachineConfig anlegen:</h3></td> + </tr> + <tr> + <td height='10'> </td> + </tr> + <tr> + <td colspan='2'><h4>Allgemein:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='mcdef_add.php' method='post'> + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Bitte ohne Leerzeichen eingeben) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + <font size='+2'><b>MC_</b></font><input type='Text' name='mccn' value='{MCCN}' size='50' class='medium_form_field'> + </td> + </tr> + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Machine Config <br>Beschreibung: </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcdesc' value='{MCDESC}' size='60' class='medium_form_field'> + + </td> + </tr> + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Ziel Objekt:</b><br> + (Mehrfachauswahl möglich) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='targets[]' size='8' multiple class='medium_form_selectbox'> + <option selected value='none'>----------------------------</option> + <option value='{NODEDN}'>DEFAULT</option> + + <option value='none'>----- RECHNER spezif. MC -----</option> + <!-- BEGIN DYNAMIC BLOCK: Hosts --> + <option value='{HDN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: Hosts --> + + <option value='none'>----- GRUPPEN MC -----</option> + <!-- BEGIN DYNAMIC BLOCK: Groups --> + <option value='{GDN}'>{GN}</option> + <!-- END DYNAMIC BLOCK: Groups --> + </select> + </td> + </tr> + + <tr valign='top'> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Gültigkeitsdauer <br>(Time Range): </b> </td> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcday' value='{MCDAY}' size='5' maxlength='5' class='medium_form_field'> + <br> + Eines der folgenden:<br> + + - <b>Datum</b> (Format: dd.mm, z.B. 21.03/01.11) <br> + - <b>Monatstag</b> (Format: dd, z.B. 01 oder 25) <br> + - <b>Wochentag</b> (Format: MO, DI, ... , SO) <br> + - <b>X</b> für <b>täglich</b> + + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcbeg' value='{MCBEG}' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:00</b> - </font> + <input type='Text' name='mcend' value='{MCEND}' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:59</b> Uhr</font><br> + - <b>Uhrzeit</b> (Format: hh, z.B. 07-19)<br> + - <b>X</b> für rund um die Uhr + </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>Dienste:</h4></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='70%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start X: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[start-x]' value='' size='10' maxlength='3' class='medium_form_field'> + ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start SNMP: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[start-snmp]' value='' size='10' maxlength='3' class='medium_form_field'> + ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start SSHD: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[start-sshd]' value='' size='10' maxlength='3' class='medium_form_field'> + ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start XDMCP: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[start-xdmcp]' value='' size='10' maxlength='3' class='medium_form_field'> + ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start RWHOD: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[start-rwhod]' value='' size='10' maxlength='3' class='medium_form_field'> + ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start PRINT DAEMON: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[start-printdaemon]' value='' size='10' maxlength='3' class='medium_form_field'> + ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>TEX Enable: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[tex-enable]' value='' size='10' maxlength='3' class='medium_form_field'> + ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Start CRON: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[start-cron]' value='' size='10' maxlength='3' class='medium_form_field'> + ( yes | no ) + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>CRONTAB Entries: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[crontab-entries]' value='' size='50' class='medium_form_field'> + </td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Language: </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[language]' value='' size='10' class='medium_form_field'> + + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>NETBIOS Workgroup: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[netbios-workgroup]' value='' size='40' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>VMWARE: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mcattribs[vmware]' value='' size='40' class='medium_form_field'> + </td> + </tr> + + <input type='hidden' name='nodedn' value='{NODEDN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_mcdef.php b/ldap-site-mngmt/webinterface/computers/new_mcdef.php new file mode 100644 index 00000000..eec7a3dd --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_mcdef.php @@ -0,0 +1,74 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 4; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "new_mcdef.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$mccn = str_replace ( "_", " ", $_GET['mccn']); +$mcdesc = str_replace ( "_", " ", $_GET['mcdesc']); +$mcday = str_replace ( "_", " ", $_GET['mcday']); +$mcbeg = str_replace ( "_", " ", $_GET['mcbeg']); +$mcend = str_replace ( "_", " ", $_GET['mcend']); + + +$template->assign(array("MCCN" => $mccn, + "MCDAY" => $mcday, + "MCBEG" => $mcbeg, + "MCEND" => $mcend, + "MCDESC" => $mcdesc, + "NODEDN" => "cn=computers,".$auDN, + "MNR" => $mnr, + "SBMNR" => $sbmnr, + "MCNR" => $mcnr)); + +################################################# +# Ziel Objekt (nur Rechner und Gruppen, Default) + +$hostorgroup = $exp[0]; +$hgexp = explode('=',$exp[0]); + +$hosts_array = get_hosts($auDN,array("dn","hostname")); +$groups_array = get_groups($auDN,array("dn","cn")); + +$template->define_dynamic("Hosts", "Webseite"); +foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'])); + $template->parse("HOSTS_LIST", ".Hosts"); +} +$template->define_dynamic("Groups", "Webseite"); +foreach ($groups_array as $item){ + $template->assign(array("GDN" => $item['dn'], + "GN" => $item['cn'])); + $template->parse("GROUPS_LIST", ".Groups"); +} + + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_menuentry.dwt b/ldap-site-mngmt/webinterface/computers/new_menuentry.dwt new file mode 100644 index 00000000..9ccaa5ff --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_menuentry.dwt @@ -0,0 +1,191 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td height='20'><h4>Zurück zu <a href='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}' class='headerlink'>{PXECN}</a></h4></td> + </tr> + <tr> + <td height='20'> </td> + </tr> + <tr> + <td colspan='2'><h3>Neuen Boot Menü Eintrag anlegen:</h3></td> + </tr> + <tr> + <td height='20'> </td> + </tr> + <tr> + <td colspan='2'><h4>Notwendige Attribute:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='menuentry_add.php' method='post'> + + <tr> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='65%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Teil des dn, ohne Leerzeichen eingeben) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='mecn' value='{MECN}' size='60' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Label:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[label]' value='{LABEL}' size='60' class='medium_form_field'> + </td> + </tr> + <tr height='50' valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Generische Boot Images: </b><br>(Wählen Sie eines aus) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='gbm' size='10' class='large_form_selectbox'> + <option selected value='none'>-----------------------</option> + <!-- BEGIN DYNAMIC BLOCK: Rbs --> + <option value='none'>----- Abteilung {RBSAU} [{RBSCN}] -----</option> + <!-- BEGIN DYNAMIC BLOCK: Gbms --> + <option value='{GBMDN}'>{GBMCN} </option> + <!-- END DYNAMIC BLOCK: Gbms --> + <!-- END DYNAMIC BLOCK: Rbs --> + </select> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menü Position: </b><br> + (Bitte ohne führende Null) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='menpos' value='{MAXPOS}' size='2' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='40'> </td> + </tr> + <tr> + <td colspan='2'><h4>Optionale Attribute:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='65%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Label:</b> <br>(Wird im Bootmenü statt Label angezeigt) </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menulabel]' value='{MELABEL}' size='50' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Passwd:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menupasswd]' value='{MEPASSWD}' size='50' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Hide:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menuhide]' value='{MEHIDE}' size='50' class='medium_form_field'> + </td> + </tr> + <tr height='50'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Localboot:</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[localboot]' value='{LOCALBOOT}' size='50' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>APPEND Parameter:</h4></td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='80%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Client Konfiguration via: </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[clientconfvia]' value='{CCV}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>vga: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[vga]' value='{VGA}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>splash: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[splash]' value='{SPLASH}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>vci: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[vci]' value='{VCI}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>no ldsc: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[noldsc]' value='{NOLDSC}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>elevator: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[elevator]' value='{ELEVATOR}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>apic: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[apic]' value='{APIC}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Union FS: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[unionfs]' value='{UNIONFS}' size='30' class='medium_form_field'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>cowloop: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[cowloop]' value='{COWLOOP}' size='30' class='medium_form_field'> + </td> + </tr> + + <input type='hidden' name='typ' value='newme'> + <input type='hidden' name='maxpos' value='{MAXPOS}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + + + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_menuentry.php b/ldap-site-mngmt/webinterface/computers/new_menuentry.php new file mode 100644 index 00000000..155ed245 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_menuentry.php @@ -0,0 +1,150 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = -1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "new_menuentry.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$mecn = str_replace ( "_", " ", $_GET['mecn']); + +$pxeDN = $_GET['dn']; +$dnexp = ldap_explode_dn($pxeDN, 1); +$pxecn = $dnexp[0]; + +# RBS Daten +$pxe = get_node_data($pxeDN,array("rbservicedn")); +$rbsDN = $pxe['rbservicedn']; +$exp = explode(',',$rbsDN); +$exprbsau = explode('=',$exp[2]); $rbsau = $exprbsau[1]; +$rbsdata = get_node_data($rbsDN,array("cn","nfsserverip","exportpath","tftpserverip","tftppath")); + +# Anzahl Menüeinträge +$menens = get_menuentries($pxeDN,array("dn")); +$maxpos = count($menens)+1; + + +# Bootmenu Daten +$template->assign(array("MECN" => $mecn, + "LABEL" => "", + "MELABEL" => "", + "MEDEF" => "", + "MEPASSWD" => "", + "MEHIDE" => "", + "VGA" => "", + "SPLASH" => "", + "NOLDSC" => "", + "ELEVATOR" => "", + "VCI" => "", + "CCV" => "", + "APIC" => "", + "COWLOOP" => "", + "UNIONFS" => "", + "DEBUG" => "", + "LOCALBOOT" => "", + "SUBMENULINK" => "", + "MENPOS" => "", + "MAXPOS" => $maxpos, + "PXEDN" => $pxeDN, + "PXECN" => $pxecn, + "MNR" => $mnr, + "SBMNR" => $sbmnr, + "MCNR" => $mcnr)); + + +# verwendbare GBMs holen +# eigene AU (andere noch über "offer" Attribut in RBS suchen) +$rbsoffers = get_rbsoffers($auDN); +# eigene AU +if (count($rbsoffers) != 0){ + $rbservices = get_rbservices($auDN,array("dn")); + # wenn eigene RBS anbietet dann diese GBMs als erstes (oben in der Liste) + if (count($rbservices) != 0){ + foreach ($rbservices as $rbs){ + for ($i=0; $i < count($rbsoffers); $i++){ + if ($rbs['dn'] == $rbsoffers[$i]){ + array_splice($rbsoffers, $i, 1); + } + } + } + # momentan maximal ein RBS in der AU + $rbsaudn[] = $rbservices[0]['dn']; + $rbsoffsorted = array_merge($rbsaudn,$rbsoffers); + } + # sonst die GBMs des für diese PXE genutzen RBS + else{ + for ($i=0; $i < count($rbsoffers); $i++){ + if ($rbsDN == $rbsoffers[$i]){ + array_splice($rbsoffers, $i, 1); + } + } + $rbsaudn[] = $rbsDN; + $rbsoffsorted = array_merge($rbsaudn,$rbsoffers); + } +} +#print_r($rbsoffsorted);echo "<br><br>"; +# RBS Offers nun in der Reihenfolge erst eigene AU dann Rest ... +$attributes = array("dn","cn","label","kernel","initrd","nfsroot","nbdroot","ipappend"); +$template->assign(array("GBMDN" => "", + "GBMCN" => "Keine generischen Boot Images verfügbar", + "RBSCN" => "", + "RBSAU" => "")); +if (count($rbsoffsorted) != 0){ + $template->define_dynamic("Rbs", "Webseite"); + $template->define_dynamic("Gbms", "Webseite"); + + foreach ($rbsoffsorted as $rbsoff){ + $template->clear_parse("GBMS_LIST"); + #print_r($rbsoff);echo "<br><br>"; + $rbsdnexp = ldap_explode_dn($rbsoff,1); + $rbsoffcn = $rbsdnexp[0]; + $rbsoffau = $rbsdnexp[2]; + + $gbm_array = get_menuentries($rbsoff,$attributes); + if (count($gbm_array) != 0){ + + foreach ($gbm_array as $item){ + $template->assign(array("GBMDN" => $item['dn'], + "GBMCN" => $item['cn'])); + $template->parse("GBMS_LIST", ".Gbms"); + $template->clear_dynamic("Gbms"); + } + + } + $template->assign(array("RBSCN" => $rbsoffcn, + "RBSAU" => $rbsoffau)); + $template->parse("RBS_LIST", ".Rbs"); + $template->clear_dynamic("Rbs"); + + } +} + + + +################################################################################### + +include("computers_footer.inc.php"); + +?> diff --git a/ldap-site-mngmt/webinterface/computers/new_pxe.dwt b/ldap-site-mngmt/webinterface/computers/new_pxe.dwt new file mode 100644 index 00000000..2a50e977 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_pxe.dwt @@ -0,0 +1,175 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>Neues PXE Boot Menü anlegen:</h3></td> + </tr> + <tr> + <td height='10'> </td> + </tr> + <tr> + <td colspan='2'><h4>Allgemein:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='pxe_add.php' method='post'> + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Bitte ohne Leerzeichen eingeben) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + <font size='+2'><b>PXE_</b></font><input type='Text' name='pxecn' value='{PXECN}' size='50' class='medium_form_field'> + </td> + </tr> + <!--<tr valign='top'> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Remote Boot Dienst <br> + auswählen: </b> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='rbs' size='5' class='medium_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Altrbs --> + <option value='{ALTRBSDN}'>{ALTRBSCN} {ALTRBSAU}</option> + <!-- END DYNAMIC BLOCK: Altrbs --> + + </select> + </td> + </tr>--> + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Ziel Objekt:</b><br> + (Mehrfachauswahl möglich) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <select name='targets[]' size='8' multiple class='medium_form_selectbox'> + <option selected value='none'>----- RECHNER spezif. PXE -----</option> + <!-- BEGIN DYNAMIC BLOCK: Hosts --> + <option value='{HDN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: Hosts --> + + <option value='none'>----- GRUPPEN spezif. PXE -----</option> + <!-- BEGIN DYNAMIC BLOCK: Groups --> + <option value='{GDN}'>{GN}</option> + <!-- END DYNAMIC BLOCK: Groups --> + </select> + </td> + </tr> + <tr valign='top'> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Gültigkeitsdauer <br>(Time Range): </b> </td> + <td width='40%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='pxeday' value='{PXEDAY}' size='5' maxlength='5' class='medium_form_field'> + <br> + Eines der folgenden:<br> + + - <b>Datum</b> (Format: dd.mm, z.B. 21.03/01.11) <br> + - <b>Monatstag</b> (Format: dd, z.B. 01 oder 25) <br> + - <b>Wochentag</b> (Format: MO, DI, ... , SO) <br> + - <b>X</b> für <b>täglich</b> + + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='pxebeg' value='{PXEBEG}' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:00</b> - </font> + <input type='Text' name='pxeend' value='{PXEEND}' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:59</b> Uhr</font><br> + - <b>Uhrzeit</b> (Format: hh, z.B. 07-19)<br> + - <b>X</b> für rund um die Uhr + </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>Globale PXE Parameter:</h4></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='70%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Default: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[default]' value='{DEFAULT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[default]' value='{DEFAULT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Title: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menutitle]' value='{MENTIT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[menutitle]' value='{MENTIT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Master Passwd: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menumasterpasswd]' value='{MENMPW}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[menumasterpasswd]' value='{MENMPW}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Timeout: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[timeout]' value='{TIMEOUT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[timeout]' value='{TIMEOUT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>No Escape: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[noescape]' value='{NOESC}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[noescape]' value='{NOESC}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Prompt: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[prompt]' value='{PROMPT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[prompt]' value='{PROMPT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Allow Options: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[allowoptions]' value='{ALLOW}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[allowoptions]' value='{ALLOW}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>On Error: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[onerror]' value='{ONERR}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[onerror]' value='{ONERR}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>ON Timeout: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[ontimeout]' value='{ONTIME}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[ontimeout]' value='{ONTIME}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Client-Conf Dateiname <br>(File URI): </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='conffile' value='{FILEURI}' size='50' class='medium_form_field'> + + </td> + </tr> + + <input type='hidden' name='nodedn' value='{NODEDN}'> + <input type='hidden' name='oldpxecn' value='{PXECN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + </table></td> + </tr> + <tr> + <td><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'> + </form></td> + </tr> + +</table>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/new_pxe.php b/ldap-site-mngmt/webinterface/computers/new_pxe.php new file mode 100644 index 00000000..07890505 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/new_pxe.php @@ -0,0 +1,130 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = 5; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "new_pxe.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$pxecn = str_replace ( "_", " ", $_GET['pxecn']); +$pxeday = str_replace ( "_", " ", $_GET['pxeday']); +$pxebeg = str_replace ( "_", " ", $_GET['pxebeg']); +$pxeend = str_replace ( "_", " ", $_GET['pxeend']); + +$template->assign(array("PXECN" => $pxecn, + "PXEDAY" => $pxeday, + "PXEBEG" => $pxebeg, + "PXEEND" => $pxeend, + # "LDAPURI" => "", + "FILEURI" => "", + "RBS" => "", + "RBSAU" => "", + "NFS" => "", + "NFSROOT" => "", + "TFTP" => "", + "TFTPROOT" => "", + "FILE" => "", + "ALLOW" => "", + "CONSOLE" => "", + "DEFAULT" => "menu.c32", + "DISPLAY" => "", + "FONT" => "", + "IMPLICIT" => "", + "KBDMAP" => "", + "MENMPW" => "", + "MENTIT" => "", + "NOESC" => "1", + "ONERR" => "", + "ONTIME" => "", + "PROMPT" => "0", + "SAY" => "", + "SERIAL" => "", + "TIMEOUT" => "600", + "NODEDN" => "cn=rbs,".$auDN, + "HDN" => "none", + "HN" => "", + "GDN" => "none", + "GN" => "", + "MNR" => $mnr, + "SBMNR" => $sbmnr)); + +############################################# +# RB Dienste holen +$rbsoffers = get_rbsoffers($auDN); + +$template->assign(array("ALTRBSDN" => "", + "ALTRBSCN" => "", + "ALTRBSAU" => "")); + +if (count($rbsoffers) != 0){ +$template->define_dynamic("Altrbs", "Webseite"); + foreach ($rbsoffers as $item){ + $rbsdnexp = ldap_explode_dn($item,1); + $rbsoffcn = $rbsdnexp[0]; + $rbsoffau = $rbsdnexp[2]; + #$auexp = explode(',',$item['auDN']); + #$altrbsau = explode('=',$auexp[0]); + $template->assign(array("ALTRBSDN" => $item, + "ALTRBSCN" => $rbsoffcn, + "ALTRBSAU" => " [ Abt.: ".$rbsoffau." ]")); + $template->parse("ALTRBS_LIST", ".Altrbs"); + } +} + +################################################# +# Ziel Objekt (nur Rechner und Gruppen, nicht Default) + +$hostorgroup = $exp[0]; +$hgexp = explode('=',$exp[0]); + +$hosts_array = get_hosts($auDN,array("dn","hostname","hlprbservice","hwaddress")); +if ( count($hosts_array) != 0 ){ + $template->define_dynamic("Hosts", "Webseite"); + foreach ($hosts_array as $item){ + # Nur Hosts die in DHCP/TFTP angemeldet und deren MAC eingetragen ist (für PXE-Filename) + if ( $item['hlprbservice'] != "" && $item['hwaddress'] != "" ){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'])); + $template->parse("HOSTS_LIST", ".Hosts"); + } + } +} + +$groups_array = get_groups($auDN,array("dn","cn","hlprbservice")); +if ( count($groups_array) != 0 ){ + $template->define_dynamic("Groups", "Webseite"); + foreach ($groups_array as $item){ + if ( $item['hlprbservice'] != "" ){ + $template->assign(array("GDN" => $item['dn'], + "GN" => $item['cn'])); + $template->parse("GROUPS_LIST", ".Groups"); + } + } +} + +################################################################################### + +include("computers_footer.inc.php"); + +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/pxe.dwt b/ldap-site-mngmt/webinterface/computers/pxe.dwt new file mode 100644 index 00000000..0dff23eb --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/pxe.dwt @@ -0,0 +1,476 @@ +<table border='0' cellpadding='5' cellspacing='0' width='100%'> + <tr> + <td colspan='2'><h3>PXE Boot Menü <code class='font_object'> {PXECN} </code> </h3></td> + </tr> + <tr> + <td height='10'></td> + </tr> + + <tr> + <td colspan='2'>Klicken Sie auf einen Menüeintrag um zur Detailansicht zu gelangen und den Eintrag bearbeiten zu können</td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='80%' style='border-color: black; border-style: solid; border-width: 2 2 2 2;'> + + <tr> + <td width='8%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'>#</td> + <td width='8%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'>Flags</td> + <td width='64%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'>Menu Label </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + <td width='15%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: Bootmenu --> + <form action='delete_confirm.php' method='post'> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;{BGCDEF}'>{POSITION} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;{BGCDEF}'>{MEDEF} {MEPWD} {MEHIDE} </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;{BGCDEF}'><font size='+1'>{ANZEIGE} </font></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;{BGCDEF}'> + <a href='menuposition_up.php?dn={MENDN}&pos={POSITION}&pxedn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'><img style='border-width:0;border-style=none;' src='../pics/up2.gif' height='15'></a> <br> + <a href='menuposition_down.php?dn={MENDN}&pos={POSITION}&pxedn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'><img style='border-width:0;border-style=none;' src='../pics/down2.gif' height='15'></a></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;{BGCDEF}'> + <input type='hidden' name='dn' value='{MENDN}'> + <input type='hidden' name='name' value='{ANZEIGENAME}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='delurl' value='menuentry_delete.php'> + <input type='hidden' name='successurl' value='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + <input type='hidden' name='backurl' value='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </tr> + </form> + <!-- END DYNAMIC BLOCK: Bootmenu --> + + </table></td> + </tr> + <tr> + <td><h4>Flags:</h4></font> + <ul> + <li><b>D</b> -> Default Menüeintrag</li> + <li><b>P</b> -> Passwort geschützt</li> + <li><b>H</b> -> Hidden</li> + </ul> + </td> + </tr> + <tr> + <td height='20'></td> + </tr> + <tr> + <td colspan='2'><h4>Neuen Menüeintrag anlegen: </h4> + <a href='new_menuentry.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}' style='color:#FFFFFF;' class='small_loginform_button'> zur Eingabemaske </a> </td> + </tr> + <tr> + <td height='10'></td> + </tr> + <tr> + <td colspan='2'><h4>Standard Menüeinträge anlegen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + + <tr> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'>Typ </td> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + <td width='10%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'>Position</td> + <td width='10%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'> </td> + </tr> + <tr valign='top'> + <form action='menuentry_add.php' method='post'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Localboot</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + Menu Label<br><input type='Text' name='locallabel' value='' size='20' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + Passwort (optional)<br><input type='Text' name='localpasswd' value='' size='20' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Text' name='localpos' value='{MAXPOS}' size='2' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'></td> + <input type='hidden' name='typ' value='local'> + <input type='hidden' name='maxpos' value='{MAXPOS}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='timerange' value='{TIMERANGE}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + </form> + </tr> + <tr valign='top'> + <form action='menuentry_add.php' method='post'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Textzeile</b> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Text' name='text' value='TEXT' size='50' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Text' name='textpos' value='{MAXPOS}' size='2' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'></td> + <input type='hidden' name='typ' value='text'> + <input type='hidden' name='maxpos' value='{MAXPOS}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='timerange' value='{TIMERANGE}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + </form> + </tr> + <tr valign='top'> + <form action='menuentry_add.php' method='post'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Leerzeile</b> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Text' name='leerpos' value='{MAXPOS}' size='2' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'></td> + <input type='hidden' name='typ' value='leer'> + <input type='hidden' name='maxpos' value='{MAXPOS}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='timerange' value='{TIMERANGE}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + </form> + </tr> + <tr valign='top'> + <form action='menuentry_add.php' method='post'> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Verweis zu Submenü</b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>Submenü Name<br> + <input type='Text' name='submenu' value='' size='20' class='medium_form_field'></td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>Remote Boot Service + <select name='subrbs' size='3' class='small_form_selectbox'> + <option selected value='none'>----------</option> + <!-- BEGIN DYNAMIC BLOCK: Subrbs --> + <option value='{SUBRBSDN}'>{SUBRBSCN} {SUBRBSAU}</option> + <!-- END DYNAMIC BLOCK: Subrbs --> + </select> + </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Text' name='submenupos' value='{MAXPOS}' size='2' class='medium_form_field'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><input type='Submit' name='apply' value='anlegen' class='small_loginform_button'></td> + <input type='hidden' name='typ' value='submenu'> + <input type='hidden' name='maxpos' value='{MAXPOS}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='timerange' value='{TIMERANGE}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + </form> + </tr> + + </table></td> + </tr> + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>Allgemeine Parameter:</h4></td> + </tr> + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <form action='pxe_change.php' method='post'> + <tr> + <td width='25%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Bitte ohne Leerzeichen eingeben) </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + <font size='+2'><b>PXE_</b></font><input type='Text' name='pxecn' value='{PXECN}' size='50' class='medium_form_field'> + <input type='hidden' name='oldpxecn' value='{PXECN}'> + </td> + </tr> + + <tr valign='top'> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Remote Boot Dienst: </b> </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <b>{RBS}</b> [Abteilung: <b>{RBSAU}</b>] </h4><br> + Von diesem Dienst verwendete Bootserver: <br> + <b>-</b> NFS Server {NFS}{NFSROOT}<br> + <b>-</b> TFTP Server {TFTP}{TFTPROOT}</td> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <b>Alternativen Dienst verwenden:</b><br> + <select name='rbs' size='3' class='small_form_selectbox'> + <option selected value='none'>----------</option> + + <!-- BEGIN DYNAMIC BLOCK: Altrbs --> + <option value='{ALTRBSDN}'>{ALTRBSCN} {ALTRBSAU}</option> + <!-- END DYNAMIC BLOCK: Altrbs --> + + </select> + </td> + </tr> + <tr valign='top'> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'><b>Gültigkeitsdauer <br>(Time Range(s)): </b><br> + Zum Löschen einer Time Range<br>Häkchen setzen </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Eines der folgenden:<br> + + - <b>Datum</b> (dd.mm, z.B. 21.03/01.11) <br> + - <b>Monatstag</b> (dd, z.B. 01 oder 25) <br> + - <b>Wochentag</b> (MO, DI, ... , SO) <br> + - <b>X</b> für <b>täglich</b> + + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + - <b>Uhrzeit</b> (Format: hh, z.B. 07-19)<br> + - <b>X</b> für rund um die Uhr + + </td> + </tr> + + <!-- BEGIN DYNAMIC BLOCK: TRanges --> + <tr valign='top'> + <td width='25%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> </td> + <td width='5%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='checkbox' name='deltr[]' value='{PXEDAY}_{PXEBEG}_{PXEEND}'> + </td> + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='pxeday[]' value='{PXEDAY}' size='5' maxlength='5' class='medium_form_field'> + <input type='hidden' name='oldpxeday[]' value='{PXEDAY}'> <br> + + + <td width='35%' style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + <input type='Text' name='pxebeg[]' value='{PXEBEG}' size='2' maxlength='2' class='medium_form_field'> + <input type='hidden' name='oldpxebeg[]' value='{PXEBEG}'> <b><font size='+1'>:00</b> - </font> + <input type='Text' name='pxeend[]' value='{PXEEND}' size='2' maxlength='2' class='medium_form_field'> + <input type='hidden' name='oldpxeend[]' value='{PXEEND}'> <b><font size='+1'>:59</b> Uhr</font><br> + </td> + </tr> + <!-- END DYNAMIC BLOCK: TRanges --> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'>Neue Time Range hinzufügen </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='newpxeday' value='' size='5' maxlength='5' class='medium_form_field'> + + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='newpxebeg' value='' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:00</b> - </font> + <input type='Text' name='newpxeend' value='' size='2' maxlength='2' class='medium_form_field'> + <b><font size='+1'>:59</b> Uhr</font><br> + + </td> + </tr> + + </table></td> + </tr> + + + + <tr> + <td height='40'></td> + </tr> + <tr> + <td colspan='2'><h4>Globale PXE Parameter:</h4></td> + </tr> + + <tr><td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr> + <td width='20%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Attribut</b></td> + <td width='80%' style='border-color: black; border-style: solid; border-width: 0 0 3 0;'><b>Wert</b></td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Default: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[default]' value='{DEFAULT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[default]' value='{DEFAULT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Title: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menutitle]' value='{MENTIT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[menutitle]' value='{MENTIT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Menu Master Passwd: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[menumasterpasswd]' value='{MENMPW}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[menumasterpasswd]' value='{MENMPW}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Timeout: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[timeout]' value='{TIMEOUT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[timeout]' value='{TIMEOUT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>No Escape: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[noescape]' value='{NOESC}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[noescape]' value='{NOESC}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Prompt: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[prompt]' value='{PROMPT}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[prompt]' value='{PROMPT}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Allow Options: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[allowoptions]' value='{ALLOW}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[allowoptions]' value='{ALLOW}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>On Error: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[onerror]' value='{ONERR}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[onerror]' value='{ONERR}'> + </td> + </tr> + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>ON Timeout: </b> </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <input type='Text' name='attribs[ontimeout]' value='{ONTIME}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[ontimeout]' value='{ONTIME}'> + </td> + </tr> + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>File URI: </td> + <td style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <font size='+1'>tftp://{TFTP}/{TFTPFILE}</font><input type='Text' name='attribs[fileuri]' value='{FILEURI}' size='30' class='medium_form_field'> + <input type='hidden' name='oldattribs[fileuri]' value='{FILEURI}'> + + </td> + </tr> + + </table></td> + </tr> + + <tr> + <td height='20'></td> + </tr> + <tr> + <td colspan='2'><h4>PXE Dateiname:</h4> + Achtung: Änderungen hier können zu nicht verwendeten PXE Dateien führen!<br> + Sie sollten hier nur Änderungen vornehmen, wenn der PXE Datei offensichtlich ein falscher Name zugewiesen ist.<br> + Wird z.B. vom betroffenen Rechner die MAC Adresse geändert, so wird dies vom System automatisch an dieser Stelle nachvollzogen. + Diese Feld dient daher primär der Kontrolle.</td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='1' align='left' width='90%' style='border-width: 0 0 0 0;'> + + <tr valign='top'> + <td width='40%' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + <b>PXE Dateiname(n): </b><br> + Bei PXE von Gruppen ist für jeden Mitgliedsrechner<br> + der PXE Dateiname aufgelistet. + </td> + <td style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + <!-- BEGIN DYNAMIC BLOCK: Filenames --> + <input type='Text' name='filename[]' value='{FILE}' size='40' class='medium_form_field'> + <input type='hidden' name='oldfilename[]' value='{FILE}'> + <!-- END DYNAMIC BLOCK: Filenames --> + <input type='Text' name='newfilename' value='' size='40' class='medium_form_field'> + </td> + </tr> + + </table></td> + </tr> + <tr> + <td> + <input type='hidden' name='nodedn' value='{NODEDN}'> + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='oldpxecn' value='{PXECN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + <input type='Submit' name='apply' value='anwenden' class='small_loginform_button'> + </form></td> + </tr> + + + + <tr> + <td height='50'></td> + </tr> + + <tr> + <td colspan='2'><h4>PXE Boot Menü <code class='font_object'>{PXECN}</code> kopieren:</h4> + Beachten Sie, dass die Time Ranges des PXE Boot Menüs nicht kopiert werden. Sie müssen diese anschließend + neu setzen. <br> + Geben Sie bitte den eindeutigen Namen des neuen PXE Boot Menüs an.</td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='pxe_copy.php' method='post'> + + <tr valign='top'> + <td style='border-color: black; border-style: solid; border-width: 3 0 1 0;'><b>Ziel Objekt:</b><br> + (Mehrfachauswahl möglich) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 3 0 1 0;'> + + <select name='copytargets[]' size='10' multiple class='medium_form_selectbox'> + <option selected value='none'>----------------------------</option> + <option value='{DEFDN}'>DEFAULT</option> + + <option value='none'>---- RECHNER -----</option> + <!-- BEGIN DYNAMIC BLOCK: Hosts --> + <option value='{HDN}'>{HN}</option> + <!-- END DYNAMIC BLOCK: Hosts --> + + <option value='none'>---- GRUPPEN -----</option> + <!-- BEGIN DYNAMIC BLOCK: Groups --> + <option value='{GDN}'>{GN}</option> + <!-- END DYNAMIC BLOCK: Groups --> + </select> + </td> + </tr> + <tr> + <td width='30%' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'><b>Eindeutiger Name (cn):</b><br>(Bitte ohne Leerzeichen eingeben) </td> + <td colspan='2' style='border-color: black; border-style: solid; border-width: 0 0 1 0;'> + <font size='+2'><b>PXE_</b></font><input type='Text' name='pxecncp' value='{PXECN}' size='50' class='medium_form_field'> + <input type='hidden' name='oldpxecncp' value='{PXECN}'> + </td> + </tr> + + <input type='hidden' name='pxedn' value='{PXEDN}'> + <input type='hidden' name='oldpxecn' value='{PXECN}'> + <input type='hidden' name='mnr' value='{MNR}'> + <input type='hidden' name='sbmnr' value='{SBMNR}'> + <input type='hidden' name='mcnr' value='{MCNR}'> + <input type='hidden' name='deltr' value='{DELTR}'> + + </table></td> + </tr><tr><td> + <input type='Submit' name='apply' value='kopieren' class='small_loginform_button'> + </form></td></tr> + + <tr> + <td height='50'></td> + </tr> + + <tr> + <td colspan='2'><h4>PXE Boot Menü <code class='font_object'>{PXECN}</code> löschen:</h4></td> + </tr> + <tr> + <td> + <table cellpadding='7' cellspacing='0' border='0' align='left' width='90%' style='border-width: 0 0 0 0;'> + <form action='delete_confirm.php' method='post'> + + + <tr> + <td style='border-color: black; border-style: solid; border-width: 0 0 0 0;'> + Die MachineConfig wird komplett gelöscht. + </tr> + + <input type='hidden' name='dn' value='{PXEDN}'> + <input type='hidden' name='name' value='{PXECN}'> + <input type='hidden' name='delurl' value='pxe_delete.php'> + <input type='hidden' name='successurl' value='{NODETYP}.php?dn={NODEDN}&mnr={MNR}&sbmnr={SBMNR}'> + <input type='hidden' name='backurl' value='pxe.php?dn={PXEDN}&mnr={MNR}&sbmnr={SBMNR}&mcnr={MCNR}'> + + </table></td> + </tr><tr><td> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'> + </form></td></tr> + +</table> diff --git a/ldap-site-mngmt/webinterface/computers/pxe.php b/ldap-site-mngmt/webinterface/computers/pxe.php new file mode 100644 index 00000000..bbc2e5e1 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/pxe.php @@ -0,0 +1,252 @@ +<?php + +include('../standard_header.inc.php'); + +# 1. Seitentitel - wird in der Titelleiste des Browser angezeigt. +$titel = "Computers Management"; +# 2. Nummer des zugehörigen Hauptmenus (Registerkarte) beginnend bei 0, siehe Dokumentation.doc. +$mainnr = 3; +$mnr = -1; +$sbmnr = -1; +$mcnr = -1; +# 3. Dateiname und evtl. Pfad des Templates für die Webseite +$webseite = "pxe.dwt"; + +include("../class.FastTemplate.php"); + +include('computers_header.inc.php'); + +################################################################################### + +$mnr = $_GET['mnr']; +$sbmnr = $_GET['sbmnr']; +$mcnr = $_GET['mcnr']; + +# Menuleisten erstellen +createMainMenu($rollen, $mainnr); +createComputersMenu($rollen, $mnr, $auDN, $sbmnr, $mcnr); + +################################################################################### + +$pxeDN = $_GET['dn']; + +$attributes = array("dn","cn","rbservicedn","filename","timerange","allowoptions","console","default", + "display","font","implicit","kbdmap","menumasterpasswd","menutitle", + "noescape","onerror","ontimeout","prompt","say","serial","timeout","ldapuri","fileuri"); +$pxe = get_node_data($pxeDN,$attributes); +#print_r($pxe); + +$exp = explode(',',$pxeDN); +$node = array_slice($exp,1); +$nodeDN = implode(',',$node); + +# RBS Daten +$rbsDN = $pxe['rbservicedn']; +$exp = explode(',',$rbsDN); +$exprbsau = explode('=',$exp[2]); $rbsau = $exprbsau[1]; +$rbsdata = get_node_data($rbsDN,array("cn","nfsserverip","exportpath","tftpserverip","tftppath","tftpclientconfpath")); + +# Timerange Komponenten +$template->define_dynamic("TRanges", "Webseite"); +if (count($pxe['timerange']) > 1){ + foreach($pxe['timerange'] as $tr){ + $exptime = explode('_',$tr); + $template->assign(array("PXEDAY" => $exptime[0], + "PXEBEG" => $exptime[1], + "PXEEND" => $exptime[2])); + $template->parse("TRANGES_LIST", ".TRanges"); + } +}else{ + $exptime = explode('_',$pxe['timerange']); + $template->assign(array("PXEDAY" => $exptime[0], + "PXEBEG" => $exptime[1], + "PXEEND" => $exptime[2])); + $template->parse("TRANGES_LIST", ".TRanges"); +} + +# Filenames +$template->define_dynamic("Filenames", "Webseite"); +if (count($pxe['filename']) > 1){ + foreach($pxe['filename'] as $fi){ + $template->assign(array("FILE" => $fi)); + $template->parse("FILENAMES_LIST", ".Filenames"); + } +}else{ + $exptime = explode('_',$pxe['filename']); + $template->assign(array("FILE" => $pxe['filename'])); + $template->parse("FILENAMES_LIST", ".Filenames"); +} + +$expcn = explode('_',$pxe['cn']); +$name = array_slice($expcn,1); +$pxecn = implode('_',$name); + +# Bootmenü Einträge +$menuentries = get_menuentries($pxeDN,array("dn","menuposition","label","menulabel","menudefault","menupasswd","menuhide")); +# print_r($menuentries); echo "<br>"; +$maxpos = count($menuentries)+1; + +# Globale Parameter +$template->assign(array("PXEDN" => $pxeDN, + "PXECN" => $pxecn, + "TIMERANGE" => $pxe['timerange'], + "RBS" => $rbsdata['cn'], + "RBSAU" => $rbsau, + "NFS" => $rbsdata['nfsserverip'], + "NFSROOT" => $rbsdata['exportpath'], + "TFTP" => $rbsdata['tftpserverip'], + "TFTPROOT" => $rbsdata['tftppath'], + "TFTPFILE" => $rbsdata['tftpclientconfpath'], + #"LDAPURI" => $pxe['ldapuri'], + "FILEURI" => $pxe['fileuri'], + "ALLOW" => $pxe['allowoptions'], + "CONSOLE" => $pxe['console'], + "DEFAULT" => $pxe['default'], + "DISPLAY" => $pxe['display'], + "FONT" => $pxe['font'], + "IMPLICIT" => $pxe['implicit'], + "KBDMAP" => $pxe['kbdmap'], + "MENMPW" => $pxe['menumasterpasswd'], + "MENTIT" => $pxe['menutitle'], + "NOESC" => $pxe['noescape'], + "ONERR" => $pxe['onerror'], + "ONTIME" => $pxe['ontimeout'], + "PROMPT" => $pxe['prompt'], + "SAY" => $pxe['say'], + "SERIAL" => $pxe['serial'], + "TIMEOUT" => $pxe['timeout'], + "MAXPOS" => $maxpos, + "NODEDN" => $nodeDN, + "DEFDN" => "cn=rbs,".$auDN, + "MNR" => $mnr, + "SBMNR" => $sbmnr, + "MCNR" => $mcnr)); + +# Alternative RB Dienste holen +$altrbs = get_rbsoffers($auDN); + +# $altrbs = get_rbservices($auDN,array("dn","cn")); +$subrbs = $altrbs; +if (count($altrbs) != 0){ + for ($i=0; $i < count($altrbs); $i++){ + if ($rbsDN == $altrbs[$i]){ + array_splice($altrbs, $i, 1); + } + } +} +$template->assign(array("ALTRBSDN" => "", + "ALTRBSCN" => "", + "ALTRBSAU" => "")); +if (count($altrbs) != 0){ +$template->define_dynamic("Altrbs", "Webseite"); + foreach ($altrbs as $item){ + $rbsdnexp = ldap_explode_dn($item,1); + $rbsoffcn = $rbsdnexp[0]; + $rbsoffau = $rbsdnexp[2]; + #$altrbsexp = explode(',',$item['dn']); + #$altrbsau = explode('=',$altrbsexp[2]); + $template->assign(array("ALTRBSDN" => $item, + "ALTRBSCN" => $rbsoffcn, + "ALTRBSAU" => " [ Abt.: ".$rbsoffau." ]")); + $template->parse("ALTRBS_LIST", ".Altrbs"); + } +} + +# Für Submenü Einträge +$template->assign(array("SUBRBSDN" => "", + "SUBRBSCN" => "", + "SUBRBSAU" => "")); +if (count($subrbs) != 0){ +$template->define_dynamic("Subrbs", "Webseite"); + foreach ($subrbs as $item){ + $rbsdnexp = ldap_explode_dn($item,1); + $subrbscn = $rbsdnexp[0]; + $subrbsau = $rbsdnexp[2]; + #$subrbsexp = explode(',',$item['dn']); + #$subrbsau = explode('=',$subrbsexp[2]); + $template->assign(array("SUBRBSDN" => $item, + "SUBRBSCN" => $subrbscn, + "SUBRBSAU" => "[ ".$subrbsau." ]")); + $template->parse("SUBRBS_LIST", ".Subrbs"); + } +} + +################################################ +# Bootmenü Einträge + +$template->define_dynamic("Bootmenu", "Webseite"); +$template->assign(array("MENDN" => "", + "MENULABEL" => "", + "ANZEIGE" => "Noch kein Bootmenü Eintrag angelegt", + "MEDEF" => "", + "MEPWD" => "", + "MEHIDE" => "", + "BGCDEF" => "", + "POSITION" => "")); +foreach ($menuentries as $me){ + $anzeige = ""; + if ($me['label'] != "" && $me['menulabel'] == ""){$anzeige .= $me['label'];} + if ($me['menulabel'] != ""){$anzeige .= $me['menulabel'];} + if ($me['menudefault'] == 1){$medef = "<b>D</b>"; $bgcdef = "background-color:#EEDD82;";} + if ($me['menupasswd'] != ""){$mepwd = "<b>P</b>";} + if ($me['menuhide'] == 1){$mehide = "<b>H</b>"; $bgcdef = "background-color:#A0A0A0;";} + $template->assign(array("MENDN" => $me['dn'], + "ANZEIGE" => "<a href='menuentry.php?dn=".$me['dn']."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr."' class='headerlink'>".$anzeige."</a>", + "ANZEIGENAME" => $anzeige, + "POSITION" => $me['menuposition'], + "MEDEF" => $medef, + "MEPWD" => $mepwd, + "MEHIDE" => $mehide, + "BGCDEF" => $bgcdef, + "AUDN" => $auDN)); + $template->parse("BOOTMENU_LIST", ".Bootmenu"); + $medef = ""; + $bgcdef = ""; +} + + +################################################ +# PXE kopieren + +$hostorgroup = $exp[0]; +$hgexp = explode('=',$exp[0]); + + +$hosts_array = get_hosts($auDN,array("dn","hostname")); +$groups_array = get_groups($auDN,array("dn","cn")); + +$template->define_dynamic("Hosts", "Webseite"); +foreach ($hosts_array as $item){ + $template->assign(array("HDN" => $item['dn'], + "HN" => $item['hostname'])); + $template->parse("HOSTS_LIST", ".Hosts"); +} +$template->define_dynamic("Groups", "Webseite"); +foreach ($groups_array as $item){ + $template->assign(array("GDN" => $item['dn'], + "GN" => $item['cn'])); + $template->parse("GROUPS_LIST", ".Groups"); +} + +$dnexp = ldap_explode_dn($pxeDN, 1); +if ($dnexp[2] == "computers"){ + $nodetyp = "host"; +} +if ($dnexp[2] == "groups"){ + $nodetyp = "group"; +} +# falls TR vorhanden dann soll sie gelöscht werden (flag deltr setzen) +if (count($pxe['timerange']) != 0){ + $template->assign(array("DELTR" => "1", + "NODETYP" => $nodetyp)); +} +else{ + $template->assign(array("DELTR" => "0", + "NODETYP" => $nodetyp)); +} + +################################################################################### + +include("computers_footer.inc.php"); + +?> diff --git a/ldap-site-mngmt/webinterface/computers/pxe_add.php b/ldap-site-mngmt/webinterface/computers/pxe_add.php new file mode 100644 index 00000000..8aa54c31 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/pxe_add.php @@ -0,0 +1,228 @@ +<?php +include('../standard_header.inc.php'); + +$pxecn = $_POST['pxecn']; $pxecn = htmlentities($pxecn); +#$rbsDN = $_POST['rbs']; + +$pxeday = $_POST['pxeday']; $pxeday = htmlentities($pxeday); +$pxebeg = $_POST['pxebeg']; $pxebeg = htmlentities($pxebeg); +$pxeend = $_POST['pxeend']; $pxeend = htmlentities($pxeend); + +$conffile = $_POST['conffile']; $conffile = htmlentities($conffile); + +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$targets = $_POST['targets']; +#print_r($targets); echo "<br>"; +$n = array_keys($targets,'none'); +#print_r($n); echo "<br>"; +for ($i=0; $i<count($n); $i++){ + $match = array_search('none',$targets); + array_splice($targets, $match, 1); +} +#echo "Zielobjekte: ";print_r($targets); echo "<br>"; + +$pxeattribs = $_POST['pxeattribs']; +if (count($pxeattribs) != 0){ + foreach (array_keys($pxeattribs) as $key){ + $pxeatts[$key] = htmlentities($pxeattribs[$key]); + } +} +# print_r($mcatts); echo "<br><br>"; + +$seconds = 20; +$get_pxecn = str_replace ( " ", "_", $pxecn ); +$get_pxeday = str_replace ( " ", "_", $pxeday ); +$get_pxebeg = str_replace ( " ", "_", $pxebeg ); +$get_pxeend = str_replace ( " ", "_", $pxeend ); +$url = "new_pxe.php?pxecn=".$get_pxecn."&pxeday=".$get_pxeday."&pxebeg=".$get_pxebeg."&pxeend=".$get_pxeend."&mnr=".$mnr."&sbmnr=".$sbmnr; + +echo " +<html> +<head> + <title>Computers Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if ( $pxecn != "" && $pxecn != "Hier_PXE_NAME_eintragen" && $rbsDN != "none" ){ + + $pxecn = "PXE_".$pxecn; + # Formulareingaben anpassen + $exppxe = explode(" ",$pxecn); + foreach ($exppxe as $word){$expuc[] = ucfirst($word);} + $pxecn = implode(" ",$expuc); + $pxecn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $pxecn); + + $pxetimerange = ""; + $nomac = 0; + + if (count($targets) != 0){ + foreach ($targets as $targetDN){ + + $exptargetdn = ldap_explode_dn($targetDN, 1); + $targetcn = $exptargetdn[0]; + $targettype = $exptargetdn[1]; + + # falls Target keine MAC hat dann kann keine PXE angelegt werden + # jetzt schon vorher bei der Zielobjektauswahl abgefangen + if ($targettype == "computers"){ + $macdata = get_node_data($targetDN, array("hwaddress")); + if ($macdata['hwaddress'] == ""){ + $nomac = 1; + echo "Für den Ziel-Rechner ist keine MAC Adresse eingetragen <br> + Das PXE Bootmenü wird nicht angelegt. <br> + <br> + Tragen Sie zuerst eine MAC ein!<br><br>"; + } + } + if ($targettype == "groups"){ + $members = get_node_data($targetDN, array("member")); + if (count($members) > 1){ + foreach ($members['member'] as $hostDN){ + $macdata = get_node_data($hostDN, array("hwaddress","hostname")); + if ($macdata['hwaddress'] == ""){ + $nomac = 1; + echo "Für den Gruppen-Rechner <b>".$macdata['hostname']."</b> ist keine MAC Adresse eingetragen <br> + Das PXE Bootmenü für die Gruppe wird nicht angelegt. <br> + <br> + Tragen Sie zuerst bei Rechner <b>".$macdata['hostname']."</b> eine MAC ein!<br><br>"; + } + } + } + if (count($members) == 1){ + $macdata = get_node_data($members['member'], array("hwaddress")); + if ($macdata['hwaddress'] == ""){ + $nomac = 1; + echo "Für den Gruppen-Rechner <b>".$macdata['hostname']."</b> ist keine MAC Adresse eingetragen <br> + Das PXE Bootmenü für die Gruppe wird nicht angelegt. <br> + <br> + Tragen Sie zuerst bei Rechner <b>".$macdata['hostname']."</b> eine MAC ein!<br><br>"; + } + } + } + + # Check auf eindeutigen PXE-Namen (könnte man erweitern auf kompletten RBS) + $brothers = get_pxeconfigs($targetDN,array("cn")); + $brother = 0; + foreach ($brothers as $item){ + if( $item['cn'] == $pxecn ){ + $mesg = "Es existiert bereits ein PXE Boot Menü mit dem eingegebenen Namen!<br> + Bitte geben Sie einen anderen Namen ein.<br><br>"; + $url = "new_pxe.php?pxecn=".$get_pxecn."&pxeday=".$get_pxeday."&pxebeg=".$get_pxebeg."&pxeend=".$get_pxeend."&mnr=".$mnr."&sbmnr=".$sbmnr; + $brother = 1; + break; + } + } + if ($brother == 0 && $nomac == 0){ + + if ( $pxeday != "" && $pxebeg != "" && $pxeend != "" && $pxebeg <= $pxeend ){ + + # TimeRange Syntax checken + $syntax = new Syntaxcheck; + if ($syntax->check_timerange_syntax($pxeday,$pxebeg,$pxeend)){ + + # in Grossbuchstaben + if (preg_match("/([a-z]+)/",$pxeday)){$pxeday = strtoupper($pxeday);} + if (preg_match("/([a-z]+)/",$pxebeg)){$pxebeg = strtoupper($pxebeg);} + if (preg_match("/([a-z]+)/",$pxeend)){$pxeend = strtoupper($pxeend);} + + # führende Nullen weg + $pxebeg = preg_replace ( '/0([0-9])/', '$1', $pxebeg); + $pxeend = preg_replace ( '/0([0-9])/', '$1', $pxeend); + + print_r($nodeDN); + # TimeRange auf Überschneidung mit vorhandenen checken + if(check_timerange_pxe($pxeday,$pxebeg,$pxeend,$targetDN,"")){ + $pxetimerange = $pxeday."_".$pxebeg."_".$pxeend; + } + else{ + $mesg = "Es existiert bereits ein PXE Boot Menü, das sich mit der eingegebenen Time Range + überschneidet!<br> + Das neue PXE Boot Menü wird ohne Time Range angelegt.<br> + Bitte geben Sie diese anschließend ein.<br><br>"; + } + } + else{ + $mesg = "Falsche Syntax in der Time-Range-Eingabe! Das neue PXE Boot Menü wird ohne Time Range angelegt.<br> + Bitte geben Sie diese anschließend ein.<br><br>"; + } + } + else{ + $mesg = "Keine vollständige Time-Range-Eingabe! Das neue PXE Boot Menü wird ohne Time Range angelegt.<br> + Bitte geben Sie diese anschließend ein.<br><br>"; + } + + $pxeDN = "cn=".$pxecn.",".$targetDN; + + + # PXE Dateinamen bestimmen, MAC(s) + $filenames = array(); + if ($targettype == "computers"){ + $macdata = get_node_data($targetDN, array("hwaddress")); + $filenames[] = "01-".$macdata['hwaddress']; + } + if ($targettype == "groups"){ + $members = get_node_data($targetDN, array("member")); + if (count($members) > 1){ + foreach ($members['member'] as $hostDN){ + $macdata = get_node_data($hostDN, array("hwaddress")); + $filenames[] = "01-".$macdata['hwaddress']; + } + } + if (count($members) == 1){ + $macdata = get_node_data($members['member'], array("hwaddress")); + $filenames[] = "01-".$macdata['hwaddress']; + } + } + echo "filenames: ";print_r($filenames); echo "<br>"; + #$ldapuri = LDAP_HOST."/dn=cn=computers,".$auDN; + + # rbsDN bestimmen + $rbs = get_node_data($targetDN,array("hlprbservice")); + $rbsDN = $rbs['hlprbservice']; + print_r($rbsDN); + + /*if (add_pxe($pxeDN,$pxecn,$rbsDN,$pxetimerange,$pxeattribs,$filenames,$conffile)){ + $mesg .= "<br>Neues PXE Boot Menü erfolgreich angelegt<br>"; + if ($targettype == "computers"){ + $mnr=1; + } + if ($targettype == "groups"){ + $mnr=2; + } + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr; + } + else{ + $mesg .= "<br>Fehler beim anlegen des PXE Boot Menüs!<br>"; + }*/ + } + } + } + else{ + $mesg .= "<br>Sie haben kein Ziel angegeben!<br>"; + } +} + + +elseif ( $pxecn == "" || $pxecn == "Hier_PXE_NAME_eintragen" || $rbsDN == "none" ){ + + $mesg = "Sie haben den Namen des neuen PXE Boot Menüs nicht angegeben oder den + Remote Boot Dienst nicht ausgewählt. Beide sind aber ein notwendige Attribute.<br> + Bitte geben Sie sie an.<br><br>"; + $url = "new_pxe.php?pxecn=Hier_PXE_NAME_eintragen&pxeday=".$get_pxeday."&pxebeg=".$get_pxebeg."&pxeend=".$get_pxeend."&mnr=".$mnr."&sbmnr=".$sbmnr; +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/pxe_change.php b/ldap-site-mngmt/webinterface/computers/pxe_change.php new file mode 100644 index 00000000..b3fcd4fa --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/pxe_change.php @@ -0,0 +1,437 @@ +<?php +include('../standard_header.inc.php'); + +$pxecn = "PXE_".$_POST['pxecn']; + +$pxeday = $_POST['pxeday']; +$pxebeg = $_POST['pxebeg']; +$pxeend = $_POST['pxeend']; +foreach (array_keys($pxeday) as $key){ + $pxeday[$key] = htmlentities($pxeday[$key]); +} +foreach (array_keys($pxebeg) as $key){ + $pxebeg[$key] = htmlentities($pxebeg[$key]); +} +foreach (array_keys($pxeend) as $key){ + $pxeend[$key] = htmlentities($pxeend[$key]); +} + +$deltr = $_POST['deltr']; + +$newpxeday = $_POST['newpxeday']; $newpxeday = htmlentities($newpxeday); +$newpxebeg = $_POST['newpxebeg']; $newpxebeg = htmlentities($newpxebeg); +$newpxeend = $_POST['newpxeend']; $newpxeend = htmlentities($newpxeend); + +$oldpxeday = $_POST['oldpxeday']; +$oldpxebeg = $_POST['oldpxebeg']; +$oldpxeend = $_POST['oldpxeend']; + +$pxeDN = $_POST['pxedn']; +$oldpxecn = "PXE_".$_POST['oldpxecn']; + +$rbs = $_POST['rbs']; +$filename = $_POST['filename']; +if (count($filename) != 0){ + foreach (array_keys($filename) as $key){ + $file[$key] = htmlentities($filename[$key]); + } +} +$oldfilename = $_POST['oldfilename']; +if (count($oldfilename) != 0){ + foreach (array_keys($oldfilename) as $key){ + $oldfile[$key] = htmlentities($oldfilename[$key]); + } +} +$newfilename = $_POST['newfilename']; $newfilename = htmlentities($newfilename); + + +$nodeDN = $_POST['nodedn']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +# sonstige Attribute +$attribs = $_POST['attribs']; +if (count($attribs) != 0){ + foreach (array_keys($attribs) as $key){ + $atts[$key] = htmlentities($attribs[$key]); + } +} +#print_r($atts); echo "<br><br>"; +$oldattribs = $_POST['oldattribs']; +if (count($oldattribs) != 0){ + foreach (array_keys($oldattribs) as $key){ + $oldatts[$key] = htmlentities($oldattribs[$key]); + } +} +#print_r($oldatts); echo "<br><br>"; + + +$seconds = 2; +$url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + +echo " +<html> +<head> + <title>Computers Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +############################################## +# PXE CN (DN) + +if ( $oldpxecn == $pxecn ){ + # $mesg = "keine Aenderung<br>"; +} + +if ( $oldpxecn != "" && $pxecn != "" && $oldpxecn != $pxecn ){ + echo "PXE Name aendern<br>"; + # hier noch Syntaxcheck + # Formulareingaben anpassen + $exppxe = explode(" ",$pxecn); + foreach ($exppxe as $word){$expuc[] = ucfirst($word);} + $pxecn = implode(" ",$expuc); + $pxecn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $pxecn); + + + $newpxeDN = "cn=".$pxecn.",".$nodeDN; + print_r($newpxeDN); echo "<br><br>"; + + if(modify_pxe_dn($pxeDN, $newpxeDN)){ + $mesg = "PXE Name erfolgreich geändert<br><br>"; + $pxeDN = $newpxeDN; + }else{ + $mesg = "Fehler beim ändern des PXE Namen!<br><br>"; + } + + + # newsubmenu holen... + $url = "pxe.php?dn=".$newpxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + +if ( $oldpxecn != "" && $pxecn == "" ){ + echo "PXE Name loeschen!<br> + Dieses ist Teil des DN, Sie werden das PXE Boot Menü komplett löschen<br><br>"; + echo "Wollen Sie das PXE Boot Menü <b>".$oldpxecn."</b> wirklich löschen?<br><br> + <form action='pxe_delete.php' method='post'> + Falls ja:<br><br> + <input type='hidden' name='dn' value='".$pxeDN."'> + <input type='hidden' name='name' value='".$oldpxecn."'> + <input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br> + </form> + <form action='".$url."' method='post'> + Falls, nein:<br><br> + <input type='Submit' name='apply' value='zurück' class='small_loginform_button'> + </form>"; + $seconds = 600; +} + +########################################## +# Remote Boot Dienst + +if ($rbs != "none"){ + $exp = explode(',',$rbs); + $exprbscn = explode('=',$exp[0]); + $rbscn = $exprbscn[1]; + $exprbsau = explode('=',$exp[2]); + $rbsau = $exprbsau[1]; + + $entryrbs ['rbservicedn'] = $rbs; + if ($result = ldap_mod_replace($ds,$pxeDN,$entryrbs)){ + $mesg = "Remote Boot Service erfolgreich zu <b>".$rbscn."[Abt.: ".$rbsau."]</b> geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern des Remote Boot Services zu <b>".$rbscn."</b>!<br><br>"; + } +} + + +########################################## +# bereits vorhandene TimeRange(s) bearbeiten + +$entrymodtr = array(); +$modtr = 0; +# TimeRanges zusammensetzen +# $t = 0; # Laufvariable für $entrymodtr, da nicht jede Timerange ok sein muss +for ($i=0; $i<count($pxeday); $i++){ + +$oldpxetimerange = $oldpxeday[$i]."_".$oldpxebeg[$i]."_".$oldpxeend[$i]; + +if ( ($pxebeg[$i] <= $pxeend[$i]) && ( ($pxeday[$i] != $oldpxeday[$i] && $pxeday[$i] != "") || ($pxebeg[$i] != $oldpxebeg[$i] && $pxebeg[$i] != "") || ($pxeend[$i] != $oldpxeend[$i] && $pxeend[$i] != "")) ){ + + + # TimeRange Syntax checken + $syntax = new Syntaxcheck; + if ($syntax->check_timerange_syntax($pxeday[$i],$pxebeg[$i],$pxeend[$i])){ + + # in Grossbuchstaben + if (preg_match("/([a-z]+)/",$pxeday[$i])){$pxeday[$i] = strtoupper($pxeday[$i]);} + if (preg_match("/([a-z]+)/",$pxebeg[$i])){$pxebeg[$i] = strtoupper($pxebeg[$i]);} + if (preg_match("/([a-z]+)/",$pxeend[$i])){$pxeend[$i] = strtoupper($pxeend[$i]);} + + # führende Nullen weg + $pxebeg[$i] = preg_replace ( '/0([0-9])/', '$1', $pxebeg[$i]); + $pxeend[$i] = preg_replace ( '/0([0-9])/', '$1', $pxeend[$i]); + + # TimeRange auf Überschneidung mit vorhandenen checken außer mit eigener alter TR da diese + # ja geändert werden soll + if(check_timerange_pxe($pxeday[$i],$pxebeg[$i],$pxeend[$i],$nodeDN,$oldpxetimerange)){ + + $pxetimerange = $pxeday[$i]."_".$pxebeg[$i]."_".$pxeend[$i]; + $entrymodtr ['timerange'][$i] = $pxetimerange; + $modtr = 1; + + } + else{ + $mesg = "Es existiert bereits ein PXE Boot Menü, das sich mit der eingegebenen Time Range + überschneidet!<br> + Bitte geben Sie eine andere Time Range ein.<br><br>"; + $entrymodtr ['timerange'][$i] = $oldpxetimerange; + } + } + else{ + $mesg = "Falsche Syntax in der Timerange-Eingabe!<br> + Bitte geben Sie die erneut Time Range ein.<br><br>"; + $entrymodtr ['timerange'][$i] = $oldpxetimerange; + } + +} + + +elseif ( $pxeday[$i] == "" || $pxebeg[$i] == "" || $pxeend[$i] == "" || $pxebeg[$i] > $pxeend[$i]){ + + $mesg = "Sie haben die Time Range <b>Nr.".$i."</b> nicht vollständig angegeben. Diese ist aber ein notwendiges Attribut.<br> + Diese Time Range wird nicht bearbeitet.<br><br>"; + $entrymodtr ['timerange'][$i] = $oldpxetimerange; +} + +else{$entrymodtr ['timerange'][$i] = $oldpxetimerange;} +} # Ende for-Schleife für jede Timerange +# jetzt noch alle gesammelten Änderungen Durchführen ... +if ($modtr == 1){ + # erst ändern + echo "Ändern: "; print_r($entrymodtr); echo "<br>"; + if($result = ldap_mod_replace($ds,$pxeDN,$entrymodtr)){ + $mesg = "TimeRanges erfolgreich geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern der TimeRanges!<br><br>"; + } +} + + +if ( count($deltr) != 0 && $modtr == 0 ){ + # Time Range löschen + $j = 0; + foreach ($deltr as $delrange){ + $entrydeltr ['timerange'][$j] = $delrange; + $j++; + } + # dann löschen + echo "Löschen: "; print_r($entrydeltr); echo "<br>"; + if($result = ldap_mod_del($ds,$pxeDN,$entrydeltr)){ + $mesg = "TimeRanges erfolgreich gelöscht<br><br>"; + }else{ + $mesg = "Fehler beim löschen der TimeRanges!<br><br>"; + } +}elseif(count($deltr) != 0 && $modtr == 1){ + echo "Nur Ändern (gleichzeitig Löschen und Ändern geht nicht)"; +} + +##################################### +# TimeRange hinzufügen + +if ( $newpxeday != "" && $newpxebeg != "" && $newpxeend != "" && $newpxebeg <= $newpxeend ){ + + # TimeRange Syntax checken + $syntax = new Syntaxcheck; + if ($syntax->check_timerange_syntax($newpxeday,$newpxebeg,$newpxeend)){ + + # in Grossbuchstaben + if (preg_match("/([a-z]+)/",$newpxeday)){$newpxeday = strtoupper($newpxeday);} + if (preg_match("/([a-z]+)/",$newpxebeg)){$newpxebeg = strtoupper($newpxebeg);} + if (preg_match("/([a-z]+)/",$newpxeend)){$newpxeend = strtoupper($newpxeend);} + + # führende Nullen weg + $newpxebeg = preg_replace ( '/0([0-9])/', '$1', $newpxebeg); + $newpxeend = preg_replace ( '/0([0-9])/', '$1', $newpxeend); + + # TimeRange auf Überschneidung mit vorhandenen checken + if(check_timerange_pxe($newpxeday,$newpxebeg,$newpxeend,$nodeDN,"")){ + + $newpxetimerange = $newpxeday."_".$newpxebeg."_".$newpxeend; + $entrytr ['timerange'] = $newpxetimerange; + if($result = ldap_mod_add($ds,$pxeDN,$entrytr)){ + $mesg = "Zusätzliche TimeRange erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der zusätzlichen TimeRange!<br><br>"; + } + }else{ + $mesg = "Es existiert bereits ein PXE Boot Menü, das sich mit der eingegebenen Time Range + überschneidet!<br> + Bitte geben Sie eine andere Time Range ein.<br><br>"; + } + }else{ + $mesg = "Falsche Syntax in der Timerange-Eingabe!<br> + Bitte geben Sie die erneut Time Range ein.<br><br>"; + } +} + + + +##################################### +# PXE Filename(s) + +$filemod = array(); +$modfi = 0; +$filedel = array(); +$delfi = 0; +$j = 0; + +if (count($file) != 0){ + +for ($i=0; $i<count($file); $i++){ + + if ( $oldfile[$i] == $file[$i] ){ + $filemod ['filename'][$i] = $oldfile[$i]; + # $mesg = "keine Aenderung<br>"; + } + + if ( $oldfile[$i] != "" && $file[$i] != "" && $oldfile[$i] != $file[$i] ){ + echo "PXE Dateinamen aendern<br> + Vorsicht dies kann eine nicht verwendbare PXE Datei zur Folge haben!<br><br>"; + # hier noch Syntaxcheck + $filemod ['filename'][$i] = $file[$i]; + $modfi = 1; + } + + if ( $oldfile[$i] != "" && $file[$i] == "" ){ + echo "PXE Dateinamen loeschen!<br> + Achtung: aus ihren PXE Daten wird keine PXE Datei mehr generiert.<br> + Sie sind solange nicht mehr für den PXE Bootvorgang verwendbar bis Sie einen neuen Dateinamen anlegen!<br><br>"; + $filemod ['filename'][$i] = $oldfile[$i]; + $filedel ['filename'][$j] = $oldfile[$i]; + $j++; + $delfi = 1; + $seconds = 4; + } +} +#erst ändern +if ($modfi == 1){ + echo "Ändern: "; print_r($filemod); echo "<br>"; + if(ldap_mod_replace($ds,$pxeDN,$filemod)){ + $mesg = "PXE Dateiname(n) erfolgreich geändert<br><br>"; + }else{ + $mesg = "Fehler beim ändern des(r) PXE Dateinamens!<br><br>"; + } + $modfi = 0; +} +# dann löschen +if ($delfi == 1){ + echo "Löschen: "; print_r($filedel); echo "<br>"; + if(ldap_mod_del($ds,$pxeDN,$filedel)){ + $mesg = "PXE Dateiname(n) erfolgreich gelöscht<br><br>"; + }else{ + $mesg = "Fehler beim löschen des PXE Dateinamens !<br><br>"; + } + $delfi = 0; +} + +} + +# PXE Dateiname neu anlegen +if ($newfilename == ""){ +} +if ($newfilename != ""){ + echo "PXE Dateiname hinzufügen"; + $fileadd ['filename'] = $newfilename; + if(ldap_mod_add($ds,$pxeDN,$fileadd)){ + $mesg = "PXE Dateiname <b>".$newfilename."</b> erfolgreich angelegt<br><br>"; + }else{ + $mesg = "Fehler beim anlegen des PXE Dateinamens ".$newfilename." !<br><br>"; + } +} + + + +################################################################## +# Restliche Attribute + +$entryadd = array(); +$entrymod = array(); +$entrydel = array(); + +foreach (array_keys($atts) as $key){ + + if ( $oldatts[$key] == $atts[$key] ){ + + } + if ( $oldatts[$key] == "" && $atts[$key] != "" ){ + # hier noch Syntaxcheck + $entryadd[$key] = $atts[$key]; + } + if ( $oldatts[$key] != "" && $atts[$key] != "" && $oldatts[$key] != $atts[$key] ){ + # hier noch Syntaxcheck + $entrymod[$key] = $atts[$key]; + } + if ( $oldatts[$key] != "" && $atts[$key] == "" ){ + # hier noch Syntaxcheck + $entrydel[$key] = $oldatts[$key]; + } +} + +#print_r($entryadd); echo "<br>"; +#print_r($entrymod); echo "<br>"; +#print_r($entrydel); echo "<br>"; + + +if (count($entryadd) != 0 ){ + #print_r($entryadd); echo "<br>"; + #echo "neu anlegen<br>"; + foreach (array_keys($entryadd) as $key){ + $addatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_add($ds,$pxeDN,$entryadd)){ + $mesg = "Attribute ".$addatts." erfolgreich eingetragen<br><br>"; + }else{ + $mesg = "Fehler beim eintragen der Attribute ".$addatts."<br><br>"; + } +} + +if (count($entrymod) != 0 ){ + #print_r($entrymod); echo "<br>"; + #echo "ändern<br>"; + foreach (array_keys($entrymod) as $key){ + $modatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_replace($ds,$pxeDN,$entrymod)){ + $mesg = "Attribute ".$modatts." erfolgreich geaendert<br><br>"; + }else{ + $mesg = "Fehler beim aendern der Attribute ".$modatts."<br><br>"; + } +} + +if (count($entrydel) != 0 ){ + #print_r($entrydel); echo "<br>"; + #echo "löschen<br>"; + foreach (array_keys($entrydel) as $key){ + $delatts .= "<b>".$key."</b>,"; + } + if(ldap_mod_del($ds,$pxeDN,$entrydel)){ + $mesg = "Attribute ".$delatts." erfolgreich geloescht<br><br>"; + }else{ + $mesg = "Fehler beim loeschen der Attribute ".$delatts."<br><br>"; + } +} + + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/pxe_copy.php b/ldap-site-mngmt/webinterface/computers/pxe_copy.php new file mode 100644 index 00000000..eb75ea44 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/pxe_copy.php @@ -0,0 +1,180 @@ +<?php +include('../standard_header.inc.php'); + +$pxeDN = $_POST['pxedn']; +$pxecn = "PXE_".$_POST['pxecncp']; +$oldpxecn = "PXE_".$_POST['oldpxecncp']; + +$deltr = $_POST['deltr']; + +$oldpxeday = $_POST['oldpxedaycp']; $oldpxeday = htmlentities($oldpxeday); +$oldpxebeg = $_POST['oldpxebegcp']; $oldpxebeg = htmlentities($oldpxebeg); +$oldpxeend = $_POST['oldpxeendcp']; $oldpxeend = htmlentities($oldpxeend); + +$nodeDN = $_POST['nodedn']; +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$copytargets = $_POST['copytargets']; +#print_r($copytargets); echo "<br>"; +$n = array_keys($copytargets,'none'); +#print_r($n); echo "<br>"; +for ($i=0; $i<count($n); $i++){ + $match = array_search('none',$copytargets); + array_splice($copytargets, $match, 1); +} +#print_r($copytargets); echo "<br>"; + + +$seconds = 2; +$url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + +echo " +<html> +<head> + <title>Computers Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if ( $pxecn != ""){ + + # Formulareingaben anpassen + $exppxe = explode(" ",$pxecn); + foreach ($exppxe as $word){$expuc[] = ucfirst($word);} + $pxecn = implode(" ",$expuc); + $pxecn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $pxecn); + + $nomac = 0; + + if (count($copytargets) != 0){ + foreach ($copytargets as $targetDN){ + + $exptargetdn = ldap_explode_dn($targetDN, 1); + $targetcn = $exptargetdn[0]; + $targettype = $exptargetdn[1]; + + # falls Target keine MAC hat dann kann keine PXE angelegt werden + if ($targettype == "computers"){ + $macdata = get_node_data($targetDN, array("hwaddress")); + if ($macdata['hwaddress'] == ""){ + $nomac = 1; + echo "Für den Ziel-Rechner ist keine MAC Adresse eingetragen <br> + Das PXE Bootmenü wird nicht angelegt. <br> + <br> + Tragen Sie zuerst eine MAC ein!<br><br>"; + } + } + if ($targettype == "groups"){ + $members = get_node_data($targetDN, array("member")); + if (count($members) > 1){ + foreach ($members['member'] as $hostDN){ + $macdata = get_node_data($hostDN, array("hwaddress","hostname")); + if ($macdata['hwaddress'] == ""){ + $nomac = 1; + echo "Für den Gruppen-Rechner <b>".$macdata['hostname']."</b> ist keine MAC Adresse eingetragen <br> + Das PXE Bootmenü für die Gruppe wird nicht angelegt. <br> + <br> + Tragen Sie zuerst bei Rechner <b>".$macdata['hostname']."</b> eine MAC ein!<br><br>"; + } + } + } + if (count($members) == 1){ + $macdata = get_node_data($members['member'], array("hwaddress")); + if ($macdata['hwaddress'] == ""){ + $nomac = 1; + echo "Für den Gruppen-Rechner <b>".$macdata['hostname']."</b> ist keine MAC Adresse eingetragen <br> + Das PXE Bootmenü für die Gruppe wird nicht angelegt. <br> + <br> + Tragen Sie zuerst bei Rechner <b>".$macdata['hostname']."</b> eine MAC ein!<br><br>"; + } + } + } + + $brothers = get_pxeconfigs($targetDN,array("cn")); + $brother = 0; + foreach ($brothers as $item){ + if( $item['cn'] == $pxecn ){ + $mesg = "Es existiert bereits ein PXE Boot Menü mit dem eingegebenen Namen!<br> + Bitte geben Sie einen anderen Namen ein.<br><br>"; + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; + $brother = 1; + break; + } + } + if ($brother == 0 && $nomac == 0){ + + $exptargetdn = ldap_explode_dn($targetDN, 1); + $target = $exptargetdn[0]; + $targettype = $exptargetdn[1]; + + $newpxeDN = "cn=".$pxecn.",".$targetDN; + print_r($newpxeDN); echo "<br>"; + + if (dive_into_tree_cp($pxeDN,$newpxeDN)){ + + # Filename anpassen + if ($targettype == "computers"){ + $macdata = get_node_data($targetDN, array("hwaddress")); + $entrymod ['filename'] = "01-".$macdata['hwaddress']; + #$entrymod ['fileuri'] = "01-".$macdata['hwaddress'].".tgz"; + } + if ($targettype == "groups"){ + $members = get_node_data($targetDN, array("member")); + if (count($members) != 0){ + foreach ($members['member'] as $hostDN){ + $macdata = get_node_data($hostDN, array("hwaddress")); + $entrymod ['filename'][] = "01-".$macdata['hwaddress']; + #$entrymod ['fileuri'] = $target.".tgz"; + } + } + } + if(ldap_mod_replace($ds,$newpxeDN,$entrymod)){ + if($deltr == 1){ + # Timeranges und FileURI im neuen Objekt löschen (todo: anpassen statt löschen) + $entrydel ['timerange'] = array(); + $entrydel ['fileuri'] = array(); + if ( ldap_mod_del($ds,$newpxeDN,$entrydel) ){ + $mesg .= "<br>PXE Boot Menü erfolgreich nach ".$target[1]." kopiert<br>"; + } + else{ + ldap_delete($ds,$newpxeDN); + $mesg .= "<br>Fehler beim kopieren des PXE Boot Menüs nach <b>".$target[1]."</b><br>"; + } + } + } + else{ + ldap_delete($ds,$newpxeDN); + $mesg .= "<br>Fehler beim kopieren des PXE Boot Menüs nach <b>".$target[1]."</b><br>"; + } + } + else{ + $mesg .= "<br>Fehler beim kopieren des PXE Boot Menüs nach <b>".$target[1]."</b><br>"; + } + } + } + } + else{ + $mesg .= "<br>Sie haben kein Ziel angegeben!<br>"; + } +} + +elseif ( $pxecn == ""){ + + $mesg = "Sie haben den Namen des neuen PXE Boot Menüs nicht angegeben. Dieser ist aber ein notwendiges Attribut.<br> + Bitte geben Sie ihn an.<br><br>"; + $url = "pxe.php?dn=".$pxeDN."&mnr=".$mnr."&sbmnr=".$sbmnr."&mcnr=".$mcnr; +} + + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file diff --git a/ldap-site-mngmt/webinterface/computers/pxe_delete.php b/ldap-site-mngmt/webinterface/computers/pxe_delete.php new file mode 100644 index 00000000..a1b7a060 --- /dev/null +++ b/ldap-site-mngmt/webinterface/computers/pxe_delete.php @@ -0,0 +1,42 @@ +<?php +include('../standard_header.inc.php'); + +$pxeDN = $_POST['dn']; +$oldpxecn = $_POST['name']; + +$mnr = $_POST['mnr']; +$sbmnr = $_POST['sbmnr']; +$mcnr = $_POST['mcnr']; + +$seconds = 1; +$url = $_POST['successurl']; + +echo " +<html> +<head> + <title>Computers Management</title> + <link rel='stylesheet' href='../styles.css' type='text/css'> +</head> +<body> +<table border='0' cellpadding='30' cellspacing='0'> +<tr><td>"; + +if ( $pxeDN != ""){ + + if ( dive_into_tree_del($pxeDN,"") ){ + $mesg = "PXE Boot Menü <b>".$pxecn."</b> erfolgreich gelöscht!<br><br>"; + } + else{ + $mesg = "Fehler beim löschen des PXE Boot Menüs <b>".$pxecn."</b> !<br><br>"; + } + +} + + +$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br> + Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>"; +redirect($seconds, $url, $mesg, $addSessionId = TRUE); + +echo "</td></tr></table></body> +</html>"; +?>
\ No newline at end of file |
