Diff for /loncom/interface/lonsearchcat.pm between versions 1.302 and 1.307

version 1.302, 2008/12/12 17:46:25 version 1.307, 2009/05/15 14:48:42
Line 519  sub course_search { Line 519  sub course_search {
         my $totaldiscussions = 0;          my $totaldiscussions = 0;
         $r->print('<br /><br /><b>'.&mt('Discussion postings').':</b><br />');           $r->print('<br /><br /><b>'.&mt('Discussion postings').':</b><br />'); 
         my $navmap = Apache::lonnavmaps::navmap->new();          my $navmap = Apache::lonnavmaps::navmap->new();
         my @allres=$navmap->retrieveResources();          if (defined($navmap)) {
         my %discussiontime = &Apache::lonnet::dump('discussiontimes',              my @allres=$navmap->retrieveResources();
                                $env{'course.'.$env{'request.course.id'}.'.domain'},              my %discussiontime = &Apache::lonnet::dump('discussiontimes',
                                $env{'course.'.$env{'request.course.id'}.'.num'});                                     $env{'course.'.$env{'request.course.id'}.'.domain'},
         foreach my $resource (@allres) {                                     $env{'course.'.$env{'request.course.id'}.'.num'});
             my $result = '';              foreach my $resource (@allres) {
             my $applies = 0;                  my $result = '';
             my $symb = $resource->symb();                  my $applies = 0;
             my $ressymb = $symb;                  my $symb = $resource->symb();
             if ($symb =~ m#(___adm/$LONCAPA::domain_re/$LONCAPA::username_re)/(\d+)/bulletinboard$#) {                  my $ressymb = $symb;
                 $ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard';                  if ($symb =~ m#(___adm/$LONCAPA::domain_re/$LONCAPA::username_re)/(\d+)/bulletinboard$#) {
                 unless ($ressymb =~ m#bulletin___\d+___adm/wrapper#) {                      $ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard';
                     $ressymb=~s#(bulletin___\d+___)#$1adm/wrapper/#;                      unless ($ressymb =~ m#bulletin___\d+___adm/wrapper#) {
                           $ressymb=~s#(bulletin___\d+___)#$1adm/wrapper/#;
                       }
                 }                  }
             }                  if (defined($discussiontime{$ressymb})) { 
             if (defined($discussiontime{$ressymb})) {                       my %contrib = &Apache::lonnet::restore($ressymb,$env{'request.course.id'},
                 my %contrib = &Apache::lonnet::restore($ressymb,$env{'request.course.id'},                           $env{'course.'.$env{'request.course.id'}.'.domain'},
                      $env{'course.'.$env{'request.course.id'}.'.domain'},                           $env{'course.'.$env{'request.course.id'}.'.num'});
                      $env{'course.'.$env{'request.course.id'}.'.num'});                      if ($contrib{'version'}) {
                 if ($contrib{'version'}) {                          for (my $id=1;$id<=$contrib{'version'};$id++) {
                     for (my $id=1;$id<=$contrib{'version'};$id++) {                              unless (($contrib{'hidden'}=~/\.$id\./) || ($contrib{'deleted'}=~/\.$id\./)) { 
                         unless (($contrib{'hidden'}=~/\.$id\./) || ($contrib{'deleted'}=~/\.$id\./)) {                                   if ($contrib{$id.':subject'}) {
                             if ($contrib{$id.':subject'}) {                                      $result .= $contrib{$id.':subject'};
                                 $result .= $contrib{$id.':subject'};  
                             }  
                             if ($contrib{$id.':message'}) {  
                                 $result .= $contrib{$id.':message'};  
                             }  
                             if ($contrib{$id,':attachmenturl'}) {  
                                 if ($contrib{$id,':attachmenturl'} =~ m-/([^/]+)$-) {  
                                     $result .= $1;  
                                 }                                  }
                                   if ($contrib{$id.':message'}) {
                                       $result .= $contrib{$id.':message'};
                                   }
                                   if ($contrib{$id,':attachmenturl'}) {
                                       if ($contrib{$id,':attachmenturl'} =~ m-/([^/]+)$-) {
                                           $result .= $1;
                                       }
                                   }
                                   $applies = &checkwords($result,$applies,@allwords);
                             }                              }
                             $applies = &checkwords($result,$applies,@allwords);  
                         }                          }
                     }                      }
                 }                  }
             }  
 # Does this discussion apply?  # Does this discussion apply?
             if ($applies) {                  if ($applies) {
                 my ($map,$ind,$url)=&Apache::lonnet::decode_symb($ressymb);                      my ($map,$ind,$url)=&Apache::lonnet::decode_symb($ressymb);
                 my $disctype = &mt('resource');                      my $disctype = &mt('resource');
                 if ($url =~ m#/bulletinboard$#) {                      if ($url =~ m#/bulletinboard$#) {
                     if ($url =~m#^adm/wrapper/adm/.*/bulletinboard$#) {                          if ($url =~m#^adm/wrapper/adm/.*/bulletinboard$#) {
                         $url =~s#^adm/wrapper##;                              $url =~s#^adm/wrapper##;
                           }
                           $disctype = &mt('discussion board');
                       } else {
                           $url = '/res/'.$url;
                     }                      }
                     $disctype = &mt('bulletin board');                      if ($url =~ /\?/) {
                 } else {                          $url .= '&symb=';
                     $url = '/res/'.$url;                      } else {
                 }                          $url .= '?symb=';
                 if ($url =~ /\?/) {                      }
                     $url .= '&symb=';                      $url .= &escape($resource->symb());
                       my $title = $resource->compTitle();
                       $r->print('<br /><a href="'.$url.'" target="cat">'.
                            ($title?$title:$url).'</a>&nbsp;&nbsp;-&nbsp;'.
                            $disctype.'<br />');
                       $totaldiscussions++;
                 } else {                  } else {
                     $url .= '?symb=';                      $r->print(' .');
                 }                  }
                 $url .= &escape($resource->symb());  
                 my $title = $resource->compTitle();  
                 $r->print('<br /><a href="'.$url.'" target="cat">'.  
                      ($title?$title:$url).'</a>&nbsp;&nbsp;-&nbsp;'.$disctype.'<br />');  
                 $totaldiscussions++;  
             } else {  
                 $r->print(' .');  
             }              }
         }              unless ($totaldiscussions) {
         unless ($totaldiscussions) {                  $r->print('<p>'.&mt('No matches found in postings').'.</p>');
             $r->print('<p>'.&mt('No matches found in postings').'.</p>');              }
           } else {
               $r->print('<div class="LC_error">'.&mt('An error occurred retrieving information about resources in the course.').'<br />'.&mt('It is recommended that you [_1]re-initialize the course[_2] and then try your search again.','<a href="/adm/roles">','</a>').'</div>');
         }          }
     }      }
     
