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

amueller amueller@source.lon-capa.org
Fri, 23 Oct 2009 18:49:10 -0000


amueller		Fri Oct 23 18:49:10 2009 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  -Hiding the maps and folders of course content when you choose for parameter level "course level" vice versa.
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.473 loncom/interface/lonparmset.pm:1.474
--- loncom/interface/lonparmset.pm:1.473	Fri Oct 23 18:16:24 2009
+++ loncom/interface/lonparmset.pm	Fri Oct 23 18:49:10 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.473 2009/10/23 18:16:24 amueller Exp $
+# $Id: lonparmset.pm,v 1.474 2009/10/23 18:49:10 amueller Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -903,7 +903,9 @@
     my ($r) = @_;
 
     my %loaditems = ('onunload' => "pclose()",
-             'onload'   => "group_or_section('cgroup')",);
+             'onload'   => "group_or_section('cgroup')",
+             'onload'   => "showHide_courseContent()",
+        );
 
     if ((($env{'form.command'} eq 'set') && ($env{'form.url'})
          && (!$env{'form.dis'})) || ($env{'form.symb'})) {
@@ -1839,7 +1841,7 @@
     my ($r,$alllevs,$parmlev)=@_;
 
     $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameter Level').&Apache::loncommon::help_open_topic('Course_Parameter_Levels')));
-    $r->print('<select name="parmlev">');
+    $r->print('<select id="parmlev" name="parmlev" onchange="showHide_courseContent()">');
     foreach (reverse sort keys %{$alllevs}) {
     $r->print('<option value="'.$$alllevs{$_}.'"');
     if ($parmlev eq $$alllevs{$_}) {
@@ -2193,20 +2195,39 @@
         $r->print('<div id="parmsel">');
     }
 
+    
     # Display Unit 1 "General Parameters"
     if (!$pssymb) {
         $r->print(&Apache::lonhtmlcommon::topic_bar (1,&mt('General Parameters')));
-        $r->print(&Apache::lonhtmlcommon::start_pick_box());
+        $r->print(<<COURSECONTENTSCRIPT);
+<script type="text/javascript">
+// <![CDATA[
+function showHide_courseContent(){
+        var parmlevValue=document.getElementById("parmlev").value;
+        if (parmlevValue == 'general') {
+            document.getElementById('mapmenu').style.display="none";
+        } else {
+            if ((parmlevValue == "full") || (parmlevValue == "map")) {
+                document.getElementById('mapmenu').style.display ="";
+            } else {
+                document.getElementById('mapmenu').style.display="none";
+            }
+        }        
+    }
+// ]]>
+</script>
+COURSECONTENTSCRIPT
 
+        $r->print(&Apache::lonhtmlcommon::start_pick_box());
         &levelmenu($r,\%alllevs,$parmlev);
-
-        if ($parmlev ne 'general') {
-            $r->print(&Apache::lonhtmlcommon::row_closure());
-            &mapmenu($r,\%allmaps,$pschp,\%maptitles, \%symbp);
-        }
-
         $r->print(&Apache::lonhtmlcommon::row_closure(1));
         $r->print(&Apache::lonhtmlcommon::end_pick_box());
+        $r->print('<div id="mapmenu">');
+        $r->print(&Apache::lonhtmlcommon::start_pick_box());
+        &mapmenu($r,\%allmaps,$pschp,\%maptitles, \%symbp);
+        $r->print(&Apache::lonhtmlcommon::row_closure(1));
+        $r->print(&Apache::lonhtmlcommon::end_pick_box());
+        $r->print('</div>');
         #Display Unit 2 "Select Parameter"   
         &displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder);
     } else {