[LON-CAPA-cvs] cvs: loncom /interface lonfeedback.pm lonmsg.pm

www lon-capa-cvs@mail.lon-capa.org
Fri, 12 Nov 2004 16:22:49 -0000


This is a MIME encoded message

--www1100276569
Content-Type: text/plain

www		Fri Nov 12 11:22:49 2004 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm lonmsg.pm 
  Log:
  Saving my work: cleanup
  
  
--www1100276569
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20041112112249.txt"

Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.130 loncom/interface/lonfeedback.pm:1.131
--- loncom/interface/lonfeedback.pm:1.130	Thu Nov 11 17:47:55 2004
+++ loncom/interface/lonfeedback.pm	Fri Nov 12 11:22:48 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.130 2004/11/11 22:47:55 albertel Exp $
+# $Id: lonfeedback.pm,v 1.131 2004/11/12 16:22:48 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2189,8 +2189,6 @@
 sub assemble_email {
   my ($feedurl,$message,$prevattempts,$usersaw,$useranswer)=@_;
   my $email=<<"ENDEMAIL";
-Refers to <a href="$feedurl">$feedurl</a>
-
 $message
 ENDEMAIL
     my $citations=<<"ENDCITE";
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.114 loncom/interface/lonmsg.pm:1.115
--- loncom/interface/lonmsg.pm:1.114	Thu Nov 11 15:41:53 2004
+++ loncom/interface/lonmsg.pm	Fri Nov 12 11:22:48 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.114 2004/11/11 20:41:53 www Exp $
+# $Id: lonmsg.pm,v 1.115 2004/11/12 16:22:48 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1028,6 +1028,7 @@
     my $dispcrit='';
     my $dissub='';
     my $dismsg='';
+    my $disbase='';
     my $func=&mt('Send New');
     my %lt=&Apache::lonlocal::texthash('us' => 'Username',
 				       'do' => 'Domain',
@@ -1057,6 +1058,9 @@
 	$dissub=&mt('Forwarding').': '.$content{'subject'};
 	$dismsg=&mt('Forwarded message from').' '.
 	    $content{'sendername'}.' '.&mt('at').' '.$content{'senderdomain'};
+	if ($content{'baseurl'}) {
+	    $disbase='<input type="hidden" name="baseurl" value="'.&Apache::lonnet::escape($content{'baseurl'}).'" />';
+	}
     }
     if ($replying) {
 	%message=&Apache::lonnet::get('nohist_email',[$replying]);
@@ -1070,6 +1074,12 @@
 	$dismsg=~s/\r/\n/g;
 	$dismsg=~s/\f/\n/g;
 	$dismsg=~s/\n+/\n\> /g;
+	if ($content{'baseurl'}) {
+	    $disbase='<input type="hidden" name="baseurl" value="'.&Apache::lonnet::escape($content{'baseurl'}).'" />';
+	    if ($ENV{'user.adv'}) {
+		$disbase='<input type="checkbox" name="storebasecomment" />'.&mt('Store message for re-use').'<br />';
+	    }
+	}
     }
     my $citation=&displayresource(%content);
     if ($ENV{'form.recdom'}) { $defdom=$ENV{'form.recdom'}; }
@@ -1111,6 +1121,7 @@
 <textarea name="message" cols="80" rows="15" wrap="hard">$dismsg
 </textarea></p><br />
 $dispcrit
+$disbase
 <input type="submit" name="send" value="$func $lt{'ma'}" />
 <input type="submit" name="cancel" value="$lt{'ca'}" /><hr />
 $citation
@@ -1735,6 +1746,8 @@
 	      ($content{'courseid'}?'<br /><b>'.&mt('Course').':</b> '.$courseinfo{'description'}.
 	       ($content{'coursesec'}?' ('.&mt('Group/Section').': '.$content{'coursesec'}.')':''):'').
 	      '<br /><b>'.&mt('Time').':</b> '.$content{'time'}.
+	      ($content{'baseurl'}?'<br /><b>'.&mt('Refers to').':</b> <a href="'.$content{'baseurl'}.'">'.
+	       $content{'baseurl'}.' ('.&Apache::lonnet::gettitle($content{'baseurl'}).')</a>':'').
 	      '<p><pre>'.
 	      &Apache::lontexconvert::msgtexconverted($content{'message'},1).
 	      '</pre><hr />'.&displayresource(%content).'</p>');
