[LON-CAPA-cvs] cvs: loncom /html/res/adm/pages anot.png anot2.gif anot2.png /interface loncommon.pm lonmenu.pm doc/loncapafiles loncapafiles.lpml
tempelho
lon-capa-cvs-allow@mail.lon-capa.org
Thu, 11 Sep 2008 21:05:22 -0000
tempelho Thu Sep 11 17:05:22 2008 EDT
Added files:
/loncom/html/res/adm/pages anot2.gif anot2.png
Modified files:
/doc/loncapafiles loncapafiles.lpml
/loncom/html/res/adm/pages anot.png
/loncom/interface loncommon.pm lonmenu.pm
Log:
loncommom.pm: Inserted the functions clean_symb() and get_annotations() from adannotations.pm
lonmenu.pm: Fixed the Bug 1736: Check whether a user already made an annotation for the resource. In a case of an annotation, the icon is replaced by an other icon. This does not work with the remote control and the display option "buttons and text".
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.610 doc/loncapafiles/loncapafiles.lpml:1.611
--- doc/loncapafiles/loncapafiles.lpml:1.610 Fri Sep 5 13:43:32 2008
+++ doc/loncapafiles/loncapafiles.lpml Thu Sep 11 17:05:15 2008
@@ -2,7 +2,7 @@
"http://lpml.sourceforge.net/DTD/lpml.dtd">
<!-- loncapafiles.lpml -->
-<!-- $Id: loncapafiles.lpml,v 1.610 2008/09/05 17:43:32 raeburn Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.611 2008/09/11 21:05:15 tempelho Exp $ -->
<!--
@@ -6312,6 +6312,7 @@
<filenames>
anno.gif;
anot.gif;
+anot2.gif;
back.gif;
bchat.gif;
bkm.gif;
@@ -6418,6 +6419,7 @@
sprs.png;
vbkm.png;
anot.png;
+anot2.png;
blog.png;
chrt.png;
cprv.png;
Index: loncom/html/res/adm/pages/anot.png
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.684 loncom/interface/loncommon.pm:1.685
--- loncom/interface/loncommon.pm:1.684 Thu Sep 11 11:15:29 2008
+++ loncom/interface/loncommon.pm Thu Sep 11 17:05:19 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.684 2008/09/11 15:15:29 www Exp $
+# $Id: loncommon.pm,v 1.685 2008/09/11 21:05:19 tempelho Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -61,6 +61,7 @@
use Apache::lonmenu();
use Apache::lonenc();
use Apache::lonlocal;
+use Apache::lonnet();
use HTML::Entities;
use Apache::lonhtmlcommon();
use Apache::loncoursedata();
@@ -9467,6 +9468,44 @@
}
}
+# --- Get the symbolic name of a problem and the url
+sub get_symb {
+ my ($request,$silent) = @_;
+ (my $url=$env{'form.url'}) =~ s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
+ my $symb=($env{'form.symb'} ne '' ? $env{'form.symb'} : (&Apache::lonnet::symbread($url)));
+ if ($symb eq '') {
+ if (!$silent) {
+ $request->print("Unable to handle ambiguous references:$url:.");
+ return ();
+ }
+ }
+ &Apache::lonenc::check_decrypt(\$symb);
+ return ($symb);
+}
+
+# --------------------------------------------------------------Get annotation
+
+sub get_annotation {
+ my ($symb,$enc) = @_;
+
+ my $key = $symb;
+ if (!$enc) {
+ $key =
+ &Apache::lonnet::clutter((&Apache::lonnet::decode_symb($symb))[2]);
+ }
+ my %annotation=&Apache::lonnet::get('nohist_annotations',[$key]);
+ return $annotation{$key};
+}
+
+sub clean_symb {
+ my ($symb) = @_;
+
+ &Apache::lonenc::check_decrypt(\$symb);
+ my $enc = $env{'request.enc'};
+ delete($env{'request.enc'});
+
+ return ($symb,$enc);
+}
=pod
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.242 loncom/interface/lonmenu.pm:1.243
--- loncom/interface/lonmenu.pm:1.242 Thu Sep 11 09:30:59 2008
+++ loncom/interface/lonmenu.pm Thu Sep 11 17:05:19 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.242 2008/09/11 13:30:59 raeburn Exp $
+# $Id: lonmenu.pm,v 1.243 2008/09/11 21:05:19 tempelho Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -514,9 +514,20 @@
c&8&2
s&8&3&prt.gif&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
s&9&1&sbkm.gif&set[_1]&bookmark[_2]&set_bookmark()&Set a bookmark for this resource&&1
-s&9&3&anot.gif&anno-[_1]&tations[_1]&annotate()&Make notes and annotations about this resource&&1
ENDMENUITEMS
+my $currentURL = &Apache::loncommon::get_symb();
+my ($symb_old,$symb_old_enc) = &Apache::loncommon::clean_symb($currentURL);
+my $annotation = &Apache::loncommon::get_annotation($symb_old,$symb_old_enc);
+$menuitems.="s&9&3&";
+if(length($annotation) > 0){
+ $menuitems.="anot2.gif";
+}else{
+ $menuitems.="anot.gif";
+}
+$menuitems.="&anno-[_1]&tations[_1]&annotate()&";
+$menuitems.="Make notes and annotations about this resource&&1\n";
+
unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) {
if (!$env{'request.enc'}) {
$menuitems.=(<<ENDREALRES);