← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 853: Fix bug tooltip for Individual Report Excel module

 

------------------------------------------------------------
revno: 853
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2009-10-14 09:21:43 +0700
message:
  Fix bug tooltip for Individual Report Excel module
modified:
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/individualReportExcel.vm
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/individual.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/individualReportExcel.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/individualReportExcel.vm	2009-10-09 01:47:46 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/individualReportExcel.vm	2009-10-14 02:21:43 +0000
@@ -1,28 +1,12 @@
-<link rel="stylesheet" href="css/ex.css" type="text/css">
 <style type="text/css">
-div#tipDiv {
+#tooltip {
     color:#000; font-size:11px; line-height:1.2;
     background-color:#E1E5F1; border:1px solid #667295; 
     width:210px; padding:4px;
 }
 </style>
-<script src="js/dw_event.js" type="text/javascript"></script>
-<script src="js/dw_viewport.js" type="text/javascript"></script>
-<script src="js/dw_tooltip.js" type="text/javascript"></script>
-<script src="js/dw_tooltip_aux.js" type="text/javascript"></script>
-<script type="text/javascript">
-
-dw_Tooltip.content_vars = {
-    L1: 'Some text in the tooltip for link 1',
-    L2: 'The tooltip can contain <strong><em>Rich HTML</em></strong>',
-    L3: '<div style="text-align:center"><img src="images/dot-com-btn.gif" /></div>',
-    L4: 'You can have a tooltip pop up when hovering over an image too of course!'
-}
-
-
-</script>
-
 <h3>$i18n.getString( "individual_report" )</h3>
+<div id="tooltip" style=" display:none; background-color:#FFFFCC; ; position:absolute;" ></div>
 
 <form id="editDataSetForm" name="editDataSetForm" method="post" onsubmit="submitForm(); return validateEditDataSet()">
   <div style="display:inline">
@@ -90,7 +74,7 @@
         <td>
           <!-- List of all available DataElements -->
 		 
-          <select size="15"  id="availableDataElements" name="availableDataElements" style="max-width:30em;min-width:30em;height:10em" onChange="getOptionCombos();">
+          <select size="15"  onMouseOut="javascript: hideToolTip();" hideToolTip id="availableDataElements" name="availableDataElements" style="max-width:30em;min-width:30em;height:10em" onChange="getOptionCombos();">
           </select>
 		  <br><br>
 		  <strong>$i18n.getString('category_option_combo')</strong><br>
@@ -104,7 +88,7 @@
         </td>
         <td>
           <!-- List of all selected DataElements -->
-          <select  size="15" id="selectedDataElements" name="selectedDataElements" style="max-width:30em;min-width:30em;height:22em" ondblclick="removeDataSetMembers();">
+          <select  size="15" onMouseOut="javascript: hideToolTip();" id="selectedDataElements" name="selectedDataElements" style="max-width:30em;min-width:30em;height:22em" ondblclick="removeDataSetMembers();">
           </select>
         </td>
       </tr>
@@ -142,7 +126,8 @@
         <td>
           <!-- List of all available DataElements -->
           <select size="15" id="availablePeriods" name="availablePeriods" multiple="multiple" style="max-width:30em;min-width:30em;height:20em" ondblclick="moveSelectedById( 'availablePeriods', 'selectedPeriods' );">
-          </select>
+          
+		  </select>
 </td>
         <td>
           <input type="button" value="&gt;" title="$i18n.getString('move_selected')" onclick="moveSelectedById( 'availablePeriods', 'selectedPeriods' );">
@@ -166,17 +151,13 @@
     </tbody>
   </table>
 </form>
-
 <span id="message"></span>
 <span id="loading" style="display:none;position:fixed;"><img src="../images/ajax-loader.gif" /></span>
 
 <script type="text/javascript">
 
 	var dataSetMembers = new Object();
