AgileApps Support Wiki Pre Release

Action Tags

From AgileApps Support Wiki

These tags directly map to various platform actions specified in the Actions section. These action tags render an HTML form element.

Common Attributes for Action Tags

All the action tags have some common attributes.

Common Attributes for Action Tags
Attribute Type Description
onError String Complete or partial relative URL to execute on error of the operation
onSuccess String Complete or partial relative URL to execute on success of the operation
method String maps to the HTML form element's method attribute
name String Name of the HTML form element which is rendered as a result of this tag
preController String Name of the class whose method is executed before the controller is executed
preControllerMethod String Method of the class identified by preController, that is executed before the controller is executed. Useful in validations or some pre actions when controller is Platform.
prefill Boolean Specifies whether the values should be prefilled for the form elements within this form. Prefill logic first looks at the HttpServletRequest.getParameter("form element"), if the value is present it will render it from there, otherwise it will take it from the value attribute of the form element. This is specifically used for error handling.

Login and Registration Tags

Login tags and Registration tags have slightly different behavior:

  • Registration tags - Allow the site user to register and login using a remote ID, like Facebook. When site users are already registered, they are automatically logged in. With this option, anyone can become a site user, and the only information available to the Site are the details captured in the remote registration process (at Facebook, for example).
  • Login Tags - Allow the user to login using a remote ID, but require them to have registered with the site to do so. You can use that registration process to a) capture additional information from the user and/or, b) restrict access in some way (for example, to restrict access to an otherwise-public company payroll site).

Typically, you will choose to use either registration tags or login tags. But whichever style you choose, you will typically provide site users with multiple options so they can choose how they want to log in.

Notepad.png

Note:
For Login tags to work, the user ID at the site must be identical to the remote user ID. One way to do that is simply to require the user to enter their ID, and trust that it will match. (Typically, it will, since a user's email address is the most common form of ID. Another, more "bulletproof" mechanism is to check to see if users are registered when they login. If they aren't, send them to the registration page with the user ID pre-filled. That mechanism is more complex, but doesn't depend on users' typing ability or memory.

Action Tag Description Syntax
Facebook Registration Tag Let a site user register and login using their Facebook ID <lj:facebookregister onError="pages/home.jsp" onSuccess="pages/ticketList.jsp?fieldList=..." />
Facebook Login Tag Let a site user login using their Facebook ID, but require site registration <lj:facebooklogin onError="pages/home.jsp" onSuccess="pages/ticketList.jsp?fieldList=..." />
Login Tag Renders an HTML form element whose action attribute is assigned to the Login action <lj:login name="loginForm" onError="pages/login.jsp" onSuccess="pages/home.jsp" method="POST" id="loginForm">
Logout Tag Renders a URL which points to the Logout action <a href="<lj:logout />">Logout</a>
Register Tag Renders an HTML form element whose action attribute is assigned to the Register User action <lj:register name="" onError="pages/register.jsp" onSuccess="pages/home.jsp" prefill="true" method="POST">
Note for Self-Hosted Installations of the Platform
In a self hosted installation of the Platform, additional setup is required to support registration and authentication using Facebook. The Administrator needs to set up a Facebook Application and configure details about the application in the platform.
To set up a Facebook Application:
  1. Go to https://developers.facebook.com and create a new Application.
  2. Modify the Application to set the App Domain to point to your domain.
  3. Specify the Site URL in "Website with Facebook Login", so it points to your Domain URL
  4. Note the App ID and the App Secret
To configure the platform:
Update the Facebook App ID and the App Secret in the Platform using SQL:
UPDATE relationals.NETWORK_GLOBAL_PROPERTIES
SET facebook_app_id = 'facebook App ID' , facebook_app_secret='App Secret';
Facebook Registration Tag

Generates a button that allows a site user to register and login using their Facebook ID. Users who are already registered with the Site are simply logged in.

Example
<%@taglib prefix="lj" uri="/LJTagLib"%>

<a href="<lj:facebookregister onError="pages/home.jsp"  
   onSuccess="pages/ticketList.jsp?fieldList=number,type,subject&sortBy=number&sortOrder=desc&page=0&pageSize=25" />" 
> Login using Facebook</a>
Facebook Login Tag

Generates a button that allows a site user to login using their Facebook ID, but only if they are a registered site user.

Requirement
  • The Site user's username must be the same as their Facebook Email address.
Example
<%@taglib prefix="lj" uri="/LJTagLib"%>

<a href="<lj:facebooklogin onError="pages/home.jsp" 
  onSuccess="pages/ticketList.jsp?fieldList=number,type,subject&sortBy=number&sortOrder=desc&page=0&pageSize=25" />" 
> Login using Facebook</a>
Login Tag

Renders an HTML form element whose action attribute is assigned to "login" action.

User is expected to supply all the form elements that are expected for this action. Refer to login action.

Example
<syntaxhighlight lang="java" enclose="div">

<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:login name="loginForm" onError="pages/login.jsp" onSuccess="pages/home.jsp" method="POST" id="loginForm">

<td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message}
Username <lj:text name="login" id="login" />
Password <lj:password name="password" id="password" />
<lj:button submit="true" name="submit" id="submit" value="Submit" /> <input type="button" name="cancel" value="Cancel" onClick="window.location='<lj:url resource="pages/home.jsp" />';" />
<a href="<lj:url resource="pages/forgot.jsp" />"> Forgot Your Password</a>