@@ -1800,6 +1813,102 @@
     &header($r,$title,$baseurl);
 }
 
+# ---------------------------------------------------------------- Send an email
+
+sub sendoffmail {
+    my ($r)=@_;
+    my $sendstatus='';
+    if ($ENV{'form.send'}) {
+	&printheader($r,'','Messages being sent.');
+	$r->rflush();
+	my %content=();
+	undef %content;
+	if ($ENV{'form.forwid'}) {
+	    my $msgid=$ENV{'form.forwid'};
+	    my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
+	    %content=&unpackagemsg($message{$msgid},1);
+	    &statuschange($msgid,'forwarded');
+	    $ENV{'form.message'}.="\n\n-- Forwarded message --\n\n".
+		$content{'message'};
+	}
+	if ($ENV{'form.replyid'}) {
+	    my $msgid=$ENV{'form.replyid'};
+	    my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
+	    %content=&unpackagemsg($message{$msgid},1);
+	    &statuschange($msgid,'replied');
+	}
+	my %toaddr=();
+	undef %toaddr;
+	if ($ENV{'form.sendmode'} eq 'group') {
+	    foreach (keys %ENV) {
+		if ($_=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) {
+		    $toaddr{$1}='';
+		}
+	    }
+	} elsif ($ENV{'form.sendmode'} eq 'upload') {
+	    foreach (split(/[\n\r\f]+/,$ENV{'form.upfile'})) {
+		my ($rec,$txt)=split(/\s*\:\s*/,$_);
+		if ($txt) {
+		    $rec=~s/\@/\:/;
+		    $toaddr{$rec}.=$txt."\n";
+		}
+	    }
+	} else {
+	    $toaddr{$ENV{'form.recuname'}.':'.$ENV{'form.recdomain'}}='';
+	}
+	if ($ENV{'form.additionalrec'}) {
+	    foreach (split(/\,/,$ENV{'form.additionalrec'})) {
+		my ($auname,$audom)=split(/\@/,$_);
+		$toaddr{$auname.':'.$audom}='';
+	    }
+	}
+	
+	foreach (keys %toaddr) {
+	    my ($recuname,$recdomain)=split(/\:/,$_);
+	    my $msgtxt=&Apache::lonfeedback::clear_out_html($ENV{'form.message'});
+	    if ($toaddr{$_}) { $msgtxt.='<hr />'.$toaddr{$_}; }
+	    my $thismsg;    
+	    if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) && 
+		(&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
+		$r->print(&mt('Sending critical message').' '.$recuname.'@'.$recdomain.': ');
+		$thismsg=&user_crit_msg($recuname,$recdomain,
+					&Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
+					$msgtxt,
+					$ENV{'form.sendbck'});
+	    } else {
+		$r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': ');
+		$thismsg=&user_normal_msg($recuname,$recdomain,
+					  &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
+					  $msgtxt,
+					  $content{'citation'});
+		if (($ENV{'request.course.id'}) && ($ENV{'form.sendmode'} eq 'group')) {
+		    &user_normal_msg_raw(
+					 $ENV{'course.'.$ENV{'request.course.id'}.'.num'},
+					 $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
+					 'Broadcast ['.$recuname.':'.$recdomain.']',
+					 $msgtxt);
+		}
+	    }
+	    $r->print($thismsg.'<br />');
+	    $sendstatus.=' '.$thismsg;
+	}
+    } else {
+	&printheader($r,'','No messages sent.'); 
+    }
+    if ($sendstatus=~/^(\s*(?:ok|con_delayed)\s*)*$/) {
+	$r->print('<br /><font color="green">'.&mt('Completed.').'</font>');
+	if ($ENV{'form.displayedcrit'}) {
+	    &discrit($r);
+	} else {
+	    &Apache::loncommunicate::menu($r);
+	}
+    } else {
+	$r->print(
+		  '<h2><font color="red">'.&mt('Could not deliver message').'</font></h2>'.
+		  &mt('Please use the browser "Back" button and correct the recipient addresses')
+		  );
+    }
+}
 
 # ===================================================================== Handler
 
