Changeset 235

Show
Ignore:
Timestamp:
04/16/07 11:23:44 (2 years ago)
Author:
ludo
Message:

new admin panel. new icons (from r4244)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/webmin/lbs/admin.cgi

    r107 r235  
    11#!/usr/bin/perl -w 
    2 # 
    3 # Show the admin panel 
    42# 
    53# $Id$ 
     
    2220# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
    2321 
    24 # stay strict 
    2522use strict; 
    26 use DB_File;; 
    27 use Fcntl; 
    28 # get some common functions ... 
    29 require 'lbs.pl'; 
    3023 
    3124# ... and vars 
    32 ReadParse(); 
    33 use vars qw (%in %text $root_directory %gconfig $VERSION $LRS_HERE @LRS_MODULES %config %lbsconf $lbs_home $current_lang); 
     25use vars qw (%access %config %in %lbsconf %text $VERSION); 
     26# get some common functions ... 
     27require "lbs.pl"; 
    3428 
    3529lbs_common::init_lbs_conf() or exit(0) ; 
    36 $lbs_home = $lbs_common::lbsconf{'basedir'}; 
    37 # entete 
    38 lbs_common::print_header( $text{'tit_index'}, "index", $VERSION); 
    3930 
    40 if (!defined $in{mac}) { 
     31my %einfo ; 
     32my $lbs_home = $lbs_common::lbsconf{'basedir'}; 
     33my $etherfile = $lbs_home . "/etc/ether" ; 
     34my ($mac,$name) ; 
     35my $hdrname ; 
     36my $menu ; 
     37my %hdr ; 
     38my %minfo ; 
     39my $title ; 
     40my $redir = ""; 
     41my $wake = $config{"wake"}; 
    4142 
    42   # tabs 
    43   lbs_common::print_html_tabs(['list_of_machines', 'logs'])
     43error(text("err_dnf",$lbs_home)) if (not -d $lbs_home) ; 
     44error(text("err_fnf",$etherfile)) if (not -f $etherfile)
    4445 
    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; 
     46ReadParse() ; 
    5447 
    55   lbs_common::print_machines_list( 
    56                                         { 
    57                                         }, 
    58                                         \@labelfunctions, 
    59                                         \@bodyfunctions 
    60                                 ); 
     48etherLoad($etherfile, \%einfo) or error( lbsGetError() ) ; 
     49 
     50$redir = ""; 
     51 
     52if (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
     66elsif ($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 
    6198} else { 
    62   # log details 
    63   lbs_common::print_html_tabs(['system_backup', 'logs']); 
    64  
    65   &morelog($in{mac}); 
     99        error($text{'err_invalcgi_nomac'}) ; 
    66100} 
    67101 
     102lbs_common::print_header( $text{'tit_wol'}, "imgbase", ""); 
     103lbs_common::print_html_tabs(['list_of_machines', "clients_list"]); 
    68104 
    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' => "&nbsp;"}); 
     105if (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> 
     113EOF 
     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>"; 
    92121} 
    93122 
    94 
    95 sub renamemac 
    96 
    97   my $inf = shift; 
     123print <<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> 
     128EOF 
    98129 
    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     } 
     130lbs_common::print_end_menu();            
     131lbs_common::print_end_menu();            
    104132 
    105   return ({'content' => "&nbsp;"}); 
    106 
     133footer("/lbs_common/", $text{'index'}); 
    107134 
     135# DEBUG 
     136#&showConfig() ; 
    108137 
    109  
    110 # delete one machine 
    111 sub delete 
    112 { 
    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' => "&nbsp;"}); 
    122 } 
    123  
  • trunk/webmin/lbs/at/lrs-export.pl

    r67 r235  
    8282sub mainlist_label() { 
    8383        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"'} 
    8585                ); 
    8686} 
     
    9595                my $name="lbswol"."_".main::mac_remove_columns($mac)."_img"; 
    9696                $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"; 
    9999                my $timestamp="&nbsp"; 
    100100 
     
    106106                                                onmouseover=\"$name.src='$imgover';\" 
    107107                                                onmouseout=\"$name.src='$imgout';\" 
    108                                                 href=\"/$module_name/wol.cgi?$params\"> 
     108                                                href=\"/$module_name/admin.cgi?$params\"> 
    109109                                                <img 
    110110                                                        border=0 
     
    121121                my $profile=$hashref->{'profile'} || ""; 
    122122                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"; 
    125125                my $timestamp="&nbsp"; 
    126126                my $name="lbswol"."_".$group."_img"; 
     
    134134                                                onmouseover=\"$name.src='$imgover';\" 
    135135                                                onmouseout=\"$name.src='$imgout';\" 
    136                                                 href=\"/$module_name/wol.cgi?$params\"> 
     136                                                href=\"/$module_name/admin.cgi?$params\"> 
    137137                                                <img 
    138138                                                        border=0 
  • trunk/webmin/lbs/debian/changelog

    r206 r235  
    1 webmin-lbs (2.6.9) stable; urgency=low 
     1webmin-lbs (2.7.0) stable; urgency=low 
    22 
    33  * New release. 
  • trunk/webmin/lbs/delete.cgi

    r162 r235  
    9898                $mesg = text("msg_delete_ok",$name,$mac); 
    9999                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"]); 
    101101 
    102102                # delete for other modules 
     
    125125        lbs_common::print_header( $text{'tit_delete'}, "index", $VERSION); 
    126126 
    127         lbs_common::print_html_tabs(['system_backup', "delete_machine"]); 
     127        lbs_common::print_html_tabs(['list_of_machines', "clients_list"]); 
    128128 
    129129        $mesg = text("msg_delete_confirm",$name,$mac) ; 
  • trunk/webmin/lbs/lang/en

    r206 r235  
    5959 
    6060lab_adminid=Password 
     61lab_administrative_tasks=Administrative tasks 
    6162lab_allmacs=MAC addresses of network interfaces : 
    6263lab_arguments=Arguments 
     
    140141lab_woltasks=WOL tasks 
    141142lab_wol=WOL 
     143lab_wol2=Wake on LAN 
    142144lab_wol_one=New single wake on lan 
    143145lab_wol_per=New periodic wake on lan 
  • trunk/webmin/lbs/lang/fr

    r206 r235  
    5959 
    6060lab_adminid=Mot de passe 
     61lab_administrative_tasks=T&acirc;ches administratives 
    6162lab_allmacs=Adresses MAC des interfaces réseau : 
    6263lab_arguments=Arguments 
     
    141142lab_woltasks=Tâches WOL 
    142143lab_wol=WOL 
     144lab_wol2=Wake on LAN 
    143145lab_wol_one=Nouveau réveil unique 
    144146lab_wol_per=Nouveau réveil périodique 
  • trunk/webmin/lbs/lrs-export.pl

    r85 r235  
    265265                 
    266266                 
    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                } 
    269275                $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 image 
    272276                $nb   = "<div style=\"text-align: right;\">$nb</div>";                                  # and Justify results 
    273277                 
  • trunk/webmin/lbs/module.info

    r206 r235  
    77 
    88depends=0.94 lbs_common proc at 
    9 version=2.6.9 
     9version=2.7.0 
  • trunk/webmin/lbs/rename.cgi

    r162 r235  
    5959# redirect to the good page 
    6060$mac = $in{'mac'}; 
    61 $redir = "bootmenu.cgi?mac=$mac"; 
     61$redir = "/lbs_common/"; 
    6262 
    6363$name = etherGetNameByMac(\%einfo, $mac) ; 
     
    127127         
    128128        #tabs 
    129         lbs_common::print_html_tabs(['system_backup', 'rename']); 
     129        lbs_common::print_html_tabs(['list_of_machines', "clients_list"]); 
    130130         
    131131        print_name_desc_form("rename.cgi", "<h2>Client $name ($mac) </h2>", $mac, $menu, $name, $redir) ; 
  • trunk/webmin/lbs/renamemac.cgi

    r162 r235  
    5555# redirect to the good page 
    5656$mac = $in{'mac'}; 
    57 $redir = "bootmenu.cgi?mac=$mac"; 
     57$redir = "/lbs_common/"; 
    5858 
    5959$name = etherGetNameByMac(\%einfo, $mac) ; 
     
    9595                etherSave($etherfile, \%einfo); 
    9696                 
    97                 $redir = "bootmenu.cgi?mac=$mac"; 
     97                $redir = "/lbs_common/"; 
    9898                 
    9999                redirect($redir); 
     
    106106 
    107107# tabs 
    108 lbs_common::print_html_tabs(['system_backup', 'change_mac']); 
     108lbs_common::print_html_tabs(['list_of_machines', "clients_list"]); 
    109109 
    110110print "<h2><font color=\"red\">$error</font></h2>" if ($error ne "");