From 4832ed9820b61193edde5ad3c8a047a820ebef8f Mon Sep 17 00:00:00 2001 From: BBcan177 Date: Wed, 30 Dec 2015 11:39:04 -0500 Subject: [PATCH 1/2] Update pkg_mgr.php * Note - There are two lines previously commented out at Lines! (L127-128) * Mods to if/else/elseif/endif statements for consistency. * Change package dependency href link icon from "paper-clip" to "globe". * Put package dependency links into a < ul > for a cleaner output when dependencies span over two lines. * Add missing gettext() --- src/usr/local/www/pkg_mgr.php | 92 +++++++++++++++-------------------- 1 file changed, 38 insertions(+), 54 deletions(-) diff --git a/src/usr/local/www/pkg_mgr.php b/src/usr/local/www/pkg_mgr.php index 669cebde51..61364234f6 100644 --- a/src/usr/local/www/pkg_mgr.php +++ b/src/usr/local/www/pkg_mgr.php @@ -67,7 +67,7 @@ require_once("globals.inc"); require_once("guiconfig.inc"); require_once("pkg-utils.inc"); -/* if upgrade in progress, alert user */ +// if upgrade in progress, alert user if (is_subsystem_dirty('packagelock')) { $pgtitle = array(gettext("System"), gettext("Package Manager")); include("head.inc"); @@ -76,10 +76,7 @@ if (is_subsystem_dirty('packagelock')) { exit; } -$pkg_info = get_pkg_info(); - $pgtitle = array(gettext("System"), gettext("Package Manager"), gettext("Available Packages")); - include("head.inc"); $tab_array = array(); @@ -87,9 +84,10 @@ $tab_array[] = array(gettext("Available Packages"), true, "pkg_mgr.php"); $tab_array[] = array(gettext("Installed Packages"), false, "pkg_mgr_installed.php"); display_top_tabs($tab_array); +$pkg_info = get_pkg_info(); if ($pkg_info) { - //Check categories - $categories=array(); + // Check categories + $categories = array(); foreach ($pkg_info as $pkg_data) { if (isset($pkg_data['categories'][0])) { $categories[$pkg_data['categories'][0]]++; @@ -97,16 +95,16 @@ if ($pkg_info) { } ksort($categories, SORT_STRING|SORT_FLAG_CASE); - $cm_count=0; + $cm_count = 0; $tab_array = array(); - $visible_categories=array(); - $categories_min_count=($g['pkg_categories_min_count'] ? $g['pkg_categories_min_count'] : 3); - $categories_max_display=($g['pkg_categories_max_display'] ? $g['pkg_categories_max_display'] : 6); + $visible_categories = array(); + $categories_min_count = ($g['pkg_categories_min_count'] ? $g['pkg_categories_min_count'] : 3); + $categories_max_display = ($g['pkg_categories_max_display'] ? $g['pkg_categories_max_display'] : 6); - /* check selected category or define default category to show */ + // check selected category or define default category to show if (isset($_REQUEST['category'])) { $menu_category = $_REQUEST['category']; - } else if (isset($g['pkg_default_category'])) { + } elseif (isset($g['pkg_default_category'])) { $menu_category = $g['pkg_default_category']; } else { $menu_category = "All"; @@ -119,7 +117,7 @@ if ($pkg_info) { foreach ($categories as $category => $c_count) { if ($c_count >= $categories_min_count && $cm_count <= $categories_max_display) { $tab_array[] = array(gettext($category) , $menu_category == $category ? true : false, "pkg_mgr.php?category={$category}"); - $visible_categories[]=$category; + $visible_categories[] = $category; $cm_count++; } } @@ -130,12 +128,12 @@ if ($pkg_info) { // display_top_tabs($tab_array); } -if (!$pkg_info || !is_array($pkg_info)): -?> +if (!$pkg_info || !is_array($pkg_info)):?> +
- +
@@ -145,10 +143,10 @@ if (!$pkg_info || !is_array($pkg_info)):
-
+
@@ -179,72 +177,58 @@ if (!$pkg_info || !is_array($pkg_info)): - - " target="_blank" href=""> - + - + - + - -

: - -
- - - + +

:
    + +    +
+ " href="pkg_mgr_install.php?id=" class="btn btn-success btn-sm">install - + " href="" class="btn btn-default btn-sm">info - + - +
- + \ No newline at end of file +?> From 8924af1a80d96dd6be32222b902950fcf8ada572 Mon Sep 17 00:00:00 2001 From: BBcan177 Date: Wed, 30 Dec 2015 11:51:24 -0500 Subject: [PATCH 2/2] Update pkg_mgr.php Update syntax to 4 space indent --- src/usr/local/www/pkg_mgr.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/usr/local/www/pkg_mgr.php b/src/usr/local/www/pkg_mgr.php index 61364234f6..8f05bd1d66 100644 --- a/src/usr/local/www/pkg_mgr.php +++ b/src/usr/local/www/pkg_mgr.php @@ -189,7 +189,7 @@ if (!$pkg_info || !is_array($pkg_info)):?> } if ($menu_category != "All" && $index['categories'][0] != $menu_category && - !($menu_category == "Other" && !in_array($index['categories'][0], $visible_categories))) { + !($menu_category == "Other" && !in_array($index['categories'][0], $visible_categories))) { continue; } ?>