Project

General

Profile

Download (22.7 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
while (false !== ($filename = readdir($dirhandle))) {
140
	$periodpos = strpos($filename, ".");
141
	$widgetname = substr($filename, 0, $periodpos);
142
	$widgetnames[] = $widgetname;
143
	if ($widgetname != "system_information")
144
		$widgetfiles[] = $filename;   		
145
}
146

    
147

    
148
##sort widgets alphabetically
149
sort($widgetfiles);
150

    
151
##insert the system information widget as first, so as to be displayed first
152
array_unshift($widgetfiles, "system_information.widget.php");
153

    
154
##if no config entry found, initialize config entry
155
if (!is_array($config['widgets'])) {
156
	$config['widgets'] = array();
157
}
158

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

    
201

    
202
##build list of php include files
203
$phpincludefiles = array();
204
$directory = "/usr/local/www/widgets/include/";
205
$dirhandle  = opendir($directory);
206
$filename = "";
207
while (false !== ($filename = readdir($dirhandle))) {
208
	$phpincludefiles[] = $filename;
209
}
210
foreach($phpincludefiles as $includename) {
211
	if(!stristr($includename, ".inc"))
212
		continue;	
213
	include($directory . $includename);
214
}
215

    
216
##begin AJAX
217
$jscriptstr = <<<EOD
218
<script language="javascript" type="text/javascript">
219

    
220

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

    
245

    
246
function addWidget(selectedDiv){	
247
	selectedDiv2 = selectedDiv + "-container";
248
	d = document;
249
	textlink = d.getElementById(selectedDiv2);
250
	Effect.Appear(selectedDiv2, {duration:1});
251
	if (textlink.style.display != "none")
252
	{
253
		Effect.Shake(selectedDiv2);	
254
	}
255
	else
256
	{
257
		widgetAjax(selectedDiv);
258
		selectIntLink = selectedDiv2 + "-input";
259
		textlink = d.getElementById(selectIntLink);
260
		textlink.value = "show";	
261
		showSave();
262
	}
263
}
264

    
265
function configureWidget(selectedDiv){
266
	selectIntLink = selectedDiv + "-settings";	
267
	d = document;
268
	textlink = d.getElementById(selectIntLink);
269
	if (textlink.style.display == "none")
270
		Effect.BlindDown(selectIntLink, {duration:1});
271
	else
272
		Effect.BlindUp(selectIntLink, {duration:1});
273
}
274

    
275
function showWidget(selectedDiv,swapButtons){
276
	//appear element
277
    Effect.BlindDown(selectedDiv, {duration:1});      
278
    showSave();    
279
	d = document;	
280
    if (swapButtons){
281
	    selectIntLink = selectedDiv + "-min";
282
		textlink = d.getElementById(selectIntLink);
283
		textlink.style.display = "inline";
284
	    
285
	    
286
	    selectIntLink = selectedDiv + "-open";
287
		textlink = d.getElementById(selectIntLink);
288
		textlink.style.display = "none";
289

    
290
    }
291
	selectIntLink = selectedDiv + "-container-input";
292
	textlink = d.getElementById(selectIntLink);
293
	textlink.value = "show";	
294
    
295
}
296
	
297
function minimizeWidget(selectedDiv,swapButtons){
298
	//fade element
299
    Effect.BlindUp(selectedDiv, {duration:1});      
300
    showSave();
301
	d = document;	
302
    if (swapButtons){
303
	    selectIntLink = selectedDiv + "-open";
304
		textlink = d.getElementById(selectIntLink);
305
		textlink.style.display = "inline";	    
306
	    
307
	    selectIntLink = selectedDiv + "-min";
308
		textlink = d.getElementById(selectIntLink);
309
		textlink.style.display = "none";
310
    }  		
311
	selectIntLink = selectedDiv + "-container-input";
312
	textlink = d.getElementById(selectIntLink);
313
	textlink.value = "hide";	  
314
    
315
}
316

    
317
function closeWidget(selectedDiv){	
318
	showSave();
319
	selectedDiv = selectedDiv + "-container";
320
	Effect.Fade(selectedDiv, {duration:1});
321
	d = document;
322
	selectIntLink = selectedDiv + "-input";
323
	textlink = d.getElementById(selectIntLink);
324
	textlink.value = "close";	
325
}
326

    
327
function showSave(){
328
	d = document;
329
	selectIntLink = "submit";
330
	textlink = d.getElementById(selectIntLink);
331
	textlink.style.display = "inline";	
332
}
333

    
334
function updatePref(){	
335
	var widgets = document.getElementsByClassName('widgetdiv');
336
	var widgetSequence = "";
337
	var firstprint = false;	
338
	d = document;
339
	for (i=0; i<widgets.length; i++){
340
		if (firstprint)
341
			widgetSequence += ",";
342
		var widget = widgets[i].id;
343
		widgetSequence += widget + ":" + widgets[i].parentNode.id + ":";
344
		widget = widget + "-input";
345
		textlink = d.getElementById(widget).value;
346
		widgetSequence += textlink;
347
		firstprint = true;		
348
	}
349
	selectLink = "sequence";
350
	textlink = d.getElementById(selectLink);
351
	textlink.value = widgetSequence;
352
	return true;	
353
}
354

    
355
function hideAllWidgets(){		
356
		Effect.Fade('niftyOutter', {to: 0.2});
357
}
358

    
359
function showAllWidgets(){		
360
		Effect.Fade('niftyOutter', {to: 1.0});
361
}
362

    
363

    
364
function changeTabDIV(selectedDiv){
365
	var dashpos = selectedDiv.indexOf("-");
366
	var tabclass = selectedDiv.substring(0,dashpos);
367
	d = document;
368

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

    
406
</script>
407
EOD;
408
$closehead = false;
409

    
410
## Set Page Title and Include Header
411
$pgtitle = array("{$g['product_name']} Dashboard");
412
include("head.inc");
413

    
414
outputJavaScriptFileInline("javascript/domTT/domLib.js");
415
outputJavaScriptFileInline("javascript/domTT/domTT.js");
416
outputJavaScriptFileInline("javascript/domTT/behaviour.js");
417
outputJavaScriptFileInline("javascript/domTT/fadomatic.js");
418
//echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domLib.js\"></script>";
419
//echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domTT.js\"></script>";
420
//echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/behaviour.js\"></script>";
421
//echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/fadomatic.js\"></script>";
422
?>
423

    
424
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
425
<form action="index.php" method="post">
426
<script language="javascript" type="text/javascript">
427
// <![CDATA[
428
columns = ['col1','col2'];
429
// ]]>
430

    
431
</script>
432

    
433
<script type="text/javascript" language="javascript" src="/javascript/scriptaculous/prototype.js"></script>"
434
<script type="text/javascript" language="javascript" src="javascript/scriptaculous/scriptaculous.js"></script>"
435

    
436
<?php
437
include("fbegin.inc");
438
echo $jscriptstr;
439
	if(!file_exists("/usr/local/www/themes/{$g['theme']}/no_big_logo"))
440
		echo "<center><img src=\"./themes/".$g['theme']."/images/logobig.jpg\"></center><br>";
441
?>
442
<div id="widgetcontainer" style="display:none">
443
		<div id="content1"><h1>Available Widgets</h1><p><?php
444
			$widgetfiles_add = $widgetfiles;
445
			sort($widgetfiles_add);
446
			foreach($widgetfiles_add as $widget) {			
447
				if(!stristr($widget, "widget.php"))
448
					continue;		
449
				
450
				$periodpos = strpos($widget, ".");
451
				$widgetname = substr($widget, 0, $periodpos);
452
				$nicename = $widgetname;
453
				$nicename = str_replace("_", " ", $nicename);
454
				//make the title look nice
455
				$nicename = ucwords($nicename);
456
				
457
				$widgettitle = $widgetname . "_title";
458
				$widgettitlelink = $widgetname . "_title_link";
459
					if ($$widgettitle != "")
460
					{
461
						//echo widget title 
462
						?>
463
						<span style="cursor: pointer;" onclick='return addWidget("<?php echo $widgetname; ?>")'>
464
						<u><?php echo $$widgettitle; ?></u></span><br>
465
						<?php 
466
					}
467
					else {?>
468
						<span style="cursor: pointer;" onclick='return addWidget("<?php echo $widgetname; ?>")'>
469
						<u><?php echo $nicename; ?></u></span><br><?php
470
					}
471
			}
472
		?>
473
		</p>
474
	</div>
475
</div>
476

    
477
<div id="welcomecontainer" style="display:none">
478
		<div id="welcome-container">
479
			<h1>
480
				<div style="float:left;width:80%;padding: 2px">
481
					Welcome to the Dashboard page!
482
				</div>
483
				<div onclick="domTT_close(this);showAllWidgets();" style="float:right;width:8%; cursor:pointer;padding: 5px;" >
484
					<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_close.gif" />
485
				</div>
486
				<div style="clear:both;"></div>
487
			</h1>
488
			<p>
489
			This page allows you to customize the information you want to be displayed!<br/>
490
			To get started click the <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif"> icon to add widgets.<br/>
491
			<br/>
492
			You can move any widget around by clicking and dragging the title.			
493
			</p>
494
	</div>
495
</div>
496

    
497

    
498

    
499
<input type="hidden" value="" name="sequence" id="sequence">
500
<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');" />
501

    
502
<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');" />
503

    
504

    
505
&nbsp;&nbsp;&nbsp;
506
		<input id="submit" name="submit" type="submit" style="display:none" onclick="return updatePref();" class="formbtn" value="Save Settings" />
507
</p>
508

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

    
689

    
690

    
691
<?php include("fend.inc"); ?>
692
	    
693
<script type="text/javascript">
694

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