]> CRI, Mines Paris - PSL - Plinn.git/blobdiff - Products/Plinn/skins/control/discussionItemDelete.py
Déplacement pour eggification.
[Plinn.git] / Products / Plinn / skins / control / discussionItemDelete.py
diff --git a/Products/Plinn/skins/control/discussionItemDelete.py b/Products/Plinn/skins/control/discussionItemDelete.py
new file mode 100644 (file)
index 0000000..ee1b272
--- /dev/null
@@ -0,0 +1,21 @@
+## Script (Python) "discussionItemDelete"
+##title=Add item to favourites
+##parameters=
+from Products.CMFCore.utils import getToolByName
+disTool = getToolByName(context, 'portal_discussion')
+thread = context.parentsInThread()
+content = thread[0]
+talk = disTool.getDiscussionFor(context)
+
+if talk.hasReplies(context) :
+       context.setStatus(True, 'Discussion thread deleted.')
+else :
+       if len(thread) == 1:
+               context.setStatus(True, 'Comment deleted.')
+       else :
+               context.setStatus(True, 'Reply deleted.')
+
+
+talk.deleteReply(context.id)
+
+return context.setRedirect(content, 'object/view', **context.REQUEST.form)