diff options
Diffstat (limited to 'usr/local/www/widgets')
-rw-r--r-- | usr/local/www/widgets/widgets/installed_packages.widget.php | 132 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/ipsec.widget.php | 11 |
2 files changed, 62 insertions, 81 deletions
diff --git a/usr/local/www/widgets/widgets/installed_packages.widget.php b/usr/local/www/widgets/widgets/installed_packages.widget.php index 193fcfb..16e85b4 100644 --- a/usr/local/www/widgets/widgets/installed_packages.widget.php +++ b/usr/local/www/widgets/widgets/installed_packages.widget.php @@ -41,85 +41,69 @@ require_once("functions.inc"); require_once("/usr/local/www/widgets/include/installed_packages.inc"); require_once("pkg-utils.inc"); + if(is_array($config['installedpackages']['package'])) { - foreach($config['installedpackages']['package'] as $instpkg) { - $tocheck[] = $instpkg['name']; - } - $currentvers = get_pkg_info($tocheck, array('version', 'xmlver')); -} + $instpkgs = array(); + foreach ($config['installedpackages']['package'] as $instpkg) + $instpkgs[ $instpkg['name'] ] = $instpkg; -$updateavailable = false; + ksort($instpkgs); + $currentvers = get_pkg_info(array_keys($instpkgs), array('version', 'xmlver')); +} ?> -<table> - <tr> - <td width="15%" class="listhdrr">Package Name</td> - <td width="15%" class="listhdrr">Category</td> - <td width="30%" class="listhdrr">Package Version</td> - </tr> - <?php - if($config['installedpackages']['package'] != "") { - $instpkgs = array(); - foreach($config['installedpackages']['package'] as $instpkg) - $instpkgs[] = $instpkg['name']; - natcasesort($instpkgs); - $y=1; - foreach ($instpkgs as $index => $pkgname){ +<?php if (empty($config['installedpackages']['package'])): ?> + <div class="panel panel-warning"> + <div class="panel-heading"><h3 class="panel-title">There are no packages installed</h3></div> + <div class="panel-body">You can install packages <a href="pkg_mgr.php">here</a>.</div> + </div> +<?php else: ?> + <table class="table table-striped"> + <thead> + <tr> + <th>Package Name</th> + <th>Category</th> + <th>Package Version</th> + </tr> + </thead> + <tbody> +<?php +foreach ($instpkgs as $pkgname => $pkg): + if (empty($pkgname)) + continue; - $pkg = $config['installedpackages']['package'][$index]; - if($pkg['name'] <> "") { ?> - <tr valign="top"> - <td class="listlr"> - <?= $pkg['name'] ?> - </td> - <td class="listr"> - <?= $pkg['category'] ?> - </td> - <td class="listr"> - <?php - $latest_package = $currentvers[$pkg['name']]['version']; - if($latest_package == false) { - // We can't determine this package's version status. - echo "Current: Unknown.<br />Installed: " . $pkg['version']; - } elseif(strcmp($pkg['version'], $latest_package) > 0) { - /* we're running a newer version of the package */ - echo "Current: {$latest_package}"; - echo "<br />Installed: {$pkg['version']}"; - } elseif(strcmp($pkg['version'], $latest_package) < 0) { - /* our package is out of date */ - $updateavailable = true; - ?> - <div id="updatediv-<?php echo $y; ?>" style="color:red"> - <b>Update Available!</b></div><div style="float:left"> - Current: <?php echo $latest_package; ?><br /> - Installed: <?php echo $pkg['version']; ?></div><div style="float:right"> - <a href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?= $pkg['name']; ?>"><img title="Update this package." src="./themes/<?= $g['theme']; ?>/images/icons/icon_reinstall_pkg.gif" alt="reinstall" /></a> - </div> - <?php - $y++; - } else { - echo $pkg['version']; - } ?> - </td> - </tr> - <?php } + $latest_package = $currentvers[$pkg['name']]['version']; + if ($latest_package) { + // we're running a newer version of the package + if(strcmp($pkg['version'], $latest_package) > 0) { + $status = 'Newer then available ('. $latest_package .')'; + $statusicon = 'exclamation'; } - } else { - echo "<tr><td colspan=\"5\" align=\"center\">There are no packages currently installed.</td></tr>"; - } - ?> -</table> - -<?php if ($updateavailable): ?> -<script type="text/javascript"> -//<![CDATA[ - window.onload = function(in_event) - { - for (y=1; y<=<?php echo $y;?>; y++){ - textID = "#updatediv-" + y; - jQuery(textID).effect('pulsate'); + // we're running an older version of the package + if(strcmp($pkg['version'], $latest_package) < 0) { + $status = 'Upgrade available to '.$latest_package; + $statusicon = 'plus'; + } + // we're running the current version + if(!strcmp($pkg['version'], $latest_package)) { + $status = 'Up-to-date'; + $statusicon = 'ok'; } + } else { + // unknown available package version + $status = 'Unknown'; + $statusicon = 'question'; } -//]]> -</script> -<?php endif; ?> +?> + <tr> + <td><?=$pkg['name']?></td> + <td><?=$pkg['category']?></td> + <td> + <i title="<?=$status?>" class="icon icon-<?=$statusicon?>-sign"></i> + <?=$pkg['version']?> + </td> + </tr> +<?php endforeach; ?> + </tbody> + </table> +<?php endif; ?>
\ No newline at end of file diff --git a/usr/local/www/widgets/widgets/ipsec.widget.php b/usr/local/www/widgets/widgets/ipsec.widget.php index d993323..1f4d4c7 100644 --- a/usr/local/www/widgets/widgets/ipsec.widget.php +++ b/usr/local/www/widgets/widgets/ipsec.widget.php @@ -194,11 +194,8 @@ if (isset($config['ipsec']['phase2'])): ?> </table> <?php endif;?> <?php else: ?> - -<div class="alert alert-info" role="alert"> - <p> - There are no configured IPsec Tunnels.<br/><br/> - <a href="vpn_ipsec.php" class="alert-link">You can configure your IPsec here</a>. - </p> -</div> + <div class="panel panel-warning"> + <div class="panel-heading"><h3 class="panel-title">There are no configured IPsec Tunnels</h3></div> + <div class="panel-body">You can configure your IPsec <a href="vpn_ipsec.php">here</a>.</div> + </div> <?php endif; ?>
\ No newline at end of file |