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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 10 May 2006 22:29:58 -0000


albertel		Wed May 10 18:29:58 2006 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  - convert to use radiobutton to select feedback destination
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.201 loncom/interface/lonfeedback.pm:1.202
--- loncom/interface/lonfeedback.pm:1.201	Tue May  9 16:54:55 2006
+++ loncom/interface/lonfeedback.pm	Wed May 10 18:29:57 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.201 2006/05/09 20:54:55 albertel Exp $
+# $Id: lonfeedback.pm,v 1.202 2006/05/10 22:29:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1455,35 +1455,21 @@
 //<!--
     function gosubmit() {
         var rec=0;
-        if (typeof(document.mailform.elements.author)!="undefined") {
-          if (document.mailform.elements.author.checked) {
-             rec=1;
-          } 
-        }
-        if (typeof(document.mailform.elements.question)!="undefined") {
-          if (document.mailform.elements.question.checked) {
-             rec=1;
-          } 
-        }
-        if (typeof(document.mailform.elements.course)!="undefined") {
-          if (document.mailform.elements.course.checked) {
-             rec=1;
-          } 
-        }
-        if (typeof(document.mailform.elements.policy)!="undefined") {
-          if (document.mailform.elements.policy.checked) {
-             rec=1;
-          } 
-        }
         if (typeof(document.mailform.elements.discuss)!="undefined") {
-	  // anon versus nonanon discussion
-          if (document.mailform.elements.discuss[0].checked 
-	      || document.mailform.elements.discuss[1].checked) {
-             rec=1;
-          } 
-        }
+	    if (typeof(document.mailform.discuss.length) == "undefined") {
+		if (document.mailform.discuss.checked ) {
+		    rec=1;
+		}
+	    } else {
+		for (var i=0; i<document.mailform.discuss.length; i++) {
+		    if (document.mailform.discuss[i].checked ) {
+			rec=1;
+		    } 
+		}
+	    }
+	}
         if (typeof(document.mailform.elements.blog)!="undefined") {
-          if (document.mailform.elements.blog.checked) {
+          if (document.mailform.blog.checked) {
              rec=1;
           } 
         }
@@ -2276,23 +2262,23 @@
     unless (($env{'form.replydisc'}) || ($env{'form.editdisc'})) {
 	if (($feedurl=~/^\/res\//) && ($feedurl!~/^\/res\/adm/) && ($env{'user.adv'})) {
 	    $msgoptions= 
-		'<p><label><input type="checkbox" name="author" /> '.
+		'<p><label><input type="radio" name="discuss" value="author" /> '.
 		&mt('Feedback to resource author').'</label></p>';
 	}
 	if (&feedback_available(1)) {
 	    $msgoptions.=
-		'<p><label><input type="checkbox" name="question" /> '.
+		'<p><label><input type="radio" name="discuss" value="question" /> '.
 		&mt('Question about resource content').'</label></p>';
 	}
 	if (&feedback_available(0,1)) {
 	    $msgoptions.=
-		'<p><label><input type="checkbox" name="course" /> '.
+		'<p><label><input type="radio" name="discuss" value="course" /> '.
 		&mt('Question/Comment/Feedback about course content').
 		'</label></p>';
 	}
 	if (&feedback_available(0,0,1)) {
 	    $msgoptions.=
-		'<p><label><input type="checkbox" name="policy" /> '.
+		'<p><label><input type="radio" name="discuss" value="policy" /> '.
 		&mt('Question/Comment/Feedback about course policy').
 		'</label></p>';
 	}
@@ -2428,13 +2414,13 @@
   my ($feedurl,$author,$question,$course,$policy,$defaultflag) = @_;
   my $typestyle='';
   my %to=();
-  if ($env{'form.author'}||$author) {
+  if ($env{'form.discuss'} eq 'author' ||$author) {
     $typestyle.='Submitting as Author Feedback<br />';
     $feedurl=~/^\/res\/(\w+)\/(\w+)\//;
     $to{$2.':'.$1}=1;
   }
-  if ($env{'form.question'}||$question) {
-    $typestyle.='Submitting as Question<br />';
+  if ($env{'form.discuss'} eq 'question' ||$question) {
+    $typestyle.=&mt('Submitting as Question').'<br />';
     foreach (split(/\,/,
 		   $env{'course.'.$env{'request.course.id'}.'.question.email'})
 	     ) {
@@ -2442,8 +2428,8 @@
         if ($rec) { $to{$rec}=1; }
     } 
   }
-  if ($env{'form.course'}||$course) {
-    $typestyle.='Submitting as Comment<br />';
+  if ($env{'form.discuss'} eq 'course' ||$course) {
+    $typestyle.=&mt('Submitting as Comment').'<br />';
     foreach (split(/\,/,
 		   $env{'course.'.$env{'request.course.id'}.'.comment.email'})
 	     ) {
@@ -2451,8 +2437,8 @@
         if ($rec) { $to{$rec}=1; }
     } 
   }
-  if ($env{'form.policy'}||$policy) {
-    $typestyle.='Submitting as Policy Feedback<br />';
+  if ($env{'form.discuss'} eq 'policy' ||$policy) {
+    $typestyle.=&mt('Submitting as Policy Feedback').'<br />';
     foreach (split(/\,/,
 		   $env{'course.'.$env{'request.course.id'}.'.policy.email'})
 	     ) {
@@ -3430,7 +3416,8 @@
 # Discussion? Store that.
 
       my $numpost=0;
-      if ($env{'form.discuss'} || $env{'form.anondiscuss'}) {
+      if ($env{'form.discuss'} =~/^(?:non|)anon$/ 
+	  || $env{'form.anondiscuss'}) {
 	  my $subject = &clear_out_html($env{'form.subject'},undef,1);
 	  my $anonmode=($env{'form.discuss'} eq 'anon' || $env{'form.anondiscuss'} );
 	  $typestyle.=&adddiscuss($symb,$message,$anonmode,$attachmenturl,