[LON-CAPA-cvs] cvs: loncom /interface lonsearchcat.pm
bisitz
bisitz at source.lon-capa.org
Fri Dec 7 13:16:34 EST 2012
bisitz Fri Dec 7 18:16:34 2012 EDT
Modified files:
/loncom/interface lonsearchcat.pm
Log:
- Added link to metadata for each resource in the search result lists. CCs an DCs have been missing this.
- New sub routine to display available tools (Stored Links and Metadata)
- Error messages: Added error style and internationalization
- Consistent wording
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.331 loncom/interface/lonsearchcat.pm:1.332
--- loncom/interface/lonsearchcat.pm:1.331 Fri Dec 9 01:04:27 2011
+++ loncom/interface/lonsearchcat.pm Fri Dec 7 18:16:33 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.331 2011/12/09 01:04:27 www Exp $
+# $Id: lonsearchcat.pm,v 1.332 2012/12/07 18:16:33 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -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('Set link to wishlist').'">'.
- '<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 = ('Set link to wishlist');
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