index.php 19.8 KB
Newer Older
Ad Schellevis's avatar
Ad Schellevis committed
1
<?php
2

Ad Schellevis's avatar
Ad Schellevis committed
3
/*
4
	Copyright (C) 2014 Deciso B.V.
Ad Schellevis's avatar
Ad Schellevis committed
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
	Copyright (C) 2004-2012 Scott Ullrich
	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.
*/

// Turn on buffering to speed up rendering
32
ini_set('output_buffering', 'true');
Ad Schellevis's avatar
Ad Schellevis committed
33 34 35 36 37 38 39 40

// Start buffering with a cache size of 100000
ob_start(null, "1000");


## Load Essential Includes
require_once('guiconfig.inc');

41 42 43 44
if (isset($_REQUEST['closenotice'])) {
    close_notice($_REQUEST['closenotice']);
    echo get_menu_messages();
    exit;
Ad Schellevis's avatar
Ad Schellevis committed
45 46 47 48 49 50 51 52 53 54 55
}

##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))) {
56 57 58 59 60 61 62 63 64 65
    $periodpos = strpos($filename, ".");
    /* Ignore files not ending in .php */
    if (substr($filename, -4, 4) != ".php") {
        continue;
    }
    $widgetname = substr($filename, 0, $periodpos);
    $widgetnames[] = $widgetname;
    if ($widgetname != "system_information") {
        $widgetfiles[] = $filename;
    }
Ad Schellevis's avatar
Ad Schellevis committed
66 67 68 69 70 71 72 73 74 75
}

##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'])) {
76
    $config['widgets'] = array();
Ad Schellevis's avatar
Ad Schellevis committed
77
}
78

Ad Schellevis's avatar
Ad Schellevis committed
79
if ($_POST && $_POST['sequence']) {
80
    $config['widgets']['sequence'] = $_POST['sequence'];
81

82 83 84 85 86
    foreach ($widgetnames as $widget) {
        if ($_POST[$widget . '-config']) {
            $config['widgets'][$widget . '-config'] = $_POST[$widget . '-config'];
        }
    }
87

88 89 90
    write_config(gettext("Widget configuration has been changed."));
    header("Location: index.php");
    exit;
Ad Schellevis's avatar
Ad Schellevis committed
91
}
Ad Schellevis's avatar
Ad Schellevis committed
92

Ad Schellevis's avatar
Ad Schellevis committed
93 94
## Check to see if we have a swap space,
## if true, display, if false, hide it ...
95
if (file_exists('/usr/sbin/swapinfo')) {
96 97 98 99
    $swapinfo = `/usr/sbin/swapinfo`;
    if (stristr($swapinfo, '%')) {
        $showswap = true;
    }
Ad Schellevis's avatar
Ad Schellevis committed
100 101
}

Ad Schellevis's avatar
Ad Schellevis committed
102 103
##build widget saved list information
if ($config['widgets'] && $config['widgets']['sequence'] != "") {
104 105 106 107 108 109 110 111 112 113 114 115
    $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);
116 117 118
        if (!in_array($widgetname, $widgetnames)) {
            continue;
        }
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
        $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) {
135
        if (isset($config['widgets'][$widget . '-config'])) {
136 137 138 139 140 141 142 143
            $pconfig[$widget . '-config'] = $config['widgets'][$widget . '-config'];
        }
    }

    $widgetlist = $savedwidgetfiles;
} else {
    // no saved widget sequence found, build default list.
    $widgetlist = $widgetfiles;
Ad Schellevis's avatar
Ad Schellevis committed
144 145
}

Ad Schellevis's avatar
Ad Schellevis committed
146 147


Ad Schellevis's avatar
Ad Schellevis committed
148 149 150 151 152 153
##build list of php include files
$phpincludefiles = array();
$directory = "/usr/local/www/widgets/include/";
$dirhandle  = opendir($directory);
$filename = "";
while (false !== ($filename = readdir($dirhandle))) {
154
    $phpincludefiles[] = $filename;
Ad Schellevis's avatar
Ad Schellevis committed
155
}
156 157 158 159 160
foreach ($phpincludefiles as $includename) {
    if (!stristr($includename, ".inc")) {
        continue;
    }
    include($directory . $includename);
Ad Schellevis's avatar
Ad Schellevis committed
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
}

