Merge branch 'master' into forum
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 10 Sep 2013 13:34:08 +0000 (15:34 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 10 Sep 2013 13:34:08 +0000 (15:34 +0200)
Conflicts:
edumed/templates/home.html

48 files changed:
catalogue/templates/catalogue/lesson/lesson_detail.html
edumed/forms.py [new file with mode: 0755]
edumed/forum.py [new file with mode: 0755]
edumed/locale-contrib/django.pot [new file with mode: 0644]
edumed/locale-contrib/pl/LC_MESSAGES/django.mo [new file with mode: 0644]
edumed/locale-contrib/pl/LC_MESSAGES/django.po [new file with mode: 0644]
edumed/locale/pl/LC_MESSAGES/django.mo
edumed/locale/pl/LC_MESSAGES/django.po
edumed/settings.d/30-apps.py
edumed/settings.d/30-locale.py
edumed/settings.d/40-context.py
edumed/settings.d/40-middleware.py
edumed/settings.d/50-contrib.py
edumed/settings.d/50-static.py
edumed/static/css/_mixins.scss [new file with mode: 0644]
edumed/static/css/_vars.scss [new file with mode: 0644]
edumed/static/css/base.css
edumed/static/css/base.scss
edumed/static/css/forum.css [new file with mode: 0644]
edumed/static/css/forum.scss [new file with mode: 0755]
edumed/templates/base.html
edumed/templates/base_forum.html [new file with mode: 0755]
edumed/templates/home.html
edumed/templates/pybb/_need_to_login_message.html [new file with mode: 0755]
edumed/templates/pybb/avatar.html [new file with mode: 0755]
edumed/templates/pybb/breadcrumb.html [new file with mode: 0755]
edumed/templates/pybb/breadcrumb_top_extra_crumb.html [new file with mode: 0755]
edumed/urls.py
edumed/views.py
forum/__init__.py [new file with mode: 0644]
forum/forms.py [new file with mode: 0644]
forum/locale/pl/LC_MESSAGES/django.mo [new file with mode: 0644]
forum/locale/pl/LC_MESSAGES/django.po [new file with mode: 0644]
forum/middleware.py [new file with mode: 0644]
forum/migrations/0001_initial.py [new file with mode: 0644]
forum/migrations/__init__.py [new file with mode: 0644]
forum/models.py [new file with mode: 0644]
forum/search_indexes.py [new file with mode: 0644]
forum/templates/forum/related_lesson_info.html [new file with mode: 0644]
forum/templates/forum/search_results.html [new file with mode: 0644]
forum/templates/pybb/forum_last_update_info.html [new file with mode: 0644]
forum/templates/pybb/post_form.html [new file with mode: 0644]
forum/templates/pybb/topic.html [new file with mode: 0644]
forum/templates/pybb/topic_last_message_info.html [new file with mode: 0644]
forum/templates/search/indexes/pybb/post_text.txt [new file with mode: 0644]
forum/urls.py [new file with mode: 0644]
forum/views.py [new file with mode: 0644]
requirements.txt

index c6f726a..f08b5b8 100755 (executable)
 </p>
 
 </footer>
+
+
+{% if request.user.is_authenticated and object.forum_topics.all.count %}
+    <h2>Na forum</h2>
+    <ul>
+    {% for forum_topic in object.forum_topics.all %}
+        <li><a href="{{forum_topic.pybb_topic.get_absolute_url}}">{{forum_topic.pybb_topic.name}}</a></li>
+    {% endfor %}
+    </ul>
+{% endif %}
+
 </div>
 
 {% endblock %}
diff --git a/edumed/forms.py b/edumed/forms.py
new file mode 100755 (executable)
index 0000000..554779f
--- /dev/null
@@ -0,0 +1,17 @@
+from django import forms
+from django.utils.translation import ugettext_lazy as _
+from pybb.forms import EditProfileForm
+from pybb import util
+
+
+class AvatarlessEditProfileForm(EditProfileForm):
+    signature = forms.CharField(
+        widget=forms.Textarea(attrs={'rows': 2, 'cols:': 60}),
+        required=False,
+        label = _('Signature')
+    )
+
+    class Meta:
+        model = util.get_pybb_profile_model()
+        fields = ['signature', 'time_zone', 'language',
+                      'show_signatures']
diff --git a/edumed/forum.py b/edumed/forum.py
new file mode 100755 (executable)
index 0000000..4b194a8
--- /dev/null
@@ -0,0 +1,25 @@
+from pybb.permissions import DefaultPermissionHandler
+
+
+class ForumPermissionHandler(DefaultPermissionHandler):
+    def may_post_as_admin(self, user):
+        """ return True if `user` may post as admin """
+        return False
+
+    def may_create_topic(self, user, forum):
+        """ return True if `user` is allowed to create a new topic in `forum` """
+        return user.is_authenticated()
+
+    def may_create_post(self, user, topic):
+        """ return True if `user` is allowed to create a new post in `topic` """
+
+        if topic.forum.hidden and (not user.is_staff):
+            # if topic is hidden, only staff may post
+            return False
+
+        if topic.closed and (not user.is_staff):
+            # if topic is closed, only staff may post
+            return False
+
+        return user.is_authenticated()
+        
\ No newline at end of file
diff --git a/edumed/locale-contrib/django.pot b/edumed/locale-contrib/django.pot
new file mode 100644 (file)
index 0000000..c231cd9
--- /dev/null
@@ -0,0 +1,715 @@
+# Translations template for PROJECT.
+# Copyright (C) 2013 ORGANIZATION
+# This file is distributed under the same license as the PROJECT project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2013.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2013-08-09 11:40+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 1.3\n"
+
+#: pybb/admin.py:40
+#: pybb/admin.py:66
+#: pybb/admin.py:94
+#: pybb/admin.py:116
+msgid "Additional options"
+msgstr ""
+
+#: pybb/admin.py:99
+#: pybb/models.py:254
+msgid "Message"
+msgstr ""
+
+#: pybb/admin.py:130
+msgid "View post"
+msgstr ""
+
+#: pybb/admin.py:135
+msgid "Edit post"
+msgstr ""
+
+#: pybb/feeds.py:25
+#: pybb/feeds.py:26
+#: pybb/templates/pybb/base.html:12
+msgid "Latest posts on forum"
+msgstr ""
+
+#: pybb/feeds.py:35
+#: pybb/feeds.py:36
+#: pybb/templates/pybb/base.html:13
+msgid "Latest topics on forum"
+msgstr ""
+
+#: pybb/forms.py:27
+msgid "Attachment is too big"
+msgstr ""
+
+#: pybb/forms.py:47
+#, python-format
+msgid "You cant add more than %s answers for poll"
+msgstr ""
+
+#: pybb/forms.py:49
+msgid "Add two or more answers for this poll"
+msgstr ""
+
+#: pybb/forms.py:109
+msgid "Polls question is required when adding a poll"
+msgstr ""
+
+#: pybb/forms.py:192
+#, python-format
+msgid "Avatar is too large, max size: %s bytes"
+msgstr ""
+
+#: pybb/models.py:68
+#: pybb/models.py:99
+msgid "Name"
+msgstr ""
+
+#: pybb/models.py:69
+#: pybb/models.py:100
+msgid "Position"
+msgstr ""
+
+#: pybb/models.py:70
+#: pybb/models.py:106
+#: pybb/templates/pybb/category.html:5
+#: pybb/templates/pybb/category.html:28
+msgid "Hidden"
+msgstr ""
+
+#: pybb/models.py:71
+msgid "If checked, this category will be visible only for staff"
+msgstr ""
+
+#: pybb/models.py:76
+#: pybb/models.py:98
+msgid "Category"
+msgstr ""
+
+#: pybb/models.py:77
+msgid "Categories"
+msgstr ""
+
+#: pybb/models.py:101
+msgid "Description"
+msgstr ""
+
+#: pybb/models.py:102
+msgid "Moderators"
+msgstr ""
+
+#: pybb/models.py:103
+#: pybb/models.py:165
+#: pybb/models.py:270
+msgid "Updated"
+msgstr ""
+
+#: pybb/models.py:104
+#: pybb/models.py:172
+#: pybb/models.py:357
+msgid "Post count"
+msgstr ""
+
+#: pybb/models.py:105
+msgid "Topic count"
+msgstr ""
+
+#: pybb/models.py:108
+msgid "Headline"
+msgstr ""
+
+#: pybb/models.py:112
+#: pybb/models.py:162
+#: pybb/templates/pybb/category.html:10
+msgid "Forum"
+msgstr ""
+
+#: pybb/models.py:113
+msgid "Forums"
+msgstr ""
+
+#: pybb/models.py:157
+msgid "None"
+msgstr ""
+
+#: pybb/models.py:158
+msgid "Single answer"
+msgstr ""
+
+#: pybb/models.py:159
+msgid "Multiple answers"
+msgstr ""
+
+#: pybb/models.py:163
+msgid "Subject"
+msgstr ""
+
+#: pybb/models.py:164
+#: pybb/models.py:269
+msgid "Created"
+msgstr ""
+
+#: pybb/models.py:166
+#: pybb/models.py:268
+#: pybb/models.py:381
+#: pybb/models.py:512
+#: pybb/templates/pybb/mail_templates/subscription_email_body.html:3
+msgid "User"
+msgstr ""
+
+#: pybb/models.py:167
+msgid "Views count"
+msgstr ""
+
+#: pybb/models.py:168
+#: pybb/templates/pybb/topic_list.html:27
+msgid "Sticky"
+msgstr ""
+
+#: pybb/models.py:169
+#: pybb/templates/pybb/topic_list.html:28
+msgid "Closed"
+msgstr ""
+
+#: pybb/models.py:170
+#: pybb/templates/pybb/topic.html:92
+msgid "Subscribers"
+msgstr ""
+
+#: pybb/models.py:174
+#: pybb/models.py:272
+msgid "On moderation"
+msgstr ""
+
+#: pybb/models.py:175
+msgid "Poll type"
+msgstr ""
+
+#: pybb/models.py:176
+msgid "Poll question"
+msgstr ""
+
+#: pybb/models.py:180
+#: pybb/models.py:267
+#: pybb/models.py:489
+#: pybb/templates/pybb/topic_list.html:7
+msgid "Topic"
+msgstr ""
+
+#: pybb/models.py:181
+#: pybb/templates/pybb/category.html:13
+msgid "Topics"
+msgstr ""
+
+#: pybb/models.py:255
+msgid "HTML version"
+msgstr ""
+
+#: pybb/models.py:256
+msgid "Text version"
+msgstr ""
+
+#: pybb/models.py:271
+msgid "User IP"
+msgstr ""
+
+#: pybb/models.py:276
+#: pybb/models.py:397
+msgid "Post"
+msgstr ""
+
+#: pybb/models.py:277
+#: pybb/templates/pybb/category.html:16
+#: pybb/templates/pybb/topic_list.html:10
+msgid "Posts"
+msgstr ""
+
+#: pybb/models.py:346
+msgid "Signature"
+msgstr ""
+
+#: pybb/models.py:348
+msgid "Signature HTML Version"
+msgstr ""
+
+#: pybb/models.py:350
+msgid "Time zone"
+msgstr ""
+
+#: pybb/models.py:352
+msgid "Language"
+msgstr ""
+
+#: pybb/models.py:355
+msgid "Show signatures"
+msgstr ""
+
+#: pybb/models.py:358
+msgid "Avatar"
+msgstr ""
+
+#: pybb/models.py:360
+msgid "Automatically subscribe"
+msgstr ""
+
+#: pybb/models.py:361
+msgid "Automatically subscribe to topics that you answer"
+msgstr ""
+
+#: pybb/models.py:384
+msgid "Profile"
+msgstr ""
+
+#: pybb/models.py:385
+msgid "Profiles"
+msgstr ""
+
+#: pybb/models.py:394
+#: pybb/templates/pybb/post_template.html:73
+msgid "Attachment"
+msgstr ""
+
+#: pybb/models.py:395
+msgid "Attachments"
+msgstr ""
+
+#: pybb/models.py:398
+msgid "Size"
+msgstr ""
+
+#: pybb/models.py:399
+msgid "File"
+msgstr ""
+
+#: pybb/models.py:447
+msgid "Topic read tracker"
+msgstr ""
+
+#: pybb/models.py:448
+msgid "Topic read trackers"
+msgstr ""
+
+#: pybb/models.py:483
+msgid "Forum read tracker"
+msgstr ""
+
+#: pybb/models.py:484
+msgid "Forum read trackers"
+msgstr ""
+
+#: pybb/models.py:490
+msgid "Text"
+msgstr ""
+
+#: pybb/models.py:493
+#: pybb/models.py:511
+msgid "Poll answer"
+msgstr ""
+
+#: pybb/models.py:494
+msgid "Polls answers"
+msgstr ""
+
+#: pybb/models.py:516
+msgid "Poll answer user"
+msgstr ""
+
+#: pybb/models.py:517
+msgid "Polls answers users"
+msgstr ""
+
+#: pybb/util.py:58
+msgid "Can't get profile for anonymous user"
+msgstr ""
+
+#: pybb/views.py:648
+msgid "All forums marked as read"
+msgstr ""
+
+#: pybb/views.py:668
+msgid "User successfuly blocked"
+msgstr ""
+
+#: pybb/templates/pybb/_button_new_topic.html:2
+#: pybb/templates/pybb/add_post.html:24
+msgid "New topic"
+msgstr ""
+
+#: pybb/templates/pybb/_button_save.html:1
+msgid "Save"
+msgstr ""
+
+#: pybb/templates/pybb/_button_submit.html:1
+msgid "Submit"
+msgstr ""
+
+#: pybb/templates/pybb/_markitup.html:15
+msgid "Bold"
+msgstr ""
+
+#: pybb/templates/pybb/_markitup.html:16
+msgid "Italic"
+msgstr ""
+
+#: pybb/templates/pybb/_markitup.html:17
+msgid "Underline"
+msgstr ""
+
+#: pybb/templates/pybb/_markitup.html:18
+msgid "Stroke"
+msgstr ""
+
+#: pybb/templates/pybb/_markitup.html:20
+msgid "Picture"
+msgstr ""
+
+#: pybb/templates/pybb/_markitup.html:21
+msgid "Link"
+msgstr ""
+
+#: pybb/templates/pybb/_markitup.html:23
+msgid "Bulleted list"
+msgstr ""
+
+#: pybb/templates/pybb/_markitup.html:24
+msgid "Numeric list"
+msgstr ""
+
+#: pybb/templates/pybb/_markitup.html:25
+msgid "List item"
+msgstr ""
+
+#: pybb/templates/pybb/_markitup.html:27
+msgid "Quotes"
+msgstr ""
+
+#: pybb/templates/pybb/_markitup.html:28
+msgid "Code"
+msgstr ""
+
+#: pybb/templates/pybb/_markitup.html:30
+msgid "Clean"
+msgstr ""
+
+#: pybb/templates/pybb/_markitup.html:31
+msgid "Preview"
+msgstr ""
+
+#: pybb/templates/pybb/_need_to_login_message.html:3
+msgid "Register"
+msgstr ""
+
+#: pybb/templates/pybb/_need_to_login_message.html:3
+msgid "or"
+msgstr ""
+
+#: pybb/templates/pybb/_need_to_login_message.html:3
+msgid "login"
+msgstr ""
+
+#: pybb/templates/pybb/_need_to_login_message.html:3
+msgid "to create to post a reply"
+msgstr ""
+
+#: pybb/templates/pybb/add_post.html:24
+msgid "New reply"
+msgstr ""
+
+#: pybb/templates/pybb/attachments_formset.html:4
+msgid "Add attachments"
+msgstr ""
+
+#: pybb/templates/pybb/attachments_formset.html:10
+#: pybb/templates/pybb/edit_profile.html:27
+msgid "delete"
+msgstr ""
+
+#: pybb/templates/pybb/breadcrumb.html:5
+msgid "Home"
+msgstr ""
+
+#: pybb/templates/pybb/category.html:19
+msgid "Last posts"
+msgstr ""
+
+#: pybb/templates/pybb/category.html:44
+msgid "No forums created"
+msgstr ""
+
+#: pybb/templates/pybb/category.html:45
+msgid "Add forum now"
+msgstr ""
+
+#: pybb/templates/pybb/delete_post.html:5
+msgid "Are you sure you want to delete this message?"
+msgstr ""
+
+#: pybb/templates/pybb/delete_post.html:12
+msgid "No, take me back"
+msgstr ""
+
+#: pybb/templates/pybb/delete_post.html:13
+msgid "Yes, I am sure"
+msgstr ""
+
+#: pybb/templates/pybb/edit_post.html:4
+#: pybb/templates/pybb/edit_post.html:13
+msgid "Editing the post"
+msgstr ""
+
+#: pybb/templates/pybb/edit_profile.html:7
+#: pybb/templates/pybb/edit_profile.html:10
+#: pybb/templates/pybb/edit_profile.html:15
+msgid "Profile editing"
+msgstr ""
+
+#: pybb/templates/pybb/edit_profile.html:20
+msgid "Subscriptions on topics"
+msgstr ""
+
+#: pybb/templates/pybb/index.html:19
+msgid "Forum categories are not created"
+msgstr ""
+
+#: pybb/templates/pybb/index.html:20
+msgid "Add a category now"
+msgstr ""
+
+#: pybb/templates/pybb/index.html:25
+#: pybb/templates/pybb/latest_topics.html:7
+#: pybb/templates/pybb/latest_topics.html:17
+msgid "Last updates in topics"
+msgstr ""
+
+#: pybb/templates/pybb/index.html:28
+msgid "Mark all forums as read"
+msgstr ""
+
+#: pybb/templates/pybb/latest_topics.html:10
+msgid "\"Last updates in topics\""
+msgstr ""
+
+#: pybb/templates/pybb/latest_topics.html:33
+msgid "Mark all topics as read"
+msgstr ""
+
+#: pybb/templates/pybb/pagination.html:7
+msgid "previous page"
+msgstr ""
+
+#: pybb/templates/pybb/pagination.html:21
+msgid "next page"
+msgstr ""
+
+#: pybb/templates/pybb/poll.html:5
+msgid "Poll"
+msgstr ""
+
+#: pybb/templates/pybb/poll.html:37
+msgid "'Cancel my poll vote'"
+msgstr ""
+
+#: pybb/templates/pybb/poll_edit_form.html:7
+msgid "Poll answers"
+msgstr ""
+
+#: pybb/templates/pybb/poll_edit_form.html:20
+msgid "remove answer"
+msgstr ""
+
+#: pybb/templates/pybb/poll_edit_form.html:21
+msgid "add answer"
+msgstr ""
+
+#: pybb/templates/pybb/post_template.html:25
+msgid "Rank"
+msgstr ""
+
+#: pybb/templates/pybb/post_template.html:38
+#: pybb/templates/pybb/user.html:41
+msgid "Edit"
+msgstr ""
+
+#: pybb/templates/pybb/post_template.html:42
+msgid "Delete post?"
+msgstr ""
+
+#: pybb/templates/pybb/post_template.html:43
+msgid "Delete"
+msgstr ""
+
+#: pybb/templates/pybb/post_template.html:45
+msgid "Approve post"
+msgstr ""
+
+#: pybb/templates/pybb/post_template.html:50
+#: pybb/templates/pybb/topic.html:63
+msgid "Admin"
+msgstr ""
+
+#: pybb/templates/pybb/post_template.html:66
+msgid "Edited"
+msgstr ""
+
+#: pybb/templates/pybb/post_template.html:78
+msgid "quote"
+msgstr ""
+
+#: pybb/templates/pybb/topic.html:24
+#: pybb/templates/pybb/topic.html:44
+#: pybb/templates/pybb/user_posts.html:8
+msgid "'Posts'"
+msgstr ""
+
+#: pybb/templates/pybb/topic.html:52
+msgid "Unstick topic"
+msgstr ""
+
+#: pybb/templates/pybb/topic.html:54
+msgid "Stick topic"
+msgstr ""
+
+#: pybb/templates/pybb/topic.html:58
+msgid "Open topic"
+msgstr ""
+
+#: pybb/templates/pybb/topic.html:60
+msgid "Close topic"
+msgstr ""
+
+#: pybb/templates/pybb/topic.html:66
+msgid "Merge topics"
+msgstr ""
+
+#: pybb/templates/pybb/topic.html:71
+msgid "Unsubscribe"
+msgstr ""
+
+#: pybb/templates/pybb/topic.html:73
+msgid "Subscribe"
+msgstr ""
+
+#: pybb/templates/pybb/topic_list.html:13
+msgid "Views"
+msgstr ""
+
+#: pybb/templates/pybb/topic_list.html:16
+msgid "Last post"
+msgstr ""
+
+#: pybb/templates/pybb/topic_list.html:26
+msgid "Go to first unread post"
+msgstr ""
+
+#: pybb/templates/pybb/topic_list.html:32
+msgid "pages"
+msgstr ""
+
+#: pybb/templates/pybb/user.html:15
+msgid "Statistics"
+msgstr ""
+
+#: pybb/templates/pybb/user.html:18
+msgid "Number of topics"
+msgstr ""
+
+#: pybb/templates/pybb/user.html:24
+msgid "Number of posts"
+msgstr ""
+
+#: pybb/templates/pybb/user.html:28
+msgid "Date of registration"
+msgstr ""
+
+#: pybb/templates/pybb/user.html:35
+msgid "Block"
+msgstr ""
+
+#: pybb/templates/pybb/user.html:36
+msgid "Block and delete all messages"
+msgstr ""
+
+#: pybb/templates/pybb/user_posts.html:13
+msgid "All posts created by"
+msgstr ""
+
+#: pybb/templates/pybb/user_topics.html:8
+msgid "'Topics'"
+msgstr ""
+
+#: pybb/templates/pybb/user_topics.html:11
+#: pybb/templates/pybb/user_topics.html:15
+msgid "All topics created by"
+msgstr ""
+
+#: pybb/templates/pybb/users.html:8
+msgid "Users"
+msgstr ""
+
+#: pybb/templates/pybb/users.html:12
+msgid "Search"
+msgstr ""
+
+#: pybb/templates/pybb/users.html:24
+msgid "'Users'"
+msgstr ""
+
+#: pybb/templates/pybb/mail_templates/subscription_email_body.html:3
+msgid "replied in topic to which you are subscribed."
+msgstr ""
+
+#: pybb/templates/pybb/mail_templates/subscription_email_body.html:4
+msgid "Link to post:"
+msgstr ""
+
+#: pybb/templates/pybb/mail_templates/subscription_email_body.html:5
+msgid "Link to topic:"
+msgstr ""
+
+#: pybb/templates/pybb/mail_templates/subscription_email_body.html:8
+msgid ""
+"If you don't want to recive notifications on new messages in this topic "
+"visit following link:"
+msgstr ""
+
+#: pybb/templates/pybb/mail_templates/subscription_email_subject.html:2
+msgid "New answer in topic that you subscribed."
+msgstr ""
+
+#: pybb/templatetags/pybb_tags.py:61
+msgid "seconds ago,seconds ago,seconds ago"
+msgstr ""
+
+#: pybb/templatetags/pybb_tags.py:64
+msgid "seconds ago"
+msgstr ""
+
+#: pybb/templatetags/pybb_tags.py:70
+msgid "minutes ago,minutes ago,minutes ago"
+msgstr ""
+
+#: pybb/templatetags/pybb_tags.py:73
+msgid "minutes ago"
+msgstr ""
+
+#: pybb/templatetags/pybb_tags.py:83
+#, python-format
+msgid "today, %s"
+msgstr ""
+
+#: pybb/templatetags/pybb_tags.py:85
+#, python-format
+msgid "yesterday, %s"
+msgstr ""
+
diff --git a/edumed/locale-contrib/pl/LC_MESSAGES/django.mo b/edumed/locale-contrib/pl/LC_MESSAGES/django.mo
new file mode 100644 (file)
index 0000000..604f177
Binary files /dev/null and b/edumed/locale-contrib/pl/LC_MESSAGES/django.mo differ
diff --git a/edumed/locale-contrib/pl/LC_MESSAGES/django.po b/edumed/locale-contrib/pl/LC_MESSAGES/django.po
new file mode 100644 (file)
index 0000000..f2768dd
--- /dev/null
@@ -0,0 +1,677 @@
+# Polish translations for PROJECT.
+# Copyright (C) 2013 ORGANIZATION
+# This file is distributed under the same license as the PROJECT project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2013.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2013-08-09 11:40+0200\n"
+"PO-Revision-Date: 2013-08-09 12:17+0100\n"
+"Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
+"Language-Team: pl <LL@li.org>\n"
+"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
+"|| n%100>=20) ? 1 : 2);\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 1.3\n"
+"X-Generator: Poedit 1.5.4\n"
+
+#: pybb/admin.py:40 pybb/admin.py:66 pybb/admin.py:94 pybb/admin.py:116
+msgid "Additional options"
+msgstr ""
+
+#: pybb/admin.py:99 pybb/models.py:254
+msgid "Message"
+msgstr ""
+
+#: pybb/admin.py:130
+msgid "View post"
+msgstr ""
+
+#: pybb/admin.py:135
+msgid "Edit post"
+msgstr ""
+
+#: pybb/feeds.py:25 pybb/feeds.py:26 pybb/templates/pybb/base.html:12
+msgid "Latest posts on forum"
+msgstr ""
+
+#: pybb/feeds.py:35 pybb/feeds.py:36 pybb/templates/pybb/base.html:13
+msgid "Latest topics on forum"
+msgstr ""
+
+#: pybb/forms.py:27
+msgid "Attachment is too big"
+msgstr ""
+
+#: pybb/forms.py:47
+#, python-format
+msgid "You cant add more than %s answers for poll"
+msgstr ""
+
+#: pybb/forms.py:49
+msgid "Add two or more answers for this poll"
+msgstr ""
+
+#: pybb/forms.py:109
+msgid "Polls question is required when adding a poll"
+msgstr ""
+
+#: pybb/forms.py:192
+#, python-format
+msgid "Avatar is too large, max size: %s bytes"
+msgstr ""
+
+#: pybb/models.py:68 pybb/models.py:99
+msgid "Name"
+msgstr ""
+
+#: pybb/models.py:69 pybb/models.py:100
+msgid "Position"
+msgstr ""
+
+#: pybb/models.py:70 pybb/models.py:106 pybb/templates/pybb/category.html:5
+#: pybb/templates/pybb/category.html:28
+msgid "Hidden"
+msgstr ""
+
+#: pybb/models.py:71
+msgid "If checked, this category will be visible only for staff"
+msgstr ""
+
+#: pybb/models.py:76 pybb/models.py:98
+msgid "Category"
+msgstr ""
+
+#: pybb/models.py:77
+msgid "Categories"
+msgstr ""
+
+#: pybb/models.py:101
+msgid "Description"
+msgstr ""
+
+#: pybb/models.py:102
+msgid "Moderators"
+msgstr ""
+
+#: pybb/models.py:103 pybb/models.py:165 pybb/models.py:270
+msgid "Updated"
+msgstr ""
+
+#: pybb/models.py:104 pybb/models.py:172 pybb/models.py:357
+msgid "Post count"
+msgstr ""
+
+#: pybb/models.py:105
+msgid "Topic count"
+msgstr ""
+
+#: pybb/models.py:108
+msgid "Headline"
+msgstr ""
+
+#: pybb/models.py:112 pybb/models.py:162 pybb/templates/pybb/category.html:10
+msgid "Forum"
+msgstr ""
+
+#: pybb/models.py:113
+msgid "Forums"
+msgstr ""
+
+#: pybb/models.py:157
+msgid "None"
+msgstr ""
+
+#: pybb/models.py:158
+msgid "Single answer"
+msgstr ""
+
+#: pybb/models.py:159
+msgid "Multiple answers"
+msgstr ""
+
+#: pybb/models.py:163
+msgid "Subject"
+msgstr ""
+
+#: pybb/models.py:164 pybb/models.py:269
+msgid "Created"
+msgstr ""
+
+#: pybb/models.py:166 pybb/models.py:268 pybb/models.py:381 pybb/models.py:512
+#: pybb/templates/pybb/mail_templates/subscription_email_body.html:3
+msgid "User"
+msgstr ""
+
+#: pybb/models.py:167
+msgid "Views count"
+msgstr ""
+
+#: pybb/models.py:168 pybb/templates/pybb/topic_list.html:27
+msgid "Sticky"
+msgstr ""
+
+#: pybb/models.py:169 pybb/templates/pybb/topic_list.html:28
+msgid "Closed"
+msgstr ""
+
+#: pybb/models.py:170 pybb/templates/pybb/topic.html:92
+msgid "Subscribers"
+msgstr ""
+
+#: pybb/models.py:174 pybb/models.py:272
+msgid "On moderation"
+msgstr ""
+
+#: pybb/models.py:175
+msgid "Poll type"
+msgstr ""
+
+#: pybb/models.py:176
+msgid "Poll question"
+msgstr ""
+
+#: pybb/models.py:180 pybb/models.py:267 pybb/models.py:489
+#: pybb/templates/pybb/topic_list.html:7
+msgid "Topic"
+msgstr ""
+
+#: pybb/models.py:181 pybb/templates/pybb/category.html:13
+msgid "Topics"
+msgstr ""
+
+#: pybb/models.py:255
+msgid "HTML version"
+msgstr ""
+
+#: pybb/models.py:256
+msgid "Text version"
+msgstr ""
+
+#: pybb/models.py:271
+msgid "User IP"
+msgstr ""
+
+#: pybb/models.py:276 pybb/models.py:397
+msgid "Post"
+msgstr ""
+
+#: pybb/models.py:277 pybb/templates/pybb/category.html:16
+#: pybb/templates/pybb/topic_list.html:10
+msgid "Posts"
+msgstr ""
+
+#: pybb/models.py:346
+msgid "Signature"
+msgstr "Podpis"
+
+#: pybb/models.py:348
+msgid "Signature HTML Version"
+msgstr ""
+
+#: pybb/models.py:350
+msgid "Time zone"
+msgstr ""
+
+#: pybb/models.py:352
+msgid "Language"
+msgstr ""
+
+#: pybb/models.py:355
+msgid "Show signatures"
+msgstr ""
+
+#: pybb/models.py:358
+msgid "Avatar"
+msgstr ""
+
+#: pybb/models.py:360
+msgid "Automatically subscribe"
+msgstr ""
+
+#: pybb/models.py:361
+msgid "Automatically subscribe to topics that you answer"
+msgstr ""
+
+#: pybb/models.py:384
+msgid "Profile"
+msgstr ""
+
+#: pybb/models.py:385
+msgid "Profiles"
+msgstr ""
+
+#: pybb/models.py:394 pybb/templates/pybb/post_template.html:73
+msgid "Attachment"
+msgstr ""
+
+#: pybb/models.py:395
+msgid "Attachments"
+msgstr ""
+
+#: pybb/models.py:398
+msgid "Size"
+msgstr ""
+
+#: pybb/models.py:399
+msgid "File"
+msgstr ""
+
+#: pybb/models.py:447
+msgid "Topic read tracker"
+msgstr ""
+
+#: pybb/models.py:448
+msgid "Topic read trackers"
+msgstr ""
+
+#: pybb/models.py:483
+msgid "Forum read tracker"
+msgstr ""
+
+#: pybb/models.py:484
+msgid "Forum read trackers"
+msgstr ""
+
+#: pybb/models.py:490
+msgid "Text"
+msgstr ""
+
+#: pybb/models.py:493 pybb/models.py:511
+msgid "Poll answer"
+msgstr ""
+
+#: pybb/models.py:494
+msgid "Polls answers"
+msgstr ""
+
+#: pybb/models.py:516
+msgid "Poll answer user"
+msgstr ""
+
+#: pybb/models.py:517
+msgid "Polls answers users"
+msgstr ""
+
+#: pybb/util.py:58
+msgid "Can't get profile for anonymous user"
+msgstr ""
+
+#: pybb/views.py:648
+msgid "All forums marked as read"
+msgstr ""
+
+#: pybb/views.py:668
+msgid "User successfuly blocked"
+msgstr ""
+
+#: pybb/templates/pybb/_button_new_topic.html:2
+#: pybb/templates/pybb/add_post.html:24
+msgid "New topic"
+msgstr ""
+
+#: pybb/templates/pybb/_button_save.html:1
+msgid "Save"
+msgstr ""
+
+#: pybb/templates/pybb/_button_submit.html:1
+msgid "Submit"
+msgstr ""
+
+#: pybb/templates/pybb/_markitup.html:15
+msgid "Bold"
+msgstr "Pogrubienie"
+
+#: pybb/templates/pybb/_markitup.html:16
+msgid "Italic"
+msgstr "Kursywa"
+
+#: pybb/templates/pybb/_markitup.html:17
+msgid "Underline"
+msgstr "Podkreślenie"
+
+#: pybb/templates/pybb/_markitup.html:18
+msgid "Stroke"
+msgstr "Przekreślenie"
+
+#: pybb/templates/pybb/_markitup.html:20
+msgid "Picture"
+msgstr "Obrazek"
+
+#: pybb/templates/pybb/_markitup.html:21
+msgid "Link"
+msgstr ""
+
+#: pybb/templates/pybb/_markitup.html:23
+msgid "Bulleted list"
+msgstr "Lista wypunktowana"
+
+#: pybb/templates/pybb/_markitup.html:24
+msgid "Numeric list"
+msgstr "Lista numerowana"
+
+#: pybb/templates/pybb/_markitup.html:25
+msgid "List item"
+msgstr "Element listy"
+
+#: pybb/templates/pybb/_markitup.html:27
+msgid "Quotes"
+msgstr "Cytat"
+
+#: pybb/templates/pybb/_markitup.html:28
+msgid "Code"
+msgstr "Kod"
+
+#: pybb/templates/pybb/_markitup.html:30
+msgid "Clean"
+msgstr ""
+
+#: pybb/templates/pybb/_markitup.html:31
+msgid "Preview"
+msgstr "Podgląd"
+
+#: pybb/templates/pybb/_need_to_login_message.html:3
+msgid "Register"
+msgstr ""
+
+#: pybb/templates/pybb/_need_to_login_message.html:3
+msgid "or"
+msgstr ""
+
+#: pybb/templates/pybb/_need_to_login_message.html:3
+msgid "login"
+msgstr ""
+
+#: pybb/templates/pybb/_need_to_login_message.html:3
+msgid "to create to post a reply"
+msgstr ""
+
+#: pybb/templates/pybb/add_post.html:24
+msgid "New reply"
+msgstr ""
+
+#: pybb/templates/pybb/attachments_formset.html:4
+msgid "Add attachments"
+msgstr ""
+
+#: pybb/templates/pybb/attachments_formset.html:10
+#: pybb/templates/pybb/edit_profile.html:27
+msgid "delete"
+msgstr ""
+
+#: pybb/templates/pybb/breadcrumb.html:5
+msgid "Home"
+msgstr ""
+
+#: pybb/templates/pybb/category.html:19
+msgid "Last posts"
+msgstr ""
+
+#: pybb/templates/pybb/category.html:44
+msgid "No forums created"
+msgstr ""
+
+#: pybb/templates/pybb/category.html:45
+msgid "Add forum now"
+msgstr ""
+
+#: pybb/templates/pybb/delete_post.html:5
+msgid "Are you sure you want to delete this message?"
+msgstr ""
+
+#: pybb/templates/pybb/delete_post.html:12
+msgid "No, take me back"
+msgstr ""
+
+#: pybb/templates/pybb/delete_post.html:13
+msgid "Yes, I am sure"
+msgstr ""
+
+#: pybb/templates/pybb/edit_post.html:4 pybb/templates/pybb/edit_post.html:13
+msgid "Editing the post"
+msgstr ""
+
+#: pybb/templates/pybb/edit_profile.html:7
+#: pybb/templates/pybb/edit_profile.html:10
+#: pybb/templates/pybb/edit_profile.html:15
+msgid "Profile editing"
+msgstr ""
+
+#: pybb/templates/pybb/edit_profile.html:20
+msgid "Subscriptions on topics"
+msgstr ""
+
+#: pybb/templates/pybb/index.html:19
+msgid "Forum categories are not created"
+msgstr ""
+
+#: pybb/templates/pybb/index.html:20
+msgid "Add a category now"
+msgstr ""
+
+#: pybb/templates/pybb/index.html:25 pybb/templates/pybb/latest_topics.html:7
+#: pybb/templates/pybb/latest_topics.html:17
+msgid "Last updates in topics"
+msgstr "Ostatnio modyfikowane tematy"
+
+#: pybb/templates/pybb/index.html:28
+msgid "Mark all forums as read"
+msgstr ""
+
+#: pybb/templates/pybb/latest_topics.html:10
+msgid "\"Last updates in topics\""
+msgstr ""
+
+#: pybb/templates/pybb/latest_topics.html:33
+msgid "Mark all topics as read"
+msgstr "Oznacz wszystkie tematy jako przeczytane"
+
+#: pybb/templates/pybb/pagination.html:7
+msgid "previous page"
+msgstr ""
+
+#: pybb/templates/pybb/pagination.html:21
+msgid "next page"
+msgstr ""
+
+#: pybb/templates/pybb/poll.html:5
+msgid "Poll"
+msgstr ""
+
+#: pybb/templates/pybb/poll.html:37
+msgid "'Cancel my poll vote'"
+msgstr "Anuluj mój głos w ankiecie"
+
+#: pybb/templates/pybb/poll_edit_form.html:7
+msgid "Poll answers"
+msgstr ""
+
+#: pybb/templates/pybb/poll_edit_form.html:20
+msgid "remove answer"
+msgstr ""
+
+#: pybb/templates/pybb/poll_edit_form.html:21
+msgid "add answer"
+msgstr ""
+
+#: pybb/templates/pybb/post_template.html:25
+msgid "Rank"
+msgstr ""
+
+#: pybb/templates/pybb/post_template.html:38 pybb/templates/pybb/user.html:41
+msgid "Edit"
+msgstr ""
+
+#: pybb/templates/pybb/post_template.html:42
+msgid "Delete post?"
+msgstr ""
+
+#: pybb/templates/pybb/post_template.html:43
+msgid "Delete"
+msgstr ""
+
+#: pybb/templates/pybb/post_template.html:45
+msgid "Approve post"
+msgstr ""
+
+#: pybb/templates/pybb/post_template.html:50 pybb/templates/pybb/topic.html:63
+msgid "Admin"
+msgstr ""
+
+#: pybb/templates/pybb/post_template.html:66
+msgid "Edited"
+msgstr ""
+
+#: pybb/templates/pybb/post_template.html:78
+msgid "quote"
+msgstr ""
+
+#: pybb/templates/pybb/topic.html:24 pybb/templates/pybb/topic.html:44
+#: pybb/templates/pybb/user_posts.html:8
+msgid "'Posts'"
+msgstr "'Posty'"
+
+#: pybb/templates/pybb/topic.html:52
+msgid "Unstick topic"
+msgstr ""
+
+#: pybb/templates/pybb/topic.html:54
+msgid "Stick topic"
+msgstr ""
+
+#: pybb/templates/pybb/topic.html:58
+msgid "Open topic"
+msgstr ""
+
+#: pybb/templates/pybb/topic.html:60
+msgid "Close topic"
+msgstr ""
+
+#: pybb/templates/pybb/topic.html:66
+msgid "Merge topics"
+msgstr "Połącz wątki"
+
+#: pybb/templates/pybb/topic.html:71
+msgid "Unsubscribe"
+msgstr ""
+
+#: pybb/templates/pybb/topic.html:73
+msgid "Subscribe"
+msgstr ""
+
+#: pybb/templates/pybb/topic_list.html:13
+msgid "Views"
+msgstr ""
+
+#: pybb/templates/pybb/topic_list.html:16
+msgid "Last post"
+msgstr ""
+
+#: pybb/templates/pybb/topic_list.html:26
+msgid "Go to first unread post"
+msgstr "Zobacz pierwszy nieprzeczytany post"
+
+#: pybb/templates/pybb/topic_list.html:32
+msgid "pages"
+msgstr ""
+
+#: pybb/templates/pybb/user.html:15
+msgid "Statistics"
+msgstr ""
+
+#: pybb/templates/pybb/user.html:18
+msgid "Number of topics"
+msgstr ""
+
+#: pybb/templates/pybb/user.html:24
+msgid "Number of posts"
+msgstr ""
+
+#: pybb/templates/pybb/user.html:28
+msgid "Date of registration"
+msgstr ""
+
+#: pybb/templates/pybb/user.html:35
+msgid "Block"
+msgstr ""
+
+#: pybb/templates/pybb/user.html:36
+msgid "Block and delete all messages"
+msgstr "Zablokuj i usuń wszystkie posty"
+
+#: pybb/templates/pybb/user_posts.html:13
+msgid "All posts created by"
+msgstr "Wszystkie posty utworzone przez"
+
+#: pybb/templates/pybb/user_topics.html:8
+msgid "'Topics'"
+msgstr "'Tematy'"
+
+#: pybb/templates/pybb/user_topics.html:11
+#: pybb/templates/pybb/user_topics.html:15
+msgid "All topics created by"
+msgstr ""
+
+#: pybb/templates/pybb/users.html:8
+msgid "Users"
+msgstr ""
+
+#: pybb/templates/pybb/users.html:12
+msgid "Search"
+msgstr ""
+
+#: pybb/templates/pybb/users.html:24
+msgid "'Users'"
+msgstr "'Użytkownicy'"
+
+#: pybb/templates/pybb/mail_templates/subscription_email_body.html:3
+msgid "replied in topic to which you are subscribed."
+msgstr ""
+
+#: pybb/templates/pybb/mail_templates/subscription_email_body.html:4
+msgid "Link to post:"
+msgstr ""
+
+#: pybb/templates/pybb/mail_templates/subscription_email_body.html:5
+msgid "Link to topic:"
+msgstr ""
+
+#: pybb/templates/pybb/mail_templates/subscription_email_body.html:8
+msgid ""
+"If you don't want to recive notifications on new messages in this topic "
+"visit following link:"
+msgstr ""
+
+#: pybb/templates/pybb/mail_templates/subscription_email_subject.html:2
+msgid "New answer in topic that you subscribed."
+msgstr ""
+
+#: pybb/templatetags/pybb_tags.py:61
+msgid "seconds ago,seconds ago,seconds ago"
+msgstr ""
+
+#: pybb/templatetags/pybb_tags.py:64
+msgid "seconds ago"
+msgstr ""
+
+#: pybb/templatetags/pybb_tags.py:70
+msgid "minutes ago,minutes ago,minutes ago"
+msgstr ""
+
+#: pybb/templatetags/pybb_tags.py:73
+msgid "minutes ago"
+msgstr ""
+
+#: pybb/templatetags/pybb_tags.py:83
+#, python-format
+msgid "today, %s"
+msgstr ""
+
+#: pybb/templatetags/pybb_tags.py:85
+#, python-format
+msgid "yesterday, %s"
+msgstr ""
index bd15844..6c2cbcf 100644 (file)
Binary files a/edumed/locale/pl/LC_MESSAGES/django.mo and b/edumed/locale/pl/LC_MESSAGES/django.mo differ
index ffd5d7b..86361c7 100644 (file)
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-11-19 15:57+0100\n"
+"POT-Creation-Date: 2013-09-04 13:32+0200\n"
 "PO-Revision-Date: 2012-11-19 15:58+0100\n"
 "Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -26,3 +26,7 @@ msgstr "Strona nie znaleziona"
 msgid "The page you were looking for doesn't exist."
 msgstr "Strona której szukasz nie została znaleziona."
 
+#: templates/base_forum.html:7
+msgid "Forum search"
+msgstr "Szukaj na forum"
+
index 521839b..6a8d656 100644 (file)
@@ -15,6 +15,9 @@ INSTALLED_APPS = (
     'haystack',
     'chunks',
     'contact',
+    'forum',
+    'pybb',
+    'django_libravatar',
     'sorl.thumbnail',
 
     'django.contrib.auth',
@@ -26,4 +29,5 @@ INSTALLED_APPS = (
     'django.contrib.admin',
     'django.contrib.admindocs',
     'django.contrib.flatpages',
+    'django.contrib.humanize'
 )
index d77583d..40f6617 100644 (file)
@@ -28,3 +28,10 @@ USE_L10N = True
 
 # If you set this to False, Django will not use timezone-aware datetimes.
 USE_TZ = True
+
+CONTRIB_LOCALE_APPS = (
+    'pybb',
+)
+LOCALE_PATHS = (
+    path.join(PROJECT_DIR, 'edumed/locale-contrib'),
+)
index e161e0b..0cf10b8 100644 (file)
@@ -8,5 +8,6 @@ TEMPLATE_CONTEXT_PROCESSORS = tuple(x for x in (
     "django.core.context_processors.tz",
     "django.contrib.messages.context_processors.messages"
             if 'django.contrib.messages' in INSTALLED_APPS else None,
-    "django.core.context_processors.request"
+    "django.core.context_processors.request",
+    'pybb.context_processors.processor',
 ) if x is not None)
index 34780d8..b9c614d 100644 (file)
@@ -21,5 +21,7 @@ MIDDLEWARE_CLASSES = tuple(x for x in (
     'pagination.middleware.PaginationMiddleware'
             if "pagination" in INSTALLED_APPS else None,
     'django.middleware.cache.FetchFromCacheMiddleware',
-    'fnpdjango.middleware.SetRemoteAddrFromXRealIP'
+    'fnpdjango.middleware.SetRemoteAddrFromXRealIP',
+    'pybb.middleware.PybbMiddleware',
+    'forum.middleware.ForumMiddleware'
 ) if x is not None)
index 9291ce5..64770e8 100644 (file)
@@ -4,4 +4,10 @@ CAS_VERSION = '1'
 SPONSORS_THUMB_WIDTH = 100
 SPONSORS_THUMB_HEIGHT = 56
 
-HONEYPOT_FIELD_NAME='miut'
+PYBB_TEMPLATE = "base_forum.html"
+PYBB_SMILES = {}
+PYBB_ENABLE_ANONYMOUS_POST = False
+
+PYBB_DEFAULT_TITLE = u'Forum'
+PYBB_DEFAULT_TIME_ZONE = 1
+PYBB_PERMISSION_HANDLER = 'edumed.forum.ForumPermissionHandler'
index 4013a66..780ce01 100644 (file)
@@ -25,6 +25,8 @@ PIPELINE_CSS = {
           'catalogue/css/section_list.scss',
           'curriculum/curriculum.scss',
           'jquery/colorbox/colorbox.css',
+
+          'css/forum.scss',
         ),
         'output_filename': 'compressed/base.css',
     },
@@ -40,6 +42,8 @@ PIPELINE_JS = {
             'catalogue/js/lesson.js',
             'sponsors/js/sponsors.js',
             'curriculum/curriculum.js',
+
+            'pybb/js/pybbjs.js',
         ),
         'output_filename': 'compressed/base.js',
     },
