Branch: refs/heads/master Author: Enrico Tröger enrico.troeger@uvena.de Committer: Enrico Tröger enrico.troeger@uvena.de Date: Sun, 05 Jan 2014 18:29:22 UTC Commit: d82a171c820ce68b893aeff2b1310fb85b875171 https://github.com/geany/www.geany.org/commit/d82a171c820ce68b893aeff2b1310f...
Log Message: ----------- Implement IRC userlist page
This page dynamically reads currently connected IRC usernames from /var/tmp/irc_userlist which is filled by the IRC bot.
Modified Paths: -------------- geany/settings.py geany/templates/pages/richtextpage.html geany/templates/pages/support/irc.html geany/templatetags/geany_tags.py
Modified: geany/settings.py 2 files changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -399,6 +399,8 @@
NIGHTLYBUILDS_BASE_DIR = '/path/to/nightly/builds'
+IRC_USER_LIST_FILE = '/var/tmp/irc_userlist' +
LOGGING = { 'version': 1,
Modified: geany/templates/pages/richtextpage.html 6 files changed, 6 insertions(+), 0 deletions(-) =================================================================== @@ -6,6 +6,9 @@
<div class="well">
+{% block content_before %} +{% endblock %} + {% block richtext_content %}
{# render the content as template, e.g. to replace {{ geany_latest_version }} #} @@ -14,6 +17,9 @@ {# display #} {{ evaluated_content|richtext_filter|safe }}
+{% block content_after %} +{% endblock %} + {% endblock %}
</div>
Modified: geany/templates/pages/support/irc.html 25 files changed, 25 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,25 @@ +{% extends "pages/richtextpage.html" %} + +{% load geany_tags %} + +{% block content_after %} + +{% get_irc_userlist as irc_userlist %} + +<h2>Users</h2> + +<p>Currently {{ irc_userlist|length }} users are connected:</p> + +<div class="row"> +{% for username in irc_userlist %} + <div class="span2">{{ username }}</div> + + {% if forloop.counter|divisibleby:4 %} + </div> + <div class="row"> + {% endif %} +{% endfor %} +</div> + + +{% endblock %}
Modified: geany/templatetags/geany_tags.py 25 files changed, 22 insertions(+), 3 deletions(-) =================================================================== @@ -3,18 +3,22 @@ # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. -# +# # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see http://www.gnu.org/licenses/.
from django import template +from django.conf import settings +from mezzanine.template import Library +import logging
-register = template.Library() +register = Library() +logger = logging.getLogger(__name__)
######################################################################## @@ -51,3 +55,18 @@ def do_evaluate(parser, token): raise template.TemplateSyntaxError(u'%r tag requires a single argument' % token.contents.split()[1]) return EvaluateNode(variable, target_var_name) + + +#---------------------------------------------------------------------- +@register.as_tag +def get_irc_userlist(): + user_list = list() + try: + with open(settings.IRC_USER_LIST_FILE) as file_h: + user_list = file_h.readlines() + except IOError, e: + logger.error(u'An error occurred reading IRC user list: %s', unicode(e), exc_info=True) + + # remove newline characters + user_list = [username.strip() for username in user_list] + return sorted(user_list)
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).