Project

General

Profile

Download (22.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
	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
	
415
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domLib.js\"></script>";
416
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domTT.js\"></script>";
417
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/behaviour.js\"></script>";
418
echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/fadomatic.js\"></script>";
419
?>
420

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

    
428
</script>
429

    
430

    
431
<script src="/javascript/scriptaculous/prototype.js" type="text/javascript"></script>
432
<script src="/javascript/scriptaculous/scriptaculous.js" type="text/javascript"></script>
433

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

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

    
495

    
496

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

    
500
<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');" />
501

    
502

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

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

    
687

    
688

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

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