diff --git a/edumed/static/css/_mixins.scss b/edumed/static/css/_mixins.scss
new file mode 100644 (file)
index 0000000..6b9499c
--- /dev/null
@@ -0,0 +1,7 @@
+@import "vars";
+
+@mixin base-font {
+    font-family: Dosis;
+    background: white;
+    color: $ciemny;
+}
\ No newline at end of file
diff --git a/edumed/static/css/_vars.scss b/edumed/static/css/_vars.scss
new file mode 100644 (file)
index 0000000..a502ca4
--- /dev/null
@@ -0,0 +1,4 @@
+$px: .0625em;
+$oranji: #ed7831;
+$ciemny: #363a3e;
+$zielony: #16a487;
\ No newline at end of file
index c59a82d..95fb533 100644 (file)
@@ -9,9 +9,9 @@ a {
 
 body {
   font-family: Dosis;
-  margin: 0;
   background: white;
-  color: #363a3e; }
+  color: #363a3e;
+  margin: 0; }
 
 .clr {
   clear: both; }
@@ -22,9 +22,9 @@ body {
   background-position: 0 100%; }
 
 header.main {
-  margin: 0 auto 1.438em;
+  margin: 0 auto 1.4375em;
   width: 58.75em;
-  padding: 1.813em 0.625em 0; }
+  padding: 1.8125em 0.625em 0; }
   header.main #logo {
     float: left;
     margin-bottom: 1.25em; }
