aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaouda Lo <daouda@mandriva.com>2003-07-17 13:59:42 +0000
committerDaouda Lo <daouda@mandriva.com>2003-07-17 13:59:42 +0000
commitfc924b7af7b05b7ae3af87c0601cf07e812de09c (patch)
treefd00a75ab6e7c5bf7fc471417a57cfbb022c66a1
parent3e22f003c302f9371e0c835316bc914cd3cae16e (diff)
downloaduserdrake-fc924b7af7b05b7ae3af87c0601cf07e812de09c.tar
userdrake-fc924b7af7b05b7ae3af87c0601cf07e812de09c.tar.gz
userdrake-fc924b7af7b05b7ae3af87c0601cf07e812de09c.tar.bz2
userdrake-fc924b7af7b05b7ae3af87c0601cf07e812de09c.tar.xz
userdrake-fc924b7af7b05b7ae3af87c0601cf07e812de09c.zip
- spinbutton in place of entry
-rwxr-xr-xuserdrake38
1 files changed, 19 insertions, 19 deletions
diff --git a/userdrake b/userdrake
index ec29af8..c12fd6c 100755
--- a/userdrake
+++ b/userdrake
@@ -141,7 +141,6 @@ foreach (($tbedit, $tbdel, $buttorcheck{edit}, $buttorcheck{delete})) { $_->set_
my $ctx = USER::ADMIN->new;
$fbut->signal_connect('clicked', sub { $stringsearch = $filter->get_text() ; Refresh($sysfilter, $stringsearch) });
Refresh($sysfilter, $stringsearch);
-my $tmm = ConvTime(19, 06, 2003);
$nb->signal_connect('switch-page' => sub { NotebookSwitch() });
$us->{wnd}{rwindow}->show_all;
Gtk2->main;
@@ -223,7 +222,7 @@ sub AddUser {
if ($nm) { RaiseError(N("User already exists, please choose another User Name")); $us->{o}->{login}->set_text('') };
$u{passwd} = $us->{o}->{passwd}->get_text();
if ($u{passwd} ne $us->{o}->{confpasswd}->get_text()) { RaiseError(N("Password Mismatch")) };
- if ($sec{SECURE_LEVEL} > 3 && length($u{passwd}) < 6) { RaiseError(N("This password is too simple. \n Good passwords should be > 6 characters")) };
+ if ($sec{SECURE_LEVEL} > 3 && length($u{passwd}) < 6) { RaiseError(N("This password is too simple. \n Good passwords should be > 6 caracters")) };
!$error and my $userEnt = $ctx->InitUser($u{username}, $is_system);
if ($us->{o}->{createhomedir}->get_active) {
$dontcreatehomedir = 0;
@@ -510,6 +509,8 @@ sub Edit {
my $p = $nb->get_current_page();
my $nbU = Gtk2::Notebook->new; my $nbG = Gtk2::Notebook->new;
if ($p <= 0) {
+ my $m = 0; my $s = 0;
+ my ($vald, $mo, $ye) = (localtime)[3, 4, 5]; my $valy = $ye +1900; my $valm = $mo +1;
gtkappend_page($nbU,
gtkpack_(Gtk2::VBox->new(0, 2),
1, BuildUui(),
@@ -517,15 +518,15 @@ sub Edit {
[ N("Home") . " :", $us->{o}->{homedir} = Gtk2::Entry->new() ]
)
), gtkshow(Gtk2::Label->new(N("User Data"))));
- my $m = 0; my $s = 0;
gtkappend_page($nbU,
gtkpack_(Gtk2::VBox->new(0, 2),
0, $us->{o}->{acheckexpire} = Gtk2::CheckButton->new(N("Enable account expiration")),
0, gtkpack__(my $h = Gtk2::HBox->new(0, 10),
- 0, Gtk2::Label->new(N("Account expires MM/DD/YYYY :")),
- 0, map { my $s = $_->[0]; my $t = $_->[1]; my $spc = $_->[2];
- $us->{o}->{$s} = GtkEntrySized($t, $spc),
- } (['expm', 2, 25], ['expd', 2, 25], ['expy', 4, 40]),
+ Gtk2::Label->new(N("Account expires (YYYY-MM-DD):")),
+ map { my $s = $_->[0]; my $value = $_->[1]; my $minv = $_->[2]; my $maxv = $_->[3]; my $spc = $_->[4];
+ $us->{o}->{$s} = Gtk2::SpinButton->new(Gtk2::Adjustment->new($value, $minv , $maxv, 1, 10, 10), 1, 0);
+ $us->{o}->{$s}->set_size_request($spc, 20);
+ } (['expy', $valy, 1970, 2037], ['expm', $valm, 1, 12], ['expd', $vald, 1, 31]),
),
0, Gtk2::HSeparator->new,
0, $us->{o}->{lockuser} = Gtk2::CheckButton->new(N("Lock User Account"))
@@ -533,10 +534,10 @@ sub Edit {
GrayBox($us->{o}->{acheckexpire}, $h, 0);
gtkappend_page($nbU,
gtkpack_(Gtk2::VBox->new(0, 2),
- 0, gtkpack__( Gtk2::HBox->new(0,5),
- 0, Gtk2::Label->new(N("User last changed password on : ")),
- 0, my $dayStr = Gtk2::Label->new(""), 0, my $month = Gtk2::Label->new(""), 0, my $dayInt = Gtk2::Label->new(""), 0, my $year = Gtk2::Label->new("")
- ),
+ 0, gtkpack_(Gtk2::HBox->new(0,5),
+ 0, Gtk2::Label->new(N("User last changed password on : ")),
+ 0, my $dayStr = Gtk2::Label->new(""), 0, my $month = Gtk2::Label->new(""), 0, my $dayInt = Gtk2::Label->new(""), 0, my $year = Gtk2::Label->new("")
+ ),
0, Gtk2::HSeparator->new,
0, $us->{o}->{pcheckexpire} = Gtk2::CheckButton->new(N("Enable Password Expiration")),
1, gtkpack_(my $v = Gtk2::VBox->new(0,1),
@@ -564,9 +565,8 @@ sub Edit {
if ($expire && $expire != -1) {
$us->{o}->{acheckexpire}->set_active(1); $h->set_sensitive(1);
$times = TimeOfArray($expire, 1);
- printf("day = %s ** Month = %s , Year = %s", $times->{dayint}, $times->{month}, $times->{year});
- $us->{o}->{expd}->set_text($times->{dayint}); $us->{o}->{expm}->set_text($times->{month});
- $us->{o}->{expy}->set_text($times->{year});
+ $us->{o}->{expd}->set_value($times->{dayint}); $us->{o}->{expm}->set_value($times->{month});
+ $us->{o}->{expy}->set_value($times->{year});
}
#root account should never be locked
!$Uid and $us->{o}->{lockuser}->set_sensitive(0);
@@ -634,7 +634,7 @@ sub Edit {
if ($u{pw} ne $u{confm}) {
RaiseError(N("Password Mismatch"));
} elsif (($u{pw} eq $u{confm}) && $u{pw} ne ' ') {
- if ($sec{SECURE_LEVEL} > 3 && length($u{pw}) < 6) { RaiseError(N("This password is too simple. \n Good passwords should be > 6 characters")) }
+ if ($sec{SECURE_LEVEL} > 3 && length($u{pw}) < 6) { RaiseError(N("This password is too simple. \n Good passwords should be > 6 caracters")) }
!$error and $ctx->UserSetPass($userEnt, $u{pw});
}
if (!$error) {
@@ -668,9 +668,9 @@ sub Edit {
$ugid = $ent->Gid($GetValue);
$userEnt->Gid($ugid);
if ($us->{o}->{acheckexpire}->get_active()) {
- my $yr = $us->{o}->{expy}->get_text();
- my $mo = $us->{o}->{expm}->get_text();
- my $dy = $us->{o}->{expd}->get_text();
+ my $yr = $us->{o}->{expy}->get_value();
+ my $mo = $us->{o}->{expm}->get_value();
+ my $dy = $us->{o}->{expd}->get_value();
ValidInt($yr, $dy, $mo) or RaiseError(N("Please specify Year, Month and Day \n for Account Expiration "));
if (!$error) { $Exp = ConvTime($dy, $mo, $yr); $userEnt->ShadowExpire($Exp); }
} else { $userEnt->ShadowExpire(ceil(-1)) }
@@ -799,7 +799,7 @@ sub ConvTime {
sub TimeOfArray {
my ($reltime, $cm) = @_;
my $h; my $t; my %mth = (Jan => 1, Feb => 2, Mar => 3, Apr=> 4, May => 5, Jun => 6, Jul => 7, Aug => 8, Sep => 9, Oct => 10, Nov => 11, Dec => 12);
- $t = gmtime($reltime * 24 * 60 * 60) =~ /(\S+)\s+(\S+)\s+(\d+)\s+(\S+)\s+(\d+)/;
+ $t = localtime($reltime * 24 * 60 * 60) =~ /(\S+)\s+(\S+)\s+(\d+)\s+(\S+)\s+(\d+)/;
$h->{daystr} = $1; $h->{month} = $2; $h->{dayint} = $3; $h->{year} = $5 ;
$cm and $h->{month} = $mth{$2};
$h