Project

General

Profile

Download (23.8 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
    index.php
5
    Copyright (C) 2004, 2005 Scott Ullrich
6
    All rights reserved.
7

    
8
    Originally part of m0n0wall (http://m0n0.ch/wall)
9
    Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
    All rights reserved.
11

    
12
    Redistribution and use in source and binary forms, with or without
13
    modification, are permitted provided that the following conditions are met:
14

    
15
    1. Redistributions of source code must retain the above copyright notice,
16
       this list of conditions and the following disclaimer.
17

    
18
    2. Redistributions in binary form must reproduce the above copyright
19
       notice, this list of conditions and the following disclaimer in the
20
       documentation and/or other materials provided with the distribution.
21

    
22
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
23
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26
    oR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
    POSSIBILITY OF SUCH DAMAGE.
32
*/
33

    
34
##|+PRIV
35
##|*IDENT=page-system-login/logout
36
##|*NAME=System: Login / Logout page
37
##|*DESCR=Allow access to the 'System: Login / Logout' page.
38
##|*MATCH=index.php*
39
##|-PRIV
40

    
41

    
42
	## Load Essential Includes
43
	require_once('guiconfig.inc');
44
	require_once('notices.inc');
45

    
46
	if ($_POST && $_POST['submit']) {
47
		$config['widgets']['sequence'] = $_POST['sequence'];
48

    
49
		foreach ($widgetnames as $widget){
50
			if ($_POST[$widget . '-config']){
51
				$config['widgets'][$widget . '-config'] = $_POST[$widget . '-config'];
52
			}
53
		}
54

    
55
		write_config("Widget configuration has been changed.");
56
		header("Location: index.php");
57
		exit;
58
	}
59

    
60
	## Load Functions Files
61
	require_once('includes/functions.inc.php');
62

    
63
	## Load AJAX, Initiate Class ###############################################
64
	require_once('includes/sajax.class.php');
65

    
66
	## Initiate Class and Set location of ajax file containing 
67
	## the information that we need for this page. Also set functions
68
	## that SAJAX will be using.
69
	$oSajax = new sajax();
70
	$oSajax->sajax_remote_uri = 'sajax/index.sajax.php';
71
	$oSajax->sajax_request_type = 'POST';
72
	$oSajax->sajax_export("get_stats");
73
	$oSajax->sajax_handle_client_request();
74
	############################################################################
75
	
76
	
77
	## Check to see if we have a swap space,
78
	## if true, display, if false, hide it ...
79
	if(file_exists("/usr/sbin/swapinfo")) {
80
		$swapinfo = `/usr/sbin/swapinfo`;
81
		if(stristr($swapinfo,'%') == true) $showswap=true;
82
	}
83

    
84

    
85
	## User recently restored his config.
86
	## If packages are installed lets resync
87
	if(file_exists('/conf/needs_package_sync')) {
88
		if($config['installedpackages'] <> '') {
89
			conf_mount_rw();
90
			unlink('/conf/needs_package_sync');
91
			conf_mount_ro();
92
			if($g['platform'] == "pfSense") {
93
				header('Location: pkg_mgr_install.php?mode=reinstallall');
94
				exit;
95
			}
96
		}
97
	}
98

    
99

    
100
	## If it is the first time webConfigurator has been
101
	## accessed since initial install show this stuff.
102
	if(file_exists('/conf/trigger_initial_wizard')) {
103

    
104

    
105
		echo <<<EOF
106
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
107
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
108
<html>
109
<head>
110
	<title>pfSense.local - pfSense first time setup</title>
111
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
112
	<link rel="stylesheet" type="text/css" href="/niftycssprintCode.css" media="print" />
113
	<script type="text/javascript">var theme = "nervecenter"</script>
114
	<script type="text/javascript" src="/themes/nervecenter/loader.js"></script>
115
		
116
EOF;
117

    
118
		echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n";
119

    
120
		if(file_exists("/usr/local/www/themes/{$g['theme']}/wizard.css")) 
121
			echo "<link rel=\"stylesheet\" href=\"/themes/{$g['theme']}/wizard.css\" media=\"all\" />\n";
122
		else 
123
			echo "<link rel=\"stylesheet\" href=\"/themes/{$g['theme']}/all.css\" media=\"all\" />";
124

    
125
		echo "<form>\n";
126
		echo "<center>\n";
127
		echo "<img src=\"/themes/{$g['theme']}/images/logo.gif\" border=\"0\"><p>\n";
128
		echo "<div \" style=\"width:700px;background-color:#ffffff\" id=\"nifty\">\n";
129
		echo "Welcome to {$g['product_name']}!<p>\n";
130
		echo "One moment while we start the initial setup wizard.<p>\n";
131
		echo "Embedded platform users: Please be patient, the wizard takes a little longer to run than the normal GUI.<p>\n";
132
		echo "To bypass the wizard, click on the {$g['product_name']} logo on the initial page.\n";
133
		echo "</div>\n";
134
		echo "<meta http-equiv=\"refresh\" content=\"1;url=wizard.php?xml=setup_wizard.xml\">\n";
135
		echo "<script type=\"text/javascript\">\n";
136
		echo "NiftyCheck();\n";
137
		echo "Rounded(\"div#nifty\",\"all\",\"#AAA\",\"#FFFFFF\",\"smooth\");\n";
138
		echo "</script>\n";
139
		exit;
140
	}
141

    
142

    
143
	## Find out whether there's hardware encryption or not
144
	unset($hwcrypto);
145
	$fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r");
146
	if ($fd) {
147
		while (!feof($fd)) {
148
			$dmesgl = fgets($fd);
149
			if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches) or preg_match("/^safe.: (.*?),/", $dmesgl, $matches) or preg_match("/^ubsec.: (.*?),/", $dmesgl, $matches) or preg_match("/^padlock.: (.*?),/", $dmesgl, $matches) or preg_match("/^glxsb.: (.*?),/", $dmesgl, $matches)) {
150
				$hwcrypto = $matches[1];
151
				break;
152
			}
153
		}
154
		fclose($fd);
155
	}
