Project

General

Profile

Download (22.5 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
	## Load Essential Includes
46
	require_once('guiconfig.inc');
47
	require_once('notices.inc');
48

    
49
	if ($_POST && $_POST['submit']) {
50
		$config['widgets']['sequence'] = $_POST['sequence'];
51

    
52
		foreach ($widgetnames as $widget){
53
			if ($_POST[$widget . '-config']){
54
				$config['widgets'][$widget . '-config'] = $_POST[$widget . '-config'];
55
			}
56
		}
57

    
58
		write_config("Widget configuration has been changed.");
59
		header("Location: index.php");
60
		exit;
61
	}
62

    
63
	## Load Functions Files
64
	require_once('includes/functions.inc.php');
65
	
66
	## Check to see if we have a swap space,
67
	## if true, display, if false, hide it ...
68
	if(file_exists("/usr/sbin/swapinfo")) {
69
		$swapinfo = `/usr/sbin/swapinfo`;
70
		if(stristr($swapinfo,'%') == true) $showswap=true;
71
	}
72

    
73

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

    
88

    
89
	## If it is the first time webConfigurator has been
90
	## accessed since initial install show this stuff.
91
	if(file_exists('/conf/trigger_initial_wizard')) {
92

    
93

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

    
107
		echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n";
108

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

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

    
131

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

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

    
161

    
162
##sort widgets alphabetically
163
sort($widgetfiles);
164

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

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

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

    
505

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

    
509
<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');" />
510

    
511

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

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

    
688

    
689

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