Line 685  sub print_basic_search_form { Line 690  sub print_basic_search_form {
     my $bread_crumb =      my $bread_crumb =
         &Apache::lonhtmlcommon::breadcrumbs('Searching','Search_Basic',          &Apache::lonhtmlcommon::breadcrumbs('Searching','Search_Basic',
     $env{'form.catalogmode'} ne 'import');      $env{'form.catalogmode'} ne 'import');
     my $scrout = &Apache::loncommon::start_page('Search').$bread_crumb;      my $scrout = &Apache::loncommon::start_page('Content Library').$bread_crumb;
 # Search form for resource space   # Search form for resource space 
     if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'})) {      if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'})) {
         $scrout .= &setup_basic_search($r,'res',$hidden_fields,$closebutton);          $scrout .= &setup_basic_search($r,'res',$hidden_fields,$closebutton);
Line 699  sub print_basic_search_form { Line 704  sub print_basic_search_form {
  'note' => 'Enter terms or phrases, then press "Search" below',   'note' => 'Enter terms or phrases, then press "Search" below',
  'use' => 'use related words',   'use' => 'use related words',
  'full' =>'fulltext search (time consuming)',   'full' =>'fulltext search (time consuming)',
          'disc' => 'search discussion postings (resources and bulletin boards)',           'disc' => 'search discussion postings (resources and discussion boards)',
    );     );
         $scrout.=(<<ENDCOURSESEARCH);          $scrout.=(<<ENDCOURSESEARCH);
 <form name="loncapa_search" method="post" action="/adm/searchcat">  <form name="loncapa_search" method="post" action="/adm/searchcat">
Line 2243  sub print_sort_form { Line 2248  sub print_sort_form {
 </script>  </script>
 END  END
   
     my $start_page = &Apache::loncommon::start_page('Results',$js,      my $start_page = &Apache::loncommon::start_page('Results',$js);
     {'no_title' => 1});  
     my $breadcrumbs=      my $breadcrumbs=
         &Apache::lonhtmlcommon::breadcrumbs('Searching','Searching',          &Apache::lonhtmlcommon::breadcrumbs('Searching','Searching',
     $env{'form.catalogmode'} ne 'import');      $env{'form.catalogmode'} ne 'import');
Line 2482  sub run_search { Line 2486  sub run_search {
     #      #
     # Print run_search header      # Print run_search header
     #      #
     my $start_page = &Apache::loncommon::start_page('Search Status',undef,      my $start_page = &Apache::loncommon::start_page('Search Status',undef);
     {'no_title' => 1});  
     my $breadcrumbs =      my $breadcrumbs =
  &Apache::lonhtmlcommon::breadcrumbs('Searching','Searching',   &Apache::lonhtmlcommon::breadcrumbs('Searching','Searching',
     $env{'form.catalogmode'} ne 'import');      $env{'form.catalogmode'} ne 'import');
Line 3556  sub compact_view { Line 3559  sub compact_view {
     my $link = &display_url($jumpurl,[1,1,1]);      my $link = &display_url($jumpurl,[1,1,1]);
           
     my $result =       my $result = 
         $prefix.'<img src="'.&Apache::loncommon::icon($values{'url'}).'">';          $prefix.'<img src="'.&Apache::loncommon::icon($values{'url'}).'" alt="" />';
     if (exists($env{'form.sortfield'}) &&       if (exists($env{'form.sortfield'}) && 
         $env{'form.sortfield'} !~ /^(default|author|url|title)$/) {          $env{'form.sortfield'} !~ /^(default|author|url|title)$/) {
         my $tmp = $values{$env{'form.sortfield'}};          my $tmp = $values{$env{'form.sortfield'}};

Removed from v.1.302  
changed lines
  Added in v.1.307


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