← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2386: Excel reporting - Fixed bug <688107> Can't copy report items from category report to another cate...

 

------------------------------------------------------------
revno: 2386
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2010-12-16 11:49:14 +0700
message:
  Excel reporting - Fixed bug <688107> Can't copy report items from category report to another category report.
  Fixed bug Can't delete report items from excel reports.
modified:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/comparator/FileNameComparator.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/action/CopyExcelItemAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/ExcelTemplateListAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/CopyReportExcelItemAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java


--
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-support/dhis-support-system/src/main/java/org/hisp/dhis/system/comparator/FileNameComparator.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/comparator/FileNameComparator.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/comparator/FileNameComparator.java	2010-12-16 04:49:14 +0000
@@ -42,7 +42,6 @@
     @Override
     public int compare( File arg0, File arg1 )
     {
-
         return arg0.getName().compareToIgnoreCase( arg1.getName() );
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/action/CopyExcelItemAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/action/CopyExcelItemAction.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/action/CopyExcelItemAction.java	2010-12-16 04:49:14 +0000
@@ -43,98 +43,100 @@
  * @version $Id$
  */
 
-public class CopyExcelItemAction implements Action {
-	// -------------------------------------------
-	// Dependency
-	// -------------------------------------------
-
-	private ExcelItemService excelItemService;
-
-	private ReportExcelService reportExcelService;
-
-	private StatementManager statementManager;
-
-	// -------------------------------------------
-	// Input
-	// -------------------------------------------
-
-	private Integer excelItemGroupId;
-
-	private Integer sheetNo;
-
-	private Collection<String> reportItemIds;
-
-	// -------------------------------------------
-	// Getter & Setter
-	// -------------------------------------------
-
-	public void setStatementManager(StatementManager statementManager) {
-		this.statementManager = statementManager;
-	}
-
-	public void setReportExcelService(ReportExcelService reportExcelService) {
-		this.reportExcelService = reportExcelService;
-	}
-
-	public void setExcelItemGroupId(Integer excelItemGroupId) {
-		this.excelItemGroupId = excelItemGroupId;
-	}
-
-	public Integer getSheetNo() {
-		return sheetNo;
-	}
-
-	public void setReportItemIds(Collection<String> reportItemIds) {
-		this.reportItemIds = reportItemIds;
-	}
-
-	public void setExcelItemService(ExcelItemService excelItemService) {
-		this.excelItemService = excelItemService;
-	}
-
-	public void setSheetNo(Integer sheetNo) {
-		this.sheetNo = sheetNo;
-	}
-
-	// -------------------------------------------
-	// Action implementation
-	// -------------------------------------------
-
-	public String execute() throws Exception {
-		
-		statementManager.initialise();
-
-		ExcelItemGroup excelItemGroup = excelItemService
-				.getExcelItemGroup(excelItemGroupId);
-
-		for (String itemId : reportItemIds) {
-
-			ReportExcelItem source = reportExcelService
-					.getReportExcelItem(Integer.parseInt(itemId));
-
-			ExcelItem excelItem = new ExcelItem();
-
-			excelItem.setName(source.getName());
-
-			excelItem.setRow(source.getRow());
-
-			excelItem.setColumn(source.getColumn());
-
-			excelItem.setExpression(source.getExpression());
-
-			excelItem.setSheetNo(sheetNo);
-
-			excelItem.setExcelItemGroup(excelItemService
-					.getExcelItemGroup(excelItemGroupId));
-			
-			excelItemService.addExcelItem(excelItem);
-		}
-
-		excelItemService.updateExcelItemGroup(excelItemGroup);
-
-		statementManager.destroy();
-
-		return SUCCESS;
-	}
+public class CopyExcelItemAction
+    implements Action
+{
+    // -------------------------------------------
+    // Dependency
+    // -------------------------------------------
+
+    private ExcelItemService excelItemService;
+
+    private ReportExcelService reportExcelService;
+
+    private StatementManager statementManager;
+
+    // -------------------------------------------
+    // Input
+    // -------------------------------------------
+
+    private Integer excelItemGroupId;
+
+    private Integer sheetNo;
+
+    private Collection<String> reportItemIds;
+
+    // -------------------------------------------
+    // Getter & Setter
+    // -------------------------------------------
+
+    public void setStatementManager( StatementManager statementManager )
+    {
+        this.statementManager = statementManager;
+    }
+
+    public void setReportExcelService( ReportExcelService reportExcelService )
+    {
+        this.reportExcelService = reportExcelService;
+    }
+
+    public void setExcelItemGroupId( Integer excelItemGroupId )
+    {
+        this.excelItemGroupId = excelItemGroupId;
+    }
+
+    public Integer getSheetNo()
+    {
+        return sheetNo;
+    }
+
+    public void setReportItemIds( Collection<String> reportItemIds )
+    {
+        this.reportItemIds = reportItemIds;
+    }
+
+    public void setExcelItemService( ExcelItemService excelItemService )
+    {
+        this.excelItemService = excelItemService;
+    }
+
+    public void setSheetNo( Integer sheetNo )
+    {
+        this.sheetNo = sheetNo;
+    }
+
+    // -------------------------------------------
+    // Action implementation
+    // -------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        statementManager.initialise();
+
+        ExcelItemGroup excelItemGroup = excelItemService.getExcelItemGroup( excelItemGroupId );
+
+        for ( String itemId : reportItemIds )
+        {
+            ReportExcelItem source = reportExcelService.getReportExcelItem( Integer.parseInt( itemId ) );
+
+            ExcelItem excelItem = new ExcelItem();
+
+            excelItem.setName( source.getName() );
+            excelItem.setRow( source.getRow() );
+            excelItem.setColumn( source.getColumn() );
+            excelItem.setExpression( source.getExpression() );
+            excelItem.setSheetNo( sheetNo );
+            excelItem.setExcelItemGroup( excelItemService.getExcelItemGroup( excelItemGroupId ) );
+
+            excelItemService.addExcelItem( excelItem );
+        }
+
+        excelItemService.updateExcelItemGroup( excelItemGroup );
+
+        statementManager.destroy();
+
+        return SUCCESS;
+    }
 
 }

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/ExcelTemplateListAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/ExcelTemplateListAction.java	2010-08-23 08:51:26 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/ExcelTemplateListAction.java	2010-12-16 04:49:14 +0000
@@ -56,9 +56,9 @@
 public class ExcelTemplateListAction
     extends ActionSupport
 {
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
     // Dependency
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
 
     private ReportLocationManager reportLocationManager;
 
@@ -81,14 +81,15 @@
         this.reportService = reportService;
     }
 
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
     // Input
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
+    
     private String mode;
 
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
     // Output
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
 
     private String newFileUploadedOrRenamed;
 
@@ -96,9 +97,9 @@
 
     private List<String> reportTypes = new ArrayList<String>();
 
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
     // Getter && Setter
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
 
     public Map<String, Boolean> getMapTemplateFiles()
     {
@@ -140,9 +141,9 @@
         return reportTypes;
     }
 
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
     // Action implementation
-    // -------------------------------------------
+    // -------------------------------------------------------------------------
 
     @Override
     public String execute()
@@ -157,9 +158,9 @@
 
         String newUploadOrRenamePath = null;
 
-        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         // Get the path of newly uploaded file
-        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
         if ( !StringUtils.isNullOREmpty( mode ) )
         {
@@ -178,9 +179,9 @@
             newFileUploadedOrRenamed = new File( newUploadOrRenamePath ).getName();
         }
 
-        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         // Get the list of files
-        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
         List<File> templateFiles = FileUtils.getListFile( templateDirectory, new ExcelFileFilter() );
 
@@ -188,8 +189,6 @@
 
         Collection<String> reportExcelTemplates = reportService.getALLReportExcelTemplates();
 
-        Collections.sort( templateFiles );
-
         for ( File file : templateFiles )
         {
             if ( reportExcelTemplates.contains( file.getName() ) )

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/CopyReportExcelItemAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/CopyReportExcelItemAction.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/CopyReportExcelItemAction.java	2010-12-16 04:49:14 +0000
@@ -26,7 +26,8 @@
  */
 package org.hisp.dhis.reportexcel.item.action;
 
-import java.util.Collection;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.amplecode.quick.StatementManager;
 import org.hisp.dhis.reportexcel.ReportExcel;
@@ -59,7 +60,7 @@
 
     private Integer sheetNo;
 
-    private Collection<String> reportItems;
+    private List<String> reportItems = new ArrayList<String>();
 
     // -------------------------------------------
     // Getter & Setter
@@ -90,7 +91,7 @@
         this.reportId = reportId;
     }
 
-    public void setReportItems( Collection<String> reportItems )
+    public void setReportItems( List<String> reportItems )
     {
         this.reportItems = reportItems;
     }
@@ -106,11 +107,11 @@
         statementManager.initialise();
 
         ReportExcel reportExcel = reportService.getReportExcel( reportId );
-
+        
         for ( String itemId : this.reportItems )
         {
             ReportExcelItem reportItem = reportService.getReportExcelItem( Integer.parseInt( itemId ) );
-            
+
             ReportExcelItem newReportItem = new ReportExcelItem();
             newReportItem.setName( reportItem.getName() );
             newReportItem.setItemType( reportItem.getItemType() );
@@ -121,11 +122,10 @@
             newReportItem.setSheetNo( sheetNo );
             newReportItem.setReportExcel( reportExcel );
             reportService.addReportExcelItem( newReportItem );
-        }     
+        }
 
         statementManager.destroy();
 
         return SUCCESS;
     }
