Project

General

Profile

Download (22.7 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
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
35
	pfSense_MODULE:	interfaces
36
*/
37

    
38
##|+PRIV
39
##|*IDENT=page-system-login/logout
40
##|*NAME=System: Login / Logout page
41
##|*DESCR=Allow access to the 'System: Login / Logout' page.
42
##|*MATCH=index.php*
43
##|-PRIV
44

    
45
	// Turn on buffering to speed up rendering
46
	ini_set('output_buffering','true');
47
	
48
	// Start buffering with a cache size of 100000
49
	ob_start(null, "100000");
50

    
51
	## Load Essential Includes
52
	require_once('functions.inc');
53
	require_once('guiconfig.inc');
54
	require_once('notices.inc');
55

    
56
	if ($_POST && $_POST['submit']) {
57
		$config['widgets']['sequence'] = $_POST['sequence'];
58

    
59
		foreach ($widgetnames as $widget){
60
			if ($_POST[$widget . '-config']){
61
				$config['widgets'][$widget . '-config'] = $_POST[$widget . '-config'];
62
			}
63
		}
64

    
65
		write_config("Widget configuration has been changed.");
66
		header("Location: index.php");
67
		exit;
68
	}
69

    
70
	## Load Functions Files
71
	require_once('includes/functions.inc.php');
72
	
73
	## Check to see if we have a swap space,
74
	## if true, display, if false, hide it ...
75
	if(file_exists("/usr/sbin/swapinfo")) {
76
		$swapinfo = `/usr/sbin/swapinfo`;
77
		if(stristr($swapinfo,'%') == true) $showswap=true;
78
	}
79

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

    
94
	## If it is the first time webConfigurator has been
95
	## accessed since initial install show this stuff.
96
	if(file_exists('/conf/trigger_initial_wizard')) {
97
		echo <<<EOF
98
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
99
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
100
<html>
101
<head>
102
	<title>pfSense.local - pfSense first time setup</title>
103
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
104
	<link rel="stylesheet" type="text/css" href="/niftycssprintCode.css" media="print" />
105
	<script type="text/javascript">var theme = "nervecenter"</script>
106
	<script type="text/javascript" src="/themes/nervecenter/loader.js"></script>
107
		
108
EOF;
109

    
110
		echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n";
111

    
112
		if(file_exists("/usr/local/www/themes/{$g['theme']}/wizard.css")) 
113
			echo "<link rel=\"stylesheet\" href=\"/themes/{$g['theme']}/wizard.css\" media=\"all\" />\n";
114
		else 
115
			echo "<link rel=\"stylesheet\" href=\"/themes/{$g['theme']}/all.css\" media=\"all\" />";
116

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

    
134

    
135
	## Find out whether there's hardware encryption or not
136
	unset($hwcrypto);
137
	$fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r");
138
	if ($fd) {
139
		while (!feof($fd)) {
140
			$dmesgl = fgets($fd);
141
			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)) {
142
				$hwcrypto = $matches[1];
143
				break;
144
			}
145
		}
146
		fclose($fd);
147
	}
