Diff for /loncom/interface/lonsearchcourse.pm between versions 1.9 and 1.12

version 1.9, 2024/02/11 20:40:37 version 1.12, 2024/02/11 23:03:13
Line 123  sub course_search { Line 123  sub course_search {
     my $discuss=$env{'form.crsdiscuss'};      my $discuss=$env{'form.crsdiscuss'};
     my @allwords=($search_string,@New_Words);      my @allwords=($search_string,@New_Words);
     $totalfound=0;      $totalfound=0;
       my $target = 'cat';
       if ((($env{'request.lti.login'}) && ($env{'request.lti.target'} eq 'iframe')) ||
           (($env{'request.deeplink.login'}) && ($env{'request.deeplink.target'} eq '_self'))) {
           $target = '_self';
       }
   
     $r->print(      $r->print(
               '<hr /><center><font size="+2" face="arial">'.                '<hr /><center><font size="+2" face="arial">'.
Line 133  sub course_search { Line 138  sub course_search {
     my $c=$r->connection;      my $c=$r->connection;
     if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.".db",      if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.".db",
             &GDBM_READER(),0640)) {              &GDBM_READER(),0640)) {
         foreach (sort(keys(%hash))) {          foreach my $key (sort(keys(%hash))) {
             if ($c->aborted()) { last; }              last if ($c->aborted());
             if (($_=~/^src\_(.+)$/)) {              if ($key =~ /^src\_(.+)$/) {
                 my $rid = $1;                  my $rid = $1;
                 unless ($env{'request.role.adv'}) {                  unless ($env{'request.role.adv'}) {
                     next if ($hash{'randomout_'.$rid} || $hash{'deeplinkout_'.$rid});                      next if ($hash{'randomout_'.$rid} || $hash{'deeplinkout_'.$rid});
Line 147  sub course_search { Line 152  sub course_search {
                     }                      }
                 }                  }
                 my $symb=&make_symb($1);                  my $symb=&make_symb($1);
                 &checkonthis($r,$1,$hash{$_},0,&Apache::lonnet::gettitle($symb),                  &checkonthis($r,$1,$hash{$key},0,&Apache::lonnet::gettitle($symb),
                              $fulltext,$symb,@allwords);                               $fulltext,$symb,$target,@allwords);
             }              }
         }          }
         untie(%hash);          untie(%hash);
Line 220  sub course_search { Line 225  sub course_search {
                     }                      }
                     $url .= &escape($resource->symb());                      $url .= &escape($resource->symb());
                     my $title = $resource->compTitle();                      my $title = $resource->compTitle();
                     $r->print('<br /><a href="'.$url.'" target="cat">'.                      $r->print('<br /><a href="'.$url.'" target="'.$target.'">'.
                          ($title?$title:$url).'</a>&nbsp;&nbsp;-&nbsp;'.                           ($title?$title:$url).'</a>&nbsp;&nbsp;-&nbsp;'.
                          $disctype.'<br />');                           $disctype.'<br />');
                     $totaldiscussions++;                      $totaldiscussions++;
Line 240  sub course_search { Line 245  sub course_search {
 # =============================== This pulls up a resource and its dependencies  # =============================== This pulls up a resource and its dependencies
   
 sub checkonthis {  sub checkonthis {
     my ($r,$id,$url,$level,$title,$fulltext,$symb,@allwords)=@_;      my ($r,$id,$url,$level,$title,$fulltext,$symb,$target,@allwords)=@_;
     $alreadyseen{$id}=1;      $alreadyseen{$id}=1;
     if (&Apache::loncommon::connection_aborted($r)) { return; }      if (&Apache::loncommon::connection_aborted($r)) { return; }
     $r->rflush();      $r->rflush();
Line 269  sub checkonthis { Line 274  sub checkonthis {
        my $href=$url;         my $href=$url;
        if ($hash{'encrypted_'.$id} && !$env{'request.role.adv'}) {         if ($hash{'encrypted_'.$id} && !$env{'request.role.adv'}) {
            $href=&Apache::lonenc::encrypted($href);             $href=&Apache::lonenc::encrypted($href);
            if ($href =~ /\.sequence$/) {             if ($url =~ /\.sequence$/) {
                $href .= '?navmap=1';                 $href .= '?navmap=1';
            } else {             } else {
                $href .= '?symb='.&Apache::lonenc::encrypted($symb);                 $href .= '?symb='.&Apache::lonenc::encrypted($symb);
Line 281  sub checkonthis { Line 286  sub checkonthis {
                $href .= '?symb='.&escape($symb);                 $href .= '?symb='.&escape($symb);
            }             }
        }         }
        $r->print('<a href="'.$href.'" target="cat">'.($title?$title:$url).         $r->print('<a href="'.$href.'" target="'.$target.'">'.($title?$title:$url).
                  '</a><br />');                   '</a><br />');
        $totalfound++;         $totalfound++;
     } elsif ($fulltext) {      } elsif ($fulltext) {
Line 291  sub checkonthis { Line 296  sub checkonthis {
 # Check also the dependencies of this one  # Check also the dependencies of this one
     my $dependencies=      my $dependencies=
                 &Apache::lonnet::metadata($url,'dependencies');                  &Apache::lonnet::metadata($url,'dependencies');
     foreach (split(/\,/,$dependencies)) {      foreach my $url (split(/\,/,$dependencies)) {
        if (($_=~/^\/res\//) && (!$alreadyseen{$id})) {         if (($url =~ /^\/res\//) && (!$alreadyseen{$id})) {
           &checkonthis($r,$id,$_,$level+1,'',$fulltext,undef,@allwords);            &checkonthis($r,$id,$url,$level+1,'',$fulltext,undef,$target,@allwords);
        }         }
     }      }
 }  }
   
 sub checkwords {  sub checkwords {
     my ($result,$applies,@allwords) = @_;      my ($result,$applies,@allwords) = @_;
     foreach (@allwords) {      foreach my $word (@allwords) {
         if ($_=~/\w/) {          if ($word =~ /\w/) {
             if ($result=~/$_/si) {              if ($result =~ /$word/si) {
                 $applies++;                  $applies++;
             }              }
         }          }

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


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>
500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.