diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2015-11-13 10:40:55 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2015-11-13 10:41:24 -0500 |
commit | e6227dde2fe79f949f1fc7af6dc22ce670c3d19e (patch) | |
tree | 69aaadbf330318ca70c4129d1de76b33d114e5ad | |
parent | aaf635033f6867ec6aa2eba3d75ccecc778a3a35 (diff) | |
download | pfsense-e6227dde2fe79f949f1fc7af6dc22ce670c3d19e.zip pfsense-e6227dde2fe79f949f1fc7af6dc22ce670c3d19e.tar.gz |
Completed #5438
-rw-r--r-- | src/usr/local/www/pkg_mgr_installed.php | 89 | ||||
-rw-r--r-- | src/usr/local/www/widgets/widgets/installed_packages.widget.php | 67 |
2 files changed, 94 insertions, 62 deletions
diff --git a/src/usr/local/www/pkg_mgr_installed.php b/src/usr/local/www/pkg_mgr_installed.php index d63ac60..3489772 100644 --- a/src/usr/local/www/pkg_mgr_installed.php +++ b/src/usr/local/www/pkg_mgr_installed.php @@ -102,16 +102,16 @@ if(empty($installed_packages)):?> <div class="panel panel-body"> <div class="table-responsive"> <table class="table table-striped table-hover table-condensed"> - <thead> - <tr> - <th><!-- Status icon --></th> - <th><?=gettext("Name")?></th> - <th><?=gettext("Category")?></th> - <th><?=gettext("Version")?></th> - <th><?=gettext("Description")?></th> - <th><?=gettext("Actions")?></th> - </tr> - </thead> + <thead> + <tr> + <th><!-- Status icon --></th> + <th><?=gettext("Name")?></th> + <th><?=gettext("Category")?></th> + <th><?=gettext("Version")?></th> + <th><?=gettext("Description")?></th> + <th><?=gettext("Actions")?></th> + </tr> + </thead> <tbody> <?php foreach ($installed_packages as $pkg): @@ -122,28 +122,37 @@ if(empty($installed_packages)):?> #check package version $txtcolor = "black"; $upgradeavail = false; + $missing = false; $vergetstr = ""; + + print($name . '<br />'); + if (isset($pkg['installed_version']) && isset($pkg['version'])) { $version_compare = pkg_version_compare($pkg['installed_version'], $pkg['version']); - if ($version_compare == '>') { - // we're running a newer version of the package - $status = 'Newer than available ('. $pkg['version'] .')'; - $statusicon = 'exclamation'; - } else if ($version_compare == '<') { - // we're running an older version of the package - $status = 'Upgrade available to '.$pkg['version']; - $statusicon = 'refresh'; - $txtcolor = "blue"; - $upgradeavail = true; - $vergetstr = '&from=' . $pkg['installed_version'] . '&to=' . $pkg['version']; - } else if ($version_compare == '=') { - // we're running the current version - $status = 'Up-to-date'; - $statusicon = 'ok'; + + if ( is_package_installed($name) && !is_pkg_installed($g['pkg_prefix'] . get_package_internal_name($name))) { + // package is configured, but does not exist in the system + $txtcolor = "red"; + $missing = true; + $status = 'Package is configured, but not installed!'; } else { - $status = 'Error comparing version'; - $statusicon = 'exclamation'; + + if ($version_compare == '>') { + // we're running a newer version of the package + $status = 'Newer than available ('. $pkg['version'] .')'; + } else if ($version_compare == '<') { + // we're running an older version of the package + $status = 'Upgrade available to '.$pkg['version']; + $txtcolor = "blue"; + $upgradeavail = true; + $vergetstr = '&from=' . $pkg['installed_version'] . '&to=' . $pkg['version']; + } else if ($version_compare == '=') { + // we're running the current version + $status = 'Up-to-date'; + } else { + $status = 'Error comparing version'; + } } } else { // unknown available package version @@ -154,9 +163,11 @@ if(empty($installed_packages)):?> <tr> <td> <?php if($upgradeavail) { ?> - <a title="<?=$status?>" href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?=$pkg['name']?><?=$vergetstr?>" class="icon-large icon-refresh"></a> + <a title="<?=$status?>" href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?=$pkg['name']?><?=$vergetstr?>" class="fa fa-refresh"></a> +<?php } else if ($missing) { ?> + <font color="red"><i title="<?=$status?>" class="fa fa-exclamation"></i></font> <?php } else { ?> - <i title="<?=$status?>" class="icon-large icon-ok"></i> + <i title="<?=$status?>" class="fa fa-check"></i> <?php } ?> </td> <td> @@ -178,15 +189,15 @@ if(empty($installed_packages)):?> <?=$pkg['desc']?> </td> <td> - <a title="<?=gettext("Remove")?>" href="pkg_mgr_install.php?mode=delete&pkg=<?=$pkg['name']?>" class="icon-large icon-minus-sign"></a> + <a title="<?=gettext("Remove")?>" href="pkg_mgr_install.php?mode=delete&pkg=<?=$pkg['name']?>" class="fa fa-minus-circle"></a> <?php if($upgradeavail) { ?> - <a title="<?=gettext("Update")?>" href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?=$pkg['name']?><?=$vergetstr?>" class="icon-large icon-refresh"></a> + <a title="<?=gettext("Update")?>" href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?=$pkg['name']?><?=$vergetstr?>" class="fa fa-refresh"></a> <?php } else { ?> - <a title="<?=gettext("Reinstall")?>" href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?=$pkg['name']?>" class="icon-large icon-retweet"></a> + <a title="<?=gettext("Reinstall")?>" href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?=$pkg['name']?>" class="fa fa-retweet"></a> <?php } ?> <?php if(!isset($g['disablepackageinfo']) && $pkg['www'] != 'UNKNOWN'):?> - <a target="_blank" title="<?=gettext("View more information")?>" href="<?=htmlspecialchars($pkg['www'])?>" class="icon-large icon-info-sign"></a> + <a target="_blank" title="<?=gettext("View more information")?>" href="<?=htmlspecialchars($pkg['www'])?>" class="fa fa-info"></a> <?php endif; ?> </td> </tr> @@ -198,13 +209,15 @@ if(empty($installed_packages)):?> <br /> <div style="text-align: center;"> <span> - <i class="icon-large icon-refresh"></i> = Update, - <i class="icon-large icon-ok"></i> = Current, - <i class="icon-large icon-minus-sign"></i> = Remove, - <i class="icon-large icon-info-sign"></i> = Information, - <i class="icon-large icon-retweet"></i> = Reinstall. + <i class="fa fa-refresh"></i> = Update, + <i class="fa fa-check"></i> = Current, + <i class="fa fa-minus-circle"></i> = Remove, + <i class="fa fa-info"></i> = Information, + <i class="fa fa-retweet"></i> = Reinstall. <br /> <font color="blue"><?=gettext("Blue package name")?></font> = <?=gettext("Newer version available")?> + <br /> + <font color="red"><?=gettext("Red")?></font> = <?=gettext("Package is configured but not (fully) installed")?> </span> </div> diff --git a/src/usr/local/www/widgets/widgets/installed_packages.widget.php b/src/usr/local/www/widgets/widgets/installed_packages.widget.php index 05ef910..48164c5 100644 --- a/src/usr/local/www/widgets/widgets/installed_packages.widget.php +++ b/src/usr/local/www/widgets/widgets/installed_packages.widget.php @@ -72,19 +72,21 @@ $installed_packages = array_filter($package_list, function($v) { }); if (empty($installed_packages)): ?> - <div class="alert alert-warning" role="alert"> - <strong>No packages installed.</strong> - You can install packages <a href="pkg_mgr.php" class="alert-link">here</a>. - </div> +<div class="alert alert-warning" role="alert"> + <strong>No packages installed.</strong> + You can install packages <a href="pkg_mgr.php" class="alert-link">here</a>. +</div> <?php else: ?> - <table class="table table-striped table-hover"> - <thead> - <tr> - <th>Name</th> - <th>Category</th> - <th>Version</th> - </tr> - </thead> +<div class="table-responsive"> + <table class="table table-striped table-hover table-condensed"> + <thead> + <tr> + <th>Name</th> + <th>Category</th> + <th>Version</th> + <th>Actions</th> + </tr> + </thead> <tbody> <?php @@ -108,15 +110,15 @@ foreach ($installed_packages as $pkg): } else if ($version_compare == '<') { // we're running an older version of the package $status = 'Upgrade available to '.$pkg['version']; - $statusicon = 'plus'; + $statusicon = 'plus-circle'; $txtcolor = "blue"; $upgradeavail = true; $vergetstr = '&from=' . $pkg['installed_version'] . '&to=' . $pkg['version']; } else if ($version_compare == '=') { // we're running the current version - $status = 'Up-to-date'; - $statusicon = 'ok'; + $status = 'ok'; + $statusicon = 'check'; } else { $status = 'Error comparing version'; $statusicon = 'exclamation'; @@ -127,15 +129,32 @@ foreach ($installed_packages as $pkg): $statusicon = 'question'; } ?> - <tr> - <td><?=$pkg['shortname']?></td> - <td><?=implode(' ', $pkg['categories'])?></td> - <td> - <i title="<?=$status?>" class="icon icon-<?=$statusicon?>-sign"></i> - <?=$pkg['installed_version']?> - </td> - </tr> + <tr> + <td><font color="<?=$txtcolor?>"><?=$pkg['shortname']?></font></td> + <td><?=implode(' ', $pkg['categories'])?></td> + <td> + <i title="<?=$status?>" class="fa fa-<?=$statusicon?>"></i> + <?=$pkg['installed_version']?> + </td> + <td> + <a title="<?=gettext("Remove")?>" href="pkg_mgr_install.php?mode=delete&pkg=<?=$pkg['name']?>" class="fa fa-minus-circle"></a> +<?php if($upgradeavail) { ?> + <a title="<?=gettext("Update")?>" href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?=$pkg['name']?><?=$vergetstr?>" class="fa fa-refresh"></a> +<?php } else { ?> + <a title="<?=gettext("Reinstall")?>" href="pkg_mgr_install.php?mode=reinstallpkg&pkg=<?=$pkg['name']?>" class="fa fa-retweet"></a> +<?php } ?> + +<?php if(!isset($g['disablepackageinfo']) && $pkg['www'] != 'UNKNOWN'):?> + <a target="_blank" title="<?=gettext("View more information")?>" href="<?=htmlspecialchars($pkg['www'])?>" class="fa fa-info"></a> +<?php endif; ?> + </td> + </tr> <?php endforeach; ?> - </tbody> + </tbody> </table> +</div> <?php endif; ?> + +<div style="text-align: center;"> + <?=gettext("Packages may be added/managed here: ")?> <a href="pkg_mgr_installed.php">System ->Packages</a> +</div> |