diff options
Diffstat (limited to 'ldap/admin')
-rw-r--r-- | ldap/admin/src/scripts/Dialog.pm | 22 | ||||
-rw-r--r-- | ldap/admin/src/scripts/Setup.pm.in | 2 |
2 files changed, 18 insertions, 6 deletions
diff --git a/ldap/admin/src/scripts/Dialog.pm b/ldap/admin/src/scripts/Dialog.pm index da82740c..31893e7b 100644 --- a/ldap/admin/src/scripts/Dialog.pm +++ b/ldap/admin/src/scripts/Dialog.pm @@ -107,12 +107,18 @@ sub isDisplayed { } # each prompt looks like this: -# [ 'resource key', is pwd ] +# [ 'resource key', is pwd, hide ] # The resource key is the string key of the resource # is pwd is optional - if present, the prompt is for a password # and should not echo the answer +# hide is optional - if present and true, the prompt will not be displayed - this +# is useful in cases where you may want to display or hide a subprompt depending +# on the response to a main prompt # e.g. # ['RESOURCE_USERNAME'], ['RESOURCE_PASSWORD', 1], ['RESOURCE_PASSWORD_AGAIN', 1] +# e.g. +# ['USE_SECURITY'], ['CA_CERTIFICATE', 0, 0] +# you can set the 0 to a 1 if the user has chosen to use security sub run { my $self = shift; my $resp = $DialogManager::SAME; @@ -129,7 +135,7 @@ sub run { my $prompt = $prompts[$index]; my $defaultans = $self->{defaultAns}($self, $index); my $ans; - if ($self->isDisplayed()) { + if ($self->isDisplayed() && !$promtpt->[2]) { $ans = $self->{manager}->showPrompt($prompt->[0], $defaultans, $prompt->[1]); } else { $ans = $defaultans; @@ -201,7 +207,13 @@ sub defaultAns { return $self->{ans}; } if (!exists($self->{default})) { - if ($self->{defaultIsYes}) { + my $isyes; + if (ref($self->{defaultIsYes}) eq 'CODE') { + $isyes = &{$self->{defaultIsYes}}($self); + } else { + $isyes = $self->{defaultIsYes}; + } + if ($isyes) { $self->{default} = $self->{"manager"}->getText("yes"); } else { $self->{default} = $self->{"manager"}->getText("no"); @@ -223,10 +235,10 @@ sub handleResponse { my $nno = $self->{"manager"}->getText("no"); # the regexp allows us to use y or ye or yes for "yes" - if ($nno =~ /^$ans/) { + if ($nno =~ /^$ans/i) { $resp = $DialogManager::NEXT; $self->{ans} = $nno; - } elsif ($yes =~ /^$ans/) { + } elsif ($yes =~ /^$ans/i) { $resp = $DialogManager::NEXT; $self->{ans} = $yes; } else { diff --git a/ldap/admin/src/scripts/Setup.pm.in b/ldap/admin/src/scripts/Setup.pm.in index d66fd7bb..67f6f21e 100644 --- a/ldap/admin/src/scripts/Setup.pm.in +++ b/ldap/admin/src/scripts/Setup.pm.in @@ -71,10 +71,10 @@ use File::Temp qw(tempfile tempdir); use SetupLog; # the setup types -$SILENT = 0; $EXPRESS = 1; $TYPICAL = 2; $CUSTOM = 3; +$SILENT = 4; # process command line options Getopt::Long::Configure(qw(bundling)); # bundling allows -ddddd |