← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3134: Dataset Assignment Editor - Improved.

 

------------------------------------------------------------
revno: 3134
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-03-23 11:38:39 +0700
message:
  Dataset Assignment Editor - Improved.
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/cancel.png
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/edit_add.png
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/DefinedAssociationsEditorAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/ShowedAssociationsEditorAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/htmlGrid.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editor.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/loadIcon.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewEditorForm.vm


--
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
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/cancel.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/cancel.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/cancel.png	2011-03-23 04:38:39 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/edit_add.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/edit_add.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/edit_add.png	2011-03-23 04:38:39 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/DefinedAssociationsEditorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/DefinedAssociationsEditorAction.java	2011-03-21 14:30:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/DefinedAssociationsEditorAction.java	2011-03-23 04:38:39 +0000
@@ -29,6 +29,7 @@
 
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.source.Source;
 
@@ -41,6 +42,8 @@
 public class DefinedAssociationsEditorAction
     implements Action
 {
+    private static final String SEPERATE = " - ";
+
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -60,6 +63,17 @@
     }
 
     // -------------------------------------------------------------------------
+    // I18n
+    // -------------------------------------------------------------------------
+
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
 
@@ -119,20 +133,25 @@
     {
         DataSet dataSet = dataSetService.getDataSet( dataSetId );
         Source source = organisationUnitService.getOrganisationUnit( orgUnitId );
-        
-        title = source.getName() + " ( " + dataSet.getName() + " )";
-        
+
+        title = SEPERATE + dataSet.getName() + SEPERATE + source.getName();
+
         if ( assigned )
         {
             dataSet.getSources().add( source );
+
+            title = i18n.getString( "assigned" ) + SEPERATE + title;
         }
         else
         {
             dataSet.getSources().remove( source );
+
+            title = i18n.getString( "unassigned" ) + SEPERATE + title;
         }
 
         dataSetService.updateDataSet( dataSet );
-        
+
         return SUCCESS;
     }
+
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/ShowedAssociationsEditorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/ShowedAssociationsEditorAction.java	2011-03-21 14:30:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/ShowedAssociationsEditorAction.java	2011-03-23 04:38:39 +0000
@@ -115,6 +115,20 @@
 
         return maps;
     }
+    
+    public List<String> getHeaderIds()
+    {
+        List<String> ids = new ArrayList<String>();
+        
+        for ( GridHeader header : grid.getVisibleHeaders() )
+        {
+            ids.add( header.getColumn() );
+        }
+        
+        ids.remove( 0 );
+        
+        return ids;
+    }
 
     // -------------------------------------------------------------------------
     // Action implement

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/htmlGrid.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/htmlGrid.vm	2011-03-21 14:30:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/htmlGrid.vm	2011-03-23 04:38:39 +0000
@@ -1,35 +1,25 @@
-<style type="text/css">
-.gridTable th
-{
-  text-align: center;
-  width: 100%;
-}
-
-.gridTable td
-{
-  text-align: center;
-  padding: 8px 35px 8px 35px;
-  width: 100%;
-}
-
-.gridLeft td
-{
-  text-align: left;
-}
-</style>
+#set( $headers = $grid.getVisibleHeaders() )
+#set( $i18nAssigned = $i18n.getString( "assigned" ) )
+#set( $i18nUnassigned = $i18n.getString( "unassigned" ) )
 
 <h3>$!encoder.htmlEncode( $grid.title )</h3>
 
 <h5>$!encoder.htmlEncode( $grid.subtitle )</h5>
 
-<table class="listTable gridTable" border="1px">
-
-#set( $headers = $grid.getVisibleHeaders() )
+<table class="listTable">
+<col width="5px"/>
+<col width="80px"/>
+#foreach( $header in $headers )
+#if ( $velocityCount > 1 )
+<col width="35px"/>
+#end
+#end
 
 <thead>
 <tr>
+<th></th>
 #foreach( $header in $headers )
-<th #if( $header.meta )style="text-align:left;min-width:180px;"#end>$!encoder.htmlEncode( $header.name )</th>
+<th>$!encoder.htmlEncode( $header.name )</th>
 #end
 </tr>
 </thead>
