Project

General

Profile

« Previous | Next » 

Revision 4728

Added by walbridge over 15 years ago

Update properties usage to be correct, use proper LDAP URL, move template function higher up to prevent prototyped subroutine definition issues.

View differences:

src/perl/ldapweb.cgi
55 55

  
56 56
$properties->load(*METACAT_PROPERTIES);
57 57

  
58
## Set up our default configuration
59
my $ldapProps = $properties->splitToTree(qr/\./, 'ldap');
60 58
# local directory configuration
61 59
my $skinsDir = "${workingDirectory}/../style/skins";
62 60
my $templatesDir = abs_path("${workingDirectory}/../style/common/templates");
......
120 118
my $searchBase;
121 119
my $ldapUsername;
122 120
my $ldapPassword;
123
my $ldapurl = $ldapProps->{'url'};
121
# TODO: when should we use surl instead? Is there a setting promoting one over the other?
122
# TODO: the default tree for accounts should be exposed somewhere, defaulting to unaffiliated
123
my $ldapurl = $properties->getProperty('auth.url');
124 124

  
125 125
# Java uses miliseconds, Perl expects whole seconds
126
my $timeout = $ldapProps->{'connectTimeLimit'} / 1000;
127
my $ldapdownmessage = "The main ldap server $ldapProps->{'url'} is down!";
126
my $timeout = $properties->getProperty('ldap.connectTimeLimit') / 1000;
127
my $ldapdownmessage = "The main ldap server $ldapurl is down!";
128 128

  
129 129
# Get the CGI input variables
130 130
my $query = new CGI;
......
211 211
# Define the subroutines to do the work
212 212
#--------------------------------------------------------------------------80c->
213 213

  
214
sub fullTemplate {
215
    my $templateList = shift;
216
    my $templateVars = setVars(shift);
214 217

  
218
    $template->process( $templates->{'header'}, $templateVars );
219
    foreach my $tmpl (@{$templateList}) {
220
        $template->process( $templates->{$tmpl}, $templateVars );
221
    }
222
    $template->process( $templates->{'footer'}, $templateVars );
223
}
224

  
215 225
#
216 226
# create the initial registration form 
217 227
#
......
960 970

  
961 971
sub handleGeneralServerFailure {
962 972
    my $errorMessage = shift;
963
    fullTemplate( ('mainServerFailure'), { errorMessage => $errorMessage });
973
    fullTemplate( ['mainServerFailure'], { errorMessage => $errorMessage });
964 974
    exit(0);   
965 975
   }
966 976
    
......
982 992
    
983 993
    return $templateVars;
984 994
} 
985
    
986
sub fullTemplate {
987
    my $templateList = shift;
988
    my $templateVars = setVars(shift);
989
    
990
    $template->process( $templates->{'header'}, $templateVars );
991
    foreach my $tmpl (@{$templateList}) {
992
        $template->process( $templates->{$tmpl}, $templateVars );
993
    }
994
    $template->process( $templates->{'footer'}, $templateVars );
995
}

Also available in: Unified diff