← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1326: Fixed bug Data Element Group Editor: list of available DE includes already selected DE

 

------------------------------------------------------------
revno: 1326
committer: Tran Thanh Tri <Tran Thanh Tri@compaq>
branch nick: trunk
timestamp: Fri 2010-01-22 12:09:00 +0700
message:
  Fixed bug Data Element Group Editor: list of available DE includes already selected DE
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditor.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorGroupEditor.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditor.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditor.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-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java	2009-11-07 14:09:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java	2010-01-22 05:09:00 +0000
@@ -603,6 +603,11 @@
 
                 DataElement dataElement = dataElementMap.get( dataElementId ); //dataElementService.getDataElement( dataElementId );
                 
+                if( dataElement==null )
+                {
+                    throw new RuntimeException("Data Element Id: " + dataElementId + " not found");
+                }
+                
                 // -------------------------------------------------------------
                 // Find value type of data element
                 // -------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditor.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditor.vm	2009-10-20 13:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementGroupEditor.vm	2010-01-22 05:09:00 +0000
@@ -3,10 +3,19 @@
 .select
 {
 	border:#666666 thin solid;
-	min-width:300px;
+	width:300px;
 	size:30;
 }
 
+#tooltip {
+    color:#000; font-size:11px; line-height:1.2;
+    background-color:#FFFFCC; border:1px solid #667295; 
+    width:210px; padding:4px;
+	z-index: 100000;
+	display: none;
+	position:absolute;
+}
+
 </style>
 
 <h3>$i18n.getString( "data_element_group_management" )</h3>
@@ -31,11 +40,11 @@
 
 	<tr>
 		<td>
-			<select class="select" id="dataElementGroups" size="30" onchange="getDataElementGroup( this );">
+			<select class="select" id="dataElementGroups" size="30" onchange="getDataElementGroup( this );" onMouseOut="javascript: hideToolTip();">
 			</select>
 		</td>
 		<td>
-			<select class="select" id="selectedDataElements" multiple="multiple" size="30"  ondblclick="removeSelectedDataElements();">
+			<select class="select" id="selectedDataElements" multiple="multiple" size="30"  ondblclick="removeSelectedDataElements();" onMouseOut="javascript: hideToolTip();">
 			</select>
 		</td>
 
@@ -44,7 +53,7 @@
 			<input type="button" value="&gt;" onclick="removeSelectedDataElements();" style="width:30px">
 		</td>
 		<td>
-			<select class="select" id="availableDataElements" multiple="multiple" size="30"  ondblclick="addSelectedDataElements();" disabled="true">
+			<select class="select" id="availableDataElements" multiple="multiple" size="30"  ondblclick="addSelectedDataElements();" disabled="true" onMouseOut="javascript: hideToolTip();">
 			</select>
 		</td>
 	</tr>
@@ -86,6 +95,9 @@
 
 </div>
 
+<div id="tooltip"></div>
+
+
 <script type="text/javascript">
 	var i18n_select_dataelement_group = '$encoder.jsEscape( $i18n.getString( "select_dataelement_group" ) , "'")';
 	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_data_element_group" ) , "'")';

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorGroupEditor.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorGroupEditor.vm	2009-10-20 13:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorGroupEditor.vm	2010-01-22 05:09:00 +0000
@@ -7,6 +7,16 @@
 	size:30;
 }
 
+#tooltip {
+    color:#000; font-size:11px; line-height:1.2;
+    background-color:#FFFFCC; border:1px solid #667295; 
+    width:210px; padding:4px;
+	z-index: 100000;
+	display: none;
+	position:absolute;
+}
+
+
 </style>
 
 <h3>$i18n.getString( "indicator_group_editor" )</h3>
@@ -31,11 +41,11 @@
 
 	<tr>
 		<td>
-			<select class="select" id="indicatorGroups" size="30" onchange="getIndicatorGroup( this );">				
+			<select class="select" id="indicatorGroups" size="30" onchange="getIndicatorGroup( this );" onMouseOut="javascript: hideToolTip();">				
 			</select>
 		</td>
 		<td>
-			<select class="select" id="selectedIndicators" multiple="multiple" size="30"  ondblclick="removeSelectedIndicators();">
+			<select class="select" id="selectedIndicators" multiple="multiple" size="30"  ondblclick="removeSelectedIndicators();" onMouseOut="javascript: hideToolTip();">
 			</select>
 		</td>
 		
@@ -44,7 +54,7 @@
 			<input type="button" value="&gt;" onclick="removeSelectedIndicators();" style="width:30px">
 		</td>
 		<td>
-			<select class="select" id="availableIndicators" multiple="multiple" size="30"  ondblclick="addSelectedIndicators();" disabled="true">				
+			<select class="select" id="availableIndicators" multiple="multiple" size="30"  ondblclick="addSelectedIndicators();" disabled="true" onMouseOut="javascript: hideToolTip();">				
 			</select>
 		</td>
 	</tr>
@@ -86,6 +96,8 @@
 
 </div>
 
