import re\r
\r
from forum.models import Question, Action\r
+from django.template import Template, Context\r
from django.utils.translation import ungettext, ugettext as _\r
from django.utils.html import strip_tags\r
from django.utils.encoding import smart_unicode\r
from django.utils.safestring import mark_safe\r
+from django.conf import settings as django_settings\r
from django.core.urlresolvers import reverse\r
from django import template\r
from forum.actions import *\r
(copy and " copy" or " ")\r
return {'text': text, 'url': url, 'classes': classes, 'title': title}\r
\r
-@register.inclusion_tag('node/post_controls.html')\r
+\r
+moderation_enabled = False\r
+for m in django_settings.MODULE_LIST:\r
+ if m.__name__.endswith('moderation'):\r
+ moderation_enabled = True\r
+\r
+@register.inclusion_tag('node/post_controls.html' if not moderation_enabled else "modules/moderation/node/post_controls.html")\r
def post_controls(post, user):\r
controls = []\r
menu = []\r
\r
@register.inclusion_tag('node/comments.html')\r
def comments(post, user):\r
- all_comments = post.comments.filter_state(deleted=False).order_by('added_at')\r
+ all_comments = post.comments.filter_state(deleted=False).order_by('-added_at')\r
\r
if len(all_comments) <= 5:\r
top_scorers = all_comments\r
context.update(dict(c.__dict__))\r
comments.append(context)\r
\r
+ # Generate canned comments\r
+ canned_comments = []\r
+ for comment in settings.CANNED_COMMENTS:\r
+ t = Template(smart_unicode(comment))\r
+ c = Context({\r
+ 'post' : post,\r
+ 'settings' : settings,\r
+ })\r
+ canned_comments.append(t.render(c))\r
+\r
+ total = len(all_comments)\r
return {\r
'comments': comments,\r
+ 'canned_comments': canned_comments,\r
'post': post,\r
'can_comment': user.can_comment(post),\r
'max_length': settings.FORM_MAX_COMMENT_BODY,\r
'min_length': settings.FORM_MIN_COMMENT_BODY,\r
'show_gravatar': settings.FORM_GRAVATAR_IN_COMMENTS,\r
'showing': showing,\r
- 'total': len(all_comments),\r
+ 'total': total,\r
+ 'more_comments_count' : int(total - showing),\r
'user': user,\r
}\r
\r