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

raeburn raeburn at source.lon-capa.org
Wed May 9 15:46:30 EDT 2012


raeburn		Wed May  9 19:46:30 2012 EDT

  Modified files:              
    /loncom/interface	londocs.pm lonhtmlcommon.pm lonparmset.pm 
  Log:
  - Code used to resize scrollbox containing contents list for Content Editor
    generalized, and moved from londocs.pm to lonhtmlcommon.pm to facilitate 
    re-use.
  - In lonhtmlcommon.pm 
      - &start_pick_box() and &topic_bar() have additional
        optional args which allow id to be passed to corresponding table or div.
  - In lonparmset.pm
    -  javascript used to toggle visibility of mapmenu depending on choice of 
       level moved to routine: &showhide_js() so it can be used for both:
       Table mode and Overview mode (new + existing).    
  
  
-------------- next part --------------
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.484 loncom/interface/londocs.pm:1.485
--- loncom/interface/londocs.pm:1.484	Mon May  7 02:12:47 2012
+++ loncom/interface/londocs.pm	Wed May  9 19:46:30 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.484 2012/05/07 02:12:47 raeburn Exp $
+# $Id: londocs.pm,v 1.485 2012/05/09 19:46:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1664,7 +1664,7 @@
 
 =item list_symbs()
 
-List Content Idenifiers
+List Content Identifiers
 
 =cut
 
@@ -2441,9 +2441,9 @@
 	    $script .= &editing_js($udom,$uname,$supplementalflag).
                        &history_tab_js().
                        &inject_data_js().
-                       &resize_contentdiv_js($tabidstr);
+                       &Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr);
             $addentries = {
-                            onload   => "javascript:resize_contentdiv('contentscroll','1','1');",
+                            onload   => "javascript:resize_scrollbox('contentscroll','1','1');",
                           };
         }
     }
@@ -3683,7 +3683,7 @@
                 }
             }
         }
-        resize_contentdiv('contentscroll','1','0');
+        resize_scrollbox('contentscroll','1','0');
 	return false;
 }
 
@@ -3800,196 +3800,6 @@
 ENDSWITCHJS
 }
 
