forked from apluslms/a-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add notice before posting to external service
- Loading branch information
1 parent
9194dc8
commit eece804
Showing
5 changed files
with
78 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 54 additions & 15 deletions
69
external_services/templates/external_services/lti_form.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,55 @@ | ||
{% extends "course/course_base.html" %} | ||
{% load i18n %} | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | ||
<script>$(function() { $("form")[0].submit(); });</script> | ||
</head> | ||
<body> | ||
<form id="lti_login_form" method="POST" action="{{ url }}"> | ||
{% for entry in parameters %} | ||
<input type="hidden" name="{{ entry.0 }}" value="{{ entry.1 }}" /> | ||
{% endfor %} | ||
<input type="submit" value="{% trans 'Continue to service...' %}" /> | ||
</form> | ||
</body> | ||
</html> | ||
|
||
{% block title %}{{ block.super }}: {{ service.menu_label }}{% endblock %} | ||
|
||
{% block breadcrumblist %} | ||
{{ block.super }} | ||
<li class="active">{{ service.menu_label }}</li> | ||
{% endblock %} | ||
|
||
{% block coursecontent %} | ||
<div class="alert alert-warning"> | ||
<p> | ||
{% blocktrans with name=service.menu_label %} | ||
You are about to use an external service, {{ name }}, for the first time. | ||
To use the service, your name and email address will be transferred | ||
to the provider of this service. | ||
{% endblocktrans %} | ||
</p> | ||
<p> | ||
<a href="{{ site }}" target="_new">{{ site }}</a> | ||
</p> | ||
<p> | ||
<br> | ||
<form id="lti_login_form" method="POST" action="{{ service.url }}"> | ||
{% for entry in parameters %} | ||
<input type="hidden" name="{{ entry.0 }}" value="{{ entry.1 }}" /> | ||
{% endfor %} | ||
<input type="submit" value="{% blocktrans with name=service.menu_label %}Accept and continue to {{ name }}{% endblocktrans %}" class="btn btn-primary" /> | ||
</form> | ||
</p> | ||
</div> | ||
{% endblock %} | ||
|
||
{% block scripts %} | ||
{{ block.super }} | ||
<script> | ||
$(function() { | ||
var cookieName = "aplusexse{{ service.id }}"; | ||
var regex = new RegExp("(?:(?:^|.*;\s*)" + cookieName + "\s*\=\s*([^;]*).*$)|^.*$"); | ||
var val = document.cookie.replace(regex, "$1"); | ||
if (val == "1") { | ||
$("form")[0].submit(); | ||
} | ||
$("form").on("submit", function() { | ||
var expire = new Date(); | ||
expire.setFullYear(expire.getFullYear() + 1); | ||
var path = document.location.href.split("/"); | ||
document.cookie = cookieName + "=1" | ||
+ ";path=/" + path[3] + "/" + path[4] + "/" | ||
+ ";expires=" + expire.toGMTString(); | ||
}); | ||
}); | ||
</script> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters