Project

General

Profile

Download (21.5 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
	if ($_POST && $_POST['submit']) {
39
		$config['widgets']['sequence'] = $_POST['sequence'];
40

    
41
		foreach ($widgetnames as $widget){
42
			if ($_POST[$widget . '-config']){
43
				$config['widgets'][$widget . '-config'] = $_POST[$widget . '-config'];
44
			}
45
		}
46

    
47
		write_config("Widget configuration has been changed.");
48
		header("Location: index.php");
49
		exit;
50
	}
51

    
52
	## Load Functions Files
53
	require_once('includes/functions.inc.php');
54

    
55
	## Load AJAX, Initiate Class ###############################################
56
	require_once('includes/sajax.class.php');
57

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

    
76

    
77
	## User recently restored his config.
78
	## If packages are installed lets resync
79
	if(file_exists('/conf/needs_package_sync')) {
80
		if($config['installedpackages'] <> '') {
81
			conf_mount_rw();
82
			unlink('/conf/needs_package_sync');
83
			conf_mount_ro();
84
			if($g['platform'] == "pfSense") {
85
				header('Location: pkg_mgr_install.php?mode=reinstallall');
86
				exit;
87
			}
88
		}
89
	}
90

    
91

    
92
	## If it is the first time webConfigurator has been
93
	## accessed since initial install show this stuff.
94
	if(file_exists('/conf/trigger_initial_wizard')) {
95

    
96
		$pgtitle = array("{$g['product_name']} first time setup");
97
		include('head.inc');
98

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

    
117

    
118
	## Find out whether there's hardware encryption or not
119
	unset($hwcrypto);
120
	$fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r");
121
	if ($fd) {
122
		while (!feof($fd)) {
123
			$dmesgl = fgets($fd);
124
			if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches)) {
125
				$hwcrypto = $matches[1];
126
				break;
127
			}
128
		}
129
		fclose($fd);
130
	}
131
	
132
//build list of widgets
133
$directory = "/usr/local/www/widgets/widgets/";
134
$dirhandle  = opendir($directory);
135
$filename = "";
136
$widgetnames = array();
137
$widgetfiles = array();
138
$widgetlist = array();
139

    
140
while (false !== ($filename = readdir($dirhandle))) {
141
	$periodpos = strpos($filename, ".");
142
	$widgetname = substr($filename, 0, $periodpos);
143
	$widgetnames[] = $widgetname;
144
	if ($widgetname != "system_information")
145
		$widgetfiles[] = $filename;   		
146
}
147
sort($widgetfiles);
148
array_unshift($widgetfiles, "system_information.widget.php");
149

    
150
if (!is_array($config['widgets'])) {
151
	$config['widgets'] = array();
152
}
153

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

    
176

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

    
191
$jscriptstr = <<<EOD
192
<script language="javascript" type="text/javascript">
193

    
194

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

    
219

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

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

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

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

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

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

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

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

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

    
337

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

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

    
380
</script>
381
EOD;
382
$closehead = false;
383

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

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

    
402
</script>
403

    
404

    
405
<script src="/javascript/scriptaculous/prototype.js" type="text/javascript"></script>
406
<script src="/javascript/scriptaculous/scriptaculous.js" type="text/javascript"></script>
407

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

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

    
469

    
470

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

    
474
<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');" />
475

    
476

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

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

    
661

    
662

    
663
<?php include("fend.inc"); ?>
664
	    
665
<script type="text/javascript">
666

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