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