[Zope] Re: DTML problem

Christian Scholz cs at comlounge.net
Fri Aug 5 10:28:06 EDT 2005


Hi!


Phil Beardmore wrote:
> I have a problem writing a DTML page.
> 
> The page will be used to submit data to an SQL database, and the page
> itself is working great, however I get all of my users to login via an
> LDAP server using LDAPUserFolder.  Once logged in the users can complete
> a form, click submit and the data is stored (along with their userID and
> date and time).  Problem is, I also want to store the full name (or CN
> attribute in LDAP tree).
> 
> I know in ZPT I can use
> 
> <b tal:condition="cn">Logged in as: </b> <font
> color=#000000><strong><span tal:replace="cn">replace
> cn</span></strong></font></span>
> 
> and this works great but I cannot manage to work it out in DTML.  Below
> is my page code (Hope you can help!)
> 
> Thanks
> Phil
> 
> 
> 
> 
> <dtml-call "REQUEST.set('user',AUTHENTICATED_USER.getUserName())">
> 
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
>      lang="en"
>      metal:use-macro="here/main_template/macros/master"
>      i18n:domain="plone">

So what type of file is this? Is it a DTML file or a Page Template? You
cannot use both. You need to decide whether you use DTML or TAL and
create an file of the correct type accordingly.

You though might keep in the TAL space and write
<tal:block tal:define="dummy
python:request.set('user',AUTHENTICATED_USER.getUserName())" />

<dtml-var user> might be straightforward to convert to TAL e.g.

tal:attributes="value name"

(however name is defined.)
Though probably you don't need to set it in the request anyway and just
can define it as normal variable on top and then use it later.

-- christian



> 
> <body>
> <div metal:fill-slot="main">
> 
> 
> <body bgcolor="#FFFFFF">
> <table width="100%" border="0">
>    <td width="80%"><form name="Add_student_modules" method="post"
> action="add_stu_modules_method" enctype="multipart/form-data">
> <input type="hidden" name="userid" value="<dtml-var user>">
> <input type="hidden" name="datetime" value="<dtml-var "ZopeTime()"
> fmt=fCommon>">
> <input type="hidden" name="name" value="<dtml-var name>">
> 
> 
>        <table width="90%" border="0" cellspacing="0" cellpadding="2"
> align="center">
> <tr>
>            <td colspan="2" class="standard" align="center"
> bgcolor="#D6DBDF"><strong>Submit Module Choices</strong></td>
>          </tr>
> 
> <tr>
>            <td width="101" bgcolor="#D6DBDF">&nbsp;</td>
>   <td width="419">&nbsp;</td></tr>
> 
> <tr>
>            <td width="101" align="right" bgcolor="#D6DBDF"
> class="standard"><b>Choice 1</b></td>
>   <td width="419">
>      <select name="choice1">
>               <option value="APC101">APC101 - Accounting, Planning and
> Control</option>
>               <option value="BUS999">BUS999 - Marketing & Business
> Enterprise</option>
>               <option value="HRM121">HRM121 - Human Resource
> Management</option>
>               <option value="SIM222">SIM222 - Strategy and International
> Management</option>
>               <option value="PSY666">PSY666 - Psychology</option>
>               <option value="LAW421">LAW421 - Law</option>
>               <option value="ADM555">ADM555 - Administration</option>
>               <option value="TEC834">TEC834 - Technical</option>
>     </select></td></tr>
> 
> <tr>
>            <td width="101" align="right" bgcolor="#D6DBDF"
> class="standard"><b>Choice 2</b></td>
>   <td width="419">
>      <select name="choice2">
>               <option value="APC101">APC101 - Accounting, Planning and
> Control</option>
>               <option value="BUS999">BUS999 - Marketing & Business
> Enterprise</option>
>               <option value="HRM121">HRM121 - Human Resource
> Management</option>
>               <option value="SIM222">SIM222 - Strategy and International
> Management</option>
>               <option value="PSY666">PSY666 - Psychology</option>
>               <option value="LAW421">LAW421 - Law</option>
>               <option value="ADM555">ADM555 - Administration</option>
>               <option value="TEC834">TEC834 - Technical</option>
>     </select></td></tr>
> 
> 
>            <td width="101" bgcolor="#D6DBDF">&nbsp;</td>
>   <td width="419">
>      <input type="submit" name="Submit" value="Submit">
>      <input type="reset" name="Submit2" value="Clear"></td></tr>
> 
> </table>
> </form></td>
>  </tr>
> </table>
> </div>
> </body>
> </html>
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )



More information about the Zope mailing list