← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8402: WIP user profile page in dashboard

 

------------------------------------------------------------
revno: 8402
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-10-06 14:30:22 +0200
message:
  WIP user profile page in dashboard
added:
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/profile/
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/profile/action/
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/profile/action/GetUserAction.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/profile.vm
modified:
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.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 directory 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/profile'
=== added directory 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/profile/action'
=== added file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/profile/action/GetUserAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/profile/action/GetUserAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/profile/action/GetUserAction.java	2012-10-06 12:30:22 +0000
@@ -0,0 +1,81 @@
+package org.hisp.dhis.dashboard.profile.action;
+
+/*
+ * Copyright (c) 2004-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 org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class GetUserAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    @Autowired
+    private UserService userService;
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private String id;
+
+    public void setId( String id )
+    {
+        this.id = id;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private User user;
+
+    public User getUser()
+    {
+        return user;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        user = userService.getUser( id );
+        
+        return SUCCESS;
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml	2012-10-05 16:00:19 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/META-INF/dhis/beans.xml	2012-10-06 12:30:22 +0000
@@ -113,4 +113,10 @@
 	<property name="interpretationService" ref="org.hisp.dhis.interpretation.InterpretationService" />
   </bean>
 
+  <!-- Profile -->
+
+  <bean id="org.hisp.dhis.dashboard.profile.action.GetUserAction" class="org.hisp.dhis.dashboard.profile.action.GetUserAction"
+    scope="prototype">
+  </bean>
+
 </beans>

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties	2012-10-05 16:00:19 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties	2012-10-06 12:30:22 +0000
@@ -64,4 +64,5 @@
 report_table=Report table
 data_set_report=Data set report
 search_for_charts_maps_reports=Search for charts, maps and reports
-no_hits=No hits, try again
\ No newline at end of file
+no_hits=No hits, try again
+profile=Profile
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/struts.xml	2012-10-05 16:00:19 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/struts.xml	2012-10-06 12:30:22 +0000
@@ -142,5 +142,14 @@
       <result name="success" type="velocity">/dhis-web-dashboard-integration/interpretationFeed.vm</result>
     </action>
 
+    <!-- Profile -->
+    
+    <action name="profile" class="org.hisp.dhis.dashboard.profile.action.GetUserAction">
+      <result name="success" type="velocity">/main.vm</result>
+      <param name="page">/dhis-web-dashboard-integration/profile.vm</param>
+      <param name="menu">/dhis-web-dashboard-integration/menu.vm</param>
+      <param name="stylesheets">style/dashboard.css</param>
+    </action>
+
   </package>
 </struts>

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm	2012-10-05 16:00:19 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm	2012-10-06 12:30:22 +0000
@@ -14,6 +14,7 @@
 
 <div id="subMenu">
 	<ul>
+        <li><a href="profile.action?id=${currentUser.uid}">$i18n.getString( "profile" )</a></li>
 		<li><a href="message.action">$i18n.getString( "messages" )</a></li>
 		<li><a href="interpretation.action">$i18n.getString( "interpretations" )</a></li>
 	</ul>

=== added file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/profile.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/profile.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/profile.vm	2012-10-06 12:30:22 +0000
@@ -0,0 +1,14 @@
+
+<h3>$encoder.htmlEncode( $user.firstName ) $encoder.htmlEncode( $user.surname  )</h3>
+
+<div class="userRow"><div class="userLabel">Introduction</div><div class="userInfo">$encoder.htmlEncode( $user.introduction )</div></div>
+<div class="userRow"><div class="userLabel">Works as</div><div class="userInfo">$encoder.htmlEncode( $user.jobTitle )</div></div>
+<div class="userRow"><div class="userLabel">Employed at</div><div class="userInfo">$encoder.htmlEncode( $user.employer )</div></div>
+<div class="userRow"><div class="userLabel">Education</div><div class="userInfo">$encoder.htmlEncode( $user.jobTitle )</div></div>
+<div class="userRow"><div class="userLabel">Interested in</div><div class="userInfo">$encoder.htmlEncode( $user.jobTitle )</div></div>
+<div class="userRow"><div class="userLabel">Speaks</div><div class="userInfo">$encoder.htmlEncode( $user.languages )</div></div>
+<div class="userRow"><div class="userLabel">Birthday</div><div class="userInfo">$format.formatDate( $user.birthday )</div></div>
+<div class="userRow"><div class="userLabel">Gender</div><div class="userInfo">$encoder.htmlEncode( $user.gender )</div></div>
+<div class="userRow"><div class="userLabel">Nationality</div><div class="userInfo">$encoder.htmlEncode( $user.nationality )</div></div>
+<div class="userRow"><div class="userLabel">Email</div><div class="userInfo">$encoder.htmlEncode( $user.email )</div></div>
+<div class="userRow"><div class="userLabel">Phone number</div><div class="userInfo">$encoder.htmlEncode( $user.birthday )</div></div>

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css	2012-10-06 09:26:35 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css	2012-10-06 12:30:22 +0000
@@ -106,7 +106,7 @@
 #searchDiv
 {
   position: absolute;
-  left: 260px;
+  left: 330px;
   height: 25px;
   width: 350px;
   border: 1px solid #ccc;
@@ -127,7 +127,7 @@
 {
   position: absolute;
   margin-top: 29px;
-  left: 260px;
+  left: 330px;
   width: 362px;
   border-right: 1px solid #bbb;
   border-bottom: 1px solid #bbb;
@@ -346,3 +346,41 @@
 {
   cursor:pointer;
 }
+
+/*----------------------------------------------------------------------------*/
+/* Profile                                                                    */
+/*----------------------------------------------------------------------------*/
+
+.userRow
+{
+  display: block;
+  margin: 6px 0;
+}
+
+.userLabel
+{
+  display: inline-block;
+  color: #777;
+  font-size: 11pt;
+  width: 110px;
+  text-align: right;
+  padding-right: 20px;
+}
+
+.userInfo
+{
+  display: inline-block;
+  display: inline;
+  font-size: 11pt;
+}
+
+
+
+
+
+
+
+
+
+
+