Diff for /rat/lonpageflip.pm between versions 1.3 and 1.4

version 1.3, 2000/10/07 22:30:30 version 1.4, 2000/10/09 19:37:35
Line 10 Line 10
 # 08/30,08/31,09/06,09/14,09/15,09/16,09/19,09/20,09/21,09/23,  # 08/30,08/31,09/06,09/14,09/15,09/16,09/19,09/20,09/21,09/23,
 # 10/02 Gerd Kortemeyer)  # 10/02 Gerd Kortemeyer)
 #  #
 # 10/03,10/05,10/06,10/07 Gerd Kortemeyer  # 10/03,10/05,10/06,10/07,10/09 Gerd Kortemeyer
   
 package Apache::lonpageflip;  package Apache::lonpageflip;
   
 use strict;  use strict;
 use Apache::Constants qw(:common :http);  use Apache::Constants qw(:common :http REDIRECT);
 use Apache::lonnet();  use Apache::lonnet();
 use HTML::TokeParser;  use HTML::TokeParser;
 use GDBM_File;  use GDBM_File;
Line 25  use GDBM_File; Line 25  use GDBM_File;
 my %hash;  my %hash;
   
 sub addrid {  sub addrid {
     my ($current,$new)=@_;      my ($current,$new,$condid)=@_;
       unless ($condid) { $condid=0; }
     if (&Apache::lonnet::allowed('bre',$hash{'src_'.$new})) {      if (&Apache::lonnet::allowed('bre',$hash{'src_'.$new})) {
  if ($current) {   if ($current) {
     $current.=','.$new;      $current.=','.$new.':'.$condid;
         } else {          } else {
             $current=''.$new;              $current=''.$new.':'.$condid;
         }          }
     }      }
     return $current;      return $current;
Line 49  sub handler { Line 50  sub handler {
      return OK;       return OK;
   }    }
   
   
 # --------BEGIN DEBUG ONLY TRASH  
     $r->content_type('text/html');  
      $r->send_http_header;  
   
   $r->print('<html><body>');  
 # --------END DEBUG ONLY TRASH  
   
   my %cachehash=();    my %cachehash=();
   my $redir=0;    my $redirecturl='';
     my $next='';
     my @possibilities=();
   
   if (($ENV{'form.postdata'})&&($ENV{'request.course.fn'})) {    if (($ENV{'form.postdata'})&&($ENV{'request.course.fn'})) {
       $ENV{'form.postdata'}=~/(\w+)\:(.*)/;        $ENV{'form.postdata'}=~/(\w+)\:(.*)/;
Line 79  sub handler { Line 74  sub handler {
               my $next='';                my $next='';
               if ($direction eq 'forward') {                if ($direction eq 'forward') {
                  map {                   map {
     $next=&addrid($next,$hash{'goesto_'.$_});      $next=&addrid($next,$hash{'goesto_'.$_},
                                     $hash{'condid_'.$hash{'undercond_'.$_}});
                   } split(/\,/,$hash{'to_'.$rid});                    } split(/\,/,$hash{'to_'.$rid});
                   my @possibilities=split(/,/,$next);  
                   if ($#possibilities==1) {  
               my $goto=$possibilities[0];  
   }  
               } elsif ($direction eq 'back') {                } elsif ($direction eq 'back') {
       } elsif ($direction eq 'up') {                  map {
       $next=&addrid($next,$hash{'comesfrom_'.$_},
                                     $hash{'condid_'.$hash{'undercond_'.$_}});
                     } split(/\,/,$hash{'from_'.$rid});
          } elsif ($direction eq 'up') {
               } elsif ($direction eq 'down') {                } elsif ($direction eq 'down') {
               }                }
                 my $redirectid='';
   # ----------------------------------------------------- Check out possibilities
                 if ($next) {
                     @possibilities=split(/\,/,$next);
                     if ($#possibilities==0) {
         $redirectid=(split(/\:/,$next))[0];
                     } else {
                     }
         }
                 if ($redirectid) {
     $redirecturl=$hash{'src_'.$redirectid};
                 }
       untie(%hash);        untie(%hash);
               $r->print($rid.' - '.$next);                if ($redirecturl) {
     $r->content_type('text/html');
                     $r->header_out(Location => 
                                   'http://'.$ENV{'HTTP_HOST'}.$redirecturl);
                     return REDIRECT;
                 }
           }            }
       } else {  
 # -------------------------------------------------------------------------- No  
   $r->print('No idea '.$currenturl);  
       }        }
   # -------------------------------------------------------- No, could not decide
         }
       $r->content_type('text/html');
        $r->send_http_header;
   
     $r->print('<html><body>');
   
 # -------------------------- Class was not initialized or page fliped strangely  # -------------------------- Class was not initialized or page fliped strangely
   } else {    } else {
       $ENV{'user.error.msg'}="/adm/flip:bre:0:0:Choose Course";        $ENV{'user.error.msg'}="/adm/flip:bre:0:0:Choose Course";

Removed from v.1.3  
changed lines
  Added in v.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>