@@ -1915,97 +2024,7 @@
     } elsif ($ENV{'form.block'}) {
         &examblock($r,$ENV{'form.block'});
     } elsif ($ENV{'form.sendmail'}) {
-	my $sendstatus='';
-	if ($ENV{'form.send'}) {
-	    &printheader($r,'','Messages being sent.');
-	    $r->rflush();
-	    my %content=();
-	    undef %content;
-	    if ($ENV{'form.forwid'}) {
-		my $msgid=$ENV{'form.forwid'};
-		my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
-		%content=&unpackagemsg($message{$msgid},1);
-		&statuschange($msgid,'forwarded');
-		$ENV{'form.message'}.="\n\n-- Forwarded message --\n\n".
-		    $content{'message'};
-	    }
-	    if ($ENV{'form.replyid'}) {
-		my $msgid=$ENV{'form.replyid'};
-		my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
-		%content=&unpackagemsg($message{$msgid},1);
-		&statuschange($msgid,'replied');
-	    }
-	    my %toaddr=();
-	    undef %toaddr;
-	    if ($ENV{'form.sendmode'} eq 'group') {
-		foreach (keys %ENV) {
-		    if ($_=~/^form\.send\_to\_\&\&\&[^\&]*\&\&\&\_(.+)$/) {
-			$toaddr{$1}='';
-		    }
-		}
-	    } elsif ($ENV{'form.sendmode'} eq 'upload') {
-		foreach (split(/[\n\r\f]+/,$ENV{'form.upfile'})) {
-		    my ($rec,$txt)=split(/\s*\:\s*/,$_);
-		    if ($txt) {
-			$rec=~s/\@/\:/;
-			$toaddr{$rec}.=$txt."\n";
-		    }
-		}
-	    } else {
-		$toaddr{$ENV{'form.recuname'}.':'.$ENV{'form.recdomain'}}='';
-	    }
-	    if ($ENV{'form.additionalrec'}) {
-		foreach (split(/\,/,$ENV{'form.additionalrec'})) {
-		    my ($auname,$audom)=split(/\@/,$_);
-		    $toaddr{$auname.':'.$audom}='';
-		}
-	    }
-
-	    foreach (keys %toaddr) {
-		my ($recuname,$recdomain)=split(/\:/,$_);
-		my $msgtxt=&Apache::lonfeedback::clear_out_html($ENV{'form.message'});
-		if ($toaddr{$_}) { $msgtxt.='<hr />'.$toaddr{$_}; }
-		my $thismsg;    
-		if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) && 
-		    (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
-		    $r->print(&mt('Sending critical message').' '.$recuname.'@'.$recdomain.': ');
-		    $thismsg=&user_crit_msg($recuname,$recdomain,
-						    &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
-						    $msgtxt,
-						    $ENV{'form.sendbck'});
-		} else {
-		    $r->print(&mt('Sending').' '.$recuname.'@'.$recdomain.': ');
-		    $thismsg=&user_normal_msg($recuname,$recdomain,
-						      &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
-						      $msgtxt,
-						      $content{'citation'});
-                    if (($ENV{'request.course.id'}) && ($ENV{'form.sendmode'} eq 'group')) {
-                        &user_normal_msg_raw(
-                        $ENV{'course.'.$ENV{'request.course.id'}.'.num'},
-                        $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
-                        'Broadcast ['.$recuname.':'.$recdomain.']',
-                        $msgtxt);
-                    }
-		}
-		$r->print($thismsg.'<br />');
-		$sendstatus.=' '.$thismsg;
-	    }
-	} else {
-	    &printheader($r,'','No messages sent.'); 
-	}
-	if ($sendstatus=~/^(\s*(?:ok|con_delayed)\s*)*$/) {
-	    $r->print('<br /><font color="green">'.&mt('Completed.').'</font>');
-	    if ($ENV{'form.displayedcrit'}) {
-		&discrit($r);
-	    } else {
-		&Apache::loncommunicate::menu($r);
-	    }
-	} else {
-	    $r->print(
-		      '<h2><font color="red">'.&mt('Could not deliver message').'</font></h2>'.
-		      &mt('Please use the browser "Back" button and correct the recipient addresses')
-		      );
-	}
+	&sendoffmessage($r);
     } elsif ($ENV{'form.newfolder'}) {
 	&printheader($r,'','New Folder');
 	&makefolder($ENV{'form.newfolder'});

--www1100276569--