Project

General

Profile

Download (21.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
	## Load Essential Includes
35
	require_once('guiconfig.inc');
36
	require_once('notices.inc');
37

    
38
	## Load Functions Files
39
	require_once('includes/functions.inc.php');
40

    
41

    
42
	## Load AJAX, Initiate Class ###############################################
43
	require_once('includes/sajax.class.php');
44

    
45
	## Initiate Class and Set location of ajax file containing 
46
	## the information that we need for this page. Also set functions
47
	## that SAJAX will be using.
48
	$oSajax = new sajax();
49
	$oSajax->sajax_remote_uri = 'sajax/index.sajax.php';
50
	$oSajax->sajax_request_type = 'POST';
51
	$oSajax->sajax_export("get_stats");
52
	$oSajax->sajax_handle_client_request();
53
	############################################################################
54
	
55
	
56
	## Check to see if we have a swap space,
57
	## if true, display, if false, hide it ...
58
	if(file_exists("/usr/sbin/swapinfo")) {
59
		$swapinfo = `/usr/sbin/swapinfo`;
60
		if(stristr($swapinfo,'%') == true) $showswap=true;
61
	}
62

    
63

    
64
	## User recently restored his config.
65
	## If packages are installed lets resync
66
	if(file_exists('/conf/needs_package_sync')) {
67
		if($config['installedpackages'] <> '') {
68
			conf_mount_rw();
69
			unlink('/conf/needs_package_sync');
70
			header('Location: pkg_mgr_install.php?mode=reinstallall');
71
			exit;
72
		}
73
	}
74

    
75

    
76
	## If it is the first time webConfigurator has been
77
	## accessed since initial install show this stuff.
78
	if(file_exists('/conf/trigger_initial_wizard')) {
79

    
80
		$pgtitle = array("{$g['product_name']} first time setup");
81
		include('head.inc');
82

    
83
		echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n";
84
		echo "<form>\n";
85
		echo "<center>\n";
86
		echo "<img src=\"/themes/{$g['theme']}/images/logo.gif\" border=\"0\"><p>\n";
87
		echo "<div \" style=\"width:700px;background-color:#ffffff\" id=\"nifty\">\n";
88
		echo "Welcome to {$g['product_name']}!<p>\n";
89
		echo "One moment while we start the initial setup wizard.<p>\n";
90
		echo "Embedded platform users: Please be patient, the wizard takes a little longer to run than the normal GUI.<p>\n";
91
		echo "To bypass the wizard, click on the {$g['product_name']} logo on the initial page.\n";
92
		echo "</div>\n";
93
		echo "<meta http-equiv=\"refresh\" content=\"1;url=wizard.php?xml=setup_wizard.xml\">\n";
94
		echo "<script type=\"text/javascript\">\n";
95
		echo "NiftyCheck();\n";
96
		echo "Rounded(\"div#nifty\",\"all\",\"#000\",\"#FFFFFF\",\"smooth\");\n";
97
		echo "</script>\n";
98
		exit;
99
	}
100

    
101

    
102
	## Find out whether there's hardware encryption or not
103
	unset($hwcrypto);
104
	$fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r");
105
	if ($fd) {
106
		while (!feof($fd)) {
107
			$dmesgl = fgets($fd);
108
			if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches)) {
109
				$hwcrypto = $matches[1];
110
				break;
111
			}
112
		}
113
		fclose($fd);
114
	}
115
	
116
//build list of widgets
117
$directory = "/usr/local/www/widgets/widgets/";
118
$dirhandle  = opendir($directory);
119
$filename = "";
120
$widgetnames = array();
121
$widgetfiles = array();
122

    
123
while (false !== ($filename = readdir($dirhandle))) {
124
	$periodpos = strpos($filename, ".");
125
	$widgetname = substr($filename, 0, $periodpos);
126
	$widgetnames[] = $widgetname;
127
	if ($widgetname != "system_information")
128
		$widgetfiles[] = $filename;   		
129
}
130
sort($widgetfiles);
131
array_unshift($widgetfiles, "system_information.widget.php");
132

    
133

    
134
if (!is_array($config['widgets'])) {
135
	$config['widgets'] = array();
136
}
137

    
138
$pconfig['sequence'] = $config['widgets']['sequence'];
139
	
140
if ($_POST){
141
	$config['widgets']['sequence'] = $_POST['sequence'];
142
	
143
	foreach ($widgetnames as $widget){
144
		if ($_POST[$widget . '-config']){
145
			$config['widgets'][$widget . '-config'] = $_POST[$widget . '-config'];
146
		}
147
	}
148
	
149
	write_config();
150
	header("Location: index.php");
151
	exit;
152
}
153

    
154
	
