Project

General

Profile

« Previous | Next » 

Revision 4010

Added by Jing Tao almost 16 years ago

Merge METACAT_1_8_1 to cvs head.

View differences:

ldapweb.cgi
49 49
my $TIMEOUT = 20;
50 50
my $mainldapdownmessage = "The main ldap server " . $mainldapurl . " is down!";
51 51

  
52
# 1.8.1 temporary baseUrl fix
53
my $baseUrl = "@systemidserver@@servlet-path@";
54
$baseUrl =~ s/metacat$//;
55

  
52 56
# Get the CGI input variables
53 57
my $query = new CGI;
54 58

  
......
105 109

  
106 110
my $cfg = $query->param('cfg');
107 111

  
112
# 1.8.1 temporary header/footer fixder =
113

  
114
my $header = ($cfg eq 'nceas') ? 'nceasHeader.tmpl' : '@defaultHeader@';
115
my $footer = ($cfg eq 'nceas') ? 'nceasFooter.tmpl' : '@defaultFooter@';
116

  
108 117
# define the possible stages
109 118
my %stages = (
110 119
              'initregister'      => \&handleInitRegister,
......
143 152
  my $templateVars = { stage => "register", cfg => $cfg };
144 153
  #$$templateVars{'orgList'} = \@orglist;
145 154
  $$templateVars{'orgList'} = \@orglist;
146
  $template->process( "@defaultHeader@", $templateVars);
155
  $$templateVars{'baseUrl'} = $baseUrl;
156
  $template->process( $header, $templateVars);
147 157
  $template->process( "@register@", $templateVars);
148
  $template->process( "@defaultFooter@", $templateVars);
158
  $template->process( $footer, $templateVars);
149 159

  
150 160
  exit();
151 161
}
......
178 188
                             allParams => $allParams,
179 189
                             errorMessage => $errorMessage };
180 190
        $$templateVars{'orgList'} = \@orglist;
181
        $template->process( "@defaultHeader@", $templateVars);
191
        $$templateVars{'baseUrl'} = $baseUrl;
192
        $template->process( $header, $templateVars);
182 193
        $template->process( "@register@", $templateVars);
183
        $template->process( "@defaultFooter@", $templateVars);
194
        $template->process( $footer, $templateVars);
184 195
        exit(0);
185 196
    } else {
186 197
        my $o = $query->param('o');    
......
219 230
                           allParams => $allParams,
220 231
                           foundAccounts => $found };
221 232
      $$templateVars{'orgList'} = \@orglist;
222
      $template->process( "@defaultHeader@", $templateVars);
233
      $$templateVars{'baseUrl'} = $baseUrl;
234
      $template->process( $header, $templateVars);
223 235
      $template->process( "@registerMatch@", $templateVars);
224 236
      $template->process( "@register@", $templateVars);
225
      $template->process( "@defaultFooter@", $templateVars);
237
      $template->process( $footer, $templateVars);
226 238

  
227 239
    # Otherwise, create a new user in the LDAP directory
228 240
    } else {
......
287 299
                             allParams => $allParams,
288 300
                             errorMessage => $errorMessage };
289 301
        $$templateVars{'orgList'} = \@orglist;
290
        $template->process( "@defaultHeader@", $templateVars);
302
        $$templateVars{'baseUrl'} = $baseUrl;
303
        $template->process( $header, $templateVars);
291 304
        $template->process( "@defaultChangePass@", $templateVars);
292
        $template->process( "@defaultFooter@", $templateVars);
305
        $template->process( $footer, $templateVars);
293 306
        exit(0);
294 307
    }
295 308

  
......
304 317

  
305 318
        my $dn = "uid=" . $query->param('uid') . "," . $config_dn->{$o};;
306 319
        if ($query->param('o') =~ "LTER") {
307
            $template->process( "@defaultHeader@");
320
            $template->process( $header);
308 321
            $template->process( "@registerLter@");
309
            $template->process( "@defaultFooter@");
322
            $template->process( $footer);
310 323
        } else {
311 324
            my $errorMessage = changePassword(
312 325
                    $dn, $query->param('userPassword'), 
......
317 330
                                     allParams => $allParams,
318 331
                                     errorMessage => $errorMessage };
319 332
                $$templateVars{'orgList'} = \@orglist;
320
                $template->process( "@defaultHeader@", $templateVars);
333
                $$templateVars{'baseUrl'} = $baseUrl;
334
                $template->process( $header, $templateVars);
321 335
                $template->process( "@defaultChangePass@", $templateVars);
322
                $template->process( "@defaultFooter@", $templateVars);
336
                $template->process( $footer, $templateVars);
323 337
                exit(0);
324 338
            } else {
325 339
                my $templateVars = { stage => "changepass",
326 340
                                     cfg => $cfg,
327 341
                                     allParams => $allParams };
328 342
                $$templateVars{'orgList'} = \@orglist;
329
                $template->process( "@defaultHeader@", $templateVars);
343
                $$templateVars{'baseUrl'} = $baseUrl;
344
                $template->process( $header, $templateVars);
330 345
                $template->process( "@changePassSuccess@", $templateVars);
331
                $template->process( "@defaultFooter@", $templateVars);
346
                $template->process( $footer, $templateVars);
332 347
                exit(0);
333 348
            }