156

    
157
##build list of widgets
158
$directory = "/usr/local/www/widgets/widgets/";
159
$dirhandle  = opendir($directory);
160
$filename = "";
161
$widgetnames = array();
162
$widgetfiles = array();
163
$widgetlist = array();
164
while (false !== ($filename = readdir($dirhandle))) {
165
	$periodpos = strpos($filename, ".");
166
	$widgetname = substr($filename, 0, $periodpos);
167
	$widgetnames[] = $widgetname;
168
	if ($widgetname != "system_information")
169
		$widgetfiles[] = $filename;   		
170
}
171

    
172

    
173
##sort widgets alphabetically
174
sort($widgetfiles);
175

    
176
##insert the system information widget as first, so as to be displayed first
177
array_unshift($widgetfiles, "system_information.widget.php");
178

    
179
##if no config entry found, initialize config entry
180
if (!is_array($config['widgets'])) {
181
	$config['widgets'] = array();
182
}
183

    
184
##build widget saved list information
185
if ($config['widgets'] && $config['widgets']['sequence'] != "") {
186
	$pconfig['sequence'] = $config['widgets']['sequence'];
187
	
188
	$widgetlist = $pconfig['sequence'];
189
	$colpos = array();
190
	$savedwidgetfiles = array();
191
	$widgetname = "";
192
	$widgetlist = explode(",",$widgetlist);
193
	
194
	##read the widget position and display information
195
	foreach ($widgetlist as $widget){
196
		$dashpos = strpos($widget, "-");		
197
		$widgetname = substr($widget, 0, $dashpos);
198
		$colposition = strpos($widget, ":");		
199
		$displayposition = strrpos($widget, ":");
200
		$colpos[] = substr($widget,$colposition+1, $displayposition - $colposition-1);
201
		$displayarray[] = substr($widget,$displayposition+1);
202
		$savedwidgetfiles[] = $widgetname . ".widget.php";
203
	}
204
	
205
	##add widgets that may not be in the saved configuration, in case they are to be displayed later
206
    foreach ($widgetfiles as $defaultwidgets){         
207
         if (!in_array($defaultwidgets, $savedwidgetfiles)){
208
             $savedwidgetfiles[] = $defaultwidgets;
209
         }
210
     }   
211
	
212
	##find custom configurations of a particular widget and load its info to $pconfig
213
	foreach ($widgetnames as $widget){
214
        if ($config['widgets'][$widget . '-config']){
215
            $pconfig[$widget . '-config'] = $config['widgets'][$widget . '-config'];
216
        }
217
    }   
218
	
219
	$widgetlist = $savedwidgetfiles;	
220
} 
221
##no saved widget sequence found, build default list.
222
else{
223
	$widgetlist = $widgetfiles;
224
}
225

    
226

    
227
##build list of php include files
228
$phpincludefiles = array();
229
$directory = "/usr/local/www/widgets/include/";
230
$dirhandle  = opendir($directory);
231
$filename = "";
232
while (false !== ($filename = readdir($dirhandle))) {
233
	$phpincludefiles[] = $filename;
234
}
235
foreach($phpincludefiles as $includename) {
236
	if(!stristr($includename, ".inc"))
237
		continue;	
238
	include($directory . $includename);
239
}
240

    
241
##begin AJAX
242
$jscriptstr = <<<EOD
243
<script language="javascript" type="text/javascript">
244

    
245

    
246
function widgetAjax(widget) {	
247
	uri = "widgets/widgets/" + widget + ".widget.php";
248
	var opt = {
249
	    // Use GET
250
	    method: 'get',
251
		evalScripts: 'true',
252
	    asynchronous: true,
253
	    // Handle 404
254
	    on404: function(t) {
255
	        alert('Error 404: location "' + t.statusText + '" was not found.');
256
	    },
257
	    // Handle other errors
258
	    onFailure: function(t) {
259
	        alert('Error ' + t.status + ' -- ' + t.statusText);
260
	    },
261
		onSuccess: function(t) {
262
			widget2 = widget + "-loader";
263
			Effect.Fade(widget2, {queue:'front'});
264
			Effect.Appear(widget, {queue:'end'});			
265
	    }	
266
	}
267
	new Ajax.Updater(widget, uri, opt);
268
}
269

    
270

    
271
function addWidget(selectedDiv){	
272
	selectedDiv2 = selectedDiv + "-container";
273
	d = document;
274
	textlink = d.getElementById(selectedDiv2);
275
	Effect.Appear(selectedDiv2, {duration:1});
276
	if (textlink.style.display != "none")
277
	{
278
		Effect.Shake(selectedDiv2);	
279
	}
280
	else
281
	{
282
		widgetAjax(selectedDiv);
283
		selectIntLink = selectedDiv2 + "-input";
284
		textlink = d.getElementById(selectIntLink);
285
		textlink.value = "show";	
286
		showSave();
287
	}
288
}
289

    
290
function configureWidget(selectedDiv){
291
	selectIntLink = selectedDiv + "-settings";	
292
	d = document;
293
	textlink = d.getElementById(selectIntLink);
294
	if (textlink.style.display == "none")
295
		Effect.BlindDown(selectIntLink, {duration:1});
296
	else
297
		Effect.BlindUp(selectIntLink, {duration:1});
298
}
299

    
300
function showWidget(selectedDiv,swapButtons){
301
	//appear element
302
    Effect.BlindDown(selectedDiv, {duration:1});      
303
    showSave();    
304
	d = document;	
305
    if (swapButtons){
306
	    selectIntLink = selectedDiv + "-min";
307
		textlink = d.getElementById(selectIntLink);
308
		textlink.style.display = "inline";
309
	    
310
	    
311
	    selectIntLink = selectedDiv + "-open";
312
		textlink = d.getElementById(selectIntLink);
313
		textlink.style.display = "none";
314

    
315
    }
316
	selectIntLink = selectedDiv + "-container-input";
317
	textlink = d.getElementById(selectIntLink);
318
	textlink.value = "show";	
319
    
320
}
321
	
