← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7461: local/in:Enabling Global Config Codes and generation of corresponding XML file for NRHM Report Mo...

 

------------------------------------------------------------
revno: 7461
committer: Gaurav <gaurav08021@xxxxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-06-30 15:49:34 +0530
message:
  local/in:Enabling Global Config Codes and generation of corresponding XML file for NRHM Report Module
added:
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/GlobalConfigService.java
  local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultGlobalConfigService.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/reportmanagement/action/DownloadRAFolderAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/reportmanagement/action/GenerateGlobalConfigAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/reportmanagement/action/ShowGlobalConfigForm.java
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/showGlobalConfigForm.vm
modified:
  local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java
  local/in/dhis-in-services/dhis-in-service-reports/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-maintenance-in/src/main/resources/struts.xml
  local/in/dhis-web-reports-national/pom.xml
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/leprosy/action/LeprosyReportResultAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserResultAction.java
  local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-reports-national/src/main/resources/org/hisp/dhis/reports/i18n_module.properties
  local/in/dhis-web-reports-national/src/main/resources/struts.xml
  local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menu.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 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/GlobalConfigService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/GlobalConfigService.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/reports/GlobalConfigService.java	2012-06-30 10:19:34 +0000
@@ -0,0 +1,19 @@
+package org.hisp.dhis.reports;
+
+import java.io.File;
+import java.util.Map;
+
+/**
+ * <gaurav>,Date: 6/26/12, Time: 2:25 PM
+ */
+public interface GlobalConfigService {
+
+    String ID = GlobalConfigService.class.getName();
+
+    public File[] getFileNames();
+
+    public void updateDecodeFiles();
+
+    public void writeGlobalSettings(Map<String, String> globalValueMap);
+
+}

=== added file 'local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultGlobalConfigService.java'
--- local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultGlobalConfigService.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultGlobalConfigService.java	2012-06-30 10:19:34 +0000
@@ -0,0 +1,271 @@
+package org.hisp.dhis.reports;
+
+import org.hisp.dhis.config.ConfigurationService;
+import org.hisp.dhis.config.Configuration_IN;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+/**
+ * <Gaurav & Mohit>,Date: 6/25/12, Time: 12:42 PM
+ */
+
+public class DefaultGlobalConfigService implements GlobalConfigService {
+
+
+    //----------------------------------------------------------------------------------------------
+    //                         INPUT-OUTPUT FOLDER PATHS
+    //----------------------------------------------------------------------------------------------
+
+    private static final String OUTPUT_FOLDER = "/home/gaurav/dhis2/dhis/home/ra_punjab_new";
+
+    private static final String SETTINGS_XML = "globalsettings.xml";
+
+    private static Map<String, String> globalValueMap = new HashMap<String, String>();
+
+    //----------------------------------------------------------------------------------------------
+    //                                    Dependencies
+    //----------------------------------------------------------------------------------------------
+
+    private DataElementService dataElementService;
+
+    private DataElementCategoryService dataElementCategoryService;
+
+    private ConfigurationService configurationService;
+
+    public void setConfigurationService(ConfigurationService configurationService) {
+        this.configurationService = configurationService;
+    }
+
+
+    public void setDataElementService(DataElementService dataElementService) {
+        this.dataElementService = dataElementService;
+    }
+
+    public void setDataElementCategoryService(DataElementCategoryService dataElementCategoryService) {
+        this.dataElementCategoryService = dataElementCategoryService;
+    }
+
+    //----------------------------------------------------------------------------------------------
+    //                         GET LIST OF DECODE XML FILES
+    //----------------------------------------------------------------------------------------------
+
+    public File[] getFileNames() {
+
+        String RAFOLDER = configurationService.getConfigurationByKey(Configuration_IN.KEY_REPORTFOLDER)
+                .getValue();
+
+        String RAFOLDER_PATH = System.getenv("DHIS2_HOME") + File.separator + RAFOLDER;
+
+        File raFile = new File(RAFOLDER_PATH);
+
+        return raFile.listFiles();
+    }
+
+    //----------------------------------------------------------------------------------------------
+    //      Implementation: Replace local De-Code Values with auto-generated Global Values
+    //----------------------------------------------------------------------------------------------
+
+    public void updateDecodeFiles() {
+
+        Integer globalID = 1;
+
+        File[] files = getFileNames();
+
+        for (File file : files) {
+
+            if (file.getName().contains("DECodes") && file.getName().endsWith(".xml")) {
+
+                if (file.exists()) {
+                    DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+
+                    try {
+                        DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
+                        Document doc = docBuilder.parse(file);
+
+
+                        NodeList listofDECodes = doc.getElementsByTagName("de-code");
+
+                        int totalCodes = listofDECodes.getLength();
+
+                        for (int i = 0; i < totalCodes; i++) {
+                            Element deCodeElemnt = (Element) listofDECodes.item(i);
+                            NodeList textCodeList = deCodeElemnt.getChildNodes();
+                            String expression = (textCodeList.item(0).getNodeValue().trim());
+
+                            String res;
+                            Pattern p = Pattern.compile("\\[(.*?)\\]");
+                            Matcher matcher = p.matcher(expression);
+                            String gconfig;
+
+                            while (matcher.find()) {
+                                res = matcher.group(1);
+                                if (!(globalValueMap.containsKey(res))) {
+                                    globalValueMap.put(res, globalID.toString());
+
+                                    globalID++;
+                                }
+
+                                gconfig = globalValueMap.get(res);
+                                expression = expression.replace("[" + res + "]", "[" + gconfig + "]");
+                            }
+
+
+                            res = expression;
+
+                            textCodeList.item(0).setNodeValue(res);
+
+                            TransformerFactory transformerFactory = TransformerFactory.newInstance();
+                            Transformer transformer = null;
+                            try {
+
+                                transformer = transformerFactory.newTransformer();
+                                transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+
+                            } catch (TransformerConfigurationException e) {
+                                e.printStackTrace();
+                            }
+                            DOMSource source = new DOMSource(doc);
+                            File newOutFile = new File(OUTPUT_FOLDER + "/" + file.getName());
+
+                            if (!newOutFile.exists()) {
+                                boolean isCreated = newOutFile.createNewFile();
+                                if (isCreated == false) {
+                                    System.out.println("*ERROR: [FAILED TO CREATE UPDATED XML FILE: " + newOutFile.getName() + " ]");
+                                }
+                            }
+
+                            StreamResult result = new StreamResult(newOutFile);
+                            try {
+                                transformer.transform(source, result);
+                            } catch (TransformerException e) {
+                                e.printStackTrace();
+                            }
+
+                        }
+
+                    } catch (SAXException e) {
+                        e.printStackTrace();
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    } catch (ParserConfigurationException e) {
+                        e.printStackTrace();
+                    }
+                } else {
+                    System.out.println("*ERROR: [DECODES XML FILE NOT FOUND]");
+                }
+            }
+        }
+
+        writeGlobalSettings(globalValueMap);
+    }
+
+    //----------------------------------------------------------------------------------------------
+    //                    Implementation: Create Global Settings XML
+    //----------------------------------------------------------------------------------------------
+
+
+    public void writeGlobalSettings(Map<String, String> globalValueMap) {
+        try {
+            DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
+
+            Document doc = docBuilder.newDocument();
+
+            Element rootElement = doc.createElement("globalSettings");
+            doc.appendChild(rootElement);
+
+            for (Map.Entry<String, String> mapElement : globalValueMap.entrySet()) {
+
+                Element gConfig = doc.createElement("gconfig");
+                rootElement.appendChild(gConfig);
+
+                Attr dhisidAttr = doc.createAttribute("commonid");
+                dhisidAttr.setValue(mapElement.getValue());
+                gConfig.setAttributeNode(dhisidAttr);
+
+                Attr dhisIDAttr = doc.createAttribute("dhisid");
+                dhisIDAttr.setValue(mapElement.getKey());
+                gConfig.setAttributeNode(dhisIDAttr);
+
+                String replaceString = mapElement.getKey().trim();
+
+                String optionComboIdStr = replaceString.substring(replaceString.indexOf('.') + 1, replaceString.length());
+
+                replaceString = replaceString.substring(0, replaceString.indexOf('.'));
+
+                int dataElementId = Integer.parseInt(replaceString);
+                int optionComboId = Integer.parseInt(optionComboIdStr);
+
+                if (dataElementService == null) {
+                    System.out.println("*ERROR:[Dataelement service is NULL]");
+                }
+                DataElement dataElement = dataElementService.getDataElement(dataElementId);
+                DataElementCategoryOptionCombo optionCombo = dataElementCategoryService.getDataElementCategoryOptionCombo(optionComboId);
+
+
+                if (dataElement != null && optionCombo != null) {
+
+                    if (optionComboId == 1) {
+                        Attr deNameAttr = doc.createAttribute("de-name");
+                        String deName = dataElement.getName().replace('\"', ' ').replace('\'', ' ');
+                        deNameAttr.setValue(deName);
+                        gConfig.setAttributeNode(deNameAttr);
+                    } else {
+                        Attr deNameAttr = doc.createAttribute("de-name");
+                        String optionName = optionCombo.getName().replace('(', ' ').replace(')', ' ');
+                        String deName = dataElement.getName().replace('\"', ' ').replace('\'', ' ');
+                        deNameAttr.setValue(deName + " [" + optionName + "]");
+                        gConfig.setAttributeNode(deNameAttr);
+                    }
+
+                } else {
+
+                    System.out.println("\n* INFO [ DATAELEMENT OR OPTION_COMBO MISSING (" + dataElementId + ")]");
+
+                    Attr deNameAttr = doc.createAttribute("de-name");
+                    deNameAttr.setValue("NA" + "(NA)");
+                    gConfig.setAttributeNode(deNameAttr);
+
+                }
+
+            }
+
+            TransformerFactory transformerFactory = TransformerFactory.newInstance();
+            Transformer transformer = transformerFactory.newTransformer();
+            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+
+            DOMSource source = new DOMSource(doc);
+
+            StreamResult result = new StreamResult(new File(OUTPUT_FOLDER + "/" + SETTINGS_XML));
+            transformer.transform(source, result);
+
+        } catch (ParserConfigurationException pce) {
+            pce.printStackTrace();
+        } catch (TransformerException tfe) {
+            tfe.printStackTrace();
+        }
+    }
+
+
+}