-sub resize_contentdiv_js {
-    my ($tabidstr) = @_;
-    my $viewport_js = &Apache::loncommon::viewport_geometry_js();
-    return <<ENDRESIZESCRIPT;
-
-window.onresize=resizeContentEditor;
-
-var activeTab;
-
-$viewport_js
-
-function resize_contentdiv(scrollboxname,chkw,chkh) {
-    var scrollboxid = 'div_'+scrollboxname;
-    var scrolltableid = 'table_'+scrollboxname;
-    var scrollbox;
-    var scrolltable;
-
-    if (document.getElementById("contenteditor") == null) {
-        return;
-    }
-
-    if (document.getElementById(scrollboxid) == null) {
-        return;
-    } else {
-        scrollbox = document.getElementById(scrollboxid);
-    }
-
-    if (document.getElementById(scrolltableid) == null) {
-        return;
-    } else {
-        scrolltable = document.getElementById(scrolltableid);
-    }
-
-    init_geometry();
-    var vph = Geometry.getViewportHeight();
-    var vpw = Geometry.getViewportWidth();
-
-    var alltabs = ['$tabidstr'];
-    var listwchange;
-    if (chkw == 1) {
-        var contenteditorw = document.getElementById("contenteditor").offsetWidth;
-        var contentlistw;
-        var contentlistid = document.getElementById("contentlist");
-        if (contentlistid != null) {
-            contentlistw = document.getElementById("contentlist").offsetWidth;
-        }
-        var contentlistwstart = contentlistw;
-
-        var scrollboxw = scrollbox.offsetWidth;
-        var scrollboxscrollw = scrollbox.scrollWidth;
-
-        var offsetw = parseInt(vpw * 0.015);
-        var paddingw = parseInt(vpw * 0.09);
-
-        var minscrollboxw = 250;
-
-        var maxtabw = 0;
-        var actabw = 0;
-        for (var i=0; i<alltabs.length; i++) {
-            if (activeTab == alltabs[i]) {
-                actabw = document.getElementById(alltabs[i]).offsetWidth;
-                if (actabw > maxtabw) {
-                    maxtabw = actabw;
-                }
-            } else {
-                if (document.getElementById(alltabs[i]) != null) {
-                    var thistab = document.getElementById(alltabs[i]);
-                    thistab.style.visibility = 'hidden';
-                    thistab.style.display = 'block';
-                    var tabw = document.getElementById(alltabs[i]).offsetWidth;
-                    thistab.style.display = 'none';
-                    thistab.style.visibility = '';
-                    if (tabw > maxtabw) {
-                        maxtabw = tabw;
-                    }
-                }
-            }
-        }
-
-        if (maxtabw > 0) {
-            var newscrollboxw;
-            if (maxtabw+paddingw+scrollboxscrollw<contenteditorw) {
-                newscrollboxw = contenteditorw-paddingw-maxtabw;
-                if (newscrollboxw < minscrollboxw) {
-                    newscrollboxw = minscrollboxw;
-                }
-                scrollbox.style.width = newscrollboxw+"px";
-                if (newscrollboxw != scrollboxw) {
-                    var newcontentlistw = newscrollboxw-offsetw;
-                    contentlistid.style.width = newcontentlistw+"px";
-                }
-            } else {
-                newscrollboxw = contenteditorw-paddingw-maxtabw;
-                if (newscrollboxw < minscrollboxw) {
-                    newscrollboxw = minscrollboxw;
-                }
-                scrollbox.style.width = newscrollboxw+"px";
-                if (newscrollboxw != scrollboxw) {
-                    var newcontentlistw = newscrollboxw-offsetw;
-                    contentlistid.style.width = newcontentlistw+"px";
-                }
-            }
-
-            if (newscrollboxw != scrollboxw) {
-                var newscrolltablew = newscrollboxw+offsetw;
-                scrolltable.style.width = newscrolltablew+"px";
-            }
-        }
-
-        if (contentlistid.offsetWidth != contentlistwstart) {
-            listwchange = 1;
-        }
-
-        if (activeTab == 'cc1') {
-            if (document.getElementById('cc_hrule') != null) {
-                document.getElementById('cc_hrule').style.width=actabw+"px";
-            }
-        } else {
-            if (activeTab == 'bb1') {
-                if (document.getElementById('bb_hrule') != null) {
-                    document.getElementById('bb_hrule').style.width=actabw+"px";
-                }
-            } else {
-                if (activeTab == 'ee2') {
-                    if (document.getElementById('ee_hrule') != null) {
-                        document.getElementById('ee_hrule').style.width=actabw+"px";
-                    }
-                }
-            }
-        }
-    }
-    if ((chkh == 1) || (listwchange)) {
-        var primaryheight = document.getElementById("LC_nav_bar").offsetHeight;
-        var secondaryheight = document.getElementById("LC_secondary_menu").offsetHeight;
-        var crumbsheight = document.getElementById("LC_breadcrumbs").offsetHeight;
-        var dccidheight = document.getElementById("dccid").offsetHeight;
-
-        var uploadresultheight = 0;
-        if (document.getElementById("uploadfileresult") != null) {
-            uploadresultheight = document.getElementById("uploadfileresult").offsetHeight;
-        }
-        var tabbedheight = document.getElementById("tabbededitor").offsetHeight;
-        var contenteditorheight = document.getElementById("contenteditor").offsetHeight;
-        var scrollboxheight = scrollbox.offsetHeight;
-        var scrollboxscrollheight = scrollbox.scrollHeight;
-        var freevspace = vph-(primaryheight+secondaryheight+crumbsheight+dccidheight+uploadresultheight+tabbedheight+contenteditorheight);
-
-        var minvscrollbox = 200;
-        var offsetv = 20;
-        var newscrollboxheight;
-        if (freevspace < 0) {
-            newscrollboxheight = scrollboxheight+freevspace-offsetv;
-            if (newscrollboxheight < minvscrollbox) {
-                newscrollboxheight = minvscrollbox;
-            }
-            scrollbox.style.height = newscrollboxheight + "px";
-        } else {
-            if (scrollboxscrollheight > scrollboxheight) {
-                if (freevspace > offsetv) {
-                    newscrollboxheight = scrollboxheight+freevspace-offsetv;
-                    if (newscrollboxheight < minvscrollbox) {
-                        newscrollboxheight = minvscrollbox;
-                    }
-                    scrollbox.style.height = newscrollboxheight+"px";
-                }
-            }
-        }
-        scrollboxheight = scrollbox.offsetHeight;
-        var contentlistheight = document.getElementById("contentlist").offsetHeight;
-
-        if (scrollboxscrollheight <= scrollboxheight) {
-            if ((contentlistheight+offsetv)<scrollboxheight) {
-                newscrollheight = contentlistheight+offsetv;
-                scrollbox.style.height = newscrollheight+"px";
-            }
-        }
-    }
-    return;
-}
-
-function resizeContentEditor() {
-    var timer;
-    clearTimeout(timer)
-    timer=setTimeout('resize_contentdiv("contentscroll","1","1")',500);
-}
-
-ENDRESIZESCRIPT
-    return;
-}
-
 sub makedocslogform {
     my ($formelems,$docslog) = @_;
     return <<"LOGSFORM";
@@ -4143,10 +3953,12 @@
 
 =item dump_switchserver_js()
 
-=item resize_contentdiv_js()
+=item resize_scrollbox_js()
 
 =item makedocslogform()
 
+=item makesimpleeditform()
+
 =back
 
 =cut
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.312 loncom/interface/lonhtmlcommon.pm:1.313
--- loncom/interface/lonhtmlcommon.pm:1.312	Fri May  4 19:03:18 2012
+++ loncom/interface/lonhtmlcommon.pm	Wed May  9 19:46:30 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.312 2012/05/04 19:03:18 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.313 2012/05/09 19:46:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1874,15 +1874,19 @@
 my @row_count;
 
 sub start_pick_box {
-    my ($css_class) = @_;
+    my ($css_class,$id) = @_;
     if (defined($css_class)) {
 	$css_class = 'class="'.$css_class.'"';
     } else {
 	$css_class= 'class="LC_pick_box"';
     }
+    my $table_id;
+    if (defined($id)) {
+        $table_id = ' id="'.$id.'"';
+    }
     unshift(@row_count,0);
     my $output = <<"END";
- <table $css_class>
+ <table $css_class $table_id>
 END
     return $output;
 }
@@ -2214,15 +2218,19 @@
 # 1. number to display.
 #    If input for number is empty only the title will be displayed. 
 # 2. title text to display.
+# 3. optional id for the <div>
 # Outputs - a scalar containing html mark-up for the div.
 
 sub topic_bar {
-    my ($num,$title) = @_;
+    my ($num,$title,$id) = @_;
     my $number = '';
     if ($num ne '') {
         $number = '<span>'.$num.'</span>';
     }
-    return '<div class="LC_topic_bar">'.$number.$title.'</div>';
+    if ($id ne '') {
+        $id = 'id="'.$id.'"';
+    }
+    return '<div class="LC_topic_bar" '.$id.'>'.$number.$title.'</div>';
 }
 
 ##############################################
@@ -2686,6 +2694,270 @@
 ##############################################
 ##############################################
 
+sub resize_scrollbox_js {
+    my ($context,$tabidstr) = @_;
+    my (%names,$paddingwfrac,$offsetwfrac,$offsetv,$minw,$minv);
+    if ($context eq 'docs') {
+        %names = (
+                   boxw   => 'contenteditor',
+                   item   => 'contentlist',
+                   header => 'uploadfileresult',
+                   scroll => 'contentscroll',
+                   boxh   => 'contenteditor',
+                 );
+        $paddingwfrac = 0.09; 
+        $offsetwfrac = 0.015;
+        $offsetv = 20;
+        $minw = 250;
+        $minv = 200;
+    } elsif ($context eq 'params') {
+        %names = (
+                   boxw   => 'parameditor',
+                   item   => 'mapmenuinner',
+                   header => 'parmstep1',
+                   scroll => 'mapmenuscroll',
+                   boxh   => 'parmlevel',
+                 );
+        $paddingwfrac = 0.2;
+        $offsetwfrac = 0.015;
+        $offsetv = 80;
+        $minw = 100;
+        $minv = 100; 
+    }
+    my $viewport_js = &Apache::loncommon::viewport_geometry_js();
+    my $output = '
+
+window.onresize=callResize;
+
+';
+    if ($context eq 'docs') {
+        $output .= '
+var activeTab;
+';
+    }
+    $output .=  <<"FIRST";
+
+$viewport_js
+
+function resize_scrollbox(scrollboxname,chkw,chkh) {
+    var scrollboxid = 'div_'+scrollboxname;
+    var scrolltableid = 'table_'+scrollboxname;
+    var scrollbox;
+    var scrolltable;
+
+    if (document.getElementById("$names{'boxw'}") == null) {
+        return;
+    }
+
+    if (document.getElementById(scrollboxid) == null) {
+        return;
+    } else {
+        scrollbox = document.getElementById(scrollboxid);
+    }
+
+
+    if (document.getElementById(scrolltableid) == null) {
+        return;
+    } else {
+        scrolltable = document.getElementById(scrolltableid);
+    }
+
+    init_geometry();
+    var vph = Geometry.getViewportHeight();
+    var vpw = Geometry.getViewportWidth();
+
+FIRST
+    if ($context eq 'docs') {
+        $output .= "
+    var alltabs = ['$tabidstr'];
+";
+    } elsif ($context eq 'params') {
+        $output .= "
+    if (document.getElementById('$names{'boxh'}') == null) {
+        return;
+    }
+";
+    }
+    $output .= <<"SECOND";
+    var listwchange;
+    if (chkw == 1) {
+        var boxw = document.getElementById("$names{'boxw'}").offsetWidth;
+        var itemw;
+        var itemid = document.getElementById("$names{'item'}");
+        if (itemid != null) {
+            itemw = itemid.offsetWidth;
+        }
+        var itemwstart = itemw;
+
+        var scrollboxw = scrollbox.offsetWidth;
+        var scrollboxscrollw = scrollbox.scrollWidth;
+
+        var offsetw = parseInt(vpw * $offsetwfrac);
+        var paddingw = parseInt(vpw * $paddingwfrac);
+
+        var minscrollboxw = $minw;
+        var maxcolw = 0;
+SECOND
+    if ($context eq 'docs') {
+        $output .= <<"DOCSONE";
+        var actabw = 0;
+        for (var i=0; i<alltabs.length; i++) {
+            if (activeTab == alltabs[i]) {
+                actabw = document.getElementById(alltabs[i]).offsetWidth;
+                if (actabw > maxcolw) {
+                    maxcolw = actabw;
+                }
+            } else {
+                if (document.getElementById(alltabs[i]) != null) {
+                    var thistab = document.getElementById(alltabs[i]);
+                    thistab.style.visibility = 'hidden';
+                    thistab.style.display = 'block';
+                    var tabw = document.getElementById(alltabs[i]).offsetWidth;
+                    thistab.style.display = 'none';
+                    thistab.style.visibility = '';
+                    if (tabw > maxcolw) {
+                        maxcolw = tabw;
+                    }
+                }
+            }
+        }
+DOCSONE
+    } elsif ($context eq 'params') {
+        $output .= <<"PARAMSONE";
+        var parmlevelrows = new Array();
+        var mapmenucells = new Array();
+        parmlevelrows = document.getElementById("$names{'boxh'}").rows;
+        var numrows = parmlevelrows.length;
+        if (numrows > 1) {
+            mapmenucells = parmlevelrows[2].getElementsByTagName('td');
+        }
+        maxcolw = mapmenucells[0].offsetWidth;
+PARAMSONE
+    }
+    $output .= <<"THIRD";
+        if (maxcolw > 0) {
+            var newscrollboxw;
+            if (maxcolw+paddingw+scrollboxscrollw<boxw) {
+                newscrollboxw = boxw-paddingw-maxcolw;
+                if (newscrollboxw < minscrollboxw) {
+                    newscrollboxw = minscrollboxw;
+                }
+                scrollbox.style.width = newscrollboxw+"px";
+                if (newscrollboxw != scrollboxw) {
+                    var newitemw = newscrollboxw-offsetw;
+                    itemid.style.width = newitemw+"px";
+                }
+            } else {
+                newscrollboxw = boxw-paddingw-maxcolw;
+                if (newscrollboxw < minscrollboxw) {
+                    newscrollboxw = minscrollboxw;
+                }
+                scrollbox.style.width = newscrollboxw+"px";
+                if (newscrollboxw != scrollboxw) {
+                    var newitemw = newscrollboxw-offsetw;
+                    itemid.style.width = newitemw+"px";
+                }
+            }
+
+            if (newscrollboxw != scrollboxw) {
+                var newscrolltablew = newscrollboxw+offsetw;
+                scrolltable.style.width = newscrolltablew+"px";
+            }
+        }
+
+        if (itemid.offsetWidth != itemwstart) {
+            listwchange = 1;
+        }
+THIRD
+    if ($context eq 'docs') {
+        $output .= <<"DOCSTWO";
+        if (activeTab == 'cc1') {
+            if (document.getElementById('cc_hrule') != null) {
+                document.getElementById('cc_hrule').style.width=actabw+"px";
+            }
+        } else {
+            if (activeTab == 'bb1') {
+                if (document.getElementById('bb_hrule') != null) {
+                    document.getElementById('bb_hrule').style.width=actabw+"px";
+                }
+            } else {
+                if (activeTab == 'ee2') {
+                    if (document.getElementById('ee_hrule') != null) {
+                        document.getElementById('ee_hrule').style.width=actabw+"px";
+                    }
+                }
+            }
+        }
+DOCSTWO
+    }
+    $output .= <<"FOURTH";
+    }
+    if ((chkh == 1) || (listwchange)) {
+        var primaryheight = document.getElementById('LC_nav_bar').offsetHeight;
+        var secondaryheight = document.getElementById('LC_secondary_menu').offsetHeight;
+        var crumbsheight = document.getElementById('LC_breadcrumbs').offsetHeight;
+        var dccidheight = 0;
+        if (document.getElementById('dccid') != null) {
+            dccidheight = document.getElementById('dccid').offsetHeight;
+        }
+        var headerheight = 0;
+        if (document.getElementById("$names{'header'}") != null) {
+            headerheight = document.getElementById("$names{'header'}").offsetHeight;
+        }
+        var tabbedheight = document.getElementById("tabbededitor").offsetHeight;
+        var boxheight = document.getElementById("$names{'boxh'}").offsetHeight;
+        var freevspace = vph-(primaryheight+secondaryheight+crumbsheight+dccidheight+headerheight+tabbedheight+boxheight);
+
+        var scrollboxheight = scrollbox.offsetHeight;
+        var scrollboxscrollheight = scrollbox.scrollHeight;
+
+        var minvscrollbox = $minv;
+        var offsetv = $offsetv;
+        var newscrollboxheight;
+        if (freevspace < 0) {
+            newscrollboxheight = scrollboxheight+freevspace-offsetv;
+            if (newscrollboxheight < minvscrollbox) {
+                newscrollboxheight = minvscrollbox;
+            }
+            scrollbox.style.height = newscrollboxheight + "px";
+        } else {
+            if (scrollboxscrollheight > scrollboxheight) {
+                if (freevspace > offsetv) {
+                    newscrollboxheight = scrollboxheight+freevspace-offsetv;
+                    if (newscrollboxheight < minvscrollbox) {
+                        newscrollboxheight = minvscrollbox;
+                    }
+                    scrollbox.style.height = newscrollboxheight+"px";
+                }
+            }
+        }
+        scrollboxheight = scrollbox.offsetHeight;
+        var itemh = document.getElementById("$names{'item'}").offsetHeight;
+
+        if (scrollboxscrollheight <= scrollboxheight) {
+            if ((itemh+offsetv)<scrollboxheight) {
+                newscrollheight = itemh+offsetv;
+                scrollbox.style.height = newscrollheight+"px";
+            }
+        }
+    }
+    return;
+}
+
+function callResize() {
+    var timer;
+    clearTimeout(timer);
+    timer=setTimeout('resize_scrollbox("$names{'scroll'}","1","1")',500);
+}
+
+FOURTH
+    return $output;
+}
+
+
+##############################################
+##############################################
+
 # javascript_valid_email
 #
 # Generates javascript to validate an e-mail address.
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.522 loncom/interface/lonparmset.pm:1.523
--- loncom/interface/lonparmset.pm:1.522	Sun May  6 22:09:14 2012
+++ loncom/interface/lonparmset.pm	Wed May  9 19:46:30 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.522 2012/05/06 22:09:14 raeburn Exp $
+# $Id: lonparmset.pm,v 1.523 2012/05/09 19:46:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -322,10 +322,10 @@
                                           &mt('Course Settings').
                                           '    </b></a></li>');
 