@@ -38,18 +28,35 @@
 #foreach( $meta in $!MetaValues )
 	#set( $list = $!MetaValueMaps.get( $meta.id ) )
 	<tr>
+		<td><input type="checkbox" onchange="assignAll( $meta.id )"/></td>
 		<td>$meta</td>
-		#foreach( $item in $list )
-		#set( $title = $meta + " ( " + $headers.get( $velocityCount ).name + " )" )
+	#foreach( $item in $list )
+		#set( $title = " - " + $headers.get( $velocityCount ).name + " - " + $meta )
+		#if( $item.metaValue == "true" )
+		#set( $title = $i18nAssigned + $title )
+		#else
+		#set( $title = $i18nUnassigned + $title )
+		#end
 		<td>
-			<div id="div$item.id$item.name">
-				<img #if ( $item.metaValue == "true" ) src="../images/assign_a.png" #else src="../images/forum_denied.png" #end onclick="changeAssociatedStatus( $item.id, $item.name, $item.metaValue )" style="cursor:pointer" title="$title"/>
-				<span #if ( $item.metaValue == "true" ) style="color:blue" #end>#if ( $item.metaValue == "true" ) $i18n.getString( "assigned" ) #else $i18n.getString( "unassigned" ) #end</span>
+			<div id="div$item.id$item.name" align="center">
+				<img #if ( $item.metaValue == "true" ) src="../images/edit_add.png" #else src="../images/cancel.png" #end 
+				onclick="changeAssociatedStatus( $item.id, $item.name, $item.metaValue )" style="cursor:pointer" title="$title"/>
+				<input type="hidden" value="$item.metaValue"/>
 			</div>
 		</td>
-		#end
+	#end
 	</tr>
 #end
 </tbody>
-
-</table>
\ No newline at end of file
+</table>
+
+<script type="text/javascript">	
+	
+	if( arrayIds.length < $headerIds.size() )
+	{	
+		#foreach( $id in $headerIds )
+			arrayIds.push( '$encoder.jsEscape( $id, "'" )' );	
+		#end
+	}
+
+</script>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editor.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editor.js	2011-03-21 14:30:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editor.js	2011-03-23 04:38:39 +0000
@@ -1,4 +1,9 @@
 
+// Global variables:
+
+arrayIds = new Array();
+
+
 function displayAssociatedForm()
 {
 	var url = "showedAssociationsEditor.action";
@@ -16,6 +21,14 @@
 	url += "orgUnitId=" + orgunitId ;
 	url += "&dataSetId=" + dataSetId;
 	url += "&assigned=" + !assigned;
-
+	
 	$( "#div" + orgunitId + dataSetId ).load( url );
+}
+
+function assignAll( orgunitId )
+{
+	for ( var i = 0 ; i < arrayIds.length ; i++ )
+	{
+		changeAssociatedStatus( orgunitId, arrayIds[i], eval($("#div" + orgunitId + arrayIds[i] + " input[type='hidden']").val()) );
+	}
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/loadIcon.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/loadIcon.vm	2011-03-21 14:30:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/loadIcon.vm	2011-03-23 04:38:39 +0000
@@ -1,2 +1,2 @@
-<img #if ( $assigned ) src="../images/assign_a.png" #else src="../images/forum_denied.png" #end onclick="changeAssociatedStatus( $orgUnitId, $dataSetId, $assigned )" style="cursor:pointer" title="$title"/>
-<span #if ( $assigned ) style="color:blue" #end>#if ( $assigned ) $i18n.getString( 'assigned' ) #else $i18n.getString( 'unassigned' ) #end</span>
\ No newline at end of file
+<img #if ( $assigned ) src="../images/edit_add.png" #else src="../images/cancel.png" #end onclick="changeAssociatedStatus( $orgUnitId, $dataSetId, $assigned )" style="cursor:pointer" title="$title"/>
+<input type="hidden" value="$assigned"/>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewEditorForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewEditorForm.vm	2011-03-21 14:30:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewEditorForm.vm	2011-03-23 04:38:39 +0000
@@ -27,4 +27,5 @@
 	});
 	
 	var i18n_processing = '$encoder.jsEscape( $i18n.getString( "processing" ) , "'")';
-</script>
+
+</script>
\ No newline at end of file