=== modified file 'local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java'
--- local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java	2011-12-14 11:09:39 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java	2012-06-30 10:19:34 +0000
@@ -1,24 +1,5 @@
 package org.hisp.dhis.reports;
 
-import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
-import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
 import org.hisp.dhis.aggregation.AggregatedDataValueService;
 import org.hisp.dhis.aggregation.AggregationService;
 import org.hisp.dhis.config.ConfigurationService;
@@ -56,16 +37,30 @@
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
+import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString;
+
 public class DefaultReportService
     implements ReportService
 {
     private static final String NULL_REPLACEMENT = "0";
+
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
 
     private ReportStore reportStore;
 
+
     public void setReportStore( ReportStore reportStore )
     {
         this.reportStore = reportStore;
@@ -312,6 +307,112 @@
         return recordNosList;
     }
 
+    //----------------------------------------------------------------------------------------------------
+    //                                  START
+    //                     Fetch Global Decode Configuration
+    //----------------------------------------------------------------------------------------------------
+
+
+    /**
+     * Generates a map of
+     * global-to-local ids
+     * using the global settings
+     * XML file.
+     * @return
+     */
+
+
+    public Map<String,String> mapGlobalValues ()
+    {
+        final String configFileName = "globalsettings.xml";
+
+        Map<String,String> globalValuesMap = new HashMap<String, String>();
+
+        String raFolderName = configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER )
+                .getValue();
+
+        String path = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
+                + configFileName ;
+
+        try
+        {
+            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+            Document doc = docBuilder.parse( new File( path ) );
+
+            if ( doc == null )
+            {
+                System.out.println( "Global config XML file not found" );
+                return null;
+            }
+
+            NodeList listOfConfigCodes = doc.getElementsByTagName( "gconfig" );
+
+            int totalConfigCodes = listOfConfigCodes.getLength();
+
+            for ( int s = 0; s < totalConfigCodes; s++ )
+            {
+                Element  configElement = (Element) listOfConfigCodes.item( s );
+
+                String value = configElement.getAttribute("dhisid").trim();
+
+                String id = configElement.getAttribute( "commonid" ).trim();
+
+                //System.out.println("\n*INFO : DhisID: "+value+" || "+"CommonID: "+id+"\n");
+
+                globalValuesMap.put(id,value);
+
+            }
+
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+        } catch (SAXException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        return globalValuesMap;
+    }
+
+    /**
+     * Replaces global ids
+     * with local values
+     * @param expression
+     * @return
+     */
+
+    public String getGlobalExpression(String expression,Map<String, String> globalValuesMap)
+    {
+        String result = null;
+
+        Pattern p = Pattern.compile("\\[(.*?)\\]");
+        Matcher matcher = p.matcher(expression);
+
+        System.out.println("*INFO :Expression: "+expression);
+
+        String localValue;
+
+        while(matcher.find())
+        {
+          result = matcher.group(1);
+          localValue = globalValuesMap.get(result);
+          expression = expression.replace("["+result+"]","["+localValue+"]");
+        }
+
+        result = expression;
+
+        System.out.println("*INFO :Result:" + result);
+
+        return result;
+    }
+
+    //----------------------------------------------------------------------------------------------------------
+    //                                  END
+    //                     Fetch Global Decode Configuration
+    //----------------------------------------------------------------------------------------------------------
+
+
     public List<Report_inDesign> getReportDesign( Report_in report )
     {
         List<Report_inDesign> deCodes = new ArrayList<Report_inDesign>();
@@ -322,6 +423,8 @@
         String path = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator
             + report.getXmlTemplateName();
 
+        String configFile= "";
+
         try
         {
             DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
@@ -335,6 +438,7 @@
 
             NodeList listOfDECodes = doc.getElementsByTagName( "de-code" );
             int totalDEcodes = listOfDECodes.getLength();
+            Map<String,String> globalValuesMap = mapGlobalValues();
 
             for ( int s = 0; s < totalDEcodes; s++ )
             {
@@ -342,6 +446,17 @@
                 NodeList textDECodeList = deCodeElement.getChildNodes();
 
                 String expression = ((Node) textDECodeList.item( 0 )).getNodeValue().trim();
+               
+                // ------------------------replace global values------------------------------------------------                
+
+                System.out.println("\n*INFO :<< CHECKING CONFIG FILE SETUP(1) >>");
+                System.out.println("*INFO :Global Value: "+expression);
+                expression = getGlobalExpression(expression,globalValuesMap);
+                System.out.println("*INFO :Local Value: "+expression);
+                System.out.println("*INFO :<<CHECK FINISHED>>\n");
+
+                // ---------------------------------------------------------------------------------------------
+                
                 String stype = deCodeElement.getAttribute( "stype" );
                 String ptype = deCodeElement.getAttribute( "type" );
                 int sheetno = new Integer( deCodeElement.getAttribute( "sheetno" ) );
@@ -355,8 +470,13 @@
 
                 deCodes.add( reportDesign );
 
-            }// end of for loop with s var
-        }// try block end
+            }
+
+            // end of for loop with s var
+        }
+
+        // try block end
+
         catch ( SAXParseException err )
         {
             System.out.println( "** Parsing error" + ", line " + err.getLineNumber() + ", uri " + err.getSystemId() );
@@ -428,7 +548,7 @@
             cal.set( year, Calendar.DECEMBER, 31 );
         }
         Date lastDay = new Date( cal.getTimeInMillis() );
-        //System.out.println( lastDay.toString() );
+
         Period newPeriod = new Period();
         newPeriod = periodService.getPeriod( firstDay, lastDay, periodType );
         return newPeriod;
