Diff for /loncom/interface/londocs.pm between versions 1.484 and 1.485

version 1.484, 2012/05/07 02:12:47 version 1.485, 2012/05/09 19:46:30
Line 1664  sub checkonthis { Line 1664  sub checkonthis {
   
 =item list_symbs()  =item list_symbs()
   
 List Content Idenifiers  List Content Identifiers
   
 =cut  =cut
   
Line 2441  sub handler { Line 2441  sub handler {
     $script .= &editing_js($udom,$uname,$supplementalflag).      $script .= &editing_js($udom,$uname,$supplementalflag).
                        &history_tab_js().                         &history_tab_js().
                        &inject_data_js().                         &inject_data_js().
                        &resize_contentdiv_js($tabidstr);                         &Apache::lonhtmlcommon::resize_scrollbox_js('docs',$tabidstr);
             $addentries = {              $addentries = {
                             onload   => "javascript:resize_contentdiv('contentscroll','1','1');",                              onload   => "javascript:resize_scrollbox('contentscroll','1','1');",
                           };                            };
         }          }
     }      }
Line 3683  function showPage(current, pageId, nav, Line 3683  function showPage(current, pageId, nav,
                 }                  }
             }              }
         }          }
         resize_contentdiv('contentscroll','1','0');          resize_scrollbox('contentscroll','1','0');
  return false;   return false;
 }  }
   
Line 3800  function choose_switchserver_window() { Line 3800  function choose_switchserver_window() {
 ENDSWITCHJS  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 {  sub makedocslogform {
     my ($formelems,$docslog) = @_;      my ($formelems,$docslog) = @_;
     return <<"LOGSFORM";      return <<"LOGSFORM";
Line 4143  Breadcrumbs for special functions Line 3953  Breadcrumbs for special functions
   
 =item dump_switchserver_js()  =item dump_switchserver_js()
   
 =item resize_contentdiv_js()  =item resize_scrollbox_js()
   
 =item makedocslogform()  =item makedocslogform()
   
   =item makesimpleeditform()
   
 =back  =back
   
 =cut  =cut

Removed from v.1.484  
changed lines
  Added in v.1.485


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>