##begin AJAX
$jscriptstr = <<<EOD
<script type="text/javascript">
//<![CDATA[

function widgetAjax(widget) {
	uri = "widgets/widgets/" + widget + ".widget.php";
	var opt = {
		// Use GET
		type: 'get',
		async: true,
		// Handle 404
		statusCode: {
		404: function(t) {
			alert('Error 404: location "' + t.statusText + '" was not found.');
		}
		},
		// Handle other errors
		error: function(t) {
			alert('Error ' + t.status + ' -- ' + t.statusText);
		},
		success: function(data) {
			widget2 = '#' + widget + "-loader";
			jQuery(widget2).fadeOut(1000,function(){
				jQuery('#' + widget).show();
			});
			jQuery('#' + widget).html(data);
		}
	}
	jQuery.ajax(uri, opt);
}


function addWidget(selectedDiv){
197
	container	=	$('#'+selectedDiv);
Ad Schellevis's avatar
Ad Schellevis committed
198
	state		=	$('#'+selectedDiv+'-config');
199

Ad Schellevis's avatar
Ad Schellevis committed
200 201 202
	container.show();
	showSave();
	state.val('show');
Ad Schellevis's avatar
Ad Schellevis committed
203 204 205 206
}

function configureWidget(selectedDiv){
	selectIntLink = '#' + selectedDiv + "-settings";
Ad Schellevis's avatar
Ad Schellevis committed
207 208
	if ($(selectIntLink).css('display') == "none")
		$(selectIntLink).show();
Ad Schellevis's avatar
Ad Schellevis committed
209
	else
Ad Schellevis's avatar
Ad Schellevis committed
210
		$(selectIntLink).hide();
Ad Schellevis's avatar
Ad Schellevis committed
211 212 213
}

function showWidget(selectedDiv,swapButtons){
214
	container	=	$('#'+selectedDiv+'-container');
Ad Schellevis's avatar
Ad Schellevis committed
215 216 217
	min_btn		=	$('#'+selectedDiv+'-min');
	max_btn		=	$('#'+selectedDiv+'-max');
	state		=	$('#'+selectedDiv+'-config');
218

Ad Schellevis's avatar
Ad Schellevis committed
219 220 221
	container.show();
	min_btn.show();
	max_btn.hide();
222

Ad Schellevis's avatar
Ad Schellevis committed
223
	showSave();
224

Ad Schellevis's avatar
Ad Schellevis committed
225
	state.val('show');
Ad Schellevis's avatar
Ad Schellevis committed
226 227 228
}

function minimizeWidget(selectedDiv,swapButtons){
229
	container	=	$('#'+selectedDiv+'-container');
Ad Schellevis's avatar
Ad Schellevis committed
230 231 232
	min_btn		=	$('#'+selectedDiv+'-min');
	max_btn		=	$('#'+selectedDiv+'-max');
	state		=	$('#'+selectedDiv+'-config');
233

Ad Schellevis's avatar
Ad Schellevis committed
234 235 236
	container.hide();
	min_btn.hide();
	max_btn.show();
237

Ad Schellevis's avatar
Ad Schellevis committed
238
	showSave();
239

Ad Schellevis's avatar
Ad Schellevis committed
240 241
	state.val('hide');

Ad Schellevis's avatar
Ad Schellevis committed
242 243 244 245

}

function closeWidget(selectedDiv){
246
	widget		=	$('#'+selectedDiv);
Ad Schellevis's avatar
Ad Schellevis committed
247
	state		=	$('#'+selectedDiv+'-config');
248

Ad Schellevis's avatar
Ad Schellevis committed
249
	showSave();
Ad Schellevis's avatar
Ad Schellevis committed
250 251
	widget.hide();
	state.val('close');
Ad Schellevis's avatar
Ad Schellevis committed
252 253 254
}

