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

raeburn lon-capa-cvs@mail.lon-capa.org
Fri, 06 Jan 2006 23:56:10 -0000


raeburn		Fri Jan  6 18:56:10 2006 EDT

  Modified files:              
    /loncom/interface	lonwhatsnew.pm 
  Log:
  Eliminate radio buttons - less clicking to change display of count of unread.
  
  
Index: loncom/interface/lonwhatsnew.pm
diff -u loncom/interface/lonwhatsnew.pm:1.46 loncom/interface/lonwhatsnew.pm:1.47
--- loncom/interface/lonwhatsnew.pm:1.46	Fri Jan  6 17:50:29 2006
+++ loncom/interface/lonwhatsnew.pm	Fri Jan  6 18:56:05 2006
@@ -1,5 +1,5 @@
 #
-# $Id: lonwhatsnew.pm,v 1.46 2006/01/06 22:50:29 albertel Exp $
+# $Id: lonwhatsnew.pm,v 1.47 2006/01/06 23:56:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -564,21 +564,34 @@
     if ($current eq '') {
         $current = 'on';
     }
-    my %status = ( $current => 'checked="checked"');
-
-    $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;');
+    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.'" />
-<label><input type ="radio" '.$status{'on'}.' name="countunread" value="on">on</label>
-&nbsp;&nbsp;&nbsp;
-<label><input type ="radio" '.$status{'off'}.' name="countunread" value="off">off</label>
+<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;
 }