diff options
Diffstat (limited to 'src/usr/local/www/index.php')
-rw-r--r-- | src/usr/local/www/index.php | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/src/usr/local/www/index.php b/src/usr/local/www/index.php index 350ddb7..496d128 100644 --- a/src/usr/local/www/index.php +++ b/src/usr/local/www/index.php @@ -138,8 +138,7 @@ foreach ($phpincludefiles as $includename) { } ##build list of widgets -foreach (glob("/usr/local/www/widgets/widgets/*.widget.php") as $file) -{ +foreach (glob("/usr/local/www/widgets/widgets/*.widget.php") as $file) { $name = basename($file, '.widget.php'); // Get the widget title that should be in a var defined in the widget's inc file. $widgettitle = ${$name . '_title'}; @@ -253,8 +252,9 @@ if ($fd) { } } fclose($fd); - if (!isset($hwcrypto) && get_single_sysctl("dev.aesni.0.%desc")) + if (!isset($hwcrypto) && get_single_sysctl("dev.aesni.0.%desc")) { $hwcrypto = get_single_sysctl("dev.aesni.0.%desc"); + } } ##build widget saved list information @@ -262,14 +262,14 @@ if ($config['widgets'] && $config['widgets']['sequence'] != "") { $pconfig['sequence'] = $config['widgets']['sequence']; $widgetsfromconfig = array(); - foreach (explode(',', $pconfig['sequence']) as $line) - { + foreach (explode(',', $pconfig['sequence']) as $line) { list($file, $col, $display) = explode(':', $line); // be backwards compatible $offset = strpos($file, '-container'); - if (false !== $offset) + if (false !== $offset) { $file = substr($file, 0, $offset); + } // Get the widget title that should be in a var defined in the widget's inc file. $widgettitle = ${$file . '_title'}; @@ -364,17 +364,18 @@ foreach ($widgets as $widgetname => $widgetconfig): <?php $widgetColumns = array(); -foreach ($widgets as $widgetname => $widgetconfig) -{ - if ($widgetconfig['display'] == 'none') +foreach ($widgets as $widgetname => $widgetconfig) { + if ($widgetconfig['display'] == 'none') { continue; + } if (!file_exists('/usr/local/www/widgets/widgets/'. $widgetname.'.widget.php')) { continue; } - if (!isset($widgetColumns[ $widgetconfig['col'] ])) + if (!isset($widgetColumns[ $widgetconfig['col'] ])) { $widgetColumns[ $widgetconfig['col'] ] = array(); + } $widgetColumns[ $widgetconfig['col'] ][ $widgetname ] = $widgetconfig; } @@ -415,7 +416,7 @@ foreach ($widgets as $widgetname => $widgetconfig) </a> </span> </div> - <div id="widget-<?=$widgetname?>_panel-body" class="panel-body collapse<?=($widgetconfig['display']=='close' ? '' : ' in')?>"> + <div id="widget-<?=$widgetname?>_panel-body" class="panel-body collapse<?=($widgetconfig['display'] == 'close' ? '' : ' in')?>"> <?php include('/usr/local/www/widgets/widgets/'. $widgetname.'.widget.php'); ?> </div> </div> @@ -425,7 +426,7 @@ foreach ($widgets as $widgetname => $widgetconfig) </div> <?php endforeach; ?> <?php - for($n = 1; $n <= ($numColumns - $columnCounter); $n++) { + for ($n = 1; $n <= ($numColumns - $columnCounter); $n++) { echo '<div class="col-md-' . $columnWidth . '" id="widgets-col' . ($n + $columnCounter) . '"></div>'; } ?> @@ -433,20 +434,20 @@ foreach ($widgets as $widgetname => $widgetconfig) <script type="text/javascript"> //<![CDATA[ -function updateWidgets(newWidget) -{ +function updateWidgets(newWidget) { var sequence = ''; - $('.container .col-md-<?=$columnWidth?>').each(function(idx, col){ - $('.panel', col).each(function(idx, widget){ + $('.container .col-md-<?=$columnWidth?>').each(function(idx, col) { + $('.panel', col).each(function(idx, widget) { var isOpen = $('.panel-body', widget).hasClass('in'); sequence += widget.id.split('-')[1] +':'+ col.id.split('-')[1] +':'+ (isOpen ? 'open' : 'close') +','; }); }); - if (typeof newWidget !== 'undefined') + if (typeof newWidget !== 'undefined') { sequence += newWidget + ':' + 'col2:open'; + } $('#widgetSequence').removeClass('hidden'); $('input[name=sequence]', $('#widgetSequence_Form')).val(sequence); @@ -455,8 +456,8 @@ function updateWidgets(newWidget) events.push(function() { // Make panels destroyable - $('.container .panel-heading a[data-toggle="close"]').each(function (idx, el){ - $(el).on('click', function(e){ + $('.container .panel-heading a[data-toggle="close"]').each(function (idx, el) { + $(el).on('click', function(e) { $(el).parents('.panel').remove(); updateWidgets(); }) @@ -487,7 +488,8 @@ events.push(function() { </script> <?php //build list of javascript include files -foreach (glob('widgets/javascript/*.js') as $file) +foreach (glob('widgets/javascript/*.js') as $file) { echo '<script src="'.$file.'"></script>'; +} include("foot.inc"); |