-
 }

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml	2010-12-15 07:52:20 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml	2010-12-16 04:49:14 +0000
@@ -384,7 +384,7 @@
 		<action name="copyReportExcelItems"
 			class="org.hisp.dhis.reportexcel.item.action.CopyReportExcelItemAction">
 			<result name="success" type="velocity-xml">
-				/dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
 		</action>
 
@@ -1035,7 +1035,7 @@
 		<action name="copyExcelItems"
 			class="org.hisp.dhis.reportexcel.excelitem.action.CopyExcelItemAction">
 			<result name="success" type="velocity-xml">
-				/dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 		</action>
 
 		<!-- IMPORT DATA -->

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js	2010-09-08 10:40:26 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js	2010-12-16 04:49:14 +0000
@@ -29,7 +29,6 @@
 	value = getFieldValue( 'itemType' );
 	enable( 'expression-button' );
 	
-	
 	if( value == 'dataelement' ){
 		byId('expression-button' ).onclick = deExpressionBuilderForm;
 	}else if( value == 'indicator' ){
@@ -54,22 +53,20 @@
 
 function insertExpression() 
 {
-	
 	if( category ) var expression = "[*." + getFieldValue("elementSelect")+ "]";
-	else var expression = getFieldValue("elementSelect");	
+	else var expression = getFieldValue("elementSelect");
 	setFieldValue( 'formula', getFieldValue( 'formula') + expression );
-	
+
 	getExpression();
-	
 }
 
 function getExpression()
 {	
-	jQuery.postJSON( '../dhis-web-commons-ajax-json/getExpressionText.action', 
+	jQuery.postJSON( '../dhis-web-commons-ajax-json/getExpressionText.action',
 	{ expression: getFieldValue('formula')}, function( json ){
 		if(json.response == 'success'){
-			setInnerHTML( 'expression-description', json.message );				
-		}	
+			setInnerHTML( 'expression-description', json.message );
+		}
 	});		
 }
 
@@ -82,7 +79,8 @@
 		sheetNo: getFieldValue( 'sheetNo' ),
 		row: getFieldValue( 'row' ),
 		column: getFieldValue( 'column' ),
-		name: getFieldValue( 'name' ),
+		name: getFieldValue( 'name' )
+
 	},function( json ){
 		if(json.response == 'success'){					
 			form.submit();
@@ -101,7 +99,8 @@
 		sheetNo: getFieldValue( 'sheetNo' ),
 		row: getFieldValue( 'row' ),
 		column: getFieldValue( 'column' ),
-		name: getFieldValue( 'name' ),
+		name: getFieldValue( 'name' )
+
 	},function( json ){
 		if(json.response == 'success'){					
 			form.submit();
@@ -111,43 +110,34 @@
 	});
 }
 
