Re: [webmin-devel] [patch] quotas : % used with limit, for webmin 1.170
Christophe Chisogne <[email protected]>
| Newsgroups | gmane.comp.web.webmin.devel |
|---|---|
| Message-ID | <[email protected]> |
Jamie Cameron wrote: > Could you email a diff file to me Oops, I forgot attachments in my previous mail, sorry. Here are the files from quota dir (simply made with 'diff -u'). I'm not (yet) familiar with patch management. But if you tell me how to do it better, I'll try to do it next time (yes, I should first read man pages about diff, patch etc) > incorporate it into the next release if it looks good .. I simply added a column (% quota used) and a new option to choose the level (x%) above which quota is showed in red. Feel free to improve it, as I'm not a Perl hacker, not even a native speaker ;) Christophe
config.info.fr.patch-1.170
(text/plain, 2 KB)
--- config.info-orig.fr Sat Nov 13 05:00:14 2004 +++ config.info.fr Fri Nov 19 14:34:17 2004 @@ -1,16 +1,20 @@ -display_max=Nombre maximum d'usagers et de groupe à afficher,0 -user_repquota_command=Commande pour lister les usagers sur un système de fichier,0 +display_max=Nombre maximum d'utilisateurs et de groupe à afficher,0 +sort_mode=Trie les utilisateurs et les groupes par,1,0-Blocs utilisés,2-Nom,1-Or +dre utilisé par repquota +block_mode=Affiche les quotas en,1,1-Kilobytes (si possible),0-Blocs +threshold_pc=Pourcentage seuil pour mettre en évidence le quota utilisé,0 +user_repquota_command=Commande pour lister les utilisateurs sur un système de fichier,0 group_repquota_command=Commande pour lister les groupes sur un système de fichier,0 -user_edquota_command=Commande pour éditer le quota d'un usager,0 +user_edquota_command=Commande pour éditer le quota d'un utilisateur,0 group_edquota_command=Commande pour éditer le quota d'un groupe,0 -user_quota_command=Commande pour vérifier le quota d'un usager,0 +user_quota_command=Commande pour vérifier le quota d'un utilisateur,0 group_quota_command=Commande pour vérifier le quota d'un groupe,0 -user_copy_command=Commande pour copier le quota d'un usager,0 +user_copy_command=Commande pour copier le quota d'un utilisateur,0 group_copy_command=Commande pour copier le quota d'un groupe,0 -user_quotaon_command=Commande pour activer les quotas au niveau usager,0 +user_quotaon_command=Commande pour activer les quotas au niveau utilisateur,0 group_quotaon_command=Commande pour activer les quotas au niveau groupe,0 -user_quotaoff_command=Commande pour arrêter les quotas usager,0 +user_quotaoff_command=Commande pour arrêter les quotas utilisateur,0 group_quotaoff_command=Commande pour arrêter les quotas groupe,0 quotacheck_command=Commande pour vérifier les quotas,0 -user_grace_command=Commande pour éditer le temps de grâce de l'usager,0 +user_grace_command=Commande pour éditer le temps de grâce de l'utilisateur,0 group_grace_command=Commande pour éditer le temps de grâce du groupe,0
config.info.patch-1.170
(text/plain, 434 B)
--- config-orig.info Sat Nov 13 05:00:14 2004 +++ config.info Fri Nov 19 14:31:12 2004 @@ -1,5 +1,6 @@ line1=Configurable options,11 display_max=Maximum number of users or groups to display,0 +threshold_pc=Threshold percentage to highlight used quota,0 sort_mode=Sort users and groups by,1,0-Blocks used,2-Name,1-Order from repquota block_mode=Show quotas in,1,1-Kilobytes (where possible),0-Blocks line2=System configuration,11
en.patch-1.170
(text/plain, 320 B)
--- en-orig Fri Nov 19 14:35:13 2004 +++ en Fri Nov 19 14:35:35 2004 @@ -243,6 +243,7 @@ lusers_hblimit=Hard Block Limit lusers_sflimit=Soft File Limit lusers_hflimit=Hard File Limit +lusers_pc_hblocks=Hard % lusers_apply=Apply lusers_emailheader=Email to users approaching quota lusers_email=Send email to users?
fr.patch-1.170
(text/plain, 283 B)
--- fr-orig Sat Nov 13 05:00:14 2004 +++ fr Fri Nov 19 14:36:24 2004 @@ -221,6 +221,7 @@ lusers_hblimit=Limite dure de blocs lusers_sflimit=Limite douce de fichiers lusers_hflimit=Limite dure de fichiers +lusers_pc_hblocks=% dure lusers_apply=Appliquer grace_seconds=Secondes
list_users.patch-1.170
(text/plain, 1.9 KB)
--- list_users-orig.cgi Fri Nov 19 12:36:01 2004
+++ list_users.cgi Fri Nov 19 14:29:26 2004
@@ -19,13 +19,16 @@
}
elsif ($n) {
$bsize = &block_size($f);
+ # no threshold (default) if <= 0% and >=101%
+ my $threshold_pc = $config{'threshold_pc'} || 101;
+ $threshold_pc = 101 if $threshold_pc < 1 or $threshold_pc > 101;
print "<h3>",&text('lusers_qoutas', $f),"</h3>\n";
&show_buttons();
print "<table border width=100%>\n";
print "<tr $tb> <td><br></td>\n";
($binfo, $finfo) = &filesystem_info($f, \%user, $n, $bsize);
- print "<td colspan=3 align=center>\n";
+ print "<td colspan=4 align=center>\n";
if ($access{'diskspace'}) {
print "<b>",$bsize ? $text{'lusers_space'} :
$text{'lusers_blocks'},
@@ -38,6 +41,7 @@
print "</td> </tr>\n";
print "<tr $tb> <td><b>$text{'lusers_user'}</b></td>\n";
+ print "<td><b>$text{'lusers_pc_hblocks'}</b></td>";
print "<td><b>$text{'lusers_used'}</b></td> <td><b>$text{'lusers_soft'}</b></td>\n";
print "<td><b>$text{'lusers_hard'}</b></td>\n";
print "<td><b>$text{'lusers_used'}</b></td> <td><b>$text{'lusers_soft'}</b></td>\n";
@@ -63,7 +67,19 @@
&urlize($f),"&source=0\">$user{$i,'user'}",
"</a></td>\n";
}
- local $ublocks = $user{$i,'ublocks'};
+ my $pc_hblocks=0;
+ if($user{$i,'hblocks'}) {
+ $pc_hblocks = 100 * $user{$i,'ublocks'};
+ $pc_hblocks/= $user{$i,'hblocks'};
+ $pc_hblocks = int($pc_hblocks);
+ }
+ if ($pc_hblocks > $threshold_pc) {
+ print "<td><font color=#ff0000>",
+ &html_escape($pc_hblocks),"%</font></td>\n";
+ } else {
+ print "<td>",&html_escape($pc_hblocks),"%</td>\n";
+ }
+ local $ublocks = $user{$i,'ublocks'};
if ($bsize) {
$ublocks = &nice_size($ublocks*$bsize);
}