Diff for /loncom/interface/lonsearchcat.pm between versions 1.331 and 1.331.4.6

version 1.331, 2011/12/09 01:04:27 version 1.331.4.6, 2013/08/13 13:27:38
Line 1781  sub build_date_queries { Line 1781  sub build_date_queries {
     if ((defined($cafter)  && ! defined($cbefore)) ||      if ((defined($cafter)  && ! defined($cbefore)) ||
         (defined($cbefore) && ! defined($cafter))) {          (defined($cbefore) && ! defined($cafter))) {
         # This is bad, so let them know          # This is bad, so let them know
         $error = &mt('Incorrect entry for the creation date.  '.          $error = &mt('Incorrect entry for the creation date. '.
                     'You must specify both the beginning and ending dates.');                      'You must specify both the beginning and ending dates.');
     }      }
     if (! defined($error) &&       if (! defined($error) && 
         ((defined($mafter)  && ! defined($mbefore)) ||          ((defined($mafter)  && ! defined($mbefore)) ||
         (defined($mbefore) && ! defined($mafter)))) {          (defined($mbefore) && ! defined($mafter)))) {
         # This is also bad, so let them know          # This is also bad, so let them know
         $error = &mt('Incorrect entry for the last revision date.  '.          $error = &mt('Incorrect entry for the last revision date. '.
                      'You must specify both the beginning and ending dates.');                       'You must specify both the beginning and ending dates.');
     }      }
     if (! defined($error)) {      if (! defined($error)) {
Line 1901  sub ensure_db_and_table { Line 1901  sub ensure_db_and_table {
     ## Sanity check the table id.      ## Sanity check the table id.
     ##      ##
     if (! defined($table) || $table eq '' || $table =~ /\D/ ) {      if (! defined($table) || $table eq '' || $table =~ /\D/ ) {
         $r->print(&Apache::loncommon::start_page(&mt('Error'))          $r->print(&Apache::loncommon::start_page('Error')
 . '<p>table: |'.$table.'|</p>' # SB  
                  .'<p class="LC_error">'                   .'<p class="LC_error">'
                  .&mt('Unable to retrieve search results. '                   .&mt('Unable to retrieve search results. '
                      .'Unable to determine the table results were saved in.')                       .'Unable to determine the table results were saved in.')
                    .'</p>'
                    . '<p>'.&mt('Internal info:').'</p>'
                    .'<pre>'.$table.'</pre>'
                  .&Apache::loncommon::end_page()                   .&Apache::loncommon::end_page()
         );          );
         return undef;          return undef;
Line 1915  sub ensure_db_and_table { Line 1917  sub ensure_db_and_table {
     ##      ##
     my $connection_result = &Apache::lonmysql::connect_to_db();      my $connection_result = &Apache::lonmysql::connect_to_db();
     if (!defined($connection_result)) {      if (!defined($connection_result)) {
         $r->print("Unable to connect to the MySQL database where your results".          $r->print(
                   " are saved.".              '<p class="LC_error">'
   &Apache::loncommon::end_page());             .&mt('Unable to connect to the MySQL database where your results are saved.')
              .'</p>'
              .&Apache::loncommon::end_page()
           );
         &Apache::lonnet::logthis("lonsearchcat: unable to get lonmysql to".          &Apache::lonnet::logthis("lonsearchcat: unable to get lonmysql to".
                                  " connect to database.");                                   " connect to database.");
         &Apache::lonnet::logthis(&Apache::lonmysql::get_error());          &Apache::lonnet::logthis(&Apache::lonmysql::get_error());
Line 1925  sub ensure_db_and_table { Line 1930  sub ensure_db_and_table {
     }      }
     my $table_check = &Apache::lonmysql::check_table($table);      my $table_check = &Apache::lonmysql::check_table($table);
     if (! defined($table_check)) {      if (! defined($table_check)) {
         $r->print("A MySQL error has occurred.</form>".          $r->print(
   &Apache::loncommon::end_page());              '<p class="LC_error">'
              .&mt('A MySQL error has occurred.')
              .'</p></form>'
              .&Apache::loncommon::end_page());
         &Apache::lonnet::logthis("lonmysql was unable to determine the status".          &Apache::lonnet::logthis("lonmysql was unable to determine the status".
                                  " of table ".$table);                                   " of table ".$table);
         return undef;          return undef;
     } elsif (! $table_check) {      } elsif (! $table_check) {
         $r->print("The table of results could not be found.");          $r->print(
               '<p class="LC_error">'
              .&mt('The table of results could not be found.')
              .'</p>'
           );
         &Apache::lonnet::logthis("The user requested a table, ".$table.          &Apache::lonnet::logthis("The user requested a table, ".$table.
                                  ", that could not be found.");                                   ", that could not be found.");
         return undef;          return undef;
Line 3157  sub evalfields { Line 3169  sub evalfields {
 ######################################################################  ######################################################################
 ######################################################################  ######################################################################
   
   sub display_tools {
       my ($title, $jumpurl) = @_;
       my $result;
       # Metadata
       $result.=
           &Apache::loncommon::modal_link(
               $jumpurl.'.meta?inhibitmenu=yes',
               '<img class="LC_icon" src="/res/adm/pages/catalog.png" alt="Info" />',
               500,500,'_blank',undef,&mt('Metadata'));
       # Stored Links
       $result.=
           ' <a href="javascript:;"'.
           ' onclick="set_wishlistlink('."'$title','$jumpurl'".')" '.
           'title="'.&mt('Save a link for this resource in your personal Stored Links repository').'">'.
           '<img class="LC_icon" src="/res/adm/pages/wishlist.png" '.
           'alt="Stored Links" style="width:22px;"/></a>';
       return $result;
   }
   
   ######################################################################
   ######################################################################
   
 =pod   =pod 
   
 =item Metadata Viewing Functions  =item Metadata Viewing Functions
Line 3181  sub detailed_citation_view { Line 3215  sub detailed_citation_view {
     my $result;      my $result;
     my $jumpurl=$values{'url'};      my $jumpurl=$values{'url'};
     $jumpurl=~s|^/ext/|http://|;      $jumpurl=~s|^/ext/|http://|;
     $result .= '<b>'.$prefix.      $result .=
           '<b>'.$prefix.
         '<img src="'.&Apache::loncommon::icon($values{'url'}).'" alt="" />'.'&nbsp;'.          '<img src="'.&Apache::loncommon::icon($values{'url'}).'" alt="" />'.'&nbsp;'.
         '<a href="'.$jumpurl.'?inhibitmenu=yes" '.          '<a href="'.$jumpurl.'?inhibitmenu=yes" '.
         'target="preview">'.$values{'title'}."</a></b>\n".          'target="preview">'.$values{'title'}."</a></b>\n".
         '<a href="javascript:;" onclick="set_wishlistlink('."'$values{'title'}','$jumpurl'".')" '.          &display_tools($values{'title'}, $jumpurl).
         'title="'.&mt('Set link to wishlist').'">'.          "<p>\n".
         '<img class="LC_icon" src="/res/adm/pages/wishlist.png" '.          '<b>'.$values{'author'}.'</b>,'.
         'alt="set wishlistlink" style="width:22px;"/></a>';  
     $result .= "<p>\n";  
     $result .= '<b>'.$values{'author'}.'</b>,'.  
         ' <i>'.$values{'owner'}.'</i><br />';          ' <i>'.$values{'owner'}.'</i><br />';
     foreach my $field       foreach my $field 
         (          (
Line 3318  sub summary_view { Line 3350  sub summary_view {
     my $jumpurl=$values{'url'};      my $jumpurl=$values{'url'};
     $jumpurl=~s|^/ext/|http://|;      $jumpurl=~s|^/ext/|http://|;
     my $link = '<br />'.&display_url($jumpurl,1).'<br />';      my $link = '<br />'.&display_url($jumpurl,1).'<br />';
       $result .=
     my $titleWL = &mt('Set link to wishlist');          '<a href="'.$jumpurl.'?inhibitmenu=yes"'.
     $result.=<<END;          ' target="preview">'.$values{'title'}.'</a>'.
 <a href="$jumpurl?inhibitmenu=yes"           &display_tools($values{'title'}, $jumpurl).<<END;
    target="preview">$values{'title'}</a>  
 <a href="javascript:;" onclick="set_wishlistlink('$values{'title'}','$jumpurl')"   
    title="$titleWL">  
    <img class="LC_icon" src="/res/adm/pages/wishlist.png"  
         alt="set wishlistlink" style="width:22px;"/>  
 </a>  
 <br />  <br />
 $link<br />  $link<br />
 $values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}<br />  $values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}<br />
Line 3374  sub compact_view { Line 3400  sub compact_view {
     $result.=' <span class="LC_nobreak">'.      $result.=' <span class="LC_nobreak">'.
  '<a href="'.$jumpurl.'?inhibitmenu=yes" target="preview">'.   '<a href="'.$jumpurl.'?inhibitmenu=yes" target="preview">'.
         &HTML::Entities::encode($values{'title'},'<>&"').'</a></span> '.          &HTML::Entities::encode($values{'title'},'<>&"').'</a></span> '.
         '<a href="javascript:;" onclick="set_wishlistlink('."'$values{'title'}','$jumpurl'".')" '.          &display_tools($values{'title'}, $jumpurl).
         'title="'.&mt('Set link to wishlist').'">'.  
         '<img class="LC_icon" src="/res/adm/pages/wishlist.png" '.  
         'alt="set wishlistlink" style="width:22px;"/>'.  
         '</a>'.  
  $link.' <b>'.$values{'author'}.'</b> ('.$values{'domain'}.')';   $link.' <b>'.$values{'author'}.'</b> ('.$values{'domain'}.')';
     return $result;      return $result;
 }  }
Line 3420  sub fielded_format_view { Line 3442  sub fielded_format_view {
     my $jumpurl=$values{'url'};      my $jumpurl=$values{'url'};
     $jumpurl=~s|^/ext/|http://|;      $jumpurl=~s|^/ext/|http://|;
   
     my $titleWL = ('Set link to wishlist');  
     my $result=<<END;      my $result=<<END;
 $prefix <img src="$icon" alt="" />  $prefix <img src="$icon" alt="" />
 <dl>  <dl>
 <dt>URL:</dt>  <dt>URL:</dt>
     <dd><a href="$jumpurl?inhibitmenu=yes"       <dd><a href="$jumpurl?inhibitmenu=yes" 
          target='preview'>$values{'url'}</a>           target='preview'>$values{'url'}</a>
          <a href="javascript:;" onclick="set_wishlistlink('$values{'title'}','$jumpurl')"  
             title="$titleWL">  
             <img class="LC_icon" src="/res/adm/pages/wishlist.png"  
             alt="set wishlistlink" style="width:22px;"/>  
          </a>  
     </dd>  
 END  END
       $result .=
           &display_tools($values{'title'}, $jumpurl).'
       </dd>';
     foreach my $field ('title','author','domain','subject','keywords','notes',      foreach my $field ('title','author','domain','subject','keywords','notes',
                        'mimetag','language','creationdate','lastrevisiondate',                         'mimetag','language','creationdate','lastrevisiondate',
                        'owner','copyrighttag','hostname','abstract') {                         'owner','copyrighttag','hostname','abstract') {
Line 3725  sub cleanup { Line 3743  sub cleanup {
   &Apache::lonnet::logthis('Failed cleanup searchcat: groupsearch_db');    &Apache::lonnet::logthis('Failed cleanup searchcat: groupsearch_db');
         }          }
     }      }
     &untiehash();  
     &Apache::lonmysql::disconnect_from_db();      &Apache::lonmysql::disconnect_from_db();
     return OK;      return OK;
 }  }

Removed from v.1.331  
changed lines
  Added in v.1.331.4.6


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