Code

Ported ogroups to new listing.
[gosa.git] / gosa-core / html / include / focus.js
index 129e6162571f0e8d2f6d505599dd48f3cbabfd85..6ade45d20b410747c990c79de7a3296855b52a40 100644 (file)
@@ -1,11 +1,32 @@
-var browserType;
+var browserType = "Not dectected, adjust focus.js";
 var firefoxType;
 
-if (document.layers) {browserType = "nn4"}
-if (document.all) {browserType = "ie"}
-if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko"}
-if (browserType=="gecko" && window.navigator.userAgent.toLowerCase().match("firefox\/2")) {firefoxType= "firefox2"}
-else {firefoxType= "firefox"};
+if (document.layers) 
+{
+               browserType = "nn4";
+}
+
+if (document.all) 
+{
+               browserType = "ie";
+}
+
+if (window.navigator.userAgent.toLowerCase().match("gecko")) 
+{
+               browserType= "gecko";
+}
+
+if (window.navigator.userAgent.toLowerCase().match(/opera/i)) 
+{
+               browserType= "gecko";
+}
+
+if (browserType=="gecko" && window.navigator.userAgent.toLowerCase().match("firefox\/2")) 
+{
+               firefoxType= "firefox2";
+}else{
+               firefoxType= "firefox";
+}
 
 netscape = "";
 ver= navigator.appVersion; len = ver.length;
@@ -75,7 +96,15 @@ function acl_toggle_all(regex)
                                }
 }
 
+
+var enable_keyPress = true;
 function keyPress(DnEvents) {
+
+       /* We are forced to skip this Keyboard input filtering 
+   *  (enable_keyPress was set to false in the HTML content)
+   */
+       if(!enable_keyPress) return;
+
   // determines whether Netscape or Internet Explorer
   k = (netscape) ? DnEvents.keyCode : window.event.keyCode;
   if (k == 13) { // enter key pressed
@@ -227,7 +256,7 @@ function show(element) {
   document.poppedLayer.style.visibility = "visible";
 }
 
-function toggle(element) {
+function GOsa_toggle(element) {
   if (browserType == "gecko" )
      document.poppedLayer = document.getElementById(element);
   else if (browserType == "ie")
@@ -257,7 +286,7 @@ function js_check(form) {
        form.javascript.value = 'true';
 }
 
-function divtoggle(element) {
+function divGOsa_toggle(element) {
        var cell;
        var cellname="tr_"+(element);
 
@@ -309,15 +338,20 @@ function adjust_height(e) {
        
                // document.defaultView allows access to the rendered size of elements and should be supported by modern browsers
                if(document.defaultView) {
-                       var menu_height=parseInt(document.defaultView.getComputedStyle(document.getElementById("menucell"),"").getPropertyValue('height'));
-       
-                       // Minimum height for divlist should be the bottom edge of the menu
-                       min_height= menu_height-197;
-                       suggested= min_height;
-                       if((inner_height-230)-suggested>0) {
-                               suggested= inner_height-230;
-                       }
+                        var menu_height= 0;
+                        if (document.getElementById("d_height")){
+                         suggested= parseInt(document.getElementById("d_height").value);
+                        } else {
+                         menu_height=parseInt(document.defaultView.getComputedStyle(document.getElementById("menucell"),"").getPropertyValue('height'));
+                         // Minimum height for divlist should be the bottom edge of the menu
+                         min_height= menu_height-197;
+                         suggested= min_height;
+                         if((inner_height-230)-suggested>0) {
+                               suggested= inner_height-230;
+                         }
                
+                        }
+       
                // IE uses other height specifications
                } else if (browserType == "ie") {
                        suggested= document.all.menucell.offsetHeight;
@@ -361,20 +395,36 @@ function adjust_width(e)
                var width= parseInt(window.innerWidth);
 
                // Resize the body cells, 470 represents the info box and the navigation part 
-               var diff= width -       div_width       -       470;
-               
+                var save= 470;
+                if(document.getElementById('d_save')) {
+                  save= document.getElementById('d_save').value;
+                }
+                var space= 600;
+                if(document.getElementById('d_space')) {
+                  space= document.getElementById('d_space').value;
+                }
+               var diff= width - div_width - save;
+
                // window has been upscaled
-               if(div_width+diff>=600) {
-                       document.getElementById('d_scrollbody').style.width=div_width+diff+"px";
-                       document.getElementById('t_scrollbody').style.width=(div_width-19)+diff+"px";
+               if(div_width+diff>=space) {
+                        if (width - save > space) {
+                         document.getElementById('d_scrollbody').style.width=div_width+diff+"px";
+                         document.getElementById('t_scrollbody').style.width=(div_width-19)+diff+"px";
        
-                       // Resize the Header cells (only the relative-width ones)
-                       document.getElementById('t_scrollhead').style.width=div_width+diff+"px";
+                         // Resize the Header cells (only the relative-width ones)
+                         document.getElementById('t_scrollhead').style.width=div_width+diff+"px";
+                        } else {
+                         document.getElementById('d_scrollbody').style.width=div_width+"px";
+                         document.getElementById('t_scrollbody').style.width=(div_width-19)+"px";
+       
+                         // Resize the Header cells (only the relative-width ones)
+                         document.getElementById('t_scrollhead').style.width=div_width+"px";
+                        }
 
                // window has been downscaled, we must reset the div to 600px
-               } else if (width < 930) {
+               } else if (width < 1200) {
                        // Reset layout (set width to 600px)
-                       div_width=600;
+                       div_width=space;
                        document.getElementById('d_scrollbody').style.width=div_width+"px";
                        document.getElementById('t_scrollbody').style.width=(div_width-19)+"px";