-    $r->print("\n".'<li'.($mode eq 'parmset'?' class="active"':'').'><a href="/adm/parmset"><b>'.
+    $r->print("\n".'<li'.($mode eq 'parmset'?' class="active"':'').' id="tabbededitor"><a href="/adm/parmset"><b>'.
                                                                  &mt('Content and Problem Settings').'</b></a></li>');
     $r->print("\n".'</ul>'."\n");
-    $r->print('<div class="LC_Box" style="clear:both;margin:0;"><div id="maincoursedoc" style="margin:0 0;padding:0 0;"><div class="LC_ContentBox" id="mainCourseDocuments" style="display: block;">');
+    $r->print('<div class="LC_Box" style="clear:both;margin:0;" id="parameditor"><div id="maincoursedoc" style="margin:0 0;padding:0 0;"><div class="LC_ContentBox" id="mainCourseDocuments" style="display: block;">');
 }
 
 sub endSettingsScreen {
@@ -887,13 +887,35 @@
         var newWin = window.open(url, wdwName, options);
         newWin.focus();
     }
+
 // ]]>
+
 </script>
 $selscript
 ENDJS
 
 }
 
+sub showhide_js {
+    return <<"COURSECONTENTSCRIPT";
+
+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";
+        }
+    }
+    return;
+}
+
+COURSECONTENTSCRIPT
+}
+
 sub startpage {
     my ($r,$psymb) = @_;
 
@@ -901,7 +923,7 @@
                       'onload'   => "group_or_section('cgroup')",
                     );
     if (!$psymb) {
-        $loaditems{'onload'} = "showHide_courseContent(); group_or_section('cgroup')";
+        $loaditems{'onload'} = "showHide_courseContent(); group_or_section('cgroup'); resize_scrollbox('mapmenuscroll','1','1');";
     }
 
     if ((($env{'form.command'} eq 'set') && ($env{'form.url'})
@@ -913,10 +935,17 @@
        text=>"Table Mode",
        help => 'Course_Setting_Parameters'});
     }
