Project

General

Profile

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

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

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

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

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

    
22
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
23
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26
    oR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
    POSSIBILITY OF SUCH DAMAGE.
32
*/
33
/*
34
	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, "1000");
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
echo "\t<script type=\"text/javascript\" src=\"javascript/domTT/domLib.js\"></script>\n";
429
echo "\t<script type=\"text/javascript\" src=\"javascript/domTT/domTT.js\"></script>\n";
430
echo "\t<script type=\"text/javascript\" src=\"javascript/domTT/behaviour.js\"></script>\n";
431
echo "\t<script type=\"text/javascript\" src=\"javascript/domTT/fadomatic.js\"></script>\n";
432

    
433
?>
434

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

    
442
</script>
443

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

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

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

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

    
510

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

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