--- loncom/interface/lonwhatsnew.pm	2006/01/06 21:52:19	1.44
+++ loncom/interface/lonwhatsnew.pm	2006/01/13 01:18:44	1.50
@@ -1,5 +1,5 @@
 #
-# $Id: lonwhatsnew.pm,v 1.44 2006/01/06 21:52:19 albertel Exp $
+# $Id: lonwhatsnew.pm,v 1.50 2006/01/13 01:18:44 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -100,28 +100,33 @@ sub handler {
             ({href=>'/adm/whatsnew?command=chgthreshold&refpage='.$refpage,
               text=>"Change thresholds"});
         $r->print(&Apache::lonhtmlcommon::breadcrumbs
-            (undef,"What's New?",'Course_Action_Items_Thresholds'));
+            (undef,"What's New?",#'Course_Action_Items_Thresholds'
+	     ));
     } elsif (($command eq 'chginterval') && $checkallowed{'versionchanges'} ) {
         &Apache::lonhtmlcommon::add_breadcrumb
             ({href=>'/adm/whatsnew?command=chginterval&refpage='.$refpage,
               text=>"Change interval"});
         $r->print(&Apache::lonhtmlcommon::breadcrumbs
-            (undef,"What's New?",'Course_Action_Items_Intervals'));
+            (undef,"What's New?",#'Course_Action_Items_Intervals'
+	     ));
     } elsif (($command eq 'chgdisc') && $checkallowed{'coursediscussion'}) {
         &Apache::lonhtmlcommon::add_breadcrumb
             ({href=>'/adm/whatsnew?command=chgdisc&refpage='.$refpage,
               text=>"Change discussion display"});
         $r->print(&Apache::lonhtmlcommon::breadcrumbs
-            (undef,"What's New?",'Course_Action_Items_Intervals'));
+            (undef,"What's New?",#'Course_Action_Items_Intervals'
+	     ));
     } elsif ($command eq 'courseinit') {
         &Apache::lonhtmlcommon::add_breadcrumb
             ({href=>'/adm/whatsnew?command=courseinit&refpage='.$refpage,
               text=>"Course initialization preference"});
         $r->print(&Apache::lonhtmlcommon::breadcrumbs
-            (undef,"What's New?",'Course_Action_Items_Initialization'));
+            (undef,"What's New?",#'Course_Action_Items_Initialization'
+	     ));
     } else {
         $r->print(&Apache::lonhtmlcommon::breadcrumbs
-            (undef,"What's New?",'Course_Action_Items_Display'));
+            (undef,"What's New?",#'Course_Action_Items_Display'
+	     ));
     }
     &display_main_box($r,$command,$refpage,\%checkallowed);
     return OK;
