Support for source names, developmentStage.
authorRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Mon, 30 Jun 2014 08:50:14 +0000 (10:50 +0200)
committerRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Mon, 30 Jun 2014 08:50:14 +0000 (10:50 +0200)
apps/catalogue/constants.py
apps/catalogue/locale/pl/LC_MESSAGES/django.mo
apps/catalogue/locale/pl/LC_MESSAGES/django.po
apps/catalogue/models/book.py
apps/catalogue/templates/catalogue/book_short.html
apps/catalogue/templates/catalogue/book_wide.html
apps/catalogue/templatetags/catalogue_tags.py
lib/librarian

index 36f4f5d..56fe939 100644 (file)
@@ -36,3 +36,9 @@ LANGUAGES_3TO2 = {
     'rus': 'ru',
     'ukr': 'uk',
 }
     'rus': 'ru',
     'ukr': 'uk',
 }
+
+SOURCE_NAMES = {
+    u'pl.wikisource.org': _(u'Wikisource'),
+    u'de.wikisource.org': _(u'Wikisource'),
+    u'www.polona.pl': u'CBN&nbsp;Polona',
+}
index 66ae688..5605ea8 100644 (file)
Binary files a/apps/catalogue/locale/pl/LC_MESSAGES/django.mo and b/apps/catalogue/locale/pl/LC_MESSAGES/django.mo differ
index 5eb1779..ecd213e 100644 (file)
@@ -1,16 +1,16 @@
-# 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.
+# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
 msgid ""
 msgstr ""
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
+"Project-Id-Version: WolneLektury\n"
 "Report-Msgid-Bugs-To: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-02-05 11:21+0100\n"
-"PO-Revision-Date: 2014-02-05 11:21+0100\n"
+"POT-Creation-Date: 2014-06-30 10:37+0200\n"
+"PO-Revision-Date: 2014-06-30 10:34+0100\n"
 "Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
 "Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language-Team: Fundacja Nowoczesna Polska <fundacja@nowoczesnapolska.org."
+"pl>\n"
+"Language: pl\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
@@ -22,6 +22,10 @@ msgid "Creative Commons Attribution-ShareAlike 3.0 Unported"
 msgstr ""
 "Creative Commons Uznanie autorstwa – Na tych samych warunkach 3.0 Unported"
 
 msgstr ""
 "Creative Commons Uznanie autorstwa – Na tych samych warunkach 3.0 Unported"
 
+#: constants.py:41 constants.py:42
+msgid "Wikisource"
+msgstr "Wikiźródła"
+
 #: forms.py:27
 msgid "Please supply an XML."
 msgstr "Proszę podać XML."
 #: forms.py:27
 msgid "Please supply an XML."
 msgstr "Proszę podać XML."
@@ -74,7 +78,7 @@ msgstr "Duży"
 msgid "Queue is full. Please try again later."
 msgstr "Kolejka jest pełna. Proszę spróbować ponownie później."
 
 msgid "Queue is full. Please try again later."
 msgstr "Kolejka jest pełna. Proszę spróbować ponownie później."
 
-#: views.py:597
+#: views.py:588
 #, python-format
 msgid ""
 "An error occurred: %(exception)s\n"
 #, python-format
 msgid ""
 "An error occurred: %(exception)s\n"
@@ -85,91 +89,95 @@ msgstr ""
 "\n"
 "%(tb)s"
 
 "\n"
 "%(tb)s"
 
-#: views.py:598
+#: views.py:589
 msgid "Book imported successfully"
 msgstr "Książka zaimportowana"
 
 msgid "Book imported successfully"
 msgstr "Książka zaimportowana"
 
-#: views.py:600
+#: views.py:591
 #, python-format
 msgid "Error importing file: %r"
 msgstr "Błąd podczas importowania pliku: %r"
 
 #, python-format
 msgid "Error importing file: %r"
 msgstr "Błąd podczas importowania pliku: %r"
 