155
if ($config['widgets'])
156
{
157
	$widgetlist = array();
158
	$widgetlist = $pconfig['sequence'];
159
	
160
	$colpos = array();
161
	$savedwidgetfiles = array();
162
	$widgetname = "";
163
	$widgetlist = explode(",",$widgetlist);
164
	foreach ($widgetlist as $widget){
165
		$dashpos = strpos($widget, "-");		
166
		$widgetname = substr($widget, 0, $dashpos);
167
		$colposition = strpos($widget, ":");		
168
		$displayposition = strrpos($widget, ":");
169
		$colpos[] = substr($widget,$colposition+1, $displayposition - $colposition-1);
170
		$displayarray[] = substr($widget,$displayposition+1);
171
		$savedwidgetfiles[] = $widgetname . ".widget.php";
172
	}
173
	foreach ($widgetnames as $widget){
174
		if ($config['widgets'][$widget . '-config']){
175
			$pconfig[$widget . '-config'] = $config['widgets'][$widget . '-config'];
176
		}
177
	}
178
	$widgetlist = $savedwidgetfiles;
179
	
180
}
181
else{
182
	$widgetlist = $widgetfiles;
183
}
184

    
185

    
186

    
187

    
188

    
189
//build list of php include files
190
$phpincludefiles = array();
191
$directory = "/usr/local/www/widgets/include/";
192
$dirhandle  = opendir($directory);
193
$filename = "";
194
while (false !== ($filename = readdir($dirhandle))) {
195
	$phpincludefiles[] = $filename;
196
}
197
foreach($phpincludefiles as $includename) {
198
	if(!stristr($includename, ".inc"))
199
		continue;	
200
	include($directory . $includename);
201
}
202

    
203
$jscriptstr = <<<EOD
204
<script language="javascript" type="text/javascript">
205

    
206

    
207
function widgetAjax(widget) {	
208
	uri = "widgets/widgets/" + widget + ".widget.php";
209
	var opt = {
210
	    // Use GET
211
	    method: 'get',
212
		evalScripts: 'true',
213
	    asynchronous: true,
214
	    // Handle 404
215
	    on404: function(t) {
216
	        alert('Error 404: location "' + t.statusText + '" was not found.');
217
	    },
218
	    // Handle other errors
219
	    onFailure: function(t) {
220
	        alert('Error ' + t.status + ' -- ' + t.statusText);
221
	    },
222
		onSuccess: function(t) {
223
			widget2 = widget + "-loader";
224
			Effect.Fade(widget2, {queue:'front'});
225
			Effect.Appear(widget, {queue:'end'});			
226
	    }	
227
	}
228
	new Ajax.Updater(widget, uri, opt);
229
}
230

    
231

    
232
function addDiv(selectedDiv){	
233
	selectedDiv2 = selectedDiv + "-container";
234
	d = document;
235
	textlink = d.getElementById(selectedDiv2);
236
	Effect.Appear(selectedDiv2, {duration:1});
237
	if (textlink.style.display != "none")
238
	{
239
		Effect.Shake(selectedDiv2);	
240
	}
241
	else
242
	{
243
		widgetAjax(selectedDiv);
244
		selectIntLink = selectedDiv2 + "-input";
245
		textlink = d.getElementById(selectIntLink);
246
		textlink.value = "show";	
247
		showSave();
248
	}
249
}
250

    
251
function configureDiv(selectedDiv){
252
	selectIntLink = selectedDiv + "-settings";	
253
	d = document;
254
	textlink = d.getElementById(selectIntLink);
255
	if (textlink.style.display == "none")
256
		Effect.BlindDown(selectIntLink, {duration:1});
257
	else
258
		Effect.BlindUp(selectIntLink, {duration:1});
259
}
260

    
261
function showDiv(selectedDiv,swapButtons){
262
	//appear element
263
    Effect.BlindDown(selectedDiv, {duration:1});      
264
    showSave();    
265
	d = document;	
266
    if (swapButtons){
267
	    selectIntLink = selectedDiv + "-min";
268
		textlink = d.getElementById(selectIntLink);
269
		textlink.style.display = "inline";
270
	    
271
	    
272
	    selectIntLink = selectedDiv + "-open";
273
		textlink = d.getElementById(selectIntLink);
274
		textlink.style.display = "none";
275

    
276
    }
277
	selectIntLink = selectedDiv + "-container-input";
278
	textlink = d.getElementById(selectIntLink);
279
	textlink.value = "show";	
280
    
281
}
282
	
