Threaded Discussions

Function: RenderAddComment

Render a form to post a comment

Documentation

Parameters
NONE

Css
  • blogAddComment
  • blogSubmitButton

This function renders a form to comment on a topic, that is on another comment or a posting. If you are logged in the fields "Name", "EMail" and "Url" will be populated with values taken from the user's profile.

See also: Comment, CommentTemplate, RenderNextCommentNr

Implementation

%STARTINCLUDE%
~~~
%IFDEFINEDTHEN{"%DBQUERY{topic="%BASEWEB%.%BASETOPIC%" format="$expand(State or @BaseRef.State or 'open')"}%" as="open" glue="off"}%
<div class="blogAddComment">
---++ Leave a Reply
<form name="AddCommentForm" action="%SCRIPTURL{"save"}%/%BASEWEB%/CommentXXXXXXXXXX" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="redirectto" value="%SCRIPTURL{"view"}%/%BASEWEB%/%BASETOPIC%?refresh=on#bottomComment" />
<input type="hidden" name="onlywikiname" value="off" />
<input type="hidden" name="templatetopic" value="Applications.DiscussionApp.CommentTemplate" />
<input type="hidden" name="formtemplate" value="Applications.DiscussionApp.Comment" />
<input type="hidden" name="TopicType" value="Comment" />
<input type="hidden" name="TopicRef" value="%BASETOPIC%" />
<input type="hidden" name="BaseRef" value="%DBQUERY{web="%BASEWEB%" topic="%BASETOPIC%" format="$expand(BaseRef or name)"}%" />
<input type="hidden" name="topicparent" value="%BASETOPIC%" />
<input type="hidden" name="Nr" value="%DBCALL{"Applications.DiscussionApp.RenderNextCommentNr" NAME="%BASETOPIC%"}%" />
<input type="hidden" name="Timestamp" value="%SERVERTIME{"$epoch"}%" />
<input type="hidden" name="topic" value="CommentXXXXXXXXXX" />
<table border="0" width="100%">
<tr>
  <td><input type="text" id="name" name="Name" value="%IFDEFINED{"%WIKINAME%" as="TWikiGuest" then=" " else="%WIKINAME%"}%" style="width:60%"/>
      <label for="name">Name <span style="color:red;font-size:0.8em">**</span></label>
  </td>
</tr>
<tr>
  <td><input type="text" id="email" name="EMail" value="%USERINFO{format="$emails"}%" style="width:60%"/>
      <label for="email">EMail <span style="color:red;font-size:0.8em">**</span></label>
  </td>
</tr>
<tr>
  <td><input type="text" id="url" name="Url" value="%FORMFIELD{"OrganisationURL" topic="%WIKIUSERNAME%"}%" style="width:60%"/>
      <label for="email">Url</label>
  </td>
</tr>
<tr>
  <td><input type="text" id="summary" name="Summary" style="width:60%"/>
      <label for="summary">Headline</label>
  </td>
</tr>
<tr>
  <td><textarea id="text" wrap="virtual" name="Text" style="width:98%" rows="10" cols="80"></textarea></td>
</tr>
<tr>
  <td style="padding-top:0.5em;">
    <table width="100%"><tr><td>
      You may have to [[%IFDEFINED{"%LOGINURL%" then="%LOGINURL%" else="%NATLOGINURL%"}%][login]]
      or [[%TWIKIREGISTRATION%][register]] to comment if you haven't already.
    </td><td>
      <input type="submit" class="blogSubmitButton" value="Submit" />
    </td></tr></table>
  </td>
</tr>
</table>
</form> 
</div> 
%FIDEFINED%
~~~
%STOPINCLUDE%

Test

TODO: create a test discussion shipped with this application

Calls to 'RenderAddComment'

Applications.ApplicationTopic
TopicType: DocuTopic, TopicFunction
Summary: Render a form to post a comment
TWikiApplication: DiscussionApp
r0 - 08 Jan 2007 - 15:38:45 - TWikiContributor
© giant orange extension cord that reeks hip-hop, funk & soul