Index: /qPloneComments/branches/plone3_extend/HISTORY.txt
===================================================================
--- /qPloneComments/branches/plone3_extend/HISTORY.txt	(revision 857)
+++ /qPloneComments/branches/plone3_extend/HISTORY.txt	(revision 858)
@@ -2,8 +2,9 @@
 =========
 
-3.2.4 (unreleased)
+3.2.4 plone3_extend (unreleased)
 ------------------
 
-- Nothing changed yet.
+- Move add comment form in comments viewlet
+- Added edit comment functionality
 
 
Index: /qPloneComments/branches/plone3_extend/browser/comments.pt
===================================================================
--- /qPloneComments/branches/plone3_extend/browser/comments.pt	(revision 857)
+++ /qPloneComments/branches/plone3_extend/browser/comments.pt	(revision 858)
@@ -59,4 +59,16 @@
                            />
                 </form>
+		<form name="edit"
+		      action="discussion_edit_form"
+		      method="post"
+		      style="display: inline;"
+		      tal:attributes="action string:${reply/absolute_url}/discussion_edit_form"
+                      tal:condition="isModerationAllowed">
+		    <input class="standalone"
+			   type="submit"
+			   value="Edit"
+			   i18n:attributes="value label_edit;"
+			   />
+		</form>
                 <form name="delete"
                       action=""
