Hi Dan,
One of the things you may want to consider exploring is the use of the
DisplayComboSelect tag.
This allows you to eseentially build a dynamic pick list, with creating a new table. I am using this functionality alot
in my apps in certain situations. I actually do this for the Company field in the PlumUser table for one app, so that
people can pick a company from a list. If the company doesn't exist yet, then somebody enters a new one. The next person
registering for that company will see their company in the picklist.
You should be able to set up a role to handle restricting this functionality to certain users if you want. Do an
Authorize check and if they have the secret handshake, display the ComboSelect control, otherwise display a Select or
text input field.
In Adam's example, you can use this tag as a self-referencing lookup for the Title field in the PlumUser table and then
don't have to add the Title table.
I have been using this for a lot of cases where I want the picklist
functionality, but don't need a parent lookup table.
HTH,
Jeff
Dan wrote:
Thanks Adam,
"Couple of minutes and bug free" is my kind of modification.
However, since you know my some by now, you know I'm sometimes stubborn--but
willing to explore and implement.
I did add a new table for UserTitles because I want to set these values
separately of user input to assure consistency. I need the users in this
app to have to pick the UserTitle from a ListBox instead of type it in.
I made the table AND then modified the UserQuery that I found in
security.cfc to include the UserTitle in its list of SELECT columns. I
tested a copy of this query outside of the cfc and it works fine, giving me
just what I wanted.
Here's my modified query (lines 150 thru 171 in security.cfc
<cfquery name="userQuery"
datasource="#Application.dbDSN#"
username="#Application.dbUsername#"
password="#Application.dbPassword#">
SELECT
UserID,
FirstName,
LastName,
Email,
Password,
LoginID,
UserTitle,
Status
FROM
PlumUser p
JOIN
BCC_tbl_UserTitles u
ON
p.UserTitleID = u.UserTitleID
WHERE
Email = <cfqueryparam
value="#Trim(Arguments.email)#"
cfsqltype="CF_SQL_VARCHAR">
</cfquery>
BUT now I don't know how to get the UserTitle OUT and use it. I am already
using #session.NameOfLoggedInUser# successfully in the site. My thinking
was simply to create # session.TitleOfLoggedInUser# to use along with it.
The code at line 102
<!--- Set cookies for auto-login and persist the user's full name --->
Looked like a logical place to add this line:
Session["TitleOfLoggedInUser"] = "#userQuery.userTitle#";
But it is not working. (Mainly I'm sure because I don't really know what I'm
doing, just trying to follow your lead and learn from you.
I am out of my league in further modifying security.cfc (if indeed that's
where I should make the mod's) to get this new query value out where I can
use it.
Can you help?
Thanks,
Dan Kaufman
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Adam
Churvis
Sent: Wednesday, May 11, 2005 1:33 PM
To: [email protected]
Subject: Re: [plum] Need to add a user title
I would add a NULLable column named Title to the PlumUser table and then
just add a field for it on the user management forms on the admin side of
the site. Takes all of a couple of minutes total to modify, bug free.
What you suggest for modifying Security.cfc is exactly the kind of
modifications to Plum that we encourage developers to explore and implement.
Respectfully,
Adam Phillip Churvis
Member of Team Macromedia
http://www.ProductivityEnhancement.com
Download Plum and other cool development tools,
and get advanced intensive Master-level training:
* C# & ASP.NET for ColdFusion Developers
* ColdFusion MX Master Class
* Advanced Development with CFMX and SQL Server 2000
----- Original Message -----
From: "Dan" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, May 11, 2005 11:17 AM
Subject: [plum] Need to add a user title
In my Plum app I have a need for some users, not all, to have a Title
(like
General Manager, Vice-President, etc.)
My fist thought is to create a new _db tbl "UserTitles"
UserTitleID PK, int, identity
UserTitle char
And then add UserTitleID to the PlumUser tbl
From an Admin side, a User will NOT be able to add/edit his/her Title.
This
can only done by a "senior" ROLE person.
How would I go about doing this within Plum's methodology?
2nd question: I will need with in the site pages to display the User's
Title with their name ( NameOfLoggedInUser )
I see where NameOfLoggedInUser is created in Security.cfc. Would it be
correct to modify/add this procedure to this CFC
}
f(Application.persistentScope EQ "Session") {
Session["NameOfLoggedInUser"] = "#userQuery.FirstName#
#userQuery.LastName#";
Session["TitleOfLoggedInUser"] = "#userQuery.userTitle #";
} else {
Client["NameOfLoggedInUser"] = "#userQuery.FirstName#
#userQuery.LastName#";
Client["TitleOfLoggedInUser"] = "#userQuery.userTitle #";
}
I would, of course, have to modify the userQuery to pull the userTitle
from
a JOIN on the PlumUser and UserTitles table.
Thanks,
Dan Kaufman
An Elephant Never Forgets
[EMAIL PROTECTED]
**********************************************************************
You can subscribe to and unsubscribe from lists, and you can change
your subscriptions between normal and digest modes here:
http://www.productivityenhancement.com/support/DiscussionListsForm.cfm
**********************************************************************
**********************************************************************
You can subscribe to and unsubscribe from lists, and you can change
your subscriptions between normal and digest modes here:
http://www.productivityenhancement.com/support/DiscussionListsForm.cfm
**********************************************************************
**********************************************************************
You can subscribe to and unsubscribe from lists, and you can change
your subscriptions between normal and digest modes here:
http://www.productivityenhancement.com/support/DiscussionListsForm.cfm
**********************************************************************