Changeset 235
- Timestamp:
- 04/16/07 11:23:44 (2 years ago)
- Files:
-
- trunk/webmin/lbs/admin.cgi (modified) (2 diffs)
- trunk/webmin/lbs/at/lrs-export.pl (modified) (5 diffs)
- trunk/webmin/lbs/debian/changelog (modified) (1 diff)
- trunk/webmin/lbs/delete.cgi (modified) (2 diffs)
- trunk/webmin/lbs/images/admin-shaded.gif (added)
- trunk/webmin/lbs/images/admin.gif (added)
- trunk/webmin/lbs/images/cross.gif (modified) (previous)
- trunk/webmin/lbs/images/doubleup1.gif (modified) (previous)
- trunk/webmin/lbs/images/down1.gif (modified) (previous)
- trunk/webmin/lbs/images/trash.gif (modified) (previous)
- trunk/webmin/lbs/images/up1.gif (modified) (previous)
- trunk/webmin/lbs/images/wake-shaded.gif (modified) (previous)
- trunk/webmin/lbs/images/wake.gif (modified) (previous)
- trunk/webmin/lbs/lang/en (modified) (2 diffs)
- trunk/webmin/lbs/lang/fr (modified) (2 diffs)
- trunk/webmin/lbs/lrs-export.pl (modified) (1 diff)
- trunk/webmin/lbs/module.info (modified) (1 diff)
- trunk/webmin/lbs/rename.cgi (modified) (2 diffs)
- trunk/webmin/lbs/renamemac.cgi (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/webmin/lbs/admin.cgi
r107 r235 1 1 #!/usr/bin/perl -w 2 #3 # Show the admin panel4 2 # 5 3 # $Id$ … … 22 20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 23 21 24 # stay strict25 22 use strict; 26 use DB_File;;27 use Fcntl;28 # get some common functions ...29 require 'lbs.pl';30 23 31 24 # ... and vars 32 ReadParse(); 33 use vars qw (%in %text $root_directory %gconfig $VERSION $LRS_HERE @LRS_MODULES %config %lbsconf $lbs_home $current_lang); 25 use vars qw (%access %config %in %lbsconf %text $VERSION); 26 # get some common functions ... 27 require "lbs.pl"; 34 28 35 29 lbs_common::init_lbs_conf() or exit(0) ; 36 $lbs_home = $lbs_common::lbsconf{'basedir'};37 # entete38 lbs_common::print_header( $text{'tit_index'}, "index", $VERSION);39 30 40 if (!defined $in{mac}) { 31 my %einfo ; 32 my $lbs_home = $lbs_common::lbsconf{'basedir'}; 33 my $etherfile = $lbs_home . "/etc/ether" ; 34 my ($mac,$name) ; 35 my $hdrname ; 36 my $menu ; 37 my %hdr ; 38 my %minfo ; 39 my $title ; 40 my $redir = ""; 41 my $wake = $config{"wake"}; 41 42 42 # tabs 43 lbs_common::print_html_tabs(['list_of_machines', 'logs']);43 error(text("err_dnf",$lbs_home)) if (not -d $lbs_home) ; 44 error(text("err_fnf",$etherfile)) if (not -f $etherfile) ; 44 45 45 # machine list 46 my (@labelfunctions, @bodyfunctions); 47 48 push @labelfunctions, sub {return ({'content' => "Renommer" }); }; 49 push @bodyfunctions, \&rename; 50 push @labelfunctions, sub {return ({'content' => "Changer MAC" }); }; 51 push @bodyfunctions, \&renamemac; 52 push @labelfunctions, sub {return ({'content' => "Supprimer" });}; 53 push @bodyfunctions, \&delete; 46 ReadParse() ; 54 47 55 lbs_common::print_machines_list( 56 { 57 }, 58 \@labelfunctions, 59 \@bodyfunctions 60 ); 48 etherLoad($etherfile, \%einfo) or error( lbsGetError() ) ; 49 50 $redir = ""; 51 52 if (exists $in{'mac'}) { 53 54 $mac = $in{'mac'}; 55 56 $name = etherGetNameByMac(\%einfo, $mac) ; 57 58 if (not defined $name) { 59 error(text("err_mac_inval",$mac)) ; 60 } 61 62 $redir .= "ext_cmd=".urlize("$in{mac}")."&mac=".urlize("$in{mac}"); 63 64 #redirect($redir) ; 65 } 66 elsif ($in{'group'}) { 67 my $macs = ""; 68 69 foreach my $k (etherGetMacs(\%einfo)) { 70 my $n = $einfo{$k}[1]; 71 if ( $n =~ m|([^:]*:)?/?([^:]+)/([^/]+)$| ) { 72 # group found 73 if (index ($2,$in{'group'}) != 0) { next; } 74 if (exists $in{'profile'} && index ($1,$in{'profile'}) != 0) { next; } 75 $macs .= $k." "; 76 } 77 } 78 $redir .= "ext_cmd=".urlize("$macs")."&group=".urlize($in{'group'})."&profile=".urlize($in{'profile'}); 79 80 } elsif (exists $in{'profile'}) { 81 my $macs = ""; 82 83 my $filt = $in{'profile'}.":"; 84 if ($filt eq ":") { $filt = "" }; 85 86 foreach my $k (etherGetMacsFilterName(\%einfo, $filt)) { 87 my $n = $einfo{$k}[1]; 88 if ( $n =~ m|^([^:]+):| ) { 89 # prof found 90 if (index ($1,$in{'profile'}) != 0) { next; } 91 $macs .= $k." "; 92 } elsif ( $filt eq "" ) { 93 $macs .= $k." "; 94 } 95 } 96 $redir .= "ext_cmd=".urlize("$macs")."&group=".urlize($in{'group'})."&profile=".urlize($in{'profile'}); 97 61 98 } else { 62 # log details 63 lbs_common::print_html_tabs(['system_backup', 'logs']); 64 65 &morelog($in{mac}); 99 error($text{'err_invalcgi_nomac'}) ; 66 100 } 67 101 102 lbs_common::print_header( $text{'tit_wol'}, "imgbase", ""); 103 lbs_common::print_html_tabs(['list_of_machines', "clients_list"]); 68 104 69 # end of tabs 70 lbs_common::print_end_menu(); 71 lbs_common::print_end_menu(); 72 73 # pied de page 74 footer("/", text('index')); 75 76 # 77 # Functions printing columns 78 # 79 sub rename 80 { 81 my $inf = shift; 82 83 if (defined($inf->{'mac'})) 84 { 85 my $mac = $inf->{'mac'}; 86 87 return ({'content' => "<a href='/lbs/rename.cgi?mac=$mac'><img src='images/detail.gif'></a>"}); 88 89 } 90 91 return ({'content' => " "}); 105 if (exists $in{'mac'}) { 106 print <<EOF 107 <h2 align="center">Client $name ($mac)</h2> 108 <h2><img src="images/admin.gif" align="center"> $text{'lab_administrative_tasks'} :</h2> 109 <ul><li><a href='rename.cgi?$redir'>$text{'but_rename'}</a> 110 <li><a href='renamemac.cgi?$redir'>$text{'but_renamemac'}</a> 111 <li><a href='delete.cgi?$redir'>$text{'but_delete'}</a> 112 </ul> 113 EOF 114 } else { 115 print "<h2 align=\"center\">"; 116 my @local_title; 117 push @local_title, "$text{'lab_group'} $in{'group'}" if $in{'group'}; 118 push @local_title, "$text{'lab_profile'} $in{'profile'}" if $in{'profile'}; 119 print join ', ', @local_title; 120 print "</h2>"; 92 121 } 93 122 94 # 95 sub renamemac 96 { 97 my $inf = shift; 123 print <<EOF; 124 <h2><img src="images/wake.gif" align="center"> $text{'lab_wol2'} :</h2> 125 <ul><li><a href='at/index.cgi?$redir'>$text{'lab_wol_one'}</a> 126 <li><a href='cron/edit_cron.cgi?new=1&$redir'>$text{'lab_wol_per'}</a> 127 </ul> 128 EOF 98 129 99 if (defined($inf->{'mac'})) 100 { 101 my $mac = $inf->{'mac'}; 102 return ({'content' => "<a href='/lbs/renamemac.cgi?mac=$mac'><img src='images/detail.gif'></a>"}); 103 } 130 lbs_common::print_end_menu(); 131 lbs_common::print_end_menu(); 104 132 105 return ({'content' => " "}); 106 } 133 footer("/lbs_common/", $text{'index'}); 107 134 135 # DEBUG 136 #&showConfig() ; 108 137 109 110 # delete one machine111 sub delete112 {113 my $inf = shift;114 115 if (defined($inf->{'mac'}))116 {117 my $mac = $inf->{'mac'};118 return ({'content' => "<a href='/lbs/delete.cgi?mac=$mac'><img src='images/trash.gif'></a>"});119 }120 121 return ({'content' => " "});122 }123 trunk/webmin/lbs/at/lrs-export.pl
r67 r235 82 82 sub mainlist_label() { 83 83 return ( 84 {'content' => "<div style='text-align: center'>"." WOL"."</div>", 'attribs' => 'width="50px"'}84 {'content' => "<div style='text-align: center'>"."Admin"."</div>", 'attribs' => 'width="50px"'} 85 85 ); 86 86 } … … 95 95 my $name="lbswol"."_".main::mac_remove_columns($mac)."_img"; 96 96 $name =~ tr|-/|__|; 97 my $imgout="/lbs/images/ wake.gif";98 my $imgover="/lbs/images/ wake-shaded.gif";97 my $imgout="/lbs/images/admin.gif"; 98 my $imgover="/lbs/images/admin-shaded.gif"; 99 99 my $timestamp=" "; 100 100 … … 106 106 onmouseover=\"$name.src='$imgover';\" 107 107 onmouseout=\"$name.src='$imgout';\" 108 href=\"/$module_name/ wol.cgi?$params\">108 href=\"/$module_name/admin.cgi?$params\"> 109 109 <img 110 110 border=0 … … 121 121 my $profile=$hashref->{'profile'} || ""; 122 122 my $params="group=".main::urlize($group)."&profile=".main::urlize($profile); 123 my $imgout="/lbs/images/ wake.gif";124 my $imgover="/lbs/images/ wake-shaded.gif";123 my $imgout="/lbs/images/admin.gif"; 124 my $imgover="/lbs/images/admin-shaded.gif"; 125 125 my $timestamp=" "; 126 126 my $name="lbswol"."_".$group."_img"; … … 134 134 onmouseover=\"$name.src='$imgover';\" 135 135 onmouseout=\"$name.src='$imgout';\" 136 href=\"/$module_name/ wol.cgi?$params\">136 href=\"/$module_name/admin.cgi?$params\"> 137 137 <img 138 138 border=0 trunk/webmin/lbs/debian/changelog
r206 r235 1 webmin-lbs (2. 6.9) stable; urgency=low1 webmin-lbs (2.7.0) stable; urgency=low 2 2 3 3 * New release. trunk/webmin/lbs/delete.cgi
r162 r235 98 98 $mesg = text("msg_delete_ok",$name,$mac); 99 99 lbs_common::print_header( $text{'tit_delete'}, "index", $VERSION); 100 lbs_common::print_html_tabs([' system_backup', "delete_machine"]);100 lbs_common::print_html_tabs(['list_of_machines', "clients_list"]); 101 101 102 102 # delete for other modules … … 125 125 lbs_common::print_header( $text{'tit_delete'}, "index", $VERSION); 126 126 127 lbs_common::print_html_tabs([' system_backup', "delete_machine"]);127 lbs_common::print_html_tabs(['list_of_machines', "clients_list"]); 128 128 129 129 $mesg = text("msg_delete_confirm",$name,$mac) ; trunk/webmin/lbs/lang/en
r206 r235 59 59 60 60 lab_adminid=Password 61 lab_administrative_tasks=Administrative tasks 61 62 lab_allmacs=MAC addresses of network interfaces : 62 63 lab_arguments=Arguments … … 140 141 lab_woltasks=WOL tasks 141 142 lab_wol=WOL 143 lab_wol2=Wake on LAN 142 144 lab_wol_one=New single wake on lan 143 145 lab_wol_per=New periodic wake on lan trunk/webmin/lbs/lang/fr
r206 r235 59 59 60 60 lab_adminid=Mot de passe 61 lab_administrative_tasks=Tâches administratives 61 62 lab_allmacs=Adresses MAC des interfaces réseau : 62 63 lab_arguments=Arguments … … 141 142 lab_woltasks=Tâches WOL 142 143 lab_wol=WOL 144 lab_wol2=Wake on LAN 143 145 lab_wol_one=Nouveau réveil unique 144 146 lab_wol_per=Nouveau réveil périodique trunk/webmin/lbs/lrs-export.pl
r85 r235 265 265 266 266 267 my $size=main::get_group_size($group, $profile, $hashref->{'ether'} ); # collect the size of the group 268 $size = int( $size >> 10 ); 267 my $size; 268 my $nb; 269 270 if ($hashref->{'name'} ne "ALLPROFILES") { 271 $size = main::get_group_size($group, $profile, $hashref->{'ether'} ); # collect the size of the group 272 $size = int( $size >> 10 ); 273 $nb = main::get_group_numofimages($group, $profile, $hashref->{'ether'} ); # collect the number of image 274 } 269 275 $size = "<div style=\"text-align: right;\">$size</div>"; # and Justify results 270 271 my $nb=main::get_group_numofimages($group, $profile, $hashref->{'ether'} ); # collect the number of image272 276 $nb = "<div style=\"text-align: right;\">$nb</div>"; # and Justify results 273 277 trunk/webmin/lbs/module.info
r206 r235 7 7 8 8 depends=0.94 lbs_common proc at 9 version=2. 6.99 version=2.7.0 trunk/webmin/lbs/rename.cgi
r162 r235 59 59 # redirect to the good page 60 60 $mac = $in{'mac'}; 61 $redir = " bootmenu.cgi?mac=$mac";61 $redir = "/lbs_common/"; 62 62 63 63 $name = etherGetNameByMac(\%einfo, $mac) ; … … 127 127 128 128 #tabs 129 lbs_common::print_html_tabs([' system_backup', 'rename']);129 lbs_common::print_html_tabs(['list_of_machines', "clients_list"]); 130 130 131 131 print_name_desc_form("rename.cgi", "<h2>Client $name ($mac) </h2>", $mac, $menu, $name, $redir) ; trunk/webmin/lbs/renamemac.cgi
r162 r235 55 55 # redirect to the good page 56 56 $mac = $in{'mac'}; 57 $redir = " bootmenu.cgi?mac=$mac";57 $redir = "/lbs_common/"; 58 58 59 59 $name = etherGetNameByMac(\%einfo, $mac) ; … … 95 95 etherSave($etherfile, \%einfo); 96 96 97 $redir = " bootmenu.cgi?mac=$mac";97 $redir = "/lbs_common/"; 98 98 99 99 redirect($redir); … … 106 106 107 107 # tabs 108 lbs_common::print_html_tabs([' system_backup', 'change_mac']);108 lbs_common::print_html_tabs(['list_of_machines', "clients_list"]); 109 109 110 110 print "<h2><font color=\"red\">$error</font></h2>" if ($error ne "");
