[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lonmsgdisplay.pm lonparmset.pm

www lon-capa-cvs@mail.lon-capa.org
Thu, 11 May 2006 19:04:33 -0000


This is a MIME encoded message

--www1147374273
Content-Type: text/plain

www		Thu May 11 15:04:33 2006 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lonmsgdisplay.pm lonparmset.pm 
  Log:
  Notification links
  
  
--www1147374273
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20060511150433.txt"

Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.368 loncom/interface/loncommon.pm:1.369
--- loncom/interface/loncommon.pm:1.368	Wed May 10 17:50:39 2006
+++ loncom/interface/loncommon.pm	Thu May 11 15:04:31 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.368 2006/05/10 21:50:39 albertel Exp $
+# $Id: loncommon.pm,v 1.369 2006/05/11 19:04:31 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -64,6 +64,7 @@
 use Apache::lonhtmlcommon();
 use Apache::loncoursedata();
 use Apache::lontexconvert();
+use LONCAPA;
 
 my $readit;
 
@@ -709,7 +710,7 @@
     my $timestamp = time;
     foreach my $datum (\$color,\$function,\$topic,\$component_help,\$faq,
 		       \$bug,\$origurl) {
-        $$datum = &Apache::lonnet::escape($$datum);
+        $$datum = &escape($$datum);
     }
     if (!$stayOnPage) {
          $link = "javascript:helpMenu('open')";
@@ -775,7 +776,7 @@
 				       $width,$height).' '.$template;
 	} else {
 	    my $help_text;
-	    $help_text=&Apache::lonnet::unescape($topic);
+	    $help_text=&unescape($topic);
 	    $template='<table><tr><td>'.
 		&help_open_topic($component_help,$help_text,$stayOnPage,
 				 $width,$height).'</td><td>'.$template.
@@ -803,7 +804,7 @@
     my $link='';
     my $template='';
     my $url=$Apache::lonnet::perlvar{'BugzillaHost'}.'enter_bug.cgi?product=LON-CAPA&bug_file_loc='.
-	&Apache::lonnet::escape($ENV{'REQUEST_URI'}).'&component='.$topic;
+	&escape($ENV{'REQUEST_URI'}).'&component='.$topic;
     if (!$stayOnPage)
     {
 	$link = "javascript:void(open('$url', 'Bugzilla', 'menubar=0,toolbar=1,scrollbars=1,width=$width,height=$height,resizable=yes'))";
@@ -2024,10 +2025,11 @@
 # ------------------------------------------------------------- Message Wrapper
 
 sub messagewrapper {
-    my ($link,$username,$domain)=@_;
+    my ($link,$username,$domain,$subject,$text)=@_;
     return 
         '<a href="/adm/email?compose=individual&'.
-        'recname='.$username.'&recdom='.$domain.'" '.
+        'recname='.$username.'&recdom='.$domain.
+	'&subject='.&escape($subject).'&text='.&escape($text).'" '.
         'title="'.&mt('Send message').'">'.$link.'</a>';
 }
 # --------------------------------------------------------------- Notes Wrapper
@@ -2394,7 +2396,7 @@
 	       } else {
 		  $value=$returnhash{$version.':'.$key};
 	       }
-	       $prevattempts.='<td>'.&Apache::lonnet::unescape($value).'&nbsp;</td>';   
+	       $prevattempts.='<td>'.&unescape($value).'&nbsp;</td>';   
 	    }
 	 }
       }
@@ -2406,7 +2408,7 @@
 	} else {
 	  $value=$lasthash{$key};
 	}
-	$value=&Apache::lonnet::unescape($value);
+	$value=&unescape($value);
 	if ($key =~/$regexp$/ && (defined &$gradesub)) {$value = &$gradesub($value)}
 	$prevattempts.='<td>'.$value.'&nbsp;</td>';
       }
@@ -2528,7 +2530,7 @@
 	if (!$symb) { $symb=$cursymb; }
     }
     if (!$symb) { $symb=&Apache::lonnet::symbread(); }
-    $symb=&Apache::lonnet::escape($symb);
+    $symb=&escape($symb);
     if ($target) { $target="target=\"$target\""; }
     return '<a href="/adm/grades?&command=submission&'.
 	'symb='.$symb.'&student='.$uname.
@@ -2574,7 +2576,7 @@
 	if (!$symb) { $symb=$cursymb; }
     }
     if (!$symb) { $symb=&Apache::lonnet::symbread(); }
-    $symb=&Apache::lonnet::escape($symb);
+    $symb=&escape($symb);
     if ($target) { $target="target=\"$target\""; }
     return '<a href="/adm/parmset?&command=set&'.
 	'symb='.$symb.'&uname='.$uname.
@@ -3311,7 +3313,7 @@
 		   $env{'environment.color.timestamp'},
 		   $function,$domain,$bgcolor);
 
