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 = "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 = $pconfig['sequence'];
158
	
159
	$colpos = array();
160
	$savedwidgetfiles = array();
161
	$widgetname = "";
162
	$widgetlist = explode(",",$widgetlist);
163
	foreach ($widgetlist as $widget){
164
		$dashpos = strpos($widget, "-");		
165
		$widgetname = substr($widget, 0, $dashpos);
166
		$colposition = strpos($widget, ":");		
167
		$displayposition = strrpos($widget, ":");
168
		$colpos[] = substr($widget,$colposition+1, $displayposition - $colposition-1);
169
		$displayarray[] = substr($widget,$displayposition+1);
170
		$savedwidgetfiles[] = $widgetname . ".widget.php";
171
	}
172
	foreach ($widgetnames as $widget){
173
		if ($config['widgets'][$widget . '-config']){
174
			$pconfig[$widget . '-config'] = $config['widgets'][$widget . '-config'];
175
		}
176
	}	
177
}
178

    
179

    
180
//build list of php include files
181
$phpincludefiles = Array();
182
$directory = "widgets/include/";
183
$dirhandle  = opendir($directory);
184
$filename = "";
185
while (false !== ($filename = readdir($dirhandle))) {
186
	$phpincludefiles[] = $filename;
187
}
188
foreach($phpincludefiles as $includename) {
189
	if(!stristr($includename, ".inc"))
190
		continue;	
191
	include($directory . $includename);
192
}
193

    
194
$jscriptstr = <<<EOD
195
<script language="javascript" type="text/javascript">
196

    
197

    
198
function widgetAjax(widget) {	
199
	uri = "widgets/widgets/" + widget + ".widget.php";
200
	var opt = {
201
	    // Use GET
202
	    method: 'get',
203
		evalScripts: 'true',
204
	    asynchronous: true,
205
	    // Handle 404
206
	    on404: function(t) {
207
	        alert('Error 404: location "' + t.statusText + '" was not found.');
208
	    },
209
	    // Handle other errors
210
	    onFailure: function(t) {
211
	        alert('Error ' + t.status + ' -- ' + t.statusText);
212
	    },
213
		onSuccess: function(t) {
214
			widget2 = widget + "-loader";
215
			Effect.Fade(widget2, {queue:'front'});
216
			Effect.Appear(widget, {queue:'end'});			
217
	    }	
218
	}
219
	new Ajax.Updater(widget, uri, opt);
220
}
221

    
222

    
223
function addDiv(selectedDiv){	
224
	selectedDiv2 = selectedDiv + "-container";
225
	d = document;
226
	textlink = d.getElementById(selectedDiv2);
227
	Effect.Appear(selectedDiv2, {duration:1});
228
	if (textlink.style.display != "none")
229
	{
230
		Effect.Shake(selectedDiv2);	
231
	}
232
	else
233
	{
234
		widgetAjax(selectedDiv);
235
		selectIntLink = selectedDiv2 + "-input";
236
		textlink = d.getElementById(selectIntLink);
237
		textlink.value = "show";	
238
		showSave();
239
	}
240
}
241

    
242
function configureDiv(selectedDiv){
243
	selectIntLink = selectedDiv + "-settings";	
244
	d = document;
245
	textlink = d.getElementById(selectIntLink);
246
	if (textlink.style.display == "none")
247
		Effect.BlindDown(selectIntLink, {duration:1});
248
	else
249
		Effect.BlindUp(selectIntLink, {duration:1});
250
}
251

    
252
function showDiv(selectedDiv,swapButtons){
253
	//appear element
254
    Effect.BlindDown(selectedDiv, {duration:1});      
255
    showSave();    
256
	d = document;	
257
    if (swapButtons){
258
	    selectIntLink = selectedDiv + "-min";
259
		textlink = d.getElementById(selectIntLink);
260
		textlink.style.display = "inline";
261
	    
262
	    
263
	    selectIntLink = selectedDiv + "-open";
264
		textlink = d.getElementById(selectIntLink);
265
		textlink.style.display = "none";
266

    
267
    }
268
	selectIntLink = selectedDiv + "-container-input";
269
	textlink = d.getElementById(selectIntLink);
270
	textlink.value = "show";	
271
    
272
}
273
	
