summaryrefslogtreecommitdiffstats
path: root/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml
blob: 88be86ffa0a3921ce5a32015a6db965700a0c246 (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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?php
  
  $index = 0;
  
  function title ( $title ) {
    echo "menu title ".$title."\n";
  }
  
  function label ( $label ) {
    global $index;
    $index++;
    echo "label item".$index."\n";
    echo "  menu label ";
    echo "^".( ( $index < 10 ) ? $index :
               sprintf ( "%c", $index + ord ( 'A' ) - 10 ) )." ";
    echo $label."\n";
  }
  
  function uriboot ( $label, $uri, $args ) {
    label ( $label );
    echo "  kernel ".$uri."\n";
    if ( $args )
        echo "  append ".$args."\n";
  }
  
  function comment ( $label, $labelmenu) {
  	echo "label $label\n";
    echo "  menu label $labelmenu\n";
    echo "  menu disable\n";
  }
  
  function localboot () {
	label ( "LOCALBOOT");
	echo "LOCALBOOT -1\n";
  	texthelp("Gets you out of here by booting from next device in BIOS boot
         order.");
  }
  
  function separator(){
  	echo "MENU SEPARATOR\n";
  }
  
  function texthelp ( $texthelp ){
  	echo "TEXT HELP\n";
	echo $texthelp."\n";
	echo "ENDTEXT\n";
  }
  
  function nomembership ($alphaID) {
    title ("You have no memberships");
    uriboot ( "Return to Group Bootmenu", "$this->httpmode://$this->host/ipxe/auth/logout/alpha/$alphaID", "" );
  }
  
  function retry ($alphaID) {
    title ("Authentication Failed");
    uriboot ( "Try again", "$this->httpmode://$this->host/ipxe/auth/login/alpha/$alphaID/login/true", "" );
    uriboot ( "Return to Group Bootmenu", "$this->httpmode://$this->host/ipxe/auth/logout/alpha/$alphaID", "" );
  }
  
  function sessionerror ($serialnumber,$mac) {
    title ("A Session Error occured");
    uriboot ( "Reconnect", "$this->httpmode://$this->host/ipxe/auth/serial/serialnumber/$serialnumber/mac/$mac", "" );
  }
  
  function serialerror ($serialnumber,$mac) {
    title ("The Serial was not found. Press Tab to change the Serial or contact an Admin");
    uriboot ( "Reconnect", "$this->httpmode://$this->host/ipxe/auth/serial/serialnumber/$serialnumber/mac/$mac", "" );
  }
  
  function nobootmenu () {
    title ("There are no Bootmenu Entries");
  }
  
?>
  
<?php if($this->action != "selectmembership")
		echo "TIMEOUT ".(10*$this->startcounter)."\n";?>
		
PROMPT 0
DEFAULT /ipxe/vesamenu.c32

<?php if($this->httpmode === 'https')
		echo "MENU BACKGROUND /ipxe/pbs2ssl.png\n";
	  else
		echo "MENU BACKGROUND /ipxe/pbs2.png\n";?>

MENU WIDTH 78
MENU MARGIN 9
MENU PASSWORDMARGIN 9
MENU ROWS 10
MENU TABMSGROW 16
MENU CMDLINEROW 16
MENU ENDROW -1
MENU PASSWORDROW 16
MENU TIMEOUTROW 20
MENU HELPMSGROW 16
MENU HELPMSGENDROW -1
MENU HSHIFT 0
MENU VSHIFT 7

#menu color screen       37;40           #80ffffff #00000000 std
menu color border        37;40           #00000000 #00000000 std
menu color title         1               #ee004a99 #00000000 all
menu color unsel         37;40           #ff4f75aa #00000000 all
menu color hotkey        1 		         #ffff8b00 #00000000 std
menu color sel           7;37;40         #ff1c2a33 #667799bb all
#menu color hotsel       1;7;37;40       #ffff8b00 #667799bb all
menu color disabled     1;37;40          #ff4f75aa #00000000 std
#menu color scrollbar    37;40           #40000000 #ee000000 std
#menu color tabmsg       37;40           #ffff8b00 #ff8093a1 std
#menu color cmdmark      1;37;40         #ffff8b00 #ff8093a1 std
#menu color cmdline      37;40           #fff0f0f0 #ff8093a1 std
#menu color pwdborder    37;40           #40000000 #ff8093a1 std
#menu color pwdheader    37;40           #ffff8b00 #ff8093a1 std
#menu color pwdentry     37;40           #ffff8b00 #ff8093a1 std
#menu color timeout_msg  37;40           #fff0f0f0 #ff8093a1 std
#menu color timeout      1;37;40         #ffff8b00 #ff8093a1 std
#menu color help         37;40           #ff1c2a33 #00000000 none
MENU MSGCOLOR                            #ff1c2a33 #00000000 none

<?php

  if(isset($this->error)){
	  switch($this->error){
	  	case "serial": 
	  		serialerror($this->serialnumber, $this->mac);
	  		break;
	  	case "session":
	  		sessionerror($this->serialnumber, $this->mac);
	  		break;
	  	case "login":
	  		retry($this->alphaID);
	  		break;
	  }
  }else{

	  if($this->action == "selectmembership"){
	  	title ( "Select Membership:" );
	  	if(isset($this->memberships)){
	  		foreach($this->memberships as $membership){
	  			uriboot ($membership['group']." as ".$membership['role'], "$this->httpmode://$this->host/ipxe/auth/setgroup/membershipid/".$membership['membershipID']."/alpha/$this->alphaID", "");
	  		}
	  		comment ("", "");
	  		comment ("login", "Logged-In as $this->firstname $this->name");
	  		uriboot ( "Logout (Return to Group Bootmenu)", "$this->httpmode://$this->host/ipxe/auth/logout/alpha/$this->alphaID", "");
	  	}else{
	  		nomembership($this->alphaID);
	  	}
	  }else{

	  	title ( $this->title);	  	
	  	
	  	$bootosmapper = new Application_Model_BootOsMapper();
	
	  	if(isset($this->bmelist)){
	  		foreach($this->bmelist as $bme){
	
	  			$kcl = $bootosmapper->find($bme->getBootosID())->getDefaultkcl();
	
	  			if($bme->getKcl() && $kcl != null){
	  				uriboot ( $bme->getTitle(),
		     	"$this->httpmode://$this->host/ipxe/resource/getkernel/alpha/$this->alphaID/bme/".$bme->getID()."/file/kernel", "initrd=$this->httpmode://$this->host/ipxe/resource/getinitramfs/alpha/$this->alphaID/bme/".$bme->getID()."/file/initramfs $kcl alpha=$this->alphaID file=$this->httpmode://$this->host/c/$this->alphaID/default.tgz ".$bme->getKclappend());
	  			}else{
	  				uriboot ( $bme->getTitle(),
		     	"$this->httpmode://$this->host/ipxe/resource/getkernel/alpha/$this->alphaID/bme/".$bme->getID()."/file/kernel", "initrd=$this->httpmode://$this->host/ipxe/resource/getinitramfs/alpha/$this->alphaID/bme/".$bme->getID()."/file/initramfs alpha=$this->alphaID file=$this->httpmode://$this->host/c/$this->alphaID/default.tgz ".$bme->getKclappend());
	  			}
	  		}	
	  	}else{
	  		nobootmenu();
	  	}
	
	  	comment ("", "");
	  	comment ("info", "More Options:");
	  	
	  	if(!$this->loggedin){
	  		uriboot ( "Login", "$this->httpmode://$this->host/ipxe/auth/login/alpha/$this->alphaID/login/true", "" );
	  		texthelp("Login to get your own Bootmenu.");
	  	}else{
	  		comment ("login", "Logged-In as $this->firstname $this->name in Group $this->group");
	  		uriboot ( "Switch Group From $this->group", "$this->httpmode://$this->host/ipxe/auth/switchgroup/alpha/$this->alphaID", "" );
	  		uriboot ( "Logout (Return to Group Bootmenu)", "$this->httpmode://$this->host/ipxe/auth/logout/alpha/$this->alphaID", "" );
	  	}
	  	
	  	localboot();
	  }
  }