comments: restrict to logged-in users; improve validateion

This commit is contained in:
Helmut Merz 2012-09-17 09:28:42 +02:00
parent 2d121fe028
commit d21e2da317
5 changed files with 11 additions and 7 deletions

View file

@ -21,6 +21,7 @@ concept(u'issubtype', u'is Subtype', u'predicate', options=u'hide_children',
# document types # document types
concept(u'keyquestions', u'Leitfragen', u'documenttype') concept(u'keyquestions', u'Leitfragen', u'documenttype')
concept(u'textelement', u'Textabschnitt', u'documenttype') concept(u'textelement', u'Textabschnitt', u'documenttype')
concept(u'textelement2', u'Textabschnitt separat', u'documenttype')
concept(u'quote', u'Zitat', u'documenttype') concept(u'quote', u'Zitat', u'documenttype')
concept(u'story', u'Geschichte', u'documenttype') concept(u'story', u'Geschichte', u'documenttype')
concept(u'usecase', u'Fallbeispiel', u'documenttype') concept(u'usecase', u'Fallbeispiel', u'documenttype')

Binary file not shown.

View file

@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: $Id$\n" "Project-Id-Version: $Id$\n"
"POT-Creation-Date: 2007-05-22 12:00 CET\n" "POT-Creation-Date: 2007-05-22 12:00 CET\n"
"PO-Revision-Date: 2012-08-20 12:00 CET\n" "PO-Revision-Date: 2012-09-17 12:00 CET\n"
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n" "Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
"Language-Team: loops developers <helmutm@cy55.de>\n" "Language-Team: loops developers <helmutm@cy55.de>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -755,6 +755,9 @@ msgstr "Kommentare"
msgid "Add Comment" msgid "Add Comment"
msgstr "Kommentar hinzufügen" msgstr "Kommentar hinzufügen"
msgid "Subject"
msgstr "Thema"
msgid "Selection using: $targets" msgid "Selection using: $targets"
msgstr "Auswahl über: $targets" msgstr "Auswahl über: $targets"

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de # Copyright (c) 2012 Helmut Merz helmutm@cy55.de
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -18,8 +18,6 @@
""" """
Definition of view classes and other browser related stuff for comments. Definition of view classes and other browser related stuff for comments.
$Id$
""" """
from zope import interface, component from zope import interface, component
@ -52,6 +50,8 @@ class CommentsView(NodeView):
@Lazy @Lazy
def allowed(self): def allowed(self):
if self.isAnonymous:
return False
return (self.virtualTargetObject is not None and return (self.virtualTargetObject is not None and
self.globalOptions('organize.allowComments')) self.globalOptions('organize.allowComments'))
@ -120,8 +120,8 @@ class CreateComment(EditObject):
def update(self): def update(self):
form = self.request.form form = self.request.form
subject = form.get('subject') subject = form.get('subject')
text = form.get('text') text = form.get('text') or u''
if not subject or not text or self.personId is None or self.object is None: if not subject or self.personId is None or self.object is None:
return True return True
#contentType = form.get('contentType') or 'text/restructured' #contentType = form.get('contentType') or 'text/restructured'
rm = self.view.loopsRoot.getRecordManager() rm = self.view.loopsRoot.getRecordManager()

View file

@ -58,7 +58,7 @@
</div> </div>
<div class="buttons"> <div class="buttons">
<input value="Save" type="submit" <input value="Save" type="submit"
onClick="return closeDialog(true)" onClick="if (not this.validate()) return False; return closeDialog(true)"
i18n:attributes="value"> i18n:attributes="value">
<input type="button" value="Cancel" <input type="button" value="Cancel"
onClick="return closeDialog(false)" onClick="return closeDialog(false)"