customizing user profiles
DESCRIPTION
Andy Keller and Dave Shepperton, Traction Software. Traction User Group, Oct 14 2010, Newport RI. TUG 2010 Newport slides, agenda and more see www.TractionSoftware.comTRANSCRIPT
Customizing User Profiles
Andy KellerDirector of Engineering
Dave SheppertonSenior Software Engineer
2
Overview
• User Profile Architecture
• Customizations
• Adding new fields
• Modifying profile display
• Custom data sources
3
User Profile Architecture
• Schema
• User Profile Display
• Form Rendering
4
User Profile Schema
• Configuration
• config/data/forms/profile.properties
• Schema XML
• config/data/forms/profile.sdl
5
config/data/forms/profile.properties
# special form factory for profilesclass=tsi.sdk.data.ProfileFormFactory
# located in the current directoryxml=config.data.forms.profile
# user must be last, because it will store the entry fqidsources=entry,ldap,user
# make these entries profilesentry_custom_type=profile
6
config/data/forms/profile.sdl
7
config/data/forms/profile.sdl
• This is XML
<?xml version="1.0"?>
• Three XML tags
<form>
<group>
<field>
8
profile.sdl: <form>
• The class attribute can be used for css styling
• Other attributes can be used when the form
appears in a dialog
• title, width
<form class=”userprofile-form”>
9
profile.sdl: <group>
• Currently, the only group type is fieldset. There may be more
in the future.
• The label attribute specifies the label for the group.
<group type=”fieldset” label=”Basic Information”>
10
profile.sdl: <field>
• Attributes
• type - the type of the form control
• source - the source of the data for read/write
• name - the name of the property
• label - the text label for the form field
• description - a description of the form field
• (other) - Depending on the field type, additional attributes may be used
<field type=”text” name=”property_twitter” label=”Twitter ID”>
11
profile.sdl: <field> types
text Text input or text area if rows attribute is specified
select Pulldown with option elements or special name=project
date Date selector that allows choosing a day using a calendar
html HTML block that can be used for adding fixed content
readonly Displays as non-editable text, often used with source=ldap
projectselect Link, click to show select with project list
label Label pillbox
labelselect Label select input with options or project and prefix
usersUser pillbox, completes against all users in the system
membersUser pillbox, completes against space members, then all
goalselector Allows selection of a goal, called a project in the interface
milestoneselector Allows selection of a milestone
richtext Coming soon!
attachments Coming soon!
12
User Profiles in Proteus
• Automatically included in any Proteus view that is in
the userprofile tabs family.
• com/traction/sdl/gwtrpc/userprofile_details.sdl,
broken into groups per column:
• basic, contact, other
• Modify by overriding individual functions in your
plug-in, e.g.,
plugins/com.example.customprofile/com/traction/sdl
/gwtrpc/userprofile_details.sdl
13
User Profile Entry Tokens
• profile_title and profile_body use SDL functions in
com/traction/sdl/token/profile.sdl
14
Customizing the User Profile Form
For Example: Add a field for the user’s LinkedIn
public profile URL
In a new plug-in:
1. Create a custom version of the schema
2. Override some SDL functions to display the
property in the profile header
3. Override some SDL functions to include the
property in full text renderings (for search results)
15
Customizing the User Profile Form (cont’d)• Create a plug-in, e.g.
plugins/com.traction.profilelinkedin
• Copy config/data/forms/profile.sdl used to generate XML schema to
plugins/com.traction.profilelinkedin/config/data/forms
• Add the field where you want it in the form:
16
Customizing the User Profile Form (cont’d)
The structure of the schema is used to automatically
generate the form:
17
Customizing the Display of User Profile Information
plugins/com.traction.profilelinkedin/com/traction/
sdl/gwtrpc/userprofile_details.sdl, start by copying
just these two functions:
•display-secure-contact function
•fill-custom-entry-props function
18
Customizing the Display of User Profile Information (cont’d)
Profile data are loaded from the User and profile
Entry in SDL (com.traction.sdl.token.profile#fill)
fill-custom-entry-props Function Names the
Same Property Given in the Schema:
19
Customizing the Display of User Profile Information (cont’d)
Modify the custom version of display-secure-contact to display the LinkedIn URL:
20
Customizing the Display of User Profile Information (cont’d)
A separate modification is required to make the
property searchable.
•plugins/com.traction.profilelinkedin/com/traction/
sdl/token/profile.sdl, start by copying just these two
functions:
•fulltextbody-custom function
•fill-custom-entry-props function
21
Customizing the Display of User Profile Information (cont’d)
Profile data are loaded from the User and profile
Entry in SDL (com.traction.sdl.token.profile#fill)
fill-custom-entry-props Function Names the
Same Property Given in the Schema:
22
Customizing the Display of User Profile Information (cont’d)
The fulltextbody-custom function can be used
to include the property in the full-text rendering so
that it appears in search results:
23
Profile information from Active Directory / LDAP
Active Directory Properties Viewed using JXplorer
24
Profile information from Active Directory / LDAP
Add it to the Profile Schema in config/data/forms/userprofile.sdl
Render it using user.profile and property.value
25
Custom DataSources
• Currently have user, entry, and ldap
• user is for user preferences
• entry is for entry properties and is used for
settings not traditionally in user preferenes
• ldap is for properties store in ldap
• It’s possible to create new sources to pull content
from a database, web service, etc.