-#: views.py:632
+#: views.py:623
 msgid "Download custom PDF"
 msgstr "Stwórz własny PDF"
 
 msgid "Download custom PDF"
 msgstr "Stwórz własny PDF"
 
-#: views.py:633 templates/catalogue/book_short.html:97
-#: templates/catalogue/book_wide.html:63
+#: views.py:624 templates/catalogue/book_short.html:103
+#: templates/catalogue/book_wide.html:64
 msgid "Download"
 msgstr "Pobierz"
 
 msgid "Download"
 msgstr "Pobierz"
 
-#: models/book.py:28 models/collection.py:11
+#: models/book.py:30 models/collection.py:11
 msgid "title"
 msgstr "tytuł"
 
 msgid "title"
 msgstr "tytuł"
 
-#: models/book.py:29 models/tag.py:34
+#: models/book.py:31 models/tag.py:34
 msgid "sort key"
 msgstr "klucz sortowania"
 
 msgid "sort key"
 msgstr "klucz sortowania"
 
-#: models/book.py:30
+#: models/book.py:32
 #, fuzzy
 msgid "sort key by author"
 msgstr "Znalezieni autorzy"
 
 #, fuzzy
 msgid "sort key by author"
 msgstr "Znalezieni autorzy"
 
-#: models/book.py:31 models/book.py:33 models/collection.py:12
+#: models/book.py:33 models/book.py:35 models/collection.py:12
 #: models/collection.py:15 models/tag.py:33
 msgid "slug"
 msgstr "slug"
 
 #: models/collection.py:15 models/tag.py:33
 msgid "slug"
 msgstr "slug"
 
-#: models/book.py:34
+#: models/book.py:36
 msgid "language code"
 msgstr "Kod języka"
 
 msgid "language code"
 msgstr "Kod języka"
 
-#: models/book.py:36 models/book.py:164 models/collection.py:13
+#: models/book.py:38 models/book.py:170 models/collection.py:13
 #: models/tag.py:37 models/tag.py:94
 msgid "description"
 msgstr "opis"
 
 #: models/tag.py:37 models/tag.py:94
 msgid "description"
 msgstr "opis"
 
-#: models/book.py:37 models/book.py:38 models/bookmedia.py:29 models/tag.py:46
+#: models/book.py:39 models/book.py:40 models/bookmedia.py:31 models/tag.py:46
 #: models/tag.py:47
 msgid "creation date"
 msgstr "data utworzenia"
 
 #: models/tag.py:47
 msgid "creation date"
 msgstr "data utworzenia"
 
-#: models/book.py:39
+#: models/book.py:41
 msgid "parent number"
 msgstr "numer rodzica"
 
 msgid "parent number"
 msgstr "numer rodzica"
 
-#: models/book.py:40 models/bookmedia.py:30
+#: models/book.py:42 models/bookmedia.py:32
 msgid "extra information"
 msgstr "dodatkowe informacje"
 
 msgid "extra information"
 msgstr "dodatkowe informacje"
 
-#: models/book.py:45
+#: models/book.py:47
 msgid "cover"
 msgstr "okładka"
 
 msgid "cover"
 msgstr "okładka"
 
-#: models/book.py:48
+#: models/book.py:52
 msgid "cover thumbnail"
 msgstr "podgląd okładki"
 
 msgid "cover thumbnail"
 msgstr "podgląd okładki"
 
-#: models/book.py:70 models/collection.py:18 models/tag.py:22
+#: models/book.py:76 models/collection.py:18 models/tag.py:22
 msgid "book"
 msgstr "książka"
 
 msgid "book"
 msgstr "książka"
 
-#: models/book.py:71
+#: models/book.py:77
 msgid "books"
 msgstr "książki"
 
 msgid "books"
 msgstr "książki"
 
-#: models/book.py:262
+#: models/book.py:268
 #, python-format
 msgid "Book \"%s\" does not exist."
 msgstr "Utwór \"%s\" nie istnieje."
 
 #, python-format
 msgid "Book \"%s\" does not exist."
 msgstr "Utwór \"%s\" nie istnieje."
 