334 349
        }
......
339 354
                             allParams => $allParams,
340 355
                             errorMessage => $errorMessage };
341 356
        $$templateVars{'orgList'} = \@orglist;
342
        $template->process( "@defaultHeader@", $templateVars);
357
        $$templateVars{'baseUrl'} = $baseUrl;
358
        $template->process( $header, $templateVars);
343 359
        $template->process( "@defaultChangePass@", $templateVars);
344
        $template->process( "@defaultFooter@", $templateVars);
360
        $template->process( $footer, $templateVars);
345 361
        exit(0);
346 362
    }
347 363
}
......
360 376
                         allParams => $allParams,
361 377
                         errorMessage => $errorMessage };
362 378
    $$templateVars{'orgList'} = \@orglist;
363
    $template->process( "@defaultHeader@", $templateVars);
379
    $$templateVars{'baseUrl'} = $baseUrl;
380
    $template->process( $header, $templateVars);
364 381
    $template->process( "@defaultChangePass@", $templateVars);
365
    $template->process( "@defaultFooter@", $templateVars);
382
    $template->process( $footer, $templateVars);
366 383
    exit(0);
367 384
}
368 385

  
......
397 414
                             allParams => $allParams,
398 415
                             errorMessage => $errorMessage };
399 416
        $$templateVars{'orgList'} = \@orglist;
400
        $template->process( "@defaultHeader@", $templateVars);
417
        $$templateVars{'baseUrl'} = $baseUrl;
418
        $template->process( $header, $templateVars);
401 419
        $template->process( "@defaultResetPass@", $templateVars);
402
        $template->process( "@defaultFooter@", $templateVars);
420
        $template->process( $footer, $templateVars);
403 421
        exit(0);
404 422
    }
405 423

  
......
407 425
    my $o = $query->param('o');
408 426
    my $dn = "uid=" . $query->param('uid') . "," . $config_dn->{$o};
409 427
    if ($query->param('o') =~ "LTER") {
410
        $template->process( "@defaultHeader@");
428
        $template->process( $header);
411 429
        $template->process( "@registerLter@");
412
        $template->process( "@defaultFooter@");
430
        $template->process( $footer);
413 431
        exit(0);
414 432
    } else {
415 433
        my $errorMessage = "";
......
432 450
                                 allParams => $allParams,
433 451
                                 errorMessage => $errorMessage };
434 452
            $$templateVars{'orgList'} = \@orglist;
435
            $template->process( "@defaultHeader@", $templateVars);
453
            $$templateVars{'baseUrl'} = $baseUrl;
454
            $template->process( $header, $templateVars);
436 455
            $template->process( "@defaultResetPass@", $templateVars);
437
            $template->process( "@defaultFooter@", $templateVars);
456
            $template->process( $footer, $templateVars);
438 457
            exit(0);
439 458
        } else {
440 459
            my $errorMessage = sendPasswordNotification($query->param('uid'),
......
444 463
                                 allParams => $allParams,
445 464
                                 errorMessage => $errorMessage };
446 465
            $$templateVars{'orgList'} = \@orglist;
447
            $template->process( "@defaultHeader@", $templateVars);
466
            $$templateVars{'baseUrl'} = $baseUrl;
467
            $template->process( $header, $templateVars);
448 468
            $template->process( "@resetPassSuccess@", $templateVars);
449
            $template->process( "@defaultFooter@", $templateVars);
469
            $template->process( $footer, $templateVars);
450 470
            exit(0);
451 471
        }
452 472
    }
......
465 485
                         allParams => $allParams,
466 486
                         errorMessage => $errorMessage };
467 487
    $$templateVars{'orgList'} = \@orglist;
468
    $template->process( "@defaultHeader@", $templateVars);
488
    $$templateVars{'baseUrl'} = $baseUrl;
489
    $template->process( $header, $templateVars);
469 490
    $template->process( "@defaultResetPass@", $templateVars);
470
    $template->process( "@defaultFooter@", $templateVars);
491
    $template->process( $footer, $templateVars);
471 492
    exit(0);
472 493
}
473 494

  
......
749 770
    my $allParams = shift;
