summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsamba_wizard/Sambaprint.pm59
1 files changed, 37 insertions, 22 deletions
diff --git a/samba_wizard/Sambaprint.pm b/samba_wizard/Sambaprint.pm
index 7dec4754..91107669 100755
--- a/samba_wizard/Sambaprint.pm
+++ b/samba_wizard/Sambaprint.pm
@@ -55,7 +55,7 @@ print Dumper($samba);
my %cprint = (
1 => N('Printers - configure your printers'),
- 2 => N('Print - printers drivers'),
+ # 2 => N('Print - printers drivers'),
);
my @yesorno = qw(yes no); push @yesorno, "";
@@ -69,10 +69,17 @@ $o->{pages} = {
$::in->ask_warn(N("Information"), N("It seems that you don\'t setup a Samba server. Please setup a Samba server with Samba wizard before manage your share."));
exit(1);
}
+ $o->{var}{wiz_do_printer_sharing} = "0";
},
data => [
- { label => N("? :"), val => \$o->{var}{wiz_todo}, list => [ keys %cprint ], format => sub { $cprint{$_[0]} } },
+ # { label => "", val => \$o->{var}{wiz_todo}, list => [ keys %cprint ], format => sub { $cprint{$_[0]} } },
+ { text => N('Enable printers in Samba ?'), type => 'bool', val => \$o->{var}{wiz_do_printer_sharing} },
],
+ post => sub {
+ if ($o->{var}{wiz_do_printer_sharing} == 0) {
+ return 'summary_disable'
+ } else { return 'ask_printers' }
+ },
next => 'ask_printers',
},
ask_printers => {
@@ -95,8 +102,8 @@ $o->{pages} = {
} else {
$o->{var}{wiz_printers_comment} = "All Printers";
}
- $o->{var}{wiz_printers_browseable} ||= $samba->{printers}{browseable};
- $o->{var}{wiz_printers_guestok} ||= $samba->{printers}{'guest ok'};
+ $o->{var}{wiz_printers_browseable} ||= $samba->{printers}{browseable} or $o->{var}{wiz_printers_browseable} = "no";
+ $o->{var}{wiz_printers_guestok} ||= $samba->{printers}{'guest ok'} or $o->{var}{wiz_printers_guestok} = "yes";
if ($samba->{printers}{'create mode'}) {
$o->{var}{wiz_printers_createmode} ||= $samba->{printers}{'create mode'}
} else {
@@ -122,14 +129,20 @@ $o->{pages} = {
$o->{var}{wiz_sambatype} = $cprint{$o->{var}{wiz_type}};
},
data => [
- { label => N('Samba type:'), fixed_val => \$o->{var}{wiz_sambatype} },
- { label => N('Workgroup:'), fixed_val => \$o->{var}{wiz_workgroup} },
- { label => N('Server banner:'), fixed_val => \$o->{var}{wiz_banner} },
- { label => N('Log file:'), fixed_val => \$o->{var}{wiz_log_file} },
+ { label => N('Comment:'), fixed_val => \$o->{var}{wiz_printers_comment} },
+ { label => N('Create mode:'), fixed_val => \$o->{var}{wiz_printers_createmode} },
+ { label => N('Browseable:'), fixed_val => \$o->{var}{wiz_printers_browseable} },
+ { label => N('Guest ok:'), fixed_val => \$o->{var}{wiz_printers_guestok} },
],
post => \&do_it,
- next => 'end'
+ next => 'end',
},
+ summary_disable => {
+ name => N('Disable Samba priniters'),
+ post => \&do_it,
+ next => 'end',
+ no_back => 1,
+ },
end => {
name => N('Congratulations') . "\n\n" . N('The wizard successfully configured your Samba printer.'),
no_back => 1,
@@ -194,7 +207,7 @@ sub list_printers() {
sub printer_sharing() {
- # create default sedction for printers with default value
+ # create default section for printers with default value
$samba->{global}{'printer adm'} = "\@adm";
$samba->{printers};
$samba->{printers}{comment} = $o->{var}{wiz_printers_comment};
@@ -207,17 +220,19 @@ sub printer_sharing() {
$samba->{printers}{printable} = "yes";
$samba->{printers}{'print command'} = "lpr-cups -P %p -o raw %s -r";
$samba->{printers}{'use client driver'} = "yes";
- for (my $i; $i < @{$o->{var}{wiz_box_list}}; $i++) {
- my $printer = $o->{var}{list_printers}[$i];
- if ($o->{var}{wiz_box_list}[$i]) {
- add_printer($printer);
- } else {
- remove_printer($printer);
+ if ($o->{var}{wiz_box_list}) {
+ for (my $i; $i < @{$o->{var}{wiz_box_list}}; $i++) {
+ my $printer = $o->{var}{list_printers}[$i];
+ if ($o->{var}{wiz_box_list}[$i]) {
+ add_printer($printer);
+ } else {
+ remove_printer($printer);
+ }
}
}
}
-sub priner_section() {
+sub printer_section() {
$samba->{'pdf-gen'};
$samba->{path} = "/var/tmp";
$samba->{'guest ok'} = "no";
@@ -266,7 +281,7 @@ sub do_it {
my $w = $in->wait_message(N("Samba server"), N("Configuring your Samba server..."));
# share printers
- if ($o->{var}{wiz_do_printer_sharing}) {
+ if ($o->{var}{wiz_do_printer_sharing} == 0) {
printer_sharing();
printer_section();
printdollar_section();
@@ -276,10 +291,10 @@ sub do_it {
$o->{var}{list_printers}[$i] and remove_printer($o->{var}{list_printers}[$i]);
}
}
- delete $samba->{global}{'printer adm'};
- delete $samba->{printers};
- delete $samba->{'print$'};
- delete $samba->{'pdf-gen'};
+ $samba->{global}{'printer adm'} and delete $samba->{global}{'printer adm'};
+ $samba->{printers} and delete $samba->{printers};
+ $samba->{'print$'} and delete $samba->{'print$'};
+ $samba->{'pdf-gen'} and delete $samba->{'pdf-gen'};
}
write_conf_restart_smb();