-    $url = '/adm/css/'.&Apache::lonnet::escape($url).'.css';
+    $url = '/adm/css/'.&escape($url).'.css';
 
     my $result =
 	'<head>'.
@@ -3919,7 +3921,7 @@
                         $content{$tool}{$function} = $value;
                     }
                 } elsif ($entry eq 'groupname') {
-                    $content{$entry}=&Apache::lonnet::unescape($value);
+                    $content{$entry}=&unescape($value);
                 } elsif (($entry eq 'roles') || ($entry eq 'types') ||
                          ($entry eq 'sectionpick') || ($entry eq 'defpriv')) {
                     push(@{$content{$entry}},$value);
@@ -4106,7 +4108,7 @@
   # $Apache::lonxml::debug=1;
   foreach my $pair (split(/&/,$query)) {
     my ($name, $value) = split(/=/,$pair);
-    $name = &Apache::lonnet::unescape($name);
+    $name = &unescape($name);
     if (!defined($possible_names) || (grep {$_ eq $name} @$possible_names)) {
       $value =~ tr/+/ /;
       $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
@@ -4735,9 +4737,9 @@
     $Title  = '' if (! defined($Title));
     $xlabel = '' if (! defined($xlabel));
     $ylabel = '' if (! defined($ylabel));
-    $ValuesHash{$id.'.title'}    = &Apache::lonnet::escape($Title);
-    $ValuesHash{$id.'.xlabel'}   = &Apache::lonnet::escape($xlabel);
-    $ValuesHash{$id.'.ylabel'}   = &Apache::lonnet::escape($ylabel);
+    $ValuesHash{$id.'.title'}    = &escape($Title);
+    $ValuesHash{$id.'.xlabel'}   = &escape($xlabel);
+    $ValuesHash{$id.'.ylabel'}   = &escape($ylabel);
     $ValuesHash{$id.'.y_max_value'} = $Max;
     $ValuesHash{$id.'.NumBars'}  = $NumBars;
     $ValuesHash{$id.'.NumSets'}  = $NumSets;
@@ -4817,9 +4819,9 @@
     $ylabel = '' if (! defined($ylabel));
     my %ValuesHash = 
         (
-         $id.'.title'  => &Apache::lonnet::escape($Title),
-         $id.'.xlabel' => &Apache::lonnet::escape($xlabel),
-         $id.'.ylabel' => &Apache::lonnet::escape($ylabel),
+         $id.'.title'  => &escape($Title),
+         $id.'.xlabel' => &escape($xlabel),
+         $id.'.ylabel' => &escape($ylabel),
          $id.'.y_max_value'=> $Max,
          $id.'.labels'     => join(',',@$Xlabels),
          $id.'.PlotType'   => 'XY',
@@ -4914,9 +4916,9 @@
     $ylabel = '' if (! defined($ylabel));
     my %ValuesHash = 
         (
-         $id.'.title'  => &Apache::lonnet::escape($Title),
-         $id.'.xlabel' => &Apache::lonnet::escape($xlabel),
-         $id.'.ylabel' => &Apache::lonnet::escape($ylabel),
+         $id.'.title'  => &escape($Title),
+         $id.'.xlabel' => &escape($xlabel),
+         $id.'.ylabel' => &escape($ylabel),
          $id.'.labels' => join(',',@$Xlabels),
          $id.'.PlotType' => 'XY',
          $id.'.NumSets' => 2,
@@ -4988,7 +4990,7 @@
 sub chartlink {
     my ($linktext, $sname, $sdomain) = @_;
     my $link = '<a href="/adm/statistics?reportSelected=student_assessment'.
-        '&amp;SelectedStudent='.&Apache::lonnet::escape($sname.':'.$sdomain).
+        '&amp;SelectedStudent='.&escape($sname.':'.$sdomain).
         '&amp;chartoutputmode='.HTML::Entities::encode('html, with all links').
        '">'.$linktext.'</a>';
 }
@@ -5051,11 +5053,11 @@
                 if (ref($env{'form.'.$setting})) {
                     $stored_form = join(',',
                                         map {
-                                            &Apache::lonnet::escape($_);
+                                            &escape($_);
                                         } sort(@{$env{'form.'.$setting}}));
                 } else {
                     $stored_form = 
-                        &Apache::lonnet::escape($env{'form.'.$setting});
+                        &escape($env{'form.'.$setting});
                 }
                 # Determine if the array contents are the same.
                 if ($stored_form ne $env{$envname}) {
@@ -5089,7 +5091,7 @@
             } elsif ($type eq 'array') {
                 $env{'form.'.$setting} = [ 
                                            map { 
-                                               &Apache::lonnet::unescape($_); 
+                                               &unescape($_); 
                                            } split(',',$env{$envname})
                                            ];
             }
@@ -5162,7 +5164,7 @@
 sub escape_url {
     my ($url)   = @_;
     my @urlslices = split(/\//, $url,-1);
-    my $lastitem = &Apache::lonnet::escape(pop(@urlslices));
+    my $lastitem = &escape(pop(@urlslices));
     return join('/',@urlslices).'/'.$lastitem;
 }
 =pod
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.22 loncom/interface/lonmsgdisplay.pm:1.23
--- loncom/interface/lonmsgdisplay.pm:1.22	Mon May  1 15:37:33 2006
+++ loncom/interface/lonmsgdisplay.pm	Thu May 11 15:04:31 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging display
 #
-# $Id: lonmsgdisplay.pm,v 1.22 2006/05/01 19:37:33 albertel Exp $
+# $Id: lonmsgdisplay.pm,v 1.23 2006/05/11 19:04:31 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -901,7 +901,9 @@
     }
     my $citation=&displayresource(%content);
     if ($env{'form.recdom'}) { $defdom=$env{'form.recdom'}; }
-      $r->print(
+    if ($env{'form.text'}) { $dismsg=$env{'form.text'}; }
+    if ($env{'form.subject'}) { $dissub=$env{'form.subject'}; }
+    $r->print(
                 '<form action="/adm/email"  name="compemail" method="post"'.
                 ' enctype="multipart/form-data">'."\n".
                 '<input type="hidden" name="sendmail" value="on" />'."\n".
@@ -1902,7 +1904,7 @@
         ['display','replyto','forward','markread','markdel','markunread',
          'sendreply','compose','sendmail','critical','recname','recdom',
          'recordftf','sortedby','block','folder','startdis','interdis',
-	 'showcommentbaseurl','dismode','group']);
+	 'showcommentbaseurl','dismode','group','subject','text']);
     $sqs='&sortedby='.$env{'form.sortedby'};
 
 # ------------------------------------------------------ They checked for email
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.303 loncom/interface/lonparmset.pm:1.304
--- loncom/interface/lonparmset.pm:1.303	Thu May 11 13:38:44 2006
+++ loncom/interface/lonparmset.pm	Thu May 11 15:04:31 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.303 2006/05/11 17:38:44 www Exp $
+# $Id: lonparmset.pm,v 1.304 2006/05/11 19:04:31 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3306,15 +3306,18 @@
 	$issection='';
     }
     my $realm='<font color="red">'.&mt('All Resources').'</font>';
+    my $realmdescription=&mt('all resources'); 
     if ($middle=~/^(.+)\_\_\_\(all\)$/) {
 	$realm='<font color="green">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><font color="#aaaaaa" size="-2">('.$1.')</font></font>';
-    } elsif ($middle) {
+ 	$realmdescription=&mt('folder').' '.&Apache::lonnet::gettitle($1);
+   } elsif ($middle) {
 	my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle);
 	$realm='<font color="orange">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><font color="#aaaaaa" size="-2">('.$url.' in '.$map.' id: '.$id.')</font></font>';
+	$realmdescription=&mt('resource').' '.&Apache::lonnet::gettitle($middle);
     }
     my $what=$part.'.'.$name;
     return ($realm,$section,$name,$part,$typeflag,
-	    $what,$middle,$uname,$udom,$issection);
+	    $what,$middle,$uname,$udom,$issection,$realmdescription);
 }
 
 sub standard_parameter_names {
@@ -3380,7 +3383,7 @@
 	my %istype=();
 	foreach my $changed (reverse(sort(@changes))) {
             my $value=$parmlog{$id}{'logentry'}->{$changed};
-            my ($realm,$section,$parmname,$part,$typeflag,$what,$middle,$uname,$udom,$issection)=
+            my ($realm,$section,$parmname,$part,$typeflag,$what,$middle,$uname,$udom,$issection,$realmdescription)=
 		&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'});
 	    if ($typeflag) { $istype{$parmname}=$value; }
 	    if ($makenewrow) { $r->print($row_start); } else { $makenewrow=1; }
@@ -3410,13 +3413,17 @@
 	    }
 	    $r->print('</td>');
 	    if ($stillactive) {
+		my $title=&mt('Changed [_1]',&standard_parameter_names($parmname));
+                my $description=&mt('Changed [_1] for [_2] to [_3]',&standard_parameter_names($parmname),$realmdescription,
+				    (&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value));
 		if (($uname) && ($udom)) {
-		    $r->print('<td>Notify Link</td>');
+		    $r->print('<td>'.
+			      &Apache::loncommon::messagewrapper('Notify User',$uname,$udom,$title,$description).
+			      '</td>');
 		} else {
 		    $r->print('<td>'.
-			      &Apache::lonrss::course_blog_link
-			      ($id,
-			       'New Parameter','Set new parameter').'</td>');
+			      &Apache::lonrss::course_blog_link($id,$title,$description).
+			      '</td>');
 		}
 	    } else {
 		$r->print('<td>&nbsp;</td>');

--www1147374273--