Welcome to Squishdot How-To Newbies Squishdot
 post article
 Mailing Lists
 Bug Tracking


addPostingForm and searchForm Author Information
How-To Posted by Deb on Thursday October 03, 04:00PM, 2002
from the Zopenewbie dept.
How to have an authenticated user show up on the addPostingForm and only local roles show up in the user pull down list on searchForm.

I have several squishdot sites on my intranet. Instead of having people enter author and email information I have setup the field to automatically include their username and email addresses, as follows:



<INPUT TYPE="TEXT" NAME="email" VALUE="<dtml-var AUTHENTICATED_USER>@oursite.com" SIZE="40">


in the searchForm I've set up a author pull down list as follows:

<SELECT name="author">
<dtml-in "acl_users.getUserNames()">
<OPTION VALUE="<dtml-var sequence-item>"><dtml-var sequence-item>
</dtml-in status_result>

My dilemma is this:

1. For the username, I want squishdot to allow me to make it so that it isn't an entry field and the username is just displayed. But when I've manipulated this code, I get posting errors because it's looking for something I can't figure out. I don't want users to be able to change the username to someone else's...it automatically posts the username for whomever is logged in.

2. Ditto for the email field.

3. For some squishdot boards I have limited access to its parent folder/container with the local role of TEAMMEMBER. I want to make it so that only those who are allowed access to that folder and its squishdot site appear in the username/author pulldown list and not the entire usernames list. How do I do this?

Grateful for any help!

<  |  >


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

    Re: addPostingForm and searchForm Author Informati
    by Bryan Kennedy on Monday October 07, 11:06PM, 2002

    This isn't a very squishdot savy way to solve the problem but it worked for me. I just set the input field's type to "hidden" and then displayed the name variable in it's place. That way the form still gets the value and the python validator doesn't act up.

    Here is an example of the code:

    Your Name<br />
    <input type="hidden" name="author" value="<dtml-var AUTHENTICATED_USER>" size="40">

    You could do the same thing for the email field.

    Thanks for you code example this really helped me figure this out.

    [ Reply to this ]
    • Re: addPostingForm and searchForm Author Informati
      by Deb on Tuesday October 08, 06:55PM, 2002
      Thank you! I was having a serious brain cramp. Now that that issue is resolved, anyone have any ideas about how to have local roles users show up on the search form instead of the entire user list?
      [ Reply to this ]
    Re: addPostingForm and searchForm Author Information
    by P Wells on Wednesday October 09, 12:11PM, 2002
    Here is one way to get users with a specific role.

    <dtml-call "REQUEST.set('isemp','2')">
    <dtml-in "acl_users.getUserNames()">
    <dtml-call "REQUEST.set('validuser','1')">
    <dtml-in "acl_users.getUser(_['sequence-item']).getRoles()">
    <dtml-if "_['sequence-item'] == 'TEAMMEMBER'">
    <dtml-call "REQUEST.set('validuser','2')">
    <dtml-if "validuser == isemp">
    <b><dtml-var sequence-item></b><br>

    There is probably an easier way, but this works.
    [ Reply to this ]
    • Re: addPostingForm and searchForm Author Informati
      by Chris Withers on Thursday October 10, 12:41AM, 2002

      That really should be a python script at the very least:

      acl_users = context.acl_users
      for user in acl_users.getUserNames():
       for role in acl_users.getUser(user).getRoles()
        if role == 'TEAMMEMBER':
         print "<b>"+user+"<b><br>"

      ...but even so, I'm sure there's a better way.



      [ 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.