summaryrefslogtreecommitdiffstats
path: root/ldap-site-mngmt/webinterface/computers/new_menuentry.php
blob: 155ed2455b7172231690eca873471d6efe41f2a8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
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&uuml;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");

?>