Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
9144a7ce
Commit
9144a7ce
authored
6 years ago
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for sqlalchemy 1.3
parent
feb6a71f
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
120 additions
and
82 deletions
+120
-82
admin.py
cps/admin.py
+9
-9
opds.py
cps/opds.py
+6
-5
config_edit.html
cps/templates/config_edit.html
+42
-42
index.html
cps/templates/index.html
+12
-1
list.html
cps/templates/list.html
+2
-1
ub.py
cps/ub.py
+5
-1
web.py
cps/web.py
+44
-23
No files found.
cps/admin.py
View file @
9144a7ce
...
...
@@ -325,7 +325,7 @@ def configuration_helper(origin):
'credential'
:
os
.
path
.
join
(
config
.
get_main_dir
,
'gdrive_credentials'
)})
else
:
flash
(
_
(
u'client_secrets.json is not configured for web application'
),
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
con
tent
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
con
fig
=
config
,
origin
=
origin
,
gdriveError
=
gdriveError
,
gfeature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
...
...
@@ -351,7 +351,7 @@ def configuration_helper(origin):
else
:
ub
.
session
.
commit
()
flash
(
_
(
u'Keyfile location is not valid, please enter correct path'
),
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
con
tent
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
con
fig
=
config
,
origin
=
origin
,
gdriveError
=
gdriveError
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
...
...
@@ -363,7 +363,7 @@ def configuration_helper(origin):
else
:
ub
.
session
.
commit
()
flash
(
_
(
u'Certfile location is not valid, please enter correct path'
),
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
con
tent
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
con
fig
=
config
,
origin
=
origin
,
gdriveError
=
gdriveError
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
content
.
config_uploading
=
0
...
...
@@ -388,7 +388,7 @@ def configuration_helper(origin):
if
"config_ldap_provider_url"
not
in
to_save
or
"config_ldap_dn"
not
in
to_save
:
ub
.
session
.
commit
()
flash
(
_
(
u'Please enter a LDAP provider and a DN'
),
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
con
tent
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
con
fig
=
config
,
origin
=
origin
,
gdriveError
=
gdriveError
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
else
:
...
...
@@ -446,7 +446,7 @@ def configuration_helper(origin):
else
:
ub
.
session
.
commit
()
flash
(
_
(
u'Logfile location is not valid, please enter correct path'
),
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
con
tent
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
con
fig
=
config
,
origin
=
origin
,
gdriveError
=
gdriveError
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
else
:
...
...
@@ -460,7 +460,7 @@ def configuration_helper(origin):
content
.
config_rarfile_location
=
to_save
[
"config_rarfile_location"
]
.
strip
()
else
:
flash
(
check
[
1
],
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
con
tent
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
con
fig
=
config
,
origin
=
origin
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
))
try
:
if
content
.
config_use_google_drive
and
is_gdrive_ready
()
and
not
\
...
...
@@ -477,14 +477,14 @@ def configuration_helper(origin):
# logging.getLogger("uploader").setLevel(config.config_log_level)
except
Exception
as
e
:
flash
(
e
,
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
con
tent
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
con
fig
=
config
,
origin
=
origin
,
gdriveError
=
gdriveError
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
if
db_change
:
reload
(
db
)
if
not
db
.
setup_db
():
flash
(
_
(
u'DB location is not valid, please enter correct path'
),
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
con
tent
=
config
,
origin
=
origin
,
return
render_title_template
(
"config_edit.html"
,
con
fig
=
config
,
origin
=
origin
,
gdriveError
=
gdriveError
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
if
reboot_required
:
...
...
@@ -498,7 +498,7 @@ def configuration_helper(origin):
gdrivefolders
=
listRootFolders
()
else
:
gdrivefolders
=
list
()
return
render_title_template
(
"config_edit.html"
,
origin
=
origin
,
success
=
success
,
con
tent
=
config
,
return
render_title_template
(
"config_edit.html"
,
origin
=
origin
,
success
=
success
,
con
fig
=
config
,
show_authenticate_google_drive
=
not
is_gdrive_ready
(),
gdriveError
=
gdriveError
,
gdrivefolders
=
gdrivefolders
,
feature_support
=
feature_support
,
title
=
_
(
u"Basic Configuration"
),
page
=
"config"
)
...
...
This diff is collapsed.
Click to expand it.
cps/opds.py
View file @
9144a7ce
...
...
@@ -31,12 +31,13 @@ import ub
from
flask_login
import
current_user
from
functools
import
wraps
from
web
import
login_required_if_no_ano
,
fill_indexpage
,
common_filters
,
get_search_results
,
render_read_books
from
sqlalchemy.sql.expression
import
func
from
sqlalchemy.sql.expression
import
func
,
text
import
helper
from
werkzeug.security
import
check_password_hash
from
werkzeug.datastructures
import
Headers
from
web
import
download_required
import
sys
try
:
from
urllib.parse
import
quote
except
ImportError
:
...
...
@@ -138,7 +139,7 @@ def feed_hot():
def
feed_authorindex
():
off
=
request
.
args
.
get
(
"offset"
)
or
0
entries
=
db
.
session
.
query
(
db
.
Authors
)
.
join
(
db
.
books_authors_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
'books_authors_link.author'
)
.
order_by
(
db
.
Authors
.
sort
)
.
limit
(
config
.
config_books_per_page
)
.
offset
(
off
)
.
group_by
(
text
(
'books_authors_link.author'
)
)
.
order_by
(
db
.
Authors
.
sort
)
.
limit
(
config
.
config_books_per_page
)
.
offset
(
off
)
pagination
=
Pagination
((
int
(
off
)
/
(
int
(
config
.
config_books_per_page
))
+
1
),
config
.
config_books_per_page
,
len
(
db
.
session
.
query
(
db
.
Authors
)
.
all
()))
return
render_xml_template
(
'feed.xml'
,
listelements
=
entries
,
folder
=
'opds.feed_author'
,
pagination
=
pagination
)
...
...
@@ -158,7 +159,7 @@ def feed_author(book_id):
def
feed_publisherindex
():
off
=
request
.
args
.
get
(
"offset"
)
or
0
entries
=
db
.
session
.
query
(
db
.
Publishers
)
.
join
(
db
.
books_publishers_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
'books_publishers_link.publisher'
)
.
order_by
(
db
.
Publishers
.
sort
)
.
limit
(
config
.
config_books_per_page
)
.
offset
(
off
)
.
group_by
(
text
(
'books_publishers_link.publisher'
)
)
.
order_by
(
db
.
Publishers
.
sort
)
.
limit
(
config
.
config_books_per_page
)
.
offset
(
off
)
pagination
=
Pagination
((
int
(
off
)
/
(
int
(
config
.
config_books_per_page
))
+
1
),
config
.
config_books_per_page
,
len
(
db
.
session
.
query
(
db
.
Publishers
)
.
all
()))
return
render_xml_template
(
'feed.xml'
,
listelements
=
entries
,
folder
=
'opds.feed_publisher'
,
pagination
=
pagination
)
...
...
@@ -179,7 +180,7 @@ def feed_publisher(book_id):
def
feed_categoryindex
():
off
=
request
.
args
.
get
(
"offset"
)
or
0
entries
=
db
.
session
.
query
(
db
.
Tags
)
.
join
(
db
.
books_tags_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
'books_tags_link.tag'
)
.
order_by
(
db
.
Tags
.
name
)
.
offset
(
off
)
.
limit
(
config
.
config_books_per_page
)
.
group_by
(
text
(
'books_tags_link.tag'
)
)
.
order_by
(
db
.
Tags
.
name
)
.
offset
(
off
)
.
limit
(
config
.
config_books_per_page
)
pagination
=
Pagination
((
int
(
off
)
/
(
int
(
config
.
config_books_per_page
))
+
1
),
config
.
config_books_per_page
,
len
(
db
.
session
.
query
(
db
.
Tags
)
.
all
()))
return
render_xml_template
(
'feed.xml'
,
listelements
=
entries
,
folder
=
'opds.feed_category'
,
pagination
=
pagination
)
...
...
@@ -199,7 +200,7 @@ def feed_category(book_id):
def
feed_seriesindex
():
off
=
request
.
args
.
get
(
"offset"
)
or
0
entries
=
db
.
session
.
query
(
db
.
Series
)
.
join
(
db
.
books_series_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
'books_series_link.series'
)
.
order_by
(
db
.
Series
.
sort
)
.
offset
(
off
)
.
all
()
.
group_by
(
text
(
'books_series_link.series'
)
)
.
order_by
(
db
.
Series
.
sort
)
.
offset
(
off
)
.
all
()
pagination
=
Pagination
((
int
(
off
)
/
(
int
(
config
.
config_books_per_page
))
+
1
),
config
.
config_books_per_page
,
len
(
db
.
session
.
query
(
db
.
Series
)
.
all
()))
return
render_xml_template
(
'feed.xml'
,
listelements
=
entries
,
folder
=
'opds.feed_series'
,
pagination
=
pagination
)
...
...
This diff is collapsed.
Click to expand it.
cps/templates/config_edit.html
View file @
9144a7ce
...
...
@@ -17,10 +17,10 @@
<div
class=
"panel-body"
>
<div
class=
"form-group required"
>
<label
for=
"config_calibre_dir"
>
{{_('Location of Calibre database')}}
</label>
<input
type=
"text"
class=
"form-control"
name=
"config_calibre_dir"
id=
"config_calibre_dir"
value=
"{% if con
tent.config_calibre_dir != None %}{{ content
.config_calibre_dir }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control"
name=
"config_calibre_dir"
id=
"config_calibre_dir"
value=
"{% if con
fig.config_calibre_dir != None %}{{ config
.config_calibre_dir }}{% endif %}"
autocomplete=
"off"
>
</div>
<div
class=
"form-group required"
>
<input
type=
"checkbox"
id=
"config_use_google_drive"
name=
"config_use_google_drive"
data-control=
"gdrive_settings"
{%
if
con
tent
.
config_use_google_drive
%}
checked
{%
endif
%}
>
<input
type=
"checkbox"
id=
"config_use_google_drive"
name=
"config_use_google_drive"
data-control=
"gdrive_settings"
{%
if
con
fig
.
config_use_google_drive
%}
checked
{%
endif
%}
>
<label
for=
"config_use_google_drive"
>
{{_('Use Google Drive?')}}
</label>
</div>
<div
data-related=
"gdrive_settings"
>
...
...
@@ -31,12 +31,12 @@
</label>
</div>
{% else %}
{% if show_authenticate_google_drive and g.user.is_authenticated and con
tent
.config_use_google_drive %}
{% if show_authenticate_google_drive and g.user.is_authenticated and con
fig
.config_use_google_drive %}
<div
class=
"form-group required"
>
<a
href=
"{{ url_for('gdrive.authenticate_google_drive') }}"
class=
"btn btn-primary"
>
{{_('Authenticate Google Drive')}}
</a>
</div>
{% else %}
{% if show_authenticate_google_drive and g.user.is_authenticated and not con
tent
.config_use_google_drive %}
{% if show_authenticate_google_drive and g.user.is_authenticated and not con
fig
.config_use_google_drive %}
<div
>
{{_('Please hit submit to continue with setup')}}
</div>
{% endif %}
{% if not g.user.is_authenticated %}
...
...
@@ -48,14 +48,14 @@
<label
for=
"config_google_drive_folder"
>
{{_('Google Drive Calibre folder')}}
</label>
<select
name=
"config_google_drive_folder"
id=
"config_google_drive_folder"
class=
"form-control"
>
{% for gdrivefolder in gdrivefolders %}
<option
value=
"{{ gdrivefolder.title }}"
{%
if
gdrivefolder
.
title =
=
con
tent
.
config_google_drive_folder
%}
selected
{%
endif
%}
>
{{ gdrivefolder.title }}
</option>
<option
value=
"{{ gdrivefolder.title }}"
{%
if
gdrivefolder
.
title =
=
con
fig
.
config_google_drive_folder
%}
selected
{%
endif
%}
>
{{ gdrivefolder.title }}
</option>
{% endfor %}
</select>
</div>
{% if con
tent
.config_google_drive_watch_changes_response %}
{% if con
fig
.config_google_drive_watch_changes_response %}
<label
for=
"config_google_drive_watch_changes_response"
>
{{_('Metadata Watch Channel ID')}}
</label>
<div
class=
"form-group input-group required"
>
<input
type=
"text"
class=
"form-control"
name=
"config_google_drive_watch_changes_response"
id=
"config_google_drive_watch_changes_response"
value=
"{{ con
tent
.config_google_drive_watch_changes_response['id'] }} expires on {{ content.config_google_drive_watch_changes_response['expiration'] | strftime }}"
autocomplete=
"off"
disabled=
""
>
<input
type=
"text"
class=
"form-control"
name=
"config_google_drive_watch_changes_response"
id=
"config_google_drive_watch_changes_response"
value=
"{{ con
fig
.config_google_drive_watch_changes_response['id'] }} expires on {{ content.config_google_drive_watch_changes_response['expiration'] | strftime }}"
autocomplete=
"off"
disabled=
""
>
<span
class=
"input-group-btn"
><a
href=
"{{ url_for('gdrive.revoke_watch_gdrive') }}"
class=
"btn btn-primary"
>
{{_('Revoke')}}
</a></span>
</div>
{% else %}
...
...
@@ -83,23 +83,23 @@
<div
class=
"panel-body"
>
<div
class=
"form-group"
>
<label
for=
"config_port"
>
{{_('Server Port')}}
</label>
<input
type=
"number"
min=
"1"
max=
"65535"
class=
"form-control"
name=
"config_port"
id=
"config_port"
value=
"{% if con
tent.config_port != None %}{{ content
.config_port }}{% endif %}"
autocomplete=
"off"
required
>
<input
type=
"number"
min=
"1"
max=
"65535"
class=
"form-control"
name=
"config_port"
id=
"config_port"
value=
"{% if con
fig.config_port != None %}{{ config
.config_port }}{% endif %}"
autocomplete=
"off"
required
>
</div>
<div
class=
"form-group"
>
<label
for=
"config_certfile"
>
{{_('SSL certfile location (leave it empty for non-SSL Servers)')}}
</label>
<input
type=
"text"
class=
"form-control"
name=
"config_certfile"
id=
"config_certfile"
value=
"{% if con
tent.config_certfile != None %}{{ content
.config_certfile }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control"
name=
"config_certfile"
id=
"config_certfile"
value=
"{% if con
fig.config_certfile != None %}{{ config
.config_certfile }}{% endif %}"
autocomplete=
"off"
>
</div>
<div
class=
"form-group"
>
<label
for=
"config_keyfile"
>
{{_('SSL Keyfile location (leave it empty for non-SSL Servers)')}}
</label>
<input
type=
"text"
class=
"form-control"
name=
"config_keyfile"
id=
"config_keyfile"
value=
"{% if con
tent.config_keyfile != None %}{{ content
.config_keyfile }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control"
name=
"config_keyfile"
id=
"config_keyfile"
value=
"{% if con
fig.config_keyfile != None %}{{ config
.config_keyfile }}{% endif %}"
autocomplete=
"off"
>
</div>
<div
class=
"form-group"
>
<label
for=
"config_updater"
>
{{_('Update channel')}}
</label>
<select
name=
"config_updater"
id=
"config_updater"
class=
"form-control"
>
<option
value=
"0"
{%
if
con
tent
.
config_updatechannel =
=
0
%}
selected
{%
endif
%}
>
{{_('Stable')}}
</option>
<!--option value="1" {% if con
tent
.config_updatechannel == 1 %}selected{% endif %}>{{_('Stable (Automatic)')}}</option-->
<option
value=
"2"
{%
if
con
tent
.
config_updatechannel =
=
2
%}
selected
{%
endif
%}
>
{{_('Nightly')}}
</option>
<!--option-- value="3" {% if con
tent
.config_updatechannel == 3 %}selected{% endif %}>{{_('Nightly (Automatic)')}}</option-->
<option
value=
"0"
{%
if
con
fig
.
config_updatechannel =
=
0
%}
selected
{%
endif
%}
>
{{_('Stable')}}
</option>
<!--option value="1" {% if con
fig
.config_updatechannel == 1 %}selected{% endif %}>{{_('Stable (Automatic)')}}</option-->
<option
value=
"2"
{%
if
con
fig
.
config_updatechannel =
=
2
%}
selected
{%
endif
%}
>
{{_('Nightly')}}
</option>
<!--option-- value="3" {% if con
fig
.config_updatechannel == 3 %}selected{% endif %}>{{_('Nightly (Automatic)')}}</option-->
</select>
</div>
</div>
...
...
@@ -119,15 +119,15 @@
<div
class=
"form-group"
>
<label
for=
"config_log_level"
>
{{_('Log Level')}}
</label>
<select
name=
"config_log_level"
id=
"config_log_level"
class=
"form-control"
>
<option
value=
"10"
{%
if
con
tent
.
config_log_level =
=
10
%}
selected
{%
endif
%}
>
DEBUG
</option>
<option
value=
"20"
{%
if
con
tent
.
config_log_level =
=
20
or
content
.
config_log_level =
=
None
%}
selected
{%
endif
%}
>
INFO
</option>
<option
value=
"30"
{%
if
con
tent
.
config_log_level =
=
30
%}
selected
{%
endif
%}
>
WARNING
</option>
<option
value=
"40"
{%
if
con
tent
.
config_log_level =
=
40
%}
selected
{%
endif
%}
>
ERROR
</option>
<option
value=
"10"
{%
if
con
fig
.
config_log_level =
=
10
%}
selected
{%
endif
%}
>
DEBUG
</option>
<option
value=
"20"
{%
if
con
fig
.
config_log_level =
=
20
or
config
.
config_log_level =
=
None
%}
selected
{%
endif
%}
>
INFO
</option>
<option
value=
"30"
{%
if
con
fig
.
config_log_level =
=
30
%}
selected
{%
endif
%}
>
WARNING
</option>
<option
value=
"40"
{%
if
con
fig
.
config_log_level =
=
40
%}
selected
{%
endif
%}
>
ERROR
</option>
</select>
</div>
<div
class=
"form-group"
>
<label
for=
"config_logfile"
>
{{_('Location and name of logfile (calibre-web.log for no entry)')}}
</label>
<input
type=
"text"
class=
"form-control"
name=
"config_logfile"
id=
"config_logfile"
value=
"{% if con
tent.config_logfile != None %}{{ content
.config_logfile }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control"
name=
"config_logfile"
id=
"config_logfile"
value=
"{% if con
fig.config_logfile != None %}{{ config
.config_logfile }}{% endif %}"
autocomplete=
"off"
>
</div>
</div>
</div>
...
...
@@ -144,35 +144,35 @@
<div
id=
"collapsefive"
class=
"panel-collapse collapse"
>
<div
class=
"panel-body"
>
<div
class=
"form-group"
>
<input
type=
"checkbox"
id=
"config_uploading"
name=
"config_uploading"
{%
if
con
tent
.
config_uploading
%}
checked
{%
endif
%}
>
<input
type=
"checkbox"
id=
"config_uploading"
name=
"config_uploading"
{%
if
con
fig
.
config_uploading
%}
checked
{%
endif
%}
>
<label
for=
"config_uploading"
>
{{_('Enable uploading')}}
</label>
</div>
<div
class=
"form-group"
>
<input
type=
"checkbox"
id=
"config_anonbrowse"
name=
"config_anonbrowse"
{%
if
con
tent
.
config_anonbrowse
%}
checked
{%
endif
%}
>
<input
type=
"checkbox"
id=
"config_anonbrowse"
name=
"config_anonbrowse"
{%
if
con
fig
.
config_anonbrowse
%}
checked
{%
endif
%}
>
<label
for=
"config_anonbrowse"
>
{{_('Enable anonymous browsing')}}
</label>
</div>
<div
class=
"form-group"
>
<input
type=
"checkbox"
id=
"config_public_reg"
name=
"config_public_reg"
{%
if
con
tent
.
config_public_reg
%}
checked
{%
endif
%}
>
<input
type=
"checkbox"
id=
"config_public_reg"
name=
"config_public_reg"
{%
if
con
fig
.
config_public_reg
%}
checked
{%
endif
%}
>
<label
for=
"config_public_reg"
>
{{_('Enable public registration')}}
</label>
</div>
<div
class=
"form-group"
>
<input
type=
"checkbox"
id=
"config_remote_login"
name=
"config_remote_login"
{%
if
con
tent
.
config_remote_login
%}
checked
{%
endif
%}
>
<input
type=
"checkbox"
id=
"config_remote_login"
name=
"config_remote_login"
{%
if
con
fig
.
config_remote_login
%}
checked
{%
endif
%}
>
<label
for=
"config_remote_login"
>
{{_('Enable remote login ("magic link")')}}
</label>
</div>
{% if feature_support['goodreads'] %}
<div
class=
"form-group"
>
<input
type=
"checkbox"
id=
"config_use_goodreads"
name=
"config_use_goodreads"
data-control=
"goodreads-settings"
{%
if
con
tent
.
config_use_goodreads
%}
checked
{%
endif
%}
>
<input
type=
"checkbox"
id=
"config_use_goodreads"
name=
"config_use_goodreads"
data-control=
"goodreads-settings"
{%
if
con
fig
.
config_use_goodreads
%}
checked
{%
endif
%}
>
<label
for=
"config_use_goodreads"
>
{{_('Use')}} Goodreads
</label>
<a
href=
"https://www.goodreads.com/api/keys"
target=
"_blank"
style=
"margin-left: 5px"
>
{{_('Obtain an API Key')}}
</a>
</div>
<div
data-related=
"goodreads-settings"
>
<div
class=
"form-group"
>
<label
for=
"config_goodreads_api_key"
>
{{_('Goodreads API Key')}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"config_goodreads_api_key"
name=
"config_goodreads_api_key"
value=
"{% if con
tent.config_goodreads_api_key != None %}{{ content
.config_goodreads_api_key }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control"
id=
"config_goodreads_api_key"
name=
"config_goodreads_api_key"
value=
"{% if con
fig.config_goodreads_api_key != None %}{{ config
.config_goodreads_api_key }}{% endif %}"
autocomplete=
"off"
>
</div>
<div
class=
"form-group"
>
<label
for=
"config_goodreads_api_secret"
>
{{_('Goodreads API Secret')}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"config_goodreads_api_secret"
name=
"config_goodreads_api_secret"
value=
"{% if con
tent.config_goodreads_api_secret != None %}{{ content
.config_goodreads_api_secret }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control"
id=
"config_goodreads_api_secret"
name=
"config_goodreads_api_secret"
value=
"{% if con
fig.config_goodreads_api_secret != None %}{{ config
.config_goodreads_api_secret }}{% endif %}"
autocomplete=
"off"
>
</div>
</div>
{% endif %}
...
...
@@ -180,13 +180,13 @@
<div
class=
"form-group"
>
<label
for=
"config_login_type"
>
{{_('Login type')}}
</label>
<select
name=
"config_login_type"
id=
"config_login_type"
class=
"form-control"
data-control=
"login-settings"
>
<option
value=
"0"
{%
if
con
tent
.
config_login_type =
=
0
%}
selected
{%
endif
%}
>
{{_('Use standard Authentication')}}
</option>
<option
value=
"0"
{%
if
con
fig
.
config_login_type =
=
0
%}
selected
{%
endif
%}
>
{{_('Use standard Authentication')}}
</option>
{% if feature_support['ldap'] %}
<option
value=
"1"
{%
if
con
tent
.
config_login_type =
=
1
%}
selected
{%
endif
%}
>
{{_('Use LDAP Authentication')}}
</option>
<option
value=
"1"
{%
if
con
fig
.
config_login_type =
=
1
%}
selected
{%
endif
%}
>
{{_('Use LDAP Authentication')}}
</option>
{% endif %}
{% if feature_support['oauth'] %}
<option
value=
"2"
{%
if
con
tent
.
config_login_type =
=
2
%}
selected
{%
endif
%}
>
{{_('Use GitHub OAuth')}}
</option>
<option
value=
"3"
{%
if
con
tent
.
config_login_type =
=
3
%}
selected
{%
endif
%}
>
{{_('Use Google OAuth')}}
</option>
<option
value=
"2"
{%
if
con
fig
.
config_login_type =
=
2
%}
selected
{%
endif
%}
>
{{_('Use GitHub OAuth')}}
</option>
<option
value=
"3"
{%
if
con
fig
.
config_login_type =
=
3
%}
selected
{%
endif
%}
>
{{_('Use Google OAuth')}}
</option>
{% endif %}
</select>
</div>
...
...
@@ -194,11 +194,11 @@
<div
data-related=
"login-settings-1"
>
<div
class=
"form-group"
>
<label
for=
"config_ldap_provider_url"
>
{{_('LDAP Provider URL')}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"config_ldap_provider_url"
name=
"config_ldap_provider_url"
value=
"{% if con
tent.config_ldap_provider_url != None %}{{ content
.config_ldap_provider_url }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control"
id=
"config_ldap_provider_url"
name=
"config_ldap_provider_url"
value=
"{% if con
fig.config_ldap_provider_url != None %}{{ config
.config_ldap_provider_url }}{% endif %}"
autocomplete=
"off"
>
</div>
<div
class=
"form-group"
>
<label
for=
"config_ldap_dn"
>
{{_('LDAP Distinguished Name (DN)')}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"config_ldap_dn"
name=
"config_ldap_dn"
value=
"{% if con
tent.config_ldap_dn != None %}{{ content
.config_ldap_dn }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control"
id=
"config_ldap_dn"
name=
"config_ldap_dn"
value=
"{% if con
fig.config_ldap_dn != None %}{{ config
.config_ldap_dn }}{% endif %}"
autocomplete=
"off"
>
</div>
</div>
{% endif %}
...
...
@@ -209,11 +209,11 @@
</div>
<div
class=
"form-group"
>
<label
for=
"config_github_oauth_client_id"
>
{{_('GitHub OAuth Client Id')}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"config_github_oauth_client_id"
name=
"config_github_oauth_client_id"
value=
"{% if con
tent.config_github_oauth_client_id != None %}{{ content
.config_github_oauth_client_id }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control"
id=
"config_github_oauth_client_id"
name=
"config_github_oauth_client_id"
value=
"{% if con
fig.config_github_oauth_client_id != None %}{{ config
.config_github_oauth_client_id }}{% endif %}"
autocomplete=
"off"
>
</div>
<div
class=
"form-group"
>
<label
for=
"config_github_oauth_client_secret"
>
{{_('GitHub OAuth Client Secret')}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"config_github_oauth_client_secret"
name=
"config_github_oauth_client_secret"
value=
"{% if con
tent.config_github_oauth_client_secret != None %}{{ content
.config_github_oauth_client_secret }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control"
id=
"config_github_oauth_client_secret"
name=
"config_github_oauth_client_secret"
value=
"{% if con
fig.config_github_oauth_client_secret != None %}{{ config
.config_github_oauth_client_secret }}{% endif %}"
autocomplete=
"off"
>
</div>
</div>
<div
data-related=
"login-settings-3"
>
...
...
@@ -222,11 +222,11 @@
</div>
<div
class=
"form-group"
>
<label
for=
"config_google_oauth_client_id"
>
{{_('Google OAuth Client Id')}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"config_google_oauth_client_id"
name=
"config_google_oauth_client_id"
value=
"{% if con
tent.config_google_oauth_client_id != None %}{{ content
.config_google_oauth_client_id }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control"
id=
"config_google_oauth_client_id"
name=
"config_google_oauth_client_id"
value=
"{% if con
fig.config_google_oauth_client_id != None %}{{ config
.config_google_oauth_client_id }}{% endif %}"
autocomplete=
"off"
>
</div>
<div
class=
"form-group"
>
<label
for=
"config_google_oauth_client_secret"
>
{{_('Google OAuth Client Secret')}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"config_google_oauth_client_secret"
name=
"config_google_oauth_client_secret"
value=
"{% if con
tent.config_google_oauth_client_secret != None %}{{ content
.config_google_oauth_client_secret }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control"
id=
"config_google_oauth_client_secret"
name=
"config_google_oauth_client_secret"
value=
"{% if con
fig.config_google_oauth_client_secret != None %}{{ config
.config_google_oauth_client_secret }}{% endif %}"
autocomplete=
"off"
>
</div>
</div>
{% endif %}
...
...
@@ -246,27 +246,27 @@
<div
id=
"collapseeight"
class=
"panel-collapse collapse"
>
<div
class=
"panel-body"
>
<div
class=
"form-group"
>
<div><input
type=
"radio"
name=
"config_ebookconverter"
id=
"converter0"
value=
"0"
{%
if
con
tent
.
config_ebookconverter =
=
0
%}
checked
{%
endif
%}
>
<div><input
type=
"radio"
name=
"config_ebookconverter"
id=
"converter0"
value=
"0"
{%
if
con
fig
.
config_ebookconverter =
=
0
%}
checked
{%
endif
%}
>
<label
for=
"converter0"
>
{{_('No converter')}}
</label></div>
<div><input
type=
"radio"
name=
"config_ebookconverter"
id=
"converter1"
value=
"1"
{%
if
con
tent
.
config_ebookconverter =
=
1
%}
checked
{%
endif
%}
>
<div><input
type=
"radio"
name=
"config_ebookconverter"
id=
"converter1"
value=
"1"
{%
if
con
fig
.
config_ebookconverter =
=
1
%}
checked
{%
endif
%}
>
<label
for=
"converter1"
>
{{_('Use Kindlegen')}}
</label></div>
<div><input
type=
"radio"
name=
"config_ebookconverter"
id=
"converter2"
value=
"2"
{%
if
con
tent
.
config_ebookconverter =
=
2
%}
checked
{%
endif
%}
>
<div><input
type=
"radio"
name=
"config_ebookconverter"
id=
"converter2"
value=
"2"
{%
if
con
fig
.
config_ebookconverter =
=
2
%}
checked
{%
endif
%}
>
<label
for=
"converter2"
>
{{_('Use calibre\'s ebook converter')}}
</label></div>
</div>
<div
data-related=
"calibre"
>
<div
class=
"form-group"
>
<label
for=
"config_calibre"
>
{{_('E-Book converter settings')}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"config_calibre"
name=
"config_calibre"
value=
"{% if con
tent.config_calibre != None %}{{ content
.config_calibre }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control"
id=
"config_calibre"
name=
"config_calibre"
value=
"{% if con
fig.config_calibre != None %}{{ config
.config_calibre }}{% endif %}"
autocomplete=
"off"
>
</div>
<div
class=
"form-group"
>
<label
for=
"config_calibre"
>
{{_('Path to convertertool')}}
</label>
<input
type=
"text"
class=
"form-control"
id=
"config_converterpath"
name=
"config_converterpath"
value=
"{% if con
tent.config_converterpath != None %}{{ content
.config_converterpath }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control"
id=
"config_converterpath"
name=
"config_converterpath"
value=
"{% if con
fig.config_converterpath != None %}{{ config
.config_converterpath }}{% endif %}"
autocomplete=
"off"
>
</div>
</div>
{% if rarfile_support %}
<div
class=
"form-group"
>
<label
for=
"config_rarfile_location"
>
{{_('Location of Unrar binary')}}
</label>
<input
type=
"text"
class=
"form-control"
name=
"config_rarfile_location"
id=
"config_rarfile_location"
value=
"{% if con
tent.config_rarfile_location != None %}{{ content
.config_rarfile_location }}{% endif %}"
autocomplete=
"off"
>
<input
type=
"text"
class=
"form-control"
name=
"config_rarfile_location"
id=
"config_rarfile_location"
value=
"{% if con
fig.config_rarfile_location != None %}{{ config
.config_rarfile_location }}{% endif %}"
autocomplete=
"off"
>
</div>
{% endif %}
</div>
...
...
This diff is collapsed.
Click to expand it.
cps/templates/index.html
View file @
9144a7ce
...
...
@@ -4,7 +4,6 @@
<div
class=
"discover random-books"
>
<h2
class=
"random-books"
>
{{_('Discover (Random Books)')}}
</h2>
<div
class=
"row"
>
{% for entry in random %}
<div
class=
"col-sm-3 col-lg-2 col-xs-6 book"
id=
"books_rand"
>
<div
class=
"cover"
>
...
...
@@ -48,6 +47,18 @@
{% endif %}
<div
class=
"discover load-more"
>
<h2
class=
"{{title}}"
>
{{_(title)}}
</h2>
<div
class=
"filterheader hidden-xs hidden-sm"
>
<a
id=
"new"
class=
"btn btn-primary"
href=
"{{url_for('web.newest_books')}}"
><span
class=
"glyphicon glyphicon-sort-by-order"
></span></a>
<a
id=
"old"
class=
"btn btn-primary"
href=
"{{url_for('web.oldest_books')}}"
><span
class=
"glyphicon glyphicon-sort-by-order-alt"
></span></a>
<a
id=
"asc"
class=
"btn btn-primary"
href=
"{{url_for('web.titles_ascending')}}"
><span
class=
"glyphicon glyphicon-font"
></span><span
class=
"glyphicon glyphicon-sort-by-alphabet"
></span></a>
<a
id=
"desc"
class=
"btn btn-primary"
href=
"{{url_for('web.titles_descending')}}"
><span
class=
"glyphicon glyphicon-font"
></span><span
class=
"glyphicon glyphicon-sort-by-alphabet-alt"
></span></a>
<a
id=
"pub_new"
class=
"btn btn-primary"
href=
"{{url_for('web.titles_descending')}}"
><span
class=
"glyphicon glyphicon-calendar"
></span><span
class=
"glyphicon glyphicon-sort-by-order"
></a>
<a
id=
"pub_old"
class=
"btn btn-primary"
href=
"{{url_for('web.titles_descending')}}"
><span
class=
"glyphicon glyphicon-calendar"
></span><span
class=
"glyphicon glyphicon-sort-by-order-alt"
></a>
<div
class=
"btn-group character"
role=
"group"
>
<a
id=
"no_shelf"
class=
"btn btn-primary"
href=
"{{url_for('web.titles_descending')}}"
><span
class=
"glyphicon glyphicon-list"
></span><b>
?
</b></a>
<div
id=
"all"
class=
"btn btn-primary"
>
{{_('All')}}
</div>
</div>
</div>
<div
class=
"row"
>
{% if entries[0] %}
{% for entry in entries %}
...
...
This diff is collapsed.
Click to expand it.
cps/templates/list.html
View file @
9144a7ce
{% extends "layout.html" %}
{% block body %}
<h1
class=
"{{page}}"
>
{{_(title)}}
</h1>
<div
class=
"container"
>
<div
class=
"filterheader hidden-xs hidden-sm"
>
<button
id=
"desc"
class=
"btn btn-success"
><span
class=
"glyphicon glyphicon-sort-by-alphabet"
></span></button>
<button
id=
"asc"
class=
"btn btn-success"
><span
class=
"glyphicon glyphicon-sort-by-alphabet-alt"
></span></button>
...
...
@@ -12,6 +12,7 @@
{% endfor %}
</div>
</div>
<div
class=
"container"
>
<div
id=
"list"
class=
"col-xs-12 col-sm-6"
>
{% for entry in entries %}
<div
class=
"row"
data-id=
"{% if entry[0].sort %}{{entry[0].sort}}{% else %}{{entry[0].name}}{% endif %}"
>
...
...
This diff is collapsed.
Click to expand it.
cps/ub.py
View file @
9144a7ce
...
...
@@ -70,6 +70,7 @@ SIDEBAR_RECENT = 512
SIDEBAR_SORTED
=
1024
MATURE_CONTENT
=
2048
SIDEBAR_PUBLISHER
=
4096
SIDEBAR_RATING
=
8192
UPDATE_STABLE
=
0
AUTO_UPDATE_STABLE
=
1
...
...
@@ -139,6 +140,9 @@ def get_sidebar_config(kwargs=[]):
"visibility"
:
SIDEBAR_LANGUAGE
,
'public'
:
(
g
.
user
.
filter_language
()
==
'all'
),
"page"
:
"language"
,
"show_text"
:
_
(
'Show language selection'
),
"config_show"
:
True
})
sidebar
.
append
({
"glyph"
:
"glyphicon-star-empty"
,
"text"
:
_
(
'Ratings'
),
"link"
:
'web.ratings_list'
,
"id"
:
"rate"
,
"visibility"
:
SIDEBAR_RATING
,
'public'
:
True
,
"page"
:
"rating"
,
"show_text"
:
_
(
'Show ratings selection'
),
"config_show"
:
True
})
return
sidebar
...
...
@@ -835,7 +839,7 @@ def create_admin_user():
user
.
role
=
ROLE_USER
+
ROLE_ADMIN
+
ROLE_DOWNLOAD
+
ROLE_UPLOAD
+
ROLE_EDIT
+
ROLE_DELETE_BOOKS
+
ROLE_PASSWD
user
.
sidebar_view
=
DETAIL_RANDOM
+
SIDEBAR_LANGUAGE
+
SIDEBAR_SERIES
+
SIDEBAR_CATEGORY
+
SIDEBAR_HOT
+
\
SIDEBAR_RANDOM
+
SIDEBAR_AUTHOR
+
SIDEBAR_BEST_RATED
+
SIDEBAR_READ_AND_UNREAD
+
SIDEBAR_RECENT
+
\
SIDEBAR_SORTED
+
SIDEBAR_PUBLISHER
SIDEBAR_SORTED
+
+
MATURE_CONTENT
+
SIDEBAR_PUBLISHER
+
SIDEBAR_RATING
user
.
password
=
generate_password_hash
(
DEFAULT_PASS
)
...
...
This diff is collapsed.
Click to expand it.
cps/web.py
View file @
9144a7ce
...
...
@@ -501,36 +501,27 @@ def index(page):
@
web
.
route
(
'/books/newest/page/<int:page>'
)
@
login_required_if_no_ano
def
newest_books
(
page
):
if
current_user
.
show_sorted
():
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
,
title
=
_
(
u"Newest Books"
),
page
=
"newest"
)
else
:
abort
(
404
)
@
web
.
route
(
'/books/oldest'
,
defaults
=
{
'page'
:
1
})
@
web
.
route
(
'/books/oldest/page/<int:page>'
)
@
login_required_if_no_ano
def
oldest_books
(
page
):
if
current_user
.
show_sorted
():
entries
,
random
,
pagination
=
fill_indexpage
(
page
,
db
.
Books
,
True
,
[
db
.
Books
.
pubdate
])
return
render_title_template
(
'index.html'
,
random
=
random
,
entries
=
entries
,
pagination
=
pagination
,
title
=
_
(
u"Oldest Books"
),
page
=
"oldest"
)
else
:
abort
(
404
)
@
web
.
route
(
'/books/a-z'
,
defaults
=
{
'page'
:
1
})
@
web
.
route
(
'/books/a-z/page/<int:page>'
)
@
login_required_if_no_ano
def
titles_ascending
(
page
):
if
current_user
.
show_sorted
():
entries
,
random
,
pagination
=
fill_indexpage
(
page
,
db
.
Books
,
True
,
[
db
.
Books
.
sort
])
return
render_title_template
(
'index.html'
,
random
=
random
,
entries
=
entries
,
pagination
=
pagination
,
title
=
_
(
u"Books (A-Z)"
),
page
=
"a-z"
)
else
:
abort
(
404
)
@
web
.
route
(
'/books/z-a'
,
defaults
=
{
'page'
:
1
})
...
...
@@ -605,7 +596,7 @@ def author_list():
if
current_user
.
check_visibility
(
ub
.
SIDEBAR_AUTHOR
):
entries
=
db
.
session
.
query
(
db
.
Authors
,
func
.
count
(
'books_authors_link.book'
)
.
label
(
'count'
))
\
.
join
(
db
.
books_authors_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
'books_authors_link.author'
)
.
order_by
(
db
.
Authors
.
sort
)
.
all
()
.
group_by
(
text
(
'books_authors_link.author'
)
)
.
order_by
(
db
.
Authors
.
sort
)
.
all
()
charlist
=
db
.
session
.
query
(
func
.
upper
(
func
.
substr
(
db
.
Authors
.
sort
,
1
,
1
))
.
label
(
'char'
))
\
.
join
(
db
.
books_authors_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
func
.
upper
(
func
.
substr
(
db
.
Authors
.
sort
,
1
,
1
)))
.
all
()
...
...
@@ -650,7 +641,7 @@ def publisher_list():
if
current_user
.
check_visibility
(
ub
.
SIDEBAR_PUBLISHER
):
entries
=
db
.
session
.
query
(
db
.
Publishers
,
func
.
count
(
'books_publishers_link.book'
)
.
label
(
'count'
))
\
.
join
(
db
.
books_publishers_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
'books_publishers_link.publisher'
)
.
order_by
(
db
.
Publishers
.
sort
)
.
all
()
.
group_by
(
text
(
'books_publishers_link.publisher'
)
)
.
order_by
(
db
.
Publishers
.
sort
)
.
all
()
charlist
=
db
.
session
.
query
(
func
.
upper
(
func
.
substr
(
db
.
Publishers
.
name
,
1
,
1
))
.
label
(
'char'
))
\
.
join
(
db
.
books_publishers_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
func
.
upper
(
func
.
substr
(
db
.
Publishers
.
name
,
1
,
1
)))
.
all
()
...
...
@@ -704,7 +695,7 @@ def series_list():
if
current_user
.
check_visibility
(
ub
.
SIDEBAR_SERIES
):
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
())
\
.
group_by
(
'books_series_link.series'
)
.
order_by
(
db
.
Series
.
sort
)
.
all
()
.
group_by
(
text
(
'books_series_link.series'
)
)
.
order_by
(
db
.
Series
.
sort
)
.
all
()
charlist
=
db
.
session
.
query
(
func
.
upper
(
func
.
substr
(
db
.
Series
.
sort
,
1
,
1
))
.
label
(
'char'
))
\
.
join
(
db
.
books_series_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
func
.
upper
(
func
.
substr
(
db
.
Series
.
sort
,
1
,
1
)))
.
all
()
...
...
@@ -728,6 +719,36 @@ def series(book_id, page):
abort
(
404
)
@
web
.
route
(
"/ratings"
)
@
login_required_if_no_ano
def
ratings_list
():
if
current_user
.
check_visibility
(
ub
.
SIDEBAR_RATING
):
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
())
\
.
group_by
(
text
(
'books_series_link.series'
))
.
order_by
(
db
.
Series
.
sort
)
.
all
()
charlist
=
db
.
session
.
query
(
func
.
upper
(
func
.
substr
(
db
.
Series
.
sort
,
1
,
1
))
.
label
(
'char'
))
\
.
join
(
db
.
books_series_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
func
.
upper
(
func
.
substr
(
db
.
Series
.
sort
,
1
,
1
)))
.
all
()
return
render_title_template
(
'list.html'
,
entries
=
entries
,
folder
=
'web.series'
,
charlist
=
charlist
,
title
=
_
(
u"Ratings list"
),
page
=
"ratingslist"
)
else
:
abort
(
404
)
@
web
.
route
(
"/ratings/<int:book_id>/"
,
defaults
=
{
'page'
:
1
})
@
web
.
route
(
"/ratings/<int:book_id>/<int:page>"
)
@
login_required_if_no_ano
def
ratings
(
book_id
,
page
):
name
=
db
.
session
.
query
(
db
.
Series
)
.
filter
(
db
.
Series
.
id
==
book_id
)
.
first
()
if
name
:
entries
,
random
,
pagination
=
fill_indexpage
(
page
,
db
.
Books
,
db
.
Books
.
series
.
any
(
db
.
Series
.
id
==
book_id
),
[
db
.
Books
.
series_index
])
return
render_title_template
(
'index.html'
,
random
=
random
,
pagination
=
pagination
,
entries
=
entries
,
title
=
_
(
u"Ratings:
%(serie)
s"
,
serie
=
name
.
name
),
page
=
"ratings"
)
else
:
abort
(
404
)
@
web
.
route
(
"/language"
)
@
login_required_if_no_ano
def
language_overview
():
...
...
@@ -749,7 +770,7 @@ def language_overview():
languages
[
0
]
.
name
=
_
(
isoLanguages
.
get
(
part3
=
languages
[
0
]
.
lang_code
)
.
name
)
lang_counter
=
db
.
session
.
query
(
db
.
books_languages_link
,
func
.
count
(
'books_languages_link.book'
)
.
label
(
'bookcount'
))
.
group_by
(
'books_languages_link.lang_code'
)
.
all
()
text
(
'books_languages_link.lang_code'
)
)
.
all
()
return
render_title_template
(
'languages.html'
,
languages
=
languages
,
lang_counter
=
lang_counter
,
charlist
=
charlist
,
title
=
_
(
u"Available languages"
),
page
=
"langlist"
)
else
:
...
...
@@ -780,7 +801,7 @@ def category_list():
if
current_user
.
check_visibility
(
ub
.
SIDEBAR_CATEGORY
):
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
())
\
.
group_by
(
'books_tags_link.tag'
)
.
all
()
.
group_by
(
text
(
'books_tags_link.tag'
)
)
.
all
()
charlist
=
db
.
session
.
query
(
func
.
upper
(
func
.
substr
(
db
.
Tags
.
name
,
1
,
1
))
.
label
(
'char'
))
\
.
join
(
db
.
books_tags_link
)
.
join
(
db
.
Books
)
.
filter
(
common_filters
())
\
.
group_by
(
func
.
upper
(
func
.
substr
(
db
.
Tags
.
name
,
1
,
1
)))
.
all
()
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment