← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3162: Added labs directory for experimental projects. Work in progress on web module for smart mobile s...

 

------------------------------------------------------------
revno: 3162
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-03-24 20:34:13 +0100
message:
  Added labs directory for experimental projects. Work in progress on web module for smart mobile screens.
added:
  labs/
  labs/dhis-web-light/
  labs/dhis-web-light/pom.xml
  labs/dhis-web-light/src/
  labs/dhis-web-light/src/main/
  labs/dhis-web-light/src/main/java/
  labs/dhis-web-light/src/main/java/org/
  labs/dhis-web-light/src/main/java/org/hisp/
  labs/dhis-web-light/src/main/java/org/hisp/dhis/
  labs/dhis-web-light/src/main/java/org/hisp/dhis/light/
  labs/dhis-web-light/src/main/java/org/hisp/dhis/light/action/
  labs/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetChartAction.java
  labs/dhis-web-light/src/main/java/org/hisp/dhis/light/action/ProvideContentAction.java
  labs/dhis-web-light/src/main/resources/
  labs/dhis-web-light/src/main/resources/META-INF/
  labs/dhis-web-light/src/main/resources/META-INF/dhis/
  labs/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml
  labs/dhis-web-light/src/main/resources/org/
  labs/dhis-web-light/src/main/resources/org/hisp/
  labs/dhis-web-light/src/main/resources/org/hisp/dhis/
  labs/dhis-web-light/src/main/resources/org/hisp/dhis/light/
  labs/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties
  labs/dhis-web-light/src/main/resources/struts.xml
  labs/dhis-web-light/src/main/webapp/
  labs/dhis-web-light/src/main/webapp/WEB-INF/
  labs/dhis-web-light/src/main/webapp/WEB-INF/web.xml
  labs/dhis-web-light/src/main/webapp/dhis-web-light/
  labs/dhis-web-light/src/main/webapp/dhis-web-light/dashboard.vm
  labs/dhis-web-light/src/main/webapp/dhis-web-light/style/
  labs/dhis-web-light/src/main/webapp/dhis-web-light/style/dhis-web-light.css
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/login.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
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/login.css'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/login.css	2011-03-23 18:29:28 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/login.css	2011-03-24 19:34:13 +0000
@@ -14,7 +14,7 @@
 
 .loginField
 {
-  margin-top: 6%;
+  margin-top: 7%;
 }
 
 .loginField td

=== added directory 'labs'
=== added directory 'labs/dhis-web-light'
=== added file 'labs/dhis-web-light/pom.xml'
--- labs/dhis-web-light/pom.xml	1970-01-01 00:00:00 +0000
+++ labs/dhis-web-light/pom.xml	2011-03-24 19:34:13 +0000
@@ -0,0 +1,53 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  
+  <parent>
+    <groupId>org.hisp.dhis</groupId>
+    <artifactId>dhis-web</artifactId>
+    <version>2.2-SNAPSHOT</version>
+  </parent>
+  
+  <artifactId>dhis-web-light</artifactId>
+  <packaging>war</packaging>
+  <name>DHIS Web Light</name>
+  
+  <build>
+    <finalName>dhis-web-light</finalName>
+  </build>
+  
+  <dependencies>
+    
+    <!-- DHIS -->
+    
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-web-commons</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-web-commons-resources</artifactId>
+      <type>war</type>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-service-reporting</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-service-core</artifactId>
+    </dependency>
+        
+    <!-- Other -->
+    
+    <dependency>
+      <groupId>jfree</groupId>
+      <artifactId>jfreechart</artifactId>
+    </dependency>    
+  </dependencies>
+  
+  <properties>
+    <rootDir>../../</rootDir>
+  </properties>
+</project>

