From 5a2a3e60b6dbc01485e37373f32ca5cec472e2cb Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 6 Aug 2014 17:14:09 -0400 Subject: [PATCH] add PD and GDFL to license choices; add pd-us also all make list display facets for PD-US and GDFL; don't expose them until we have content we like in them --- core/cc.py | 13 ++++++++++++- core/models.py | 2 +- frontend/templates/cc_list.html | 4 ++-- frontend/views.py | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/core/cc.py b/core/cc.py index e806ceaa..f9247160 100644 --- a/core/cc.py +++ b/core/cc.py @@ -11,6 +11,7 @@ INFO_CC = ( ('CC0', 'cc0', 'No Rights Reserved (CC0)', 'http://creativecommons.org/about/cc0'), ) INFO_PD = ( + ('GFDL', 'gdfl', 'GNU Free Documentaion License', 'http://www.gnu.org/licenses/fdl-1.3-standalone.html'), ('PD-US', 'pd-us', 'Public Domain, US', 'http://creativecommons.org/about/pdm'), ) INFO_ALL = INFO_CC + INFO_PD @@ -27,7 +28,7 @@ GRANTS = tuple([(item[0],item[3]) for item in INFO_ALL]) LICENSE_LIST = [item[0] for item in INFO_CC] LICENSE_LIST_ALL = [item[0] for item in INFO_ALL] -FACET_LIST = [item[1] for item in INFO_CC] +FACET_LIST = [item[1] for item in INFO_ALL] class CCLicense(): @staticmethod @@ -55,6 +56,8 @@ class CCLicense(): return 'https://i.creativecommons.org/l/by-sa/3.0/88x31.png' elif license == 'CC BY-ND': return 'https://i.creativecommons.org/l/by-nd/3.0/88x31.png' + elif license == 'GFDL': + return 'https://www.gnu.org/graphics/gfdl-logo-tiny.png' else: return '' @@ -75,6 +78,8 @@ def description(license): return 'You are free to: copy and redistribute the material in any medium or format; remix, transform, and build upon the material; for any purpose, even commercially. Under the following terms: You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.' elif license == 'CC BY-ND': return 'You are free to: copy and redistribute the material in any medium or format; for any purpose, even commercially. Under the following terms: You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. If you remix, transform, or build upon the material, you may not distribute the modified material.' + elif license == 'GFDL': + return 'The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.' else: return '' @@ -97,4 +102,10 @@ class ccinfo(): return INFO_ALL[LICENSE_LIST_ALL.index(license)][2] else: return '' + @property + def is_cc(self): + return self.license in LICENSE_LIST + @property + def is_pd(self): + return self.license == 'PD-US' \ No newline at end of file diff --git a/core/models.py b/core/models.py index 289f5a68..e6ed9154 100755 --- a/core/models.py +++ b/core/models.py @@ -1583,7 +1583,7 @@ class EbookFile(models.Model): class Ebook(models.Model): FORMAT_CHOICES = settings.FORMATS - RIGHTS_CHOICES = cc.CCCHOICES + RIGHTS_CHOICES = cc.CHOICES url = models.URLField(max_length=1024) created = models.DateTimeField(auto_now_add=True, db_index=True,) format = models.CharField(max_length=25, choices = FORMAT_CHOICES) diff --git a/frontend/templates/cc_list.html b/frontend/templates/cc_list.html index ac0a181f..5cf06de6 100644 --- a/frontend/templates/cc_list.html +++ b/frontend/templates/cc_list.html @@ -29,7 +29,7 @@

Ready to Read
-

These {% if pub_lang %}{{ pub_lang|ez_lang_name }} language {% endif %}Creative Commons {% if license %}{{ license }}{% endif %} licensed ebooks are ready to read - the people who created them want you to read and share them.

+

These {% if pub_lang %}{{ pub_lang|ez_lang_name }} language {% endif %}{% if cc.is_cc %}Creative Commons{% endif %} {% if license %}{{ license }}{% endif %} {%if cc.is_pd %}ebooks are ready to read - they belong to all of us!{% else %}licensed ebooks are ready to read - the people who created them want you to read and share them.{% endif %}

{% if license %}

badge for {{license}} {{cc.description}}

{% endif %}
@@ -74,7 +74,7 @@
{% ifequal work_list.count 0 %} - There aren't any {{ pub_lang|ez_lang_name }} Creative Commons {{ license }} works in this list. Why don't you add some? Use the "More" tab on a work, there are links there for adding CC ebooks. + There aren't any {{ pub_lang|ez_lang_name }} {% if cc.is_cc %}Creative Commons{% endif %} {{ license }} works in this list. Why don't you add some? Use the "More" tab on a work, there are links there for adding ebooks. {% else %} {% lazy_paginate 20 work_list using "work_list" %} {% for work in work_list %} diff --git a/frontend/views.py b/frontend/views.py index 389fc303..b2ad59ae 100755 --- a/frontend/views.py +++ b/frontend/views.py @@ -886,7 +886,7 @@ class ByPubListView(ByPubView): class CCListView(FilterableListView): template_name = "cc_list.html" context_object_name = "work_list" - licenses = cc.LICENSE_LIST + licenses = cc.LICENSE_LIST_ALL facets = cc.FACET_LIST def get_queryset_all(self):