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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 09 May 2006 20:00:45 -0000


albertel		Tue May  9 16:00:45 2006 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  - blog posting setting is remebered when going to a from attachments screen
  - page headers added back to attachment screen
  - anon versus nonanon is a radiobutton now
  
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.197 loncom/interface/lonfeedback.pm:1.198
--- loncom/interface/lonfeedback.pm:1.197	Tue May  9 11:09:27 2006
+++ loncom/interface/lonfeedback.pm	Tue May  9 16:00:44 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.197 2006/05/09 15:09:27 albertel Exp $
+# $Id: lonfeedback.pm,v 1.198 2006/05/09 20:00:44 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -726,7 +726,7 @@
             if ($outputtarget ne 'tex') {
                 $discussion.=&generate_attachments_button('',$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,'',$mode);
                 if (@currnewattach > 0) {
-                    $newattachmsg .= '<b>New attachments</b><br />';
+                    $newattachmsg .= '<br /><b>New attachments</b><br />';
                     if (@currnewattach > 1) {
                         $newattachmsg .= '<ol>';
                         foreach my $item (@currnewattach) {
@@ -1328,12 +1328,15 @@
   my $attachnum = 0;
   my $anonchk = (<<END);
   function anonchk() {
-     if (document.mailform.anondiscuss.checked == true) {
-          document.attachment.anondiscuss.value = '1'
-     }
-     if (document.mailform.discuss.checked == true) {
-          document.attachment.discuss.value = '1'
-     }
+      if (document.mailform.discuss[0].checked) {
+	  document.attachment.discuss.value = 'nonanon';
+      }
+      if (document.mailform.discuss[1].checked) {
+	  document.attachment.discuss.value = 'anon';
+      }
+      if (document.mailform.blog.checked) {
+	  document.attachment.blog.value = 1;
+      }
      return
    }
 END
@@ -1341,13 +1344,16 @@
   if (exists($env{'form.origpage'})) {
       $anonscript = (<<END);
   function setposttype() {
-      var anondisc = $env{'form.anondiscuss'};
-      var disc = $env{'form.discuss'};
-      if (anondisc == 1) {
-          document.mailform.anondiscuss.checked = true
-      }
-      if (disc == 1) {
-          document.mailform.discuss.checked = true
+      var disc = "$env{'form.discuss'}";
+      if (disc == 'nonanon') {
+          document.mailform.discuss[0].checked=1;
+      }
+      if (disc == 'anon') {
+          document.mailform.discuss[1].checked=1;
+      }
+      var blog = "$env{'form.blog'}";
+      if (blog == 1) {
+          document.mailform.blog.checked=1;
       }
       return
   }
@@ -1422,12 +1428,10 @@
   function setposttype () {
       var currtype = $anonflag
       if (currtype == 1) {
-          document.mailform.elements.discuss.checked = false
-          document.mailform.elements.anondiscuss.checked = true
+          document.mailform.elements.discuss.value = 'anon'
       }
       if (currtype == 0) {
-          document.mailform.elements.anondiscuss.checked = false
-          document.mailform.elements.discuss.checked = true
+          document.mailform.elements.discuss.value = 'nonanon'
       }
       return
   }
@@ -1473,12 +1477,9 @@
           } 
         }
         if (typeof(document.mailform.elements.discuss)!="undefined") {
-          if (document.mailform.elements.discuss.checked) {
-             rec=1;
-          } 
-        }
-        if (typeof(document.mailform.elements.anondiscuss)!="undefined") {
-          if (document.mailform.elements.anondiscuss.checked) {
+	  // anon versus nonanon discussion
+          if (document.mailform.elements.discuss[0].checked 
+	      || document.mailform.elements.discuss[1].checked) {
              rec=1;
           } 
         }
@@ -1494,7 +1495,7 @@
 	    }
 	    document.mailform.submit();
         } else {
-            alert('Please check a feedback type.');
+            alert('Please select a feedback type.');
 	}
     }
     $anonchk
@@ -1583,7 +1584,7 @@
         $r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver));
         if ($attachnum > 0) {
             if (@currnewattach > 0) {
-                $newattachmsg .= '<b>New attachments</b><br />';
+                $newattachmsg .= '<br /><b>New attachments</b><br />';
                 if (@currnewattach > 1) {
                     $newattachmsg .= '<ol>';
                     foreach my $item (@currnewattach) {
@@ -2292,10 +2293,9 @@
 	    &Apache::lonnet::allowed('pch',
 				     $env{'request.course.id'}.
 				     ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
-	    $discussoptions='<label><input type="checkbox" name="discuss" onClick="this.form.anondiscuss.checked=false;" '.
-		($env{'form.replydisc'}?' checked="1"':'').' /> '.
+	    $discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '.
 		&mt('Contribution to course discussion of resource');
-	    $discussoptions.='</label><br /><label><input type="checkbox" name="anondiscuss" onClick="this.form.discuss.checked=false;" /> '.
+	    $discussoptions.='</label><br /><label><input type="radio" name="discuss" value="anon" /> '.
 		&mt('Anonymous contribution to course discussion of resource').
 		' <i>('.&mt('name only visible to course faculty').')</i></label> '.
 		'<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>';
@@ -2694,6 +2694,7 @@
 	&Apache::loncommon::end_page();
 				       
     $r->print(<<END);
+$start_page
 <form name="modattachments" method="post" enctype="multipart/form-data" action="/adm/feedback?attach=$symb">
  <table border="2">
   <tr>
@@ -2733,7 +2734,6 @@
 <input type="hidden" name="idx" value="$env{'form.idx'}" />
 <input type="hidden" name="numoldver" value="$env{'form.numoldver'}" />
 <input type="hidden" name="origpage" value="$env{'form.origpage'}" />
-<input type="hidden" name="anondiscuss" value="$env{'form.anondiscuss'}" />
 <input type="hidden" name="blog" value="$env{'form.blog'}" />
 <input type="hidden" name="discuss" value="$env{'form.discuss'}" />
 END
@@ -2799,7 +2799,6 @@
 <input type="hidden" name="subject" />
 <input type="hidden" name="comment" />
 <input type="hidden" name="blog" value = "0" />
-<input type="hidden" name="anondiscuss" value = "0" />
 <input type="hidden" name="discuss" value = "0" />
 <input type="hidden" name="numoldver" value="$numoldver" />
 ENDATTACH
@@ -3250,7 +3249,7 @@
 # -------------------------------------------------------- Work on attachments
       &Apache::loncommon::content_type($r,'text/html');
       $r->send_http_header;
-      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','addnewattach','delnewattach','timestamp','numoldver','idx','anondiscuss','discuss','blog']);
+      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','addnewattach','delnewattach','timestamp','numoldver','idx','discuss','blog']);
       my (@currnewattach,@currdelold,@keepold);
       &process_attachments(\@currnewattach,\@currdelold,\@keepold);
       if (exists($env{'form.addnewattach.filename'})) {
@@ -3417,9 +3416,9 @@
 # Discussion? Store that.
 
       my $numpost=0;
-      if ($env{'form.discuss'} || $env{'form.anondiscuss'}) {
+      if ($env{'form.discuss'}) {
 	  my $subject = &clear_out_html($env{'form.subject'},undef,1);
-	  my $anonmode=(defined($env{'form.anondiscuss'}));
+	  my $anonmode=($env{'form.discuss'} eq 'anon');
 	  $typestyle.=&adddiscuss($symb,$message,$anonmode,$attachmenturl,
 				  $subject);
 	  $numpost++;