283
function minimizeDiv(selectedDiv,swapButtons){
284
	//fade element
285
    Effect.BlindUp(selectedDiv, {duration:1});      
286
    showSave();
287
	d = document;	
288
    if (swapButtons){
289
	    selectIntLink = selectedDiv + "-open";
290
		textlink = d.getElementById(selectIntLink);
291
		textlink.style.display = "inline";	    
292
	    
293
	    selectIntLink = selectedDiv + "-min";
294
		textlink = d.getElementById(selectIntLink);
295
		textlink.style.display = "none";
296
    }  		
297
	selectIntLink = selectedDiv + "-container-input";
298
	textlink = d.getElementById(selectIntLink);
299
	textlink.value = "hide";	  
300
    
301
}
302

    
303
function closeDiv(selectedDiv){	
304
	showSave();
305
	selectedDiv = selectedDiv + "-container";
306
	Effect.Fade(selectedDiv, {duration:1});
307
	d = document;
308
	selectIntLink = selectedDiv + "-input";
309
	textlink = d.getElementById(selectIntLink);
310
	textlink.value = "close";	
311
}
312

    
313
function showSave(){
314
	d = document;
315
	selectIntLink = "submit";
316
	textlink = d.getElementById(selectIntLink);
317
	textlink.style.display = "inline";	
318
}
319

    
320
function updatePref(){	
321
	var widgets = document.getElementsByClassName('widgetdiv');
322
	var widgetSequence = "";
323
	var firstprint = false;	
324
	d = document;
325
	for (i=0; i<widgets.length; i++){
326
		if (firstprint)
327
			widgetSequence += ",";
328
		var widget = widgets[i].id;
329
		widgetSequence += widget + ":" + widgets[i].parentNode.id + ":";
330
		widget = widget + "-input";
331
		textlink = d.getElementById(widget).value;
332
		widgetSequence += textlink;
333
		firstprint = true;		
334
	}
335
	selectLink = "sequence";
336
	textlink = d.getElementById(selectLink);
337
	textlink.value = widgetSequence;
338
	return true;	
339
}
340

    
341
function hideAllWidgets(){		
342
		Effect.Fade('niftyOutter', {to: 0.2});
343
}
344

    
345
function showAllWidgets(){		
346
		Effect.Fade('niftyOutter', {to: 1.0});
347
}
348

    
349

    
350
function changeTabDIV(selectedDiv){
351
	var dashpos = selectedDiv.indexOf("-");
352
	var tabclass = selectedDiv.substring(0,dashpos);
353
	d = document;
354

    
355
	//get deactive tabs first
356
	tabclass = tabclass + "-class-tabdeactive"; 
357
	var tabs = document.getElementsByClassName(tabclass);
358
	var incTabSelected = selectedDiv + "-deactive";
359
	for (i=0; i<tabs.length; i++){
360
		var tab = tabs[i].id;
361
		dashpos = tab.lastIndexOf("-");
362
		var tab2 = tab.substring(0,dashpos) + "-deactive";
363
		if (tab2 == incTabSelected){
364
			tablink = d.getElementById(tab2);
365
			tablink.style.display = "none";
366
			tab2 = tab.substring(0,dashpos) + "-active";
367
			tablink = d.getElementById(tab2);
368
			tablink.style.display = "table-cell";
369
			
370
			//now show main div associated with link clicked
371
			tabmain = d.getElementById(selectedDiv);
372
			tabmain.style.display = "block";
373
		}
374
		else
375
		{	
376
			tab2 = tab.substring(0,dashpos) + "-deactive";
377
			tablink = d.getElementById(tab2);
378
			tablink.style.display = "table-cell";
379
			tab2 = tab.substring(0,dashpos) + "-active";
380
			tablink = d.getElementById(tab2);
381
			tablink.style.display = "none";		
382
			
383
			//hide sections we don't want to see
384
			tab2 = tab.substring(0,dashpos);
385
			tabmain = d.getElementById(tab2);
386
			tabmain.style.display = "none";
387
				
388
		}
389
	}	
390
}
391

    
392
</script>
393
EOD;
394
$closehead = false;
395

    
396
## Set Page Title and Include Header
397
$pgtitle = array("{$g['product_name']} Dashboard");
398
include("head.inc");
399
	
400
	
