Welcome to Squishdot Websites Squishdot How-To Newbies
 about
 search
 post article
 Documentation
 Mailing Lists
 Bug Tracking
 Development
 Installation
 Upgrading
 Download
 admin
 rdf

 main


How to Default the Tile and Email Address on Postings
How-To Posted by Mark Matthews on Tuesday July 13, 11:02AM, 2004
from the getting-my-hands-dirty dept.
The "Title" and "Email" boxes on the Posting form (for both Articles and Replies) need to default the user's details (Full Name and Email Address).

This is a requirement from our management :-(

I have added a TinyTablePlus object to the root Squishdot Site Folder called "user_details", with these columns: logonname fullname emailaddress

(All edits of the site will be by authenticated users)

How can I get the posting form to look up the users' logonname (i.e. "markm", and put the relevant fullname and emailaddress into the Name and Email boxes (i.e. "Mark Matthews" and "mmatthews@nyfix.co.uk" ????

Also, I may have to make these same boxes read only as well.

<  |  >

 

Related Links
  • Articles on How-To
  • Also by Mark Matthews
  • Contact author
  • The Fine Print: The following comments are owned by whoever posted them.
    ( Reply )

    Re: How to Default the Tile and Email Address on P
    by Chris Withers on Thursday July 15, 09:51PM, 2004
    You'll have to find the way to query a TinyTable yourself, I'm afraid I don't know...

    After that, insert the required code into the posting form and put it into a hidden input instead of displaying a visible input (->learn more about html ;-)

    This doesn't really prevent them from changing things, but will be good enough for most people ;-)
    [ Reply to this ]
    Re: How to Default the Tile and Email Address on Postings
    by Mark Matthews on Monday July 19, 02:03PM, 2004
    Here's how i made this work;

    Note: All our zope site users users registered in the ZMI at "Root\acl_users" have names in the format "markm" or "fredb"

    First, I made a TinyTable object on the root of the site, i.e. at "ZMI\Root\MySquishdotSite" called "user_details" with columns "logonname fullname emailaddress", and sample data like this;
    "markm", "mark Matthews", "mmatthews@nyfix.co.uk"
    "fredb", "fred bloggs", "fbloggs@nyfix.co.uk"

    Second, to show the login data in the Right Hand Side of the screen below the Rightbbox Methods, in the "Root\MySquishdotSite\misc_methods" folder i made a new DTML Method called "user_detail_info" wit the following script:

    <!--tiny table example-->
    <!--columns = logonname fullname emailaddress -->
    <dtml-let blogsurfer="_.SecurityGetUser().getUserName()">
    <TABLE ALIGN="left" BORDER=1 CELLSPACING=1 CELLPADDING=1>
    <TR ALIGN="left" VALIGN="middle">
    <TH><b>User Details</b></TH>
    </TR>
    <TR ALIGN="left" VALIGN="middle"><TD>
    Logged On As<br>
    <I><dtml-var blogsurfer></I>
    <dtml-in expr="user_details(logonname=blogsurfer)">
    <br><b><a href="mailto:<dtml-var emailaddress>" ><dtml-var fullname></a></b>
    </dtml-in>
    </TD></TR>
    </TABLE>
    </dtml-let>
    <!--tiny table example-->

    Second (cont) I added this script into the index_html() object's script after it does the rightbox stuff;

    <!--user_detail_info-->
    <dtml-with misc_methods>
    <dtml-var user_detail_info>
    </dtml-with>
    <!--user_detail_info-->

    Now, the above shows how to get the users' login name, and do lookups based on that. So next was how to use this in the posting windows? well...

    Third, to use this in the addPostingForm() I changed the script (in both places where it created the Input controls) to look like this;

    <!-- logon user details-->
    <dtml-let blogsurfer="_.SecurityGetUser().getUserName()">
    <dtml-in expr="user_details(logonname=blogsurfer)">
    <INPUT TYPE="HIDDEN" NAME="author" VALUE="<dtml-var fullname>" SIZE=50>
    <LABEL><dtml-var fullname></LABEL>
    <P><FONT color="<dtml-var color3>"><B>Your Email address</B></FONT>
    (<dtml-if mail_host>Required if reply notification is checked<dtml-else>Optional</dtml-if>)<BR>
    <INPUT TYPE="HIDDEN" NAME="email" VALUE="<dtml-var emailaddress>" SIZE=50>
    <LABEL><dtml-var emailaddress></LABEL>
    </dtml-in>
    </dtml-let>
    <!-- logon user details-->

    Basically, you are wrapping up the old script on this object wherever it used to say

    <INPUT TYPE="TEXT" NAME="author" VALUE="<dtml-if suggest_author><dtml-var suggest_author html_quote></dtml-if suggest_author>" SIZE=50>

    and

    <INPUT TYPE="TEXT" NAME="email" VALUE="<dtml-if suggest_email><dtml-var suggest_email html_quote></dtml-if suggest_email>" SIZE=50>

    with the above script.
    [ Reply to this ]
    The Fine Print: The following comments are owned by whoever posted them.
    ( Reply )

    Powered by Zope  Squishdot Powered
      "Any system that depends on reliability is unreliable." -- Nogg's Postulate
    All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest ©1999 Butch Landingin, ©2000-2002 Chris Withers.