Project

General

Profile

Download (22.9 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
	## Load AJAX, Initiate Class ###############################################
64
	require_once('includes/sajax.class.php');
65

    
66
	## Initiate Class and Set location of ajax file containing 
67
	## the information that we need for this page. Also set functions
68
	## that SAJAX will be using.
69
	$oSajax = new sajax();
70
	$oSajax->sajax_remote_uri = 'sajax/index.sajax.php';
71
	$oSajax->sajax_request_type = 'POST';
72
	$oSajax->sajax_export("get_stats");
73
	$oSajax->sajax_handle_client_request();
74
	############################################################################
75
	
76
	
77
	## Check to see if we have a swap space,
78
	## if true, display, if false, hide it ...
79
	if(file_exists("/usr/sbin/swapinfo")) {
80
		$swapinfo = `/usr/sbin/swapinfo`;
81
		if(stristr($swapinfo,'%') == true) $showswap=true;
82
	}
83

    
84

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

    
99

    
100
	## If it is the first time webConfigurator has been
101
	## accessed since initial install show this stuff.
102
	if(file_exists('/conf/trigger_initial_wizard')) {
103

    
104
		$pgtitle = array("{$g['product_name']} first time setup");
105
		include('head.inc');
106

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

    
125

    
126
	## Find out whether there's hardware encryption or not
127
	unset($hwcrypto);
128
	$fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r");
129
	if ($fd) {
130
		while (!feof($fd)) {
131
			$dmesgl = fgets($fd);
132
			if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches)) {
133
				$hwcrypto = $matches[1];
134
				break;
135
			}
136
		}
137
		fclose($fd);
138
	}
139

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

    
155

    
156
##sort widgets alphabetically
157
sort($widgetfiles);
158

    
159
##insert the system information widget as first, so as to be displayed first
160
array_unshift($widgetfiles, "system_information.widget.php");
161

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

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

    
209

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

    
224
##begin AJAX
225
$jscriptstr = <<<EOD
226
<script language="javascript" type="text/javascript">
227

    
228

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

    
253

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

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

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

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

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

    
335
function showSave(){
336
	d = document;
337
	selectIntLink = "submit";
338
	textlink = d.getElementById(selectIntLink);
339
	textlink.style.display = "inline";	
340
}
341

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

    
363
function hideAllWidgets(){		
364
		Effect.Fade('niftyOutter', {to: 0.2});
365
}
366

    
367
function showAllWidgets(){		
368
		Effect.Fade('niftyOutter', {to: 1.0});
369
}
370

    
371

    
372
function changeTabDIV(selectedDiv){
373
	var dashpos = selectedDiv.indexOf("-");
374
	var tabclass = selectedDiv.substring(0,dashpos);
375
	d = document;
376

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

    
414
</script>
415
EOD;
416
$closehead = false;
417

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

    
422
outputJavaScriptFileInline("javascript/domTT/domLib.js");
423
outputJavaScriptFileInline("javascript/domTT/domTT.js");
424
outputJavaScriptFileInline("javascript/domTT/behaviour.js");
425
outputJavaScriptFileInline("javascript/domTT/fadomatic.js");
426
//echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domLib.js\"></script>";
427
//echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domTT.js\"></script>";
428
//echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/behaviour.js\"></script>";
429
//echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/fadomatic.js\"></script>";
430
?>
431

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

    
439
</script>
440

    
441
<script type="text/javascript" language="javascript" src="/javascript/scriptaculous/prototype.js"></script>
442
<script type="text/javascript" language="javascript" src="javascript/scriptaculous/scriptaculous.js"></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

    
506

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

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

    
512

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

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

    
697

    
698

    
699
<?php include("fend.inc"); ?>
700
	    
701
<script type="text/javascript">
702

    
703
	<?php if (!$config['widgets']  && $pconfig['sequence'] != ""){ ?>
704
	window.onload = function(in_event)
705
	{		
706
			hideAllWidgets();		    
707
			domTT_activate('welcome1', null, 'x', 287, 'y', 107, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '','delay', 1000, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');		
708
	}
709
	<?php } ?>
710
	// <![CDATA[
711
	Sortable.create("col1", {tag:'div',dropOnEmpty:true,containment:columns,handle:'widgetheader',constraint:false,only:'widgetdiv',onChange:showSave});	
712
	Sortable.create("col2", {tag:'div',dropOnEmpty:true,containment:columns,handle:'widgetheader',constraint:false,only:'widgetdiv',onChange:showSave});		
713
	// ]]>	
714
	
715
	<?php
716
	//build list of javascript include files
717
	$jsincludefiles = array();
718
	$directory = "widgets/javascript/";
719
	$dirhandle  = opendir($directory);
720
	$filename = "";
721
	while (false !== ($filename = readdir($dirhandle))) {
722
   		$jsincludefiles[] = $filename;
723
	}
724
	foreach($jsincludefiles as $jsincludename) {
725
		if(!stristr($jsincludename, ".js"))
726
			continue;	
727
		include($directory . $jsincludename);
728
	}
729
	?>
730
</script>
731
</form>
732
</body>
733
</html>
(71-71/209)