← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5320: local vn - Minor fixed and optimized code in Preview.

 

------------------------------------------------------------
revno: 5320
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-12-07 13:50:10 +0700
message:
  local vn - Minor fixed and optimized code in Preview.
modified:
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/degroup/action/UpdateSortedDataElementGroupOrderAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportCategoryAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/dataElementGroupOrder.js
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listDataElementGroupOrder.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
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/degroup/action/UpdateSortedDataElementGroupOrderAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/degroup/action/UpdateSortedDataElementGroupOrderAction.java	2011-08-03 08:38:38 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/degroup/action/UpdateSortedDataElementGroupOrderAction.java	2011-12-07 06:50:10 +0000
@@ -33,20 +33,19 @@
 import org.hisp.dhis.reportsheet.DataElementGroupOrder;
 import org.hisp.dhis.reportsheet.DataElementGroupOrderService;
 import org.hisp.dhis.reportsheet.ExportReport;
+import org.hisp.dhis.reportsheet.ExportReportCategory;
 import org.hisp.dhis.reportsheet.ExportReportService;
-import org.hisp.dhis.reportsheet.ExportReportCategory;
+import org.hisp.dhis.reportsheet.action.ActionSupport;
 import org.hisp.dhis.reportsheet.importitem.ImportReport;
 import org.hisp.dhis.reportsheet.importitem.ImportReportService;
 
-import com.opensymphony.xwork2.Action;
-
 /**
  * @author Tran Thanh Tri
  * @author Dang Duy Hieu
  * @version $Id$
  */
 public class UpdateSortedDataElementGroupOrderAction
-    implements Action
+    extends ActionSupport
 {
     // -------------------------------------------------------------------------
     // Dependency
@@ -138,6 +137,8 @@
             importReportService.updateImportReport( importReport );
         }
 
+        message = i18n.getString( "update_successful" );
+        
         return SUCCESS;
     }
 

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportCategoryAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportCategoryAction.java	2011-11-03 04:26:28 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportCategoryAction.java	2011-12-07 06:50:10 +0000
@@ -120,7 +120,6 @@
 
             for ( DataElementGroupOrder dataElementGroup : exportReport.getDataElementOrders() )
             {
-
                 int beginChapter = rowBegin;
 
                 if ( exportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.DATAELEMENT_NAME ) )

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties	2011-11-18 04:24:39 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties	2011-12-07 06:50:10 +0000
@@ -186,7 +186,7 @@
 template_status             = Template status
 use_only_letters_numbers_dot_only = Please enter Letters, Numbers for file's name and Dot for extension only
 cell_exist					= Exist one cell same sheet, row and column with this.
-update_successful           = Updating is success \!
+update_successful           = Update success \!
 cell_exist					= Exist one cell same sheet, row and column with this.
 download					= Download
 upload_file_null			= Upload file null

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/dataElementGroupOrder.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/dataElementGroupOrder.js	2011-08-03 08:38:38 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/dataElementGroupOrder.js	2011-12-07 06:50:10 +0000
@@ -27,13 +27,6 @@
     showDetails();
 }
 
-/*function validateDataElementGroupOrder( _form )
-{
-	jQuery.postJSON( 'validateDataElementGroupOrder.action',
-		{ id: }, function() {
-	});
-}*/
-
 /*
 * 	Open Add Data Element Group Order 
 */
@@ -109,7 +102,7 @@
 	}
 	
 	jQuery.postJSON( url, {}, function( json ) {
-		setMessage( json.message );
+		showSuccessMessage( json.message );
 	});
 }
 

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js	2011-11-09 07:34:53 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js	2011-12-07 06:50:10 +0000
@@ -7,6 +7,13 @@
 importlist = null;
 importItemIds = new Array();
 
