=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm 2010-09-16 08:17:27 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm 2010-10-19 10:12:54 +0000
@@ -59,8 +59,8 @@
#end
|
-
-
+ |
+
|
|
@@ -73,15 +73,15 @@
|
- |
+ |
|
- |
+ |
|
- |
+ |
|
@@ -92,7 +92,7 @@
var propNames = new Array()
#set( $count = 0 )
- #foreach ($propertyName in $propertyNames )
+ #foreach ( $propertyName in $propertyNames )
propNames[$count] = "$propertyName";
#set( $count = $count + 1 )
#end
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2010-10-18 08:12:47 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2010-10-19 10:12:54 +0000
@@ -1276,3 +1276,13 @@
var currentPage = jQuery("#jumpToPage").val();
window.location.href = baseLink +"pageSize=" + pageSize +"¤tPage=" +currentPage;
}
+
+/**
+ * Used to export PDF file by the given type and
+ * the active items in table
+ */
+function exportPdfByType( type )
+{
+ var activeIds = getArrayIdOfActiveRows();
+ window.location.href = 'exportToPdf.action?type=' + type + activeIds;
+}
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/lists.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/lists.js 2010-09-08 10:40:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/lists.js 2010-10-19 10:12:54 +0000
@@ -446,4 +446,20 @@
});
return result;
+}
+
+/**
+ * Return the list of Id from the active rows in table name 'listTable'
+ */
+function getArrayIdOfActiveRows()
+{
+ var params = "";
+ var rows = jQuery( "table.listTable tbody tr" );
+
+ for ( var i = 0; i < rows.length; i++ )
+ {
+ params += "&activeIds=" + rows[i].id.split("tr")[1];
+ }
+
+ return params;
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf/ExportToPdfAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf/ExportToPdfAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/pdf/ExportToPdfAction.java 2010-10-19 10:12:54 +0000
@@ -28,6 +28,8 @@
*/
import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -48,15 +50,15 @@
implements Action
{
private static final Log log = LogFactory.getLog( ExportToPdfAction.class );
-
+
private static final String EXPORT_FORMAT_PDF = "PDF";
-
+
private static final String TYPE_DATAELEMENT = "dataelement";
private static final String TYPE_INDICATOR = "indicator";
-
+
private static final String FILENAME_DATAELEMENT = "DataElements.zip";
private static final String FILENAME_INDICATOR = "Indicators.zip";
-
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -81,7 +83,7 @@
{
this.format = format;
}
-
+
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -92,7 +94,7 @@
{
return inputStream;
}
-
+
private String fileName;
public String getFileName()
@@ -110,14 +112,21 @@
{
this.dataDictionaryMode = dataDictionaryMode;
}
-
+
private String type;
public void setType( String type )
{
this.type = type;
}
-
+
+ private List activeIds = new ArrayList();
+
+ public void setActiveIds( List activeIds )
+ {
+ this.activeIds = activeIds;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -128,34 +137,50 @@
if ( type != null )
{
ExportParams params = new ExportParams();
-
+
if ( type.equals( TYPE_DATAELEMENT ) )
{
- params.setDataElements( null );
+ if ( (activeIds != null) && !activeIds.isEmpty() )
+ {
+ params.setDataElements( activeIds );
+ }
+ else
+ {
+ params.setDataElements( null );
+ }
fileName = FILENAME_DATAELEMENT;
-
+
log.info( "Exporting to PDF for object type: " + TYPE_DATAELEMENT );
- }
+ }
else if ( type.equals( TYPE_INDICATOR ) )
{
- params.setIndicators( null );
-
+ if ( (activeIds != null) && !activeIds.isEmpty() )
+ {
+ params.setIndicators( activeIds );
+ }
+ else
+ {
+ params.setIndicators( null );
+ }
+
fileName = FILENAME_INDICATOR;
-
+
log.info( "Exporting to PDF for object type: " + TYPE_INDICATOR );
}
-
- params.setExtendedMode( dataDictionaryMode != null && dataDictionaryMode.equals( DataDictionaryModeManager.DATADICTIONARY_MODE_EXTENDED ) );
- params.setIncludeDataValues( false );
+
+ params.setExtendedMode( dataDictionaryMode != null
+ && dataDictionaryMode.equals( DataDictionaryModeManager.DATADICTIONARY_MODE_EXTENDED ) );
+ params.setIncludeDataValues( false );
params.setI18n( i18n );
params.setFormat( format );
-
+
ExportService exportService = serviceProvider.provide( EXPORT_FORMAT_PDF );
-
+
inputStream = exportService.exportData( params );
}
-
+
return SUCCESS;
}
+
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm 2010-09-23 15:16:08 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm 2010-10-19 10:12:54 +0000
@@ -35,7 +35,7 @@
-
+
#if ( $dataDictionaryMode == "extended" )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicator.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicator.vm 2010-10-13 07:27:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicator.vm 2010-10-19 10:12:54 +0000
@@ -28,7 +28,7 @@
|
-
+
#if ( $dataDictionaryMode == "extended" )
|