function showSave(){
Ad Schellevis's avatar
Ad Schellevis committed
255
	$('#updatepref').show();
Ad Schellevis's avatar
Ad Schellevis committed
256 257
}

258
function updatePref(){
Ad Schellevis's avatar
Ad Schellevis committed
259 260
	var widgets = $('.widgetdiv');
	var widgetSequence = '';
Ad Schellevis's avatar
Ad Schellevis committed
261
	var firstprint = false;
262

Ad Schellevis's avatar
Ad Schellevis committed
263 264
	widgets.each(function(key) {
		obj = $(this);
265 266

		if (firstprint)
Ad Schellevis's avatar
Ad Schellevis committed
267
			widgetSequence += ',';
268 269


Ad Schellevis's avatar
Ad Schellevis committed
270
		state = $('input[name='+obj.attr('id')+'-config]').val();
271

Ad Schellevis's avatar
Ad Schellevis committed
272
		widgetSequence += obj.attr('id')+'-container:col1:'+state;
273

Ad Schellevis's avatar
Ad Schellevis committed
274
		firstprint = true;
Ad Schellevis's avatar
Ad Schellevis committed
275
	});
276

Ad Schellevis's avatar
Ad Schellevis committed
277
	$("#sequence").val(widgetSequence);
278

Ad Schellevis's avatar
Ad Schellevis committed
279
	$("#iform").submit();
280

Ad Schellevis's avatar
Ad Schellevis committed
281
	return false;
282
}
Ad Schellevis's avatar
Ad Schellevis committed
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
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";
		}
	}
}
Ad Schellevis's avatar
Ad Schellevis committed
321 322 323 324 325 326 327 328
//]]>
</script>
EOD;

include("head.inc");

?>

Ad Schellevis's avatar
Ad Schellevis committed
329 330 331
<body>


Ad Schellevis's avatar
Ad Schellevis committed
332

333
<!--script type="text/javascript">
Ad Schellevis's avatar
Ad Schellevis committed
334 335 336
//<![CDATA[
columns = ['col1','col2','col3','col4', 'col5','col6','col7','col8','col9','col10'];
//]]>
337
</script-->
Ad Schellevis's avatar
Ad Schellevis committed
338 339 340

<?php
include("fbegin.inc");
Ad Schellevis's avatar
Ad Schellevis committed
341 342


Ad Schellevis's avatar
Ad Schellevis committed
343 344
echo $jscriptstr;

Ad Schellevis's avatar
Ad Schellevis committed
345 346
?>

347
<?php
348 349 350 351
    ## If it is the first time webConfigurator has been
    ## accessed since initial install show this stuff.
if (isset($config['trigger_initial_wizard'])) :
?>
Ad Schellevis's avatar
Ad Schellevis committed
352 353 354 355 356 357 358 359 360
	<header class="page-content-head">
		<div class="container-fluid">
			<h1><?=gettext("Starting initial configuration"); ?>!</h1>
		</div>
	</header>

	<section class="page-content-main">
		<div class="container-fluid col-xs-12 col-sm-10 col-md-9">
			<div class="row">
361 362
			<section class="col-xs-12">
				<div class="content-box" style="padding: 20px;">
Ad Schellevis's avatar
Ad Schellevis committed
363 364
							<div class="table-responsive">
								<?php
365
                                echo "<img src=\"/ui/themes/{$themename}/build/images/default-logo.png\" border=\"0\" alt=\"logo\" /><p>\n";
366
                                ?>
Ad Schellevis's avatar
Ad Schellevis committed
367 368
								<br />
								<div class="content-box-main">
369 370 371 372 373 374
                                <?php
                                    echo sprintf(gettext("Welcome to %s!\n"), $g['product_name']) . "<p>";
                                    echo gettext("One moment while we start the initial setup wizard.") . "<p>\n";
                                    echo gettext("Embedded platform users: Please be patient, the wizard takes a little longer to run than the normal GUI.") . "<p>\n";
                                    echo sprintf(gettext("To bypass the wizard, click on the %s logo on the initial page."), $g['product_name']) . "\n";
                                ?>
