Project

General

Profile

Download (22.4 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
	## Check to see if we have a swap space,
64
	## if true, display, if false, hide it ...
65
	if(file_exists("/usr/sbin/swapinfo")) {
66
		$swapinfo = `/usr/sbin/swapinfo`;
67
		if(stristr($swapinfo,'%') == true) $showswap=true;
68
	}
69

    
70

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

    
85

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

    
90

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

    
104
		echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n";
105

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

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

    
128

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

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

    
158

    
159
##sort widgets alphabetically
160
sort($widgetfiles);
161

    
162
##insert the system information widget as first, so as to be displayed first
163
array_unshift($widgetfiles, "system_information.widget.php");
164

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

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

    
212

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

    
227
##begin AJAX
228
$jscriptstr = <<<EOD
229
<script language="javascript" type="text/javascript">
230

    
231

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

    
256

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

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

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

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

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

    
338
function showSave(){
339
	d = document;
340
	selectIntLink = "submit";
341
	textlink = d.getElementById(selectIntLink);
342
	textlink.style.display = "inline";	
343
}
344

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

    
366
function hideAllWidgets(){		
367
		Effect.Fade('niftyOutter', {to: 0.2});
368
}
369

    
370
function showAllWidgets(){		
371
		Effect.Fade('niftyOutter', {to: 1.0});
372
}
373

    
374

    
375
function changeTabDIV(selectedDiv){
376
	var dashpos = selectedDiv.indexOf("-");
377
	var tabclass = selectedDiv.substring(0,dashpos);
378
	d = document;
379

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

    
417
</script>
418
EOD;
419
$closehead = false;
420

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

    
425
outputJavaScriptFileInline("javascript/domTT/domLib.js");
426
outputJavaScriptFileInline("javascript/domTT/domTT.js");
427
outputJavaScriptFileInline("javascript/domTT/behaviour.js");
428
outputJavaScriptFileInline("javascript/domTT/fadomatic.js");
429
?>
430

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

    
438
</script>
439

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

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

    
501

    
502

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

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

    
508

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

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

    
685

    
686

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