-	//#foreach ( $dataElement in $dataSetDataElements )
-		//dataSetMembers['$dataElement.id'] = '$encoder.jsEscape( $dataElement.name, "'" )';
-	//#end
-
+	
 	var availableAllDataElements = new Object();	
 	#foreach ( $availableDataElement in $dataElements )
 		availableAllDataElements['$availableDataElement.id'] = '$encoder.jsEscape( $availableDataElement.name, "'" )';

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/individual.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/individual.js	2009-10-09 06:06:43 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/individual.js	2009-10-14 02:21:43 +0000
@@ -39,36 +39,36 @@
 
 function filterByDataElementGroup( selectedDataElementGroup )
 {
-  var request = new Request();
-
-  var requestString = 'filterAvailableDataElementsByDataElementGroup.action';
-  
-  var params = 'dataElementGroupId=' + selectedDataElementGroup;
-
-  var selectedList = byId( 'selectedDataElements' );
-
-	
-  for ( var i = 0; i < selectedList.options.length; ++i)
-  {
-	var selectedValue = selectedList.options[i].value;
-	  
-	var id = selectedValue.substring(selectedValue.indexOf(".") + 1, selectedValue.length);
-
-  	params += '&selectedDataElements=' + id;
-  }
-
-  // Clear the Dataelement list
-  var availableList = document.getElementById( 'availableDataElements' );
-  availableList.options.length = 0;
-
-  // Clear the OptionCombo list
-  availableList = document.getElementById( 'availableOptionCombos' );
-  availableList.options.length = 0;
-  
-  request.setResponseTypeXML( 'dataElementGroup' );
-  request.setCallbackSuccess( filterByDataElementGroupCompleted );
-  request.sendAsPost( params );
-  request.send( requestString );
+	  var request = new Request();
+
+	  var requestString = 'filterAvailableDataElementsByDataElementGroup.action';
+	  
+	  var params = 'dataElementGroupId=' + selectedDataElementGroup;
+
+	  var selectedList = byId( 'selectedDataElements' );
+
+		
+	  for ( var i = 0; i < selectedList.options.length; ++i)
+	  {
+		var selectedValue = selectedList.options[i].value;
+		  
+		var id = selectedValue.substring(selectedValue.indexOf(".") + 1, selectedValue.length);
+
+		params += '&selectedDataElements=' + id;
+	  }
+
+	  // Clear the Dataelement list
+	  var availableList = document.getElementById( 'availableDataElements' );
+	  availableList.options.length = 0;
+
+	  // Clear the OptionCombo list
+	  availableList = document.getElementById( 'availableOptionCombos' );
+	  availableList.options.length = 0;
+	  
+	  request.setResponseTypeXML( 'dataElementGroup' );
+	  request.setCallbackSuccess( filterByDataElementGroupCompleted );
+	  request.sendAsPost( params );
+	  request.send( requestString );
 
 }
 
@@ -82,11 +82,14 @@
   for ( var i = 0; i < dataElementList.length; i++ )
   {
     var dataElement = dataElementList[i];
-    var name = dataElement.firstChild.nodeValue;
+    var value = dataElement.firstChild.nodeValue;
     var id = dataElement.getAttribute( 'id' );
-	var option = new Option( name, id );
-	dw_Tooltip.content_vars[i] = name;
-	option.setAttribute("class", "showTip " + i );
+	var option = new Option( value, id );
+	
+	option.onmousemove  = function(e){
+		showToolTip( e, availableAllDataElements[this.value]);
+	}
+	
 	availableList.add( option , null );
   }
   
@@ -109,9 +112,14 @@
         
 		var option = new Option( value, id );
 		
-		dw_Tooltip.content_vars[id] = name;
+		//dw_Tooltip.content_vars[id] = name;
 	
-		option.setAttribute("class", "showTip " + id );
+		option.onmousemove  = function(e){
+			showToolTip(e, name);
+		}
+			
+		//option.setAttribute("onMouseOver",  showToolTip(byId('tooltip'), value) );
+		//option.setAttribute("class", "showTip " + id );
 	
         if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
         {
@@ -128,9 +136,9 @@
     {
 		var option = new Option( availableAllDataElements[id], id );
 		
-		dw_Tooltip.content_vars[id] = availableAllDataElements[id];
-		
-		option.setAttribute("class", "showTip " + id );
+		option.onmousemove  = function(e){
+			showToolTip(e, this.text);
+		}
 		
         list.add(option , null );
     }
@@ -152,13 +160,15 @@
 
         dataSetMembers[id] = list.options[list.selectedIndex].text + " - " + listOptionCombo[listOptionCombo.selectedIndex].text;
     
-			
-		
-		dw_Tooltip.content_vars[id] = dataSetMembers[id];
+		//dw_Tooltip.content_vars[id] = dataSetMembers[id];
 	
 		var option =  new Option( dataSetMembers[id], id );
 	
-		option.setAttribute("class", "showTip " + id );
+		option.onmousemove  = function(e){
+			showToolTip( e, this.text);
+		}
+		
+		//option.setAttribute("class", "showTip " + id );
 	
 		byId( 'selectedDataElements' ).add(option, null );
 		
@@ -265,4 +275,35 @@
 			deleteDivEffect();
 			$("#loading").hide();		
 		},'xml');
+}
+
+// -----------------------------------------------------------------------------
+function showToolTip( e, value){
+	
+	var tooltipDiv = byId('tooltip');
+	tooltipDiv.style.display = 'block';
+	
+	var posx = 0;
+    var posy = 0;
+	
+    if (!e) var e = window.event;
+    if (e.pageX || e.pageY)
+    {
+        posx = e.pageX;
+        posy = e.pageY;
+    }
+    else if (e.clientX || e.clientY)
+    {
+        posx = e.clientX;
+        posy = e.clientY;
+    }
+	
+	
+	tooltipDiv.style.left= posx  + 8 + 'px';
+	tooltipDiv.style.top = posy  + 8 + 'px';
+	tooltipDiv.innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +   value;
+}
+
+function hideToolTip(){
+	byId('tooltip').style.display = 'none';
 }
\ No newline at end of file