Revision 4832ed98
Added by BBcan177 . over 9 years ago
src/usr/local/www/pkg_mgr.php | ||
---|---|---|
67 | 67 |
require_once("guiconfig.inc"); |
68 | 68 |
require_once("pkg-utils.inc"); |
69 | 69 |
|
70 |
/* if upgrade in progress, alert user */
|
|
70 |
// if upgrade in progress, alert user
|
|
71 | 71 |
if (is_subsystem_dirty('packagelock')) { |
72 | 72 |
$pgtitle = array(gettext("System"), gettext("Package Manager")); |
73 | 73 |
include("head.inc"); |
... | ... | |
76 | 76 |
exit; |
77 | 77 |
} |
78 | 78 |
|
79 |
$pkg_info = get_pkg_info(); |
|
80 |
|
|
81 | 79 |
$pgtitle = array(gettext("System"), gettext("Package Manager"), gettext("Available Packages")); |
82 |
|
|
83 | 80 |
include("head.inc"); |
84 | 81 |
|
85 | 82 |
$tab_array = array(); |
... | ... | |
87 | 84 |
$tab_array[] = array(gettext("Installed Packages"), false, "pkg_mgr_installed.php"); |
88 | 85 |
display_top_tabs($tab_array); |
89 | 86 |
|
87 |
$pkg_info = get_pkg_info(); |
|
90 | 88 |
if ($pkg_info) { |
91 |
//Check categories |
|
92 |
$categories=array();
|
|
89 |
// Check categories
|
|
90 |
$categories = array();
|
|
93 | 91 |
foreach ($pkg_info as $pkg_data) { |
94 | 92 |
if (isset($pkg_data['categories'][0])) { |
95 | 93 |
$categories[$pkg_data['categories'][0]]++; |
... | ... | |
97 | 95 |
} |
98 | 96 |
|
99 | 97 |
ksort($categories, SORT_STRING|SORT_FLAG_CASE); |
100 |
$cm_count=0;
|
|
98 |
$cm_count = 0;
|
|
101 | 99 |
$tab_array = array(); |
102 |
$visible_categories=array();
|
|
103 |
$categories_min_count=($g['pkg_categories_min_count'] ? $g['pkg_categories_min_count'] : 3);
|
|
104 |
$categories_max_display=($g['pkg_categories_max_display'] ? $g['pkg_categories_max_display'] : 6);
|
|
100 |
$visible_categories = array();
|
|
101 |
$categories_min_count = ($g['pkg_categories_min_count'] ? $g['pkg_categories_min_count'] : 3);
|
|
102 |
$categories_max_display = ($g['pkg_categories_max_display'] ? $g['pkg_categories_max_display'] : 6);
|
|
105 | 103 |
|
106 |
/* check selected category or define default category to show */
|
|
104 |
// check selected category or define default category to show
|
|
107 | 105 |
if (isset($_REQUEST['category'])) { |
108 | 106 |
$menu_category = $_REQUEST['category']; |
109 |
} else if (isset($g['pkg_default_category'])) {
|
|
107 |
} elseif (isset($g['pkg_default_category'])) { |
|
110 | 108 |
$menu_category = $g['pkg_default_category']; |
111 | 109 |
} else { |
112 | 110 |
$menu_category = "All"; |
... | ... | |
119 | 117 |
foreach ($categories as $category => $c_count) { |
120 | 118 |
if ($c_count >= $categories_min_count && $cm_count <= $categories_max_display) { |
121 | 119 |
$tab_array[] = array(gettext($category) , $menu_category == $category ? true : false, "pkg_mgr.php?category={$category}"); |
122 |
$visible_categories[]=$category;
|
|
120 |
$visible_categories[] = $category;
|
|
123 | 121 |
$cm_count++; |
124 | 122 |
} |
125 | 123 |
} |
... | ... | |
130 | 128 |
// display_top_tabs($tab_array); |
131 | 129 |
} |
132 | 130 |
|
133 |
if (!$pkg_info || !is_array($pkg_info)): |
|
134 |
?> |
|
131 |
if (!$pkg_info || !is_array($pkg_info)):?>
|
|
132 |
|
|
135 | 133 |
<div class="alert alert-warning"> |
136 | 134 |
<?=gettext("There are currently no packages available for installation.")?> |
137 | 135 |
</div> |
138 |
<?php else: ?>
|
|
136 |
<?php else:?> |
|
139 | 137 |
|
140 | 138 |
<div class="panel panel-default" id="search-panel"> |
141 | 139 |
<div class="panel-heading"><?=gettext('Search')?> |
... | ... | |
145 | 143 |
</a> |
146 | 144 |
</span> |
147 | 145 |
</div> |
148 |
<div id='search-panel_panel-body' class="panel-body collapse in">
|
|
146 |
<div id="search-panel_panel-body" class="panel-body collapse in">
|
|
149 | 147 |
<div class="form-group"> |
150 | 148 |
<label class="col-sm-2 control-label"> |
151 |
Search term
|
|
149 |
<?=gettext("Search term")?>
|
|
152 | 150 |
</label> |
153 | 151 |
<div class="col-sm-5"><input class="form-control" name="searchstr" id="searchstr" type="text"/></div> |
154 | 152 |
<div class="col-sm-2"> |
... | ... | |
179 | 177 |
<?php if (!$g['disablepackagehistory']):?> |
180 | 178 |
<th><?=gettext("Version")?></th> |
181 | 179 |
<?php endif;?> |
182 |
|
|
183 | 180 |
<th><?=gettext("Description")?></th> |
184 | 181 |
<th></th> |
185 | 182 |
</tr> |
186 | 183 |
</thead> |
187 | 184 |
<tbody> |
188 |
<?php |
|
189 | 185 |
|
190 |
foreach ($pkg_info as $index): |
|
191 |
if (isset($index['installed'])) { |
|
192 |
continue; |
|
193 |
} |
|
194 |
|
|
195 |
if ($menu_category != "All" && $index['categories'][0] != $menu_category && !($menu_category == "Other" && !in_array($index['categories'][0], $visible_categories))) { |
|
196 |
continue; |
|
197 |
} |
|
186 |
<?php foreach ($pkg_info as $index): |
|
187 |
if (isset($index['installed'])) { |
|
188 |
continue; |
|
189 |
} |
|
198 | 190 |
|
191 |
if ($menu_category != "All" && $index['categories'][0] != $menu_category && |
|
192 |
!($menu_category == "Other" && !in_array($index['categories'][0], $visible_categories))) { |
|
193 |
continue; |
|
194 |
} |
|
199 | 195 |
?> |
200 | 196 |
<tr> |
201 | 197 |
<td> |
202 | 198 |
<?php if ($index['www']):?> |
203 | 199 |
<a title="<?=gettext("Visit official website")?>" target="_blank" href="<?=htmlspecialchars($index['www'])?>"> |
204 |
<?php endif; ?>
|
|
200 |
<?php endif;?> |
|
205 | 201 |
<?=htmlspecialchars($index['shortname'])?> |
206 | 202 |
</a> |
207 | 203 |
</td> |
208 | 204 |
|
209 |
<?php |
|
210 |
if (!$g['disablepackagehistory']): |
|
211 |
?> |
|
205 |
<?php if (!$g['disablepackagehistory']):?> |
|
212 | 206 |
<td> |
213 | 207 |
<?=htmlspecialchars($index['version'])?> |
214 | 208 |
</td> |
215 |
<?php |
|
216 |
endif; |
|
217 |
?> |
|
209 |
<?php endif;?> |
|
218 | 210 |
<td> |
219 | 211 |
<?=$index['desc']?> |
220 |
<?php if (is_array($index['deps']) && count($index['deps'])): ?>
|
|
221 |
<br /><br /><?= gettext("Package Dependencies") ?>:
|
|
222 |
<?php foreach ($index['deps'] as $pdep): ?>
|
|
223 |
<br /><i class="fa fa-paperclip"></i> <?= basename($pdep['origin']) ?>-<?= $pdep['version'] ?>
|
|
224 |
<?php endforeach; ?>
|
|
225 |
<?php endif; ?>
|
|
212 |
<?php if (is_array($index['deps']) && count($index['deps'])):?> |
|
213 |
<br /><br /><?= gettext("Package Dependencies")?>:<ul>
|
|
214 |
<?php foreach ($index['deps'] as $pdep):?> |
|
215 |
<a target="_blank" href="https://freshports.org/<?=$pdep['origin']?>" class="fa fa-globe"><small> <?= basename($pdep['origin']) . '-' . $pdep['version']?></small></a> 
|
|
216 |
<?php endforeach;?></ul>
|
|
217 |
<?php endif;?> |
|
226 | 218 |
</td> |
227 | 219 |
<td> |
228 | 220 |
<a title="<?=gettext("Click to install")?>" href="pkg_mgr_install.php?id=<?=$index['name']?>" class="btn btn-success btn-sm">install</a> |
229 |
<?php |
|
230 |
if (!$g['disablepackageinfo'] && $index['pkginfolink'] && $index['pkginfolink'] != $index['www']): |
|
231 |
?> |
|
221 |
<?php if (!$g['disablepackageinfo'] && $index['pkginfolink'] && $index['pkginfolink'] != $index['www']):?> |
|
232 | 222 |
<a target="_blank" title="<?=gettext("View more information")?>" href="<?=htmlspecialchars($index['pkginfolink'])?>" class="btn btn-default btn-sm">info</a> |
233 |
<?php |
|
234 |
endif; |
|
235 |
?> |
|
223 |
<?php endif;?> |
|
236 | 224 |
</td> |
237 | 225 |
</tr> |
238 |
<?php |
|
239 |
endforeach; |
|
240 |
?> |
|
226 |
<?php endforeach;?> |
|
241 | 227 |
</tbody> |
242 | 228 |
</table> |
243 | 229 |
</div> |
244 | 230 |
</div> |
245 |
<?php |
|
246 |
endif; |
|
247 |
?> |
|
231 |
<?php endif;?> |
|
248 | 232 |
|
249 | 233 |
<script type="text/javascript"> |
250 | 234 |
//<![CDATA[ |
... | ... | |
314 | 298 |
</script> |
315 | 299 |
|
316 | 300 |
<?php include("foot.inc"); |
317 |
?> |
|
301 |
?> |
Also available in: Unified diff
Update pkg_mgr.php