+    my $js = &page_js().'
+<script type="text/javascript">
+// <![CDATA[
+'.
+            &Apache::lonhtmlcommon::resize_scrollbox_js('params').'
+// ]]>
+</script>
+';
     my $start_page =
-    &Apache::loncommon::start_page('Set/Modify Course Parameters',
-                       &page_js(),
-                       {'add_entries' => \%loaditems,});
+        &Apache::loncommon::start_page('Set/Modify Course Parameters',$js,
+                                       {'add_entries' => \%loaditems,});
     my $breadcrumbs =
     &Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode');
     my $escfilter=&Apache::lonhtmlcommon::entity_encode($env{'form.filter'});
@@ -1535,8 +1564,12 @@
 
 sub partmenu {
     my ($r,$allparts,$psprt)=@_;
+    my $selsize = 1+scalar(keys(%{$allparts}));
+    if ($selsize > 8) {
+        $selsize = 8;
+    }
 
-    $r->print('<select multiple="multiple" name="psprt" size="8">');
+    $r->print('<select multiple="multiple" name="psprt" size="'.$selsize.'">');
     $r->print('<option value="all"');
     $r->print(' selected="selected"') unless (@{$psprt});
     $r->print('>'.&mt('All Parts').'</option>');
@@ -1737,12 +1770,12 @@
            .'</div>'
         );
 
