summaryrefslogtreecommitdiffstats
path: root/application/modules/fbgui/views/scripts/index/index.phtml
blob: 1e8994bf4a5dbdeb7d11c195f8db61b646d39f6c (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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?php if($this->notification != ''){echo $this->notification;} ?>

<?php if($this->nobootmenu === true):?>
	<?php if($this->loginmenu):?>
	<div class="fbguilogin selectswitch" style=''> 
		<div style='font-size:16px;font-weight:bold;margin-bottom:5px;'>Login</div>
		<i>This is not your Bootmenu. Select this to get your own Bootmenu.</i> 
		<input type="hidden" class="id" value="login"/> 
	</div>
	<?php else:?>
	<div class="fbguilogin selectswitch" style=''> 
		<div style='font-size:16px;font-weight:bold;margin-bottom:5px;'>Logout</div>
		<i>Select this to logout and get to the default BootMenu.</i> 
		<input type="hidden" class="id" value="logout"/> 
	</div>
	<?php endif;?>
	<script type="text/javascript">
	var activeElement = 0;
	$(document).ready(function(){	
		$('.selectswitch').click(function(){
			$('.selectswitch').removeClass('selected');
			$(this).addClass('selected');			
			$("#selectedBootOs").val($(this).find('.id').val());
			$("#startbutton").focus();
		});
		$('.selectswitch').click();
		$('#startbutton').focus();
		$('.selectswitch').dblclick(function(){
			$('.selectswitch').removeClass('selected');
			$(this).addClass('selected');			
			$("#selectedBootOs").val($(this).find('.id').val());
			$("#startbutton").focus();
			start();
		});
		
		$(function() {
			$(document).click(function(){
				abortStartcount = true;
			})
			$(document).keyup(function (event) {
				if (event.keyCode == 38) {
					// up
					if(activeElement >=1)
						activeElement = activeElement-1;
					$('.selectswitch').eq(activeElement).click();
				} else if (event.keyCode == 40) {
					// Down
					if(activeElement < $('.selectswitch').length-1 )					
						activeElement = activeElement+1;					
					$('.selectswitch').eq(activeElement).click();
				} else if (event.keyCode == 13) {
					// Down
					$('#startbutton').click();
				}
				abortStartcount = true;
			});
		});
		decreaseDown();
	});
	function decreaseDown(){
		var act = parseInt($('.startcounter').html());
		if(act == 0){
			start();
			return;
		}
		var next = act-1;		
		$('.startcounter').html(next);
		if(next == 0){
			start();
		}
		if(next > 0 && abortStartcount == false){
			setTimeout('decreaseDown()',1000);
		}
		if(abortStartcount == true){
			$('.startcounter').parent().fadeOut();
		}
	}
	function start(){		
		if($('#selectedBootOs').val() != ''){
			if($('#selectedBootOs').val() == 'login'){
				window.location='/fbgui/auth/login/'
			} else{
				window.location='/fbgui/index/start/bme/'+$('#selectedBootOs').val();
			}
		}
		else{
			alert('You have to select a BootOs');
		}
	}
	</script>
	<input style="display:none;" type='text' id="selectedBootOs" />
	<button onClick="start();" id='startbutton' class="fbguistart" style='font-size:16px;font-weight:bold;margin-bottom:5px;'>
		<?php echo ($this->loginmenu)?'Login':'Logout'; ?>
	</button>	
	<div class='clear'></div>
<?php endif; ?>
<?php if(isset($this->entries)):?>
	<?php if($this->loginmenu):?>
	<div class="fbguilogin selectswitch" style=''> 
		<div style='font-size:16px;font-weight:bold;margin-bottom:5px;'>Login</div>
		<i>This is not your Bootmenu. Select this to get your own Bootmenu.</i> 
		<input type="hidden" class="id" value="login"/> 
	</div>
	<?php else:?>
	<div class="fbguilogin selectswitch" style=''> 
		<div style='font-size:16px;font-weight:bold;margin-bottom:5px;'>Logout</div>
		<i>Select this to logout and get to the default BootMenu.</i> 
		<input type="hidden" class="id" value="logout"/> 
	</div>
	<?php endif;?>
	<script type="text/javascript">
	var activeElement = 0;
	var abortStartcount = false;
	$(document).ready(function(){	
		$('.selectswitch').click(function(){
			$('.selectswitch').removeClass('selected');
			$(this).addClass('selected');			
			$("#selectedBootOs").val($(this).find('.id').val());
			$("#startbutton").focus();			
		});
		$('.bootmenu .selectswitch').eq(activeElement).click();
		$('#startbutton').focus();
		$('.selectswitch').dblclick(function(){
			$('.selectswitch').removeClass('selected');
			$(this).addClass('selected');			
			$("#selectedBootOs").val($(this).find('.id').val());
			$("#startbutton").focus();
			start();
		});
		
		$(function() {
			$(document).click(function(){
				abortStartcount = true;
			})
			$(document).keyup(function (event) {
				if (event.keyCode == 38) {
					// up
					if(activeElement >=1)
						activeElement = activeElement-1;
					$('.selectswitch').eq(activeElement).click();
				} else if (event.keyCode == 40) {
					// Down
					if(activeElement < $('.selectswitch').length-1 )					
						activeElement = activeElement+1;					
					$('.selectswitch').eq(activeElement).click();
				} else if (event.keyCode == 13) {
					// Down
					$('#startbutton').click();
				}
				abortStartcount = true;
			});
		});
		<?php if(count($this->entries) > 0): ?>
		decreaseDown()
		<?php endif; ?>
	});
	function decreaseDown(){
		var act = parseInt($('.startcounter').html());
		if(act == 0){
			start();
			return;
		}
		var next = act-1;		
		$('.startcounter').html(next);
		if(next == 0){
			start();
		}
		if(next > 0 && abortStartcount == false){
			setTimeout('decreaseDown()',1000);
		}
		if(abortStartcount == true){
			$('.startcounter').parent().fadeOut();
		}
	}
	function start(){		
		if($('#selectedBootOs').val() != ''){
			if($('#selectedBootOs').val() == 'login'){
				window.location='/fbgui/auth/login/'
			}else if($('#selectedBootOs').val() == 'logout'){
				window.location='/fbgui/auth/logout/'
			} else{
				window.location='/fbgui/index/start/bme/'+$('#selectedBootOs').val();
			}
		}
		else{
			alert('You have to select a BootOs');
		}
	}
	</script>
	<h1><?php echo $this->title;?></h1>
	<?php if(count($this->entries) > 0): ?>
	<div style='padding:5px;float:right;'>Starting in <span class='startcounter'><?php echo $this->startcounter; ?></span> seconds</div>
	<?php endif; ?>
	<div class='bootmenu'>
	<?php $first = true; 	
	?>
	<?php foreach($this->entries as $k=>$entry):?>
		<?php
			$bootosMapper = new Application_Model_BootOsMapper();
			$bootos = new Application_Model_BootOs();
			$bootos = $bootosMapper->find($entry->getBootosID());			
		?>
		<div id="menu_item_<?php echo $k;?>" class="menu selectswitch"  class="flexbox"> 
			<img src="/media/img/os/ubuntu.png" /> 
			<h2><?php echo $entry->getTitle(); ?></h2>
			<i>BootOs-Name: <?php echo $bootos->getTitle();?></i> 
			<p>Description: <?php echo $bootos->getDescription();?></p> 
			<input type="hidden" class="id" value="<?php echo $entry->getID();?>"/> 
		</div> 
	<?php endforeach; ?>
	</div>	
	<input style="display:none;" type='text' id="selectedBootOs" />
	<button onClick="start();" id='startbutton' class="fbguistart" style='font-size:16px;font-weight:bold;margin-bottom:5px;'>
		Start System
	</button>	
	<div class='clear'></div>	
<?php endif;?>