</lj:login> </syntaxhighlight>

Logout Tag

Renders a URL which points to the logout action.

User is expected to supply all the form elements that are expected for this action. Refer to logout action.

Example
<syntaxhighlight lang="java" enclose="div">

<%@taglib prefix="lj" uri="/LJTagLib"%> <a href="<lj:logout />">Logout</a> </syntaxhighlight>

Register Tag

Renders an HTML form element whose action attribute is assigned to "register" action.

User is expected to supply all the form elements that are expected for this action. Refer to register action.

Example
<syntaxhighlight lang="java" enclose="div">

<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:register name="" onError="pages/register.jsp" onSuccess="pages/home.jsp" prefill="true" method="POST">

<td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message}
First Name <lj:text name="first_name" value="${first_name}"/>
Last Name <lj:text name="last_name" value="${last_name}"/>
Email <lj:text name="email" value="${email}"/>
User Name <lj:text name="username" value="${username}"/>
Password <lj:password name="password"/>
Confirm Password <lj:password name="password2"/>
Security Question <lj:text name="custom_security_question" value="${custom_security_question}"/>
Security Answer <lj:text name="security_answer" value="${security_answer}"/>
<lj:button submit="true" name="submit" value="Register"/> <input type="submit" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/home.jsp"/>'; return false;"/>

</lj:register> </syntaxhighlight>

Other Action Tags

Action Tag Description Syntax
Change Password Tag Renders an HTML form element whose action attribute is assigned to Change Password action <lj:changePassword name="" onError="pages/changePassword.jsp" onSuccess="pages/home.jsp">
Reset Password Tag Renders an HTML form element whose action attribute is assigned to Reset Password action <lj:resetPassword name="" onError="pages/resetPassword.jsp" onSuccess="pages/home.jsp">
Update Profile Tag Renders an HTML form element whose action attribute is assigned to Update Profile action <lj:updateProfile name="" onError="pages/updateProfile.jsp" onSuccess="pages/home.jsp" prefill="true">
Validate Security Question Tag Renders an HTML form element whose action attribute is assigned to the Validate the Security Question action. <lj:validateSecurityQuestion name="" onError="pages/secQuestion.jsp" onSuccess="pages/resetPassword.jsp" prefill="true">
Change Password Tag

Renders an HTML form element whose action attribute is assigned to "change_password" action.

User is expected to supply all the form elements that are expected for this action. Refer to changePassword action.

Example
<syntaxhighlight lang="java" enclose="div">

<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:changePassword name="" onError="pages/changePassword.jsp" onSuccess="pages/home.jsp">