@@ -497,7 +617,7 @@
             tempEndDate.setTime( endDate );
         }
 
-        // System.out.print(deType+" -- ");
+
         calendarList.add( tempStartDate );
         calendarList.add( tempEndDate );
 
@@ -584,12 +704,15 @@
 
         return null;
 
-    } // getDataElementPeriodType end
+    }
+
+    // getDataElementPeriodType end
 
     
     // -------------------------------------------------------------------------
-    // Get Aggregated Result for dataelement expression 
+    // Get Aggregated Result for dataelement expression
     // -------------------------------------------------------------------------
+
     public String getResultDataValue( String formula, Date startDate, Date endDate, OrganisationUnit organisationUnit , String reportModelTB )
     {
         int deFlag1 = 0;
@@ -1485,6 +1608,7 @@
 
         NodeList listOfDECodes = doc.getElementsByTagName( "de-code" );
         int totalDEcodes = listOfDECodes.getLength();
+        Map<String,String> globalValuesMap = mapGlobalValues();
 
         for ( int s = 0; s < totalDEcodes; s++ )
         {
@@ -1492,6 +1616,17 @@
             NodeList textDECodeList = deCodeElement.getChildNodes();
             
             String expression = ((Node) textDECodeList.item( 0 )).getNodeValue().trim();
+
+            // ------------------------replace global values------------------------------------------------
+
+            System.out.println("\n*INFO :<< CHECKING CONFIG FILE SETUP(3) >>");
+            System.out.println("*INFO :Global Value: "+expression);
+            expression = getGlobalExpression(expression, globalValuesMap);
+            System.out.println("*INFO :Local Value: "+expression);
+            System.out.println("*INFO :<<CHECK FINISHED>>\n");
+
+            // ---------------------------------------------------------------------------------------------
+
             String stype = deCodeElement.getAttribute( "stype" );
             String ptype = deCodeElement.getAttribute( "type" );
             int sheetno = new Integer( deCodeElement.getAttribute( "sheetno" ) );
@@ -1559,6 +1694,7 @@
 
             NodeList listOfDECodes = doc.getElementsByTagName( "de-code" );
             int totalDEcodes = listOfDECodes.getLength();
+            Map<String,String> globalValuesMap = mapGlobalValues();
 
             for ( int s = 0; s < totalDEcodes; s++ )
             {
@@ -1566,6 +1702,17 @@
                 NodeList textDECodeList = deCodeElement.getChildNodes();
                 
                 String expression = ((Node) textDECodeList.item( 0 )).getNodeValue().trim();
+
+                // ------------------------replace global values------------------------------------------------
+
+                System.out.println("\n*INFO :<< CHECKING CONFIG FILE SETUP(2) >>");
+                System.out.println("*INFO :Global Value: "+expression);
+                expression = getGlobalExpression(expression, globalValuesMap);
+                System.out.println("*INFO :Local Value: "+expression);
+                System.out.println("*INFO :<<CHECK FINISHED>>\n");
+
+                // ---------------------------------------------------------------------------------------------
+
                 String stype = deCodeElement.getAttribute( "stype" );
                 String ptype = deCodeElement.getAttribute( "type" );
                 int sheetno = new Integer( deCodeElement.getAttribute( "sheetno" ) );

=== modified file 'local/in/dhis-in-services/dhis-in-service-reports/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-in-services/dhis-in-service-reports/src/main/resources/META-INF/dhis/beans.xml	2012-02-02 09:56:51 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/resources/META-INF/dhis/beans.xml	2012-06-30 10:19:34 +0000
@@ -32,7 +32,17 @@
 		<property name="databaseInfoProvider" ref="databaseInfoProvider" />
 		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
 	</bean>
-	
+
+
+    <bean id="org.hisp.dhis.reports.GlobalConfigService"
+          class="org.hisp.dhis.reports.DefaultGlobalConfigService">
+        <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+        <property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
+        <property name="configurationService" ref="org.hisp.dhis.config.ConfigurationService"/>
+    </bean>
+
+
+
 	<!-- DeletionHandlers -->
 	<bean id="org.hisp.dhis.reports.Report_inDeletionHandler"
 		class="org.hisp.dhis.reports.Report_inDeletionHandler">

=== modified file 'local/in/dhis-web-maintenance-in/src/main/resources/struts.xml'
--- local/in/dhis-web-maintenance-in/src/main/resources/struts.xml	2011-09-08 05:43:00 +0000
+++ local/in/dhis-web-maintenance-in/src/main/resources/struts.xml	2012-06-30 10:19:34 +0000
@@ -3,6 +3,7 @@
 "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
 "http://struts.apache.org/dtds/struts-2.0.dtd";>
 <struts>
+
   <!-- use the DHIS web portal default -->
   <include file="dhis-web-commons.xml"/>
 

=== modified file 'local/in/dhis-web-reports-national/pom.xml'
--- local/in/dhis-web-reports-national/pom.xml	2012-05-10 12:05:02 +0000
+++ local/in/dhis-web-reports-national/pom.xml	2012-06-30 10:19:34 +0000
@@ -180,7 +180,7 @@
 		<dependency>
 			<groupId>net.sourceforge.jexcelapi</groupId>
 			<artifactId>jxl</artifactId>
-			<version>2.6</version>
+			<version>2.6.12</version>
 		</dependency>
 		<dependency>
 			<groupId>org.amplecode</groupId>

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/leprosy/action/LeprosyReportResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/leprosy/action/LeprosyReportResultAction.java	2012-02-02 09:56:51 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/leprosy/action/LeprosyReportResultAction.java	2012-06-30 10:19:34 +0000
@@ -39,10 +39,7 @@
 import org.hisp.dhis.aggregation.AggregationService;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.config.Configuration_IN;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataelement.*;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorService;
@@ -74,6 +71,7 @@
     // -------------------------------------------------------------------------
 
     private StatementManager statementManager;
+    private DefaultDataElementCategoryService dataElementCategoryOptionComboService;
 
     public void setStatementManager( StatementManager statementManager )
     {
@@ -1209,4 +1207,8 @@
             throw new RuntimeException( "Illegal DataElement id", ex );
         }
     }
+
+    public void setDataElementCategoryOptionComboService(DefaultDataElementCategoryService dataElementCategoryOptionComboService) {
+        this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
+    }
 }

=== added file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/reportmanagement/action/DownloadRAFolderAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/reportmanagement/action/DownloadRAFolderAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/reportmanagement/action/DownloadRAFolderAction.java	2012-06-30 10:19:34 +0000
@@ -0,0 +1,84 @@
+package org.hisp.dhis.reports.reportmanagement.action;
+
+import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.config.ConfigurationService;
+import org.hisp.dhis.config.Configuration_IN;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+/**
+ * <gaurav>,Date: 6/29/12, Time: 10:35 AM
+ */
+public class DownloadRAFolderAction implements Action {
+
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private ConfigurationService configurationService;
+
+    public void setConfigurationService( ConfigurationService configurationService )
+    {
+        this.configurationService = configurationService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input and Output Parameters
+    // -------------------------------------------------------------------------
+
+    private InputStream inputStream;
+
+    public InputStream getInputStream()
+    {
+        return inputStream;
+    }
+
+    private String fileName;
+
+    public String getFileName()
+    {
+        return fileName;
+    }
+
+    private String selectedButton;
+
+    public void setSelectedButton( String selectedButton )
+    {
+        this.selectedButton = selectedButton;
+    }
+
+    private String statusMessage;
+
+    public String getStatusMessage()
+    {
+        return statusMessage;
+    }
+
+
+    @Override
+    public String execute() throws Exception {
+
+
+            String raFolderName = configurationService.getConfigurationByKey( Configuration_IN.KEY_REPORTFOLDER).getValue();
+
+            String raPath = configurationService.backupFolder( System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName+"_new" );
+
+            if( raPath.equalsIgnoreCase( "INPUT" ) )
+            {
+                statusMessage = "Problem while taking backup for reports folder, please see the log";
+            }
+            else
+            {
+                fileName = raFolderName+".zip";
+
+                inputStream = new BufferedInputStream( new FileInputStream( raPath ), 1024 );
+
+                return "download";
+            }
+        return SUCCESS;
+    }
+}

=== added file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/reportmanagement/action/GenerateGlobalConfigAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/reportmanagement/action/GenerateGlobalConfigAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/reportmanagement/action/GenerateGlobalConfigAction.java	2012-06-30 10:19:34 +0000
@@ -0,0 +1,34 @@
+package org.hisp.dhis.reports.reportmanagement.action;
+
+import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.reports.GlobalConfigService;
+
+import java.util.Date;
+
+/**
+ * <gaurav>,Date: 6/28/12, Time: 11:36 AM
+ */
+public class GenerateGlobalConfigAction implements Action {
+
+    private GlobalConfigService globalConfigService;
+
+    public void setGlobalConfigService(GlobalConfigService globalConfigService) {
+        this.globalConfigService = globalConfigService;
+    }
+
+    @Override
+    public String execute() throws Exception {
+
+        System.out.println( "\n" +"--------------------------------------------------------------------------\n"+
+                                  "     Global Config Action Start Time is : " + new Date()+
+                                "\n--------------------------------------------------------------------------\n" );
+
+        globalConfigService.updateDecodeFiles();
+
+        System.out.println( "\n" +"----------------------------------------------------------------------------\n"+
+                                  "     Global Config Action End Time is : " + new Date()+
+                                "\n----------------------------------------------------------------------------\n" );
+
+        return SUCCESS;
+    }
+}

=== added file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/reportmanagement/action/ShowGlobalConfigForm.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/reportmanagement/action/ShowGlobalConfigForm.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/reportmanagement/action/ShowGlobalConfigForm.java	2012-06-30 10:19:34 +0000
@@ -0,0 +1,13 @@
+package org.hisp.dhis.reports.reportmanagement.action;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * <gaurav>,Date: 6/28/12, Time: 3:33 PM
+ */
+public class ShowGlobalConfigForm implements Action {
+    @Override
+    public String execute() throws Exception {
+        return SUCCESS;
+    }
+}

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserResultAction.java	2012-02-02 09:56:51 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserResultAction.java	2012-06-30 10:19:34 +0000
@@ -1,36 +1,15 @@
 package org.hisp.dhis.reports.upward.action;
 
 
-import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.UUID;
-
+import com.opensymphony.xwork2.Action;
 import jxl.CellType;
 import jxl.Workbook;
 import jxl.format.Alignment;
 import jxl.format.Border;
 import jxl.format.BorderLineStyle;
 import jxl.format.CellFormat;
-import jxl.write.Blank;
-import jxl.write.Label;
+import jxl.write.*;
 import jxl.write.Number;
-import jxl.write.WritableCell;
-import jxl.write.WritableCellFormat;
-import jxl.write.WritableSheet;
-import jxl.write.WritableWorkbook;
-
 import org.amplecode.quick.StatementManager;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.config.Configuration_IN;
@@ -43,11 +22,17 @@
 import org.hisp.dhis.reports.Report_in;
 import org.hisp.dhis.reports.Report_inDesign;
 
-import com.opensymphony.xwork2.Action;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
 
 public class GenerateUpwardReportAnalyserResultAction
-    implements Action
-{
+        implements Action {
 
     private final String GENERATEAGGDATA = "generateaggdata";
 
@@ -59,36 +44,31 @@
     // -------------------------------------------------------------------------
     private StatementManager statementManager;
 
-    public void setStatementManager( StatementManager statementManager )
-    {
+    public void setStatementManager(StatementManager statementManager) {
         this.statementManager = statementManager;
     }
 
     private ReportService reportService;
 
-    public void setReportService( ReportService reportService )
-    {
+    public void setReportService(ReportService reportService) {
         this.reportService = reportService;
     }
 
     private PeriodService periodService;
 
-    public void setPeriodService( PeriodService periodService )
-    {
+    public void setPeriodService(PeriodService periodService) {
         this.periodService = periodService;
     }
 
     private OrganisationUnitService organisationUnitService;
 
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
+    public void setOrganisationUnitService(OrganisationUnitService organisationUnitService) {
         this.organisationUnitService = organisationUnitService;
     }
 
     private I18nFormat format;
 
-    public void setFormat( I18nFormat format )
-    {
+    public void setFormat(I18nFormat format) {
         this.format = format;
     }
 
@@ -98,46 +78,42 @@
 
     private InputStream inputStream;
 
-    public InputStream getInputStream()
-    {
+    public InputStream getInputStream() {
         return inputStream;
     }
 
     private String fileName;
 
-    public String getFileName()
-    {
+    public String getFileName() {
         return fileName;
     }
 
     private String reportList;
 
-    public void setReportList( String reportList )
-    {
+    public void setReportList(String reportList) {
         this.reportList = reportList;
     }
 
     private int ouIDTB;
 
-    public void setOuIDTB( int ouIDTB )
-    {
+    public void setOuIDTB(int ouIDTB) {
         this.ouIDTB = ouIDTB;
     }
 
     private int availablePeriods;
 
-    public void setAvailablePeriods( int availablePeriods )
-    {
+    public void setAvailablePeriods(int availablePeriods) {
         this.availablePeriods = availablePeriods;
     }
-/*
-    private String aggCB;
-
-    public void setAggCB( String aggCB )
-    {
-        this.aggCB = aggCB;
-    }
-*/
+
+    /*
+        private String aggCB;
+
+        public void setAggCB( String aggCB )
+        {
+            this.aggCB = aggCB;
+        }
+    */
     private String reportFileNameTB;
 
     private String reportModelTB;
@@ -157,11 +133,10 @@
     private Date eDate;
 
     private String raFolderName;
-    
+
     private String aggData;
-    
-    public void setAggData( String aggData )
-    {
+
+    public void setAggData(String aggData) {
         this.aggData = aggData;
     }
 
@@ -169,85 +144,76 @@
     // Action Implementation
     // -------------------------------------------------------------------------
     public String execute()
-        throws Exception
-    {
+            throws Exception {
         statementManager.initialise();
 
         // Initialization
         raFolderName = reportService.getRAFolderName();
         String deCodesXMLFileName = "";
-        simpleDateFormat = new SimpleDateFormat( "MMM-yyyy" );
-        monthFormat = new SimpleDateFormat( "MMMM" );
-        simpleMonthFormat = new SimpleDateFormat( "MMM" );
+        simpleDateFormat = new SimpleDateFormat("MMM-yyyy");
+        monthFormat = new SimpleDateFormat("MMMM");
+        simpleMonthFormat = new SimpleDateFormat("MMM");
         String parentUnit = "";
-        
-        Report_in selReportObj =  reportService.getReport( Integer.parseInt( reportList ) );
-        
+
+        Report_in selReportObj = reportService.getReport(Integer.parseInt(reportList));
+
         deCodesXMLFileName = selReportObj.getXmlTemplateName();
 
         reportModelTB = selReportObj.getModel();
         reportFileNameTB = selReportObj.getExcelTemplateName();
-        
-
-        String inputTemplatePath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "template" + File.separator + reportFileNameTB;
+
+
+        String inputTemplatePath = System.getenv("DHIS2_HOME") + File.separator + raFolderName + File.separator + "template" + File.separator + reportFileNameTB;
         //String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator + raFolderName + File.separator + "output" + File.separator + UUID.randomUUID().toString() + ".xls";
-        
-        String outputReportPath = System.getenv( "DHIS2_HOME" ) + File.separator +  Configuration_IN.DEFAULT_TEMPFOLDER;
-        File newdir = new File( outputReportPath );
-        if( !newdir.exists() )
-        {
+
+        String outputReportPath = System.getenv("DHIS2_HOME") + File.separator + Configuration_IN.DEFAULT_TEMPFOLDER;
+        File newdir = new File(outputReportPath);
+        if (!newdir.exists()) {
             newdir.mkdirs();
         }
         outputReportPath += File.separator + UUID.randomUUID().toString() + ".xls";
-        
-        if ( reportModelTB.equalsIgnoreCase( "DYNAMIC-ORGUNIT" ) )
-        {
-            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
-            orgUnitList = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
-            Collections.sort( orgUnitList, new IdentifiableObjectNameComparator() );
-        }
-        else if ( reportModelTB.equalsIgnoreCase( "STATIC" ) || reportModelTB.equalsIgnoreCase( "STATIC-DATAELEMENTS" ) || reportModelTB.equalsIgnoreCase( "STATIC-FINANCIAL" ) )
-        {
+
+        if (reportModelTB.equalsIgnoreCase("DYNAMIC-ORGUNIT")) {
+            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit(ouIDTB);
+            orgUnitList = new ArrayList<OrganisationUnit>(orgUnit.getChildren());
+            Collections.sort(orgUnitList, new IdentifiableObjectNameComparator());
+        } else if (reportModelTB.equalsIgnoreCase("STATIC") || reportModelTB.equalsIgnoreCase("STATIC-DATAELEMENTS") || reportModelTB.equalsIgnoreCase("STATIC-FINANCIAL")) {
             orgUnitList = new ArrayList<OrganisationUnit>();
-            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
-            orgUnitList.add( orgUnit );
-        }
-        else if ( reportModelTB.equalsIgnoreCase( "dynamicwithrootfacility" ) )
-        {
-            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
-            orgUnitList = new ArrayList<OrganisationUnit>( orgUnit.getChildren() );
-            Collections.sort( orgUnitList, new IdentifiableObjectNameComparator() );
-            orgUnitList.add( orgUnit );
+            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit(ouIDTB);
+            orgUnitList.add(orgUnit);
+        } else if (reportModelTB.equalsIgnoreCase("dynamicwithrootfacility")) {
+            OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit(ouIDTB);
+            orgUnitList = new ArrayList<OrganisationUnit>(orgUnit.getChildren());
+            Collections.sort(orgUnitList, new IdentifiableObjectNameComparator());
+            orgUnitList.add(orgUnit);
 
             parentUnit = orgUnit.getName();
         }
 
-        System.out.println( orgUnitList.get( 0 ).getName()+ " : " + selReportObj.getName()+" : Report Generation Start Time is : " + new Date() );
-        
-        selectedPeriod = periodService.getPeriod( availablePeriods );
-
-        sDate = format.parseDate( String.valueOf( selectedPeriod.getStartDate() ) );
-
-        eDate = format.parseDate( String.valueOf( selectedPeriod.getEndDate() ) );
-
-        Workbook templateWorkbook = Workbook.getWorkbook( new File( inputTemplatePath ) );
-
-        WritableWorkbook outputReportWorkbook = Workbook.createWorkbook( new File( outputReportPath ), templateWorkbook );
+        System.out.println(orgUnitList.get(0).getName() + " : " + selReportObj.getName() + " : Report Generation Start Time is : " + new Date());
+
+        selectedPeriod = periodService.getPeriod(availablePeriods);
+
+        sDate = format.parseDate(String.valueOf(selectedPeriod.getStartDate()));
+
+        eDate = format.parseDate(String.valueOf(selectedPeriod.getEndDate()));
+
+        Workbook templateWorkbook = Workbook.getWorkbook(new File(inputTemplatePath));
+
+        WritableWorkbook outputReportWorkbook = Workbook.createWorkbook(new File(outputReportPath), templateWorkbook);
 
         // Getting DataValues
-        List<Report_inDesign> reportDesignList = reportService.getReportDesign( deCodesXMLFileName );
+        List<Report_inDesign> reportDesignList = reportService.getReportDesign(deCodesXMLFileName);
         int orgUnitCount = 0;
 
         Iterator<OrganisationUnit> it = orgUnitList.iterator();
-        while ( it.hasNext() )
-        {
+        while (it.hasNext()) {
             OrganisationUnit currentOrgUnit = (OrganisationUnit) it.next();
 
             int count1 = 0;
             Iterator<Report_inDesign> reportDesignIterator = reportDesignList.iterator();
-            while ( reportDesignIterator.hasNext() )
-            {
-                Report_inDesign report_inDesign = (Report_inDesign) reportDesignIterator.next();
+            while (reportDesignIterator.hasNext()) {
+                Report_inDesign report_inDesign = reportDesignIterator.next();
 
                 String deType = report_inDesign.getPtype();
                 String sType = report_inDesign.getStype();
@@ -256,201 +222,127 @@
 
                 Calendar tempStartDate = Calendar.getInstance();
                 Calendar tempEndDate = Calendar.getInstance();
-                List<Calendar> calendarList = new ArrayList<Calendar>( reportService.getStartingEndingPeriods( deType, selectedPeriod ) );
-                if( calendarList == null || calendarList.isEmpty() )
-                {
-                    tempStartDate.setTime( selectedPeriod.getStartDate() );
-                    tempEndDate.setTime( selectedPeriod.getEndDate() );
+                List<Calendar> calendarList = new ArrayList<Calendar>(reportService.getStartingEndingPeriods(deType, selectedPeriod));
+                if (calendarList == null || calendarList.isEmpty()) {
+                    tempStartDate.setTime(selectedPeriod.getStartDate());
+                    tempEndDate.setTime(selectedPeriod.getEndDate());
                     return SUCCESS;
-                } 
-                else
-                {
-                    tempStartDate = calendarList.get( 0 );
-                    tempEndDate = calendarList.get( 1 );
+                } else {
+                    tempStartDate = calendarList.get(0);
+                    tempEndDate = calendarList.get(1);
                 }
 
-                if( deCodeString.equalsIgnoreCase( "FACILITY" ) )
-                {
+                if (deCodeString.equalsIgnoreCase("FACILITY")) {
                     tempStr = currentOrgUnit.getName();
-                } 
-                else if( deCodeString.equalsIgnoreCase( "FACILITY-NOREPEAT" ) )
-                {
+                } else if (deCodeString.equalsIgnoreCase("FACILITY-NOREPEAT")) {
                     tempStr = parentUnit;
-                } 
-                else if( deCodeString.equalsIgnoreCase( "FACILITYP" ) )
-                {
+                } else if (deCodeString.equalsIgnoreCase("FACILITYP")) {
                     tempStr = currentOrgUnit.getParent().getName();
-                } 
-                else if( deCodeString.equalsIgnoreCase( "FACILITYPP" ) )
-                {
+                } else if (deCodeString.equalsIgnoreCase("FACILITYPP")) {
                     tempStr = currentOrgUnit.getParent().getParent().getName();
-                } 
-                else if( deCodeString.equalsIgnoreCase( "FACILITYPPP" ) )
-                {
+                } else if (deCodeString.equalsIgnoreCase("FACILITYPPP")) {
                     tempStr = currentOrgUnit.getParent().getParent().getParent().getName();
-                } 
-                else if( deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
-                {
+                } else if (deCodeString.equalsIgnoreCase("FACILITYPPPP")) {
                     tempStr = currentOrgUnit.getParent().getParent().getParent().getParent().getName();
-                } 
-                else if( deCodeString.equalsIgnoreCase( "PERIOD" ) || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" ) )
-                {
-                    tempStr = simpleDateFormat.format( sDate );
-                } 
-                else if( deCodeString.equalsIgnoreCase( "PERIOD-MONTH" ) )
-                {
-                    tempStr = monthFormat.format( sDate );
-                } 
-                else if( deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" ) )
-                {
-                    tempStr = simpleMonthFormat.format( sDate );
-                } 
-                else if( deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" ) )
-                {
-                    tempStr = simpleMonthFormat.format( eDate );
-                } 
-                else if( deCodeString.equalsIgnoreCase( "MONTH-START" ) )
-                {
-                    tempStr = monthFormat.format( sDate );
-                } 
-                else if( deCodeString.equalsIgnoreCase( "MONTH-END" ) )
-                {
-                    tempStr = monthFormat.format( eDate );
-                } 
-                else if( deCodeString.equalsIgnoreCase( "SLNO" ) )
-                {
-                    tempStr = "" + ( orgUnitCount + 1 );
-                } 
-                else if( deCodeString.equalsIgnoreCase( "NA" ) )
-                {
+                } else if (deCodeString.equalsIgnoreCase("PERIOD") || deCodeString.equalsIgnoreCase("PERIOD-NOREPEAT")) {
+                    tempStr = simpleDateFormat.format(sDate);
+                } else if (deCodeString.equalsIgnoreCase("PERIOD-MONTH")) {
+                    tempStr = monthFormat.format(sDate);
+                } else if (deCodeString.equalsIgnoreCase("MONTH-START-SHORT")) {
+                    tempStr = simpleMonthFormat.format(sDate);
+                } else if (deCodeString.equalsIgnoreCase("MONTH-END-SHORT")) {
+                    tempStr = simpleMonthFormat.format(eDate);
+                } else if (deCodeString.equalsIgnoreCase("MONTH-START")) {
+                    tempStr = monthFormat.format(sDate);
+                } else if (deCodeString.equalsIgnoreCase("MONTH-END")) {
+                    tempStr = monthFormat.format(eDate);
+                } else if (deCodeString.equalsIgnoreCase("SLNO")) {
+                    tempStr = "" + (orgUnitCount + 1);
+                } else if (deCodeString.equalsIgnoreCase("NA")) {
                     tempStr = " ";
-                } 
-                else
-                {
-                    if( sType.equalsIgnoreCase( "dataelement" ) )
-                    {
-                        if ( aggData.equalsIgnoreCase( USECAPTUREDDATA ) )
-                        {
-                            tempStr = reportService.getIndividualResultDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB );
-                        } 
-                        else if( aggData.equalsIgnoreCase( GENERATEAGGDATA ) )
-                        {
-                            tempStr = reportService.getResultDataValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB );
-                        }
-                        else if( aggData.equalsIgnoreCase( USEEXISTINGAGGDATA ) )
-                        {
-                            List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( tempStartDate.getTime(), tempEndDate.getTime() ) );
-                            Collection<Integer> periodIds = new ArrayList<Integer>( getIdentifiers(Period.class, periodList ) );
-                            tempStr = reportService.getResultDataValueFromAggregateTable( deCodeString, periodIds, currentOrgUnit, reportModelTB );
-                        }
-                    } 
-                    else if ( sType.equalsIgnoreCase( "dataelement-boolean" ) )
-                    {
-                        if ( aggData.equalsIgnoreCase( USECAPTUREDDATA ) )
-                        {
-                            tempStr = reportService.getBooleanDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB);
-                        } 
-                        else if( aggData.equalsIgnoreCase( GENERATEAGGDATA ) )
-                        {
-                            tempStr = reportService.getBooleanDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB);
-                        }
-                        else if( aggData.equalsIgnoreCase( USEEXISTINGAGGDATA ) )
-                        {
-                            tempStr = reportService.getBooleanDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB);
-                        }
-                        
-                    }
-                    else
-                    {
-                        if ( aggData.equalsIgnoreCase( USECAPTUREDDATA ) )
-                        {
-                            tempStr = reportService.getIndividualResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
-                        } 
-                        else if( aggData.equalsIgnoreCase( GENERATEAGGDATA ) )
-                        {
-                            tempStr = reportService.getResultIndicatorValue( deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit );
-                        }     
-                        else if( aggData.equalsIgnoreCase( USEEXISTINGAGGDATA ) )
-                        {
-                            List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( tempStartDate.getTime(), tempEndDate.getTime() ) );
-                            Collection<Integer> periodIds = new ArrayList<Integer>( getIdentifiers(Period.class, periodList ) );
-                            tempStr = reportService.getResultDataValueFromAggregateTable( deCodeString, periodIds, currentOrgUnit, reportModelTB );
+                } else {
+                    if (sType.equalsIgnoreCase("dataelement")) {
+                        if (aggData.equalsIgnoreCase(USECAPTUREDDATA)) {
+                            tempStr = reportService.getIndividualResultDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB);
+                        } else if (aggData.equalsIgnoreCase(GENERATEAGGDATA)) {
+                            tempStr = reportService.getResultDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB);
+                        } else if (aggData.equalsIgnoreCase(USEEXISTINGAGGDATA)) {
+                            List<Period> periodList = new ArrayList<Period>(periodService.getPeriodsBetweenDates(tempStartDate.getTime(), tempEndDate.getTime()));
+                            Collection<Integer> periodIds = new ArrayList<Integer>(getIdentifiers(Period.class, periodList));
+                            tempStr = reportService.getResultDataValueFromAggregateTable(deCodeString, periodIds, currentOrgUnit, reportModelTB);
+                        }
+                    } else if (sType.equalsIgnoreCase("dataelement-boolean")) {
+                        if (aggData.equalsIgnoreCase(USECAPTUREDDATA)) {
+                            tempStr = reportService.getBooleanDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB);
+                        } else if (aggData.equalsIgnoreCase(GENERATEAGGDATA)) {
+                            tempStr = reportService.getBooleanDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB);
+                        } else if (aggData.equalsIgnoreCase(USEEXISTINGAGGDATA)) {
+                            tempStr = reportService.getBooleanDataValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit, reportModelTB);
+                        }
+
+                    } else {
+                        if (aggData.equalsIgnoreCase(USECAPTUREDDATA)) {
+                            tempStr = reportService.getIndividualResultIndicatorValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit);
+                        } else if (aggData.equalsIgnoreCase(GENERATEAGGDATA)) {
+                            tempStr = reportService.getResultIndicatorValue(deCodeString, tempStartDate.getTime(), tempEndDate.getTime(), currentOrgUnit);
+                        } else if (aggData.equalsIgnoreCase(USEEXISTINGAGGDATA)) {
+                            List<Period> periodList = new ArrayList<Period>(periodService.getPeriodsBetweenDates(tempStartDate.getTime(), tempEndDate.getTime()));
+                            Collection<Integer> periodIds = new ArrayList<Integer>(getIdentifiers(Period.class, periodList));
+                            tempStr = reportService.getResultDataValueFromAggregateTable(deCodeString, periodIds, currentOrgUnit, reportModelTB);
                         }
                     }
                 }
-        
+
                 int tempRowNo = report_inDesign.getRowno();
                 int tempColNo = report_inDesign.getColno();
                 int sheetNo = report_inDesign.getSheetno();
-                WritableSheet sheet0 = outputReportWorkbook.getSheet( sheetNo );
-                
-                if ( tempStr == null || tempStr.equals( " " ) )
-                {
+                WritableSheet sheet0 = outputReportWorkbook.getSheet(sheetNo);
+
+                if (tempStr == null || tempStr.equals(" ")) {
                     tempColNo += orgUnitCount;
-        
+
                     WritableCellFormat wCellformat = new WritableCellFormat();
-                    wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
-                    wCellformat.setWrap( true );
-                    wCellformat.setAlignment( Alignment.CENTRE );
-        
-                    sheet0.addCell( new Blank( tempColNo, tempRowNo, wCellformat ) );
-                } 
-                else
-                {
-                    if ( reportModelTB.equalsIgnoreCase( "DYNAMIC-ORGUNIT" ) )
-                    {
-                        if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) || deCodeString.equalsIgnoreCase( "FACILITYPP" ) || deCodeString.equalsIgnoreCase( "FACILITYPPP" ) || deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
-                        {
-                        } 
-                        else if ( deCodeString.equalsIgnoreCase( "PERIOD" ) || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" ) || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" ) || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" ) || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" ) || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" ) || deCodeString.equalsIgnoreCase( "MONTH-START" ) || deCodeString.equalsIgnoreCase( "MONTH-END" ) || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" ) || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" ) || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" ) || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" ) || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" ) || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" ) || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" ) || deCodeString.equalsIgnoreCase( "QUARTER-START" ) || deCodeString.equalsIgnoreCase( "QUARTER-END" ) || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" ) || deCodeString.equalsIgnoreCase( "YEAR-END" ) || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
-                        {
-                        }
-                        else
-                        {
+                    wCellformat.setBorder(Border.ALL, BorderLineStyle.THIN);
+                    wCellformat.setWrap(true);
+                    wCellformat.setAlignment(Alignment.CENTRE);
+
+                    sheet0.addCell(new Blank(tempColNo, tempRowNo, wCellformat));
+                } else {
+                    if (reportModelTB.equalsIgnoreCase("DYNAMIC-ORGUNIT")) {
+                        if (deCodeString.equalsIgnoreCase("FACILITYP") || deCodeString.equalsIgnoreCase("FACILITYPP") || deCodeString.equalsIgnoreCase("FACILITYPPP") || deCodeString.equalsIgnoreCase("FACILITYPPPP")) {
+                        } else if (deCodeString.equalsIgnoreCase("PERIOD") || deCodeString.equalsIgnoreCase("PERIOD-NOREPEAT") || deCodeString.equalsIgnoreCase("PERIOD-WEEK") || deCodeString.equalsIgnoreCase("PERIOD-MONTH") || deCodeString.equalsIgnoreCase("PERIOD-QUARTER") || deCodeString.equalsIgnoreCase("PERIOD-YEAR") || deCodeString.equalsIgnoreCase("MONTH-START") || deCodeString.equalsIgnoreCase("MONTH-END") || deCodeString.equalsIgnoreCase("MONTH-START-SHORT") || deCodeString.equalsIgnoreCase("MONTH-END-SHORT") || deCodeString.equalsIgnoreCase("SIMPLE-QUARTER") || deCodeString.equalsIgnoreCase("QUARTER-MONTHS-SHORT") || deCodeString.equalsIgnoreCase("QUARTER-MONTHS") || deCodeString.equalsIgnoreCase("QUARTER-START-SHORT") || deCodeString.equalsIgnoreCase("QUARTER-END-SHORT") || deCodeString.equalsIgnoreCase("QUARTER-START") || deCodeString.equalsIgnoreCase("QUARTER-END") || deCodeString.equalsIgnoreCase("SIMPLE-YEAR") || deCodeString.equalsIgnoreCase("YEAR-END") || deCodeString.equalsIgnoreCase("YEAR-FROMTO")) {
+                        } else {
                             tempColNo += orgUnitCount;
                         }
-                    }
-                    else if ( reportModelTB.equalsIgnoreCase( "dynamicwithrootfacility" ) )
-                    {
-                        if ( deCodeString.equalsIgnoreCase( "FACILITYP" ) || deCodeString.equalsIgnoreCase( "FACILITY-NOREPEAT" ) ||  deCodeString.equalsIgnoreCase( "FACILITYPP" ) || deCodeString.equalsIgnoreCase( "FACILITYPPP" ) || deCodeString.equalsIgnoreCase( "FACILITYPPPP" ) )
-                        {
-                        } 
-                        else if ( deCodeString.equalsIgnoreCase( "PERIOD" ) || deCodeString.equalsIgnoreCase( "PERIOD-NOREPEAT" ) || deCodeString.equalsIgnoreCase( "PERIOD-WEEK" ) || deCodeString.equalsIgnoreCase( "PERIOD-MONTH" ) || deCodeString.equalsIgnoreCase( "PERIOD-QUARTER" ) || deCodeString.equalsIgnoreCase( "PERIOD-YEAR" ) || deCodeString.equalsIgnoreCase( "MONTH-START" ) || deCodeString.equalsIgnoreCase( "MONTH-END" ) || deCodeString.equalsIgnoreCase( "MONTH-START-SHORT" ) || deCodeString.equalsIgnoreCase( "MONTH-END-SHORT" ) || deCodeString.equalsIgnoreCase( "SIMPLE-QUARTER" ) || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS-SHORT" ) || deCodeString.equalsIgnoreCase( "QUARTER-MONTHS" ) || deCodeString.equalsIgnoreCase( "QUARTER-START-SHORT" ) || deCodeString.equalsIgnoreCase( "QUARTER-END-SHORT" ) || deCodeString.equalsIgnoreCase( "QUARTER-START" ) || deCodeString.equalsIgnoreCase( "QUARTER-END" ) || deCodeString.equalsIgnoreCase( "SIMPLE-YEAR" ) || deCodeString.equalsIgnoreCase( "YEAR-END" ) || deCodeString.equalsIgnoreCase( "YEAR-FROMTO" ) )
-                        {
-                        } 
-                        else
-                        {
+                    } else if (reportModelTB.equalsIgnoreCase("dynamicwithrootfacility")) {
+                        if (deCodeString.equalsIgnoreCase("FACILITYP") || deCodeString.equalsIgnoreCase("FACILITY-NOREPEAT") || deCodeString.equalsIgnoreCase("FACILITYPP") || deCodeString.equalsIgnoreCase("FACILITYPPP") || deCodeString.equalsIgnoreCase("FACILITYPPPP")) {
+                        } else if (deCodeString.equalsIgnoreCase("PERIOD") || deCodeString.equalsIgnoreCase("PERIOD-NOREPEAT") || deCodeString.equalsIgnoreCase("PERIOD-WEEK") || deCodeString.equalsIgnoreCase("PERIOD-MONTH") || deCodeString.equalsIgnoreCase("PERIOD-QUARTER") || deCodeString.equalsIgnoreCase("PERIOD-YEAR") || deCodeString.equalsIgnoreCase("MONTH-START") || deCodeString.equalsIgnoreCase("MONTH-END") || deCodeString.equalsIgnoreCase("MONTH-START-SHORT") || deCodeString.equalsIgnoreCase("MONTH-END-SHORT") || deCodeString.equalsIgnoreCase("SIMPLE-QUARTER") || deCodeString.equalsIgnoreCase("QUARTER-MONTHS-SHORT") || deCodeString.equalsIgnoreCase("QUARTER-MONTHS") || deCodeString.equalsIgnoreCase("QUARTER-START-SHORT") || deCodeString.equalsIgnoreCase("QUARTER-END-SHORT") || deCodeString.equalsIgnoreCase("QUARTER-START") || deCodeString.equalsIgnoreCase("QUARTER-END") || deCodeString.equalsIgnoreCase("SIMPLE-YEAR") || deCodeString.equalsIgnoreCase("YEAR-END") || deCodeString.equalsIgnoreCase("YEAR-FROMTO")) {
+                        } else {
                             tempRowNo += orgUnitCount;
                         }
                     }
-    
-                    WritableCell cell = sheet0.getWritableCell( tempColNo, tempRowNo );
-    
+
+                    WritableCell cell = sheet0.getWritableCell(tempColNo, tempRowNo);
+
                     CellFormat cellFormat = cell.getCellFormat();
                     WritableCellFormat wCellformat = new WritableCellFormat();
-                    wCellformat.setBorder( Border.ALL, BorderLineStyle.THIN );
-                    wCellformat.setWrap( true );
-                    wCellformat.setAlignment( Alignment.CENTRE );
-    
-                    if ( cell.getType() == CellType.LABEL )
-                    {
+                    wCellformat.setBorder(Border.ALL, BorderLineStyle.THIN);
+                    wCellformat.setWrap(true);
+                    wCellformat.setAlignment(Alignment.CENTRE);
+
+                    if (cell.getType() == CellType.LABEL) {
                         Label l = (Label) cell;
-                        l.setString( tempStr );
-                        l.setCellFormat( cellFormat );
-                    } 
-                    else
-                    {
-                        try
-                        {
-                            sheet0.addCell( new Number( tempColNo, tempRowNo, Double.parseDouble( tempStr ), wCellformat ) );
-                        }
-                        catch( Exception e )
-                        {
-                            sheet0.addCell( new Label( tempColNo, tempRowNo, tempStr, wCellformat ) );
+                        l.setString(tempStr);
+                        l.setCellFormat(cellFormat);
+                    } else {
+                        try {
+                            sheet0.addCell(new Number(tempColNo, tempRowNo, Double.parseDouble(tempStr), wCellformat));
+                        } catch (Exception e) {
+                            sheet0.addCell(new Label(tempColNo, tempRowNo, tempStr, wCellformat));
                         }
                     }
                 }
-                
+
                 count1++;
             }// inner while loop end
             orgUnitCount++;
@@ -459,13 +351,13 @@
         outputReportWorkbook.write();
         outputReportWorkbook.close();
 
-        fileName = reportFileNameTB.replace( ".xls", "" );
-        fileName += "_" + orgUnitList.get( 0 ).getShortName() + "_";
-        fileName += "_" + simpleDateFormat.format( selectedPeriod.getStartDate() ) + ".xls";
-        File outputReportFile = new File( outputReportPath );
-        inputStream = new BufferedInputStream( new FileInputStream( outputReportFile ) );
+        fileName = reportFileNameTB.replace(".xls", "");
+        fileName += "_" + orgUnitList.get(0).getShortName() + "_";
+        fileName += "_" + simpleDateFormat.format(selectedPeriod.getStartDate()) + ".xls";
+        File outputReportFile = new File(outputReportPath);
+        inputStream = new BufferedInputStream(new FileInputStream(outputReportFile));
 
-        System.out.println( orgUnitList.get( 0 ).getName()+ " : " + selReportObj.getName()+" Report Generation End Time is : " + new Date() );
+        System.out.println(orgUnitList.get(0).getName() + " : " + selReportObj.getName() + " Report Generation End Time is : " + new Date());
 
         outputReportFile.deleteOnExit();
 

=== modified file 'local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml	2012-06-27 09:23:24 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/META-INF/dhis/beans.xml	2012-06-30 10:19:34 +0000
@@ -3,6 +3,24 @@
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd";>
+
+
+    <!--Global Config Settings -->
+
+    <bean id="org.hisp.dhis.reports.reportmanagement.action.GenerateGlobalConfigAction"
+          class="org.hisp.dhis.reports.reportmanagement.action.GenerateGlobalConfigAction"
+          scope="prototype">
+        <property name="globalConfigService" ref="org.hisp.dhis.reports.GlobalConfigService">
+        </property>
+    </bean>
+
+
+    <bean id="org.hisp.dhis.reports.reportmanagement.action.DownloadRAFolderAction"
+          class="org.hisp.dhis.reports.reportmanagement.action.DownloadRAFolderAction"
+          scope="prototype">
+        <property name="configurationService" ref="org.hisp.dhis.config.ConfigurationService">
+        </property>
+    </bean>
     
     <!-- Reports -->
     <bean id="org.hisp.dhis.reports.action.ReportsHomePageAction"

=== modified file 'local/in/dhis-web-reports-national/src/main/resources/org/hisp/dhis/reports/i18n_module.properties'
--- local/in/dhis-web-reports-national/src/main/resources/org/hisp/dhis/reports/i18n_module.properties	2012-06-22 05:36:42 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/org/hisp/dhis/reports/i18n_module.properties	2012-06-30 10:19:34 +0000
@@ -334,5 +334,10 @@
 in_selected_orgU = In Selected Organisation Unit
 available_delist = Available dataelements
 selected_delist = Selected dataelements
+generate_globalXML = Generate Global Config XML
+message = This may take a few seconds
+generate = Generate
+download = Download New RA-Folder
+selected_delist = Selected dataelements
 discharge = Discharge
-followup = Followup
\ No newline at end of file
+followup = Followup

=== modified file 'local/in/dhis-web-reports-national/src/main/resources/struts.xml'
--- local/in/dhis-web-reports-national/src/main/resources/struts.xml	2012-04-16 08:47:07 +0000
+++ local/in/dhis-web-reports-national/src/main/resources/struts.xml	2012-06-30 10:19:34 +0000
@@ -15,8 +15,35 @@
             <param name="page">/dhis-web-reports/welcome.vm</param>
             <param name="menu">/dhis-web-reports/menu.vm</param>
         </action>
-        
+
+        <action name="globalconfig"
+                class="org.hisp.dhis.reports.reportmanagement.action.GenerateGlobalConfigAction">
+            <result name="success" type="velocity">/main.vm</result>
+            <param name="page">/dhis-web-reports/showGlobalConfigForm.vm</param>
+            <param name="menu">/dhis-web-reports/menu.vm</param>
+        </action>
+
+        <action name="showglobalconfig"
+                class="org.hisp.dhis.reports.reportmanagement.action.ShowGlobalConfigForm">
+            <result name="success" type="velocity">/main.vm</result>
+            <param name="page">/dhis-web-reports/showGlobalConfigForm.vm</param>
+            <param name="menu">/dhis-web-reports/menu.vm</param>
+        </action>
+
+        <action name="downloadnewra"
+                class="org.hisp.dhis.reports.reportmanagement.action.DownloadRAFolderAction">
+            <result name="success" type="redirect">index.action</result>
+            <result name="download" type="stream">
+                <param name="contentType">application/zip</param>
+                <param name="inputName">inputStream</param>
+                <param name="contentDisposition">filename="${fileName}"</param>
+                <param name="bufferSize">1024</param>
+            </result>
+            <param name="menu">/dhis-web-reports/menu.vm</param>
+        </action>
+
         <!-- Reports Management -->
+
         <action name="reportManagement"
             class="org.hisp.dhis.reports.reportmanagement.action.ReportsListAction">
             <result name="success" type="velocity">/main.vm</result>

=== modified file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menu.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menu.vm	2012-04-04 11:58:27 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/menu.vm	2012-06-30 10:19:34 +0000
@@ -5,6 +5,7 @@
         <li>Report Management</li>
         <ul>
             <li><a href = "reportManagement.action">Report Management</a></li>
+            <li><a href="showglobalconfig.action">Generate Global Config</a></li>
         </ul>
     </ul>
 #end

=== added file 'local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/showGlobalConfigForm.vm'
--- local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/showGlobalConfigForm.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-reports-national/src/main/webapp/dhis-web-reports/showGlobalConfigForm.vm	2012-06-30 10:19:34 +0000
@@ -0,0 +1,50 @@
+<div id="caption" align="center" style="background-color: #99FFFF; height:50;width:400;margin-bottom: 20;padding-top: 7">
+<h3>$i18n.getString( "generate_globalXML" )</h3>
+</div>
+
+<form id="showGlobalConfigForm" name="showGlobalConfigForm" action="showglobalconfig.action" method="post">
+    <tbody>
+
+
+    <tr>
+        <td colspan="2">
+            <input type="button" id ="gen" onclick="llAggregate();"
+                   value="$i18n.getString( "generate" )" style="width:12em">
+        </td>
+        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+        </td>
+        <td colspan="2">
+            <input type="button" id="download" disabled="true"  onclick="window.location.href='downloadnewra.action'"
+                   value="$i18n.getString( "download" )" style="width:16em">
+        </td>
+
+    </tr>
+    #parse( "/dhis-web-commons/loader/loader.vm" )
+    <div id='loaderDiv' style="margin-top: 20"></div>
+    <div id="llAggregateDiv"></div>
+    </tbody>
+</form>
+
+<script type="text/javascript">
+    function llAggregate()
+    {
+
+
+            jQuery('#loaderDiv').show();
+
+            document.getElementById("gen").disabled = true;
+
+            jQuery('#llAggregateDiv').load('globalconfig.action',
+                    {
+
+                    }, function()
+                    {
+                        document.getElementById( "download" ).disabled = false;
+
+                        jQuery('#loaderDiv').hide();
+                        jQuery('#llAggregateDiv').hide();
+                    });
+
+    }
+
+</script>