dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16875
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6544: Added unit test for DataValueSetService. Added support for task summaries to Notifier. Added user...
Merge authors:
Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 6544 [merge]
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-04-11 16:35:07 +0200
message:
Added unit test for DataValueSetService. Added support for task summaries to Notifier. Added user interface for data value import.
added:
dhis-2/dhis-dxf2/src/test/java/org/
dhis-2/dhis-dxf2/src/test/java/org/hisp/
dhis-2/dhis-dxf2/src/test/java/org/hisp/dhis/
dhis-2/dhis-dxf2/src/test/java/org/hisp/dhis/dxf2/
dhis-2/dhis-dxf2/src/test/java/org/hisp/dhis/dxf2/datavalueset/
dhis-2/dhis-dxf2/src/test/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetServiceTest.java
dhis-2/dhis-dxf2/src/test/resources/
dhis-2/dhis-dxf2/src/test/resources/dataValueSetA.xml
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.java
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportDataValueTask.java
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importDataValue.js
modified:
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportCount.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/IndicatorImporter.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/notification/InMemoryNotifier.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/notification/NotificationCategory.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/notification/Notifier.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/htmlNotifications.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonNotifications.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/NoAction.java
dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties
dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/index.vm
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/mainMenu.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataMart.js
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataMartForm.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 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2012-04-02 17:23:48 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2012-04-11 11:33:43 +0000
@@ -32,6 +32,8 @@
import static org.hisp.dhis.importexport.ImportStrategy.UPDATES;
import static org.hisp.dhis.system.util.ConversionUtils.wrap;
import static org.hisp.dhis.system.util.DateUtils.getDefaultDate;
+import static org.hisp.dhis.system.notification.NotificationCategory.DATAVALUE_IMPORT;
+import static org.hisp.dhis.system.notification.NotificationLevel.INFO;
import java.io.InputStream;
import java.io.OutputStream;
@@ -61,6 +63,7 @@
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.system.notification.Notifier;
import org.hisp.dhis.system.util.DateUtils;
import org.hisp.dhis.user.CurrentUserService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -70,6 +73,11 @@
public class DefaultDataValueSetService
implements DataValueSetService
{
+ private static final String ERROR_INVALID_DATA_SET = "Invalid data set: ";
+ private static final String ERROR_INVALID_PERIOD = "Invalid period: ";
+ private static final String ERROR_INVALID_ORG_UNIT = "Invalid org unit: ";
+ private static final String ERROR_OBJECT_NEEDED_TO_COMPLETE = "Must be provided to complete data set";
+
@Autowired
private IdentifiableObjectManager identifiableObjectManager;
@@ -97,6 +105,9 @@
@Autowired
private DataValueSetStore dataValueSetStore;
+ @Autowired
+ private Notifier notifier;
+
//--------------------------------------------------------------------------
// DataValueSet implementation
//--------------------------------------------------------------------------
@@ -109,17 +120,17 @@
if ( dataSet_ == null )
{
- throw new IllegalArgumentException( "Invalid data set: " + dataSet );
+ throw new IllegalArgumentException( ERROR_INVALID_DATA_SET + dataSet );
}
if ( period_ == null )
{
- throw new IllegalArgumentException( "Invalid period: " + period );
+ throw new IllegalArgumentException( ERROR_INVALID_PERIOD + period );
}
if ( orgUnit_ == null )
{
- throw new IllegalArgumentException( "Invalid org unit: " + orgUnit );
+ throw new IllegalArgumentException( ERROR_INVALID_ORG_UNIT + orgUnit );
}
CompleteDataSetRegistration registration = registrationService.getCompleteDataSetRegistration( dataSet_, period_, orgUnit_ );
@@ -138,6 +149,8 @@
public ImportSummary saveDataValueSet( InputStream in, IdentifiableProperty dataElementIdScheme, IdentifiableProperty orgUnitIdScheme, boolean dryRun, ImportStrategy strategy )
{
+ notifier.clear( DATAVALUE_IMPORT ).notify( DATAVALUE_IMPORT, "Process started" );
+
ImportSummary summary = new ImportSummary();
DataValueSet dataValueSet = new StreamingDataValueSet( XMLFactory.getXMLReader( in ) );
@@ -172,6 +185,8 @@
int updateCount = 0;
int totalCount = 0;
+ notifier.notify( DATAVALUE_IMPORT, "Importing data values" );
+
while ( dataValueSet.hasNextDataValue() )
{
org.hisp.dhis.dxf2.datavalue.DataValue dataValue = dataValueSet.getNextDataValue();
@@ -255,6 +270,8 @@
batchHandler.flush();
+ notifier.notify( INFO, DATAVALUE_IMPORT, "Import done", true ).addTaskSummary( DATAVALUE_IMPORT, summary );
+
return summary;
}
@@ -264,14 +281,18 @@
private void handleComplete( DataSet dataSet, Date completeDate, OrganisationUnit orgUnit, Period period, ImportSummary summary )
{
+ notifier.notify( DATAVALUE_IMPORT, "Completing data set" );
+
if ( orgUnit == null )
{
- throw new IllegalArgumentException( "Org unit id must be provided to complete data set" );
+ summary.getConflicts().add( new ImportConflict( OrganisationUnit.class.getSimpleName(), ERROR_OBJECT_NEEDED_TO_COMPLETE ) );
+ return;
}
if ( period == null )
{
- throw new IllegalArgumentException( "Period id must be provided to complete data set" );
+ summary.getConflicts().add( new ImportConflict( Period.class.getSimpleName(), ERROR_OBJECT_NEEDED_TO_COMPLETE ) );
+ return;
}
CompleteDataSetRegistration completeAlready = registrationService.getCompleteDataSetRegistration( dataSet, period, orgUnit );
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportCount.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportCount.java 2012-04-03 10:24:37 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportCount.java 2012-04-11 11:40:51 +0000
@@ -106,11 +106,9 @@
@Override
public String toString()
{
- return "ImportCount{" +
- "object='" + object + '\'' +
+ return "[object='" + object + "'" +
", imports=" + imports +
", updates=" + updates +
- ", ignores=" + ignores +
- '}';
+ ", ignores=" + ignores + "]";
}
}
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/IndicatorImporter.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/IndicatorImporter.java 2012-04-07 12:36:39 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/IndicatorImporter.java 2012-04-11 11:33:43 +0000
@@ -29,7 +29,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.constant.Constant;
import org.hisp.dhis.indicator.Indicator;
import org.springframework.stereotype.Component;
=== added directory 'dhis-2/dhis-dxf2/src/test/java/org'
=== added directory 'dhis-2/dhis-dxf2/src/test/java/org/hisp'
=== added directory 'dhis-2/dhis-dxf2/src/test/java/org/hisp/dhis'
=== added directory 'dhis-2/dhis-dxf2/src/test/java/org/hisp/dhis/dxf2'
=== added directory 'dhis-2/dhis-dxf2/src/test/java/org/hisp/dhis/dxf2/datavalueset'
=== added file 'dhis-2/dhis-dxf2/src/test/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetServiceTest.java'
--- dhis-2/dhis-dxf2/src/test/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetServiceTest.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-dxf2/src/test/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetServiceTest.java 2012-04-11 11:40:51 +0000
@@ -0,0 +1,142 @@
+package org.hisp.dhis.dxf2.datavalueset;
+
+/*
+ * Copyright (c) 2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+
+import java.util.Collection;
+
+import org.hisp.dhis.DhisTest;
+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.dataset.CompleteDataSetRegistration;
+import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.datavalue.DataValueService;
+import org.hisp.dhis.dxf2.importsummary.ImportSummary;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.period.MonthlyPeriodType;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ClassPathResource;
+
+public class DataValueSetServiceTest
+ extends DhisTest
+{
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private DataElementCategoryService categoryService;
+
+ @Autowired
+ private DataSetService dataSetService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
+ private PeriodService periodService;
+
+ @Autowired
+ private DataValueSetService dataValueSetService;
+
+ @Autowired
+ private DataValueService dataValueService;
+
+ @Autowired
+ private CompleteDataSetRegistrationService registrationService;
+
+ private DataElement deA;
+ private DataElement deB;
+ private DataElement deC;
+ private DataSet dsA;
+ private OrganisationUnit ouA;
+ private Period peA;
+ private DataElementCategoryOptionCombo optionComboA;
+
+ @Override
+ public void setUpTest()
+ {
+ deA = createDataElement( 'A' );
+ deB = createDataElement( 'B' );
+ deC = createDataElement( 'C' );
+ dsA = createDataSet( 'A', new MonthlyPeriodType() );
+ ouA = createOrganisationUnit( 'A' );
+ peA = createPeriod( getDate( 2012, 1, 1 ), getDate( 2012, 1, 31 ) );
+ optionComboA = categoryService.getDefaultDataElementCategoryOptionCombo();
+
+ deA.setUid( "f7n9E0hX8qk" );
+ deB.setUid( "Ix2HsbDMLea" );
+ deC.setUid( "eY5ehpbEsB7" );
+ dsA.setUid( "pBOMPrpg1QX" );
+ ouA.setUid( "DiszpKrYNg8" );
+
+ dataElementService.addDataElement( deA );
+ dataElementService.addDataElement( deB );
+ dataElementService.addDataElement( deC );
+ dataSetService.addDataSet( dsA );
+ organisationUnitService.addOrganisationUnit( ouA );
+ periodService.addPeriod( peA );
+ }
+
+ @Test
+ public void testImport()
+ throws Exception
+ {
+ ImportSummary summary = dataValueSetService.saveDataValueSet( new ClassPathResource( "dataValueSetA.xml" ).getInputStream() );
+
+ assertNotNull( summary );
+ assertEquals( 1, summary.getCounts().size() );
+
+ Collection<DataValue> dataValues = dataValueService.getAllDataValues();
+
+ assertNotNull( dataValues );
+ assertEquals( 3, dataValues.size() );
+ assertTrue( dataValues.contains( new DataValue( deA, peA, ouA, optionComboA ) ) );
+ assertTrue( dataValues.contains( new DataValue( deB, peA, ouA, optionComboA ) ) );
+ assertTrue( dataValues.contains( new DataValue( deC, peA, ouA, optionComboA ) ) );
+
+ CompleteDataSetRegistration registration = registrationService.getCompleteDataSetRegistration( dsA, peA, ouA );
+
+ assertNotNull( registration );
+ assertEquals( dsA, registration.getDataSet() );
+ assertEquals( peA, registration.getPeriod() );
+ assertEquals( ouA, registration.getSource() );
+ assertEquals( getDate( 2012, 1, 2 ), registration.getDate() );
+ }
+}
=== added directory 'dhis-2/dhis-dxf2/src/test/resources'
=== added file 'dhis-2/dhis-dxf2/src/test/resources/dataValueSetA.xml'
--- dhis-2/dhis-dxf2/src/test/resources/dataValueSetA.xml 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-dxf2/src/test/resources/dataValueSetA.xml 2012-04-11 11:33:43 +0000
@@ -0,0 +1,5 @@
+<dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0" dataSet="pBOMPrpg1QX" completeDate="2012-01-02" period="201201" orgUnit="DiszpKrYNg8">
+ <dataValue dataElement="f7n9E0hX8qk" value="10001" storedBy="john" comment="comment" followup="false"/>
+ <dataValue dataElement="Ix2HsbDMLea" value="10002" storedBy="john" comment="comment" followup="false"/>
+ <dataValue dataElement="eY5ehpbEsB7" value="10003" storedBy="john" comment="comment" followup="false"/>
+</dataValueSet>
\ No newline at end of file
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/notification/InMemoryNotifier.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/notification/InMemoryNotifier.java 2012-04-10 20:15:18 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/notification/InMemoryNotifier.java 2012-04-11 14:33:18 +0000
@@ -29,25 +29,35 @@
import java.util.ArrayList;
import java.util.Date;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import javax.annotation.PostConstruct;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* @author Lars Helge Overland
*/
public class InMemoryNotifier
implements Notifier
{
+ private static final Log log = LogFactory.getLog( InMemoryNotifier.class );
+
private int MAX_SIZE = 1000;
private List<Notification> notifications;
+ private Map<NotificationCategory, Object> taskSummaries;
+
@PostConstruct
public void init()
{
notifications = new ArrayList<Notification>();
+ taskSummaries = new HashMap<NotificationCategory, Object>();
}
// -------------------------------------------------------------------------
@@ -72,6 +82,8 @@
notifications.remove( MAX_SIZE );
}
+ log.info( notification );
+
return this;
}
@@ -132,13 +144,28 @@
while ( iter.hasNext() )
{
- if ( category.equals( iter.next() ) )
+ if ( category.equals( iter.next().getCategory() ) )
{
iter.remove();
}
}
}
- return this;
+ taskSummaries.remove( category );
+
+ return this;
+ }
+
+ @Override
+ public Notifier addTaskSummary( NotificationCategory category, Object taskSummary )
+ {
+ taskSummaries.put( category, taskSummary );
+ return this;
+ }
+
+ @Override
+ public Object getTaskSummary( NotificationCategory category )
+ {
+ return taskSummaries.get( category );
}
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/notification/NotificationCategory.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/notification/NotificationCategory.java 2012-02-12 20:32:14 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/notification/NotificationCategory.java 2012-04-11 11:33:43 +0000
@@ -33,5 +33,6 @@
public enum NotificationCategory
{
DATAMART,
- IMPORT
+ DATAVALUE_IMPORT,
+ METADATA_IMPORT
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/notification/Notifier.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/notification/Notifier.java 2012-04-10 20:15:18 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/notification/Notifier.java 2012-04-11 11:33:43 +0000
@@ -43,4 +43,9 @@
List<Notification> getNotifications( NotificationCategory category, String lastUid );
Notifier clear( NotificationCategory category );
+
+ Notifier addTaskSummary( NotificationCategory category, Object taskSummary );
+
+ Object getTaskSummary( NotificationCategory category );
+
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/htmlNotifications.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/htmlNotifications.vm 2012-02-14 12:53:25 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/htmlNotifications.vm 2012-04-11 09:02:06 +0000
@@ -1,16 +1,3 @@
-<style type="text/css">
-.notificationTable {
- background-color: #ffffbf;
- border: 1px solid #cccc00;
- padding: 6px;
- border-radius: 3px;
-}
-
-.notificationTable td {
- padding: 3px;
-}
-</style>
-
#if( $notifications.size() > 0 )
<table class="notificationTable">
<col width="120">
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonNotifications.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonNotifications.vm 2012-04-10 20:15:18 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonNotifications.vm 2012-04-11 09:02:06 +0000
@@ -5,8 +5,8 @@
"uid": "${notification.uid}",
"level": "${notification.level}",
"category": "${notification.category}",
- "time": "${format.formatDate( $notification.time )}",
- "message": "${notification.message}",
+ "time": "${format.formatDateTime( $notification.time )}",
+ "message": "$!{encoder.jsonEncode( $notification.message )}",
"completed": "${notification.completed}"
}#if( $velocityCount < $size ),#end
#end
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css 2012-03-09 13:21:38 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css 2012-04-11 09:02:06 +0000
@@ -338,6 +338,19 @@
border-radius: 3px;
}
+table.notificationTable
+{
+ background-color: #ffffbf;
+ border: 1px solid #cccc00;
+ padding: 6px;
+ border-radius: 3px;
+}
+
+table.notificationTable td
+{
+ padding: 3px;
+}
+
/*----------------------------------------------------------------------------*/
/* Sorting */
/*----------------------------------------------------------------------------*/
=== 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 2012-03-05 10:43:47 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2012-04-11 14:33:18 +0000
@@ -4,8 +4,8 @@
// -----------------------------------------------------------------------------
var headerMessageTimeout = -1;
-var _loading_bar_html = "<img src='../images/ajax-loader-bar.gif'>";
-var _loading_circle_html = "<img src='../images/ajax-loader-circle.gif'>";
+var _loading_bar_html = "<span id='loaderSpan'><img src='../images/ajax-loader-bar.gif'></span>";
+var _loading_circle_html = "<span id='loaderSpan'><img src='../images/ajax-loader-circle.gif'></span>";
/**
* Go back using the document.referrer.
@@ -1522,7 +1522,6 @@
// Paging
// -----------------------------------------------------------------------------
-
isAjax = false;
function pagingList( currentPage, pageSize )
{
@@ -1587,3 +1586,39 @@
pagingList( currentPage, pageSize );
}
}
+
+// -----------------------------------------------------------------------------
+// Notifications
+// -----------------------------------------------------------------------------
+
+function pingNotifications( category, tableId )
+{
+ var lastUid = $( '#' + tableId ).prop( 'lastUid' );
+
+ var param = lastUid ? '&lastUid=' + lastUid : '';
+
+ $.getJSON( '../dhis-web-commons-ajax-json/getNotifications.action?category=' + category + param, function( json )
+ {
+ var html = '';
+ var completedHtml = '<img src="../images/completed.png">';
+
+ $.each( json.notifications, function( i, notification )
+ {
+ var first = i == 0;
+ var loaderHtml = '';
+
+ if ( first )
+ {
+ $( '#' + tableId ).prop( 'lastUid', notification.uid );
+ loaderHtml = _loading_bar_html;
+ $( '#loaderSpan' ).replaceWith ( '' ); // Hide previous loader bar
+ }
+
+ html += '<tr><td>' + notification.time + '</td><td>' + notification.message + ' ';
+ html += notification.completed == "true" ? completedHtml : loaderHtml;
+ html += '</td></tr>';
+ } );
+
+ $( '#' + tableId ).prepend( html );
+ } );
+}
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/NoAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/NoAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/NoAction.java 2012-04-11 13:49:03 +0000
@@ -36,6 +36,17 @@
public class NoAction
implements Action
{
+ private boolean running;
+
+ public boolean isRunning()
+ {
+ return running;
+ }
+ public void setRunning( boolean running )
+ {
+ this.running = running;
+ }
+
public String execute()
{
return SUCCESS;
=== added directory 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue'
=== added file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ImportDataValueAction.java 2012-04-11 13:49:03 +0000
@@ -0,0 +1,82 @@
+package org.hisp.dhis.importexport.action.datavalue;
+
+/*
+ * Copyright (c) 2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import org.hisp.dhis.dxf2.datavalueset.DataValueSetService;
+import org.hisp.dhis.importexport.ImportStrategy;
+import org.hisp.dhis.importexport.action.util.ImportDataValueTask;
+import org.hisp.dhis.system.scheduling.Scheduler;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+public class ImportDataValueAction
+ implements Action
+{
+ @Autowired
+ private DataValueSetService dataValueSetService;
+
+ @Autowired
+ private Scheduler scheduler;
+
+ private File upload;
+
+ public void setUpload( File upload )
+ {
+ this.upload = upload;
+ }
+
+ private boolean dryRun;
+
+ public void setDryRun( boolean dryRun )
+ {
+ this.dryRun = dryRun;
+ }
+
+ private ImportStrategy strategy;
+
+ public void setStrategy( String stgy )
+ {
+ this.strategy = ImportStrategy.valueOf( stgy );
+ }
+
+ public String execute()
+ throws Exception
+ {
+ final InputStream in = new BufferedInputStream( new FileInputStream( upload ) );
+
+ scheduler.executeTask( new ImportDataValueTask( dataValueSetService, in, dryRun, strategy ) );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportDataValueTask.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportDataValueTask.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ImportDataValueTask.java 2012-04-11 13:49:03 +0000
@@ -0,0 +1,30 @@
+package org.hisp.dhis.importexport.action.util;
+
+import java.io.InputStream;
+
+import org.hisp.dhis.common.IdentifiableObject.IdentifiableProperty;
+import org.hisp.dhis.dxf2.datavalueset.DataValueSetService;
+import org.hisp.dhis.importexport.ImportStrategy;
+
+public class ImportDataValueTask
+ implements Runnable
+{
+ private DataValueSetService dataValueSetService;
+ private InputStream in;
+ private boolean dryRun;
+ private ImportStrategy strategy;
+
+ public ImportDataValueTask( DataValueSetService dataValueSetService, InputStream in, boolean dryRun, ImportStrategy strategy )
+ {
+ this.dataValueSetService = dataValueSetService;
+ this.in = in;
+ this.dryRun = dryRun;
+ this.strategy = strategy;
+ }
+
+ @Override
+ public void run()
+ {
+ dataValueSetService.saveDataValueSet( in, IdentifiableProperty.UID, IdentifiableProperty.UID, dryRun, strategy );
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml 2012-01-05 20:39:23 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/META-INF/dhis/beans.xml 2012-04-11 13:49:03 +0000
@@ -3,9 +3,11 @@
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <!-- Import -->
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <!-- Data value import -->
+
+ <bean id="org.hisp.dhis.importexport.action.datavalue.ImportDataValueAction" class="org.hisp.dhis.importexport.action.datavalue.ImportDataValueAction"/>
+
+ <!-- Import -->
<bean id="org.hisp.dhis.importexport.action.imp.ImportAction" class="org.hisp.dhis.importexport.action.imp.ImportAction"
scope="prototype">
@@ -34,9 +36,7 @@
<property name="processCoordinator" ref="processCoordinator" />
</bean>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <!-- Object Ajax -->
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <!-- Object Ajax -->
<bean id="org.hisp.dhis.importexport.action.object.MatchObjectAction" class="org.hisp.dhis.importexport.action.object.MatchObjectAction"
scope="prototype">
@@ -66,9 +66,7 @@
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
</bean>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <!-- Preview -->
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <!-- Preview -->
<bean id="org.hisp.dhis.importexport.action.imp.GetPreviewOptionsAction" class="org.hisp.dhis.importexport.action.imp.GetPreviewOptionsAction"
scope="prototype">
@@ -97,9 +95,7 @@
<property name="importObjectService" ref="org.hisp.dhis.importexport.ImportObjectService" />
</bean>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <!-- Export -->
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <!-- Export -->
<bean id="org.hisp.dhis.importexport.action.exp.MetaDataExportAction" class="org.hisp.dhis.importexport.action.exp.MetaDataExportAction"
scope="prototype">
@@ -159,9 +155,7 @@
<property name="dataIntegrityService" ref="org.hisp.dhis.dataintegrity.DataIntegrityService" />
</bean>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <!-- Dhis 1.4 Configuration -->
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <!-- Dhis 1.4 Configuration -->
<bean id="org.hisp.dhis.importexport.action.dhis14.GetDhis14ConfigurationAction" class="org.hisp.dhis.importexport.action.dhis14.GetDhis14ConfigurationAction"
scope="prototype">
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2012-02-23 11:12:25 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2012-04-11 14:33:18 +0000
@@ -262,6 +262,7 @@
intro_pdf_metadata_export=Portable Document Format (PDF) is a commonly used file format for document exchange.
intro_xls_metadata_export=Excel Spreadsheet (XLS) is a commonly used spreadsheet file format from Microsoft.
intro_import=This is the regular import function which imports data from the DHIS 2 exchange format called DXF.
+intro_data_value_import=Import data values on the DXF format, which is used for data exchange by DHIS and other third-party software.
intro_dhis14_import=Import data from DHIS 1.4 installations. DHIS 1.4 is the predecessor of DHIS 2.
intro_data_export=Export data values. This is the regular export function which exports data to the DHIS 2 exchange format called DXF.
intro_metadata_export=Export meta data to the DHIS 2 exchange format. Meta meta implies data elements and other objects describing the data.
@@ -269,3 +270,8 @@
intro_export_to_other_systems=Export data and meta data to formats such as PDF, Excel and DHIS 1.4.
intro_dhis14_file_configuration=Set the configuration for the DHIS 1.4 file import process, such as the location of the data file.
no_item_to_match=Sorry, there is no any selected item to match
+dry_run=Dry run
+strategy=Strategy
+new_only=New only
+updates_only=Updates only
+data_value_import=Data value import
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml 2011-06-23 14:44:17 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/struts.xml 2012-04-11 13:49:03 +0000
@@ -14,9 +14,21 @@
<param name="menu">/dhis-web-importexport/mainMenu.vm</param>
</action>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <!-- Menu -->
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <!-- Data value import -->
+
+ <action name="displayImportDataValueForm" class="org.hisp.dhis.importexport.action.NoAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-importexport/importDataValue.vm</param>
+ <param name="menu">/dhis-web-importexport/mainMenu.vm</param>
+ <param name="javascripts">javascript/importDataValue.js</param>
+ </action>
+
+ <action name="importDataValue" class="org.hisp.dhis.importexport.action.datavalue.ImportDataValueAction">
+ <result name="success" type="redirect">displayImportDataValueForm.action?running=true</result>
+ <interceptor-ref name="fileUploadStack" />
+ </action>
+
+ <!-- Menu -->
<action name="displayExternalImportMenu" class="org.hisp.dhis.importexport.action.NoAction">
<result name="success" type="velocity">/main.vm</result>
@@ -30,9 +42,7 @@
<param name="menu">/dhis-web-importexport/mainMenu.vm</param>
</action>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <!-- Import -->
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <!-- Import -->
<action name="setImportFormat" class="org.hisp.dhis.importexport.action.imp.SetImportTypeAction">
<result name="success" type="redirect">displayImportForm.action</result>
@@ -66,10 +76,8 @@
<param name="page">/dhis-web-importexport/importAnalysisForm.vm</param>
<param name="menu">/dhis-web-importexport/mainMenu.vm</param>
</action>
-
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <!-- Object Ajax -->
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+
+ <!-- Object Ajax -->
<action name="discardObjectAjax" class="org.hisp.dhis.importexport.action.object.DiscardObjectAction">
<result name="success" type="velocity-xml">/dhis-web-importexport/responseSuccess.vm</result>
@@ -83,9 +91,7 @@
<param name="onExceptionReturn">plainTextError</param>
</action>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <!-- Preview -->
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <!-- Preview -->
<action name="displayPreviewForm" class="org.hisp.dhis.importexport.action.imp.GetPreviewOptionsAction">
<result name="success" type="velocity">/main.vm</result>
@@ -129,10 +135,8 @@
<param name="menu">/dhis-web-importexport/mainMenu.vm</param>
<param name="javascripts">javascript/import.js</param>
</action>
-
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <!-- Export -->
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+
+ <!-- Export -->
<action name="displayMetaDataExportForm" class="org.hisp.dhis.importexport.action.exp.GetExportOptionsAction">
<result name="success" type="velocity">/main.vm</result>
@@ -203,9 +207,7 @@
<param name="onExceptionReturn">plainTextError</param>
</action>
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
- <!-- Dhis 1.4 Configuration -->
- <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
+ <!-- Dhis 1.4 Configuration -->
<action name="displayConfigDhis14Form" class="org.hisp.dhis.importexport.action.dhis14.GetDhis14ConfigurationAction">
<result name="success" type="velocity">/main.vm</result>
=== added file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/importDataValue.vm 2012-04-11 14:33:18 +0000
@@ -0,0 +1,52 @@
+
+<h3>$i18n.getString( "data_value_import" )</h3>
+
+<div class="inputCriteria" style="height:130px">
+<form id="importForm" name="importForm" method="post" enctype="multipart/form-data" action="importDataValue.action">
+<table>
+<col width="80">
+<col>
+<tr>
+ <td>$i18n.getString( "file" )</td>
+ <td><input type="file" id="upload" name="upload"></td>
+</tr>
+<tr>
+ <td>$i18n.getString( "dry_run" )</td>
+ <td><select id="dryRun" name="dryRun" style="width:180px">
+ <option value="false">$i18n.getString( "no" )</option>
+ <option value="true">$i18n.getString( "yes" )</option>
+ </select></td>
+</tr>
+<tr>
+ <td>$i18n.getString( "strategy" )</td>
+ <td><select id="strategy" name="strategy" style="width:180px">
+ <option value="NEW_AND_UPDATES">$i18n.getString( "new_and_updates" )</option>
+ <option value="NEW">$i18n.getString( "new_only" )</option>
+ <option value="UPDATES">$i18n.getString( "updates_only" )</option>
+ </select></td>
+</tr>
+<tr>
+ <td></td>
+ <td><input type="button" value="$i18n.getString( 'import' )" style="width:120px" onclick="importDataValue()"/></td>
+</tr>
+</table>
+</form>
+</div>
+
+#if( $running )
+
+<div>
+<table id="notificationTable" class="notificationTable">
+<col width="120">
+<col width="380">
+</table>
+</div>
+
+<script type="text/javascript">
+$( document ).ready( function() {
+ $( "#notificationTable" ).empty();
+ pingNotificationsTimeout();
+} );
+</script>
+
+#end
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/index.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/index.vm 2012-03-04 13:26:24 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/index.vm 2012-04-11 14:33:18 +0000
@@ -9,6 +9,7 @@
<ul class="introList">
#introListImgItem( "setImportFormat.action?importFormat=DXF" "import" "import" )
+ #introListImgItem( "displayImportDataValueForm.action" "data_value_import" "import" )
#introListImgItem( "displayExternalImportMenu.action" "dhis14_import" "import" )
#introListImgItem( "displayDataValueExportForm.action?exportFormat=DXF" "data_export" "export" )
=== added file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importDataValue.js'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importDataValue.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/importDataValue.js 2012-04-11 14:33:18 +0000
@@ -0,0 +1,17 @@
+
+function importDataValue()
+{
+ if ( !$( "#upload" ).val() )
+ {
+ setHeaderDelayMessage( "Please select a file to upload" );
+ return false;
+ }
+
+ $( "#importForm" ).submit();
+}
+
+function pingNotificationsTimeout()
+{
+ pingNotifications( 'DATAVALUE_IMPORT', 'notificationTable' );
+ setTimeout( "pingNotificationsTimeout()", 2500 );
+}
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/mainMenu.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/mainMenu.vm 2010-06-19 15:32:24 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/mainMenu.vm 2012-04-11 14:33:18 +0000
@@ -3,6 +3,7 @@
<ul>
<li><a href="setImportFormat.action?importFormat=DXF">$i18n.getString( "import" ) </a></li>
+ <li><a href="displayImportDataValueForm.action">$i18n.getString( "data_value_import" ) </a></li>
<li><a href="displayExternalImportMenu.action">$i18n.getString( "dhis14_import" ) </a></li>
</ul>
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataMart.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataMart.js 2012-04-10 20:15:18 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataMart.js 2012-04-11 13:49:03 +0000
@@ -6,6 +6,8 @@
function startExport()
{
+ $( '#notificationTable' ).show().prepend( '<tr><td>' + _loading_bar_html + '</td></tr>' );
+
var startDate = $( '#startDate' ).val();
var endDate = $( '#endDate' ).val();
@@ -15,16 +17,11 @@
url += "&periodType=" + $( this ).val();
} );
- $.get( url, pingNotifications );
-}
-
-function pingNotifications()
-{
- $( '#notificationDiv' ).load( '../dhis-web-commons-ajax-html/getNotifications.action?category=DATAMART&max=20' );
+ $.get( url, pingNotificationsTimeout );
}
function pingNotificationsTimeout()
{
- pingNotifications();
- setTimeout( "pingNotificationsTimeout()", 2000 );
+ pingNotifications( 'DATAMART', 'notificationTable' );
+ setTimeout( "pingNotificationsTimeout()", 2500 );
}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataMartForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataMartForm.vm 2012-02-12 19:23:31 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDataMartForm.vm 2012-04-11 09:02:06 +0000
@@ -1,4 +1,3 @@
-
<h3>$i18n.getString( "data_mart_management" )</h3>
<div id="critiera" class="inputCriteria" style="width:380px;height:170px;">
@@ -29,4 +28,9 @@
</table>
</div>
-<div id="notificationDiv" class="notifications"></div>
\ No newline at end of file
+<div>
+<table id="notificationTable" class="notificationTable" style="display:none">
+<col width="120">
+<col width="380">
+</table>
+</div>
\ No newline at end of file