274
function minimizeDiv(selectedDiv,swapButtons){
275
	//fade element
276
    Effect.BlindUp(selectedDiv, {duration:1});      
277
    showSave();
278
	d = document;	
279
    if (swapButtons){
280
	    selectIntLink = selectedDiv + "-open";
281
		textlink = d.getElementById(selectIntLink);
282
		textlink.style.display = "inline";	    
283
	    
284
	    selectIntLink = selectedDiv + "-min";
285
		textlink = d.getElementById(selectIntLink);
286
		textlink.style.display = "none";
287
    }  		
288
	selectIntLink = selectedDiv + "-container-input";
289
	textlink = d.getElementById(selectIntLink);
290
	textlink.value = "hide";	  
291
    
292
}
293

    
294
function closeDiv(selectedDiv){	
295
	showSave();
296
	selectedDiv = selectedDiv + "-container";
297
	Effect.Fade(selectedDiv, {duration:1});
298
	d = document;
299
	selectIntLink = selectedDiv + "-input";
300
	textlink = d.getElementById(selectIntLink);
301
	textlink.value = "close";	
302
}
303

    
304
function showSave(){
305
	d = document;
306
	selectIntLink = "submit";
307
	textlink = d.getElementById(selectIntLink);
308
	textlink.style.display = "inline";	
309
}
310

    
311
function updatePref(){	
312
	var widgets = document.getElementsByClassName('widgetdiv');
313
	var widgetSequence = "";
314
	var firstprint = false;	
315
	d = document;
316
	for (i=0; i<widgets.length; i++){
317
		if (firstprint)
318
			widgetSequence += ",";
319
		var widget = widgets[i].id;
320
		widgetSequence += widget + ":" + widgets[i].parentNode.id + ":";
321
		widget = widget + "-input";
322
		textlink = d.getElementById(widget).value;
323
		widgetSequence += textlink;
324
		firstprint = true;		
325
	}
326
	selectLink = "sequence";
327
	textlink = d.getElementById(selectLink);
328
	textlink.value = widgetSequence;
329
	return true;	
330
}
331

    
332
function hideAllWidgets(){		
333
		Effect.Fade('niftyOutter', {to: 0.2});
334
}
335

    
336
function showAllWidgets(){		
337
		Effect.Fade('niftyOutter', {to: 1.0});
338
}
339

    
340

    
341
function changeTabDIV(selectedDiv){
342
	var dashpos = selectedDiv.indexOf("-");
343
	var tabclass = selectedDiv.substring(0,dashpos);
344
	d = document;
345

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

    
383
</script>
384
EOD;
385
$closehead = false;
386

    
387
## Set Page Title and Include Header
388
$pgtitle = array("{$g['product_name']} Dashboard");
389
include("head.inc");
390
	
391
	
392
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domLib.js\"></script>";
393
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domTT.js\"></script>";
394
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/behaviour.js\"></script>";
395
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/fadomatic.js\"></script>";
396
?>
397

    
398
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
399
<form action="index.php" method="post">
400
<script language="javascript" type="text/javascript">
401
// <![CDATA[
402
columns = ['col1','col2'];
403
// ]]>
404

    
405
</script>
406

    
407

    
408
<script src="/javascript/scriptaculous/prototype.js" type="text/javascript"></script>
409
<script src="/javascript/scriptaculous/scriptaculous.js" type="text/javascript"></script>
410

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

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

    
472

    
473

    
474
<input type="hidden" value="" name="sequence" id="sequence">
475
<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');" />
476

    
477
<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');" />
478

    
479

    
480
&nbsp;&nbsp;&nbsp;
481
		<input id="submit" name="submit" type="submit" style="display:none" onclick="return updatePref();" class="formbtn" value="Save Settings" />
482
</p>
483

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

    
669

    
670

    
671
<?php include("fend.inc"); ?>
672
	    
673
<script type="text/javascript">
674

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