Code

Line Highlighting in divlists
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Apr 2006 15:10:53 +0000 (15:10 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Apr 2006 15:10:53 +0000 (15:10 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2957 594d385d-05f5-0310-b6e9-bd551577e9d8

html/include/focus.js
html/themes/default/style.css
include/class_divlist.inc

index 457e67e1cf1a2f39d8e16b49cfdd60d8d6e7804e..e8c92c96ff4c20fdada3d53368c46ba3e9b21cc6 100644 (file)
@@ -217,30 +217,56 @@ function adjust_height(e) {
 function adjust_width(e) {
        if (!e) e=window.event;
 
-       // Resize the div
-       var div_width=parseInt(document.defaultView.getComputedStyle(document.getElementById("t_scrolltable"),"").getPropertyValue('width'));
-       var width= parseInt(window.innerWidth);
+       // Known to not work with IE
+       if(document.defaultView) {
+               // Resize the div
+               var div_width=parseInt(document.defaultView.getComputedStyle(document.getElementById("t_scrolltable"),"").getPropertyValue('width'));
+               var width= parseInt(window.innerWidth);
 
-       // Resize the body cells
+               // Resize the body cells
                var diff= width-div_width-470;
-
-       // 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";
+               
+               // 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";
        
-               // Resize the Header cells (only the relative-width ones)
-               document.getElementById('t_scrollhead').style.width=div_width+diff+"px";
-
-       // window has been downscaled, we must reset the div to 600px
-       } else if (width < 930) {
-               // Reset layout (set width to 600px)
-               div_width=600;
-               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+diff+"px";
+
+               // window has been downscaled, we must reset the div to 600px
+               } else if (width < 930) {
+                       // Reset layout (set width to 600px)
+                       div_width=600;
+                       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";
+                       // Resize the Header cells (only the relative-width ones)
+                       document.getElementById('t_scrollhead').style.width=div_width+"px";
+               }
+       } else {
+               // IE
+
+       }
+}
+
+function highlight(e) {
+       if(e) {
+               for(i=0;i<e.parentNode.getElementsByTagName('td').length;i++) {
+                       e.parentNode.getElementsByTagName('td')[i].style.background='#CDF6BD';
+               }
+       }
+}
+
+function unhighlight(e,style) {
+       if(e && style) {
+               for(i=0;i<e.parentNode.getElementsByTagName('td').length;i++) {
+                       if(style=='list0') {
+                               e.parentNode.getElementsByTagName('td')[i].style.background='#F0F0F0';
+                       } else {
+                               e.parentNode.getElementsByTagName('td')[i].style.background='#FFFFFF';
+                       }
+               }
        }
 }
 // vim:ts=2:syntax
index c87fba644997609f47f753d449d09c5b87b09fa5..4553657120d201abcb9efed052a418c08a136472 100644 (file)
@@ -81,6 +81,10 @@ td.list0 {
        height:22px;
 }
 
+td.list0:hover {
+       background:#CDF6BD;
+}
+
 td.list0#icon {
        width:20px;
        text-align:center;
@@ -126,6 +130,10 @@ td.list1 {
        height:22px;
 }
 
+td.list1:hover {
+       background:#CDF6BD;
+}
+
 td.list1#fill {
        height:100%;
 }
index fe836f4531b89b4429171f0f68c6dfea21d5e8b4..461d3f92d8e53b07f6e80edf517766d825d20b36 100644 (file)
@@ -176,7 +176,7 @@ class divlist {
                                
                                if($i_alternate) $i_alternate=0; else $i_alternate=1;
                                
-                               $s_return .= "\n<tr>";
+                               $s_return .= "\n<tr class='rowxp'>";
                                
                                $cnt = 0;                                       
                                        
@@ -262,7 +262,7 @@ class divlist {
                                          $style = " ".$s_value2['attach']." "  ;
                                  }
             
-            $s_return .= "\n<td ".$style." class='".$class."'>";
+            $s_return .= "\n<td ".$style." class='".$class."' onmouseover='highlight(this);' onmouseout='unhighlight(this,\"list".$i_alternate."\");'>";
                                  $s_return .= $s_value2['string'];
                                  $s_return .= "</td>";
                          }
@@ -275,9 +275,9 @@ class divlist {
         $fill= "";
         for ($i= 1; $i <= $this->cols; $i++){
           if ($i == $this->cols){
-           $fill.= "<td class='list1' style='height:100%;border-right:0px;'>&nbsp;</td>";
+           $fill.= "<td class='list1' onmouseover='highlight;' style='height:100%;border-right:0px;'>&nbsp;</td>";
           } else {
-           $fill.= "<td class='list1' style='height:100%;'>&nbsp;</td>";
+           $fill.= "<td class='list1' onmouseover='highlight;' style='height:100%;'>&nbsp;</td>";
           }
         }
         $s_return.="\n<tr>$fill";