+htmlStyle = ["<style type='text/css'>"];
+htmlStyle.push( "td.printclass { font-size: 12px; }" );
+htmlStyle.push( ".ui-preview-table{ border-collapse: collapse; }" );
+htmlStyle.push( ".ui-preview-normal{ font-weight: bold; color: blue }" );
+htmlStyle.push( ".ui-widget-content { border: 1px solid #a6c9e2; background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; }" );
+htmlStyle.push( "</style>" );
+
 // ----------------------------------------------------------------------
 // Methods
 // ----------------------------------------------------------------------
@@ -74,31 +81,28 @@
 
 	var _index		= 0;
 	var _orderSheet	= 0;
-	var _sHTML		= "";
 	var _sPattern	= "";
 	var _rows 		= "";
 	var _cols 		= "";
 	var _sheets		= parentElement.getElementsByTagName( 'sheet' );
-	var tabsHTML 	= '<div id="tabs">';
-	var titleHTML 	= '<ul>';
-	var contentsHTML= '';
+	var _sHTML		= [];
+	var tabsHTML 	= ['<div id="tabs"><ul>'];
 	
 	for (var s = 0 ; s < _sheets.length ; s ++)
 	{
 		// Create tab name
-		titleHTML += '<li><a href="#tabs-' + s + '">' + getElementValue( _sheets[s], "name" ) + '</a></li>';
+		tabsHTML.push( '<li><a href="#tabs-', s, '">', getElementValue( _sheets[s], "name" ), '</a></li>' );
 	
 		_rows 		= _sheets[s].getElementsByTagName( 'row' );
 		_orderSheet	= getRootElementAttribute( _sheets[s], "id" );
 		
-		contentsHTML += '<div id="tabs-' + s + '">';
-
-		_sHTML = "<table class='ui-preview-table'>";
+		_sHTML.push( '<div id="tabs-', s, '">' );
+		_sHTML.push( "<table class='ui-preview-table'>" );
 		
 		for (var i = 0 ; i < _rows.length ; i ++)
 		{
 			_index	= 0;
-			_sHTML += "<tr>";
+			_sHTML.push( "<tr>" );
 			
 			_cols 	= _rows[i].getElementsByTagName( 'col' );
 			
@@ -110,7 +114,7 @@
 				// Printing out the unformatted cells
 				for (; _index < _number ; _index ++)
 				{
-					_sHTML += "<td/>";
+					_sHTML.push( "<td/>" );
 				}
 
 				if ( _index == _number )
@@ -127,37 +131,31 @@
 					j 		= Number(j) + Number(_colspan);
 					_index 	= Number(_index) + Number(_colspan);
 					
-					_sHTML += "<td align='" + _align + "' colspan='" + _colspan + "'";
-					_sHTML += " class='printclass";
-					_sHTML += _border > 0 ? " ui-widget-content" : "";
+					_sHTML.push( "<td align='", _align, "' colspan='", _colspan, "'" );
+					_sHTML.push( " class='printclass" );
+					_sHTML.push( _border > 0 ? " ui-widget-content" : "" );
 					
 					// Preview without importing
 					if ( keyId && keyId.length > 0 )
 					{
-						_sHTML += " ui-preview-unselected' id='" + keyId;
+						_sHTML.push( " ui-preview-unselected' id='", keyId );
 					}
 					else if ( !isImport && isRealNumber(_sData) )
 					{
-						_sHTML += " ui-preview-normal";
+						_sHTML.push( " ui-preview-normal" );
 					}
 					
-					_sHTML += "'>" + _sData + "</td>";
+					_sHTML.push( "'>", _sData, "</td>" );
 				}
 			}
-			_sHTML += "</tr>";
+			_sHTML.push( "</tr>" );
 		}
-		_sHTML += "</table><br/>";		
-		
-		contentsHTML += _sHTML;
-		contentsHTML += '</div>';
+		_sHTML.push( "</table></div>" );
 	}
