← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8905: Notification in dashboard if profile is not filled

 

------------------------------------------------------------
revno: 8905
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-11-06 17:03:24 +0300
message:
  Notification in dashboard if profile is not filled
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java
  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
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java	2012-10-14 17:22:01 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/User.java	2012-11-06 14:03:24 +0000
@@ -151,6 +151,25 @@
     {
         return firstName + " " + surname;
     }
+    
+    /**
+     * Checks whether the profile has been filled, which is defined as three
+     * not-null properties out of all optional properties.
+     */
+    public boolean isProfileFilled()
+    {
+        Object[] props = { jobTitle, introduction, gender, birthday, 
+            nationality, employer, education, interests, languages };
+        
+        int count = 0;
+        
+        for ( Object prop : props )
+        {
+            count = prop != null ? ( count + 1 ) : count;
+        }
+        
+        return count > 3;
+    }
 
     /**
      * Returns the first of the organisation units associated with the user.

=== 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-11-06 13:08:45 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm	2012-11-06 14:03:24 +0000
@@ -4,7 +4,9 @@
 var i18n_viewing = '$encoder.jsEscape( $i18n.getString( "viewing" ), "'")';
 </script>
 
-<h3><a href="profile.action"><img src="../images/user_small.png"></a> &nbsp;<a href="profile.action">$encoder.htmlEncode( $currentUser.name )</a>
+<h3>
+<a href="profile.action"><img src="../images/user_small.png"></a> &nbsp;<a href="profile.action">$encoder.htmlEncode( $currentUser.name )</a>
+#if( !$currentUser.profileFilled )<span class="alert">(</span><a class="alert" href="../dhis-web-commons-about/showUpdateUserProfileForm.action">update profile!</a><span class="alert">)</span> #end
 &nbsp;&#8226;&nbsp; <a href="showSendFeedback.action">$i18n.getString( "write_feedback" )</a>
 #if( $messageCount > 0 )&nbsp;&#8226;&nbsp; <a href="message.action">$messageCount #if( $messageCount > 1 )$i18n.getString( "unread_messages" )#else$i18n.getString( "unread_message" )#end</a> #end
 &nbsp;&#8226;&nbsp; #if( $interpretationCount > 0 )<a href="interpretation.action">$interpretationCount #if( $interpretationCount > 1 )$i18n.getString( "new_interpretations" )#else$i18n.getString( "new_interpretation" )#end</a> 

=== 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-11-06 13:08:45 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css	2012-11-06 14:03:24 +0000
@@ -191,6 +191,11 @@
   margin: 0 0 6px 4px;
 }
 
+a.alert, .alert
+{
+  color: #E92B2B;
+}
+
 /*----------------------------------------------------------------------------*/
 /* Message                                                                    */
 /*----------------------------------------------------------------------------*/