[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface londocs.pm

raeburn raeburn at source.lon-capa.org
Thu May 10 13:56:58 EDT 2012


raeburn		Thu May 10 17:56:58 2012 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	londocs.pm 
  Log:
  - For 2.11
    - Backport 1.485.
  
  
-------------- next part --------------
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.484.2.2 loncom/interface/londocs.pm:1.484.2.3
--- loncom/interface/londocs.pm:1.484.2.2	Mon May  7 05:14:59 2012
+++ loncom/interface/londocs.pm	Thu May 10 17:56:58 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.484.2.2 2012/05/07 05:14:59 raeburn Exp $
+# $Id: londocs.pm,v 1.484.2.3 2012/05/10 17:56:58 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1664,7 +1664,7 @@
 
 =item list_symbs()
 
-List Content Idenifiers
+List Content Identifiers
 
 =cut
 
@@ -2440,9 +2440,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');",
                           };
         }
     }
@@ -3680,7 +3680,7 @@
                 }
             }
         }
-        resize_contentdiv('contentscroll','1','0');
+        resize_scrollbox('contentscroll','1','0');
 	return false;
 }
 
@@ -3797,196 +3797,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";
@@ -4140,10 +3950,12 @@
 
 =item dump_switchserver_js()
 
-=item resize_contentdiv_js()
+=item resize_scrollbox_js()
 
 =item makedocslogform()
 
+=item makesimpleeditform()
+
 =back
 
 =cut


More information about the LON-CAPA-cvs mailing list