@@ -311,7 +316,7 @@ sub display_actions_box {
         }
     }
     $r->print($lt{'pgse'}.' '.&mt('Currently: [_1]','<i>'.$currinit.'</i>').
-              '<nobr>&nbsp;&nbsp;'.&mt('[_1] for just [_2]','<b>Change</b>',
+              ' <nobr>&nbsp;&nbsp;'.&mt('[_1] for just [_2]','<b>Change</b>',
               '<a href="/adm/whatsnew?command=courseinit&refpage='.$refpage.
               '">this course</a>').' '.&mt('or for all [_1].',
               '<a href="/adm/preferences?action=changecourseinit&refpage='.
@@ -396,10 +401,10 @@ sub display_actions_box {
         &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,$rowColor1,$rowColor2,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread);
     }
     if ($show{'coursenormalmail'}) {
-        &getnormalmail(\@newmsgs);
+        $msgcount = &getnormalmail(\@newmsgs);
     }
     if ($show{'coursecritmail'}) {
-        &getcritmail(\@critmsgs);
+        $critmsgcount = &getcritmail(\@critmsgs);
     }
 
     $r->print(qq|<a href="javascript:changeAll('hide');">$lt{'hial'}</a>
@@ -564,24 +569,34 @@ sub display_discussion_config {
     if ($current eq '') {
         $current = 'on';
     }
-    my %status = (
-                    on => 'checked="checked"',
-                    off => 'checked="checked"',
-                 );
-    $status{$current} = '';
-    $r->print('<br />'.&mt('Choose whether or not to display a count of the number of new posts for each resource or bulletin board which has unread posts.').'<br />'.&mt('This can increase the time taken to gather data for the [_1] page by a few seconds.',"<i>What's New?</i>").'&nbsp;&nbsp;'.&mt('Currently set to [_1] .'),"<b>$current</b>.");
+    my %opposite = ( 
+                      'on' => 'off',
+                      'off' => 'on',
+                    );
+    $r->print('<script type="text/javascript">
+function toggle_countunread(choice) {
+    if (choice == "unchanged") {
+        document.discussionswitch.command.value = "";
+    }
+    document.discussionswitch.submit();
+}
+</script>');
+    $r->print('<br />'.&mt('Choose whether or not to display a count of the number of new posts for each resource or bulletin board which has unread posts.').'<br />'.&mt('This can increase the time taken to gather data for the [_1] page by a few seconds.',"<i>What's New?</i>").'&nbsp;&nbsp;'.&mt('Currently set to [_1].','<b>'.$current.'</b>'));
     $r->print('<br /><br />
-<form method="post" name="discussionswitch" action="/adm/whatsnew">'.
-&mt('Display of unread post counts?').'&nbsp;
+<form method="post" name="discussionswitch" action="/adm/whatsnew">
 <input type="hidden" name="command" value="newdiscconf" />
 <input type="hidden" name="refpage" value="'.$refpage.'" />
-<input type ="radio" '.$status{'on'}.' name="countunread" value="on">on
-&nbsp;&nbsp;&nbsp;
-<input type ="radio" '.$status{'off'}.' name="countunread" value="off">off
+<input type="hidden" name="countunread" value="'.$opposite{$current}.'" />
 ');
-    $r->print('<br/><br />
-               <input type="submit" name="display" value="'.
-               &mt('Make changes').'" /></form>');
+    $r->print('<br/>
+               <input type="button" name="display" value="'.
+               &mt('Change to [_1]',$opposite{$current}).'" 
+               onclick="javascript:toggle_countunread('."'change'".')" />
+               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;
+               <input type="button" name="nochange" value="'.
+               &mt("No change").'" 
+               onclick="javascript:toggle_countunread('."'unchanged'".')" />
+               </form>');
     return;
 }
 
@@ -617,14 +632,14 @@ $$initpage{$current}</b>.<br /><br />
 $lt{'padc'}&nbsp;&nbsp;
 END
     foreach my $choice (@chgstate) {
-        $r->print('<nobr><input type="radio" name="courseinit_control" value="'.
-                   $choice.'"/>'.$$initpage{$choice}.'&nbsp;&nbsp;</nobr>');
+        $r->print('<nobr><label><input type="radio" name="courseinit_control" value="'.
+                   $choice.'"/>'.$$initpage{$choice}.'&nbsp;&nbsp;</label></nobr>');
     }
     $r->print('<br /><br />'.&mt('If').' '.$$initpage{'coursespecific'}.
               '<br />'.$lt{'chce'}." \n");
     foreach my $choice (@chgentry) {
-        $r->print('<nobr><input type="radio" name="courseinit_page" value="'.
-                  $choice.'"/>'.$$initpage{$choice}.'&nbsp;&nbsp;</nobr>');
+        $r->print('<nobr><label><input type="radio" name="courseinit_page" value="'.
+                  $choice.'"/>'.$$initpage{$choice}.'&nbsp;&nbsp;</label></nobr>');
     }
     $r->print('<br /><br /><input type="submit" name="display" value="'.
                $lt{'moce'}.'" /></form>');
@@ -880,6 +895,9 @@ sub check_thresholds {
         if ($resource->handgrade($part) eq 'yes') {
             next;
         }
+        if ($resource->is_survey($part)) {
+            next;
+        }
         %{$stats{$part}} = ();
         my ($attempts,$users,$corrects,$degdiff,$av_attempts);
         if (exists($$resourcetracker{$symb."\0".$part."\0attempts"})) {