Project

General

Profile

Download (22.6 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 10094
49
	ob_start(null, "10094");
50

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

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

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

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

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

    
95
	## If it is the first time webConfigurator has been
96
	## accessed since initial install show this stuff.
97
	if(file_exists('/conf/trigger_initial_wizard')) {
98

    
99

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

    
113
		echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n";
114

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

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

    
137

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

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

    
167
##sort widgets alphabetically
168
sort($widgetfiles);
169

    
170
##insert the system information widget as first, so as to be displayed first
171
array_unshift($widgetfiles, "system_information.widget.php");
172

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

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

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

    
233
##begin AJAX
234
$jscriptstr = <<<EOD
235
<script language="javascript" type="text/javascript">
236

    
237

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

    
262

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

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

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

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

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

    
344
function showSave(){
345
	d = document;
346
	selectIntLink = "submit";
347
	textlink = d.getElementById(selectIntLink);
348
	textlink.style.display = "inline";	
349
}
350

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

    
372
function hideAllWidgets(){		
373
		Effect.Fade('niftyOutter', {to: 0.2});
374
}
375

    
376
function showAllWidgets(){		
377
		Effect.Fade('niftyOutter', {to: 1.0});
378
}
379

    
380

    
381
function changeTabDIV(selectedDiv){
382
	var dashpos = selectedDiv.indexOf("-");
383
	var tabclass = selectedDiv.substring(0,dashpos);
384
	d = document;
385

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

    
423
</script>
424
EOD;
425
$closehead = false;
426

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

    
431
outputJavaScriptFileInline("javascript/domTT/domLib.js");
432
outputJavaScriptFileInline("javascript/domTT/domTT.js");
433
outputJavaScriptFileInline("javascript/domTT/behaviour.js");
434
outputJavaScriptFileInline("javascript/domTT/fadomatic.js");
435
?>
436

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

    
444
</script>
445

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

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

    
507

    
508

    
509
<input type="hidden" value="" name="sequence" id="sequence">
510
<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');" />
511

    
512
<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');" />
513

    
514

    
515
&nbsp;&nbsp;&nbsp;
516
		<input id="submit" name="submit" type="submit" style="display:none" onclick="return updatePref();" class="formbtn" value="Save Settings" />
517
</p>
518

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

    
691

    
692

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