-
-
 /*
 *	Delete multi report item
 */
 
 function deleteMultiReportItem( confirm )
 {
-	
 	if ( window.confirm( confirm ) ) 
-	{	
-		
+	{			
 		var listRadio = document.getElementsByName( 'reportItemCheck' );
-		
-		var params = new Array();	
-		
+		var url = "deleteMultiReportItem.action?";
 		var j = 0;
 		
-		for( var i=0;i<listRadio.length;i++ )
+		for( var i=0; i < listRadio.length; i++ )
 		{
 			var item = listRadio.item(i);
 			
-			if(item.checked==true)
+			if( item.checked == true )
 			{		
-				params.push( item.getAttribute( 'reportItemID' ) );				
-				j++;				
+				url += "ids=" + item.getAttribute( 'reportItemID' );
+				url += (i < listRadio.length-1) ? "&" : "";
+				j++;
 			}
 		}
-
+		
 		if( j>0 )
 		{
 			$.getJSON(
-    	    "deleteMultiReportItem.action",
-    	    {
-    	        "ids": params   
-    	    },
-				function( json )
+				url, {}, function( json )
 				{
 					if ( json.response == "success" )
 					{
@@ -163,11 +153,9 @@
 	}
 }
 
-
 /**
 *	COPY REPORT ITEM(s) TO ANOTHER REPORTEXCEL
 */
-//function copySelectedItem() {
 function copySelectedReportItemToReport() {
 	
 	var request = new Request();
@@ -200,14 +188,15 @@
 */
 
 sheetId = 0;
-NoItemsChecked = 0;
+NumberOfItemsChecked = 0;
 ItemsSaved = null;
 itemsCurTarget = null;
 itemsDuplicated = null;
+warningMessages = "";
 
 function validateCopyReportItemsToReportExcel() {
 
-	sheetId	= byId( "targetSheetNo" ).value;
+	sheetId	= $( "#targetSheetNo" ).val();
 	
 	var message = '';
 	
@@ -274,7 +263,7 @@
 		}
 	}
 	
-	NoItemsChecked = itemsChecked.length;
+	NumberOfItemsChecked = itemsChecked.length;
 	
 	for (var i in itemsChecked)
 	{
@@ -298,59 +287,35 @@
 
 function saveCopyReportItemsToReportExcel() {
 	
-	var warningMessage = " ======= Sheet [" + sheetId + "] =======<br/>";
+	warningMessages = " ======= Sheet [" + sheetId + "] ========";
 	
 	// If have ReportItem(s) in Duplicating list
-	// preparing the warning message
-	if ( itemsDuplicated.length > 0 ) {
-
-		warningMessage += 
-		"<b>[" + (itemsDuplicated.length) + "/" + (NoItemsChecked) + "]</b>:: "
-		+ i18n_copy_items_duplicated
-		+ "<br/><br/>";
-		
-		for (var i in itemsDuplicated) {
-		
-			warningMessage +=
-			"<b>(*)</b> "
-			+ itemsDuplicated[i] 
-			+ "<br/><br/>";
+	// Preparing the warning message
+	if ( itemsDuplicated.length > 0 )
+	{
+		setUpDuplicatedItemsMessage();
+	}
+	
+	// If have also ReportItem(s) in Copying list
+	// Do copy and prepare the message notes
+	if ( ItemsSaved.length > 0 )
+	{
+		var url = "copyReportExcelItems.action";
+			url += "?reportId=" + $("#targetReport").val();
+			url += "&sheetNo=" + sheetId;
+			
+		for (var i in ItemsSaved)
+		{
+			url += "&reportItems=" + ItemsSaved[i];
 		}
 		
-		warningMessage += "======================<br/><br/>";
-	}
-	
-	// If have also ReportItem(s) in Copying list
-	// do copy and prepare the message notes
-	if ( ItemsSaved.length > 0 ) {
-	
-		$.post("copyReportExcelItems.action",
-		{
-			reportId:$("#targetReport").val(),
-			sheetNo:sheetId,
-			reportItems:ItemsSaved
-		},
-		function (data)
-		{
-			var data = data.getElementsByTagName("message")[0];	
-			var type = data.getAttribute("type");
-			
-			if ( type == "success" ) {
-				
-				warningMessage +=
-				"<br/><b>[" + (ItemsSaved.length) + "/" + (NoItemsChecked) + "]</b>:: "
-				+ i18n_copy_successful
-				+ "<br/>======================<br/><br/>";
-			}
-			
-			setMessage( warningMessage );
-			
-		},'xml');
+		executeCopyItems( url );
 	}
 	// If have no any ReportItem(s) will be copied
 	// and also have ReportItem(s) in Duplicating list
-	else if ( itemsDuplicated.length > 0 ) {
-		setMessage( warningMessage );
+	else if ( itemsDuplicated.length > 0 )
+	{
+		setMessage( warningMessages );
 	}
 		
 	hideById('copyToReport'); 
@@ -362,7 +327,6 @@
 *	COPY SELECTED REPORTITEM(s) TO EXCEL_ITEM_GROUP
 */
 
-//function copySelectedExcelItemForm() {
 function copySelectedReportItemToExcelItemGroup() {
 	
 	var request = new Request();
@@ -393,10 +357,9 @@
 *	Validate copy Report Items to Excel Item Group
 */
 
-//function validateCopyExcelItems() {
 function validateCopyReportItemsToExcelItemGroup() {
 
-	sheetId	= byId("targetExcelItemGroupSheetNo").value;
+	sheetId	= $("#targetExcelItemGroupSheetNo").val();
 	
 	var message = '';
 	
@@ -443,55 +406,36 @@
 	saveCopiedReportItemsToExcelItemGroup();
 }
 
-warningMessages = "";
-
 function saveCopiedReportItemsToExcelItemGroup() {
 	
-	warningMessages = "";
+	warningMessages = " ======= Sheet [" + sheetId + "] ========";
 	
 	// If have ReportItem(s) in Duplicating list
 	// preparing the warning message
-	if ( itemsDuplicated.length > 0 ) {
-
-		warningMessages += 
-		"<b>[" + (itemsDuplicated.length) + "/" + (NoItemsChecked) + "]</b>:: "
-		+ i18n_copy_items_duplicated
-		+ "<br/><br/>";
-		
-		for (var i in itemsDuplicated) {
-		
-			warningMessages +=
-			"<b>(*)</b> "
-			+ itemsDuplicated[i] 
-			+ "<br/><br/>";
-		}
-		
-		warningMessages += "<br/>";
+	if ( itemsDuplicated.length > 0 )
+	{
+		setUpDuplicatedItemsMessage();
 	}
 	
 	// If have also ReportItem(s) in Copying list
 	// do copy and prepare the message notes
-	if ( ItemsSaved.length > 0 ) {
-	
-		var request = new Request();
-		request.setResponseTypeXML( 'xmlObject' );
-		request.setCallbackSuccess( saveCopyExcelItemsReceived );	
-		
-		var params = "excelItemGroupId=" + byId("targetExcelItemGroup").value;
-			params += "&sheetNo=" + sheetId;
+	if ( ItemsSaved.length > 0 )
+	{
+		var url = "copyExcelItems.action";
+			url += "?excelItemGroupId=" + $("#targetExcelItemGroup").val();
+			url += "&sheetNo=" + sheetId;
 			
 		for (var i in ItemsSaved)
 		{
-			params += "&reportItemIds=" + ItemsSaved[i];
+			url += "&reportItemIds=" + ItemsSaved[i];
 		}
-			
-		request.sendAsPost(params);
-		request.send( "copyExcelItems.action");
+	
+		executeCopyItems( url );
 	}
 	// If have no any ReportItem(s) will be copied
 	// and also have ReportItem(s) in Duplicating list
-	else if ( itemsDuplicated.length > 0 ) {
-
+	else if ( itemsDuplicated.length > 0 )
+	{
 		setMessage( warningMessages );
 	}
 		
@@ -499,23 +443,41 @@
 	unLockScreen();
 }
 
-function saveCopyExcelItemsReceived( data ) {
-	
-	var type = data.getAttribute("type");
-	
-	if ( type == "success" ) {
-	
+function setUpDuplicatedItemsMessage()
+{		
+	warningMessages += 
+	"<br/><b>[" + (itemsDuplicated.length) + "/" + (NumberOfItemsChecked) + "]</b>:: "
+	+ i18n_copy_items_duplicated
+	+ "<br/><br/>";
+	
+	for (var i in itemsDuplicated)
+	{
 		warningMessages +=
-		" ======= Sheet [" + sheetId + "] ========"
-		+ "<br/><b>[" + (ItemsSaved.length) + "/" + (NoItemsChecked) + "]</b>:: "
-		+ i18n_copy_successful
-		+ "<br/>======================<br/><br/>";
-		
+		"<b>(*)</b> "
+		+ itemsDuplicated[i] 
+		+ "<br/><br/>";
 	}
 	
-	setMessage( warningMessages );
+	warningMessages += "<br/>";
 }
 
+function executeCopyItems( url )
+{	
+	$.postJSON(
+		url, {}, function ( json )
+		{
+			if ( json.response == "success" )
+			{	
+				warningMessages +=
+				"<br/><b>[" + (ItemsSaved.length) + "/" + (NumberOfItemsChecked) + "]</b>:: "
+				+ i18n_copy_successful
+				+ "<br/>======================<br/><br/>";
+			}
+			
+			setMessage( warningMessages );
+		}
+	);
+}
 
 /**
 * Open dataelement expression
@@ -550,10 +512,7 @@
 	for ( id in dataElementGroups )
 	{
 		list.add( new Option( dataElementGroups[id], id ), null );
-		//var option = new Option( dataElementGroups[id], id );
-		//list.add( option , null );
 	}
-	
 }
 
 /**
@@ -593,9 +552,6 @@
 }
 
 
-
-
-
 /**
 * Indicator Report item type
 */
@@ -656,7 +612,6 @@
 			option.selected = true;
 			byId("formulaIndicatorDiv").innerHTML = indicatorName;
 		}
-		
 	}
 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java	2010-10-22 06:52:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java	2010-12-16 04:49:14 +0000
@@ -1,4 +1,4 @@
- package org.hisp.dhis.dataset.action;
+package org.hisp.dhis.dataset.action;
 
 /*
  * Copyright (c) 2004-2010, University of Oslo
@@ -93,7 +93,7 @@
     // -------------------------------------------------------------------------
     // Input & output
     // -------------------------------------------------------------------------
-    
+
     private String name;
 
     public void setName( String name )
@@ -107,13 +107,13 @@
     {
         this.shortName = shortName;
     }
-    
+
     private String code;
 
     public void setCode( String code )
     {
         this.code = code;
-    }    
+    }
 
     private String frequencySelect;
 
@@ -128,22 +128,22 @@
     {
         this.selectedList = selectedList;
     }
-    
+
     private boolean mobile;
-    
-    public void setMobile(boolean mobile) 
+
+    public void setMobile( boolean mobile )
     {
-		this.mobile = mobile;
-	}
+        this.mobile = mobile;
+    }
 
     // -------------------------------------------------------------------------
     // Action
-    // -------------------------------------------------------------------------    
+    // -------------------------------------------------------------------------
 
-	public String execute()
+    public String execute()
         throws Exception
     {
-    	// ---------------------------------------------------------------------
+        // ---------------------------------------------------------------------
         // Prepare values
         // ---------------------------------------------------------------------
 
@@ -155,14 +155,13 @@
         if ( code != null && code.trim().length() == 0 )
         {
             code = null;
-        }               
-        
+        }
+
         PeriodType periodType = periodService.getPeriodTypeByName( frequencySelect );
 
         DataSet dataSet = new DataSet( name, shortName, code, periodType );
-        
+
         dataSet.setMobile( mobile );
-        
 
         for ( String id : selectedList )
         {
@@ -174,22 +173,22 @@
         dataSetService.addDataSet( dataSet );
 
         assignDataSetToUserRole( dataSet );
-        
+
         return SUCCESS;
     }
-    
+
     private void assignDataSetToUserRole( DataSet dataSet )
     {
         User currentUser = currentUserService.getCurrentUser();
-        
+
         if ( !currentUserService.currentUserIsSuper() && currentUser != null )
         {
-            UserCredentials userCredentials = userStore.getUserCredentials( currentUser );       
-            
+            UserCredentials userCredentials = userStore.getUserCredentials( currentUser );
+
             for ( UserAuthorityGroup userAuthorityGroup : userCredentials.getUserAuthorityGroups() )
-            {                
+            {
                 userAuthorityGroup.getDataSets().add( dataSet );
-                
+
                 userStore.updateUserAuthorityGroup( userAuthorityGroup );
             }
         }