mirror of
https://github.com/webmin/webmin.git
synced 2026-06-02 11:20:30 +01:00
Merge branch 'master' of git@github.com:webmin/webmin
This commit is contained in:
@@ -7,5 +7,4 @@ require './software-lib.pl';
|
||||
@heiropen = &get_heiropen();
|
||||
@heiropen = grep { $_ ne $in{'what'} } @heiropen;
|
||||
&save_heiropen(\@heiropen);
|
||||
&redirect("tree.cgi#$in{'what'}");
|
||||
|
||||
&redirect("tree.cgi#".&urlize($in{'what'}));
|
||||
|
||||
@@ -7,5 +7,5 @@ require './software-lib.pl';
|
||||
@heiropen = &get_heiropen();
|
||||
@heiropen = grep { $_ ne $in{'what'} } @heiropen;
|
||||
&save_heiropen(\@heiropen);
|
||||
&redirect("ipkg-tree.cgi#$in{'what'}");
|
||||
&redirect("ipkg-tree.cgi#".&urlize($in{'what'}));
|
||||
|
||||
|
||||
@@ -45,8 +45,10 @@ print &ui_buttons_end();
|
||||
if ($in{'search'}) {
|
||||
&ui_print_footer("search.cgi?search=$in{'search'}", $text{'search_return'});
|
||||
}
|
||||
elsif ($in{'filter'}) {
|
||||
&ui_print_footer("ipkg-tree.cgi?filter=$in{'filter'}#$pinfo[1]", $text{'index_treturn'});
|
||||
}
|
||||
else {
|
||||
&ui_print_footer("ipkg-tree.cgi#$pinfo[1]", $text{'index_treturn'});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -14,40 +14,55 @@ return ("ipkg");
|
||||
|
||||
# list_packages([package]*)
|
||||
# Fills the array %packages with a list of all packages
|
||||
# ipkg extension: if ALL is specified list alos uninstalled packages
|
||||
# ipkg extension: if ALL is specified list also uninstalled packages
|
||||
sub list_packages
|
||||
{
|
||||
local $i = 0;
|
||||
local $arg = join(" ", map { quotemeta($_) } @_);
|
||||
local $cmd = "ipkg list-installed";
|
||||
$cmd = "ipkg list" if ($arg eq "ALL");
|
||||
%packages = ( );
|
||||
&open_execute_command(PKGINFO, $cmd, 1, 1);
|
||||
&open_execute_command(PKGINFO, "ipkg info", 1, 1);
|
||||
local %temp = ();
|
||||
while(<PKGINFO>) {
|
||||
local ($name, $version, $desc) = split(/ - /, $_);
|
||||
$packages{$i,'name'} = "$name";
|
||||
$packages{$i,'version'} = "$version";
|
||||
$packages{$i,'desc'} = "$desc";
|
||||
|
||||
# generate categories from names, lib and x
|
||||
$name =~ m/^([^-0-9]*)/;
|
||||
local $cat= $1;
|
||||
if ($cat =~ m/^(lib|^(gnu)|^(gtk)|^(perl)|^(net)|^ncurses)/i) {
|
||||
$cat=$1;
|
||||
} elsif ($cat =~ /^x|motif/ && $desc =~ /X |Xorg|X11|XDMCP|Xinerama|Athena|Motif/) {
|
||||
$cat = "x11";
|
||||
} elsif ($cat =~ /^x/ && $desc eq "") {
|
||||
$cat = "x";
|
||||
} elsif ($cat =~ /^arc|^bzip|^cpio|^freeze|^gzip|^lha|^lzo|^tar|^upx|^xz|^zip|^zlib|^zoo|^unzip|^unrar/) {
|
||||
$cat = "archiver";
|
||||
}
|
||||
$packages{$i,'class'} = $cat;
|
||||
$i++;
|
||||
$_ =~ s/\r|\n//g;
|
||||
if ($_) {
|
||||
local ($param, $val) = split(/: /, $_);
|
||||
$temp{$param}=$val;
|
||||
} else {
|
||||
next if (! $temp{'Installed-Time'} && $arg ne "ALL");
|
||||
$packages{$i,'name'} = $temp{'Package'};
|
||||
$packages{$i,'version'} = $temp{'Version'};
|
||||
$packages{$i,'desc'} = $temp{'Description'};
|
||||
$packages{$i,'install'} = $temp{'Installed-Time'};
|
||||
# generate categories from names, Section
|
||||
$temp{'Package'} =~ m/^(..[^-0-9]*)/;
|
||||
local $cat= $1;
|
||||
if ($temp{'Section'} =~ m/^(audio|editor|media|print|games|shell|sys|utils)/) {
|
||||
$cat=ucfirst($1);
|
||||
} elsif ($cat =~ /^(audio|auto|core|compression|diff|lib|ffmpeg|gnu|gtk|perl|net|ncurses|py)/) {
|
||||
$cat=ucfirst($1);
|
||||
} elsif ($cat =~ /^(amavisd|cyrus|esmtp|fetchmail|imap|mail|mini|mutt|mpop|msmtp|offlineimap|pop|postfix|postgrey|procmail|putmail|up|qpopper|sendmail|xmail)$/ ) {
|
||||
$cat = "Mail";
|
||||
} elsif ($cat =~ /^(arc|bzip|cabextract|cpio|freeze|gzip|lha|lzo|p7zip|tar|upx|unarj|xz|zip|zlib|zoo|unzip|unrar)$/) {
|
||||
$cat = "Compression";
|
||||
} elsif ($cat =~ /^x|motif/ && $desc =~ /X |Xorg|X11|XDMCP|Xinerama|Athena|Motif/) {
|
||||
$cat = "X11";
|
||||
} elsif ($cat =~ /^([^v]+sh|sharutils)$/) {
|
||||
$cat = "Shell";
|
||||
} elsif ($cat =~ /^(ed|gawk|sed|vim)$/) {
|
||||
$cat = "Editor";
|
||||
} elsif ($cat =~ /^(apache|cherokee|hiawatha|lighttpd|minihttpd|mod|thttpd)$|^shell/) {
|
||||
$cat = "Web";
|
||||
}
|
||||
$packages{$i,'class'} = $cat;
|
||||
%temp = ();
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
close(PKGINFO);
|
||||
return $i;
|
||||
}
|
||||
|
||||
|
||||
# package_info(package)
|
||||
# Returns an array of package information in the order
|
||||
# name, class, description, arch, version, vendor, installtime
|
||||
|
||||
@@ -7,5 +7,5 @@ require './software-lib.pl';
|
||||
@heiropen = &get_heiropen();
|
||||
push(@heiropen, $in{'what'});
|
||||
&save_heiropen(\@heiropen);
|
||||
&redirect("ipkg-tree.cgi#$in{'what'}");
|
||||
&redirect("ipkg-tree.cgi#".&urlize($in{'what'}));
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/local/bin/perl
|
||||
# tree.cgi
|
||||
# Display the package tree
|
||||
# ikpg-tree.cgi
|
||||
# Display the IPKG package tree
|
||||
|
||||
require './software-lib.pl';
|
||||
&ReadParse();
|
||||
@@ -9,12 +9,25 @@ require './software-lib.pl';
|
||||
# read package list
|
||||
$n = &list_packages("ALL");
|
||||
|
||||
# filter array
|
||||
if ($in{'filter'}) {
|
||||
for($i=0; $i<$n; $i++) {
|
||||
if (index($packages{$i, 'name'}, $in{'filter'}) == -1) {
|
||||
$filter++;
|
||||
$packages{$i, 'name'}='';
|
||||
$packages{$i, 'version'}='';
|
||||
$packages{$i, 'desc'}='';
|
||||
$packages{$i, 'class'}='';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# prcoess openall / closeall actions
|
||||
if ( $in{'mode'} eq "closeall" ) {
|
||||
&save_heiropen([ ]);
|
||||
}
|
||||
|
||||
if ( $in{'mode'} eq "openall" ) {
|
||||
if ( $in{'mode'} eq "openall" || $in{'filter'} ) {
|
||||
for($i=0; $i<$n; $i++) {
|
||||
@w = split(/\//, $packages{$i,'class'});
|
||||
for($j=0; $j<@w; $j++) {
|
||||
@@ -30,27 +43,18 @@ $spacer = " "x3;
|
||||
for($i=0; $i<$n; $i++) {
|
||||
push(@pack, $packages{$i,'name'});
|
||||
push(@vers, $packages{$i,'version'});
|
||||
#push(@svers, $packages{$i,'shortversion'} ||
|
||||
# $packages{$i,'version'});
|
||||
push(@class, $packages{$i,'class'});
|
||||
push(@desc, $packages{$i,'desc'});
|
||||
push(@inst, $packages{$i,'install'});
|
||||
}
|
||||
@order = sort { lc($pack[$a]) cmp lc($pack[$b]) } (0 .. $n-1);
|
||||
$heir{""} = "";
|
||||
foreach $c (sort { $a cmp $b } &unique(@class)) {
|
||||
# note: this is optimize for having only one level!
|
||||
if (!$c) { next; }
|
||||
@w = split(/\//, $c);
|
||||
@w = $c;
|
||||
$p = join('/', @w[0..$#w-1]); # parent class
|
||||
#if (!defined($heir{$p})) {
|
||||
# $pp = join('/', @w[0..$#w-2]); # grandparent class
|
||||
# $heir{$pp} .= "$p\0";
|
||||
# $ppp = join('/', @w[0..$#w-3]); # great-grandparent class
|
||||
# if ($ppp || 1) {
|
||||
# $heir{$ppp} .= "$pp\0";
|
||||
# }
|
||||
# }
|
||||
$heir{$p} .= "$c\0";
|
||||
#$hasclasses++;
|
||||
}
|
||||
|
||||
# get the current open list
|
||||
@@ -58,15 +62,32 @@ foreach $c (sort { $a cmp $b } &unique(@class)) {
|
||||
$heiropen{""} = 1;
|
||||
|
||||
# traverse the hierarchy
|
||||
print &ui_form_start("ipkg-tree.cgi");
|
||||
print &ui_submit($text{'IPKG_filter'});
|
||||
print &ui_textbox("filter", $in{'filter'}, 50);
|
||||
print &ui_form_end(),"<p>\n";
|
||||
|
||||
print &ui_link("ipkg-tree.cgi?mode=closeall", $text{'index_close'});
|
||||
print &ui_link("ipkg-tree.cgi?mode=openall", $text{'index_open'});
|
||||
if ($in{'filter'}) {
|
||||
print &ui_link("ipkg-tree.cgi", $text{'IPKG_filterclear'});
|
||||
print " ", &text('IPKG_filtered',$n-$filter,$n+1), "\n";
|
||||
}
|
||||
print "<table width=\"95%\">\n";
|
||||
&traverse("", 0);
|
||||
print "</table>\n";
|
||||
#if ($hasclasses) {
|
||||
print &ui_link("ipkg-tree.cgi?mode=closeall", $text{'index_close'});
|
||||
print "\n";
|
||||
print &ui_link("ipkg-tree.cgi?mode=openall", $text{'index_open'});
|
||||
print "<p>\n";
|
||||
# }
|
||||
print &ui_form_start("ipkg-tree.cgi");
|
||||
print &ui_submit($text{'IPKG_filter'});
|
||||
print &ui_textbox("filter", $in{'filter'}, 50);
|
||||
print &ui_form_end(),"<p>\n";
|
||||
|
||||
print &ui_link("ipkg-tree.cgi?mode=closeall", $text{'index_close'});
|
||||
print &ui_link("ipkg-tree.cgi?mode=openall", $text{'index_open'});
|
||||
if ($in{'filter'}) {
|
||||
print &ui_link("ipkg-tree.cgi", $text{'IPKG_filterclear'});
|
||||
print " ", &text('IPKG_filtered',$n-$filter,$n+1), "\n";
|
||||
}
|
||||
print "<p>\n";
|
||||
|
||||
&ui_print_footer("", $text{'index_return'});
|
||||
|
||||
@@ -77,11 +98,15 @@ local($s, $act, $i);
|
||||
# Show the icon and class name
|
||||
print "<tr style=\"border-top: 1px solid lightgrey\"> <td>", $spacer x $_[1];
|
||||
if ($_[0]) {
|
||||
print "<a name=\"$_[0]\"></a>\n";
|
||||
$act = $heiropen{$_[0]} ? "close" : "open";
|
||||
my $link = "ipkg-$act.cgi?what=".&urlize($_[0]);
|
||||
if ($in{'filter'}) {
|
||||
print "<img border=0 src='images/close.gif'>";
|
||||
} else {
|
||||
print "<a name=\"$_[0]\"></a>\n";
|
||||
$act = $heiropen{$_[0]} ? "close" : "open";
|
||||
my $link = "ipkg-$act.cgi?what=".&urlize($_[0]);
|
||||
print &ui_link($link, "<img border=0 src='images/$act.gif'>");
|
||||
}
|
||||
$_[0] =~ /([^\/]+)$/;
|
||||
print &ui_link($link, "<img border=0 src='images/$act.gif'>");
|
||||
print " $1</td>\n";
|
||||
}
|
||||
else {
|
||||
@@ -93,10 +118,11 @@ if ($heiropen{$_[0]}) {
|
||||
# print packages followed by sub-folders
|
||||
foreach $i (@order) {
|
||||
if ($class[$i] eq $_[0]) {
|
||||
next if ($vers[$i] == '');
|
||||
print "<tr> <td nowrap>", $spacer x ($_[1]+1);
|
||||
print "<img border=0 src=images/pack.gif> \n";
|
||||
print "<font size=\"+1\" color=\"red\">", ($inst[$i] ? "✅" : " ✘ "), "</font>";
|
||||
print &ui_link("ipkg-edit_pack.cgi?package=". &urlize($pack[$i]).
|
||||
"&version=". &urlize($vers[$i]),
|
||||
"&version=". &urlize($vers[$i]). "&filter=". &urlize($in{'filter'}),
|
||||
"<b>".&html_escape($pack[$i]. ($vers[$i] ? " $vers[$i]" : ""))."</b>" );
|
||||
print "</td> <td>",&html_escape($desc[$i]),"</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
@@ -21,7 +21,7 @@ print "<b>",&text('IPKG_updatedesc', "<tt>$cmd</tt>"),"</b><p>\n";
|
||||
print "<pre>";
|
||||
&additional_log("exec", undef, $cmd);
|
||||
&clean_environment();
|
||||
open(CMD, "$cmd 2>&1 </dev/null |");
|
||||
open(CMD, "($cmd; ipkg list-upgradable) 2>&1 </dev/null |");
|
||||
while(<CMD>) {
|
||||
print &html_escape($_);
|
||||
$out .= $_;
|
||||
|
||||
@@ -414,3 +414,6 @@ IPKG_install_package=Installieren
|
||||
IPKG_install_packagedesc=Installiere dieses Paket auf Deinem System
|
||||
IPKG_noupgrade=Nichts zu aktualisieren
|
||||
IPKG-edit_title=Verwalte IPKG Paket
|
||||
IPKG_filter=Filtere Pakete
|
||||
IPKG_filterclear=Filter löschen
|
||||
IPKG_filtered=Es werden <tt>$1</tt> von <tt>$2</tt> Paketen angezeigt
|
||||
|
||||
@@ -446,3 +446,6 @@ IPKG_install_package=Install
|
||||
IPKG_install_packagedesc=Install this package on your system
|
||||
IPKG_noupgrade=Nothing to upgrade
|
||||
IPKG-edit_title=Manage IPKG Package
|
||||
IPKG_filter=Filter Packages
|
||||
IPKG_filterclear=Clear Filter
|
||||
IPKG_filtered=Displaying <tt>$1</tt> packages out of <tt>$2</tt>
|
||||
|
||||
@@ -7,5 +7,5 @@ require './software-lib.pl';
|
||||
@heiropen = &get_heiropen();
|
||||
push(@heiropen, $in{'what'});
|
||||
&save_heiropen(\@heiropen);
|
||||
&redirect("tree.cgi#$in{'what'}");
|
||||
&redirect("tree.cgi#".&urlize($in{'what'}));
|
||||
|
||||
|
||||
@@ -40,6 +40,12 @@ foreach $c (sort { $a cmp $b } &unique(@class)) {
|
||||
$heiropen{""} = 1;
|
||||
|
||||
# traverse the hierarchy
|
||||
if ($hasclasses) {
|
||||
print &ui_link("closeall.cgi", $text{'index_close'});
|
||||
print "\n";
|
||||
print &ui_link("openall.cgi", $text{'index_open'});
|
||||
print "<p>\n";
|
||||
}
|
||||
print "<table width=100%>\n";
|
||||
&traverse("", 0);
|
||||
print "</table>\n";
|
||||
@@ -76,7 +82,7 @@ if ($heiropen{$_[0]}) {
|
||||
foreach $i (@order) {
|
||||
if ($class[$i] eq $_[0]) {
|
||||
print "<tr> <td nowrap>", $spacer x ($_[1]+1);
|
||||
print "<img border=0 src=images/pack.gif></a> \n";
|
||||
print "<img border=0 src=images/pack.gif> \n";
|
||||
print &ui_link("edit_pack.cgi?package=".
|
||||
&urlize($pack[$i])."&version=".
|
||||
&urlize($vers[$i]), &html_escape($pack[$i].
|
||||
|
||||
Reference in New Issue
Block a user