148

    
149
##build list of widgets
150
$directory = "/usr/local/www/widgets/widgets/";
151
$dirhandle  = opendir($directory);
152
$filename = "";
153
$widgetnames = array();
154
$widgetfiles = array();
155
$widgetlist = array();
156
while (false !== ($filename = readdir($dirhandle))) {
157
	$periodpos = strpos($filename, ".");
158
	$widgetname = substr($filename, 0, $periodpos);
159
	$widgetnames[] = $widgetname;
160
	if ($widgetname != "system_information")
161
		$widgetfiles[] = $filename;   		
162
}
163

    
164
##sort widgets alphabetically
165
sort($widgetfiles);
166

    
167
##insert the system information widget as first, so as to be displayed first
168
array_unshift($widgetfiles, "system_information.widget.php");
169

    
170
##if no config entry found, initialize config entry
171
if (!is_array($config['widgets'])) {
172
	$config['widgets'] = array();
173
}
174

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

    
216
##build list of php include files
217
$phpincludefiles = array();
218
$directory = "/usr/local/www/widgets/include/";
219
$dirhandle  = opendir($directory);
220
$filename = "";
221
while (false !== ($filename = readdir($dirhandle))) {
222
	$phpincludefiles[] = $filename;
223
}
224
foreach($phpincludefiles as $includename) {
225
	if(!stristr($includename, ".inc"))
226
		continue;	
227
	include($directory . $includename);
228
}
229

    
230
##begin AJAX
231
$jscriptstr = <<<EOD
232
<script language="javascript" type="text/javascript">
233

    
234

    
235
function widgetAjax(widget) {	
236
	uri = "widgets/widgets/" + widget + ".widget.php";
237
	var opt = {
238
	    // Use GET
239
	    method: 'get',
240
		evalScripts: 'true',
241
	    asynchronous: true,
242
	    // Handle 404
243
	    on404: function(t) {
244
	        alert('Error 404: location "' + t.statusText + '" was not found.');
245
	    },
246
	    // Handle other errors
247
	    onFailure: function(t) {
248
	        alert('Error ' + t.status + ' -- ' + t.statusText);
249
	    },
250
		onSuccess: function(t) {
251
			widget2 = widget + "-loader";
252
			Effect.Fade(widget2, {queue:'front'});
253
			Effect.Appear(widget, {queue:'end'});			
254
	    }	
255
	}
256
	new Ajax.Updater(widget, uri, opt);
257
}
258

    
259

    
260
function addWidget(selectedDiv){	
261
	selectedDiv2 = selectedDiv + "-container";
262
	d = document;
263
	textlink = d.getElementById(selectedDiv2);
264
	Effect.Appear(selectedDiv2, {duration:1});
265
	if (textlink.style.display != "none")
266
	{
267
		Effect.Shake(selectedDiv2);	
268
	}
269
	else
270
	{
271
		widgetAjax(selectedDiv);
272
		selectIntLink = selectedDiv2 + "-input";
273
		textlink = d.getElementById(selectIntLink);
274
		textlink.value = "show";	
275
		showSave();
276
	}
277
}
278

    
279
function configureWidget(selectedDiv){
280
	selectIntLink = selectedDiv + "-settings";	
281
	d = document;
282
	textlink = d.getElementById(selectIntLink);
283
	if (textlink.style.display == "none")
284
		Effect.BlindDown(selectIntLink, {duration:1});
285
	else
286
		Effect.BlindUp(selectIntLink, {duration:1});
287
}
288

    
289
function showWidget(selectedDiv,swapButtons){
290
	//appear element
291
    Effect.BlindDown(selectedDiv, {duration:1});      
292
    showSave();    
293
	d = document;	
294
    if (swapButtons){
295
	    selectIntLink = selectedDiv + "-min";
296
		textlink = d.getElementById(selectIntLink);
297
		textlink.style.display = "inline";
298
	    
299
	    
300
	    selectIntLink = selectedDiv + "-open";
301
		textlink = d.getElementById(selectIntLink);
302
		textlink.style.display = "none";
303

    
304
    }
305
	selectIntLink = selectedDiv + "-container-input";
306
	textlink = d.getElementById(selectIntLink);
307
	textlink.value = "show";	
308
    
309
}
310
	