Ad Schellevis's avatar
Ad Schellevis committed
375 376 377 378 379 380 381
								</div>
							<div>
					</div>
				</section>
			</div>
		</div>
	</section>
382
	<meta http-equiv="refresh" content="3;url=wizard.php">
Ad Schellevis's avatar
Ad Schellevis committed
383
	<?php exit; ?>
384 385
<?php
endif; ?>
Ad Schellevis's avatar
Ad Schellevis committed
386

387 388
<section class="page-content-main">
	<div class="container-fluid">
389

390
        <div class="row">
Jos Schellevis's avatar
Jos Schellevis committed
391

392
				<?php
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
                    $crash_report = get_crash_report();
                if ($crash_report != '') {
                    print_info_box($crash_report);
                }

                    $totalwidgets = count($widgetfiles);
                    $halftotal = $totalwidgets / 2 - 2;
                    $widgetcounter = 0;
                    $directory = "/usr/local/www/widgets/widgets/";
                    $printed = false;
                    $firstprint = false;

                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);
                    }

419 420 421 422 423 424 425
                    if (isset($config['widgets']) && isset($pconfig['sequence'])) {
                        if (isset($displayarray[$widgetcounter])) {
                            $disparr = $displayarray[$widgetcounter];
                        } else {
                            $disparr = null;
                        }
                        switch($disparr){
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
                            case "show":
                                $divdisplay = "block";
                                $display = "block";
                                $inputdisplay = "show";
                                $showWidget = "none";
                                $mindiv = "inline";
                                break;
                            case "hide":
                                $divdisplay = "block";
                                $display = "none";
                                $inputdisplay = "hide";
                                $showWidget = "inline";
                                $mindiv = "none";
                                break;
                            case "close":
                                $divdisplay = "none";
                                $display = "block";
                                $inputdisplay = "close";
                                $showWidget = "none";
                                $mindiv = "inline";
                                break;
                            default:
                                $divdisplay = "none";
                                $display = "block";
                                $inputdisplay = "none";
                                $showWidget = "none";
                                $mindiv = "inline";
                                break;
                        }
                    } else {
                        if ($firstprint == false) {
                            $divdisplay = "block";
                            $display = "block";
                            $inputdisplay = "show";
                            $showWidget = "none";
                            $mindiv = "inline";
                            $firstprint = true;
                        } else {
                            switch ($widget) {
465
                                case "interface_list.widget.php":
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
                                case "traffic_graphs.widget.php":
                                    $divdisplay = "block";
                                    $display = "block";
                                    $inputdisplay = "show";
                                    $showWidget = "none";
                                    $mindiv = "inline";
                                    break;
                                default:
                                    $divdisplay = "none";
                                    $display = "block";
                                    $inputdisplay = "close";
                                    $showWidget = "none";
                                    $mindiv = "inline";
                                    break;
                            }
                        }
                    }



                ?>
                    <section class="col-xs-12 col-md-6 widgetdiv" id="<?php echo $widgetname;?>"  style="display:<?php echo $divdisplay; ?>;">
                    <div class="content-box">
                        <form action="<?=$_SERVER['REQUEST_URI'];?>" method="post" id="iform">
                        <input type="hidden" value="" name="sequence" id="sequence" />
                            <header class="content-box-head container-fluid">

                                <ul class="list-inline __nomb">
                                    <li><h3>
                                    <?php
                                        $widgettitle = $widgetname . "_title";
                                        $widgettitlelink = $widgetname . "_title_link";
