Diff for /rat/lonambiguous.pm between versions 1.9 and 1.11

version 1.9, 2003/04/12 15:43:58 version 1.11, 2004/12/17 22:40:24
Line 38  use Apache::lonnet; Line 38  use Apache::lonnet;
 use Apache::Constants qw(:common REDIRECT);  use Apache::Constants qw(:common REDIRECT);
 use GDBM_File;  use GDBM_File;
 use Apache::loncommon;  use Apache::loncommon;
   use Apache::lonlocal;
   
 my %bighash;  my %bighash;
   
Line 54  sub cleanup { Line 55  sub cleanup {
   
 sub getlost {  sub getlost {
     my ($r,$errmsg)=@_;      my ($r,$errmsg)=@_;
       $errmsg=&mt($errmsg);
     $r->content_type('text/html');      $r->content_type('text/html');
     $r->send_http_header;      $r->send_http_header;
     $r->print(      $r->print(
Line 65  sub getlost { Line 67  sub getlost {
   
 # ================================================================ Main Handler  # ================================================================ Main Handler
   
   sub make_symb {
       my ($id)=@_;
       my ($mapid,$resid)=split(/\./,$id);
       my $map=$bighash{'map_id_'.$mapid};
       my $res=$bighash{'src_'.$id};
       my $symb=&Apache::lonnet::encode_symb($map,$resid,$res);
       return $symb;
   }
   
 sub handler {  sub handler {
    my $r=shift;     my $r=shift;
   
    if ($r->header_only) {     if ($r->header_only) {
       $r->content_type('text/html');        &Apache::loncommon::content_type($r,'text/html');
       $r->send_http_header;        $r->send_http_header;
       return OK;        return OK;
    }     }
Line 149  sub handler { Line 160  sub handler {
 # ------------------------------------------------------------------- Has ID(s)  # ------------------------------------------------------------------- Has ID(s)
          my @possibilities=split(/\,/,$ids);           my @possibilities=split(/\,/,$ids);
          my $couldbe='';           my $couldbe='';
          map {           foreach (@possibilities) {
              if (&Apache::lonnet::allowed('bre',$bighash{'src_'.$_})) {               if ($bighash{'encrypted_'.$_}) { next; }
        my $symb=&make_symb($_);
                if (&Apache::lonnet::allowed('bre',$bighash{'src_'.$_},$symb)) {
          if ($couldbe) {           if ($couldbe) {
      $couldbe.=','.$_;       $couldbe.=','.$_;
                  } else {                   } else {
                      $couldbe=$_;                       $couldbe=$_;
                  }                   }
              }               }
  } @possibilities;   }
          if ($couldbe) {           if ($couldbe) {
             @possibilities=split(/\,/,$couldbe);              @possibilities=split(/\,/,$couldbe);
             if ($#possibilities>0) {              if ($#possibilities>0) {
Line 174  and LON-CAPA has insufficient session in Line 187  and LON-CAPA has insufficient session in
 of the resource you meant.  of the resource you meant.
 <p>  <p>
 Please click on the instance of the resource you intended to access:  Please click on the instance of the resource you intended to access:
 <p>  </p>
 <form action="/adm/ambiguous" method=post>  <table border="2">
 <input type=hidden name=orgurl value="$thisfn">  <tr><th>Title</th><th>Part of ...</th></tr>
 <input type=hidden name=selecturl value=1>  
 <table border=2>  
 <tr><th>&nbsp;</th><th>Title</th><th>Type</th><th>Part of ...</th></tr>  
 ENDSTART  ENDSTART
                map {                 map {
      my $resurl=$bighash{'src_'.$_};
                    my $mapurl=$bighash{'map_id_'.(split(/\./,$_))[0]};                     my $mapurl=$bighash{'map_id_'.(split(/\./,$_))[0]};
                    $r->print('<tr><td><input type=submit value=Select name="'.     my $symb=&make_symb($_);
                               $_.'"></td><td>'.$bighash{'title_'.$_}.     $r->print('<tr><td><a href="'.$resurl.'?symb='.$symb.'">'.
                               '</td><td>'.$bighash{'type_'.$_}.       &Apache::lonnet::gettitle($symb).
                               '</td><td>'.       '</a></td><td>'.
                               ($mapurl=~/^\/uploaded\//?'':'<a href="'.$mapurl.'">').       &Apache::lonnet::gettitle($mapurl).'&nbsp;'.
                               &Apache::lonnet::gettitle($mapurl).'&nbsp;'.       '</td></tr>');
       ($mapurl=~/^\/uploaded\//?'':'</a>').'</td></tr>');  
                } @possibilities;                 } @possibilities;
                $r->print('</table></form></body></html>');                 $r->print('</table></body></html>');
        untie(%bighash);         untie(%bighash);
                return OK;                 return OK;
             }              }

Removed from v.1.9  
changed lines
  Added in v.1.11


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