[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonsearchcat.pm

raeburn raeburn at source.lon-capa.org
Mon Jan 7 17:20:58 EST 2013


raeburn		Mon Jan  7 22:20:58 2013 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonsearchcat.pm 
  Log:
  - For 2.11
    - Backport 1.332, 1.333.
  
  
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.331.4.3 loncom/interface/lonsearchcat.pm:1.331.4.4
--- loncom/interface/lonsearchcat.pm:1.331.4.3	Mon Dec 17 13:54:25 2012
+++ loncom/interface/lonsearchcat.pm	Mon Jan  7 22:20:58 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Catalog
 #
-# $Id: lonsearchcat.pm,v 1.331.4.3 2012/12/17 13:54:25 raeburn Exp $
+# $Id: lonsearchcat.pm,v 1.331.4.4 2013/01/07 22:20:58 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1781,14 +1781,14 @@
     if ((defined($cafter)  && ! defined($cbefore)) ||
         (defined($cbefore) && ! defined($cafter))) {
         # 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.');
     }
     if (! defined($error) && 
         ((defined($mafter)  && ! defined($mbefore)) ||
         (defined($mbefore) && ! defined($mafter)))) {
         # 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.');
     }
     if (! defined($error)) {
@@ -1915,9 +1915,12 @@
     ##
     my $connection_result = &Apache::lonmysql::connect_to_db();
     if (!defined($connection_result)) {
-        $r->print("Unable to connect to the MySQL database where your results".
-                  " are saved.".
-		  &Apache::loncommon::end_page());
+        $r->print(
+            '<p class="LC_error">'
+           .&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".
                                  " connect to database.");
         &Apache::lonnet::logthis(&Apache::lonmysql::get_error());
@@ -1925,13 +1928,20 @@
     }
     my $table_check = &Apache::lonmysql::check_table($table);
     if (! defined($table_check)) {
-        $r->print("A MySQL error has occurred.</form>".
-		  &Apache::loncommon::end_page());
+        $r->print(
+            '<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".
                                  " of table ".$table);
         return undef;
     } 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.
                                  ", that could not be found.");
         return undef;
@@ -3157,6 +3167,28 @@
 ######################################################################
 ######################################################################
 
+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 
 
 =item Metadata Viewing Functions
@@ -3181,16 +3213,14 @@
     my $result;
     my $jumpurl=$values{'url'};
     $jumpurl=~s|^/ext/|http://|;
-    $result .= '<b>'.$prefix.
+    $result .=
+        '<b>'.$prefix.
         '<img src="'.&Apache::loncommon::icon($values{'url'}).'" alt="" />'.' '.
         '<a href="'.$jumpurl.'?inhibitmenu=yes" '.
         'target="preview">'.$values{'title'}."</a></b>\n".
-        '<a href="javascript:;" onclick="set_wishlistlink('."'$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>';
-    $result .= "<p>\n";
-    $result .= '<b>'.$values{'author'}.'</b>,'.
+        &display_tools($values{'title'}, $jumpurl).
+        "<p>\n".
+        '<b>'.$values{'author'}.'</b>,'.
         ' <i>'.$values{'owner'}.'</i><br />';
     foreach my $field 
         (
@@ -3318,16 +3348,10 @@
     my $jumpurl=$values{'url'};
     $jumpurl=~s|^/ext/|http://|;
     my $link = '<br />'.&display_url($jumpurl,1).'<br />';
-
-    my $titleWL = &mt('Set link to wishlist');
-    $result.=<<END;
-<a href="$jumpurl?inhibitmenu=yes" 
-   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>
+    $result .=
+        '<a href="'.$jumpurl.'?inhibitmenu=yes"'.
+        ' target="preview">'.$values{'title'}.'</a>'.
+        &display_tools($values{'title'}, $jumpurl).<<END;
 <br />
 $link<br />
 $values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}<br />
@@ -3374,11 +3398,7 @@
     $result.=' <span class="LC_nobreak">'.
 	'<a href="'.$jumpurl.'?inhibitmenu=yes" target="preview">'.
         &HTML::Entities::encode($values{'title'},'<>&"').'</a></span> '.
-        '<a href="javascript:;" onclick="set_wishlistlink('."'$values{'title'}','$jumpurl'".')" '.
-        'title="'.&mt('Add to stored links').'">'.
-        '<img class="LC_icon" src="/res/adm/pages/wishlist.png" '.
-        'alt="set wishlistlink" style="width:22px;"/>'.
-        '</a>'.
+        &display_tools($values{'title'}, $jumpurl).
 	$link.' <b>'.$values{'author'}.'</b> ('.$values{'domain'}.')';
     return $result;
 }
@@ -3420,20 +3440,16 @@
     my $jumpurl=$values{'url'};
     $jumpurl=~s|^/ext/|http://|;
 
-    my $titleWL = &mt('Add to stored links');
     my $result=<<END;
 $prefix <img src="$icon" alt="" />
 <dl>
 <dt>URL:</dt>
     <dd><a href="$jumpurl?inhibitmenu=yes" 
          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
+    $result .=
+        &display_tools($values{'title'}, $jumpurl).'
+    </dd>';
     foreach my $field ('title','author','domain','subject','keywords','notes',
                        'mimetag','language','creationdate','lastrevisiondate',
                        'owner','copyrighttag','hostname','abstract') {




More information about the LON-CAPA-cvs mailing list