From d77b52af9631ca9f5727097126940932420e8c16 Mon Sep 17 00:00:00 2001 From: Niktia Pchelin Date: Sun, 16 Feb 2020 22:24:00 -0500 Subject: [PATCH 01/12] #645 - displays '(public)' next to public shelves created by the user --- cps/templates/layout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cps/templates/layout.html b/cps/templates/layout.html index 9ffb04f8..84785205 100644 --- a/cps/templates/layout.html +++ b/cps/templates/layout.html @@ -140,7 +140,7 @@ {% endfor %} {% for shelf in g.user.shelf %} -
  • {{shelf.name|shortentitle(40)}}
  • +
  • {{shelf.name|shortentitle(40)}}{% if shelf.is_public == 1 %} (public){% endif %}
  • {% endfor %} {% if not g.user.is_anonymous %} From 7c0d10da796737f9c1f829c89914ff93b1a92e94 Mon Sep 17 00:00:00 2001 From: Niktia Pchelin Date: Sun, 16 Feb 2020 22:47:32 -0500 Subject: [PATCH 02/12] #645 - displays '(public)' next to user's public shelves in OPDS feed --- cps/templates/feed.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cps/templates/feed.xml b/cps/templates/feed.xml index 37b7765e..089ca65b 100644 --- a/cps/templates/feed.xml +++ b/cps/templates/feed.xml @@ -75,7 +75,11 @@ {% endif %} {% for entry in listelements %} + {% if entry.__class__.__name__ == 'Shelf' and entry.is_public == 1 %} + {{entry.name}} (public) + {% else %} {{entry.name}} + {% endif %} {{ url_for(folder, book_id=entry.id) }} From dac48a26108bf38d823f364969902db53095e691 Mon Sep 17 00:00:00 2001 From: Niktia Pchelin Date: Sun, 16 Feb 2020 23:38:35 -0500 Subject: [PATCH 03/12] #645 - changes create_shelf and edit_shelf to allow user create public and private shelves with the same name --- cps/shelf.py | 47 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/cps/shelf.py b/cps/shelf.py index 6e8c4b9f..2a8d7c43 100644 --- a/cps/shelf.py +++ b/cps/shelf.py @@ -204,12 +204,24 @@ def create_shelf(): shelf.is_public = 1 shelf.name = to_save["title"] shelf.user_id = int(current_user.id) - existing_shelf = ub.session.query(ub.Shelf).filter( - or_((ub.Shelf.name == to_save["title"]) & (ub.Shelf.is_public == 1), - (ub.Shelf.name == to_save["title"]) & (ub.Shelf.user_id == int(current_user.id)))).first() - if existing_shelf: - flash(_(u"A shelf with the name '%(title)s' already exists.", title=to_save["title"]), category="error") + + is_shelf_name_unique = False + if shelf.is_public == 1: + is_shelf_name_unique = ub.session.query(ub.Shelf) \ + .filter((ub.Shelf.name == to_save["title"]) & (ub.Shelf.is_public == 1)) \ + .first() is None + + if not is_shelf_name_unique: + flash(_(u"A public shelf with the name '%(title)s' already exists.", title=to_save["title"]), category="error") else: + is_shelf_name_unique = ub.session.query(ub.Shelf) \ + .filter((ub.Shelf.name == to_save["title"]) & (ub.Shelf.is_public == 0) & (ub.Shelf.user_id == int(current_user.id))) \ + .first() is None + + if not is_shelf_name_unique: + flash(_(u"A private shelf with the name '%(title)s' already exists.", title=to_save["title"]), category="error") + + if is_shelf_name_unique: try: ub.session.add(shelf) ub.session.commit() @@ -227,13 +239,26 @@ def edit_shelf(shelf_id): shelf = ub.session.query(ub.Shelf).filter(ub.Shelf.id == shelf_id).first() if request.method == "POST": to_save = request.form.to_dict() - existing_shelf = ub.session.query(ub.Shelf).filter( - or_((ub.Shelf.name == to_save["title"]) & (ub.Shelf.is_public == 1), - (ub.Shelf.name == to_save["title"]) & (ub.Shelf.user_id == int(current_user.id)))).filter( - ub.Shelf.id != shelf_id).first() - if existing_shelf: - flash(_(u"A shelf with the name '%(title)s' already exists.", title=to_save["title"]), category="error") + + is_shelf_name_unique = False + if shelf.is_public == 1: + is_shelf_name_unique = ub.session.query(ub.Shelf) \ + .filter((ub.Shelf.name == to_save["title"]) & (ub.Shelf.is_public == 1)) \ + .filter(ub.Shelf.id != shelf_id) \ + .first() is None + + if not is_shelf_name_unique: + flash(_(u"A public shelf with the name '%(title)s' already exists.", title=to_save["title"]), category="error") else: + is_shelf_name_unique = ub.session.query(ub.Shelf) \ + .filter((ub.Shelf.name == to_save["title"]) & (ub.Shelf.is_public == 0) & (ub.Shelf.user_id == int(current_user.id))) \ + .filter(ub.Shelf.id != shelf_id) \ + .first() is None + + if not is_shelf_name_unique: + flash(_(u"A private shelf with the name '%(title)s' already exists.", title=to_save["title"]), category="error") + + if is_shelf_name_unique: shelf.name = to_save["title"] if "is_public" in to_save: shelf.is_public = 1 From c870f6e87d5791b66ee984bc7461cdd8a80b47c5 Mon Sep 17 00:00:00 2001 From: Josh O'Brien Date: Thu, 19 Mar 2020 13:10:10 +1100 Subject: [PATCH 04/12] English Language V2 --- cps/__init__.py | 0 cps/comic.py | 0 cps/db.py | 0 cps/server.py | 0 cps/shelf.py | 4 ++-- cps/static/js/libs/tinymce/license.txt | 0 .../tinymce/skins/lightgray/content.inline.min.css | 0 .../js/libs/tinymce/skins/lightgray/content.min.css | 0 .../tinymce/skins/lightgray/fonts/tinymce-small.eot | Bin .../tinymce/skins/lightgray/fonts/tinymce-small.svg | 0 .../tinymce/skins/lightgray/fonts/tinymce-small.ttf | Bin .../skins/lightgray/fonts/tinymce-small.woff | Bin .../libs/tinymce/skins/lightgray/fonts/tinymce.eot | Bin .../libs/tinymce/skins/lightgray/fonts/tinymce.svg | 0 .../libs/tinymce/skins/lightgray/fonts/tinymce.ttf | Bin .../libs/tinymce/skins/lightgray/fonts/tinymce.woff | Bin .../js/libs/tinymce/skins/lightgray/img/anchor.gif | Bin .../js/libs/tinymce/skins/lightgray/img/loader.gif | Bin .../js/libs/tinymce/skins/lightgray/img/object.gif | Bin .../js/libs/tinymce/skins/lightgray/img/trans.gif | Bin .../js/libs/tinymce/skins/lightgray/skin.min.css | 0 .../js/libs/tinymce/themes/inlite/theme.min.js | 0 .../js/libs/tinymce/themes/modern/theme.min.js | 0 cps/templates/admin.html | 4 ++-- cps/templates/index.html | 0 cps/templates/modal_restriction.html | 10 +++++----- cps/templates/user_edit.html | 4 ++-- cps/web.py | 6 +++--- 28 files changed, 14 insertions(+), 14 deletions(-) mode change 100755 => 100644 cps/__init__.py mode change 100755 => 100644 cps/comic.py mode change 100755 => 100644 cps/db.py mode change 100755 => 100644 cps/server.py mode change 100755 => 100644 cps/static/js/libs/tinymce/license.txt mode change 100755 => 100644 cps/static/js/libs/tinymce/skins/lightgray/content.inline.min.css mode change 100755 => 100644 cps/static/js/libs/tinymce/skins/lightgray/content.min.css mode change 100755 => 100644 cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce-small.eot mode change 100755 => 100644 cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce-small.svg mode change 100755 => 100644 cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce-small.ttf mode change 100755 => 100644 cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce-small.woff mode change 100755 => 100644 cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce.eot mode change 100755 => 100644 cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce.svg mode change 100755 => 100644 cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce.ttf mode change 100755 => 100644 cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce.woff mode change 100755 => 100644 cps/static/js/libs/tinymce/skins/lightgray/img/anchor.gif mode change 100755 => 100644 cps/static/js/libs/tinymce/skins/lightgray/img/loader.gif mode change 100755 => 100644 cps/static/js/libs/tinymce/skins/lightgray/img/object.gif mode change 100755 => 100644 cps/static/js/libs/tinymce/skins/lightgray/img/trans.gif mode change 100755 => 100644 cps/static/js/libs/tinymce/skins/lightgray/skin.min.css mode change 100755 => 100644 cps/static/js/libs/tinymce/themes/inlite/theme.min.js mode change 100755 => 100644 cps/static/js/libs/tinymce/themes/modern/theme.min.js mode change 100755 => 100644 cps/templates/index.html diff --git a/cps/__init__.py b/cps/__init__.py old mode 100755 new mode 100644 diff --git a/cps/comic.py b/cps/comic.py old mode 100755 new mode 100644 diff --git a/cps/db.py b/cps/db.py old mode 100755 new mode 100644 diff --git a/cps/server.py b/cps/server.py old mode 100755 new mode 100644 diff --git a/cps/shelf.py b/cps/shelf.py index afee1eaa..bb3a42b5 100644 --- a/cps/shelf.py +++ b/cps/shelf.py @@ -216,9 +216,9 @@ def create_shelf(): flash(_(u"Shelf %(title)s created", title=to_save["title"]), category="success") except Exception: flash(_(u"There was an error"), category="error") - return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"create a shelf"), page="shelfcreate") + return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"Create a Shelf"), page="shelfcreate") else: - return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"create a shelf"), page="shelfcreate") + return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"Create a Shelf"), page="shelfcreate") @shelf.route("/shelf/edit/", methods=["GET", "POST"]) diff --git a/cps/static/js/libs/tinymce/license.txt b/cps/static/js/libs/tinymce/license.txt old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/skins/lightgray/content.inline.min.css b/cps/static/js/libs/tinymce/skins/lightgray/content.inline.min.css old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/skins/lightgray/content.min.css b/cps/static/js/libs/tinymce/skins/lightgray/content.min.css old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce-small.eot b/cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce-small.eot old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce-small.svg b/cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce-small.svg old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce-small.ttf b/cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce-small.ttf old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce-small.woff b/cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce-small.woff old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce.eot b/cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce.eot old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce.svg b/cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce.svg old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce.ttf b/cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce.ttf old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce.woff b/cps/static/js/libs/tinymce/skins/lightgray/fonts/tinymce.woff old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/skins/lightgray/img/anchor.gif b/cps/static/js/libs/tinymce/skins/lightgray/img/anchor.gif old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/skins/lightgray/img/loader.gif b/cps/static/js/libs/tinymce/skins/lightgray/img/loader.gif old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/skins/lightgray/img/object.gif b/cps/static/js/libs/tinymce/skins/lightgray/img/object.gif old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/skins/lightgray/img/trans.gif b/cps/static/js/libs/tinymce/skins/lightgray/img/trans.gif old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/skins/lightgray/skin.min.css b/cps/static/js/libs/tinymce/skins/lightgray/skin.min.css old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/themes/inlite/theme.min.js b/cps/static/js/libs/tinymce/themes/inlite/theme.min.js old mode 100755 new mode 100644 diff --git a/cps/static/js/libs/tinymce/themes/modern/theme.min.js b/cps/static/js/libs/tinymce/themes/modern/theme.min.js old mode 100755 new mode 100644 diff --git a/cps/templates/admin.html b/cps/templates/admin.html index 5b2ad78c..69deee09 100644 --- a/cps/templates/admin.html +++ b/cps/templates/admin.html @@ -15,7 +15,7 @@ {{_('Downloads')}} {{_('Admin')}} {{_('Download')}} - {{_('View eBooks')}} + {{_('View Books')}} {{_('Upload')}} {{_('Edit')}} @@ -58,7 +58,7 @@ {{email.mail_from}} - + diff --git a/cps/templates/index.html b/cps/templates/index.html old mode 100755 new mode 100644 diff --git a/cps/templates/modal_restriction.html b/cps/templates/modal_restriction.html index ede585d7..aa8678df 100644 --- a/cps/templates/modal_restriction.html +++ b/cps/templates/modal_restriction.html @@ -3,10 +3,10 @@