750 771

  
751 772
    if ($query->param('o') =~ "LTER") {
752
        $template->process( "@defaultHeader@");
773
        $template->process( $header);
753 774
        $template->process( "@registerLter@");
754
        $template->process( "@defaultFooter@");
775
        $template->process( $footer);
755 776
    } else {
756 777

  
757 778
        # Be sure the passwords match
......
762 783
                                 allParams => $allParams,
763 784
                                 errorMessage => $errorMessage };
764 785
            $$templateVars{'orgList'} = \@orglist;
765
            $template->process( "@defaultHeader@", $templateVars);
786
            $$templateVars{'baseUrl'} = $baseUrl;
787
            $template->process( $header, $templateVars);
766 788
            $template->process( "@registerFailed@", $templateVars);
767 789
            $template->process( "@register@", $templateVars);
768
            $template->process( "@defaultFooter@", $templateVars);
790
            $template->process( $footer, $templateVars);
769 791
            exit(0);
770 792
        }
771 793

  
......
823 845
                                 allParams => $allParams,
824 846
                                 errorMessage => $result->error };
825 847
            $$templateVars{'orgList'} = \@orglist;
826
            $template->process( "@defaultHeader@", $templateVars);
848
            $$templateVars{'baseUrl'} = $baseUrl;
849
            $template->process( $header, $templateVars);
827 850
            $template->process( "@registerFailed@", $templateVars);
828 851
            $templateVars    = { stage => "register",
829 852
                                 cfg => $cfg,
830 853
                                 allParams => $allParams };
831 854
            $$templateVars{'orgList'} = \@orglist;
855
            $$templateVars{'baseUrl'} = $baseUrl;
832 856
            $template->process( "@register@", $templateVars);
833
            $template->process( "@defaultFooter@", $templateVars);
857
            $template->process( $footer, $templateVars);
834 858
        } else {
835 859
            my $templateVars    = { cfg => $cfg };
836
            $template->process( "@defaultHeader@", $templateVars);
860
            $$templateVars{'baseUrl'} = $baseUrl;
861
            $template->process( $header, $templateVars);
837 862
            $template->process( "@registerSuccess@", $templateVars);
838
            $template->process( "@defaultFooter@", $templateVars);
863
            $template->process( $footer, $templateVars);
839 864
        }
840 865

  
841 866
        $ldap->unbind;   # take down session
......
851 876
                       cfg => $cfg,
852 877
                       errorMessage => $errorMessage };
853 878
  $$templateVars{'orgList'} = \@orglist;
854
  $template->process( "@defaultHeader@", $templateVars);
855
  $template->process( "@defaultFooter@", $templateVars);
879
  $$templateVars{'baseUrl'} = $baseUrl;
880
  $template->process( $header, $templateVars);
881
  $template->process( $footer, $templateVars);
856 882
  exit(0);
857 883
}
858 884

  
......
913 939
                           allParams => $allParams,
914 940
                           foundAccounts => $found };
915 941
      $$templateVars{'orgList'} = \@orglist;
916
      $template->process( "@defaultHeader@", $templateVars);
942
      $$templateVars{'baseUrl'} = $baseUrl;
943
      $template->process( $header, $templateVars);
917 944
      $template->process( "@searchResults@", $templateVars);
918
      $template->process( "@defaultFooter@", $templateVars);
945
      $template->process( $footer, $templateVars);
919 946

  
920 947
    } else {
921 948
      $found = "No entries matched your criteria.  Please try again\n";
......
925 952
                           allParams => $allParams,
926 953
                           foundAccounts => $found };
927 954
      $$templateVars{'orgList'} = \@orglist;
928
      $template->process( "@defaultHeader@", $templateVars);
955
      $$templateVars{'baseUrl'} = $baseUrl;
956
      $template->process( $header, $templateVars);
929 957
      $template->process( "@searchResults@", $templateVars);
930
      $template->process( "@defaultFooter@", $templateVars);
958
      $template->process( $footer, $templateVars);
931 959

  
932 960
    }
933 961

  
......
1009 1037
    my $errorMessage = shift;
1010 1038
    my $templateVars = { cfg => $cfg,
1011 1039
                         errorMessage => $errorMessage };
1012
    $template->process( "@defaultHeader@", $templateVars);
1040
    $$templateVars{'baseUrl'} = $baseUrl;
1041
    $template->process( $header, $templateVars);
1013 1042
    $template->process( "@ldapMainServerFailure@", $templateVars);
1014
    $template->process( "@defaultFooter@", $templateVars);
1043
    $template->process( $footer, $templateVars);
1015 1044
    exit(0);   
1016 1045
   }
1017 1046
    

Also available in: Unified diff