Project

General

Profile

Download (21 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
			}
214
			new Ajax.Updater(widget, uri, opt);
215
		}
216

    
217

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

    
237
function configureDiv(selectedDiv){
238
	selectIntLink = selectedDiv + "-settings";	
239
	d = document;
240
	textlink = d.getElementById(selectIntLink);
241
	if (textlink.style.display == "none")
242
		Effect.BlindDown(selectIntLink, {duration:1});
243
	else
244
		Effect.BlindUp(selectIntLink, {duration:1});
245
}
246

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

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

    
289
function closeDiv(selectedDiv){	
290
	showSave();
291
	selectedDiv = selectedDiv + "-container";
292
	Effect.Fade(selectedDiv, {duration:1});
293
	d = document;
294
	selectIntLink = selectedDiv + "-input";
295
	textlink = d.getElementById(selectIntLink);
296
	textlink.value = "close";	
297
}
298

    
299
function showSave(){
300
	d = document;
301
	selectIntLink = "submit";
302
	textlink = d.getElementById(selectIntLink);
303
	textlink.style.display = "inline";	
304
}
305

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

    
327
function hideAllWidgets(){		
328
		Effect.Fade('niftyOutter', {to: 0.2});
329
}
330

    
331
function showAllWidgets(){		
332
		Effect.Fade('niftyOutter', {to: 1.0});
333
}
334

    
335

    
336
function changeTabDIV(selectedDiv){
337
	var dashpos = selectedDiv.indexOf("-");
338
	var tabclass = selectedDiv.substring(0,dashpos);
339
	d = document;
340

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

    
378
</script>
379
EOD;
380
$closehead = false;
381

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

    
393
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
394
<form action="index.php" method="post">
395
<script language="javascript" type="text/javascript">
396
// <![CDATA[
397
columns = ['col1','col2'];
398
// ]]>
399

    
400
</script>
401

    
402

    
403
<script src="/javascript/scriptaculous/prototype.js" type="text/javascript"></script>
404
<script src="/javascript/scriptaculous/scriptaculous.js" type="text/javascript"></script>
405

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

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

    
467

    
468

    
469
<input type="hidden" value="" name="sequence" id="sequence">
470
<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');" />
471

    
472
<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');" />
473

    
474

    
475
&nbsp;&nbsp;&nbsp;
476
		<input id="submit" name="submit" type="submit" style="display:none" onclick="return updatePref();" class="formbtn" value="Save Settings" />
477
</p>
478

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

    
656

    
657

    
658
<?php include("fend.inc"); ?>
659
	    
660
<script type="text/javascript">
661

    
662
	<?php if (!$config['widgets']){ ?>
663
	window.onload = function(in_event)
664
	{		
665
			hideAllWidgets();		    
666
			domTT_activate('welcome1', null, 'x', 287, 'y', 107, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '','delay', 1000, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');		
667
	}
668
	<?php } ?>
669
	// <![CDATA[
670
	Sortable.create("col1", {tag:'div',dropOnEmpty:true,containment:columns,handle:'widgetheader',constraint:false,only:'widgetdiv',onChange:showSave});	
671
	Sortable.create("col2", {tag:'div',dropOnEmpty:true,containment:columns,handle:'widgetheader',constraint:false,only:'widgetdiv',onChange:showSave});		
672
	// ]]>	
673
	
674
	<?php
675
	//build list of javascript include files
676
	$jsincludefiles = array();
677
	$directory = "widgets/javascript/";
678
	$dirhandle  = opendir($directory);
679
	$filename = "";
680
	while (false !== ($filename = readdir($dirhandle))) {
681
   		$jsincludefiles[] = $filename;
682
	}
683
	foreach($jsincludefiles as $jsincludename) {
684
		if(!stristr($jsincludename, ".js"))
685
			continue;	
686
		include($directory . $jsincludename);
687
	}
688
	?>
689
</script>
690
</form>
691
</body>
692
</html>
(71-71/189)