=== added directory 'labs/dhis-web-light/src'
=== added directory 'labs/dhis-web-light/src/main'
=== added directory 'labs/dhis-web-light/src/main/java'
=== added directory 'labs/dhis-web-light/src/main/java/org'
=== added directory 'labs/dhis-web-light/src/main/java/org/hisp'
=== added directory 'labs/dhis-web-light/src/main/java/org/hisp/dhis'
=== added directory 'labs/dhis-web-light/src/main/java/org/hisp/dhis/light'
=== added directory 'labs/dhis-web-light/src/main/java/org/hisp/dhis/light/action'
=== added file 'labs/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetChartAction.java'
--- labs/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetChartAction.java	1970-01-01 00:00:00 +0000
+++ labs/dhis-web-light/src/main/java/org/hisp/dhis/light/action/GetChartAction.java	2011-03-24 19:34:13 +0000
@@ -0,0 +1,124 @@
+package org.hisp.dhis.light.action;
+
+/*
+ * 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.
+ */
+
+import org.hisp.dhis.chart.ChartService;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.jfree.chart.JFreeChart;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class GetChartAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private ChartService chartService;
+
+    public void setChartService( ChartService chartService )
+    {
+        this.chartService = chartService;
+    }
+    
+    private I18nFormat format;
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private JFreeChart chart;
+
+    public JFreeChart getChart()
+    {
+        return chart;
+    }
+    
+    private int height;
+
+    public int getHeight()
+    {
+        return height;
+    }
+
+    public void setHeight( int height )
+    {
+        this.height = height;
+    }
+
+    private int width;
+
+    public int getWidth()
+    {
+        return width;
+    }
+
+    public void setWidth( int width )
+    {
+        this.width = width;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implemenation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        if ( id != null )
+        {
+            chart = chartService.getJFreeChart( id, format );
+            
+            height = 200;
+            
+            width = 400;
+        }
+        
+        return SUCCESS;
+    }
+}

=== added file 'labs/dhis-web-light/src/main/java/org/hisp/dhis/light/action/ProvideContentAction.java'
--- labs/dhis-web-light/src/main/java/org/hisp/dhis/light/action/ProvideContentAction.java	1970-01-01 00:00:00 +0000
+++ labs/dhis-web-light/src/main/java/org/hisp/dhis/light/action/ProvideContentAction.java	2011-03-24 19:34:13 +0000
@@ -0,0 +1,88 @@
+package org.hisp.dhis.light.action;
+
+import java.util.List;
+
+import org.hisp.dhis.dashboard.DashboardConfiguration;
+import org.hisp.dhis.dashboard.DashboardContent;
+import org.hisp.dhis.dashboard.DashboardManager;
+import org.hisp.dhis.dashboard.DashboardService;
+import org.hisp.dhis.document.Document;
+import org.hisp.dhis.reporttable.ReportTable;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.User;
+
+import com.opensymphony.xwork2.Action;
+import com.opensymphony.xwork2.ActionContext;
+
+public class ProvideContentAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private DashboardService dashboardService;
+    
+    public void setDashboardService( DashboardService dashboardService )
+    {
+        this.dashboardService = dashboardService;
+    }
+    
+    private DashboardManager dashboardManager;
+    
+    public void setDashboardManager( DashboardManager dashboardManager )
+    {
+        this.dashboardManager = dashboardManager;
+    }
+
+    private CurrentUserService currentUserService;
+    
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private List<ReportTable> reportTables;
+    
+    public List<ReportTable> getReportTables()
+    {
+        return reportTables;
+    }
+
+    private List<Document> documents;
+
+    public List<Document> getDocuments()
+    {
+        return documents;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        DashboardConfiguration config = dashboardManager.getConfiguration();
+        
+        if ( config != null )
+        {
+            ActionContext.getContext().getActionInvocation().getStack().push( config.getAreaItems() );
+            System.out.println( config.getAreaItems() );
+        }
+        
+        User user = currentUserService.getCurrentUser();
+        
+        DashboardContent content = dashboardService.getDashboardContent( user );
+        
+        reportTables = content.getReportTables();
+        
+        documents = content.getDocuments();
+
+        return SUCCESS;
+    }
+}

