1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
|
<?php
/* $Id$ */
/*
index.php
Copyright (C) 2004, 2005 Scott Ullrich
All rights reserved.
Originally part of m0n0wall (http://m0n0.ch/wall)
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
oR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
##|+PRIV
##|*IDENT=page-system-login/logout
##|*NAME=System: Login / Logout page
##|*DESCR=Allow access to the 'System: Login / Logout' page.
##|*MATCH=index.php*
##|-PRIV
## Load Essential Includes
require_once('guiconfig.inc');
require_once('notices.inc');
if ($_POST && $_POST['submit']) {
$config['widgets']['sequence'] = $_POST['sequence'];
foreach ($widgetnames as $widget){
if ($_POST[$widget . '-config']){
$config['widgets'][$widget . '-config'] = $_POST[$widget . '-config'];
}
}
write_config("Widget configuration has been changed.");
header("Location: index.php");
exit;
}
## Load Functions Files
require_once('includes/functions.inc.php');
## Load AJAX, Initiate Class ###############################################
require_once('includes/sajax.class.php');
## Initiate Class and Set location of ajax file containing
## the information that we need for this page. Also set functions
## that SAJAX will be using.
$oSajax = new sajax();
$oSajax->sajax_remote_uri = 'sajax/index.sajax.php';
$oSajax->sajax_request_type = 'POST';
$oSajax->sajax_export("get_stats");
$oSajax->sajax_handle_client_request();
############################################################################
## Check to see if we have a swap space,
## if true, display, if false, hide it ...
if(file_exists("/usr/sbin/swapinfo")) {
$swapinfo = `/usr/sbin/swapinfo`;
if(stristr($swapinfo,'%') == true) $showswap=true;
}
## User recently restored his config.
## If packages are installed lets resync
if(file_exists('/conf/needs_package_sync')) {
if($config['installedpackages'] <> '') {
conf_mount_rw();
unlink('/conf/needs_package_sync');
conf_mount_ro();
if($g['platform'] == "pfSense") {
header('Location: pkg_mgr_install.php?mode=reinstallall');
exit;
}
}
}
## If it is the first time webConfigurator has been
## accessed since initial install show this stuff.
if(file_exists('/conf/trigger_initial_wizard')) {
echo <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>pfSense.local - pfSense first time setup</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="/niftycssprintCode.css" media="print" />
<script type="text/javascript">var theme = "nervecenter"</script>
<script type="text/javascript" src="/themes/nervecenter/loader.js"></script>
EOF;
echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n";
if(file_exists("/usr/local/www/themes/{$g['theme']}/wizard.css"))
echo "<link rel=\"stylesheet\" href=\"/themes/{$g['theme']}/wizard.css\" media=\"all\" />\n";
else
echo "<link rel=\"stylesheet\" href=\"/themes/{$g['theme']}/all.css\" media=\"all\" />";
echo "<form>\n";
echo "<center>\n";
echo "<img src=\"/themes/{$g['theme']}/images/logo.gif\" border=\"0\"><p>\n";
echo "<div \" style=\"width:700px;background-color:#ffffff\" id=\"nifty\">\n";
echo "Welcome to {$g['product_name']}!<p>\n";
echo "One moment while we start the initial setup wizard.<p>\n";
echo "Embedded platform users: Please be patient, the wizard takes a little longer to run than the normal GUI.<p>\n";
echo "To bypass the wizard, click on the {$g['product_name']} logo on the initial page.\n";
echo "</div>\n";
echo "<meta http-equiv=\"refresh\" content=\"1;url=wizard.php?xml=setup_wizard.xml\">\n";
echo "<script type=\"text/javascript\">\n";
echo "NiftyCheck();\n";
echo "Rounded(\"div#nifty\",\"all\",\"#AAA\",\"#FFFFFF\",\"smooth\");\n";
echo "</script>\n";
exit;
}
## Find out whether there's hardware encryption or not
unset($hwcrypto);
$fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r");
if ($fd) {
while (!feof($fd)) {
$dmesgl = fgets($fd);
if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches)) {
$hwcrypto = $matches[1];
break;
}
}
fclose($fd);
}
##build list of widgets
$directory = "/usr/local/www/widgets/widgets/";
$dirhandle = opendir($directory);
$filename = "";
$widgetnames = array();
$widgetfiles = array();
$widgetlist = array();
while (false !== ($filename = readdir($dirhandle))) {
$periodpos = strpos($filename, ".");
$widgetname = substr($filename, 0, $periodpos);
$widgetnames[] = $widgetname;
if ($widgetname != "system_information")
$widgetfiles[] = $filename;
}
##sort widgets alphabetically
sort($widgetfiles);
##insert the system information widget as first, so as to be displayed first
array_unshift($widgetfiles, "system_information.widget.php");
##if no config entry found, initialize config entry
if (!is_array($config['widgets'])) {
$config['widgets'] = array();
}
##build widget saved list information
if ($config['widgets'] && $config['widgets']['sequence'] != "") {
$pconfig['sequence'] = $config['widgets']['sequence'];
$widgetlist = $pconfig['sequence'];
$colpos = array();
$savedwidgetfiles = array();
$widgetname = "";
$widgetlist = explode(",",$widgetlist);
##read the widget position and display information
foreach ($widgetlist as $widget){
$dashpos = strpos($widget, "-");
$widgetname = substr($widget, 0, $dashpos);
$colposition = strpos($widget, ":");
$displayposition = strrpos($widget, ":");
$colpos[] = substr($widget,$colposition+1, $displayposition - $colposition-1);
$displayarray[] = substr($widget,$displayposition+1);
$savedwidgetfiles[] = $widgetname . ".widget.php";
}
##add widgets that may not be in the saved configuration, in case they are to be displayed later
foreach ($widgetfiles as $defaultwidgets){
if (!in_array($defaultwidgets, $savedwidgetfiles)){
$savedwidgetfiles[] = $defaultwidgets;
}
}
##find custom configurations of a particular widget and load its info to $pconfig
foreach ($widgetnames as $widget){
if ($config['widgets'][$widget . '-config']){
$pconfig[$widget . '-config'] = $config['widgets'][$widget . '-config'];
}
}
$widgetlist = $savedwidgetfiles;
}
##no saved widget sequence found, build default list.
else{
$widgetlist = $widgetfiles;
}
##build list of php include files
$phpincludefiles = array();
$directory = "/usr/local/www/widgets/include/";
$dirhandle = opendir($directory);
$filename = "";
while (false !== ($filename = readdir($dirhandle))) {
$phpincludefiles[] = $filename;
}
foreach($phpincludefiles as $includename) {
if(!stristr($includename, ".inc"))
continue;
include($directory . $includename);
}
##begin AJAX
$jscriptstr = <<<EOD
<script language="javascript" type="text/javascript">
function widgetAjax(widget) {
uri = "widgets/widgets/" + widget + ".widget.php";
var opt = {
// Use GET
method: 'get',
evalScripts: 'true',
asynchronous: true,
// Handle 404
on404: function(t) {
alert('Error 404: location "' + t.statusText + '" was not found.');
},
// Handle other errors
onFailure: function(t) {
alert('Error ' + t.status + ' -- ' + t.statusText);
},
onSuccess: function(t) {
widget2 = widget + "-loader";
Effect.Fade(widget2, {queue:'front'});
Effect.Appear(widget, {queue:'end'});
}
}
new Ajax.Updater(widget, uri, opt);
}
function addWidget(selectedDiv){
selectedDiv2 = selectedDiv + "-container";
d = document;
textlink = d.getElementById(selectedDiv2);
Effect.Appear(selectedDiv2, {duration:1});
if (textlink.style.display != "none")
{
Effect.Shake(selectedDiv2);
}
else
{
widgetAjax(selectedDiv);
selectIntLink = selectedDiv2 + "-input";
textlink = d.getElementById(selectIntLink);
textlink.value = "show";
showSave();
}
}
function configureWidget(selectedDiv){
selectIntLink = selectedDiv + "-settings";
d = document;
textlink = d.getElementById(selectIntLink);
if (textlink.style.display == "none")
Effect.BlindDown(selectIntLink, {duration:1});
else
Effect.BlindUp(selectIntLink, {duration:1});
}
function showWidget(selectedDiv,swapButtons){
//appear element
Effect.BlindDown(selectedDiv, {duration:1});
showSave();
d = document;
if (swapButtons){
selectIntLink = selectedDiv + "-min";
textlink = d.getElementById(selectIntLink);
textlink.style.display = "inline";
selectIntLink = selectedDiv + "-open";
textlink = d.getElementById(selectIntLink);
textlink.style.display = "none";
}
selectIntLink = selectedDiv + "-container-input";
textlink = d.getElementById(selectIntLink);
textlink.value = "show";
}
function minimizeWidget(selectedDiv,swapButtons){
//fade element
Effect.BlindUp(selectedDiv, {duration:1});
showSave();
d = document;
if (swapButtons){
selectIntLink = selectedDiv + "-open";
textlink = d.getElementById(selectIntLink);
textlink.style.display = "inline";
selectIntLink = selectedDiv + "-min";
textlink = d.getElementById(selectIntLink);
textlink.style.display = "none";
}
selectIntLink = selectedDiv + "-container-input";
textlink = d.getElementById(selectIntLink);
textlink.value = "hide";
}
function closeWidget(selectedDiv){
showSave();
selectedDiv = selectedDiv + "-container";
Effect.Fade(selectedDiv, {duration:1});
d = document;
selectIntLink = selectedDiv + "-input";
textlink = d.getElementById(selectIntLink);
textlink.value = "close";
}
function showSave(){
d = document;
selectIntLink = "submit";
textlink = d.getElementById(selectIntLink);
textlink.style.display = "inline";
}
function updatePref(){
var widgets = document.getElementsByClassName('widgetdiv');
var widgetSequence = "";
var firstprint = false;
d = document;
for (i=0; i<widgets.length; i++){
if (firstprint)
widgetSequence += ",";
var widget = widgets[i].id;
widgetSequence += widget + ":" + widgets[i].parentNode.id + ":";
widget = widget + "-input";
textlink = d.getElementById(widget).value;
widgetSequence += textlink;
firstprint = true;
}
selectLink = "sequence";
textlink = d.getElementById(selectLink);
textlink.value = widgetSequence;
return true;
}
function hideAllWidgets(){
Effect.Fade('niftyOutter', {to: 0.2});
}
function showAllWidgets(){
Effect.Fade('niftyOutter', {to: 1.0});
}
function changeTabDIV(selectedDiv){
var dashpos = selectedDiv.indexOf("-");
var tabclass = selectedDiv.substring(0,dashpos);
d = document;
//get deactive tabs first
tabclass = tabclass + "-class-tabdeactive";
var tabs = document.getElementsByClassName(tabclass);
var incTabSelected = selectedDiv + "-deactive";
for (i=0; i<tabs.length; i++){
var tab = tabs[i].id;
dashpos = tab.lastIndexOf("-");
var tab2 = tab.substring(0,dashpos) + "-deactive";
if (tab2 == incTabSelected){
tablink = d.getElementById(tab2);
tablink.style.display = "none";
tab2 = tab.substring(0,dashpos) + "-active";
tablink = d.getElementById(tab2);
tablink.style.display = "table-cell";
//now show main div associated with link clicked
tabmain = d.getElementById(selectedDiv);
tabmain.style.display = "block";
}
else
{
tab2 = tab.substring(0,dashpos) + "-deactive";
tablink = d.getElementById(tab2);
tablink.style.display = "table-cell";
tab2 = tab.substring(0,dashpos) + "-active";
tablink = d.getElementById(tab2);
tablink.style.display = "none";
//hide sections we don't want to see
tab2 = tab.substring(0,dashpos);
tabmain = d.getElementById(tab2);
tabmain.style.display = "none";
}
}
}
</script>
EOD;
$closehead = false;
## Set Page Title and Include Header
$pgtitle = array("{$g['product_name']} Dashboard");
include("head.inc");
outputJavaScriptFileInline("javascript/domTT/domLib.js");
outputJavaScriptFileInline("javascript/domTT/domTT.js");
outputJavaScriptFileInline("javascript/domTT/behaviour.js");
outputJavaScriptFileInline("javascript/domTT/fadomatic.js");
//echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domLib.js\"></script>";
//echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/domTT.js\"></script>";
//echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/behaviour.js\"></script>";
//echo "<script type=\"text/javascript\" language=\"javascript\" src=\"/javascript/domTT/fadomatic.js\"></script>";
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<form action="index.php" method="post">
<script language="javascript" type="text/javascript">
// <![CDATA[
columns = ['col1','col2'];
// ]]>
</script>
<script type="text/javascript" language="javascript" src="/javascript/scriptaculous/prototype.js"></script>
<script type="text/javascript" language="javascript" src="javascript/scriptaculous/scriptaculous.js"></script>
<?php
include("fbegin.inc");
echo $jscriptstr;
if(!file_exists("/usr/local/www/themes/{$g['theme']}/no_big_logo"))
echo "<center><img src=\"./themes/".$g['theme']."/images/logobig.jpg\"></center><br>";
?>
<div id="widgetcontainer" style="display:none">
<div id="content1"><h1>Available Widgets</h1><p><?php
$widgetfiles_add = $widgetfiles;
sort($widgetfiles_add);
foreach($widgetfiles_add as $widget) {
if(!stristr($widget, "widget.php"))
continue;
$periodpos = strpos($widget, ".");
$widgetname = substr($widget, 0, $periodpos);
$nicename = $widgetname;
$nicename = str_replace("_", " ", $nicename);
//make the title look nice
$nicename = ucwords($nicename);
$widgettitle = $widgetname . "_title";
$widgettitlelink = $widgetname . "_title_link";
if ($$widgettitle != "")
{
//echo widget title
?>
<span style="cursor: pointer;" onclick='return addWidget("<?php echo $widgetname; ?>")'>
<u><?php echo $$widgettitle; ?></u></span><br>
<?php
}
else {?>
<span style="cursor: pointer;" onclick='return addWidget("<?php echo $widgetname; ?>")'>
<u><?php echo $nicename; ?></u></span><br><?php
}
}
?>
</p>
</div>
</div>
<div id="welcomecontainer" style="display:none">
<div id="welcome-container">
<h1>
<div style="float:left;width:80%;padding: 2px">
Welcome to the Dashboard page!
</div>
<div onclick="domTT_close(this);showAllWidgets();" style="float:right;width:8%; cursor:pointer;padding: 5px;" >
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_close.gif" />
</div>
<div style="clear:both;"></div>
</h1>
<p>
This page allows you to customize the information you want to be displayed!<br/>
To get started click the <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif"> icon to add widgets.<br/>
<br/>
You can move any widget around by clicking and dragging the title.
</p>
</div>
</div>
<input type="hidden" value="" name="sequence" id="sequence">
<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');" />
<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');" />
<input id="submit" name="submit" type="submit" style="display:none" onclick="return updatePref();" class="formbtn" value="Save Settings" />
</p>
<div id="niftyOutter">
<?php
$totalwidgets = count($widgetfiles);
$halftotal = $totalwidgets / 2 - 2;
$widgetcounter = 0;
$directory = "/usr/local/www/widgets/widgets/";
$printed = false;
$firstprint = false;
?>
<div id="col1" style="float:left;width:49%;padding-bottom:40px">
<?php
foreach($widgetlist as $widget) {
if(!stristr($widget, "widget.php"))
continue;
$periodpos = strpos($widget, ".");
$widgetname = substr($widget, 0, $periodpos);
if ($widgetname != ""){
$nicename = $widgetname;
$nicename = str_replace("_", " ", $nicename);
//make the title look nice
$nicename = ucwords($nicename);
}
if ($config['widgets'] && $pconfig['sequence'] != ""){
if ($displayarray[$widgetcounter] == "show"){
$divdisplay = "block";
$display = "block";
$inputdisplay = "show";
$showWidget = "none";
$mindiv = "inline";
}
else if ($displayarray[$widgetcounter] == "hide") {
$divdisplay = "block";
$display = "none";
$inputdisplay = "hide";
$showWidget = "inline";
$mindiv = "none";
}
else if ($displayarray[$widgetcounter] == "close"){
$divdisplay = "none";
$display = "block";
$inputdisplay = "close";
$showWidget = "none";
$mindiv = "inline";
}
else{
$divdisplay = "none";
$display = "block";
$inputdisplay = "none";
$showWidget = "none";
$mindiv = "inline";
}
}
else
{
if ($firstprint == false){
$divdisplay = "block";
$display = "block";
$inputdisplay = "show";
$showWidget = "none";
$mindiv = "inline";
$firstprint = true;
}
else
{
if ($widget == "interfaces.widget.php")
{
$divdisplay = "block";
$display = "block";
$inputdisplay = "show";
$showWidget = "none";
$mindiv = "inline";
}
else if ($widget == "traffic_graphs.widget.php")
{
$divdisplay = "block";
$display = "block";
$inputdisplay = "show";
$showWidget = "none";
$mindiv = "inline";
}
else {
$divdisplay = "none";
$display = "block";
$inputdisplay = "close";
$showWidget = "none";
$mindiv = "inline";
}
}
}
if ($config['widgets'] && $pconfig['sequence'] != ""){
if ($colpos[$widgetcounter] == "col2" && $printed == false)
{
$printed = true;
?>
</div>
<div id="col2" style="float:right;width:49%;padding-bottom:40px">
<?php
}
}
else if ($widgetcounter >= $halftotal && $printed == false){
$printed = true;
?>
</div>
<div id="col2" style="float:right;width:49%;padding-bottom:40px">
<?php
}
?>
<div style="clear:both;"></div>
<div id="<?php echo $widgetname;?>-container" class="widgetdiv" style="display:<?php echo $divdisplay; ?>;">
<input type="hidden" value="<?php echo $inputdisplay;?>" id="<?php echo $widgetname;?>-container-input" name="<?php echo $widgetname;?>-container-input">
<div id="<?php echo $widgetname;?>-topic" class="widgetheader" style="cursor:move">
<div style="float:left;">
<?php
$widgettitle = $widgetname . "_title";
$widgettitlelink = $widgetname . "_title_link";
if ($$widgettitle != "")
{
//only show link if defined
if ($$widgettitlelink != "") {?>
<u><span onClick="location.href='/<?php echo $$widgettitlelink;?>'" style="cursor:pointer">
<?php }
//echo widget title
echo $$widgettitle;
if ($$widgettitlelink != "") { ?>
</span></u>
<?php }
}
else{
if ($$widgettitlelink != "") {?>
<u><span onClick="location.href='/<?php echo $$widgettitlelink;?>'" style="cursor:pointer">
<?php }
echo $nicename;
if ($$widgettitlelink != "") { ?>
</span></u>
<?php }
}
?>
</div>
<div align="right" style="float:right;">
<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>
<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>
<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>
<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>
</div>
<div style="clear:both;"></div>
</div>
<?php if ($divdisplay != "block") { ?>
<div id="<?php echo $widgetname;?>-loader" style="display:<?php echo $display; ?>;">
<br>
<center>
<img src="./themes/<?= $g['theme']; ?>/images/misc/widget_loader.gif" width=25 height=25 alt="Loading selected widget...">
</center>
<br>
</div> <?php } if ($divdisplay != "block") $display = none; ?>
<div id="<?php echo $widgetname;?>" style="display:<?php echo $display; ?>;">
<?php
if ($divdisplay == "block")
{
include($directory . $widget);
}
?>
</div>
<div style="clear:both;"></div>
</div>
<?php
$widgetcounter++;
}//end foreach
?>
</div>
<div style="clear:both;"></div>
</div>
<?php include("fend.inc"); ?>
<script type="text/javascript">
<?php if (!$config['widgets'] && $pconfig['sequence'] != ""){ ?>
window.onload = function(in_event)
{
hideAllWidgets();
domTT_activate('welcome1', null, 'x', 287, 'y', 107, 'content', document.getElementById('welcome-container'), 'type', 'sticky', 'closeLink', '','delay', 1000, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');
}
<?php } ?>
// <![CDATA[
Sortable.create("col1", {tag:'div',dropOnEmpty:true,containment:columns,handle:'widgetheader',constraint:false,only:'widgetdiv',onChange:showSave});
Sortable.create("col2", {tag:'div',dropOnEmpty:true,containment:columns,handle:'widgetheader',constraint:false,only:'widgetdiv',onChange:showSave});
// ]]>
<?php
//build list of javascript include files
$jsincludefiles = array();
$directory = "widgets/javascript/";
$dirhandle = opendir($directory);
$filename = "";
while (false !== ($filename = readdir($dirhandle))) {
$jsincludefiles[] = $filename;
}
foreach($jsincludefiles as $jsincludename) {
if(!stristr($jsincludename, ".js"))
continue;
include($directory . $jsincludename);
}
?>
</script>
</form>
</body>
</html>
|