22
22
This is mainly for the benefit of the link in ivle.webapp.help."""
25
26
import ivle.webapp.security
26
27
from ivle.webapp.base.xhtml import XHTMLView
27
28
from ivle.webapp.base.plugins import ViewPlugin, MediaPlugin
30
def get_terms_of_service(config):
32
Sends the Terms of Service document to the req object.
33
This consults conf to find out where the TOS is located on disk, and sends
34
that. If it isn't found, it sends a generic message explaining to admins
35
how to create a real one.
38
return open(os.path.join(config['paths']['data'],
39
'notices/tos.html')).read()
42
<p><b>*** SAMPLE ONLY ***</b></p>
43
<p>This is the text of the IVLE Terms of Service.</p>
44
<p>The administrator should create a license file with an appropriate
45
"Terms of Service" license for your organisation.</p>
46
<h2>Instructions for Administrators</h2>
47
<p>You are seeing this message because you have not configured a Terms of
49
<p>When you configured IVLE, you specified a path to the Terms of Service
50
document (this is found in <b><tt>ivle/conf/conf.py</tt></b> under
51
"<tt>tos_path</tt>").</p>
52
<p>Create a file at this location; an HTML file with the appropriately-worded
54
<p>This should be a normal XHTML file, except it should not contain
55
<tt>html</tt>, <tt>head</tt> or <tt>body</tt> elements - it should
56
just be the contents of a body element (IVLE will wrap it accordingly).</p>
57
<p>This will automatically be used as the license text instead of this
29
61
class TermsOfServiceView(XHTMLView):
30
62
"""View of the Terms of Service, allowing acceptance.
54
86
return ivle.webapp.security.get_user_details(req) is not None
56
88
def populate(self, req, ctx):
57
ctx['text'] = ivle.util.get_terms_of_service()
89
ctx['text'] = get_terms_of_service(req.config)
59
91
if self.mode == 'accept':
60
92
self.plugin_scripts[Plugin] = ['tos.js']