311
function minimizeWidget(selectedDiv,swapButtons){
312
	//fade element
313
    Effect.BlindUp(selectedDiv, {duration:1});      
314
    showSave();
315
	d = document;	
316
    if (swapButtons){
317
	    selectIntLink = selectedDiv + "-open";
318
		textlink = d.getElementById(selectIntLink);
319
		textlink.style.display = "inline";	    
320
	    
321
	    selectIntLink = selectedDiv + "-min";
322
		textlink = d.getElementById(selectIntLink);
323
		textlink.style.display = "none";
324
    }  		
325
	selectIntLink = selectedDiv + "-container-input";
326
	textlink = d.getElementById(selectIntLink);
327
	textlink.value = "hide";	  
328
    
329
}
330

    
331
function closeWidget(selectedDiv){	
332
	showSave();
333
	selectedDiv = selectedDiv + "-container";
334
	Effect.Fade(selectedDiv, {duration:1});
335
	d = document;
336
	selectIntLink = selectedDiv + "-input";
337
	textlink = d.getElementById(selectIntLink);
338
	textlink.value = "close";	
339
}
340

    
341
function showSave(){
342
	d = document;
343
	selectIntLink = "submit";
344
	textlink = d.getElementById(selectIntLink);
345
	textlink.style.display = "inline";	
346
}
347

    
348
function updatePref(){	
349
	var widgets = document.getElementsByClassName('widgetdiv');
350
	var widgetSequence = "";
351
	var firstprint = false;	
352
	d = document;
353
	for (i=0; i<widgets.length; i++){
354
		if (firstprint)
355
			widgetSequence += ",";
356
		var widget = widgets[i].id;
357
		widgetSequence += widget + ":" + widgets[i].parentNode.id + ":";
358
		widget = widget + "-input";
359
		textlink = d.getElementById(widget).value;
360
		widgetSequence += textlink;
361
		firstprint = true;		
362
	}
363
	selectLink = "sequence";
364
	textlink = d.getElementById(selectLink);
365
	textlink.value = widgetSequence;
366
	return true;	
367
}
368

    
369
function hideAllWidgets(){		
370
		Effect.Fade('niftyOutter', {to: 0.2});
371
}
372

    
373
function showAllWidgets(){		
374
		Effect.Fade('niftyOutter', {to: 1.0});
375
}
376

    
377

    
378
function changeTabDIV(selectedDiv){
379
	var dashpos = selectedDiv.indexOf("-");
380
	var tabclass = selectedDiv.substring(0,dashpos);
381
	d = document;
382

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

    
420
</script>
421
EOD;
422
$closehead = false;
423

    
424
## Set Page Title and Include Header
425
$pgtitle = array("{$g['product_name']} Dashboard");
426
include("head.inc");
427

    
428
outputJavaScriptFileInline("javascript/domTT/domLib.js");
429
outputJavaScriptFileInline("javascript/domTT/domTT.js");
430
outputJavaScriptFileInline("javascript/domTT/behaviour.js");
431
outputJavaScriptFileInline("javascript/domTT/fadomatic.js");
432
?>
433

    
434
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
435
<form action="index.php" method="post">
436
<script language="javascript" type="text/javascript">
437
// <![CDATA[
438
columns = ['col1','col2'];
439
// ]]>
440

    
441
</script>
442

    
443
<?php
444
include("fbegin.inc");
445
echo $jscriptstr;
446
	if(!file_exists("/usr/local/www/themes/{$g['theme']}/no_big_logo"))
447
		echo "<center><img src=\"./themes/".$g['theme']."/images/logobig.jpg\"></center><br>";
448
?>
449
<div id="widgetcontainer" style="display:none">
450
		<div id="content1"><h1>Available Widgets</h1><p><?php
451
			$widgetfiles_add = $widgetfiles;
452
			sort($widgetfiles_add);
453
			foreach($widgetfiles_add as $widget) {			
454
				if(!stristr($widget, "widget.php"))
455
					continue;		
456
				
457
				$periodpos = strpos($widget, ".");
458
				$widgetname = substr($widget, 0, $periodpos);
459
				$nicename = $widgetname;
460
				$nicename = str_replace("_", " ", $nicename);
461
				//make the title look nice
462
				$nicename = ucwords($nicename);
463
				
464
				$widgettitle = $widgetname . "_title";
465
				$widgettitlelink = $widgetname . "_title_link";
466
					if ($$widgettitle != "")
467
					{
468
						//echo widget title 
469
						?>
470
						<span style="cursor: pointer;" onclick='return addWidget("<?php echo $widgetname; ?>")'>
471
						<u><?php echo $$widgettitle; ?></u></span><br>
472
						<?php 
473
					}
474
					else {?>
475
						<span style="cursor: pointer;" onclick='return addWidget("<?php echo $widgetname; ?>")'>
476
						<u><?php echo $nicename; ?></u></span><br><?php
477
					}
478
			}
479
		?>
480
		</p>
481
	</div>
482
</div>
483

    
484
<div id="welcomecontainer" style="display:none">
485
		<div id="welcome-container">
486
			<h1>
487
				<div style="float:left;width:80%;padding: 2px">
488
					Welcome to the Dashboard page!
489
				</div>
490
				<div onclick="domTT_close(this);showAllWidgets();" style="float:right;width:8%; cursor:pointer;padding: 5px;" >
491
					<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_close.gif" />
492
				</div>
493
				<div style="clear:both;"></div>
494
			</h1>
495
			<p>
496
			This page allows you to customize the information you want to be displayed!<br/>
497
			To get started click the <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif"> icon to add widgets.<br/>
498
			<br/>
499
			You can move any widget around by clicking and dragging the title.			
500
			</p>
501
	</div>
502
</div>
503

    
504
<input type="hidden" value="" name="sequence" id="sequence">
505
<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');" />
506

    
507
<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');" />
508

    
509

    
510
&nbsp;&nbsp;&nbsp;
511
		<input id="submit" name="submit" type="submit" style="display:none" onclick="return updatePref();" class="formbtn" value="Save Settings" />
512
</p>
513

    
514
<div id="niftyOutter">
515
	<?php
516
	$totalwidgets = count($widgetfiles);
517
	$halftotal = $totalwidgets / 2 - 2;
518
	$widgetcounter = 0;
519
	$directory = "/usr/local/www/widgets/widgets/";
520
	$printed = false;
521
	$firstprint = false;
522
	?> 
523
	<div id="col1" style="float:left;width:49%;padding-bottom:40px">		
524
	<?php	
525
		
526
	foreach($widgetlist as $widget) {
527
		
528
		if(!stristr($widget, "widget.php"))
529
					continue;
530
		$periodpos = strpos($widget, ".");
531
		$widgetname = substr($widget, 0, $periodpos);	
532
		if ($widgetname != ""){
533
			$nicename = $widgetname;
534
			$nicename = str_replace("_", " ", $nicename);
535
			
536
			//make the title look nice
537
			$nicename = ucwords($nicename);
538
		}
539
		
540
		if ($config['widgets'] && $pconfig['sequence'] != ""){
541
			switch($displayarray[$widgetcounter]){
542
				case "show":
543
					$divdisplay = "block";
544
					$display = "block";
545
					$inputdisplay = "show";					
546
					$showWidget = "none";
547
					$mindiv = "inline";
548
					break;
549
				case "hide":
550
					$divdisplay = "block";
551
					$display = "none";
552
					$inputdisplay = "hide";		
553
					$showWidget = "inline";
554
					$mindiv = "none";
555
					berak;
556
				case "close":
557
					$divdisplay = "none";
558
					$display = "block";
559
					$inputdisplay = "close";			
560
					$showWidget = "none";
561
					$mindiv = "inline";
562
					break;
563
				default:
564
					$divdisplay = "none";
565
					$display = "block";
566
					$inputdisplay = "none";
567
					$showWidget = "none";
568
					$mindiv = "inline";
569
					break;
570
			}
571
		} else {
572
			if ($firstprint == false){
573
				$divdisplay = "block";
574
				$display = "block";
575
				$inputdisplay = "show";
576
				$showWidget = "none";
577
				$mindiv = "inline";
578
				$firstprint = true;
579
			} else {
580
				switch ($widget) {
581
					case "interfaces.widget.php":
582
					case "traffic_graphs.widget.php":
583
						$divdisplay = "block";
584
						$display = "block";
585
						$inputdisplay = "show";
586
						$showWidget = "none";
587
						$mindiv = "inline";
588
						break;
589
					default:
590
						$divdisplay = "none";
591
						$display = "block";
592
						$inputdisplay = "close";
593
						$showWidget = "none";
594
						$mindiv = "inline";
595
						break;
596
				}
597
			}
598
		}
599
		
600
		if ($config['widgets'] && $pconfig['sequence'] != ""){
601
			if ($colpos[$widgetcounter] == "col2" && $printed == false)
602
			{
603
				$printed = true;
604
				?>
605
				</div>
606
				<div id="col2" style="float:right;width:49%;padding-bottom:40px">		
607
				<?php
608
			}
609
		}
610
		else if ($widgetcounter >= $halftotal && $printed == false){
611
			$printed = true;
612
			?>
613
			</div>
614
			<div id="col2" style="float:right;width:49%;padding-bottom:40px">		
615
			<?php
616
		}
617
		
618
		?>
619
		<div style="clear:both;"></div>
620
		<div  id="<?php echo $widgetname;?>-container" class="widgetdiv" style="display:<?php echo $divdisplay; ?>;">
621
			<input type="hidden" value="<?php echo $inputdisplay;?>" id="<?php echo $widgetname;?>-container-input" name="<?php echo $widgetname;?>-container-input">
622
			<div id="<?php echo $widgetname;?>-topic" class="widgetheader" style="cursor:move">
623
				<div style="float:left;">
624
					<?php 
625
					
626
					$widgettitle = $widgetname . "_title";
627
					$widgettitlelink = $widgetname . "_title_link";
628
					if ($$widgettitle != "")
629
					{
630
						//only show link if defined
631
						if ($$widgettitlelink != "") {?>						
632
						<u><span onClick="location.href='/<?php echo $$widgettitlelink;?>'" style="cursor:pointer">
633
						<?php }
634
							//echo widget title
635
							echo $$widgettitle; 
636
						if ($$widgettitlelink != "") { ?>
637
						</span></u>						
638
						<?php }
639
					}
640
					else{		
641
						if ($$widgettitlelink != "") {?>						
642
						<u><span onClick="location.href='/<?php echo $$widgettitlelink;?>'" style="cursor:pointer">
643
						<?php }
644
						echo $nicename;
645
							if ($$widgettitlelink != "") { ?>
646
						</span></u>						
647
						<?php }
648
					}
649
					?>
650
				</div>
651
				<div align="right" style="float:right;">	
652
					<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>									
653
					<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>	
654
					<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>												
655
					<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>	
656
				</div>
657
				<div style="clear:both;"></div>
658
			</div>
659
			<?php if ($divdisplay != "block") { ?>
660
			<div id="<?php echo $widgetname;?>-loader" style="display:<?php echo $display; ?>;">
661
				<br>	
662
					<center>
663
						<img src="./themes/<?= $g['theme']; ?>/images/misc/widget_loader.gif" width=25 height=25 alt="Loading selected widget...">
664
					</center>	
665
				<br>
666
			</div> <?php } if ($divdisplay != "block") $display = none; ?>
667
			<div id="<?php echo $widgetname;?>" style="display:<?php echo $display; ?>;">				
668
				<?php 
669
					if ($divdisplay == "block")
670
					{
671
						include($directory . $widget);
672
					}	
673
				 ?>
674
			</div>
675
			<div style="clear:both;"></div>
676
		</div>
677
		<?php 	
678
	$widgetcounter++;
679
		
680
	}//end foreach	
681
	?>			
682
		</div>
683
	<div style="clear:both;"></div>
684
</div>
685

    
686
<?php include("fend.inc"); ?>
687
	    
688
<script type="text/javascript">
689
	document.observe('dom:loaded', function(in_event)
690
	{		
691
			Sortable.create("col1", {tag:'div',dropOnEmpty:true,containment:columns,handle:'widgetheader',constraint:false,only:'widgetdiv',onChange:showSave});	
692
			Sortable.create("col2", {tag:'div',dropOnEmpty:true,containment:columns,handle:'widgetheader',constraint:false,only:'widgetdiv',onChange:showSave});		
693
	<?php if (!$config['widgets']  && $pconfig['sequence'] != ""){ ?>
694
			hideAllWidgets();		    
695
			domTT_activate('welcome1', null, 'x', 287, 'y', 107, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '','delay', 1000, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');		
696
	<?php } ?>
697
	});
698
	<?php
699
	//build list of javascript include files
700
	$jsincludefiles = array();
701
	$directory = "widgets/javascript/";
702
	$dirhandle  = opendir($directory);
703
	$filename = "";
704
	while (false !== ($filename = readdir($dirhandle))) {
705
   		$jsincludefiles[] = $filename;
706
	}
707
	foreach($jsincludefiles as $jsincludename) {
708
		if(!stristr($jsincludename, ".js"))
709
			continue;	
710
		include($directory . $jsincludename);
711
	}
712
	?>
713
</script>
714
</form>
715
</body>
716
</html>
(77-77/214)