-        $r->print(&Apache::loncommon::start_scrollbox());
-        $r->print(&Apache::loncommon::start_data_table());
+        $r->print(&Apache::loncommon::start_scrollbox(undef,undef,undef,'mapmenuscroll'));
+        $r->print(&Apache::loncommon::start_data_table(undef,'mapmenuinner'));
 
         # Display row: "All Maps or Folders"
         $r->print(
-            &Apache::loncommon::start_data_table_row()
+            &Apache::loncommon::start_data_table_row(undef,'picklevel')
            .'<td>'
            .'<label>'
            .'<input type="radio" name="pschp"'
@@ -1817,8 +1850,9 @@
             );
         }
 
-        $r->print(&Apache::loncommon::end_data_table());
-        $r->print(&Apache::loncommon::end_scrollbox());
+        $r->print(&Apache::loncommon::end_data_table().
+                  '<br style="line-height:2px;" />'.
+                  &Apache::loncommon::end_scrollbox());
     }
 }
 
@@ -2221,27 +2255,15 @@
         }
 
         # Step 1
-        $r->print(&Apache::lonhtmlcommon::topic_bar(1,&mt('Resource Specification')));
-        $r->print(<<COURSECONTENTSCRIPT);
+        $r->print(&Apache::lonhtmlcommon::topic_bar(1,&mt('Resource Specification'),'parmstep1'));
+        $r->print('
 <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";
-            }
-        }        
-    }
+// <![CDATA['.
+                 &showhide_js().'
 // ]]>
 </script>