Index: /qPloneComments/branches/plone3_extend/skins/qplonecomments/discussion_edit.cpy
===================================================================
--- /qPloneComments/branches/plone3_extend/skins/qplonecomments/discussion_edit.cpy	(revision 858)
+++ /qPloneComments/branches/plone3_extend/skins/qplonecomments/discussion_edit.cpy	(revision 858)
@@ -0,0 +1,50 @@
+## Script (Python) "discussion_edit"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=subject,body_text
+##title=Delete discussion item
+##
+
+from Products.PythonScripts.standard import url_quote_plus
+from Products.CMFCore.utils import getToolByName
+from Products.CMFPlone import PloneMessageFactory as _
+dtool = getToolByName(context, 'portal_discussion')
+req = context.REQUEST
+
+tb = dtool.getDiscussionFor(context)
+id = context.getId()
+reply = tb.getReply(id)
+
+modif_date = reply.modification_date
+
+# Set Title
+reply.setTitle(subject)
+
+# Update text
+reply.edit(text_format=reply.Format(), text=body_text)
+
+# TODO THIS NEEDS TO GO AWAY!
+if hasattr(dtool.aq_explicit, 'cookReply'):
+    dtool.cookReply(reply, text_format='plain')
+
+# Set modification date to old value
+reply.setModificationDate(modification_date=modif_date)
+
+parent = tb.aq_parent
+
+# return to the discussable object.
+redirect_target = context.plone_utils.getDiscussionThread(tb)[0]
+view = redirect_target.getTypeInfo().getActionInfo('object/view',
+                                                   redirect_target)['url']
+anchor = reply.getId()
+
+from Products.CMFPlone.utils import transaction_note
+transaction_note('Added comment to %s at %s' % (parent.title_or_id(),
+                                                reply.absolute_url()))
+
+context.plone_utils.addPortalMessage(_(u'Comment updated.'))
+target = '%s#%s' % (view, anchor)
+return req.RESPONSE.redirect(target)
Index: /qPloneComments/branches/plone3_extend/skins/qplonecomments/discussion_edit_form.cpt
===================================================================
--- /qPloneComments/branches/plone3_extend/skins/qplonecomments/discussion_edit_form.cpt	(revision 858)
+++ /qPloneComments/branches/plone3_extend/skins/qplonecomments/discussion_edit_form.cpt	(revision 858)
@@ -0,0 +1,157 @@
+<html xmlns:tal="http://xml.zope.org/namespaces/tal"
+      xmlns:metal="http://xml.zope.org/namespaces/metal"
+      metal:use-macro="here/main_template/macros/master"
+      i18n:domain="plone">
+<body>
+
+<metal:block fill-slot="top_slot"
+             tal:define="dummy python:request.set('disable_border',1)" />
+
+<metal:block fill-slot="sub" />
+
+<div metal:fill-slot="main"
+     tal:define="errors options/state/getErrors;
+                 thread python:putils.getDiscussionThread(here);
+                 discussable python:thread[0];
+                 replies python:thread[1:]">
+
+
+    <form name="edit_form"
+          method="post"
+          action="talkback"
+          tal:attributes="action string:$here_url/$template_id">
+
+        <fieldset>
+
+            <legend i18n:translate="legend_edit_comment">Edit comment</legend>
+            <p i18n:translate="description_edit_comment">
+                You can edit a comment by filling out the form below. Plain text
+                formatting.
+            </p>
+
+            <input type="hidden" name="Creator" value=""
+                   tal:attributes="value member/getUserName" />
+
+            <div class="portalMessage"
+                 tal:condition="isAnon">
+
+                <tal:block replace="structure here/info.gif"/>
+
+                <p i18n:translate="legend_note_reply_anonymous">
+                    Note: you are not logged in. You may optionally enter your
+                    username and password below. If you don't enter your
+                    username and password below, this comment will be posted as
+                    the 'Anonymous User'.
+                </p>
+
+                <div class="field">
+
+                    <label for="username" i18n:translate="label_name">Name</label>
+
+                    <input name="username"
+                           id="username"
+                           value="" alt="Username" title="Name"
+                           size="40"
+                           tabindex=""
+                           i18n:attributes="title label_name; alt label_username;"
+                           tal:attributes="tabindex tabindex/next;" />
+
+                </div>
+
+                <div class="field">
+
+                    <label for="password" i18n:translate="label_password">Password</label>
+
+                    <input type="password"
+                           id="password"
+                           name="password"
+                           tabindex=""
+                           value="" alt="Password" title="Password"
+                           size="40"
+                           i18n:attributes="title label_password; alt label_password;"
+                           tal:attributes="tabindex tabindex/next;" />
+
+                </div>
+
+            </div>
+
+
+        <div class="field"
+        tal:define="error errors/subject|nothing;"
+        tal:attributes="class python:test(error, 'field error', 'field')">
+
+                <label for="subject" i18n:translate="label_subject">Subject</label>
+
+        <span class="fieldRequired" title="Required"
+              i18n:attributes="title title_required;"
+              i18n:translate="label_required">(Required)</span>
+
+            <div tal:content="error">Validation error output</div>
+
+                <input name="subject"
+                       id="subject"
+                       value=""
+                       size="40"
+                       tabindex=""
+                       tal:attributes="value context/title|request/subject|request/title_override|nothing;
+                                       tabindex tabindex/next" />
+
+            </div>
+
+        <div class="field"
+        tal:define="error errors/body_text|nothing;"
+        tal:attributes="class python:test(error, 'field error', 'field')">
+
+          <label for="body_text" i18n:translate="label_comment">Comment</label>
+
+        <span class="fieldRequired" title="Required"
+              i18n:attributes="title title_required;"
+              i18n:translate="label_required">(Required)</span>
+
+            <div tal:content="error">Validation error output</div>
+
+                <textarea name="body_text"
+                          id="body_text"
+                          cols="40"
+                          rows="20"
+                          tabindex=""
+                          tal:content="context/text|request/body_text|request/text_override | nothing"
+                          tal:attributes="tabindex tabindex/next"
+                        ></textarea>
+
+            </div>
+
+             <div tal:condition="nocall:here/captcha_widget|nothing"
+                  tal:omit-tag="">
+                <div metal:use-macro="here/captcha_widget/macros/captcha" />
+             </div>
+	     
+            <div class="formControls">
+
+                <input class="context"
+                       tabindex=""
+                       type="submit"
+                       value="Save"
+                       name="form.button.Save"
+                       i18n:attributes="value label_save;"
+                       tal:attributes="tabindex tabindex/next;
+                                       name string:discussion_reply:method;" />
+                <input class="standalone"
+                       tabindex=""
+                       type="submit"
+                       value="Cansel"
+                       name="form.button.Cancel"
+                       i18n:attributes="value label_cancel;"
+                       tal:attributes="tabindex tabindex/next;" />
+
+            </div>
+          <input type="hidden" name="form.submitted" value="1" />
+
+        </fieldset>
+
+    </form>
+
+</div>
+
+</body>
+</html>
Index: /qPloneComments/branches/plone3_extend/skins/qplonecomments/discussion_edit_form.cpt.metadata
===================================================================
--- /qPloneComments/branches/plone3_extend/skins/qplonecomments/discussion_edit_form.cpt.metadata	(revision 858)
+++ /qPloneComments/branches/plone3_extend/skins/qplonecomments/discussion_edit_form.cpt.metadata	(revision 858)
@@ -0,0 +1,14 @@
+[default]
+title=Discussioin edit form
+
+[security]
+View=1:Manager
+
+[validators]
+validators=validate_talkback
+validators..Cancel=
+
+[actions]
+action.success=redirect_to:string:
+action.success..Save=traverse_to:string:discussion_edit
+action.failure=traverse_to:string:discussion_edit_form