<td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message}
Old Password <lj:password name="old_password" value=""/>
New Password <lj:password name="password" />
Confirm Password <lj:password name="password2" />
<lj:button submit="true" name="submit" value="Change"/> <input type="button" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/home.jsp"/>'; return false;"/>

</lj:changePassword> </syntaxhighlight>

Reset Password Tag

Renders an HTML form element whose action attribute is assigned to "reset_password" action.

User is expected to supply all the form elements that are expected for this action. Refer to Reset Password action.

Example
<syntaxhighlight lang="java" enclose="div">

<%@taglib prefix="lj" uri="/LJTagLib"%>

<lj:resetPassword name="" onError="pages/resetPassword.jsp" onSuccess="pages/home.jsp">

<td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message}
New Password <lj:password name="password" />
New Password Again <lj:password name="password2" />
<lj:button submit="true" name="submit" value="Reset" /> <input type="button" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/login.jsp"/>'; return false;"/>

</lj:resetPassword> </syntaxhighlight>

Update Profile Tag

Renders an HTML form element whose action attribute is assigned to "update_profile" action.

User is expected to supply all the form elements that are expected for this action. Refer to Update Profile action.

Example
<syntaxhighlight lang="java" enclose="div">

<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:updateProfile name="" onError="pages/updateProfile.jsp" onSuccess="pages/home.jsp" prefill="true">

<lj:detailData object="USER_PROFILE" controller="Platform" recordVariable="profile"> <td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message} </lj:detailData>
First Name <lj:text name="first_name" value="${profile.parameters.first_name}" />
Last Name <lj:text name="last_name" value="${profile.parameters.last_name}" />
Email <lj:text name="email" value="${profile.parameters.email}" />
Street <lj:text name="street" value="${profile.parameters.street}" />
City <lj:text name="city" value="${profile.parameters.city}" />
State <lj:text name="state" value="${profile.parameters.state}" />
Zip <lj:text name="zip" value="${profile.parameters.zip}" />
Country <lj:text name="country" value="${profile.parameters.country}" />
Company <lj:text name="company" value="${profile.parameters.company}" />
Title <lj:text name="title" value="${profile.parameters.title}" />
Division <lj:text name="division" value="${profile.parameters.division}" />
Phone <lj:text name="phone" value="${profile.parameters.phone}" />
Fax <lj:text name="fax" value="${profile.parameters.fax}" />
Mobile <lj:text name="mobile" value="${profile.parameters.mobile}" />
Security Question <lj:text name="custom_security_question" value="${profile.parameters.custom_security_question}" />
Security Answer <lj:text name="security_answer" value="${profile.parameters.security_answer}" />
<lj:button submit="true" name="submit" value="Update" /> <input type="submit" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/home.jsp"/>'; return false;"/>

</lj:updateProfile> </syntaxhighlight>

Validate Security Question Tag

Renders an HTML form element whose action attribute is assigned to "validate_security_question" action.

User is expected to supply all the form elements that are expected for this action. Refer to Validate Security Question action.

Example
<syntaxhighlight lang="java" enclose="div">

<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:validateSecurityQuestion name="" onError="pages/secQuestion.jsp" onSuccess="pages/resetPassword.jsp" prefill="true">

<td colspan="2" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message} <lj:detailData object="USER_PROFILE" controller="Platform" recordVariable="user" recordId="${param['username']}"> <td ${empty user ? "" : (user.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty user ? "" : user.message} </lj:detailData>
 
Username ${user.parameters.username}<lj:hidden name="username" value="${user.parameters.username}"/>
Security Question ${user.parameters.custom_security_question} <lj:hidden name="custom_security_question" value="${user.parameters.custom_security_question}"/>
Security Answer <lj:text name="security_answer" value="${security_answer}"/>
<lj:button submit="true" name="submit" value="Submit"/> <input type="submit" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/login.jsp"/>'; return false;"/>

</lj:validateSecurityQuestion> </syntaxhighlight>