OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Thomas Lotterer
  Root:   /v/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-registry                 Date:   24-Nov-2005 23:34:36
  Branch: HEAD                             Handle: 2005112422343600

  Modified files:
    openpkg-registry        registry-ui.pl

  Log:
    add asecomeback page which inserts or updates the user entry in the
    registry; fix minor variable assignment bugs

  Summary:
    Revision    Changes     Path
    1.16        +52 -5      openpkg-registry/registry-ui.pl
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-registry/registry-ui.pl
  ============================================================================
  $ cvs diff -u -r1.15 -r1.16 registry-ui.pl
  --- openpkg-registry/registry-ui.pl   24 Nov 2005 21:30:13 -0000      1.15
  +++ openpkg-registry/registry-ui.pl   24 Nov 2005 22:34:36 -0000      1.16
  @@ -216,6 +216,12 @@
       $out .= &viewlogout();
       print STDOUT &canvas($out);
   }
  +elsif ($cgi->param("page") eq "asecomeback") {
  +    my $out;
  +    $out = '';
  +    $out .= &viewasecomeback();
  +    print STDOUT &canvas($out);
  +}
   elsif ($cgi->param("page") eq "association") {
       my $out;
       $out = '';
  @@ -868,14 +874,14 @@
   sub viewloginform()
   {
       my $html;
  -    $html .= '';
  +    $html = '';
       if    ($cfg->{identification}->{mode} eq "ase") {
           $html .= $cgi->start_form(-action => $ase->url(-action => "login", 
-mode_during => "ase", -mode_after => "ase"));
           $html .= $cgi->delete(-name=>'page');
           $html .= $cgi->hidden(-name=>'page', -value => "ase");
           $html .= $cgi->hidden(-name=>'ase-action',      -value => "login");
           $html .= $cgi->hidden(-name=>'ase-mode_during', -value => "ase");
  -        $html .= $cgi->hidden(-name=>'ase-mode_after',  -value => 
"association");
  +        $html .= $cgi->hidden(-name=>'ase-mode_after',  -value => 
"asecomeback");
           $html .= $cgi->submit('submit','login');
           $html .= $cgi->end_form;
       }
  @@ -908,11 +914,52 @@
   sub viewase() #FIXME
   {
       my $html;
  -    $html .= '';
  +    $html = '';
       $html .= $ase->canvas(-part => "body");
       return $html;
   }
   
  +sub viewasecomeback()
  +{
  +    my ($header, $redirect, $username);
  +    my $html;
  +
  +    $html = '';
  +    $username = &identifyusername();
  +    if (defined $username) {
  +
  +        #   updating heartbeat or creating username
  +        #
  +        $dbh->{AutoCommit} = 1;
  +        $sql = sprintf("UPDATE reg_user SET heartbeat = now() WHERE ( 
username = '%s' );", $username);
  +        $rv = $dbh->do($sql);
  +        if (not defined $rv) {
  +            $html .= &printprettyerror("updating user $username", 
prettydbi());
  +        }
  +        elsif ($rv != 1) {
  +            $sql = sprintf("INSERT INTO reg_user (username) VALUES ('%s');", 
$username);
  +            $rv = $dbh->do($sql);
  +            if (not defined $rv) {
  +                $html .= &printprettyerror("inserting user $username", 
prettydbi());
  +            }
  +            elsif ($rv != 1) {
  +                $html .= &printprettyerror("creating user $username", 
prettydbi());
  +            }
  +        }
  +    }
  +
  +    return $html if ($html ne "");
  +
  +    $header = {};
  +    $redirect = $cgi->redirect(
  +        -uri       => $myurl
  +    );
  +    $header = {
  +        -redirect => $redirect,
  +    };
  +    return $cgi->redirect($header);
  +}
  +
   sub printprettyerror($$)
   {
       my ($marketingmessage, $technicaldetail) = @_;
  @@ -931,7 +978,7 @@
       my ($marketingmessage, $technicaldetail) = @_;
       my $html;
   
  -    $html .= '';
  +    $html = '';
       $html .= "<h1>Sorry</h1>\n";
       $html .= "<img src=\"?page=gif;name=icon-x\">&nbsp;an internal 
<b>ERROR</b> occurred and prevents further processing.<br>\n";
       $html .= sprintf("<h2>Problem scope</h2>\n%s<br>\n", $marketingmessage) 
if (defined $marketingmessage and $marketingmessage ne "");
  @@ -1028,7 +1075,7 @@
   sub viewdropxmlform()
   {
       my $html;
  -    $html .= '';
  +    $html = '';
       $html .= $cgi->start_form();
       $html .= $cgi->delete(-name=>'page');
       $html .= $cgi->hidden(-name=>'page', -value => "dropxml");
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     openpkg-cvs@openpkg.org

Reply via email to