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

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

    
427
</script>
428

    
429

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

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

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

    
494

    
495

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

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

    
501

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

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

    
686

    
687

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

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