dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14111
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4664: auto-generate section form for mobile
------------------------------------------------------------
revno: 4664
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-09-23 20:11:09 +0200
message:
auto-generate section form for mobile
added:
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetSectionFormAction.java
modified:
dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntry.vm
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/style/light.css
--
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 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetSectionFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetSectionFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetSectionFormAction.java 2011-09-23 18:11:09 +0000
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2004-2010, 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.
+ */
+
+package org.hisp.dhis.light.action;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetSectionFormAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ private PeriodService periodService;
+
+ public void setPeriodService( PeriodService periodService )
+ {
+ this.periodService = periodService;
+ }
+
+ private I18nFormat format;
+
+ public void setFormat( I18nFormat format )
+ {
+ this.format = format;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private Integer organisationUnitId;
+
+ public void setOrganisationUnitId( Integer organisationUnitId )
+ {
+ this.organisationUnitId = organisationUnitId;
+ }
+
+ public Integer getOrganisationUnitId()
+ {
+ return organisationUnitId;
+ }
+
+ private Integer dataSetId;
+
+ public void setDataSetId( Integer dataSetId )
+ {
+ this.dataSetId = dataSetId;
+ }
+
+ public Integer getDataSetId()
+ {
+ return dataSetId;
+ }
+
+ private String periodId;
+
+ public void setPeriodId( String periodId )
+ {
+ this.periodId = periodId;
+ }
+
+ public String getPeriodId()
+ {
+ return periodId;
+ }
+
+ private DataSet dataSet;
+
+ public DataSet getDataSet()
+ {
+ return dataSet;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ {
+ Period period = new Period( String.valueOf( periodId ) );
+ dataSet = dataSetService.getDataSet( dataSetId );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2011-09-23 15:49:07 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2011-09-23 18:11:09 +0000
@@ -18,6 +18,11 @@
<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
</bean>
+ <bean id="org.hisp.dhis.light.action.GetSectionFormAction" class="org.hisp.dhis.light.action.GetSectionFormAction">
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+ </bean>
+
<bean id="org.hisp.dhis.light.action.ProvideContentAction" class="org.hisp.dhis.light.action.ProvideContentAction"
scope="prototype">
<property name="dashboardManager" ref="org.hisp.dhis.dashboard.DashboardManager" />
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml 2011-09-23 13:11:20 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml 2011-09-23 18:11:09 +0000
@@ -27,7 +27,7 @@
<param name="page">/dhis-web-light/selectPeriod.vm</param>
</action>
- <action name="dataEntry" class="org.hisp.dhis.light.action.NoAction">
+ <action name="dataEntry" class="org.hisp.dhis.light.action.GetSectionFormAction">
<result name="success" type="velocity">/dhis-web-light/main.vm</result>
<param name="page">/dhis-web-light/dataEntry.vm</param>
</action>
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntry.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntry.vm 2011-09-23 13:11:20 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntry.vm 2011-09-23 18:11:09 +0000
@@ -1,37 +1,24 @@
-<h2>Immunization</h2>
+<h2>$dataSet.name</h2>
<form>
-<div class="header-box">
- <h3>BCG doses given</h3>
- <p>
- <label>Fixed | < 12 mths</label> <input type="text" size="24" /><br />
- <label>Fixed | 12 to 59 mths</label> <input type="text" size="24" /> <br />
- <label>Outreach | < 12 mths</label> <input type="text" size="24" /> <br />
- <label>Outreach | 12 to 59 mths</label> <input type="text" size="24" /> <br />
- </p>
-</div>
-
-<div class="header-box">
- <h3>Fully Immunized child</h3>
- <p>
- <label>Fixed | < 12 mths</label> <input type="text" size="24" /><br />
- <label>Fixed | 12 to 59 mths</label> <input type="text" size="24" /> <br />
- <label>Outreach | < 12 mths</label> <input type="text" size="24" /> <br />
- <label>Outreach | 12 to 59 mths</label> <input type="text" size="24" /> <br />
- </p>
-</div>
-
-<div class="header-box">
- <h3>LLITN given at Penta3</h3>
- <p>
- <label>Fixed | < 12 mths</label> <input type="text" size="24" /><br />
- <label>Fixed | 12 to 59 mths</label> <input type="text" size="24" /> <br />
- <label>Outreach | < 12 mths</label> <input type="text" size="24" /> <br />
- <label>Outreach | 12 to 59 mths</label> <input type="text" size="24" /> <br />
- </p>
-</div>
+#foreach( $section in $dataSet.sections )
+<div class="header-box">
+ <h3>$section.name</h3>
+ <p>
+ #foreach( $dataElement in $section.dataElements)
+ #if( $section.categoryCombo.name == "default" )
+ <label>(default) $dataElement.name</label> <input type="text" size="24" /><br />
+ #else
+ #foreach( $optionCombo in $section.categoryCombo.optionCombos )
+ <label>$dataElement.name $optionCombo.name</label> <input type="text" size="24" /><br />
+ #end
+ #end
+ #end
+ </p>
+</div>
+#end
<div class="header-box">
<p>
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/style/light.css'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/style/light.css 2011-09-23 15:41:35 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/style/light.css 2011-09-23 18:11:09 +0000
@@ -454,7 +454,7 @@
body div.header-box p {
font-size: 0.6em;
- border: 1px solid #D8D8D8;
+ border: 1px solid #C8DBEA;
width: 92%;
margin: 0 auto 0.6em auto;
padding: 0.4em 0.4em;
@@ -468,8 +468,8 @@
width: 92%;
margin: 0em auto;
padding: 0.3em 0.3em;
- background-color: #0038E1;
- color: white;
+ background-color: #CBDDEB;
+ color: #39547D;
}
/*