← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1062: Fixed the logic in showing message GUI when copied ReportItem(s)

 

------------------------------------------------------------
revno: 1062
committer: hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2009-11-20 14:20:40 +0700
message:
  Fixed the logic in showing message GUI when copied ReportItem(s)
modified:
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.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/resources/org/hisp/dhis/reportexcel/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties	2009-11-13 10:28:52 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties	2009-11-20 07:20:40 +0000
@@ -155,7 +155,7 @@
 associations				= Associations
 sheetNo						= Sheet
 choose_excelItem			= Please choose excel items
-copy_items_duplicated       = Warning! Cannot copy the duplicated items
+copy_items_duplicated       = Warning! Cannot copy the duplicated item(s)
 copy_successful             = Copy successful !
 copy_selected_item_to_excel_item = Copy to excel item
 excelitem_group				= Excel item group

=== 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	2009-11-10 06:39:31 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js	2009-11-20 07:20:40 +0000
@@ -175,6 +175,7 @@
 
 
 sheetId = 0;
+iReportItemsChecked = 0;
 reportItems = null;
 reportItemsCurTarget = null;
 reportItemsDuplicated = null;
@@ -225,6 +226,8 @@
 		}
 	}
 	
+	iReportItemsChecked = reportItemsChecked.length;
+	
 	for (var i in reportItemsChecked)
 	{
 		flag = i;
@@ -246,27 +249,33 @@
 }
 
 function saveCopyItems() {
-		
-	if (reportItemsDuplicated.length > 0) {
+	
+	var warningMessage = " ======= Sheet [" + sheetId + "] =======<br/>";
+	
+	// If have ReportItem(s) in Duplicating list
+	// preparing the warning message
+	if ( reportItemsDuplicated.length > 0 ) {
 
-		var reportItemsDuplicatedList = "Sheet [" + sheetId + "] - " + i18n_copy_items_duplicated + "<br>";
+		warningMessage += 
+		"<b>[" + (reportItemsDuplicated.length) + "/" + (iReportItemsChecked) + "]</b>:: "
+		+ i18n_copy_items_duplicated
+		+ "<br/><br/>";
 		
 		for (var i in reportItemsDuplicated) {
 		
-			reportItemsDuplicatedList = reportItemsDuplicatedList 
-			+ "&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;"
+			warningMessage +=
+			"<b>(*)</b> "
 			+ reportItemsDuplicated[i] 
-			+ "<br>";
+			+ "<br/><br/>";
 		}
 		
-		//reportItemsDuplicatedList = reportItemsDuplicatedList + "</ul>"
-		
-		//setMessage(reportItemsDuplicatedList);
-	
-		//$("#copyTo").hide();
+		warningMessage += "======================<br/><br/>";
 	}
 	
-	if( reportItems.length > 0 ) {
+	// If have also ReportItem(s) in Copying list
+	// do copy and prepare the message notes
+	if ( reportItems.length > 0 ) {
+	
 		$.post("copyReportExcelItems.action",
 		{
 			reportId:$("#targetReport").val(),
@@ -275,26 +284,33 @@
 		},
 		function (data)
 		{
-			//setMessage( i18n_copy_successful );
-			//$("#copyTo").hide();
+			var data = data.getElementsByTagName("message")[0];	
+			var type = data.getAttribute("type");
+			
+			if ( type == "success" ) {
+				
+				warningMessage +=
+				"<br/><b>[" + (reportItems.length) + "/" + (iReportItemsChecked) + "]</b>:: "
+				+ i18n_copy_successful
+				+ "<br/>======================<br/><br/>";
+			}
+			
+			setMessage( warningMessage );
+			
 		},'xml');
 	}
-	
-	if(reportItems.length == 0){
-		setMessage( excelItemsDuplicatedList );
-	}else{
-		if (reportItemsDuplicatedList.length > 0)
-			 reportItemsDuplicatedList += "<br>==========<br>" + i18n_copy_successful;
-		else
-			reportItemsDuplicatedList += i18n_copy_successful;
-		setMessage( reportItemsDuplicatedList);
+	// If have no any ReportItem(s) will be copied
+	// and also have ReportItem(s) in Duplicating list
+	else if ( reportItemsDuplicated.length > 0 ) {
+
+		setMessage( warningMessage );
 	}
-	
+		
 	$("#copyTo").hide();
 	deleteDivEffect();
-	
 }
 
+
 /**
 * DataElement Report type
 */