Author: hansbak
Date: Tue Jan 20 00:30:41 2009
New Revision: 735965
URL: http://svn.apache.org/viewvc?rev=735965&view=rev
Log:
first version of captcha, not perfect yet: multiple users registering at the same time, image should be stored in 'runtime' not
working on windows. Another problem is what files to put where.....the captcha itself looks like a framework feature...however the
registration process needs the party component....so let us know, we will correct it....
Added:
ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java (with props)
ofbiz/trunk/specialpurpose/myportal/widget/login.ftl (with props)
Modified:
ofbiz/trunk/framework/common/widget/CommonMenus.xml
ofbiz/trunk/specialpurpose/myportal/config/MyPortalUiLabels.xml
ofbiz/trunk/specialpurpose/myportal/script/org/ofbiz/myportal/Events.xml
ofbiz/trunk/specialpurpose/myportal/webapp/myportal/WEB-INF/controller.xml
ofbiz/trunk/specialpurpose/myportal/widget/CommonScreens.xml
ofbiz/trunk/specialpurpose/myportal/widget/MyPortalForms.xml
Added: ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java?rev=735965&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java (added)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java Tue Jan 20
00:30:41 2009
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+
*******************************************************************************/
+
+// copied from : http://cocoon.apache.org/2.2/blocks/captcha/1.0/1436_1_1.html
+
+package org.ofbiz.common;
+
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.awt.*;
+import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+
+public class Captcha {
+
+ public static String ID_KEY = null;
+
+ public static String getCodeCaptcha(HttpServletRequest
request,HttpServletResponse response) {
+ StringBuffer finalString = new StringBuffer();
+ String elegibleChars =
"ABCDEFGHJKLMPQRSTUVWXYabcdefhjkmnpqrstuvwxy23456789";
+ int charsToPrint = 6;
+ char[] chars = elegibleChars.toCharArray();
+
+ for (int i = 0; i < charsToPrint; i++) {
+ double randomValue = Math.random();
+ int randomIndex = (int) Math.round(randomValue * (chars.length -
1));
+ char characterToShow = chars[randomIndex];
+ finalString.append(characterToShow);
+ }
+ ID_KEY = finalString.toString();
+ if(createImageCaptcha (request,response)) return "success";
+ return "error";
+ }
+
+ public static boolean createImageCaptcha (HttpServletRequest
request,HttpServletResponse response) {
+ try {
+ //It is possible to pass the font size, image width and height
with the request as well
+ Color backgroundColor = Color.gray;
+ Color borderColor = Color.DARK_GRAY;
+ Color textColor = Color.ORANGE;
+ Color circleColor = new Color(160, 160, 160);
+ Font textFont = new Font("Arial", Font.PLAIN, paramInt(request,
"fontSize", 22));
+ int charsToPrint = 6;
+ int width = paramInt(request, "width", 149);
+ int height = paramInt(request, "height", 40);
+ int circlesToDraw = 6;
+ float horizMargin = 20.0f;
+ double rotationRange = 0.7; // in radians
+ BufferedImage bufferedImage = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
+
+ Graphics2D g = (Graphics2D) bufferedImage.getGraphics();
+
+ g.setColor(backgroundColor);
+ g.fillRect(0, 0, width, height);
+
+ //Generating some circles for background noise
+ g.setColor(circleColor);
+ for (int i = 0; i < circlesToDraw; i++) {
+ int circleRadius = (int) (Math.random() * height / 2.0);
+ int circleX = (int) (Math.random() * width - circleRadius);
+ int circleY = (int) (Math.random() * height - circleRadius);
+ g.drawOval(circleX, circleY, circleRadius * 2, circleRadius *
2);
+ }
+ g.setColor(textColor);
+ g.setFont(textFont);
+
+ FontMetrics fontMetrics = g.getFontMetrics();
+ int maxAdvance = fontMetrics.getMaxAdvance();
+ int fontHeight = fontMetrics.getHeight();
+
+ //We are not using certain characters, which might confuse users
+ String characterToShow = ID_KEY;
+ float spaceForLetters = -horizMargin * 2 + width;
+ float spacePerChar = spaceForLetters / (charsToPrint - 1.0f);
+
+ for (int i = 0; i < characterToShow.length(); i++) {
+
+ // this is a separate canvas used for the character so that
+ // we can rotate it independently
+ int charWidth =
fontMetrics.charWidth(characterToShow.charAt(i));
+ int charDim = Math.max(maxAdvance, fontHeight);
+ int halfCharDim = (int) (charDim / 2);
+
+ BufferedImage charImage =
+ new BufferedImage(charDim, charDim,
BufferedImage.TYPE_INT_ARGB);
+ Graphics2D charGraphics = charImage.createGraphics();
+ charGraphics.translate(halfCharDim, halfCharDim);
+ double angle = (Math.random() - 0.5) * rotationRange;
+
charGraphics.transform(AffineTransform.getRotateInstance(angle));
+ charGraphics.translate(-halfCharDim, -halfCharDim);
+ charGraphics.setColor(textColor);
+ charGraphics.setFont(textFont);
+
+ int charX = (int) (0.5 * charDim - 0.5 * charWidth);
+ charGraphics.drawString("" + characterToShow.charAt(i), charX,
+ (int) ((charDim - fontMetrics.getAscent()) / 2 +
fontMetrics.getAscent()));
+
+ float x = horizMargin + spacePerChar * (i) - charDim / 2.0f;
+ int y = (int) ((height - charDim) / 2);
+
+ g.drawImage(charImage, (int) x, y, charDim, charDim, null,
null);
+
+ charGraphics.dispose();
+ }
+ // Drawing the image border
+ g.setColor(borderColor);
+ g.drawRect(0, 0, width - 1, height - 1);
+ g.dispose();
+ Captcha.writeImage(bufferedImage, "captchaImage.png");
+
+ } catch (Exception ioe) {
+ return false;
+ }
+ //Adding this because we called response.getOutputStream() above. This
will prevent and illegal state exception being thrown
+ return true;
+ }
+
+ public static void writeImage(BufferedImage image, String fileName)
+ {
+ if (fileName == null) return;
+ int offset = fileName.lastIndexOf( "." );
+ String type = offset == -1 ? "png" : fileName.substring(offset + 1);
+ String path;
+ try {
+ path = new java.io.File(".").getCanonicalPath();
+ path += "/framework/images/webapp/images/";
+ path += fileName;
+ System.out.println("\n\nPath = "+path+"\n");
+ System.out.println("Captcha Key = "+ID_KEY+"\n\n");
+ ImageIO.write(image, type, new File( path ));
+ } catch (IOException e) {
+ return;
+ }
+ }
+
+ public static String paramString(HttpServletRequest request, String
paramName,
+ String defaultString) {
+ return request.getParameter(paramName) != null ?
request.getParameter(paramName) : defaultString;
+ }
+
+ public static int paramInt(HttpServletRequest request, String paramName,
int defaultInt) {
+ return request.getParameter(paramName) != null ?
Integer.parseInt(request.getParameter(paramName)) : defaultInt;
+ }
+}
\ No newline at end of file
Propchange: ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/framework/common/src/org/ofbiz/common/Captcha.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: ofbiz/trunk/framework/common/widget/CommonMenus.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/CommonMenus.xml?rev=735965&r1=735964&r2=735965&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/CommonMenus.xml (original)
+++ ofbiz/trunk/framework/common/widget/CommonMenus.xml Tue Jan 20 00:30:41 2009
@@ -31,7 +31,7 @@
</menu-item>
<menu-item name="Login" title="${uiLabelMap.CommonLogin}"
align-style="opposed">
<condition><if-empty field-name="userLogin"/></condition>
- <link target="${checkLoginUrl}"/>
+ <link target="logout"/>
</menu-item>
</menu>
Modified: ofbiz/trunk/specialpurpose/myportal/config/MyPortalUiLabels.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/config/MyPortalUiLabels.xml?rev=735965&r1=735964&r2=735965&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/config/MyPortalUiLabels.xml (original)
+++ ofbiz/trunk/specialpurpose/myportal/config/MyPortalUiLabels.xml Tue Jan 20
00:30:41 2009
@@ -18,6 +18,18 @@
under the License.
-->
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <property key="CaptchaMissingError">
+ <value xml:lang="en">Verify code captcha is missing or wrong</value>
+ <value
xml:lang="th">รหัสà¸à¸±à¸§à¹à¸¥à¸à¸à¸µà¹à¸à¹à¸²à¸à¸à¸£à¸à¸à¸¡à¸µà¸à¹à¸à¸à¸´à¸à¸à¸¥à¸²à¸</value>
+ </property>
+ <property key="FirstName_Missing">
+ <value xml:lang="en">Your firstName is missing</value>
+ <value
xml:lang="th">à¸à¸£à¸¸à¸à¸²à¸à¸£à¸à¸à¸à¸·à¹à¸à¸à¸à¸à¸à¹à¸²à¸</value>
+ </property>
+ <property key="LastName_Missing">
+ <value xml:lang="en">Your lastname is missing</value>
+ <value
xml:lang="th">à¸à¸£à¸¸à¸à¸²à¸à¸£à¸à¸à¸à¸²à¸¡à¸ªà¸à¸¸à¸¥à¸à¸à¸à¸à¹à¸²à¸</value>
+ </property>
<property key="MyPortalDashboard">
<value xml:lang="en">My Portal</value>
<value xml:lang="fr">Mon portail</value>
@@ -30,6 +42,10 @@
<value xml:lang="it">Invia email ad ogni cliente per le modifiche sulla
richiesta</value>
<value
xml:lang="th">สà¹à¸à¸à¸µà¹à¸¡à¸¥à¹à¸à¸¶à¸à¸¥à¸¹à¸à¸à¹à¸²à¸à¸µà¹à¹à¸à¸¥à¸µà¹à¸¢à¸à¸à¸§à¸²à¸¡à¸à¹à¸à¸à¸à¸²à¸£</value>
</property>
+ <property key="NewRegistration">
+ <value xml:lang="en">New Registration </value>
+ <value xml:lang="th">ลà¸à¸à¸°à¹à¸à¸µà¸¢à¸ </value>
+ </property>
<property key="PageTitleMyPortal">
<value xml:lang="en">My Portal for : </value>
<value xml:lang="it">Mio portale per : </value>
@@ -41,4 +57,24 @@
<value xml:lang="it">Pagina mio portale</value>
<value
xml:lang="th">หà¸à¹à¸²à¸ªà¹à¸§à¸à¸à¸±à¸§à¸à¸à¸à¸à¸±à¸</value>
</property>
+ <property key="PicCaptcha">
+ <value xml:lang="en">Code Captcha</value>
+ <value xml:lang="th">รหัสà¸à¸£à¸§à¸à¸ªà¸à¸</value>
+ </property>
+ <property key="RegisterComplete">
+ <value xml:lang="en">Register of new person is complete...Please
</value>
+ <value
xml:lang="th">à¸à¸²à¸£à¸¥à¸à¸à¸°à¹à¸à¸µà¸¢à¸à¹à¸«à¸¡à¹à¸ªà¸³à¸«à¸£à¸±à¸à¸à¸¸à¸à¸à¸¥à¹à¸à¹à¸à¸³à¸à¸²à¸£à¹à¸ªà¸£à¹à¸à¸ªà¸´à¹à¸à¸ªà¸¡à¸à¸¹à¸£à¸à¹à¹à¸¥à¹à¸§...สามารà¸à¹à¸à¹à¸²à¸ªà¸¹à¹à¸£à¸°à¸à¸à¹à¸à¹
</value>
+ </property>
+ <property key="RegisterForCustomer">
+ <value xml:lang="en">Register for customer</value>
+ <value
xml:lang="th">ลà¸à¸à¸°à¹à¸à¸µà¸¢à¸à¸ªà¸³à¸«à¸£à¸±à¸à¸¥à¸¹à¸à¸à¹à¸²</value>
+ </property>
+ <property key="VerifyCaptcha">
+ <value xml:lang="en">Verify captcha code</value>
+ <value xml:lang="th">à¹à¸ªà¹à¸£à¸«à¸±à¸ªà¸à¸²à¸¡à¸£à¸¹à¸</value>
+ </property>
+ <property key="UserLogin">
+ <value xml:lang="en">User Login</value>
+ <value
xml:lang="th">à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸²à¸£à¸¥à¸à¸à¸°à¹à¸à¸µà¸¢à¸</value>
+ </property>
</resource>
Modified:
ofbiz/trunk/specialpurpose/myportal/script/org/ofbiz/myportal/Events.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/script/org/ofbiz/myportal/Events.xml?rev=735965&r1=735964&r2=735965&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/script/org/ofbiz/myportal/Events.xml
(original)
+++ ofbiz/trunk/specialpurpose/myportal/script/org/ofbiz/myportal/Events.xml
Tue Jan 20 00:30:41 2009
@@ -312,4 +312,87 @@
request-name="communicationEventTypeId"/>
<field-to-request field="communicationEventId"
request-name="communicationEventId"/>
</simple-method>
+
+ <simple-method method-name="createRegister"
+ short-description="Create person when new register"
login-required="false">
+ <if-empty field="parameters.firstName"><property-to-field field="errorMessage" resource="MyPortalUiLabels"
property="FirstName_Missing"/><field-to-list field="errorMessage" list="error_list"/></if-empty>
+ <if-empty field="parameters.lastName"><property-to-field field="errorMessage" resource="MyPortalUiLabels"
property="LastName_Missing"/><field-to-list field="errorMessage" list="error_list"/></if-empty>
+ <if-empty field="parameters.USERNAME"><property-to-field field="errorMessage" resource="PartyUiLabels"
property="PartyUserNameMissing"/><field-to-list field="errorMessage" list="error_list"/></if-empty>
+ <if-empty field="parameters.PASSWORD"><property-to-field field="errorMessage" resource="PartyUiLabels"
property="PartyPasswordMissing"/><field-to-list field="errorMessage" list="error_list"/></if-empty>
+ <call-bsh><![CDATA[
+ parameters.put("captchaCode",org.ofbiz.common.Captcha.ID_KEY);
+ ]]></call-bsh>
+ <call-object-method obj-field="PASSWORD" obj-map-name="parameters" method-name="toLowerCase" ret-field="PASSWORD"
ret-map-name="parameters"/>
+ <call-object-method obj-field="CONFIRM_PASSWORD" obj-map-name="parameters" method-name="toLowerCase"
ret-field="CONFIRM_PASSWORD" ret-map-name="parameters"/>
+ <if-compare field="parameters.PASSWORD" value="${parameters.CONFIRM_PASSWORD}"
operator="equals">
+ <call-object-method obj-field="captcha" obj-map-name="parameters" method-name="toLowerCase" ret-field="captcha"
ret-map-name="parameters"/>
+ <call-object-method obj-field="captchaCode" obj-map-name="parameters" method-name="toLowerCase"
ret-field="captchaCode" ret-map-name="parameters"/>
+ <if-compare field="parameters.captcha" value="${parameters.captchaCode}"
operator="equals">
+
+ <!-- Create Person -->
+ <set field="parameters.statusId" value="PARTY_ENABLED"/>
+ <make-value entity-name="Party" value-field="newEntity"/>
+ <set-pk-fields map="parameters" value-field="newEntity"/>
+ <make-next-seq-id value-field="newEntity"
seq-field-name="partyId"/>
+ <set field="newEntity.partyTypeId" value="PERSON"/>
+ <set-nonpk-fields map="parameters" value-field="newEntity"/>
+ <create-value value-field="newEntity"/>
+
+ <make-value entity-name="PartyStatus"
value-field="newEntity2"/>
+ <set field="newEntity2.partyId"
from-field="newEntity.partyId"/>
+ <set field="newEntity2.statusId"
from-field="newEntity.statusId"/>
+ <set field="newEntity2.statusDate"
from-field="newEntity.createdStamp"/>
+ <create-value value-field="newEntity2"/>
+
+ <make-value entity-name="Person" value-field="newEntity3"/>
+ <set field="newEntity3.partyId"
from-field="newEntity.partyId"/>
+ <set-nonpk-fields map="parameters" value-field="newEntity3"/>
+ <create-value value-field="newEntity3"/>
+
+ <!-- Create the UserLogin Record -->
+ <call-map-processor in-map-name="parameters"
out-map-name="userLoginContext">
+ <simple-map-processor name="newUserLogin">
+ <process field="USERNAME"><copy
to-field="userLoginId"/></process>
+ <process field="PASSWORD"><copy
to-field="currentPassword"/></process>
+ <process field="CONFIRM_PASSWORD"><copy
to-field="currentPasswordVerify"/></process>
+ <process field="PASSWORD_HINT"><copy
to-field="passwordHint"/></process>
+ </simple-map-processor>
+ </call-map-processor>
+ <set field="userLoginExistsMap.userLoginId"
from-field="userLoginContext.userLoginId" />
+ <find-by-primary-key entity-name="UserLogin" map="userLoginExistsMap"
value-field="existingUserLogin"/>
+ <if-not-empty field="existingUserLogin">
+ <set field="errorMessage" value="Username in use, please choose
another." />
+ <field-to-list field="errorMessage" list="error_list"/>
+ <check-errors error-list-name="error_list"
error-code="resultPage"/>
+ <else>
+ <make-value entity-name="UserLogin"
value-field="newUserLogin"/>
+ <set field="newUserLogin.userLoginId"
from-field="userLoginContext.userLoginId"/>
+ <set field="newUserLogin.currentPassword"
from-field="userLoginContext.currentPassword" />
+ <set field="newUserLogin.passwordHint"
from-field="userLoginContext.passwordHint" />
+ <!-- Check the password, etc for validity -->
+ <call-bsh><![CDATA[
+ String password = (String)
userLoginContext.get("currentPassword");
+ String confirmPassword = (String)
userLoginContext.get("currentPasswordVerify");
+ String passwordHint = (String)
userLoginContext.get("passwordHint");
+ org.ofbiz.common.login.LoginServices.checkNewPassword(newUserLogin, null, password, confirmPassword,
passwordHint, error_list, true, locale);
+ boolean useEncryption = "true".equals(org.ofbiz.base.util.UtilProperties.getPropertyValue("security",
"password.encrypt"));
+ if (useEncryption) { newUserLogin.set("currentPassword",
org.ofbiz.base.crypto.HashCrypt.getDigestHash((String) newUserLogin.get("currentPassword"))); }
+ ]]></call-bsh>
+ <set field="newUserLogin.partyId"
from-field="newEntity.partyId" />
+ <create-value value-field="newUserLogin"/>
+ </else>
+ </if-not-empty>
+ <set field="partyId" from-field="newEntity.partyId"/>
+ <field-to-request field="partyId" request-name="partyId"/>
+ <return response-code="resultPage"/>
+ <else>
+ <property-to-field field="errorMessage" resource="MyPortalUiLabels"
property="CaptchaMissingError"/><field-to-list field="errorMessage" list="error_list"/>
+ </else>
+ </if-compare>
+ <else>
+ <property-to-field field="errorMessage" resource="PartyUiLabels"
property="PartyPasswordMatchError"/><field-to-list field="errorMessage" list="error_list"/>
+ </else>
+ </if-compare>
+ <check-errors error-list-name="error_list" error-code="resultPage"/>
+ </simple-method>
</simple-methods>
Modified:
ofbiz/trunk/specialpurpose/myportal/webapp/myportal/WEB-INF/controller.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/webapp/myportal/WEB-INF/controller.xml?rev=735965&r1=735964&r2=735965&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/webapp/myportal/WEB-INF/controller.xml
(original)
+++ ofbiz/trunk/specialpurpose/myportal/webapp/myportal/WEB-INF/controller.xml
Tue Jan 20 00:30:41 2009
@@ -31,6 +31,23 @@
<security https="true" auth="true"/>
<response name="success" type="view" value="main"/>
</request-map>
+ <request-map uri="login">
+ <security https="true" auth="false"/>
+ <event type="java" path="org.ofbiz.securityext.login.LoginEvents"
invoke="storeLogin"/>
+ <response name="success" type="view" value="main"/>
+ <response name="requirePasswordChange" type="view"
value="requirePasswordChange"/>
+ <response name="error" type="view" value="login"/>
+ </request-map>
+ <request-map uri="newRegisterLogin">
+ <security https="true" auth="false"/>
+ <event type="java" invoke="getCodeCaptcha"
path="org.ofbiz.common.Captcha"/>
+ <response name="success" type="view" value="newRegisterLogin"/>
+ </request-map>
+ <request-map uri="createRegister">
+ <security https="true" auth="false"/>
+ <event type="simple" invoke="createRegister"
path="org/ofbiz/myportal/Events.xml"/>
+ <response name="resultPage" type="url" value="newRegisterLogin"/>
+ </request-map>
<!-- TIMESHEET -->
<request-map uri="myTimesheet">
@@ -270,6 +287,8 @@
</request-map>
<view-map name="main" type="screen"
page="component://myportal/widget/CommonScreens.xml#main"/>
+ <view-map name="login" type="screen"
page="component://myportal/widget/CommonScreens.xml#login"/>
+ <view-map name="newRegisterLogin" type="screen"
page="component://myportal/widget/CommonScreens.xml#newRegisterLogin"/>
<view-map name="myTasks" type="screen"
page="component://myportal/widget/CommonScreens.xml#MyTasks"/>
<view-map name="myCommunications" type="screen"
page="component://myportal/widget/CommonScreens.xml#MyCommunications"/>
<view-map name="otherCommunications" type="screen"
page="component://myportal/widget/CommonScreens.xml#OtherCommunications"/>
Modified: ofbiz/trunk/specialpurpose/myportal/widget/CommonScreens.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/widget/CommonScreens.xml?rev=735965&r1=735964&r2=735965&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/myportal/widget/CommonScreens.xml Tue Jan 20
00:30:41 2009
@@ -164,6 +164,66 @@
</widgets>
</section>
</screen>
+
+ <screen name="login">
+ <section>
+ <widgets>
+ <decorator-screen name="main-decorator"
location="${parameters.mainDecoratorLocation}">
+ <decorator-section name="body">
+ <platform-specific>
+ <html><html-template
location="component://myportal/widget/login.ftl"/></html>
+ </platform-specific>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
+
+ <!--New Register Person-->
+ <screen name="newRegisterLogin">
+ <section>
+ <actions>
+ <set field="partyId" from-field="parameters.partyId"/>
+ <entity-one entity-name="PartyAndPerson"
value-name="personInfo"/>
+ </actions>
+ <widgets>
+ <decorator-screen name="main-decorator"
location="${parameters.mainDecoratorLocation}">
+ <decorator-section name="body">
+ <section>
+ <condition>
+ <not><if-empty
field-name="parameters.partyId"/></not>
+ </condition>
+ <actions>
+ <set field="partyId"
from-field="parameters.partyId"/>
+ <script
location="component://party/webapp/partymgr/WEB-INF/actions/party/ViewProfile.groovy"/>
+ </actions>
+ <widgets>
+ <label style="h2" text="${uiLabelMap.RegisterComplete}"/><link target="main" style="h2"
text="${uiLabelMap.CommonBeLogged}"></link>
+ <label style="h2" text="<br><br>"/>
+ <include-screen name="Party"
location="component://party/widget/partymgr/ProfileScreens.xml"/>
+ </widgets>
+ <fail-widgets>
+ <container style="screenlet">
+ <container style="screenlet-title-bar">
+ <container style="h3">
+ <label
text="${uiLabelMap.NewRegistration}"/>
+ </container>
+ </container>
+ <container style="screenlet-body">
+ <section>
+ <widgets>
+ <include-form name="RegisterPerson"
location="component://myportal/widget/MyPortalForms.xml"/>
+ </widgets>
+ </section>
+ </container>
+ </container>
+ </fail-widgets>
+ </section>
+ </decorator-section>
+ </decorator-screen>
+ </widgets>
+ </section>
+ </screen>
<screen name="CommonRequestDecorator">
<section>
Modified: ofbiz/trunk/specialpurpose/myportal/widget/MyPortalForms.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/widget/MyPortalForms.xml?rev=735965&r1=735964&r2=735965&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/widget/MyPortalForms.xml (original)
+++ ofbiz/trunk/specialpurpose/myportal/widget/MyPortalForms.xml Tue Jan 20
00:30:41 2009
@@ -276,4 +276,75 @@
<field name="task"><display description="${workEffortName}"/></field>
</form>
+ <!--New Register Person-->
+ <form name="RegisterPerson" type="single" target="createRegister"
default-map-name="personInfo"
+ focus-field-name="salutation" header-row-style="header-row"
default-table-style="basic-table">
+ <auto-fields-service service-name="updatePerson"/>
+ <field use-when="personInfo!=null" name="partyId" title="${uiLabelMap.PartyPartyId}"
tooltip="${uiLabelMap.CommonNotModifRecreat}"><display/></field>
+ <field use-when="personInfo==null&&partyId==null" name="partyId"
title="${uiLabelMap.PartyPartyId}"><ignored/></field>
+ <field use-when="personInfo==null&&partyId!=null" name="partyId" title="${uiLabelMap.PartyPartyId}"
tooltip="${uiLabelMap.CommonCannotBeFound}: [${partyId}]"><display also-hidden="false"/></field>
+ <field name="firstName" title="${uiLabelMap.PartyFirstName}" tooltip="${uiLabelMap.CommonRequired}"
widget-style="required"><text size="40" maxlength="60"/></field>
+ <field name="lastName" title="${uiLabelMap.PartyLastName}" tooltip="${uiLabelMap.CommonRequired}"
widget-style="required"><text size="40" maxlength="60"/></field>
+ <field name="gender">
+ <drop-down allow-empty="true">
+ <option key="M" description="${uiLabelMap.CommonMale}"/>
+ <option key="F" description="${uiLabelMap.CommonFemale}"/>
+ </drop-down>
+ </field>
+ <field name="maritalStatus">
+ <drop-down allow-empty="true">
+ <option key="S"
description="${uiLabelMap.PartyMaritalStatusSingle}"/>
+ <option key="M"
description="${uiLabelMap.PartyMaritalStatusMarried}"/>
+ <option key="P"
description="${uiLabelMap.PartyMaritalStatusSeparated}"/>
+ <option key="D"
description="${uiLabelMap.PartyMaritalStatusDivorced}"/>
+ <option key="W"
description="${uiLabelMap.PartyMaritalStatusWidowed}"/>
+ </drop-down>
+ </field>
+ <field name="employmentStatusEnumId">
+ <drop-down allow-empty="true">
+ <entity-options entity-name="Enumeration" key-field-name="enumId"
description="${description} [${enumCode}]">
+ <entity-constraint name="enumTypeId" value="EMPLOY_STTS"/>
+ <entity-order-by field-name="sequenceId"/>
+ </entity-options>
+ </drop-down>
+ </field>
+ <field name="residenceStatusEnumId">
+ <drop-down allow-empty="true">
+ <entity-options entity-name="Enumeration" key-field-name="enumId"
description="${description} [${enumCode}]">
+ <entity-constraint name="enumTypeId"
value="PTY_RESID_STTS"/>
+ <entity-order-by field-name="sequenceId"/>
+ </entity-options>
+ </drop-down>
+ </field>
+ <field name="existingCustomer">
+ <drop-down allow-empty="true"><option key="Y" description="${uiLabelMap.CommonY}"/><option key="N"
description="${uiLabelMap.CommonN}"/></drop-down>
+ </field>
+ <field name="preferredCurrencyUomId">
+ <drop-down allow-empty="true">
+ <entity-options key-field-name="uomId" description="${abbreviation} -
${description}" entity-name="Uom">
+ <entity-constraint name="uomTypeId" operator="equals"
value="CURRENCY_MEASURE"/>
+ <entity-order-by field-name="abbreviation"/>
+ </entity-options>
+ </drop-down>
+ </field>
+ <field name="statusId" use-when="person==null"><hidden/></field>
+ <field name="statusId" use-when="person!=null">
+ <drop-down allow-empty="false">
+ <entity-options description="${description}"
entity-name="StatusItem">
+ <entity-constraint name="statusTypeId"
value="PARTY_STATUS"/>
+ <entity-order-by field-name="sequenceId"/>
+ </entity-options>
+ </drop-down>
+ </field>
+ <field name="UserLogin" title="${uiLabelMap.UserLogin}" title-area-style="group-label"><display description=" "
also-hidden="false"/></field>
+ <field name="USERNAME" title="${uiLabelMap.CommonUsername}" tooltip="${uiLabelMap.CommonRequired}"
widget-style="required"><text size="30" maxlength="250"/></field>
+ <field name="PASSWORD" title="${uiLabelMap.CommonPassword}" tooltip="${uiLabelMap.CommonRequired}"
widget-style="required"><password size="15" maxlength="250"/></field>
+ <field name="CONFIRM_PASSWORD" title="${uiLabelMap.CommonPassword}" tooltip="* ${uiLabelMap.CommonConfirm}"
widget-style="required"><password size="15" maxlength="250"/></field>
+ <field name="VerifyCaptchaTitle" title="${uiLabelMap.VerifyCaptcha}" title-area-style="group-label"><display
description=" " also-hidden="false"/></field>
+ <field name="picOfcaptcha" title="${uiLabelMap.PicCaptcha}"><image
value="/images/captchaImage.png"></image></field>
+ <field name="reload" title=" "><image value="/images/feed-icon-14x14.png"><sub-hyperlink target="newRegisterLogin"
description="reload image"/></image></field>
+ <field name="captcha" title="${uiLabelMap.VerifyCaptcha}" tooltip="${uiLabelMap.CommonRequired}"
widget-style="required"><text size="23" maxlength="30"/></field>
+ <field name="submitButton" title="${uiLabelMap.CommonSave}" title-area-style="group-label"><submit
button-type="button"/></field>
+ </form>
+
</forms>
Added: ofbiz/trunk/specialpurpose/myportal/widget/login.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/widget/login.ftl?rev=735965&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/widget/login.ftl (added)
+++ ofbiz/trunk/specialpurpose/myportal/widget/login.ftl Tue Jan 20 00:30:41
2009
@@ -0,0 +1,73 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<#if requestAttributes.uiLabelMap?exists><#assign uiLabelMap =
requestAttributes.uiLabelMap></#if>
+
+<#assign previousParams = sessionAttributes._PREVIOUS_PARAMS_?if_exists>
+<#if previousParams?has_content>
+ <#assign previousParams = "?" + previousParams>
+</#if>
+
+<#assign username =
requestParameters.USERNAME?default((sessionAttributes.autoUserLogin.userLoginId)?default(""))>
+<#if username != "">
+ <#assign focusName = false>
+<#else>
+ <#assign focusName = true>
+</#if>
+
+<center>
+ <div class="screenlet login-screenlet" style="width: 22%; margin-left: 5px;
text-align: center;">
+ <div class="screenlet-title-bar">
+ <h3>${uiLabelMap.CommonRegistered}</h3>
+ </div>
+ <div class="screenlet-body">
+ <form method="post" action="<@ofbizUrl>login${previousParams?if_exists}</@ofbizUrl>"
name="loginform">
+ <table class="basic-table" cellspacing="0">
+ <tr>
+ <td class="label" style="width:
31%;">${uiLabelMap.CommonUsername}</td>
+ <td><input type="text" name="USERNAME" value="${username}"
size="20"/></td>
+ </tr>
+ <tr>
+ <td class="label">${uiLabelMap.CommonPassword}</td>
+ <td><input type="password" name="PASSWORD" value=""
size="20"/></td>
+ </tr>
+ <tr>
+ <td colspan="2" align="center">
+ <input type="submit" value="${uiLabelMap.CommonLogin}"/>
+ </td>
+ </tr>
+ </table>
+ <input type="hidden" name="JavaScriptEnabled" value="N"/>
+ <br/>
+ <a
href="<@ofbizUrl>forgotPassword${previousParams?if_exists}</@ofbizUrl>">${uiLabelMap.CommonForgotYourPassword}?</a>
+ <br/>
+ <a
href="<@ofbizUrl>newRegisterLogin${previousParams?if_exists}</@ofbizUrl>">${uiLabelMap.NewRegistration}</a>
+ </form>
+ </div>
+ </div>
+</center>
+
+<script language="JavaScript" type="text/javascript">
+ document.loginform.JavaScriptEnabled.value = "Y";
+ <#if focusName>
+ document.loginform.USERNAME.focus();
+ <#else>
+ document.loginform.PASSWORD.focus();
+ </#if>
+</script>
\ No newline at end of file
Propchange: ofbiz/trunk/specialpurpose/myportal/widget/login.ftl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/specialpurpose/myportal/widget/login.ftl
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/specialpurpose/myportal/widget/login.ftl
------------------------------------------------------------------------------
svn:mime-type = text/plain