322
function minimizeWidget(selectedDiv,swapButtons){
323
	//fade element
324
    Effect.BlindUp(selectedDiv, {duration:1});      
325
    showSave();
326
	d = document;	
327
    if (swapButtons){
328
	    selectIntLink = selectedDiv + "-open";
329
		textlink = d.getElementById(selectIntLink);
330
		textlink.style.display = "inline";	    
331
	    
332
	    selectIntLink = selectedDiv + "-min";
333
		textlink = d.getElementById(selectIntLink);
334
		textlink.style.display = "none";
335
    }  		
336
	selectIntLink = selectedDiv + "-container-input";
337
	textlink = d.getElementById(selectIntLink);
338
	textlink.value = "hide";	  
339
    
340
}
341

    
342
function closeWidget(selectedDiv){	
343
	showSave();
344
	selectedDiv = selectedDiv + "-container";
345
	Effect.Fade(selectedDiv, {duration:1});
346
	d = document;
347
	selectIntLink = selectedDiv + "-input";
348
	textlink = d.getElementById(selectIntLink);
349
	textlink.value = "close";	
350
}
351

    
352
function showSave(){
353
	d = document;
354
	selectIntLink = "submit";
355
	textlink = d.getElementById(selectIntLink);
356
	textlink.style.display = "inline";	
357
}
358

    
359
function updatePref(){	
360
	var widgets = document.getElementsByClassName('widgetdiv');
361
	var widgetSequence = "";
362
	var firstprint = false;	
363
	d = document;
364
	for (i=0; i<widgets.length; i++){
365
		if (firstprint)
366
			widgetSequence += ",";
367
		var widget = widgets[i].id;
368
		widgetSequence += widget + ":" + widgets[i].parentNode.id + ":";
369
		widget = widget + "-input";
370
		textlink = d.getElementById(widget).value;
371
		widgetSequence += textlink;
372
		firstprint = true;		
373
	}
374
	selectLink = "sequence";
375
	textlink = d.getElementById(selectLink);
376
	textlink.value = widgetSequence;
377
	return true;	
378
}
379

    
380
function hideAllWidgets(){		
381
		Effect.Fade('niftyOutter', {to: 0.2});
382
}
383

    
384
function showAllWidgets(){		
385
		Effect.Fade('niftyOutter', {to: 1.0});
386
}
387

    
388

    
389
function changeTabDIV(selectedDiv){
390
	var dashpos = selectedDiv.indexOf("-");
391
	var tabclass = selectedDiv.substring(0,dashpos);
392
	d = document;
393

    
394
	//get deactive tabs first
395
	tabclass = tabclass + "-class-tabdeactive"; 
396
	var tabs = document.getElementsByClassName(tabclass);
397
	var incTabSelected = selectedDiv + "-deactive";
398
	for (i=0; i<tabs.length; i++){
399
		var tab = tabs[i].id;
400
		dashpos = tab.lastIndexOf("-");
401
		var tab2 = tab.substring(0,dashpos) + "-deactive";
402
		if (tab2 == incTabSelected){
403
			tablink = d.getElementById(tab2);
404
			tablink.style.display = "none";
405
			tab2 = tab.substring(0,dashpos) + "-active";
406
			tablink = d.getElementById(tab2);
407
			tablink.style.display = "table-cell";
408
			
409
			//now show main div associated with link clicked
410
			tabmain = d.getElementById(selectedDiv);
411
			tabmain.style.display = "block";
412
		}
413
		else
414
		{	
415
			tab2 = tab.substring(0,dashpos) + "-deactive";
416
			tablink = d.getElementById(tab2);
417
			tablink.style.display = "table-cell";
418
			tab2 = tab.substring(0,dashpos) + "-active";
419
			tablink = d.getElementById(tab2);
420
			tablink.style.display = "none";		
421
			
422
			//hide sections we don't want to see
423
			tab2 = tab.substring(0,dashpos);
424
			tabmain = d.getElementById(tab2);
425
			tabmain.style.display = "none";
426
				
427
		}
428
	}	
429
}
430

    
431
</script>
432
EOD;
433
$closehead = false;
434

    
435
## Set Page Title and Include Header
436
$pgtitle = array("{$g['product_name']} Dashboard");
437
include("head.inc");
438

    
439
?>
440

    
441
<script type="text/javascript" language="javascript" src="/javascript/scriptaculous/prototype.js"></script>
442
<script type="text/javascript" language="javascript" src="/javascript/scriptaculous/scriptaculous.js"></script>
443

    
444
<?php
445

    
446
outputJavaScriptFileInline("javascript/domTT/domLib.js");
447
outputJavaScriptFileInline("javascript/domTT/domTT.js");
448
outputJavaScriptFileInline("javascript/domTT/behaviour.js");
449
outputJavaScriptFileInline("javascript/domTT/fadomatic.js");
450
//echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domLib.js\"></script>";
451
//echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domTT.js\"></script>";
452
//echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/behaviour.js\"></script>";
453
//echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/fadomatic.js\"></script>";
454
?>
455

    
456
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
457
<form action="index.php" method="post">
458
<script language="javascript" type="text/javascript">
459
// <![CDATA[
460
columns = ['col1','col2'];
461
// ]]>
462

    
463
</script>
464

    
465
<?php
466
include("fbegin.inc");
467
echo $jscriptstr;
468
	if(!file_exists("/usr/local/www/themes/{$g['theme']}/no_big_logo"))