=== added directory 'labs/dhis-web-light/src/main/resources'
=== added directory 'labs/dhis-web-light/src/main/resources/META-INF'
=== added directory 'labs/dhis-web-light/src/main/resources/META-INF/dhis'
=== added file 'labs/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml'
--- labs/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	1970-01-01 00:00:00 +0000
+++ labs/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2011-03-24 19:34:13 +0000
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans";
+	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.0.xsd";>
+
+  <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"/>
+	<property name="dashboardService" ref="org.hisp.dhis.dashboard.DashboardService"/>
+    <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService"/>
+  </bean>
+	
+  <bean id="org.hisp.dhis.light.action.GetChartAction"
+    class="org.hisp.dhis.light.action.GetChartAction" scope="prototype">
+    <property name="chartService" ref="org.hisp.dhis.chart.ChartService"/>
+  </bean>
+  
+</beans>
\ No newline at end of file

=== added directory 'labs/dhis-web-light/src/main/resources/org'
=== added directory 'labs/dhis-web-light/src/main/resources/org/hisp'
=== added directory 'labs/dhis-web-light/src/main/resources/org/hisp/dhis'
=== added directory 'labs/dhis-web-light/src/main/resources/org/hisp/dhis/light'
=== added file 'labs/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties'
=== added file 'labs/dhis-web-light/src/main/resources/struts.xml'
--- labs/dhis-web-light/src/main/resources/struts.xml	1970-01-01 00:00:00 +0000
+++ labs/dhis-web-light/src/main/resources/struts.xml	2011-03-24 19:34:13 +0000
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE struts PUBLIC
+"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+"http://struts.apache.org/dtds/struts-2.0.dtd";>
+<struts>
+
+  <include file="dhis-web-commons.xml"/>
+  
+  <package name="dhis-web-light" extends="dhis-web-commons" namespace="/dhis-web-light">
+
+    <action name="index" class="org.hisp.dhis.light.action.ProvideContentAction">
+	  <result name="success" type="velocity">/dhis-web-light/dashboard.vm</result>
+    </action>
+
+    <action name="getChart" class="org.hisp.dhis.light.action.GetChartAction">
+      <result name="success" type="chart">
+      <param name="width">480</param>
+      <param name="height">800</param>
+      </result>
+    </action>
+    
+  </package>
+</struts>
\ No newline at end of file

=== added directory 'labs/dhis-web-light/src/main/webapp'
=== added directory 'labs/dhis-web-light/src/main/webapp/WEB-INF'
=== added file 'labs/dhis-web-light/src/main/webapp/WEB-INF/web.xml'
--- labs/dhis-web-light/src/main/webapp/WEB-INF/web.xml	1970-01-01 00:00:00 +0000
+++ labs/dhis-web-light/src/main/webapp/WEB-INF/web.xml	2011-03-24 19:34:13 +0000
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+  "http://java.sun.com/dtd/web-app_2_3.dtd";>
+<web-app>
+  <display-name>DHIS Web Light</display-name>
+
+  <context-param>
+    <param-name>contextConfigLocation</param-name>
+    <param-value>classpath*:/META-INF/dhis/beans.xml</param-value>
+  </context-param>
+  <context-param>
+    <param-name>automaticAccessType</param-name>
+    <param-value>ghostAdmin</param-value>
+  </context-param>
+
+  <filter>
+    <filter-name>RedirectFilter</filter-name>
+    <filter-class>org.hisp.dhis.servlet.filter.HttpRedirectFilter</filter-class>
+    <init-param>
+      <param-name>redirectPath</param-name>
+      <param-value>dhis-web-light/index.action</param-value>
+    </init-param>
+  </filter>
+  <filter>
+    <filter-name>OpenSessionInViewFilter</filter-name>
+    <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
+  </filter>
+  <filter>
+    <filter-name>springSecurityFilterChain</filter-name>
+    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
+  </filter>
+  <filter>
+    <filter-name>Struts</filter-name>
+    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
+  </filter>
+
+  <filter-mapping>
+    <filter-name>RedirectFilter</filter-name>
+    <url-pattern>/</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+    <filter-name>OpenSessionInViewFilter</filter-name>
+    <url-pattern>*.action</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+    <filter-name>springSecurityFilterChain</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+    <filter-name>Struts</filter-name>
+    <url-pattern>*.action</url-pattern>
+  </filter-mapping>
+
+  <listener>
+    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+  </listener>
+  <listener>
+    <listener-class>org.hisp.dhis.system.startup.StartupListener</listener-class>
+  </listener>
+</web-app>