-#: models/book.py:276
+#: models/book.py:282
 #, python-format
 msgid "Book %s already exists"
 msgstr "Książka %s już istnieje"
 
 #, python-format
 msgid "Book %s already exists"
 msgstr "Książka %s już istnieje"
 
-#: models/book.py:625 models/bookmedia.py:23
+#: models/book.py:618
+msgid "This work needs modernisation"
+msgstr "Ten utwór wymaga uwspółcześnienia"
+
+#: models/book.py:637 models/bookmedia.py:23
 #, python-format
 msgid "%s file"
 msgstr "plik %s"
 #, python-format
 msgid "%s file"
 msgstr "plik %s"
@@ -186,7 +194,7 @@ msgstr "nazwa"
 msgid "file"
 msgstr "plik"
 
 msgid "file"
 msgstr "plik"
 
-#: models/bookmedia.py:39 models/bookmedia.py:40
+#: models/bookmedia.py:41 models/bookmedia.py:42
 msgid "book media"
 msgstr "media książki"
 
 msgid "book media"
 msgstr "media książki"
 
@@ -371,31 +379,31 @@ msgstr "Gatunek"
 msgid "Language"
 msgstr "Język"
 
 msgid "Language"
 msgstr "Język"
 
-#: templates/catalogue/book_short.html:93
+#: templates/catalogue/book_short.html:99
 msgid "Read online"
 msgstr "Czytaj online"
 
 msgid "Read online"
 msgstr "Czytaj online"
 
-#: templates/catalogue/book_short.html:100
+#: templates/catalogue/book_short.html:106
 msgid "to print"
 msgstr "do druku"
 
 msgid "to print"
 msgstr "do druku"
 
-#: templates/catalogue/book_short.html:103
+#: templates/catalogue/book_short.html:109
 msgid "for an e-book reader"
 msgstr "na czytnik e-booków"
 
 msgid "for an e-book reader"
 msgstr "na czytnik e-booków"
 
-#: templates/catalogue/book_short.html:106
+#: templates/catalogue/book_short.html:112
 msgid "for Kindle"
 msgstr "na Kindle"
 
 msgid "for Kindle"
 msgstr "na Kindle"
 
-#: templates/catalogue/book_short.html:109
+#: templates/catalogue/book_short.html:115
 msgid "FictionBook"
 msgstr "FictionBook"
 
 msgid "FictionBook"
 msgstr "FictionBook"
 
-#: templates/catalogue/book_short.html:112
+#: templates/catalogue/book_short.html:118
 msgid "for advanced usage"
 msgstr "do zadań specjalnych"
 
 msgid "for advanced usage"
 msgstr "do zadań specjalnych"
 
-#: templates/catalogue/book_short.html:118
+#: templates/catalogue/book_short.html:124
 msgid "Listen"
 msgstr "Słuchaj"
 
 msgid "Listen"
 msgstr "Słuchaj"
 
@@ -465,31 +473,35 @@ msgstr "Źródło"
 msgid "of the book"
 msgstr "utworu"
 
 msgid "of the book"
 msgstr "utworu"
 
-#: templates/catalogue/book_wide.html:49
+#: templates/catalogue/book_wide.html:48
+msgid "in"
+msgstr "w serwisie"
+
+#: templates/catalogue/book_wide.html:50
 msgid "Source XML file"
 msgstr "Źródłowy plik XML"
 
 msgid "Source XML file"
 msgstr "Źródłowy plik XML"
 
-#: templates/catalogue/book_wide.html:51
+#: templates/catalogue/book_wide.html:52
 msgid "Book on"
 msgstr "Utwór na"
 
 msgid "Book on"
 msgstr "Utwór na"
 
-#: templates/catalogue/book_wide.html:51
+#: templates/catalogue/book_wide.html:52
 msgid "Editor's Platform"
 msgstr "Platformie Redakcyjnej"
 
 msgid "Editor's Platform"
 msgstr "Platformie Redakcyjnej"
 
-#: templates/catalogue/book_wide.html:54
+#: templates/catalogue/book_wide.html:55
 msgid "Book description on Lektury.Gazeta.pl"
 msgstr "Opis lektury w Lektury.Gazeta.pl"
 
 msgid "Book description on Lektury.Gazeta.pl"
 msgstr "Opis lektury w Lektury.Gazeta.pl"
 
-#: templates/catalogue/book_wide.html:57
+#: templates/catalogue/book_wide.html:58
 msgid "Book description on Wikipedia"
 msgstr "Opis lektury w Wikipedii"
 
 msgid "Book description on Wikipedia"
 msgstr "Opis lektury w Wikipedii"
 
-#: templates/catalogue/book_wide.html:59
+#: templates/catalogue/book_wide.html:60
 msgid "Mix this book"
 msgstr "Miksuj treść utworu"
 
 msgid "Mix this book"
 msgstr "Miksuj treść utworu"
 
-#: templates/catalogue/book_wide.html:67
+#: templates/catalogue/book_wide.html:68
 msgid "Download all audiobooks for this book"
 msgstr "Pobierz wszystkie audiobooki tego utworu"
 
 msgid "Download all audiobooks for this book"
 msgstr "Pobierz wszystkie audiobooki tego utworu"
 
index 414d1ef..27240fb 100644 (file)
@@ -8,6 +8,7 @@ from django.core.cache import get_cache
 from django.db import models
 from django.db.models import permalink
 import django.dispatch
 from django.db import models
 from django.db.models import permalink
 import django.dispatch
+from django.core.urlresolvers import reverse
 from django.utils.datastructures import SortedDict
 from django.utils.translation import ugettext_lazy as _
 import jsonfield
 from django.utils.datastructures import SortedDict
 from django.utils.translation import ugettext_lazy as _
 import jsonfield
@@ -612,6 +613,14 @@ class Book(models.Model):
         audiences = sorted(set([self._audiences_pl.get(a, (99, a)) for a in audiences]))
         return [a[1] for a in audiences]
 
         audiences = sorted(set([self._audiences_pl.get(a, (99, a)) for a in audiences]))
         return [a[1] for a in audiences]
 
+    def stage_note(self):
+        stage = self.extra_info.get('stage')
+        if stage and stage < '0.4':
+            return (_('This work needs modernisation'),
+                    reverse('infopage', args=['wymagajace-uwspolczesnienia']))
+        else:
+            return None, None
+
     def choose_fragment(self):
         tag = self.book_tag()
         fragments = Fragment.tagged.with_any([tag])
     def choose_fragment(self):
         tag = self.book_tag()
         fragments = Fragment.tagged.with_any([tag])
index 3a0d37a..9c90bdd 100644 (file)
             </span></span>
             {% endif %}
 
             </span></span>
             {% endif %}
 
+            {% if stage_note %}
+            <br><span class="category">
+                <a{% if stage_note_url %} href="{{ stage_note_url }}"{% endif %}>{{ stage_note }}</a>
+            </span>
+            {% endif %}
+
            {% endspaceless %}
         </div>
     </div>
            {% endspaceless %}
         </div>
     </div>
index 13df555..5ce66a3 100644 (file)
@@ -1,6 +1,6 @@
 {% extends "catalogue/book_short.html" %}
 {% load i18n %}
 {% extends "catalogue/book_short.html" %}
 {% load i18n %}
-{% load download_audio tag_list custom_pdf_link_li license_icon from catalogue_tags %}
+{% load download_audio tag_list custom_pdf_link_li license_icon source_name from catalogue_tags %}
 {% load cite_promo from social_tags %}
 
 
 {% load cite_promo from social_tags %}
 
 
@@ -44,7 +44,8 @@
     <h2 class="mono">{% trans "See" %}</h2>
     <ul class="plain">
       {% if extra_info.source_url %}
     <h2 class="mono">{% trans "See" %}</h2>
     <ul class="plain">
       {% if extra_info.source_url %}
-      <li><a href="{{ extra_info.source_url }}">{% trans "Source" %}</a> {% trans "of the book" %}</li>
+      <li><a href="{{ extra_info.source_url }}">{% trans "Source" %}</a> {% trans "of the book" %}
+        {% trans "in" %} {% source_name extra_info.source_url %}</li>
       {% endif %}
       <li><a href="{{ book.xml_file.url }}">{% trans "Source XML file" %}</a></li>
       {% if extra_info.about and not hide_about %}
       {% endif %}
       <li><a href="{{ book.xml_file.url }}">{% trans "Source XML file" %}</a></li>
       {% if extra_info.about and not hide_about %}
index bbd9f07..5555711 100644 (file)
@@ -5,6 +5,7 @@
 import datetime
 import feedparser
 from random import randint
 import datetime
 import feedparser
 from random import randint
+from urlparse import urlparse
 
 from django.conf import settings
 from django import template
 
 from django.conf import settings
 from django import template
@@ -16,7 +17,7 @@ from django.utils.translation import ugettext as _
 
 from catalogue.utils import related_tag_name as _related_tag_name
 from catalogue.models import Book, BookMedia, Fragment, Tag
 
 from catalogue.utils import related_tag_name as _related_tag_name
 from catalogue.models import Book, BookMedia, Fragment, Tag
-from catalogue.constants import LICENSES
+from catalogue.constants import LICENSES, SOURCE_NAMES
 
 register = template.Library()
 
 
 register = template.Library()
 
@@ -326,6 +327,7 @@ def book_wide(context, book):
     book_themes = book.related_themes()
     extra_info = book.extra_info
     hide_about = extra_info.get('about', '').startswith('http://wiki.wolnepodreczniki.pl')
     book_themes = book.related_themes()
     extra_info = book.extra_info
     hide_about = extra_info.get('about', '').startswith('http://wiki.wolnepodreczniki.pl')
+    stage_note, stage_note_url = book.stage_note()
 
     return {
         'book': book,
 
     return {
         'book': book,
@@ -336,17 +338,23 @@ def book_wide(context, book):
         'themes': book_themes,
         'request': context.get('request'),
         'show_lang': book.language_code() != settings.LANGUAGE_CODE,
         'themes': book_themes,
         'request': context.get('request'),
         'show_lang': book.language_code() != settings.LANGUAGE_CODE,
+        'stage_note': stage_note,
+        'stage_note_url': stage_note_url,
     }
 
 
 @register.inclusion_tag('catalogue/book_short.html', takes_context=True)
 def book_short(context, book):
     }
 
 
 @register.inclusion_tag('catalogue/book_short.html', takes_context=True)
 def book_short(context, book):
+    stage_note, stage_note_url = book.stage_note()
+
     return {
         'book': book,
         'main_link': book.get_absolute_url(),
         'related': book.related_info(),
         'request': context.get('request'),
         'show_lang': book.language_code() != settings.LANGUAGE_CODE,
     return {
         'book': book,
         'main_link': book.get_absolute_url(),
         'related': book.related_info(),
         'request': context.get('request'),
         'show_lang': book.language_code() != settings.LANGUAGE_CODE,
+        'stage_note': stage_note,
+        'stage_note_url': stage_note_url,
     }
 
 
     }
 
 
@@ -473,3 +481,8 @@ def related_tag_name(tag, lang=None):
 def class_name(obj):
     return obj.__class__.__name__
 
 def class_name(obj):
     return obj.__class__.__name__
 
+
+@register.simple_tag
+def source_name(url):
+    netloc = urlparse(url).netloc
+    return SOURCE_NAMES.get(netloc, netloc)
index 13b88a3..2a4236f 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 13b88a3bfdd4fa3cf5c92368aa5cb60fa832eda6
+Subproject commit 2a4236f2ddbe95d07ba7fcbe750451340c38c2b9