-COURSECONTENTSCRIPT
-
-        $r->print(&Apache::lonhtmlcommon::start_pick_box());
+');
+        $r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel'));
         &levelmenu($r,\%alllevs,$parmlev);
         $r->print(&Apache::lonhtmlcommon::row_closure());
         &mapmenu($r,\%allmaps,$pschp,\%maptitles, \%symbp);
@@ -2252,11 +2274,11 @@
         $r->print(&Apache::lonhtmlcommon::end_pick_box());
 
         # Step 2
-        $r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification')));
+        $r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2'));
         &displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder);
 
         # Step 3
-        $r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)')));
+        $r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3'));
         $r->print(&Apache::lonhtmlcommon::start_pick_box());
         &usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups);
         $r->print(&Apache::lonhtmlcommon::row_closure(1));
@@ -3284,7 +3306,21 @@
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
     &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
         text=>"Overview Mode"});
-    my $start_page = &Apache::loncommon::start_page('Set Parameters');
+
+    my %loaditems = (
+                      'onload'   => "showHide_courseContent(); resize_scrollbox('mapmenuscroll','1','1');",
+                    );
+    my $js = '
+<script type="text/javascript">
+// <![CDATA[
+'.
+            &Apache::lonhtmlcommon::resize_scrollbox_js('params')."\n".
+            &showhide_js()."\n".
+'// ]]>
+</script>
+';
+    my $start_page = &Apache::loncommon::start_page('Set Parameters',$js,
+                                                    {'add_entries' => \%loaditems,});
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview');
     $r->print($start_page.$breadcrumbs);
     &startSettingsScreen($r,'parmset');
@@ -3350,7 +3386,7 @@
     $r->print('<div class="LC_Box">');
     #$r->print('<h2 class="LC_hcell">Step 1</h2>');
     $r->print('<div>');
-    $r->print(&Apache::lonhtmlcommon::start_pick_box());
+    $r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel'));
     &levelmenu($r,\%alllevs,$parmlev);
     if ($parmlev ne 'general') {
         $r->print(&Apache::lonhtmlcommon::row_closure());


More information about the LON-CAPA-cvs mailing list