=== added directory 'labs/dhis-web-light/src/main/webapp/dhis-web-light'
=== added file 'labs/dhis-web-light/src/main/webapp/dhis-web-light/dashboard.vm'
--- labs/dhis-web-light/src/main/webapp/dhis-web-light/dashboard.vm	1970-01-01 00:00:00 +0000
+++ labs/dhis-web-light/src/main/webapp/dhis-web-light/dashboard.vm	2011-03-24 19:34:13 +0000
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd";>
+<html>
+<head>
+  <title>DHIS 2</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+  
+  <link type="text/css" rel="stylesheet" media="screen" href="style/dhis-web-light.css">
+  
+  <script type="text/javascript" src="../dhis-web-commons/javascripts/commons.js"></script>
+  <script type="text/javascript" src="../dhis-web-commons/javascripts/commons.ajax.js"></script>
+  <script type="text/javascript" src="../dhis-web-commons/javascripts/lists.js"></script>
+  
+</head>
+<head>
+<body>
+
+<div class="headerDiv">DHIS 2</div>
+
+<div class="contentDiv">
+
+<!-- Charts -->
+
+#if( $chartAreaA )
+<div class="contentItemDiv"><img src="getChart.action?id=${chartAreaA}" style="width:100%"></div>
+#end
+
+#if( $chartAreaB )
+<div class="contentItemDiv"><img src="getChart.action?id=${chartAreaB}" style="width:100%"></div>
+#end
+
+#if( $chartAreaC )
+<div class="contentItemDiv"><img src="getChart.action?id=${chartAreaC}" style="width:100%"></div>
+#end
+
+#if( $chartAreaD )
+<div class="contentItemDiv"><img src="getChart.action?id=${chartAreaD}" style="width:100%"></div>
+#end
+
+<!-- Report tables -->
+
+
+
+</div>
+</body>
+</html>

=== added directory 'labs/dhis-web-light/src/main/webapp/dhis-web-light/style'
=== added file 'labs/dhis-web-light/src/main/webapp/dhis-web-light/style/dhis-web-light.css'
--- labs/dhis-web-light/src/main/webapp/dhis-web-light/style/dhis-web-light.css	1970-01-01 00:00:00 +0000
+++ labs/dhis-web-light/src/main/webapp/dhis-web-light/style/dhis-web-light.css	2011-03-24 19:34:13 +0000
@@ -0,0 +1,32 @@
+
+html, body {
+  font-family: arial;
+}
+
+body {
+  margin: 0px;
+  padding: 0px;
+}
+  
+.headerDiv {
+  position: relative;
+  width: 100%;
+  font-size: 2em;
+  text-align: center;
+  color: #ffffff;
+  background-color: #32669a;
+  padding: 0.5em;
+  border-bottom: 1px solid #d0d0d0;
+}
+  
+.contentDiv {
+  position: relative;
+  width: 100%;
+}
+  
+.contentItemDiv {
+  position: relative;
+  padding-top: 3em;
+  padding-bottom: 3em;
+  border-bottom: 1px solid #d0d0d0;
+}