469
		echo "<center><img src=\"./themes/".$g['theme']."/images/logobig.jpg\"></center><br>";
470
?>
471
<div id="widgetcontainer" style="display:none">
472
		<div id="content1"><h1>Available Widgets</h1><p><?php
473
			$widgetfiles_add = $widgetfiles;
474
			sort($widgetfiles_add);
475
			foreach($widgetfiles_add as $widget) {			
476
				if(!stristr($widget, "widget.php"))
477
					continue;		
478
				
479
				$periodpos = strpos($widget, ".");
480
				$widgetname = substr($widget, 0, $periodpos);
481
				$nicename = $widgetname;
482
				$nicename = str_replace("_", " ", $nicename);
483
				//make the title look nice
484
				$nicename = ucwords($nicename);
485
				
486
				$widgettitle = $widgetname . "_title";
487
				$widgettitlelink = $widgetname . "_title_link";
488
					if ($$widgettitle != "")
489
					{
490
						//echo widget title 
491
						?>
492
						<span style="cursor: pointer;" onclick='return addWidget("<?php echo $widgetname; ?>")'>
493
						<u><?php echo $$widgettitle; ?></u></span><br>
494
						<?php 
495
					}
496
					else {?>
497
						<span style="cursor: pointer;" onclick='return addWidget("<?php echo $widgetname; ?>")'>
498
						<u><?php echo $nicename; ?></u></span><br><?php
499
					}
500
			}