498
                                    if (isset($$widgettitle)) {
499 500 501 502 503 504 505 506
                                        //only show link if defined
                                        if ($$widgettitlelink != "") {
?>
                                            <u><span onclick="location.href='/<?php echo $$widgettitlelink;?>'" style="cursor:pointer">
                                            <?php
                                        }
                                            //echo widget title
                                            echo $$widgettitle;
507
                                        if (isset($$widgettitlelink)) {
508 509 510 511 512
?>
                                            </span></u>
                                            <?php
                                        }
                                    } else {
513
                                        if (isset($$widgettitlelink)) {
514 515 516 517 518
?>
                                            <u><span onclick="location.href='/<?php echo $$widgettitlelink;?>'" style="cursor:pointer">
                                            <?php
                                        }
                                        echo $nicename;
519
                                        if (isset($$widgettitlelink)) {
520 521 522 523 524 525
?>
                                        </span></u>
                                        <?php
                                        }
                                    }
                                        ?>
526
								        </h3></li>
Jos Schellevis's avatar
Jos Schellevis committed
527

528
								        <li class="pull-right">
529 530
                                        <div class="btn-group">
                                            <button type="button" class="btn btn-default btn-xs" title="minimize" id="<?php echo $widgetname;?>-min" onclick='return minimizeWidget("<?php echo $widgetname;?>",true)' style="display:<?php echo $mindiv; ?>;"><span class="glyphicon glyphicon-minus"></span></button>
531

532
                                              <button type="button" class="btn btn-default btn-xs" title="maximize" id="<?php echo $widgetname;?>-max" onclick='return showWidget("<?php echo $widgetname;?>",true)' style="display:<?php echo $mindiv == 'none' ? 'inline' : 'none'; ?>;"><span class="glyphicon glyphicon-plus"></span></button>
533

534
                                            <button type="button" class="btn btn-default btn-xs" title="remove widget" onclick='return closeWidget("<?php echo $widgetname;?>",true)'><span class="glyphicon glyphicon-remove"></span></button>
535

536
                                            <button type="button" class="btn btn-default btn-xs" id="<?php echo $widgetname;?>-configure" onclick='return configureWidget("<?php echo $widgetname;?>")' style="display:none; cursor:pointer" ><span class="glyphicon glyphicon-pencil"></span></button>
537

538
                                        </div>
539 540
								        </li>
								    </ul>
541
								</header>
542
					        </form>
543 544
							<div class="content-box-main collapse in" id="<?php echo $widgetname;
?>-container" style="display:<?=$mindiv;?>">
545 546 547
								<input type="hidden" value="<?php echo $inputdisplay;?>" id="<?php echo $widgetname;?>-config" name="<?php echo $widgetname;?>-config" />


548 549
									<?php if ($divdisplay != "block") {
?>
550 551 552 553
									<div id="<?php echo $widgetname;?>-loader" style="display:<?php echo $display; ?>;" align="center">
										<br />
											<span class="glyphicon glyphicon-refresh"></span> <?=gettext("Loading selected widget"); ?>
										<br />
554 555
									</div> <?php $display = "none";
} ?>
556

557
									<?php
558 559 560 561 562
                                    if (file_exists($directory . $widget)) {
                                        if ($divdisplay == 'block') {
                                            include($directory . $widget);
                                        }
                                    } ?>
563
					<?php $widgetcounter++; ?>
564 565
							</div>
				            </div>
566
				        </section>
Jos Schellevis's avatar
Jos Schellevis committed
567

568 569
				<?php
                } //end foreach ?>
570

571 572 573
	    </div>
    </div>
</section>
Ad Schellevis's avatar
Ad Schellevis committed
574

Ad Schellevis's avatar
Ad Schellevis committed
575

Ad Schellevis's avatar
Ad Schellevis committed
576

Ad Schellevis's avatar
Ad Schellevis committed
577
<?php
578 579 580 581 582 583 584 585 586 587 588 589 590 591
    //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 (!preg_match('/\.js$/', $jsincludename)) {
        continue;
    }
    echo "<script src='{$directory}{$jsincludename}' type='text/javascript'></script>\n";
}
Ad Schellevis's avatar
Ad Schellevis committed
592 593
?>

Ad Schellevis's avatar
Ad Schellevis committed
594

595
<?php include("foot.inc");