-	
-	titleHTML += '</ul>';
-	tabsHTML += titleHTML;
-	tabsHTML += contentsHTML;	
-	tabsHTML += '</div>';
-	
-	jQuery( '#previewDiv' ).html( tabsHTML );
+
+	tabsHTML.push( '</ul>', _sHTML.join(''), '</div>' );
+	
+	jQuery( '#previewDiv' ).html( tabsHTML.join('') );
 	jQuery( '#tabs' ).tabs({ collapsible : true });
 	enable( 'printExcelReportButton' );
 	applyStyleIntoPreview();
@@ -211,13 +209,6 @@
 
 function printExportReport()
 {
-	var htmlStyle = "<style type='text/css'>";
-	htmlStyle += "td.printclass { font-size: 12px; }";
-	htmlStyle += ".ui-preview-table{ border-collapse: collapse; }";
-	htmlStyle += ".ui-preview-normal{ font-weight: bold; color: blue }";
-	htmlStyle += ".ui-widget-content { border: 1px solid #a6c9e2; background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; }";
-	htmlStyle += "</style>";
-
 	var tab = jQuery('#tabs').tabs('option', 'selected');
-	jQuery( "#tabs-" + tab ).jqprint( {CSS : htmlStyle} );
+	jQuery( "#tabs-" + tab ).jqprint( {CSS : htmlStyle.join('')} );
 }
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listDataElementGroupOrder.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listDataElementGroupOrder.vm	2011-08-03 08:38:38 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listDataElementGroupOrder.vm	2011-12-07 06:50:10 +0000
@@ -1,5 +1,6 @@
 <h3>$i18n.getString('dataelement_groups')</h3>
 <h4><font color="green">$!encoder.htmlEncode($!report.name)</font></h4>
+
 <table width="800px">
 	<tr>
 		<td colspan=2>
@@ -7,7 +8,7 @@
 			<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location='listAll${clazzSimpleName}.action'" style="width:100px"/>
 		</td>
 		<td width="100px">
-			<input type="button" value="$i18n.getString( 'update_order' )" onclick="updateSortDataElementGroupOrder()" style="width:150px">
+			<input type="button" value="$i18n.getString( 'update_order' )" onclick="updateSortDataElementGroupOrder()" style="width:150px"/>
 		</td>
 	</tr>
 	<tr>
@@ -16,6 +17,28 @@
 	</tr>	
 </table>
 
+<table align="right">
+	<tr>
+		<td style="width:20em; padding-left:2em; vertical-align:top">
+			<div id="detailsArea" style="display:none">
+				<div style="float:right">
+					<a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"/></a>
+				</div>				
+				<p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
+				<p><label>$i18n.getString( "code" ):</label><br/><span id="codeField"></span></p>
+				<p><label>$i18n.getString( "number_of_members" ):</label><br/><span id="memberCountField"></span></p>
+			</div>
+
+			<div id="warningArea" style="position:fixed;right:10px;top:200px;display:none">
+				<div style="float:right">
+					<a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_warning' )"/></a>
+				</div>
+				<p><span id="warningField"></span></p>
+			</div>
+		</td>
+	</tr>
+</table>
+
 <ul id="sortable"> 
 #foreach($group in $!report.dataElementOrders)
 	<li class="ui-state-default" name="dataElementGroupOrder" value="$group.id" title="$i18n.getString( 'sort_order_help' )">		
@@ -34,21 +57,6 @@
 #end
 </ul>
 
-<table align="right">
-	<tr>
-		<td style="width:20em; padding-left:2em; vertical-align:top">
-			<div id="detailsArea" style="display:none">
-				<div style="float:right">
-					<a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"/></a>
-				</div>				
-				<p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
-				<p><label>$i18n.getString( "code" ):</label><br/><span id="codeField"></span></p>
-				<p><label>$i18n.getString( "number_of_members" ):</label><br/><span id="memberCountField"></span></p>
-			</div>
-		</td>	
-	</tr>	
-</table>
-
 <div id="dataElementGroups">
 	<form name="dataElementGroups" id="dataElementGroupsForm" method="POST">
 		<input type="hidden" name="id" value="$report.id"/>