-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhooks.py
More file actions
112 lines (97 loc) · 3 KB
/
hooks.py
File metadata and controls
112 lines (97 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
from django.template.loader import render_to_string
from plugins.apc import plugin_settings
from utils import setting_handler
from submission import models as submission_models
def publication_fees(context):
plugin = plugin_settings.get_self()
request = context['request']
enable_apcs = setting_handler.get_plugin_setting(
plugin,
'enable_apcs',
request.journal,
create=True,
pretty='Enable APCs',
)
track_apcs = setting_handler.get_plugin_setting(
plugin,
'track_apcs',
request.journal,
create=True,
pretty='Track APCs',
)
sections = submission_models.Section.objects.filter(
journal=request.journal,
public_submissions=True,
).prefetch_related('sectionapc')
if track_apcs.value == 'on':
return ''
elif enable_apcs.value == 'on':
return render_to_string(
'apc/publication_fees.html',
{'sections': sections},
)
return ''
def waiver_info(context):
plugin = plugin_settings.get_self()
request = context['request']
author_contribution_mode = setting_handler.get_plugin_setting(
plugin,
'author_contribution_mode',
request.journal,
create=True,
pretty='Author Contribution Mode',
)
mode = author_contribution_mode.value if author_contribution_mode else ''
if mode == 'vac':
vac_text = setting_handler.get_plugin_setting(
plugin,
'vac_text',
request.journal,
create=True,
pretty='VAC Text',
)
return render_to_string(
'apc/vac_optin.html',
{'request': request, 'vac_text': vac_text.value if vac_text else ''},
)
elif mode == 'waiver':
waiver_text = setting_handler.get_plugin_setting(
plugin,
'waiver_text',
request.journal,
create=True,
pretty='Waiver Text',
)
return render_to_string(
'apc/waiver_info.html',
{'request': request, 'waiver_text': waiver_text.value},
)
return ''
def waiver_application(context):
plugin = plugin_settings.get_self()
request = context['request']
article = context['article']
author_contribution_mode = setting_handler.get_plugin_setting(
plugin,
'author_contribution_mode',
request.journal,
create=True,
pretty='Author Contribution Mode',
)
if author_contribution_mode and author_contribution_mode.value == 'waiver':
waiver_text = setting_handler.get_plugin_setting(
plugin,
'waiver_text',
request.journal,
create=True,
pretty='Waiver Text',
)
return render_to_string(
'apc/article_waiver_app.html',
{
'request': request,
'waiver_text': waiver_text.value,
'article': article,
},
)
return ''