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

bisitz bisitz@source.lon-capa.org
Wed, 10 Jun 2009 14:42:25 -0000


bisitz		Wed Jun 10 14:42:25 2009 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  Resource Parameters - Table Mode:
  - Hide parameter selection after click on "Update Parameter Display" button
    (Use Javascript and display:none style to avoid page reload and structural changes)
  - Added link to show again the parameter selection when this part is hidden
  - Wrapped 10 minutes warning message in <p> and added warning style
  - Wrap messages only in <div> instead of <p> (XHTML)
  - Moved messages below the update-button/show-link
    (Fits ergonomically better, especially with the new show/hide functionality)
  - Added some code comments
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.458 loncom/interface/lonparmset.pm:1.459
--- loncom/interface/lonparmset.pm:1.458	Tue Jun  9 23:27:04 2009
+++ loncom/interface/lonparmset.pm	Wed Jun 10 14:42:24 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.458 2009/06/09 23:27:04 schualex Exp $
+# $Id: lonparmset.pm,v 1.459 2009/06/10 14:42:24 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1920,7 +1920,10 @@
 				 $uname,$udom,$csec,$cgroup);
 	}
 # ---------------------------------------------------------------- Done storing
-	$message.='<h3>'.&mt('Changes can take up to 10 minutes before being active for all students.').&Apache::loncommon::help_open_topic('Caching').'</h3>';
+        $message.='<p class="LC_warning">'
+                 .&mt('Changes can take up to 10 minutes before being active for all students.')
+                 .&Apache::loncommon::help_open_topic('Caching')
+                 .'</p>';
     }
 #----------------------------------------------- if all selected, fill in array
     if ($pscat[0] eq "all") {@pscat = (keys %allparms);}
@@ -1937,6 +1940,27 @@
 		  '" name="recent_'.$_.'" />');
     }
 
+    # ----- Start Parameter Selection
+
+    # Hide parm selection?
+    $r->print(<<ENDPARMSELSCRIPT);
+<script type="text/javascript">
+// <![CDATA[
+function parmsel_show() {
+  document.getElementById('parmsel').style.display = "";
+  document.getElementById('parmsellink').style.display = "none";
+}
+// ]]>
+</script>
+ENDPARMSELSCRIPT
+    my $parmselhiddenstyle=' style="display:none"';
+    if($env{'form.hideparmsel'} eq 'hidden') {
+        $r->print('<div id="parmsel"'.$parmselhiddenstyle.'>');
+    } else  {
+        $r->print('<div id="parmsel">');
+    }
+
+    # Display parameter selection boxes
     if (!$pssymb) {
         $r->print(&Apache::lonhtmlcommon::topic_bar (1,&mt('General Parameters')));
         $r->print(&Apache::lonhtmlcommon::start_pick_box());
@@ -1966,10 +1990,31 @@
     $r->print(&Apache::lonhtmlcommon::row_closure(1));
     $r->print(&Apache::lonhtmlcommon::end_pick_box());
     
+    # parm selection is shown: display parm update button
+    $r->print('<p>'
+             .'<input type="submit" name="dis"'
+             .' value="'.&mt('Update Parameter Display').'" />'
+             .'<input type="hidden" name="hideparmsel" value="hidden" />'
+             .'</p>'
+    );
+
+    $r->print('</div>');
+    # ----- End Parameter Selection
+
+    # Offer link to display parameter selection again
+    $r->print('<p id="parmsellink"');
+    if($env{'form.hideparmsel'} ne 'hidden') {
+        $r->print($parmselhiddenstyle);
+    }
+    $r->print('>'
+             .'<a href="javascript:parmsel_show()">'
+             .&mt('Change Parameter Selection')
+             .'</a>'
+             .'</p>');
 
-    $r->print('<p>'.$message.'</p>');
+    # Display Messages
+    $r->print('<div>'.$message.'</div>');
 
-    $r->print('<br /><input type="submit" name="dis" value="'.&mt("Update Parameter Display").'" />');
 
     my @temp_pscat;
     map {