401
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domLib.js\"></script>";
402
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domTT.js\"></script>";
403
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/behaviour.js\"></script>";
404
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/fadomatic.js\"></script>";
405
?>
406

    
407
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
408
<form action="index.php" method="post">
409
<script language="javascript" type="text/javascript">
410
// <![CDATA[
411
columns = ['col1','col2'];
412
// ]]>
413

    
414
</script>
415

    
416

    
417
<script src="/javascript/scriptaculous/prototype.js" type="text/javascript"></script>
418
<script src="/javascript/scriptaculous/scriptaculous.js" type="text/javascript"></script>
419

    
420
<?php
421
include("fbegin.inc");
422
echo $jscriptstr;
423
	if(!file_exists("/usr/local/www/themes/{$g['theme']}/no_big_logo"))
424
		echo "<center><img src=\"./themes/".$g['theme']."/images/logobig.jpg\"></center><br>";
425
?>
426
<div id="widgetcontainer" style="display:none">
427
		<div id="content1"><h1>Available Widgets</h1><p><?php
428
			$widgetfiles_add = $widgetfiles;
429
			sort($widgetfiles_add);
430
			foreach($widgetfiles_add as $widget) {			
431
				if(!stristr($widget, "widget.php"))
432
					continue;		
433
				
434
				$periodpos = strpos($widget, ".");
435
				$widgetname = substr($widget, 0, $periodpos);
436
				$nicename = $widgetname;
437
				$nicename = str_replace("_", " ", $nicename);
438
				//make the title look nice
439
				$nicename = ucwords($nicename);
440
				
441
				$widgettitle = $widgetname . "_title";
442
				$widgettitlelink = $widgetname . "_title_link";
443
					if ($$widgettitle != "")
444
					{
445
						//echo widget title 
446
						?>
447
						<span style="cursor: pointer;" onclick='return addDiv("<?php echo $widgetname; ?>")'>
448
						<u><?php echo $$widgettitle; ?></u></span><br>
449
						<?php 
450
					}
451
					else {?>
452
						<span style="cursor: pointer;" onclick='return addDiv("<?php echo $widgetname; ?>")'>
453
						<u><?php echo $nicename; ?></u></span><br><?php
454
					}
455
			}
456
		?>
457
		</p>
458
	</div>
459
</div>
460

    
461
<div id="welcomecontainer" style="display:none">
462
		<div id="welcome-container">
463
			<h1>
464
				<div style="float:left;width:80%;padding: 2px">
465
					Welcome to the Dashboard page!
466
				</div>
467
				<div onclick="domTT_close(this);showAllWidgets();" style="float:right;width:8%; cursor:pointer;padding: 5px;" >
468
					<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_close.gif" />
469
				</div>
470
				<div style="clear:both;"></div>
471
			</h1>
472
			<p>
473
			This page allows you to customize the information you want to be displayed!<br/>
474
			To get started click the <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif"> icon to add widgets.<br/>
475
			<br/>
476
			You can move any widget around by clicking and dragging the title.			
477
			</p>
478
	</div>
479
</div>
480

    
481

    
482

    
483
<input type="hidden" value="" name="sequence" id="sequence">
484
<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');" />
485

    
486
<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');" />
487

    
488

    
489
&nbsp;&nbsp;&nbsp;
490
		<input id="submit" name="submit" type="submit" style="display:none" onclick="return updatePref();" class="formbtn" value="Save Settings" />
491
</p>
492

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

    
672

    
673

    
674
<?php include("fend.inc"); ?>
675
	    
676
<script type="text/javascript">
677

    
678
	<?php if (!$config['widgets']){ ?>
679
	window.onload = function(in_event)
680
	{		
681
			hideAllWidgets();		    
682
			domTT_activate('welcome1', null, 'x', 287, 'y', 107, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '','delay', 1000, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');		
683
	}
684
	<?php } ?>
685
	// <![CDATA[
686
	Sortable.create("col1", {tag:'div',dropOnEmpty:true,containment:columns,handle:'widgetheader',constraint:false,only:'widgetdiv',onChange:showSave});	
687
	Sortable.create("col2", {tag:'div',dropOnEmpty:true,containment:columns,handle:'widgetheader',constraint:false,only:'widgetdiv',onChange:showSave});		
688
	// ]]>	
689
	
690
	<?php
691
	//build list of javascript include files
692
	$jsincludefiles = array();
693
	$directory = "widgets/javascript/";
694
	$dirhandle  = opendir($directory);
695
	$filename = "";
696
	while (false !== ($filename = readdir($dirhandle))) {
697
   		$jsincludefiles[] = $filename;
698
	}
699
	foreach($jsincludefiles as $jsincludename) {
700
		if(!stristr($jsincludename, ".js"))
701
			continue;	
702
		include($directory . $jsincludename);
703
	}
704
	?>
705
</script>
706
</form>
707
</body>
708
</html>
(74-74/200)