501
		?>
502
		</p>
503
	</div>
504
</div>
505

    
506
<div id="welcomecontainer" style="display:none">
507
		<div id="welcome-container">
508
			<h1>
509
				<div style="float:left;width:80%;padding: 2px">
510
					Welcome to the Dashboard page!
511
				</div>
512
				<div onclick="domTT_close(this);showAllWidgets();" style="float:right;width:8%; cursor:pointer;padding: 5px;" >
513
					<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_close.gif" />
514
				</div>
515
				<div style="clear:both;"></div>
516
			</h1>
517
			<p>
518
			This page allows you to customize the information you want to be displayed!<br/>
519
			To get started click the <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif"> icon to add widgets.<br/>
520
			<br/>
521
			You can move any widget around by clicking and dragging the title.			
522
			</p>
523
	</div>
524
</div>
525

    
526

    
527

    
528
<input type="hidden" value="" name="sequence" id="sequence">
529
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="Click here to add widgets" style="cursor: pointer;" onmouseup="domTT_activate(this, event, 'content', document.getElementById('content1'), 'type', 'velcro', 'delay', 0, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');" />
530

    
531
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_info_pkg.gif" alt="Click here for help" style="cursor: help;" onmouseup="hideAllWidgets();domTT_activate(this, event, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '','delay', 0, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');" />
532

    
533

    
534
&nbsp;&nbsp;&nbsp;
535
		<input id="submit" name="submit" type="submit" style="display:none" onclick="return updatePref();" class="formbtn" value="Save Settings" />
536
</p>
537

    
538
<div id="niftyOutter">
539
	<?php
540
	$totalwidgets = count($widgetfiles);
541
	$halftotal = $totalwidgets / 2 - 2;
542
	$widgetcounter = 0;
543
	$directory = "/usr/local/www/widgets/widgets/";
544
	$printed = false;
545
	$firstprint = false;
546
	?> 
547
	<div id="col1" style="float:left;width:49%;padding-bottom:40px">		
548
	<?php	
549
		
550
	foreach($widgetlist as $widget) {
551
		
552
		if(!stristr($widget, "widget.php"))
553
					continue;
554
		$periodpos = strpos($widget, ".");
555
		$widgetname = substr($widget, 0, $periodpos);	
556
		if ($widgetname != ""){
557
			$nicename = $widgetname;
558
			$nicename = str_replace("_", " ", $nicename);
559
			
560
			//make the title look nice
561
			$nicename = ucwords($nicename);
562
		}
563
		
564
		if ($config['widgets'] && $pconfig['sequence'] != ""){
565
			if ($displayarray[$widgetcounter] == "show"){
566
				$divdisplay = "block";
567
				$display = "block";
568
				$inputdisplay = "show";					
569
				$showWidget = "none";
570
				$mindiv = "inline";
571
			}
572
			else if ($displayarray[$widgetcounter] == "hide") {
573
				$divdisplay = "block";
574
				$display = "none";
575
				$inputdisplay = "hide";		
576
				$showWidget = "inline";
577
				$mindiv = "none";
578
			}
579
			else if ($displayarray[$widgetcounter] == "close"){
580
				$divdisplay = "none";
581
				$display = "block";
582
				$inputdisplay = "close";			
583
				$showWidget = "none";
584
				$mindiv = "inline";
585
			}
586
			else{
587
				$divdisplay = "none";
588
				$display = "block";
589
				$inputdisplay = "none";
590
				$showWidget = "none";
591
				$mindiv = "inline";
592
			}
593
		}
594
		else
595
		{
596
			if ($firstprint == false){
597
				$divdisplay = "block";
598
				$display = "block";
599
				$inputdisplay = "show";					
600
				$showWidget = "none";
601
				$mindiv = "inline";
602
				$firstprint = true;
603
			}
604
			else
605
			{
606
				if ($widget == "interfaces.widget.php")
607
				{
608
					$divdisplay = "block";
609
					$display = "block";
610
					$inputdisplay = "show";					
611
					$showWidget = "none";
612
					$mindiv = "inline";
613
				}
614
				else if ($widget == "traffic_graphs.widget.php")
615
				{
616
					$divdisplay = "block";
617
					$display = "block";
618
					$inputdisplay = "show";					
619
					$showWidget = "none";
620
					$mindiv = "inline";
621
				}
622
				else {
623
					$divdisplay = "none";
624
					$display = "block";
625
					$inputdisplay = "close";			
626
					$showWidget = "none";
627
					$mindiv = "inline";
628
				}
629
			}
630
		}
631
		
632
		if ($config['widgets'] && $pconfig['sequence'] != ""){
633
			if ($colpos[$widgetcounter] == "col2" && $printed == false)
634
			{
635
				$printed = true;
636
				?>
637
				</div>
638
				<div id="col2" style="float:right;width:49%;padding-bottom:40px">		
639
				<?php
640
			}
641
		}
642
		else if ($widgetcounter >= $halftotal && $printed == false){
643
			$printed = true;
644
			?>
645
			</div>
646
			<div id="col2" style="float:right;width:49%;padding-bottom:40px">		
647
			<?php
648
		}
649
		
650
		?>
651
		<div style="clear:both;"></div>
652
		<div  id="<?php echo $widgetname;?>-container" class="widgetdiv" style="display:<?php echo $divdisplay; ?>;">
653
			<input type="hidden" value="<?php echo $inputdisplay;?>" id="<?php echo $widgetname;?>-container-input" name="<?php echo $widgetname;?>-container-input">
654
			<div id="<?php echo $widgetname;?>-topic" class="widgetheader" style="cursor:move">
655
				<div style="float:left;">
656
					<?php 
657
					
658
					$widgettitle = $widgetname . "_title";
659
					$widgettitlelink = $widgetname . "_title_link";
660
					if ($$widgettitle != "")
661
					{
662
						//only show link if defined
663
						if ($$widgettitlelink != "") {?>						
664
						<u><span onClick="location.href='/<?php echo $$widgettitlelink;?>'" style="cursor:pointer">
665
						<?php }
666
							//echo widget title
667
							echo $$widgettitle; 
668
						if ($$widgettitlelink != "") { ?>
669
						</span></u>						
670
						<?php }
671
					}
672
					else{		
673
						if ($$widgettitlelink != "") {?>						
674
						<u><span onClick="location.href='/<?php echo $$widgettitlelink;?>'" style="cursor:pointer">
675
						<?php }
676
						echo $nicename;
677
							if ($$widgettitlelink != "") { ?>
678
						</span></u>						
679
						<?php }
680
					}
681
					?>
682
				</div>
683
				<div align="right" style="float:right;">	
684
					<div id="<?php echo $widgetname;?>-configure" onclick='return configureWidget("<?php echo $widgetname;?>")' style="display:none; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_configure.gif" /></div>									
685
					<div id="<?php echo $widgetname;?>-open" onclick='return showWidget("<?php echo $widgetname;?>",true)' style="display:<?php echo $showWidget;?>; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_open.gif" /></div>	
686
					<div id="<?php echo $widgetname;?>-min" onclick='return minimizeWidget("<?php echo $widgetname;?>",true)' style="display:<?php echo $mindiv;?>; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_minus.gif"/></div>												
687
					<div id="<?php echo $widgetname;?>-close" onclick='return closeWidget("<?php echo $widgetname;?>",true)' style="display:inline; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_close.gif" /></div>	
688
				</div>
689
				<div style="clear:both;"></div>
690
			</div>
691
			<?php if ($divdisplay != "block") { ?>
692
			<div id="<?php echo $widgetname;?>-loader" style="display:<?php echo $display; ?>;">
693
				<br>	
694
					<center>
695
						<img src="./themes/<?= $g['theme']; ?>/images/misc/widget_loader.gif" width=25 height=25 alt="Loading selected widget...">
696
					</center>	
697
				<br>
698
			</div> <?php } if ($divdisplay != "block") $display = none; ?>
699
			<div id="<?php echo $widgetname;?>" style="display:<?php echo $display; ?>;">				
700
				<?php 
701
					if ($divdisplay == "block")
702
					{
703
						include($directory . $widget);
704
					}	
705
				 ?>
706
			</div>
707
			<div style="clear:both;"></div>
708
		</div>
709
		<?php 	
710
	$widgetcounter++;
711
		
712
	}//end foreach	
713
	?>			
714
		</div>
715
	<div style="clear:both;"></div>
716
</div>
717

    
718

    
719

    
720
<?php include("fend.inc"); ?>
721
	    
722
<script type="text/javascript">
723
	window.onload = function(in_event)
724
	{		
725
			Sortable.create("col1", {tag:'div',dropOnEmpty:true,containment:columns,handle:'widgetheader',constraint:false,only:'widgetdiv',onChange:showSave});	
726
			Sortable.create("col2", {tag:'div',dropOnEmpty:true,containment:columns,handle:'widgetheader',constraint:false,only:'widgetdiv',onChange:showSave});		
727
	<?php if (!$config['widgets']  && $pconfig['sequence'] != ""){ ?>
728
			hideAllWidgets();		    
729
			domTT_activate('welcome1', null, 'x', 287, 'y', 107, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '','delay', 1000, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');		
730
	<?php } ?>
731
	}	
732
	<?php
733
	//build list of javascript include files
734
	$jsincludefiles = array();
735
	$directory = "widgets/javascript/";
736
	$dirhandle  = opendir($directory);
737
	$filename = "";
738
	while (false !== ($filename = readdir($dirhandle))) {
739
   		$jsincludefiles[] = $filename;
740
	}
741
	foreach($jsincludefiles as $jsincludename) {
742
		if(!stristr($jsincludename, ".js"))
743
			continue;	
744
		include($directory . $jsincludename);
745
	}
746
	?>
747
</script>
748
</form>
749
</body>
750
</html>
(75-75/216)