PKU8R) pdata/__init__.py# -*- coding: utf-8 -*- # vim: sw=4 ts=4 fenc=utf-8 # ============================================================================= # $Id: __init__.py 43 2008-02-21 18:08:40Z s0undt3ch $ # ============================================================================= # $URL: http://devnull.ufsoft.org/svn/ExtendedLatestCommentsWidget/trunk/__init__.py $ # $LastChangedDate: 2008-02-21 18:08:40 +0000 (Thu, 21 Feb 2008) $ # $Rev: 43 $ # $LastChangedBy: s0undt3ch $ # ============================================================================= # Copyright (C) 2007 Ufsoft.org - Pedro Algarvio # # Please view LICENSE for additional licensing information. # ============================================================================= from os.path import dirname, join from textpress.api import * from textpress.widgets import LatestComments TEMPLATES = join(dirname(__file__), 'templates') class ExtendedLatestComments(LatestComments): """ Show the latest n comments and the n words of each comment. """ NAME = 'get_latest_comments_extended' TEMPLATE = 'extended_latest_comments.html' def __init__(self, limit=5, show_title=False, max_words=10): self.max_words = max_words LatestComments.__init__(self, limit, show_title) @staticmethod def get_display_name(): return _('Latest Comments (Extended)') @staticmethod def configure_widget(initial_args, request): args = form = initial_args.copy() errors = [] if request.method == 'POST': args['limit'] = limit = request.form.get('limit') if not limit: args['limit'] = None elif not limit.isdigit(): errors.append(_('Limit must be omited or a valid number.')) else: args['limit'] = int(limit) args['max_words'] = max_words = request.form.get('max_words') if not max_words: args['max_words'] = None elif not max_words.isdigit(): errors.append(_('Limit must be omited or a valid number.')) else: args['max_words'] = int(max_words) args['show_title'] = request.form.get('show_title') == 'yes' if errors: args = None return args, render_template('admin/extended_latest_comments.html', errors=errors, form=form) def setup(app, plugin): app.add_template_searchpath(TEMPLATES) app.add_widget(ExtendedLatestComments) PK"Z8s%%pdata/metadata.txtName: Extended Latest Comments Widget Author: Pedro Algarvio, aka, s0undt3ch License: BSD Version: 1.0 Description: This is the same as the "Latest Comments" widget except it\ also shows 'n' words(configurable) words of each comment.
\
Contribute Back
\ If you think this plugin is usefull and would like\ to contribute back, feel free to click on the donate button.\ This is optional.\ \
\ \ \ \ \


\
\

PKKS8H-pdata/templates/extended_latest_comments.html{% extends 'widgets/base.html' %} {% block title %}{% trans 'Latest Comments' %}{% endblock %} {% block body %} {%- if widget.comments %} {%- endif %} {% endblock %} PKcZ8tB3pdata/templates/admin/extended_latest_comments.html{% for error in errors %}
{{ error }}
{% endfor %}
{% trans "Limit" %}
{{ h.input_field('limit', form.limit) }}
{% trans "Maximum Number Of Comment Words" %}
{{ h.input_field('max_words', form.max_words) }}
{% trans "Show Title" %}
{{ h.checkbox('show_title', form.show_title) }}
PK[8"TTEXTPRESS_PLUGINextended_latest_comments_widgetPK[8܃TEXTPRESS_PACKAGE1PKU8R) pdata/__init__.pyPK"Z8s%%< pdata/metadata.txtPKKS8H-pdata/templates/extended_latest_comments.htmlPKcZ8tB3pdata/templates/admin/extended_latest_comments.htmlPK[8"TTEXTPRESS_PLUGINPK[8܃TEXTPRESS_PACKAGEPK>