dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19641
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8657: Added link to account page on front page
------------------------------------------------------------
revno: 8657
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-10-23 12:26:43 +0200
message:
Added link to account page on front page
added:
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/useraccount/action/IsSelfRegistrationAllowedAction.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/configuration/Configuration.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AccountController.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/account.css
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/widgets.css
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/account.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/useraccount/action/UpdateUserAccountAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml
--
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/configuration/Configuration.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/configuration/Configuration.java 2012-10-22 18:48:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/configuration/Configuration.java 2012-10-23 10:26:43 +0000
@@ -74,6 +74,11 @@
return infrastructuralPeriodType != null ? infrastructuralPeriodType : DEFAULT_INFRASTRUCTURAL_PERIODTYPE;
}
+ public boolean selfRegistrationAllowed()
+ {
+ return selfRegistrationRole != null && selfRegistrationRole instanceof UserAuthorityGroup;
+ }
+
// -------------------------------------------------------------------------
// Set and get methods
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AccountController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AccountController.java 2012-10-22 18:54:25 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AccountController.java 2012-10-23 10:26:43 +0000
@@ -95,9 +95,9 @@
HttpServletRequest request,
HttpServletResponse response )
{
- UserAuthorityGroup userRole = configurationService.getConfiguration().getSelfRegistrationRole();
+ boolean allowed = configurationService.getConfiguration().selfRegistrationAllowed();
- if ( userRole == null )
+ if ( !allowed )
{
response.setStatus( HttpServletResponse.SC_BAD_REQUEST );
return "User self registration is not allowed";
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/account.css'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/account.css 2012-10-19 18:29:23 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/account.css 2012-10-23 10:26:43 +0000
@@ -17,14 +17,14 @@
top: 0;
left: 0;
width: 100%;
- height: 93px;
+ height: 80px;
background-color: #1d5288;
}
#bannerArea
{
position: relative;
- top: 25px;
+ top: 19px;
}
#accountContainer
@@ -39,7 +39,7 @@
#accountInput
{
position: relative;
- padding-top: 80px;
+ padding-top: 65px;
}
h3
=== 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 2012-10-17 17:04:50 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/login.css 2012-10-23 10:26:43 +0000
@@ -59,6 +59,27 @@
color: #bfd9f2;
}
+#bannerArea
+{
+ margin-bottom: 35px;
+ border: none;
+}
+
+#accountArea
+{
+ position: absolute;
+ right: 10px;
+ padding: 18px 30px 18px 0;
+ font-size: 17px;
+}
+
+#accountIntro
+{
+ position: relative;
+ top: 1px;
+ padding-right: 15px
+}
+
#loginField
{
position: relative;
@@ -67,12 +88,6 @@
text-align: center;
}
-#bannerArea
-{
- margin-bottom: 35px;
- border: none;
-}
-
#loginField td
{
padding-right: 5px;
@@ -102,7 +117,28 @@
text-align: center;
}
-.button {
+.greenButtonLink
+{
+ padding: 6px 12px;
+ height: 27px;
+ border: 1px solid #67A767;
+ border-radius: 3px;
+ margin-right: 4px;
+ font-family: LiberationSansBold, arial;
+ font-size: 13px;
+ background-color: #1A9B20;
+ color: #fff !important;
+ text-decoration: none !important;
+}
+
+.greenButtonLink:hover
+{
+ text-decoration: none;
+ background-color: #1DA223;
+}
+
+.button
+{
font-family: LiberationSansBold, arial;
background: -webkit-linear-gradient(top, #f1f1f1, #d1d1d1);
background: -moz-linear-gradient(top, #f1f1f1, #d1d1d1);
@@ -114,7 +150,8 @@
color: #222;
}
-.button:hover {
+.button:hover
+{
background: -webkit-linear-gradient(top, #fafafa, #dadada);
background: -moz-linear-gradient(top, #fafafa, #dadada);
background: -ms-linear-gradient(top, #fafafa, #dadada);
=== 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-10-17 20:29:56 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css 2012-10-23 10:26:43 +0000
@@ -624,6 +624,50 @@
}
/*----------------------------------------------------------------------------*/
+/* Buttons */
+/*----------------------------------------------------------------------------*/
+
+.greyButtonLink
+{
+ padding: 6px 12px;
+ height: 25px;
+ border: 1px solid #aaa;
+ border-radius: 3px;
+ margin-right: 4px;
+ font-family: LiberationSansBold, arial;
+ font-size: 13px;
+ background-color: #f3f3f3;
+ color: #606060 !important;
+ text-decoration: none !important;
+}
+
+.greyButtonLink:hover
+{
+ text-decoration: none;
+ background-color: #f8f8f8;
+}
+
+.blueButtonLink
+{
+ padding: 6px 12px;
+ height: 25px;
+ border: 1px solid #3D77B3;
+ border-radius: 3px;
+ margin-right: 4px;
+ font-family: LiberationSansBold, arial;
+ font-size: 13px;
+ background-color: #427DB8;
+ color: #fff !important;
+ text-decoration: none !important;
+}
+
+.blueButtonLink:hover
+{
+ text-decoration: none;
+ background-color: #3674B3;
+}
+
+/*----------------------------------------------------------------------------*/
/* jQuery overrides */
/*----------------------------------------------------------------------------*/
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/account.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/account.js 2012-10-22 16:28:40 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/useraccount/account.js 2012-10-23 10:26:43 +0000
@@ -33,9 +33,7 @@
$( document ).ready( function() {
- Recaptcha.create( "6LcM6tcSAAAAANwYsFp--0SYtcnze_WdYn8XwMMk", "recaptchaDiv", {
- callback: Recaptcha.focus_response_field
- } );
+ Recaptcha.create( "6LcM6tcSAAAAANwYsFp--0SYtcnze_WdYn8XwMMk", "recaptchaDiv" );
$( "#accountForm" ).validate( {
rules: validationRules.rules,
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm 2012-10-11 11:56:28 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm 2012-10-23 10:26:43 +0000
@@ -15,11 +15,12 @@
});
});
</script>
+ <link type="text/css" rel="stylesheet" href="../css/widgets.css">
<link type="text/css" rel="stylesheet" href="../css/login.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
- <div id="headerArea">
+ <div>
#if ( $keyFlag )
<img id="flagArea" src="../flags/${keyFlagImage}">
#end
@@ -30,6 +31,11 @@
<span id="introArea">$encoder.htmlEncode( $applicationIntro )</span>
#end
</div>
+ #if ( $keyConfig.selfRegistrationAllowed() )
+ <div id="accountArea">
+ <span id="accountIntro">Do you want access?</span> <a class="greenButtonLink" href="account.action">Create an account</a>
+ </div>
+ #end
<div id="loginField">
<div id="bannerArea"><a href="http://dhis2.org"><img src="logo_front.png" style="border:none"></a></div>
=== added file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/useraccount/action/IsSelfRegistrationAllowedAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/useraccount/action/IsSelfRegistrationAllowedAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/useraccount/action/IsSelfRegistrationAllowedAction.java 2012-10-23 10:26:43 +0000
@@ -0,0 +1,52 @@
+package org.hisp.dhis.useraccount.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.configuration.ConfigurationService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class IsSelfRegistrationAllowedAction
+ implements Action
+{
+ @Autowired
+ private ConfigurationService configurationService;
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ boolean allowed = configurationService.getConfiguration().selfRegistrationAllowed();
+
+ return allowed ? SUCCESS : ERROR;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/useraccount/action/UpdateUserAccountAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/useraccount/action/UpdateUserAccountAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/useraccount/action/UpdateUserAccountAction.java 2012-10-23 10:26:43 +0000
@@ -37,8 +37,6 @@
/**
* @author Torgeir Lorange Ostby
- * @version $Id: UpdateUserAction.java 5556 2008-08-20 11:36:20Z abyot $
- * @version $Id: UpdateUserAction.java 5556 2009-11-30 11:18:30Z Chau Thu Tran $
*/
public class UpdateUserAccountAction
implements Action
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2012-10-23 08:01:42 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2012-10-23 10:26:43 +0000
@@ -586,6 +586,9 @@
<bean id="org.hisp.dhis.useraccount.action.UpdateUserProfileAction" class="org.hisp.dhis.useraccount.action.UpdateUserProfileAction"
scope="prototype"/>
+
+ <bean id="org.hisp.dhis.useraccount.action.IsSelfRegistrationAllowedAction" class="org.hisp.dhis.useraccount.action.IsSelfRegistrationAllowedAction"
+ scope="prototype"/>
<!-- User settings -->
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml 2012-10-23 07:44:55 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml 2012-10-23 10:26:43 +0000
@@ -114,8 +114,9 @@
<param name="onExceptionReturn">plainTextError</param>
</action>
- <action name="account" class="org.hisp.dhis.commons.action.NoAction">
+ <action name="account" class="org.hisp.dhis.useraccount.action.IsSelfRegistrationAllowedAction">
<result name="success" type="velocity">/dhis-web-commons/useraccount/account.vm</result>
+ <result name="error" type="redirect">login.action</result>
</action>
</package>
=== 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-18 13:35:14 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css 2012-10-23 10:26:43 +0000
@@ -84,46 +84,6 @@
float: left;
}
-.greyButtonLink
-{
- padding: 6px 12px;
- height: 25px;
- border: 1px solid #aaa;
- border-radius: 3px;
- margin-right: 4px;
- font-family: LiberationSansBold, arial;
- font-size: 13px;
- background-color: #f3f3f3;
- color: #606060 !important;
- text-decoration: none !important;
-}
-
-.greyButtonLink:hover
-{
- text-decoration: none;
- background-color: #f8f8f8;
-}
-
-.blueButtonLink
-{
- padding: 6px 12px;
- height: 25px;
- border: 1px solid #3D77B3;
- border-radius: 3px;
- margin-right: 4px;
- font-family: LiberationSansBold, arial;
- font-size: 13px;
- background-color: #427DB8;
- color: #fff !important;
- text-decoration: none !important;
-}
-
-.blueButtonLink:hover
-{
- text-decoration: none;
- background-color: #3674B3;
-}
-
#searchDiv
{
position: absolute;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2012-06-01 12:17:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2012-10-23 10:26:43 +0000
@@ -58,8 +58,7 @@
</action>
<action name="addDataElement" class="org.hisp.dhis.dd.action.dataelement.AddDataElementAction">
- <result name="success" type="redirect">dataElement.action
- </result>
+ <result name="success" type="redirect">dataElement.action</result>
<param name="requiredAuthorities">F_DATAELEMENT_ADD</param>
</action>