mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-25 17:40:31 +00:00
Requests from #454
This commit is contained in:
parent
6f36eef51d
commit
8896b3c5d2
@ -17,7 +17,7 @@
|
|||||||
{% if g.user.role_download() %}
|
{% if g.user.role_download() %}
|
||||||
{% if entry.data|length %}
|
{% if entry.data|length %}
|
||||||
<div class="btn-group" role="group">
|
<div class="btn-group" role="group">
|
||||||
{% if entry.data|length < 3 %}
|
{% if entry.data|length < 2 %}
|
||||||
<button type="button" class="btn btn-primary">
|
<button type="button" class="btn btn-primary">
|
||||||
{{_('Download')}} :
|
{{_('Download')}} :
|
||||||
</button>
|
</button>
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="meta">
|
<div class="meta">
|
||||||
<p class="title">{{entry.title|shortentitle}}</p>
|
<p class="title">{{entry.title|truncate(60)}}</p>
|
||||||
<p class="author">
|
<p class="author">
|
||||||
{% for author in entry.authors %}
|
{% for author in entry.authors %}
|
||||||
<a href="{{url_for('author', book_id=author.id) }}">{{author.name.replace('|',',')}}</a>
|
<a href="{{url_for('author', book_id=author.id) }}">{{author.name.replace('|',',')}}</a>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
{% block header %}{% endblock %}
|
{% block header %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="{{ page }}">
|
||||||
<!-- Static navbar -->
|
<!-- Static navbar -->
|
||||||
<div class="navbar navbar-default navbar-static-top" role="navigation">
|
<div class="navbar navbar-default navbar-static-top" role="navigation">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
@ -116,7 +116,7 @@
|
|||||||
<ul class="list-unstyled" id="scnd-nav" intent in-standard-append="nav.navigation" in-mobile-after="#main-nav" in-mobile-class="nav navbar-nav">
|
<ul class="list-unstyled" id="scnd-nav" intent in-standard-append="nav.navigation" in-mobile-after="#main-nav" in-mobile-class="nav navbar-nav">
|
||||||
<li class="nav-head hidden-xs">{{_('Browse')}}</li>
|
<li class="nav-head hidden-xs">{{_('Browse')}}</li>
|
||||||
{% if g.user.show_recent() %}
|
{% if g.user.show_recent() %}
|
||||||
<li id="nav_new"><a href="{{url_for('index')}}"><span class="glyphicon glyphicon-book"></span> {{_('Recently Added')}}</a></li>
|
<li id="nav_new" {% if page == 'root' %}class="active"{% endif %}><a href="{{url_for('index')}}"><span class="glyphicon glyphicon-book"></span> {{_('Recently Added')}}</a></li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
{% if g.user.show_sorted() %}
|
{% if g.user.show_sorted() %}
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
@ -125,39 +125,39 @@
|
|||||||
<span class="caret"></span>
|
<span class="caret"></span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a href="{{url_for('newest_books')}}">{{_('Sort By')}} {{_('Newest')}}</a></li>
|
<li {% if page == 'newest' %}class="active"{% endif %}><a href="{{url_for('newest_books')}}">{{_('Sort By')}} {{_('Newest')}}</a></li>
|
||||||
<li><a href="{{url_for('oldest_books')}}">{{_('Sort By')}} {{_('Oldest')}}</a></li>
|
<li {% if page == 'oldest' %}class="active"{% endif %}><a href="{{url_for('oldest_books')}}">{{_('Sort By')}} {{_('Oldest')}}</a></li>
|
||||||
<li><a href="{{url_for('titles_ascending')}}">{{_('Sort By')}} {{_('Title')}} ({{_('Ascending')}})</a></li>
|
<li {% if page == 'a-z' %}class="active"{% endif %}><a href="{{url_for('titles_ascending')}}">{{_('Sort By')}} {{_('Title')}} ({{_('Ascending')}})</a></li>
|
||||||
<li><a href="{{url_for('titles_descending')}}">{{_('Sort By')}} {{_('Title')}} ({{_('Descending')}})</a></li>
|
<li {% if page == 'z-a' %}class="active"{% endif %}><a href="{{url_for('titles_descending')}}">{{_('Sort By')}} {{_('Title')}} ({{_('Descending')}})</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
{% if g.user.show_hot_books() %}
|
{% if g.user.show_hot_books() %}
|
||||||
<li id="nav_hot"><a href="{{url_for('hot_books')}}"><span class="glyphicon glyphicon-fire"></span> {{_('Hot Books')}}</a></li>
|
<li id="nav_hot" {% if page == 'hot' %}class="active"{% endif %}><a href="{{url_for('hot_books')}}"><span class="glyphicon glyphicon-fire"></span> {{_('Hot Books')}}</a></li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
{% if g.user.show_best_rated_books() %}
|
{% if g.user.show_best_rated_books() %}
|
||||||
<li><a href="{{url_for('best_rated_books')}}"><span class="glyphicon glyphicon-star"></span> {{_('Best rated Books')}}</a></li>
|
<li {% if page == 'rated' %}class="active"{% endif %}><a href="{{url_for('best_rated_books')}}"><span class="glyphicon glyphicon-star"></span> {{_('Best rated Books')}}</a></li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
{% if g.user.show_read_and_unread() %}
|
{% if g.user.show_read_and_unread() %}
|
||||||
{% if not g.user.is_anonymous %}
|
{% if not g.user.is_anonymous %}
|
||||||
<li><a href="{{url_for('read_books')}}"><span class="glyphicon glyphicon-eye-open"></span> {{_('Read Books')}}</a></li>
|
<li {% if page == 'read' %}class="active"{% endif %}><a href="{{url_for('read_books')}}"><span class="glyphicon glyphicon-eye-open"></span> {{_('Read Books')}}</a></li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
<li><a href="{{url_for('unread_books')}}"><span class="glyphicon glyphicon-eye-close"></span> {{_('Unread Books')}}</a></li>
|
<li {% if page == 'read' %}class="active"{% endif %}><a href="{{url_for('unread_books')}}"><span class="glyphicon glyphicon-eye-close"></span> {{_('Unread Books')}}</a></li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
{% if g.user.show_random_books() %}
|
{% if g.user.show_random_books() %}
|
||||||
<li id="nav_rand"><a href="{{url_for('discover')}}"><span class="glyphicon glyphicon-random"></span> {{_('Discover')}}</a></li>
|
<li id="nav_rand" {% if page == 'discover' %}class="active"{% endif %}><a href="{{url_for('discover')}}"><span class="glyphicon glyphicon-random"></span> {{_('Discover')}}</a></li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
{% if g.user.show_category() %}
|
{% if g.user.show_category() %}
|
||||||
<li id="nav_cat"><a href="{{url_for('category_list')}}"><span class="glyphicon glyphicon-inbox"></span> {{_('Categories')}}</a></li>
|
<li id="nav_cat" {% if page == 'discover' %}class="category"{% endif %}><a href="{{url_for('category_list')}}"><span class="glyphicon glyphicon-inbox"></span> {{_('Categories')}}</a></li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
{% if g.user.show_series() %}
|
{% if g.user.show_series() %}
|
||||||
<li id="nav_serie"><a href="{{url_for('series_list')}}"><span class="glyphicon glyphicon-bookmark"></span> {{_('Series')}}</a></li>
|
<li id="nav_serie" {% if page == 'series' %}class="active"{% endif %}><a href="{{url_for('series_list')}}"><span class="glyphicon glyphicon-bookmark"></span> {{_('Series')}}</a></li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
{% if g.user.show_author() %}
|
{% if g.user.show_author() %}
|
||||||
<li id="nav_author"><a href="{{url_for('author_list')}}"><span class="glyphicon glyphicon-user"></span> {{_('Authors')}}</a></li>
|
<li id="nav_author" {% if page == 'author' %}class="active"{% endif %}><a href="{{url_for('author_list')}}"><span class="glyphicon glyphicon-user"></span> {{_('Authors')}}</a></li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
{% if g.user.filter_language() == 'all' and g.user.show_language() %}
|
{% if g.user.filter_language() == 'all' and g.user.show_language() %}
|
||||||
<li id="nav_lang"><a href="{{url_for('language_overview')}}"><span class="glyphicon glyphicon-flag"></span> {{_('Languages')}} </a></li>
|
<li id="nav_lang" {% if page == 'language' %}class="active"{% endif %}><a href="{{url_for('language_overview')}}"><span class="glyphicon glyphicon-flag"></span> {{_('Languages')}} </a></li>
|
||||||
{%endif%}
|
{%endif%}
|
||||||
{% if g.user.is_authenticated or g.user.is_anonymous %}
|
{% if g.user.is_authenticated or g.user.is_anonymous %}
|
||||||
<li class="nav-head hidden-xs">{{_('Public Shelves')}}</li>
|
<li class="nav-head hidden-xs">{{_('Public Shelves')}}</li>
|
||||||
@ -170,7 +170,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if not g.user.is_anonymous %}
|
{% if not g.user.is_anonymous %}
|
||||||
<li id="nav_createshelf" class="create-shelf"><a href="{{url_for('create_shelf')}}">{{_('Create a Shelf')}}</a></li>
|
<li id="nav_createshelf" class="create-shelf"><a href="{{url_for('create_shelf')}}">{{_('Create a Shelf')}}</a></li>
|
||||||
<li id="nav_about"><a href="{{url_for('stats')}}"><span class="glyphicon glyphicon-info-sign"></span> {{_('About')}}</a></li>
|
<li id="nav_about" {% if page == 'stat' %}class="active"{% endif %}><a href="{{url_for('stats')}}"><span class="glyphicon glyphicon-info-sign"></span> {{_('About')}}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
132
cps/web.py
132
cps/web.py
@ -1031,7 +1031,7 @@ def get_matching_tags():
|
|||||||
def index(page):
|
def index(page):
|
||||||
entries, random, pagination = fill_indexpage(page, db.Books, True, db.Books.timestamp.desc())
|
entries, random, pagination = fill_indexpage(page, db.Books, True, db.Books.timestamp.desc())
|
||||||
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
||||||
title=_(u"Recently Added Books"))
|
title=_(u"Recently Added Books"), page="root")
|
||||||
|
|
||||||
|
|
||||||
@app.route('/books/newest', defaults={'page': 1})
|
@app.route('/books/newest', defaults={'page': 1})
|
||||||
@ -1041,7 +1041,7 @@ def newest_books(page):
|
|||||||
if current_user.show_sorted():
|
if current_user.show_sorted():
|
||||||
entries, random, pagination = fill_indexpage(page, db.Books, True, db.Books.pubdate.desc())
|
entries, random, pagination = fill_indexpage(page, db.Books, True, db.Books.pubdate.desc())
|
||||||
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
||||||
title=_(u"Newest Books"))
|
title=_(u"Newest Books"), page="newest")
|
||||||
else:
|
else:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@ -1053,7 +1053,7 @@ def oldest_books(page):
|
|||||||
if current_user.show_sorted():
|
if current_user.show_sorted():
|
||||||
entries, random, pagination = fill_indexpage(page, db.Books, True, db.Books.pubdate)
|
entries, random, pagination = fill_indexpage(page, db.Books, True, db.Books.pubdate)
|
||||||
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
||||||
title=_(u"Oldest Books"))
|
title=_(u"Oldest Books"), page="oldest")
|
||||||
else:
|
else:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@ -1065,7 +1065,7 @@ def titles_ascending(page):
|
|||||||
if current_user.show_sorted():
|
if current_user.show_sorted():
|
||||||
entries, random, pagination = fill_indexpage(page, db.Books, True, db.Books.sort)
|
entries, random, pagination = fill_indexpage(page, db.Books, True, db.Books.sort)
|
||||||
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
||||||
title=_(u"Books (A-Z)"))
|
title=_(u"Books (A-Z)"), page="a-z")
|
||||||
else:
|
else:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@ -1076,7 +1076,7 @@ def titles_ascending(page):
|
|||||||
def titles_descending(page):
|
def titles_descending(page):
|
||||||
entries, random, pagination = fill_indexpage(page, db.Books, True, db.Books.sort.desc())
|
entries, random, pagination = fill_indexpage(page, db.Books, True, db.Books.sort.desc())
|
||||||
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
||||||
title=_(u"Books (Z-A)"))
|
title=_(u"Books (Z-A)"), page="z-a")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/hot", defaults={'page': 1})
|
@app.route("/hot", defaults={'page': 1})
|
||||||
@ -1105,7 +1105,7 @@ def hot_books(page):
|
|||||||
numBooks = entries.__len__()
|
numBooks = entries.__len__()
|
||||||
pagination = Pagination(page, config.config_books_per_page, numBooks)
|
pagination = Pagination(page, config.config_books_per_page, numBooks)
|
||||||
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
||||||
title=_(u"Hot Books (most downloaded)"))
|
title=_(u"Hot Books (most downloaded)"), page="hot")
|
||||||
else:
|
else:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@ -1118,7 +1118,7 @@ def best_rated_books(page):
|
|||||||
entries, random, pagination = fill_indexpage(page, db.Books, db.Books.ratings.any(db.Ratings.rating > 9),
|
entries, random, pagination = fill_indexpage(page, db.Books, db.Books.ratings.any(db.Ratings.rating > 9),
|
||||||
db.Books.timestamp.desc())
|
db.Books.timestamp.desc())
|
||||||
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
||||||
title=_(u"Best rated books"))
|
title=_(u"Best rated books"), page="rated")
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
|
|
||||||
@ -1129,7 +1129,8 @@ def discover(page):
|
|||||||
if current_user.show_random_books():
|
if current_user.show_random_books():
|
||||||
entries, __, pagination = fill_indexpage(page, db.Books, True, func.randomblob(2))
|
entries, __, pagination = fill_indexpage(page, db.Books, True, func.randomblob(2))
|
||||||
pagination = Pagination(1, config.config_books_per_page, config.config_books_per_page)
|
pagination = Pagination(1, config.config_books_per_page, config.config_books_per_page)
|
||||||
return render_title_template('discover.html', entries=entries, pagination=pagination, title=_(u"Random Books"))
|
return render_title_template('discover.html', entries=entries, pagination=pagination,
|
||||||
|
title=_(u"Random Books"), page="discover")
|
||||||
else:
|
else:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@ -1143,7 +1144,8 @@ def author_list():
|
|||||||
.group_by('books_authors_link.author').order_by(db.Authors.sort).all()
|
.group_by('books_authors_link.author').order_by(db.Authors.sort).all()
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
entry.Authors.name = entry.Authors.name.replace('|', ',')
|
entry.Authors.name = entry.Authors.name.replace('|', ',')
|
||||||
return render_title_template('list.html', entries=entries, folder='author', title=_(u"Author list"))
|
return render_title_template('list.html', entries=entries, folder='author',
|
||||||
|
title=_(u"Author list"), page="authorlist")
|
||||||
else:
|
else:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@ -1172,7 +1174,7 @@ def author(book_id, page):
|
|||||||
app.logger.error('Goodreads website is down/inaccessible')
|
app.logger.error('Goodreads website is down/inaccessible')
|
||||||
|
|
||||||
return render_title_template('author.html', entries=entries, pagination=pagination,
|
return render_title_template('author.html', entries=entries, pagination=pagination,
|
||||||
title=name, author=author_info, other_books=other_books)
|
title=name, author=author_info, other_books=other_books, page="author")
|
||||||
|
|
||||||
|
|
||||||
def get_unique_other_books(library_books, author_books):
|
def get_unique_other_books(library_books, author_books):
|
||||||
@ -1201,7 +1203,8 @@ def series_list():
|
|||||||
entries = db.session.query(db.Series, func.count('books_series_link.book').label('count'))\
|
entries = db.session.query(db.Series, func.count('books_series_link.book').label('count'))\
|
||||||
.join(db.books_series_link).join(db.Books).filter(common_filters())\
|
.join(db.books_series_link).join(db.Books).filter(common_filters())\
|
||||||
.group_by('books_series_link.series').order_by(db.Series.sort).all()
|
.group_by('books_series_link.series').order_by(db.Series.sort).all()
|
||||||
return render_title_template('list.html', entries=entries, folder='series', title=_(u"Series list"))
|
return render_title_template('list.html', entries=entries, folder='series',
|
||||||
|
title=_(u"Series list"), page="serieslist")
|
||||||
else:
|
else:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@ -1215,7 +1218,7 @@ def series(book_id, page):
|
|||||||
name = db.session.query(db.Series).filter(db.Series.id == book_id).first().name
|
name = db.session.query(db.Series).filter(db.Series.id == book_id).first().name
|
||||||
if entries:
|
if entries:
|
||||||
return render_title_template('index.html', random=random, pagination=pagination, entries=entries,
|
return render_title_template('index.html', random=random, pagination=pagination, entries=entries,
|
||||||
title=_(u"Series: %(serie)s", serie=name))
|
title=_(u"Series: %(serie)s", serie=name), page="series")
|
||||||
else:
|
else:
|
||||||
flash(_(u"Error opening eBook. File does not exist or file is not accessible:"), category="error")
|
flash(_(u"Error opening eBook. File does not exist or file is not accessible:"), category="error")
|
||||||
return redirect(url_for("index"))
|
return redirect(url_for("index"))
|
||||||
@ -1248,7 +1251,7 @@ def language_overview():
|
|||||||
func.count('books_languages_link.book').label('bookcount')).group_by(
|
func.count('books_languages_link.book').label('bookcount')).group_by(
|
||||||
'books_languages_link.lang_code').all()
|
'books_languages_link.lang_code').all()
|
||||||
return render_title_template('languages.html', languages=languages, lang_counter=lang_counter,
|
return render_title_template('languages.html', languages=languages, lang_counter=lang_counter,
|
||||||
title=_(u"Available languages"))
|
title=_(u"Available languages"), page="langlist")
|
||||||
else:
|
else:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@ -1265,7 +1268,7 @@ def language(name, page):
|
|||||||
except Exception:
|
except Exception:
|
||||||
name = _(isoLanguages.get(part3=name).name)
|
name = _(isoLanguages.get(part3=name).name)
|
||||||
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
||||||
title=_(u"Language: %(name)s", name=name))
|
title=_(u"Language: %(name)s", name=name), page="language")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/category")
|
@app.route("/category")
|
||||||
@ -1275,7 +1278,8 @@ def category_list():
|
|||||||
entries = db.session.query(db.Tags, func.count('books_tags_link.book').label('count'))\
|
entries = db.session.query(db.Tags, func.count('books_tags_link.book').label('count'))\
|
||||||
.join(db.books_tags_link).join(db.Books).order_by(db.Tags.name).filter(common_filters())\
|
.join(db.books_tags_link).join(db.Books).order_by(db.Tags.name).filter(common_filters())\
|
||||||
.group_by('books_tags_link.tag').all()
|
.group_by('books_tags_link.tag').all()
|
||||||
return render_title_template('list.html', entries=entries, folder='category', title=_(u"Category list"))
|
return render_title_template('list.html', entries=entries, folder='category',
|
||||||
|
title=_(u"Category list"), page="catlist")
|
||||||
else:
|
else:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@ -1289,7 +1293,7 @@ def category(book_id, page):
|
|||||||
|
|
||||||
name = db.session.query(db.Tags).filter(db.Tags.id == book_id).first().name
|
name = db.session.query(db.Tags).filter(db.Tags.id == book_id).first().name
|
||||||
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
||||||
title=_(u"Category: %(name)s", name=name))
|
title=_(u"Category: %(name)s", name=name), page="category")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/ajax/toggleread/<int:book_id>", methods=['POST'])
|
@app.route("/ajax/toggleread/<int:book_id>", methods=['POST'])
|
||||||
@ -1374,7 +1378,8 @@ def show_book(book_id):
|
|||||||
have_read = None
|
have_read = None
|
||||||
|
|
||||||
return render_title_template('detail.html', entry=entries, cc=cc, is_xhr=request.is_xhr,
|
return render_title_template('detail.html', entry=entries, cc=cc, is_xhr=request.is_xhr,
|
||||||
title=entries.title, books_shelfs=book_in_shelfs, have_read=have_read)
|
title=entries.title, books_shelfs=book_in_shelfs,
|
||||||
|
have_read=have_read, page="book")
|
||||||
else:
|
else:
|
||||||
flash(_(u"Error opening eBook. File does not exist or file is not accessible:"), category="error")
|
flash(_(u"Error opening eBook. File does not exist or file is not accessible:"), category="error")
|
||||||
return redirect(url_for("index"))
|
return redirect(url_for("index"))
|
||||||
@ -1413,7 +1418,7 @@ def stats():
|
|||||||
authors = len(db.session.query(db.Authors).all())
|
authors = len(db.session.query(db.Authors).all())
|
||||||
categorys = len(db.session.query(db.Tags).all())
|
categorys = len(db.session.query(db.Tags).all())
|
||||||
series = len(db.session.query(db.Series).all())
|
series = len(db.session.query(db.Series).all())
|
||||||
config_anonbrowse = uploader.book_formats.get_versions()
|
versions = uploader.book_formats.get_versions()
|
||||||
vendorpath = os.path.join(config.get_main_dir, "vendor")
|
vendorpath = os.path.join(config.get_main_dir, "vendor")
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
kindlegen = os.path.join(vendorpath, u"kindlegen.exe")
|
kindlegen = os.path.join(vendorpath, u"kindlegen.exe")
|
||||||
@ -1445,7 +1450,7 @@ def stats():
|
|||||||
versions['sqlite'] = db.engine.dialect.dbapi.sqlite_version
|
versions['sqlite'] = db.engine.dialect.dbapi.sqlite_version
|
||||||
|
|
||||||
return render_title_template('stats.html', bookcounter=counter, authorcounter=authors, versions=versions,
|
return render_title_template('stats.html', bookcounter=counter, authorcounter=authors, versions=versions,
|
||||||
categorycounter=categorys, seriecounter=series, title=_(u"Statistics"))
|
categorycounter=categorys, seriecounter=series, title=_(u"Statistics"), page="stat")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/delete/<int:book_id>/")
|
@app.route("/delete/<int:book_id>/")
|
||||||
@ -1660,9 +1665,9 @@ def search():
|
|||||||
# result = db.session.execute("select name from authors where lower(name) like '%" + term.lower() + "%'")
|
# result = db.session.execute("select name from authors where lower(name) like '%" + term.lower() + "%'")
|
||||||
# entries = result.fetchall()
|
# entries = result.fetchall()
|
||||||
# result.close()
|
# result.close()
|
||||||
return render_title_template('search.html', searchterm=term, entries=entries)
|
return render_title_template('search.html', searchterm=term, entries=entries, page="search")
|
||||||
else:
|
else:
|
||||||
return render_title_template('search.html', searchterm="")
|
return render_title_template('search.html', searchterm="", page="search")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/advanced_search", methods=["GET"])
|
@app.route("/advanced_search", methods=["GET"])
|
||||||
@ -1746,7 +1751,8 @@ def advanced_search():
|
|||||||
for language in exclude_languages_inputs:
|
for language in exclude_languages_inputs:
|
||||||
q = q.filter(not_(db.Books.series.any(db.Languages.id == language)))
|
q = q.filter(not_(db.Books.series.any(db.Languages.id == language)))
|
||||||
q = q.all()
|
q = q.all()
|
||||||
return render_title_template('search.html', searchterm=searchterm, entries=q, title=_(u"search"))
|
return render_title_template('search.html', searchterm=searchterm,
|
||||||
|
entries=q, title=_(u"search"), page="search")
|
||||||
tags = db.session.query(db.Tags).order_by(db.Tags.name).all()
|
tags = db.session.query(db.Tags).order_by(db.Tags.name).all()
|
||||||
series = db.session.query(db.Series).order_by(db.Series.name).all()
|
series = db.session.query(db.Series).order_by(db.Series.name).all()
|
||||||
if current_user.filter_language() == u"all":
|
if current_user.filter_language() == u"all":
|
||||||
@ -1759,7 +1765,8 @@ def advanced_search():
|
|||||||
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
|
||||||
else:
|
else:
|
||||||
languages = None
|
languages = None
|
||||||
return render_title_template('search_form.html', tags=tags, languages=languages, series=series, title=_(u"search"))
|
return render_title_template('search_form.html', tags=tags, languages=languages,
|
||||||
|
series=series, title=_(u"search"), page="advsearch")
|
||||||
|
|
||||||
|
|
||||||
def get_cover_via_gdrive(cover_path):
|
def get_cover_via_gdrive(cover_path):
|
||||||
@ -1843,7 +1850,7 @@ def render_read_books(page, are_read, as_xml=False):
|
|||||||
.filter(db.cc_classes[config.config_read_column].value==True).all()
|
.filter(db.cc_classes[config.config_read_column].value==True).all()
|
||||||
readBookIds = [x.book for x in readBooks]
|
readBookIds = [x.book for x in readBooks]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
app.logger.error(u"Custom Column No.%d is not exisiting in calibre database" % config.config_read_column)
|
app.logger.error(u"Custom Column No.%d is not existing in calibre database" % config.config_read_column)
|
||||||
readBookIds=[]
|
readBookIds=[]
|
||||||
|
|
||||||
if are_read:
|
if are_read:
|
||||||
@ -1866,7 +1873,7 @@ def render_read_books(page, are_read, as_xml=False):
|
|||||||
total_books = db.session.query(func.count(db.Books.id)).scalar()
|
total_books = db.session.query(func.count(db.Books.id)).scalar()
|
||||||
name = _(u'Unread Books') + ' (' + str(total_books - len(readBookIds)) + ')'
|
name = _(u'Unread Books') + ' (' + str(total_books - len(readBookIds)) + ')'
|
||||||
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
||||||
title=_(name, name=name))
|
title=_(name, name=name), page="read")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/opds/readbooks/")
|
@app.route("/opds/readbooks/")
|
||||||
@ -1989,7 +1996,7 @@ def register():
|
|||||||
to_save = request.form.to_dict()
|
to_save = request.form.to_dict()
|
||||||
if not to_save["nickname"] or not to_save["email"] or not to_save["password"]:
|
if not to_save["nickname"] or not to_save["email"] or not to_save["password"]:
|
||||||
flash(_(u"Please fill out all fields!"), category="error")
|
flash(_(u"Please fill out all fields!"), category="error")
|
||||||
return render_title_template('register.html', title=_(u"register"))
|
return render_title_template('register.html', title=_(u"register"), page="register")
|
||||||
|
|
||||||
existing_user = ub.session.query(ub.User).filter(func.lower(ub.User.nickname) == to_save["nickname"].lower()).first()
|
existing_user = ub.session.query(ub.User).filter(func.lower(ub.User.nickname) == to_save["nickname"].lower()).first()
|
||||||
existing_email = ub.session.query(ub.User).filter(ub.User.email == to_save["email"]).first()
|
existing_email = ub.session.query(ub.User).filter(ub.User.email == to_save["email"]).first()
|
||||||
@ -2006,14 +2013,14 @@ def register():
|
|||||||
except Exception:
|
except Exception:
|
||||||
ub.session.rollback()
|
ub.session.rollback()
|
||||||
flash(_(u"An unknown error occured. Please try again later."), category="error")
|
flash(_(u"An unknown error occured. Please try again later."), category="error")
|
||||||
return render_title_template('register.html', title=_(u"register"))
|
return render_title_template('register.html', title=_(u"register"), page="register")
|
||||||
flash("Your account has been created. Please login.", category="success")
|
flash("Your account has been created. Please login.", category="success")
|
||||||
return redirect(url_for('login'))
|
return redirect(url_for('login'))
|
||||||
else:
|
else:
|
||||||
flash(_(u"This username or email address is already in use."), category="error")
|
flash(_(u"This username or email address is already in use."), category="error")
|
||||||
return render_title_template('register.html', title=_(u"register"))
|
return render_title_template('register.html', title=_(u"register"), page="register")
|
||||||
|
|
||||||
return render_title_template('register.html', title=_(u"register"))
|
return render_title_template('register.html', title=_(u"register"), page="regsiter")
|
||||||
|
|
||||||
|
|
||||||
@app.route('/login', methods=['GET', 'POST'])
|
@app.route('/login', methods=['GET', 'POST'])
|
||||||
@ -2039,7 +2046,7 @@ def login():
|
|||||||
next_url = url_for('index')
|
next_url = url_for('index')
|
||||||
|
|
||||||
return render_title_template('login.html', title=_(u"login"), next_url=next_url,
|
return render_title_template('login.html', title=_(u"login"), next_url=next_url,
|
||||||
remote_login=config.config_remote_login)
|
remote_login=config.config_remote_login, page="login")
|
||||||
|
|
||||||
|
|
||||||
@app.route('/logout')
|
@app.route('/logout')
|
||||||
@ -2060,7 +2067,7 @@ def remote_login():
|
|||||||
verify_url = url_for('verify_token', token=auth_token.auth_token, _external=true)
|
verify_url = url_for('verify_token', token=auth_token.auth_token, _external=true)
|
||||||
|
|
||||||
return render_title_template('remote_login.html', title=_(u"login"), token=auth_token.auth_token,
|
return render_title_template('remote_login.html', title=_(u"login"), token=auth_token.auth_token,
|
||||||
verify_url=verify_url)
|
verify_url=verify_url, page="remotelogin")
|
||||||
|
|
||||||
|
|
||||||
@app.route('/verify/<token>')
|
@app.route('/verify/<token>')
|
||||||
@ -2263,9 +2270,9 @@ def create_shelf():
|
|||||||
flash(_(u"Shelf %(title)s created", title=to_save["title"]), category="success")
|
flash(_(u"Shelf %(title)s created", title=to_save["title"]), category="success")
|
||||||
except Exception:
|
except Exception:
|
||||||
flash(_(u"There was an error"), category="error")
|
flash(_(u"There was an error"), category="error")
|
||||||
return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"create a shelf"))
|
return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"create a shelf"), page="shelfcreate")
|
||||||
else:
|
else:
|
||||||
return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"create a shelf"))
|
return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"create a shelf"), page="shelfcreate")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/shelf/edit/<int:shelf_id>", methods=["GET", "POST"])
|
@app.route("/shelf/edit/<int:shelf_id>", methods=["GET", "POST"])
|
||||||
@ -2291,9 +2298,9 @@ def edit_shelf(shelf_id):
|
|||||||
flash(_(u"Shelf %(title)s changed", title=to_save["title"]), category="success")
|
flash(_(u"Shelf %(title)s changed", title=to_save["title"]), category="success")
|
||||||
except Exception:
|
except Exception:
|
||||||
flash(_(u"There was an error"), category="error")
|
flash(_(u"There was an error"), category="error")
|
||||||
return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"Edit a shelf"))
|
return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"Edit a shelf"), page="shelfedit")
|
||||||
else:
|
else:
|
||||||
return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"Edit a shelf"))
|
return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"Edit a shelf"), page="shelfedit")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/shelf/delete/<int:shelf_id>")
|
@app.route("/shelf/delete/<int:shelf_id>")
|
||||||
@ -2337,7 +2344,7 @@ def show_shelf(shelf_id):
|
|||||||
cur_book = db.session.query(db.Books).filter(db.Books.id == book.book_id).first()
|
cur_book = db.session.query(db.Books).filter(db.Books.id == book.book_id).first()
|
||||||
result.append(cur_book)
|
result.append(cur_book)
|
||||||
return render_title_template('shelf.html', entries=result, title=_(u"Shelf: '%(name)s'", name=shelf.name),
|
return render_title_template('shelf.html', entries=result, title=_(u"Shelf: '%(name)s'", name=shelf.name),
|
||||||
shelf=shelf)
|
shelf=shelf, page="shelf")
|
||||||
else:
|
else:
|
||||||
flash(_(u"Error opening shelf. Shelf does not exist or is not accessible"), category="error")
|
flash(_(u"Error opening shelf. Shelf does not exist or is not accessible"), category="error")
|
||||||
return redirect(url_for("index"))
|
return redirect(url_for("index"))
|
||||||
@ -2370,7 +2377,8 @@ def order_shelf(shelf_id):
|
|||||||
cur_book = db.session.query(db.Books).filter(db.Books.id == book.book_id).first()
|
cur_book = db.session.query(db.Books).filter(db.Books.id == book.book_id).first()
|
||||||
result.append(cur_book)
|
result.append(cur_book)
|
||||||
return render_title_template('shelf_order.html', entries=result,
|
return render_title_template('shelf_order.html', entries=result,
|
||||||
title=_(u"Change order of Shelf: '%(name)s'", name=shelf.name), shelf=shelf)
|
title=_(u"Change order of Shelf: '%(name)s'", name=shelf.name),
|
||||||
|
shelf=shelf, page="shelforder")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/me", methods=["GET", "POST"])
|
@app.route("/me", methods=["GET", "POST"])
|
||||||
@ -2446,8 +2454,8 @@ def profile():
|
|||||||
title=_(u"%(name)s's profile", name=current_user.nickname))
|
title=_(u"%(name)s's profile", name=current_user.nickname))
|
||||||
flash(_(u"Profile updated"), category="success")
|
flash(_(u"Profile updated"), category="success")
|
||||||
return render_title_template("user_edit.html", translations=translations, profile=1, languages=languages,
|
return render_title_template("user_edit.html", translations=translations, profile=1, languages=languages,
|
||||||
content=content,
|
content=content, downloads=downloads, title=_(u"%(name)s's profile",
|
||||||
downloads=downloads, title=_(u"%(name)s's profile", name=current_user.nickname))
|
name=current_user.nickname), page="me")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/admin/view")
|
@app.route("/admin/view")
|
||||||
@ -2469,7 +2477,7 @@ def admin():
|
|||||||
content = ub.session.query(ub.User).all()
|
content = ub.session.query(ub.User).all()
|
||||||
settings = ub.session.query(ub.Settings).first()
|
settings = ub.session.query(ub.Settings).first()
|
||||||
return render_title_template("admin.html", content=content, email=settings, config=config, commit=commit,
|
return render_title_template("admin.html", content=content, email=settings, config=config, commit=commit,
|
||||||
development=ub.DEVELOPMENT, title=_(u"Admin page"))
|
development=ub.DEVELOPMENT, title=_(u"Admin page"), page="admin")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/admin/config", methods=["GET", "POST"])
|
@app.route("/admin/config", methods=["GET", "POST"])
|
||||||
@ -2551,7 +2559,7 @@ def view_configuration():
|
|||||||
readColumn = db.session.query(db.Custom_Columns)\
|
readColumn = db.session.query(db.Custom_Columns)\
|
||||||
.filter(db.and_(db.Custom_Columns.datatype == 'bool',db.Custom_Columns.mark_for_delete == 0)).all()
|
.filter(db.and_(db.Custom_Columns.datatype == 'bool',db.Custom_Columns.mark_for_delete == 0)).all()
|
||||||
return render_title_template("config_view_edit.html", content=config, readColumns=readColumn,
|
return render_title_template("config_view_edit.html", content=config, readColumns=readColumn,
|
||||||
title=_(u"UI Configuration"))
|
title=_(u"UI Configuration"), page="uiconfig")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2606,7 +2614,8 @@ def configuration_helper(origin):
|
|||||||
flash(_(u'client_secrets.json is not configured for web application'), category="error")
|
flash(_(u'client_secrets.json is not configured for web application'), category="error")
|
||||||
return render_title_template("config_edit.html", content=config, origin=origin,
|
return render_title_template("config_edit.html", content=config, origin=origin,
|
||||||
gdrive=gdrive_support, gdriveError=gdriveError,
|
gdrive=gdrive_support, gdriveError=gdriveError,
|
||||||
goodreads=goodreads_support, title=_(u"Basic Configuration"))
|
goodreads=goodreads_support, title=_(u"Basic Configuration"),
|
||||||
|
page="config")
|
||||||
# always show google drive settings, but in case of error deny support
|
# always show google drive settings, but in case of error deny support
|
||||||
if "config_use_google_drive" in to_save and not gdriveError:
|
if "config_use_google_drive" in to_save and not gdriveError:
|
||||||
content.config_use_google_drive = "config_use_google_drive" in to_save
|
content.config_use_google_drive = "config_use_google_drive" in to_save
|
||||||
@ -2631,7 +2640,8 @@ def configuration_helper(origin):
|
|||||||
flash(_(u'Keyfile location is not valid, please enter correct path'), category="error")
|
flash(_(u'Keyfile location is not valid, please enter correct path'), category="error")
|
||||||
return render_title_template("config_edit.html", content=config, origin=origin,
|
return render_title_template("config_edit.html", content=config, origin=origin,
|
||||||
gdrive=gdrive_support, gdriveError=gdriveError,
|
gdrive=gdrive_support, gdriveError=gdriveError,
|
||||||
goodreads=goodreads_support, title=_(u"Basic Configuration"))
|
goodreads=goodreads_support, title=_(u"Basic Configuration"),
|
||||||
|
page="config")
|
||||||
if "config_certfile" in to_save:
|
if "config_certfile" in to_save:
|
||||||
if content.config_certfile != to_save["config_certfile"]:
|
if content.config_certfile != to_save["config_certfile"]:
|
||||||
if os.path.isfile(to_save["config_certfile"]) or to_save["config_certfile"] is u"":
|
if os.path.isfile(to_save["config_certfile"]) or to_save["config_certfile"] is u"":
|
||||||
@ -2642,7 +2652,8 @@ def configuration_helper(origin):
|
|||||||
flash(_(u'Certfile location is not valid, please enter correct path'), category="error")
|
flash(_(u'Certfile location is not valid, please enter correct path'), category="error")
|
||||||
return render_title_template("config_edit.html", content=config, origin=origin,
|
return render_title_template("config_edit.html", content=config, origin=origin,
|
||||||
gdrive=gdrive_support, gdriveError=gdriveError,
|
gdrive=gdrive_support, gdriveError=gdriveError,
|
||||||
goodreads=goodreads_support, title=_(u"Basic Configuration"))
|
goodreads=goodreads_support, title=_(u"Basic Configuration"),
|
||||||
|
page="config")
|
||||||
content.config_uploading = 0
|
content.config_uploading = 0
|
||||||
content.config_anonbrowse = 0
|
content.config_anonbrowse = 0
|
||||||
content.config_public_reg = 0
|
content.config_public_reg = 0
|
||||||
@ -2677,7 +2688,8 @@ def configuration_helper(origin):
|
|||||||
flash(_(u'Logfile location is not valid, please enter correct path'), category="error")
|
flash(_(u'Logfile location is not valid, please enter correct path'), category="error")
|
||||||
return render_title_template("config_edit.html", content=config, origin=origin,
|
return render_title_template("config_edit.html", content=config, origin=origin,
|
||||||
gdrive=gdrive_support, gdriveError=gdriveError,
|
gdrive=gdrive_support, gdriveError=gdriveError,
|
||||||
goodreads=goodreads_support, title=_(u"Basic Configuration"))
|
goodreads=goodreads_support, title=_(u"Basic Configuration"),
|
||||||
|
page="config")
|
||||||
else:
|
else:
|
||||||
content.config_logfile = to_save["config_logfile"]
|
content.config_logfile = to_save["config_logfile"]
|
||||||
reboot_required = True
|
reboot_required = True
|
||||||
@ -2696,15 +2708,15 @@ def configuration_helper(origin):
|
|||||||
except e:
|
except e:
|
||||||
flash(e, category="error")
|
flash(e, category="error")
|
||||||
return render_title_template("config_edit.html", content=config, origin=origin, gdrive=gdrive_support,
|
return render_title_template("config_edit.html", content=config, origin=origin, gdrive=gdrive_support,
|
||||||
gdriveError=gdriveError,
|
gdriveError=gdriveError, goodreads=goodreads_support,
|
||||||
goodreads=goodreads_support, title=_(u"Basic Configuration"))
|
title=_(u"Basic Configuration"), page="config")
|
||||||
if db_change:
|
if db_change:
|
||||||
reload(db)
|
reload(db)
|
||||||
if not db.setup_db():
|
if not db.setup_db():
|
||||||
flash(_(u'DB location is not valid, please enter correct path'), category="error")
|
flash(_(u'DB location is not valid, please enter correct path'), category="error")
|
||||||
return render_title_template("config_edit.html", content=config, origin=origin, gdrive=gdrive_support,
|
return render_title_template("config_edit.html", content=config, origin=origin, gdrive=gdrive_support,
|
||||||
gdriveError=gdriveError,
|
gdriveError=gdriveError, goodreads=goodreads_support,
|
||||||
goodreads=goodreads_support, title=_(u"Basic Configuration"))
|
title=_(u"Basic Configuration"), page="config")
|
||||||
if reboot_required:
|
if reboot_required:
|
||||||
# db.engine.dispose() # ToDo verify correct
|
# db.engine.dispose() # ToDo verify correct
|
||||||
ub.session.close()
|
ub.session.close()
|
||||||
@ -2722,7 +2734,7 @@ def configuration_helper(origin):
|
|||||||
return render_title_template("config_edit.html", origin=origin, success=success, content=config,
|
return render_title_template("config_edit.html", origin=origin, success=success, content=config,
|
||||||
show_authenticate_google_drive=not is_gdrive_ready(), gdrive=gdrive_support,
|
show_authenticate_google_drive=not is_gdrive_ready(), gdrive=gdrive_support,
|
||||||
gdriveError=gdriveError, gdrivefolders=gdrivefolders,
|
gdriveError=gdriveError, gdrivefolders=gdrivefolders,
|
||||||
goodreads=goodreads_support, title=_(u"Basic Configuration"))
|
goodreads=goodreads_support, title=_(u"Basic Configuration"), page="config")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/admin/user/new", methods=["GET", "POST"])
|
@app.route("/admin/user/new", methods=["GET", "POST"])
|
||||||
@ -2799,7 +2811,7 @@ def new_user():
|
|||||||
content.sidebar_view = config.config_default_show
|
content.sidebar_view = config.config_default_show
|
||||||
content.mature_content = bool(config.config_default_show & ub.MATURE_CONTENT)
|
content.mature_content = bool(config.config_default_show & ub.MATURE_CONTENT)
|
||||||
return render_title_template("user_edit.html", new_user=1, content=content, translations=translations,
|
return render_title_template("user_edit.html", new_user=1, content=content, translations=translations,
|
||||||
languages=languages, title=_(u"Add new user"))
|
languages=languages, title=_(u"Add new user"), page="newuser")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/admin/mailsettings", methods=["GET", "POST"])
|
@app.route("/admin/mailsettings", methods=["GET", "POST"])
|
||||||
@ -2832,7 +2844,7 @@ def edit_mailsettings():
|
|||||||
flash(_(u"Please configure your kindle email address first..."), category="error")
|
flash(_(u"Please configure your kindle email address first..."), category="error")
|
||||||
else:
|
else:
|
||||||
flash(_(u"E-Mail settings updated"), category="success")
|
flash(_(u"E-Mail settings updated"), category="success")
|
||||||
return render_title_template("email_edit.html", content=content, title=_(u"Edit mail settings"))
|
return render_title_template("email_edit.html", content=content, title=_(u"Edit mail settings"), page="mailset")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/admin/user/<int:user_id>", methods=["GET", "POST"])
|
@app.route("/admin/user/<int:user_id>", methods=["GET", "POST"])
|
||||||
@ -2976,8 +2988,8 @@ def edit_user(user_id):
|
|||||||
ub.session.rollback()
|
ub.session.rollback()
|
||||||
flash(_(u"An unknown error occured."), category="error")
|
flash(_(u"An unknown error occured."), category="error")
|
||||||
return render_title_template("user_edit.html", translations=translations, languages=languages, new_user=0,
|
return render_title_template("user_edit.html", translations=translations, languages=languages, new_user=0,
|
||||||
content=content, downloads=downloads,
|
content=content, downloads=downloads, title=_(u"Edit User %(nick)s",
|
||||||
title=_(u"Edit User %(nick)s", nick=content.nickname))
|
nick=content.nickname), page="edituser")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/admin/book/<int:book_id>", methods=['GET', 'POST'])
|
@app.route("/admin/book/<int:book_id>", methods=['GET', 'POST'])
|
||||||
@ -3008,7 +3020,7 @@ def edit_book(book_id):
|
|||||||
# Show form
|
# Show form
|
||||||
if request.method != 'POST':
|
if request.method != 'POST':
|
||||||
return render_title_template('book_edit.html', book=book, authors=author_names, cc=cc,
|
return render_title_template('book_edit.html', book=book, authors=author_names, cc=cc,
|
||||||
title=_(u"edit metadata"))
|
title=_(u"edit metadata"), page="editbook")
|
||||||
|
|
||||||
# Update book
|
# Update book
|
||||||
edited_books_id = set()
|
edited_books_id = set()
|
||||||
@ -3219,12 +3231,12 @@ def edit_book(book_id):
|
|||||||
return redirect(url_for('show_book', book_id=book.id))
|
return redirect(url_for('show_book', book_id=book.id))
|
||||||
else:
|
else:
|
||||||
return render_title_template('book_edit.html', book=book, authors=author_names, cc=cc,
|
return render_title_template('book_edit.html', book=book, authors=author_names, cc=cc,
|
||||||
title=_(u"edit metadata"))
|
title=_(u"edit metadata"), page="editbook")
|
||||||
else:
|
else:
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
flash( error, category="error")
|
flash( error, category="error")
|
||||||
return render_title_template('book_edit.html', book=book, authors=author_names, cc=cc,
|
return render_title_template('book_edit.html', book=book, authors=author_names, cc=cc,
|
||||||
title=_(u"edit metadata"))
|
title=_(u"edit metadata"), page="editbook")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
app.logger.exception(e)
|
app.logger.exception(e)
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
@ -3392,9 +3404,11 @@ def upload():
|
|||||||
# db.session.connection().connection.connection.create_function("title_sort", 1, db.title_sort)
|
# db.session.connection().connection.connection.create_function("title_sort", 1, db.title_sort)
|
||||||
cc = db.session.query(db.Custom_Columns).filter(db.Custom_Columns.datatype.notin_(db.cc_exceptions)).all()
|
cc = db.session.query(db.Custom_Columns).filter(db.Custom_Columns.datatype.notin_(db.cc_exceptions)).all()
|
||||||
if current_user.role_edit() or current_user.role_admin():
|
if current_user.role_edit() or current_user.role_admin():
|
||||||
return render_title_template('book_edit.html', book=book, authors=author_names, cc=cc,title=_(u"edit metadata"))
|
return render_title_template('book_edit.html', book=book, authors=author_names,
|
||||||
|
cc=cc,title=_(u"edit metadata"), page="upload")
|
||||||
book_in_shelfs = []
|
book_in_shelfs = []
|
||||||
return render_title_template('detail.html', entry=book, cc=cc, title=book.title, books_shelfs=book_in_shelfs, )
|
return render_title_template('detail.html', entry=book, cc=cc,
|
||||||
|
title=book.title, books_shelfs=book_in_shelfs, page="upload")
|
||||||
return redirect(url_for("index"))
|
return redirect(url_for("index"))
|
||||||
else:
|
else:
|
||||||
return redirect(url_for("index"))
|
return redirect(url_for("index"))
|
||||||
|
Loading…
Reference in New Issue
Block a user