@@ -44,7 +44,7 @@ header.main {
     list-style: none;
     display: inline-block;
     text-transform: uppercase;
-    margin: 0 .5em;
+    margin: 0 0.5em;
     text-align: center;
     /*position:relative;*/ }
   header.main nav a {
@@ -203,5 +203,5 @@ footer.main {
     margin: 1em 0; }
 
 .flatpage img {
-  border: 0.313em solid #eeeeee;
+  border: 0.3125em solid #eeeeee;
   margin: 1.3em; }
index c29938d..38f8a09 100644 (file)
@@ -1,9 +1,7 @@
 @import url(http://fonts.googleapis.com/css?family=Dosis:400,700&subset=latin,latin-ext);
 
-$px: .0625em;
-$oranji: #ed7831;
-$ciemny: #363a3e;
-$zielony: #16a487;
+@import "vars";
+@import "mixins";
 
 
 a {
@@ -16,10 +14,8 @@ a {
 }
 
 body {
-    font-family: Dosis;
+    @include base-font;
     margin: 0;
-    background: white;
-    color: $ciemny;
 }
 .clr {
     clear: both;
diff --git a/edumed/static/css/forum.css b/edumed/static/css/forum.css
new file mode 100644 (file)
index 0000000..1c0b056
--- /dev/null
@@ -0,0 +1,89 @@
+ul.breadcrumb {
+  margin: 0;
+  padding: 0;
+  list-style: none; }
+  ul.breadcrumb li {
+    display: inline; }
+
+.forum-body {
+  position: relative;
+  /* --- Unread --- */
+  /* --- Moderation --- */
+  /* --- Mini pagination --- */ }
+  .forum-body .search-result em {
+    background-color: yellow; }
+  .forum-body .pagination ul {
+    margin: 0;
+    padding: 0;
+    list-style: none; }
+    .forum-body .pagination ul li {
+      display: inline-block; }
+      .forum-body .pagination ul li a {
+        display: block;
+        padding: .5em; }
+    .forum-body .pagination ul .disabled a {
+      color: black; }
+  .forum-body .table {
+    width: 100%;
+    margin: 1em 0; }
+  .forum-body .forum-description {
+    margin: 5px; }
+  .forum-body .forum-row, .forum-body .topic-row {
+    width: 100%; }
+  .forum-body .forum-name, .forum-body .topic-name {
+    width: 40%;
+    text-align: left; }
+  .forum-body .forum-topic-count, .forum-body .forum-post-count, .forum-body .topic-post-count, .forum-body .topic-view-count {
+    width: 10%;
+    text-align: center; }
+  .forum-body .forum-last-post, .forum-body .topic-last-post {
+    width: 32%;
+    text-align: center; }
+  .forum-body .first-unread-post-link, .forum-body .first-unread-post-link:hover {
+    text-decoration: none; }
+  .forum-body .post:nth-child(4n+4) {
+    background-color: #eaeaea; }
+  .forum-body .post-header {
+    padding: 3px 0 3px 20px; }
+    .forum-body .post-header th {
+      text-align: left; }
+  .forum-body .post-info {
+    width: 200px;
+    padding: 10px; }
+    .forum-body .post-info .post-author {
+      padding: 5px 0; }
+  .forum-body .post-content {
+    vertical-align: top;
+    padding: 10px; }
+  .forum-body .post-signature {
+    color: #CCC;
+    margin-top: 15px;
+    border-top: 1px dotted #cccccc;
+    display: block; }
+  .forum-body .post-related {
+    margin-top: 20px; }
+  .forum-body .forum-headline {
+    margin-top: 10px; }
+  .forum-body .attachments-form {
+    padding-bottom: 15px; }
+  .forum-body .attachment-link {
+    border-bottom: 1px dotted; }
+  .forum-body .state-indicator {
+    display: block;
+    float: left;
+    height: 10px;
+    width: 10px;
+    margin: 3px 5px; }
+  .forum-body .topic-unread a, .forum-body .forum-unread a {
+    font-weight: bold; }
+  .forum-body .on-moderation {
+    background: #ffcccc; }
+  .forum-body .mini-pagination {
+    padding: 3px 0 3px 10px; }
+  .forum-body .post-form input, .forum-body .post-form textarea {
+    font-family: Dosis;
+    background: white;
+    color: #363a3e;
+    font-size: 1.6em; }
+  .forum-body .post-form #id_name {
+    width: 698px; }
diff --git a/edumed/static/css/forum.scss b/edumed/static/css/forum.scss
new file mode 100755 (executable)
index 0000000..e1a3d58
--- /dev/null
@@ -0,0 +1,180 @@
+@import "mixins";
+
+
+ul.breadcrumb {
+    margin: 0;
+    padding: 0;
+    list-style: none;
+    li {
+        display: inline;
+    }
+}
+
+
+
+.forum-body {
+
+    position: relative;
+
+    .search-result {
+        em {
+            background-color: yellow;
+        }
+    }
+
+    .pagination {
+        ul {
+            margin: 0;
+            padding: 0;
+            list-style: none;
+
+            li {
+                display: inline-block;
+                a {
+                    display: block;
+                    padding: .5em;
+                }
+            }
+
+            .disabled {
+                a {
+                    color: black;
+                }
+            }
+        }
+    }
+
+    .table {
+        width: 100%;
+        margin: 1em 0;
+    }
+
+    .forum-description {
+        margin: 5px;
+    }
+
+    .forum-row, .topic-row {
+        width: 100%;
+    }
+
+    .forum-name, .topic-name {
+        width: 40%;
+        text-align: left;
+    }
+
+    .forum-topic-count, .forum-post-count, .topic-post-count, .topic-view-count {
+        width: 10%;
+        text-align: center;
+    }
+
+    .forum-last-post, .topic-last-post {
+        width: 32%;
+        text-align: center;
+    }
+
+    .first-unread-post-link, .first-unread-post-link:hover {
+        text-decoration: none;
+    }
+
+
+
+    .post:nth-child(4n+4) {
+        background-color: lighten(#D0D0D0 , 10%);
+    }
+
+    .post-header {
+       padding: 3px 0 3px 20px;
+       th {
+            text-align: left;
+       }
+    }
+
+    .post-info {
+        width: 200px;
+        padding: 10px;
+
+        .avatar {
+
+        }
+
+        .post-author {
+            padding: 5px 0;
+        }
+
+        .post-extra-info {
+        }
+
+        .post-controls {
+        }
+    }
+
+    .post-content {
+        vertical-align: top;
+        padding: 10px;
+    }
+
+    .post-signature {
+        color: #CCC;
+        margin-top: 15px;
+        border-top: 1px dotted #CCC;
+        display: block;
+    }
+
+    .post-related {
+        margin-top: 20px;
+    }
+
+
+
+
+    .forum-headline {
+        margin-top: 10px;
+    }
+
+    .attachments-form {
+        padding-bottom: 15px;
+    }
+
+    .attachment-link {
+        border-bottom: 1px dotted;
+    }
+
+    /* --- Unread --- */
+
+    .state-indicator {
+        display: block;
+        float: left;
+        height: 10px;
+        width: 10px;
+        margin: 3px 5px;
+    }
+
+    .topic-unread, .forum-unread {
+        a {
+            font-weight: bold;
+        }
+        .state-indicator {
+        }
+    }
+
+    /* --- Moderation --- */
+    .on-moderation {
+        background: #ffcccc;
+    }
+
+    /* --- Mini pagination --- */
+    .mini-pagination {
+        padding: 3px 0 3px 10px;
+    }
+
+
+    .post-form {
+        input, textarea {
+            @include base-font;
+            font-size: 1.6em;
+        }
+        #id_name {
+            width: 698px;
+        }
+    }
+}
index 6233cf3..5486d6d 100644 (file)
@@ -30,6 +30,9 @@
                 src="{% static "tlo.png" %}"
                 style="position:absolute; opacity: 0.5; top:0; left: -83px; z-index:1000"
                 -->
+            {% if request.user.is_authenticated %}
+                <a href="{% url 'logout' %}" style="position: absolute; top:5px; right: 10px; font-size: 12px;">Wyloguj</a>
+            {% endif %}
             <div id="header-top">
             <a id="logo" href="/"><img src="{% static "img/logo.png" %}" alt="Edukacja medialna"/></a>
             <div id="organizer">
@@ -96,6 +99,7 @@
 
     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
     {% compressed_js 'base' %}
+    {% block extra_script %}{% endblock %}
     {{ piwik_tag|safe }}
     </body>
 </html>
diff --git a/edumed/templates/base_forum.html b/edumed/templates/base_forum.html
new file mode 100755 (executable)
index 0000000..587a1e8
--- /dev/null
@@ -0,0 +1,10 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block body %}
+<div class="forum-body">
+    {% block breadcrumb %}{% endblock %}
+    <a href="{% url 'forum_search' %}" style="position: absolute; top: 0; right: 5px;">{% trans 'Forum search' %}</a>
+    {% block content %}{% endblock %}
+</div>
+{% endblock %}
index ac03e7d..3a82a7b 100755 (executable)
@@ -43,6 +43,7 @@
     <li><a href="{{ package_student_url }}">Pobierz wszystkie lekcje w&nbsp;wersji dla ucznia</a></li>
     <li><a href="{% url 'catalogue_lesson' 'slowniczek' %}">Słowniczek</a></li>
     <li><a href="{% url 'catalogue_lesson' 'metody' %}">Metody edukacyjne</a></li>
+    {% if request.user.is_authenticated %}<li><a href="{% url 'pybb:index' %}">Forum</a></li>{% endif %}
     <li><a href="{% url 'info' 'infografiki' %}">Infografiki</a></li>
     <li><a href="http://nowoczesnapolska.org.pl/prywatnosc/">Polityka prywatności i ciasteczka</a></li>
 </ul>
diff --git a/edumed/templates/pybb/_need_to_login_message.html b/edumed/templates/pybb/_need_to_login_message.html
new file mode 100755 (executable)
index 0000000..bcc8550
--- /dev/null
@@ -0,0 +1,2 @@
+{% load i18n %}
+<a href="{% url 'login' %}">{% trans "Login" %} / {% trans "register" %}</a> {% trans "to create to post a reply" %}.
diff --git a/edumed/templates/pybb/avatar.html b/edumed/templates/pybb/avatar.html
new file mode 100755 (executable)
index 0000000..0358753
--- /dev/null
@@ -0,0 +1,8 @@
+{% load pybb_tags %}
+{% load libravatar_tags %}
+<div class="avatar">
+    {% pybb_get_profile user=user as user_profile %}
+    <a href="{{ user_profile.get_absolute_url }}">
+        <img src="{% libravatar user.email PYBB_AVATAR_WIDTH %}" alt="{{ user }} libravatar" width="{{ PYBB_AVATAR_WIDTH }}" height="{{ PYBB_AVATAR_HEIGHT }}" />
+    </a>
+</div>
diff --git a/edumed/templates/pybb/breadcrumb.html b/edumed/templates/pybb/breadcrumb.html
new file mode 100755 (executable)
index 0000000..a537281
--- /dev/null
@@ -0,0 +1,20 @@
+{% load i18n pybb_tags %}
+<ul class='breadcrumb'>
+    {% include "pybb/breadcrumb_top_extra_crumb.html" %}
+    <li><a href="{% url 'pybb:index' %}">Forum</a> <span class="divider">/</span></li>
+    {% if object %}
+        {% if object.get_parents %}
+            {% for obj in object.get_parents %}
+                <li>{% pybb_link obj %} <span class="divider">/</span></li>
+            {% endfor %}
+        {% endif %}
+        {% if extra_crumb %}
+            <li>{% pybb_link object %} <span class="divider">/</span></li>
+        {% else %}
+            <li>{{ object }}</li>
+        {% endif %}
+    {% endif %}
+    {% if extra_crumb %}
+        <li>{% trans extra_crumb %}</li>
+    {% endif %}
+</ul>
diff --git a/edumed/templates/pybb/breadcrumb_top_extra_crumb.html b/edumed/templates/pybb/breadcrumb_top_extra_crumb.html
new file mode 100755 (executable)
index 0000000..dd09f97
--- /dev/null
@@ -0,0 +1 @@
+<li><a href="{% url 'home' %}">Strona główna</a> <span class="divider">/</span></li>
index 3e99b30..ff55310 100644 (file)
@@ -1,17 +1,20 @@
 from django.conf.urls import patterns, include, url
 from django.conf import settings
-from .views import HomeView
+from .views import HomeView, AvatarlessProfileEditView
+
 
 
 urlpatterns = patterns('',
     url(r'^$', HomeView.as_view(), name="home"),
     url(r'^kompetencje/', include('curriculum.urls')),
     url(r'^lekcje/', include('catalogue.urls')),
-#    url(r'^i/', include('django.contrib.flatpages.urls')),
     url(r'^info/(?P<url>.*)$', 'django.contrib.flatpages.views.flatpage',
         name="info"),
     url(r'^szukaj/', include('haystack.urls')),
     url(r'^zglos/', include('contact.urls')),
+    url(r'^forum/profile/edit/$', AvatarlessProfileEditView.as_view(), name='edit_profile'),
+    url(r'^forum/', include('forum.urls')),
+    url(r'^forum/', include('pybb.urls', namespace='pybb')),
 )
 
 
@@ -20,6 +23,10 @@ if 'django.contrib.admin' in settings.INSTALLED_APPS:
     from django.contrib import admin
     admin.autodiscover()
 
+    if 'django_cas' in settings.INSTALLED_APPS:
+        urlpatterns += patterns('',
+            (r'^admin/logout/$', 'django_cas.views.logout'),
+        )
     urlpatterns += patterns('',
         url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
         url(r'^admin/', include(admin.site.urls)),
@@ -28,8 +35,8 @@ if 'django.contrib.admin' in settings.INSTALLED_APPS:
 # Auth stuff, if necessary
 if 'django_cas' in settings.INSTALLED_APPS:
     urlpatterns += patterns('',
-        (r'^accounts/login/$', 'django_cas.views.login'),
-        (r'^accounts/logout/$', 'django_cas.views.logout'),
+        url(r'^accounts/login/$', 'django_cas.views.login', name='login'),
+        url(r'^accounts/logout/$', 'django_cas.views.logout', name='logout'),
     )
 
 
index b497716..bde67ef 100755 (executable)
@@ -1,6 +1,9 @@
 import os.path
 from django.conf import settings
 from django.views.generic import TemplateView
+from pybb.views import ProfileEditView
+from .forms import AvatarlessEditProfileForm
+
 
 class HomeView(TemplateView):
     template_name="home.html"
@@ -10,3 +13,6 @@ class HomeView(TemplateView):
         context['package_url'] = os.path.join(settings.MEDIA_URL, settings.CATALOGUE_PACKAGE)
         context['package_student_url'] = os.path.join(settings.MEDIA_URL, settings.CATALOGUE_PACKAGE_STUDENT)
         return context
+
+class AvatarlessProfileEditView(ProfileEditView):
+    form_class = AvatarlessEditProfileForm
diff --git a/forum/__init__.py b/forum/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/forum/forms.py b/forum/forms.py
new file mode 100644 (file)
index 0000000..9e931db
--- /dev/null
@@ -0,0 +1,39 @@
+from django import forms
+from django.forms.models import ModelChoiceIterator
+from django.utils.translation import ugettext as _
+import pybb.forms
+
+from catalogue.models import Lesson
+
+
+class GroupedModelChoiceIterator(ModelChoiceIterator):
+    def __init__(self, field):
+        super(GroupedModelChoiceIterator, self).__init__(field)
+        self.queryset = self.field.grouping_model.objects
+        self.items_queryset = self.field.queryset
+    
+    def choice(self, obj):
+        items_query = self.items_queryset.filter(**{self.field.grouping_fk_field: obj})
+        items = [super(GroupedModelChoiceIterator, self).choice(item) for item in items_query.all()]
+        return (unicode(obj), items)
+
+
+class GroupedModelChoiceField(forms.ModelChoiceField):
+    
+    def __init__(self, queryset, grouping_fk_field, **kwargs):
+        self.grouping_fk_field = grouping_fk_field
+        self.grouping_model = queryset.model._meta.get_field(grouping_fk_field).rel.to
+        super(GroupedModelChoiceField, self).__init__(queryset, **kwargs)
+
+    def _get_choices(self):
+        toret = super(GroupedModelChoiceField, self)._get_choices()
+        if isinstance(toret, ModelChoiceIterator):
+            toret = GroupedModelChoiceIterator(self)
+        return toret
+
+    choices = property(_get_choices, forms.ModelChoiceField.choices.fset)
+
+
+class PostForm(pybb.forms.PostForm):
+    lesson = GroupedModelChoiceField(label = _('Related lesson'), queryset = Lesson.objects.all(),
+        grouping_fk_field = 'section', required = False)
diff --git a/forum/locale/pl/LC_MESSAGES/django.mo b/forum/locale/pl/LC_MESSAGES/django.mo
new file mode 100644 (file)
index 0000000..219ea2a
Binary files /dev/null and b/forum/locale/pl/LC_MESSAGES/django.mo differ
diff --git a/forum/locale/pl/LC_MESSAGES/django.po b/forum/locale/pl/LC_MESSAGES/django.po
new file mode 100644 (file)
index 0000000..bc13e50
--- /dev/null
@@ -0,0 +1,60 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-08-29 10:00+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
+"|| n%100>=20) ? 1 : 2);\n"
+
+#: forms.py:9 templates/forum/related_lesson_info.html:2
+msgid "Related lesson"
+msgstr "Powiązana lekcja"
+
+#: templates/pybb/topic.html:27 templates/pybb/topic.html.py:47
+msgid "Posts"
+msgstr ""
+
+#: templates/pybb/topic.html:55
+msgid "Unstick topic"
+msgstr ""
+
+#: templates/pybb/topic.html:57
+msgid "Stick topic"
+msgstr ""
+
+#: templates/pybb/topic.html:61
+msgid "Open topic"
+msgstr ""
+
+#: templates/pybb/topic.html:63
+msgid "Close topic"
+msgstr ""
+
+#: templates/pybb/topic.html:66
+msgid "Admin"
+msgstr ""
+
+#: templates/pybb/topic.html:75
+msgid "Unsubscribe"
+msgstr ""
+
+#: templates/pybb/topic.html:77
+msgid "Subscribe"
+msgstr ""
+
+#: templates/pybb/topic.html:96
+msgid "Subscribers"
+msgstr ""
diff --git a/forum/middleware.py b/forum/middleware.py
new file mode 100644 (file)
index 0000000..fb0a605
--- /dev/null
@@ -0,0 +1,14 @@
+from urllib import urlencode
+
+from django.contrib.auth import REDIRECT_FIELD_NAME
+from django.http import HttpResponseRedirect
+from django.core.urlresolvers import reverse
+from django_cas.views import login as cas_login
+
+
+class ForumMiddleware:
+    def process_request(self, request):
+        if request.path.startswith(reverse('pybb:index')) \
+            and (not hasattr(request, 'user') or not request.user.is_authenticated()):
+            params = urlencode({REDIRECT_FIELD_NAME: request.get_full_path()})
+            return HttpResponseRedirect(reverse(cas_login) + '?' + params)
diff --git a/forum/migrations/0001_initial.py b/forum/migrations/0001_initial.py
new file mode 100644 (file)
index 0000000..3a80106
--- /dev/null
@@ -0,0 +1,164 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding model 'Topic'
+        db.create_table(u'forum_topic', (
+            ('pybb_topic', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['pybb.Topic'], unique=True, primary_key=True)),
+            ('lesson', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.Lesson'], null=True, blank=True)),
+        ))
+        db.send_create_signal(u'forum', ['Topic'])
+
+
+    def backwards(self, orm):
+        # Deleting model 'Topic'
+        db.delete_table(u'forum_topic')
+
+
+    models = {
+        u'auth.group': {
+            'Meta': {'object_name': 'Group'},
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        u'auth.permission': {
+            'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
+            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        },
+        u'auth.user': {
+            'Meta': {'object_name': 'User'},
+            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+        },
+        u'catalogue.lesson': {
+            'Meta': {'ordering': "['section', 'level', 'order']", 'object_name': 'Lesson'},
+            'curriculum_courses': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['curriculum.CurriculumCourse']", 'symmetrical': 'False', 'blank': 'True'}),
+            'dc': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}),
+            'html_file': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'level': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['curriculum.Level']"}),
+            'order': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
+            'package': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+            'pdf': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+            'section': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['catalogue.Section']", 'null': 'True', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}),
+            'student_package': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+            'student_pdf': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'type': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}),
+            'xml_file': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
+        },
+        u'catalogue.section': {
+            'Meta': {'ordering': "['order']", 'object_name': 'Section'},
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+            'order': ('django.db.models.fields.IntegerField', [], {}),
+            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}),
+            'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
+            'xml_file': ('django.db.models.fields.files.FileField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'})
+        },
+        u'contenttypes.contenttype': {
+            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        u'curriculum.curriculumcourse': {
+            'Meta': {'ordering': "['slug']", 'object_name': 'CurriculumCourse'},
+            'accusative': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'slug': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        u'curriculum.level': {
+            'Meta': {'ordering': "['order']", 'object_name': 'Level'},
+            'group': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'order': ('django.db.models.fields.IntegerField', [], {}),
+            'slug': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        u'forum.topic': {
+            'Meta': {'object_name': 'Topic'},
+            'lesson': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['catalogue.Lesson']", 'null': 'True', 'blank': 'True'}),
+            'pybb_topic': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['pybb.Topic']", 'unique': 'True', 'primary_key': 'True'})
+        },
+        u'pybb.category': {
+            'Meta': {'ordering': "['position']", 'object_name': 'Category'},
+            'hidden': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
+            'position': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'})
+        },
+        u'pybb.forum': {
+            'Meta': {'ordering': "['position']", 'object_name': 'Forum'},
+            'category': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'forums'", 'to': u"orm['pybb.Category']"}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'headline': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'hidden': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'moderators': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
+            'position': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
+            'post_count': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
+            'readed_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'readed_forums'", 'symmetrical': 'False', 'through': u"orm['pybb.ForumReadTracker']", 'to': u"orm['auth.User']"}),
+            'topic_count': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
+            'updated': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'})
+        },
+        u'pybb.forumreadtracker': {
+            'Meta': {'unique_together': "(('user', 'forum'),)", 'object_name': 'ForumReadTracker'},
+            'forum': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['pybb.Forum']", 'null': 'True', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'time_stamp': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"})
+        },
+        u'pybb.topic': {
+            'Meta': {'ordering': "['-created']", 'object_name': 'Topic'},
+            'closed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'created': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+            'forum': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'topics'", 'to': u"orm['pybb.Forum']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'on_moderation': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'poll_question': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'poll_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'post_count': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
+            'readed_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'readed_topics'", 'symmetrical': 'False', 'through': u"orm['pybb.TopicReadTracker']", 'to': u"orm['auth.User']"}),
+            'sticky': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'subscribers': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'subscriptions'", 'blank': 'True', 'to': u"orm['auth.User']"}),
+            'updated': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}),
+            'views': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'})
+        },
+        u'pybb.topicreadtracker': {
+            'Meta': {'unique_together': "(('user', 'topic'),)", 'object_name': 'TopicReadTracker'},
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'time_stamp': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+            'topic': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['pybb.Topic']", 'null': 'True', 'blank': 'True'}),
+            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"})
+        }
+    }
+
+    complete_apps = ['forum']
\ No newline at end of file
diff --git a/forum/migrations/__init__.py b/forum/migrations/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/forum/models.py b/forum/models.py
new file mode 100644 (file)
index 0000000..7a9c359
--- /dev/null
@@ -0,0 +1,12 @@
+from django.db import models
+from django.db.models.signals import post_save
+
+import pybb.models
+
+from catalogue.models import Lesson
+
+
+class Topic(models.Model):
+    pybb_topic = models.OneToOneField(pybb.models.Topic, primary_key = True, related_name = 'edumed_topic')
+    lesson = models.ForeignKey(Lesson, null = True, blank = True, related_name = 'forum_topics')
+    
\ No newline at end of file
diff --git a/forum/search_indexes.py b/forum/search_indexes.py
new file mode 100644 (file)
index 0000000..5add363
--- /dev/null
@@ -0,0 +1,9 @@
+from haystack import indexes
+from pybb.models import Post
+
+
+class PostIndex(indexes.SearchIndex, indexes.Indexable):
+    text = indexes.CharField(document=True, use_template=True)
+
+    def get_model(self):
+        return Post
diff --git a/forum/templates/forum/related_lesson_info.html b/forum/templates/forum/related_lesson_info.html
new file mode 100644 (file)
index 0000000..1f807f6
--- /dev/null
@@ -0,0 +1,4 @@
+{% load i18n %}
+{% if lesson %}
+<h5 style="margin-top: -20px;">{% trans 'Related lesson' %}: <a href="{{lesson.get_absolute_url}}">{{lesson.title}}</a></h5>
+{% endif %}
\ No newline at end of file
diff --git a/forum/templates/forum/search_results.html b/forum/templates/forum/search_results.html
new file mode 100644 (file)
index 0000000..b656a40
--- /dev/null
@@ -0,0 +1,41 @@
+{% extends 'pybb/base.html' %}
+{% load i18n %}
+
+
+{% block content %}
+    
+        <h1>{% trans 'Search' %}</h1>
+        <form method="get">
+            {{form.q}}
+            <tr>
+                <td>&nbsp;</td>
+                <td>
+                    <input type="submit" value="{% trans 'Search' %}">
+                </td>
+            </tr>
+        </form>
+
+    {% if query %}
+        <hr/>
+        {% for result in page.object_list %}
+            <p class="search-result">
+                <strong>Temat:</strong> <a href="{{ result.object.get_absolute_url }}">{{ result.object.topic.name }}</a><br/>
+                {% autoescape off %}
+                {% for snippet in result.highlighted.text %}
+                    {{snippet}}{% if not forloop.last %} <strong>...</strong> {% endif %}
+                {% endfor %}
+                {% endautoescape %}
+            </p>
+        {% empty %}
+            <p>Brak wyników.</p>
+        {% endfor %}
+
+        {% if page.has_previous or page.has_next %}
+            <div>
+                {% if page.has_previous %}<a href="?q={{ query }}&amp;page={{ page.previous_page_number }}">{% endif %}&laquo; Poprzednie{% if page.has_previous %}</a>{% endif %}
+                |
+                {% if page.has_next %}<a href="?q={{ query }}&amp;page={{ page.next_page_number }}">{% endif %}Następne &raquo;{% if page.has_next %}</a>{% endif %}
+            </div>
+        {% endif %}
+    {% endif %}
+{% endblock %}
\ No newline at end of file
diff --git a/forum/templates/pybb/forum_last_update_info.html b/forum/templates/pybb/forum_last_update_info.html
new file mode 100644 (file)
index 0000000..c3256a9
--- /dev/null
@@ -0,0 +1,5 @@
+{% load humanize %}
+{% if forum.updated %}
+    {{ forum.last_post.user }}
+    {{ forum.updated|naturaltime }}
+{% endif %}
\ No newline at end of file
diff --git a/forum/templates/pybb/post_form.html b/forum/templates/pybb/post_form.html
new file mode 100644 (file)
index 0000000..5db31a4
--- /dev/null
@@ -0,0 +1,36 @@
+{% load url from future %}
+{% load i18n pybb_tags %}
+<form class="post-form" action="
+    {% if forum %}
+        {% url 'pybb:add_topic' forum.pk %}
+    {% else %}
+        {% if topic %}
+            {% url 'pybb:add_post' topic.pk %}
+        {% else %}
+            {% url 'pybb:edit_post' pk=object.pk %}
+        {% endif %}
+    {% endif %}" method="post" enctype="multipart/form-data">
+  {% csrf_token %}
+  <fieldset>
+    {% include "pybb/form_errors.html" %}
+    {% if form.name %} {% include "pybb/form_field.html" with field=form.name %} {% endif %}
+
+    {% if lesson_editable %}
+        {% include "pybb/form_field.html" with field=form.lesson %}
+    {% endif %}
+
+    {% if form.login %} {% include "pybb/form_field.html" with field=form.login %}  {% endif %}
+    {% if form.body %} {% include "pybb/form_field.html" with field=form.body %}  {% endif %}
+    <div id='emoticons'>
+      {% for smile, url in form.available_smiles.items %}
+        <a href='#' title='{{ smile|safe }}'><img src='{{ STATIC_URL }}{{ form.smiles_prefix }}{{ url }}'></a>
+      {% endfor %}
+    </div>
+
+    {% if form.poll_type and request.user.is_superuser %}
+      {% include "pybb/poll_edit_form.html" %}
+    {% endif %}
+    {% include "pybb/attachments_formset.html" %}
+    <p class="submit">{% include "pybb/_button_submit.html" %}</p>
+  </fieldset>
+</form>
diff --git a/forum/templates/pybb/topic.html b/forum/templates/pybb/topic.html
new file mode 100644 (file)
index 0000000..f11f2cb
--- /dev/null
@@ -0,0 +1,102 @@
+{% extends 'pybb/base.html' %}
+
+{% load url from future %}
+
+{% load pybb_tags i18n %}
+
+{% block title %}{{ topic }}{% endblock %}
+
+{% block extra_script %}
+    {{ block.super }}
+    {% include "pybb/_markitup.html" %}
+    <script type="text/javascript" src="{{ STATIC_URL }}pybb/js/jquery.formset.min.js"></script>
+{% endblock %}
+
+{% block breadcrumb %}
+    {% with object=topic %}
+        {% include "pybb/breadcrumb.html" %}
+    {% endwith %}
+{% endblock %}
+
+{% block content %}
+    <div class="topic">
+        <h1>{{ topic.name }}</h1>
+        
+        {% include 'forum/related_lesson_info.html' with lesson=topic.edumed_topic.lesson %}
+        
+        {% with _('Posts') as label %}
+            {% include "pybb/pagination.html" %}
+        {% endwith %}
+
+        {% if topic.poll_type %}
+            {% include 'pybb/poll.html' %}
+        {% endif %}
+
+        <div class="posts">
+            {% if first_post %}{% ifnotequal first_post post_list.0 %}
+                {% with first_post as post %}
+                    <li class="first_post">{% include "pybb/post_template.html" %}</li>
+                {% endwith %}
+            {% endifnotequal %}{% endif %}
+            {% for post in post_list %}
+                {% cycle 'odd' 'even' as rowcolors silent %}
+                {% include "pybb/post_template.html" %}
+            {% endfor %}
+        </div>
+        <div>&nbsp;</div>
+        {% with _('Posts') as label %}
+            {% include "pybb/pagination.html" %}
+        {% endwith %}
+
+        {% if user.is_authenticated %}
+            <div class="controls">
+                {% if user.is_moderator %}
+                    {% if topic.sticky %}
+                        <a href="{% url 'pybb:unstick_topic' topic.id %}">{% trans "Unstick topic" %}</a> /
+                    {% else %}
+                        <a href="{% url 'pybb:stick_topic' topic.id %}">{% trans "Stick topic" %}</a> /
+                    {% endif %}
+
+                    {% if topic.closed %}
+                        <a href="{% url 'pybb:open_topic' topic.id %}">{% trans "Open topic" %}</a> /
+                    {% else %}
+                        <a href="{% url 'pybb:close_topic' topic.id %}">{% trans "Close topic" %}</a> /
+                    {% endif %}
+                    {% if perms.pybb.change_topic and user.is_staff %}
+                        <a href="{% url 'admin:pybb_topic_change' topic.id %}">{% trans 'Admin' %}</a> /
+                    {% endif %}
+                    {% comment %}
+            <a href="{% url 'pybb:merge_topics' %}?topic={{ topic.id }}">{% trans 'Merge topics' %}</a> /
+            {% endcomment %}
+                {% endif %}
+
+                {% if user.is_subscribed %}
+                    <a href="{% url 'pybb:delete_subscription' topic.id %}?from_topic">{% trans "Unsubscribe" %}</a>
+                {% else %}
+                    <a href="{% url 'pybb:add_subscription' topic.id %}">{% trans "Subscribe" %}</a>
+                {% endif %}
+            </div>
+        {% endif %}
+
+        {% if user.is_authenticated or PYBB_ENABLE_ANONYMOUS_POST %}
+            {% pybb_get_profile user=user as user_profile %}
+
+            {% if not user_profile.is_banned %}
+                {% if not topic.closed %}
+                    {% include "pybb/post_form.html" %}
+                {% endif %}
+            {% endif %}
+        {% else %}
+            {% include 'pybb/_need_to_login_message.html' %}
+        {% endif %}
+
+        {% if user.is_staff %}
+            <div class="subscriber-list">
+                {% trans "Subscribers" %}:
+                {% for subscriber in topic.subscribers.all %}
+                    <a href="{% url 'pybb:user' subscriber.username %}">{{ subscriber.username }}</a>,
+                {% endfor %}
+            </div>
+        {% endif %}
+    </div>
+{% endblock %}
diff --git a/forum/templates/pybb/topic_last_message_info.html b/forum/templates/pybb/topic_last_message_info.html
new file mode 100644 (file)
index 0000000..ff49ffa
--- /dev/null
@@ -0,0 +1,6 @@
+{% load humanize %}
+{% if topic.updated %}
+    {{ topic.last_post.user }}
+    {{ topic.updated|naturaltime }}
+    
+{% endif %}
\ No newline at end of file
diff --git a/forum/templates/search/indexes/pybb/post_text.txt b/forum/templates/search/indexes/pybb/post_text.txt
new file mode 100644 (file)
index 0000000..c51be26
--- /dev/null
@@ -0,0 +1 @@
+{{object.body_text}}
\ No newline at end of file
diff --git a/forum/urls.py b/forum/urls.py
new file mode 100644 (file)
index 0000000..309e9a7
--- /dev/null
@@ -0,0 +1,23 @@
+from django.conf.urls import patterns, include, url
+from haystack.query import SearchQuerySet
+from haystack.views import SearchView, search_view_factory
+from haystack.forms import SearchForm
+from pybb.models import Post
+
+from .views import AddPostView, EditPostView
+
+
+urlpatterns = patterns('',
+    url(r'^forum/(?P<forum_id>\d+)/topic/add/$', AddPostView.as_view()),
+    url(r'^post/(?P<pk>\d+)/edit/$', EditPostView.as_view()),
+)
+
+PostsSearchQuerySet = SearchQuerySet().models(Post).highlight()
+
+urlpatterns += patterns('haystack.views',
+    url(r'^szukaj/$', search_view_factory(
+        view_class = SearchView,
+        template = 'forum/search_results.html',
+        searchqueryset = PostsSearchQuerySet,
+        form_class = SearchForm
+    ), name='forum_search'))
\ No newline at end of file
diff --git a/forum/views.py b/forum/views.py
new file mode 100644 (file)
index 0000000..41b7eb8
--- /dev/null
@@ -0,0 +1,59 @@
+from django.core.exceptions import ObjectDoesNotExist
+import pybb.views
+import pybb.forms
+
+from catalogue.models import Lesson
+
+from .forms import PostForm
+from .models import Topic
+
+
+class PostEditMixin(pybb.views.PostEditMixin):
+
+    def get_form_class(self):
+        toret = super(PostEditMixin, self).get_form_class()
+        if issubclass(toret, pybb.forms.PostForm):
+            toret = PostForm
+        return toret
+
+    def form_valid(self, form):
+        toret = super(PostEditMixin, self).form_valid(form)
+
+        pybb_post = self.object
+        pybb_topic = pybb_post.topic
+        topic, topic_created = Topic.objects.get_or_create(pybb_topic = pybb_topic)
+
+        if pybb_post == pybb_topic.head:
+            topic.lesson = form.cleaned_data['lesson']
+            topic.save()
+
+        return toret
+
+
+class AddPostView(PostEditMixin, pybb.views.AddPostView):
+    def get_context_data(self, **kwargs):
+        ctx = super(AddPostView, self).get_context_data(**kwargs)
+        ctx['lesson_editable'] = self._creates_new_topic()
+        return ctx
+
+    def _creates_new_topic(self):
+        return self.forum is not None
+
+
+class EditPostView(PostEditMixin, pybb.views.EditPostView):
+    def get_context_data(self, **kwargs):
+        ctx = super(EditPostView, self).get_context_data(**kwargs)
+        ctx['lesson_editable'] = self._edits_topics_head()
+        return ctx
+
+    def _edits_topics_head(self):
+        return self.object == self.object.topic.head
+
+    def get_form_kwargs(self):
+        kwargs = super(EditPostView, self).get_form_kwargs()
+        try:
+            lesson = self.object.topic.edumed_topic.lesson
+        except ObjectDoesNotExist:
+            lesson = None
+        kwargs['initial']['lesson'] = lesson
+        return kwargs
index 3db2e26..c96b02c 100644 (file)
@@ -29,4 +29,8 @@ django-sponsors>=1.1,<1.2
 django-haystack>=2.0,<2.1
 pysolr>=3,<4
 
+pybbm>=0.14,<0.15
+django-libravatar
+
 sorl-thumbnail>=11,<12
+