+<div id="tooltip"></div>
+
 <script type="text/javascript">
 
 	function cancel(){

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditor.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditor.js	2009-09-03 19:11:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditor.js	2010-01-22 05:09:00 +0000
@@ -1,4 +1,32 @@
+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';
+}
+// ========================================================================
 function initAllList()
 {
     var list = document.getElementById( 'dataElementGroups' );
@@ -6,14 +34,22 @@
 
     for ( id in dataElementGroups )
     {
-        list.add( new Option( dataElementGroups[id], id ), null );
+		var option = new Option( dataElementGroups[id], id );
+		option.onmousemove  = function(e){
+			showToolTip( e, this.text);
+		}
+        list.add( option, null );
     }
 
     list = document.getElementById( 'availableDataElements' );
 
     for ( id in availableDataElements )
     {
-        list.add( new Option( availableDataElements[id], id ), null );
+		var option = new Option( availableDataElements[id], id );
+		option.onmousemove  = function(e){
+			showToolTip( e, this.text);
+		}
+        list.add( option, null );        
     }
 
     if(list.selectedIndex==-1)
@@ -58,22 +94,6 @@
     filterSelectedDataElements();
     filterAvailableDataElements();
 }
-{
-    var filter = document.getElementById( 'dataElementGroupsFilter' ).value;
-    var list = document.getElementById( 'dataElementGroups' );
-
-    list.options.length = 0;
-
-    for ( var id in dataElementGroups )
-    {
-        var value = dataElementGroups[id];
-
-        if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
-        {
-            list.add( new Option( value, id ), null );
-        }
-    }
-}
 
 function filterAvailableDataElements()
 {
@@ -88,8 +108,12 @@
 
         if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
         {
-            list.add( new Option( value, id ), null );
-        }
+            var option = new Option( value, id );
+			option.onmousemove  = function(e){
+				showToolTip( e, this.text);
+			}
+	        list.add( option, null );
+	    }
     }
 }
 
@@ -106,7 +130,12 @@
 
         if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
         {
-            list.add( new Option( value, id ), null );
+			var option = new Option( value, id );
+			option.onmousemove  = function(e){
+				showToolTip( e, value);				
+			}
+            list.add( option, null );			
+
         }
     }
 }
@@ -138,6 +167,24 @@
 
     filterSelectedDataElements();
     document.getElementById('availableDataElements').disabled=false;
+	visableAvailableDataElements();	
+}
+
+function visableAvailableDataElements()
+{
+	var selectedList = byId( 'selectedDataElements' );
+	var availableList = byId( 'availableDataElements' );
+	var selectedOptions = selectedList.options;
+	var availableOptions = availableList.options;
+	
+	for(var i=0;i<availableOptions.length;i++){
+		availableList.options[i].style.display='block';
+		for(var j=0;j<selectedOptions.length;j++){			
+			if(availableOptions[i].value==selectedOptions[j].value){				
+				availableList.options[i].style.display='none';
+			}
+		}
+	}
 }
 
 function updateDataElementGroupMembers()

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditor.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditor.js	2009-03-23 16:35:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditor.js	2010-01-22 05:09:00 +0000
@@ -1,17 +1,54 @@
+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';
+}
 
 function initList() 
 {
 	var list = document.getElementById('indicatorGroups');
 	var id;
 
-	for (id in indicatorGroups) {
-		list.add(new Option(indicatorGroups[id], id), null);
+	for (id in indicatorGroups) {		
+		var option = new Option( indicatorGroups[id], id );
+		option.onmousemove  = function(e){
+			showToolTip( e, this.text);
+		}
+        list.add( option, null );  
+		
 	}
 
 	list = document.getElementById('availableIndicators');
 
-	for (id in availableIndicators) {
-		list.add(new Option(availableIndicators[id], id), null);
+	for (id in availableIndicators) {		
+		var option = new Option( availableIndicators[id], id );
+		option.onmousemove  = function(e){
+			showToolTip( e, this.text);
+		}
+        list.add( option, null );  
 	}
 
 	if (list.selectedIndex == -1) {
@@ -84,12 +121,30 @@
         var name = indicator.getElementsByTagName('name')[0].firstChild.nodeValue;
         selectedIndicators[id] = name;
     }
-    filterSelectedIndicators();   
-    document.getElementById( 'groupNameView').innerHTML = i18n_member_of + " <b>" + name + "</b>";
+    filterSelectedIndicators();       
     document.getElementById('availableIndicators').disabled=false;
+	visableAvailableIndicators();
     
 }
 
+function visableAvailableIndicators()
+{
+	var selectedList = byId( 'selectedIndicators' );
+	var availableList = byId( 'availableIndicators' );
+	var selectedOptions = selectedList.options;
+	var availableOptions = availableList.options;
+	
+	for(var i=0;i<availableOptions.length;i++){
+		availableList.options[i].style.display='block';
+		for(var j=0;j<selectedOptions.length;j++){			
+			if(availableOptions[i].value==selectedOptions[j].value){				
+				availableList.options[i].style.display='none';
+			}
+		}
+	}
+}
+
+
 /*==============================================================================
  *   Filter Indicator 
  *==============================================================================*/
@@ -106,8 +161,12 @@
         var value = selectedIndicators[id];
         
         if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
-        {
-            list.add( new Option( value, id ), null );
+        {            
+			var option = new Option( value, id );
+			option.onmousemove  = function(e){
+				showToolTip( e, this.text);
+			}
+	        list.add( option, null );  
         }
     }
 }
@@ -125,7 +184,11 @@
         
         if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
         {
-            list.add( new Option( value, id ), null );
+            var option = new Option( value, id );
+			option.onmousemove  = function(e){
+				showToolTip( e, this.text);
+			}
+	        list.add( option, null );  
         }
     }
 }
@@ -143,7 +206,11 @@
         
         if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
         {
-            list.add( new Option( value, id ), null );
+            var option = new Option( value, id );
+			option.onmousemove  = function(e){
+				showToolTip( e, this.text);
+			}
+	        list.add( option, null );  
         }
     }
 }