Gitlab CSE Unil

Commit d72b4819 authored by Julien Furrer's avatar Julien Furrer
Browse files

Merge branch 'master' into django-18

parents 3f47cd5b 6c093efb
......@@ -58,6 +58,13 @@ function($){
rateLimitWait: 300
},
//// Uncomment to enable Shibboleth SLO
//aai : {
// sp_logout: "https://jabba.unil.ch/Shibboleth.sso/Logout",
// idp_logout: "https://aai.unil.ch/idp/logout.jsp"
//},
// ====================================================================
// ----- Specific config
// The following settings are specific to the current use of the tool
......
......@@ -208,7 +208,8 @@ define([
function _getThumbnail(options) {
options.thumbnailSize = parseInt(config.thumbnailSize, 10) || 150;
var pr = window.devicePixelRatio || 1;
options.thumbnailSize = (parseInt(config.thumbnailSize, 10) || 150) / pr;
return _exportPng(null, options);
}
......
......@@ -82,7 +82,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
* - document is ready
* - view.js is initialized
*
* @param mainEvents A dictionary of the signals dispatched by main.js
* @param params A dictionary of the signals dispatched by main.js
* used to listen to the needed signals
*
*/
......@@ -118,13 +118,13 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
// ----- General Event listeners -----
// Listen to events
view.events.imageLoaded.add(function(evt) {
view.events.imageLoaded.add(function (evt) {
adjustCanvasToImage(evt.raster);
$("#page-loader").remove();
console.timeEnd("complete app");
});
view.events.annotationsLoaded.add(function() {
view.events.annotationsLoaded.add(function () {
zoomFitContent();
updateUserLayers();
_autoSave = true;
......@@ -134,7 +134,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
view.events.userLayerVisibilityChanged.add(onUserLayerVisChange);
tools.events.annotationSelected.add(function(item) {
tools.events.annotationSelected.add(function (item) {
// ----- Update Properties Panel -----
// disable properties panel if there is no item or more than one
var doDisplay = !!item && view.getSelectedAnnotations().length === 1;
......@@ -142,12 +142,12 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
// If there are multiple selected items, determine if they are all children
// of the selected annotation. If so, it can be considered as a unique selection
/*if (paper.project.getSelectedItems().length > 1) {
doDisplay = paper.project.getSelectedItems().every(function(c){
return c === item || c.parent === item;
});
}*/
doDisplay = paper.project.getSelectedItems().every(function(c){
return c === item || c.parent === item;
});
}*/
if (! doDisplay) {
if (!doDisplay) {
// Disable properties panel
disableProperties(true);
$("*:focus").blur();
......@@ -160,7 +160,7 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
// -- strokeWidth
var itemStokeWidth = (typeof item.data.getStrokeWidth === 'function') ? item.data.getStrokeWidth.call(item) :
(typeof item.data.strokeWidth !== 'undefined') ? item.data.strokeWidth :
(typeof item.strokeWidth !== 'undefined') ? item.strokeWidth : 0;
(typeof item.strokeWidth !== 'undefined') ? item.strokeWidth : 0;
if (itemStokeWidth) {
_widthSlider.slider('setValue', itemStokeWidth);
attributes.setStrokeWidth(itemStokeWidth, false, true);
......@@ -173,10 +173,10 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
}
// -- color
var itemColor = (typeof item.data.getColor === 'function') ? item.data.getColor.call(item):
var itemColor = (typeof item.data.getColor === 'function') ? item.data.getColor.call(item) :
(item.data.color) ? item.data.color :
(item.strokeColor) ? item.strokeColor :
item.fillColor;
(item.strokeColor) ? item.strokeColor :
item.fillColor;
if (itemColor) {
updateColorSelector(itemColor);
attributes.setColor(itemColor, false, true);
......@@ -200,24 +200,26 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
if (item && item.layer) {
var id = item.layer.id;
var annotationLayerListItem = $("#annotation-list-container .list-group-item").filter(
function(i,n){ return( $(n).data('layerId') == id ); }
function (i, n) {
return ( $(n).data('layerId') == id );
}
);
selectLayerListItem(annotationLayerListItem, false);
}
});
io.events.loadingError.add(function(err){
io.events.loadingError.add(function (err) {
var pageLoader = $("#page-loader");
if (pageLoader.length) {
pageLoader.html(
'<div class="text-danger lead">Erreur de chargement</div>'+
'<div class="text-danger lead">Erreur de chargement</div>' +
'<div class="text-danger">' + err.msg + '</div>'
);
} else {
var alert = $('<div class="alert alert-danger in">'+
'<button data-dismiss="alert" class="close" type="button">×</button>'+
'<h4>Erreur de chargement</h4>'+
'<p>' + err.msg + '</p>'+
var alert = $('<div class="alert alert-danger in">' +
'<button data-dismiss="alert" class="close" type="button">×</button>' +
'<h4>Erreur de chargement</h4>' +
'<p>' + err.msg + '</p>' +
'</div>'
);
......@@ -225,6 +227,19 @@ function($, _, Signal, paper, config, view, io, tools, attributes, Users, export
}
});
// AAI SLO
if (config.aai && config.user && config.user.shibboleth) {
$("#adim-logout-but").click(function (event) {
event.preventDefault();
var logout_url = $(this).attr("href");
$("<iframe>", {src: config.aai.sp_logout}).appendTo("body").hide();
$("<iframe>", {src: config.aai.idp_logout}).appendTo("body").hide();
setTimeout(function () {
window.document.location.href = logout_url;
}, 500);
});
}
var _autoSave = io.getAutoSave();
var saveBut = $("#save-but");
var autoSaveBut = $("#autosave-but");
......
This diff is collapsed.
This diff is collapsed.
......@@ -66,11 +66,12 @@ window.ADIM_CONFIG = {
username: "{{ user.username }}",
fullName: "{{ user.get_full_name }}",
full_name: "{{ user.get_full_name }}",
token: "{{ user.auth_token }}",
token: "{{ user.auth_token }}"
{% if membership %}
membership: { publish_mode: {{ membership.publish_mode }} },
,membership: { publish_mode: {{ membership.publish_mode }} }
{% endif %}
guest: {% if anobj.owner.id != user.id %}true{% else %}false{% endif %}
,guest: {% if anobj.owner.id != user.id %}true{% else %}false{% endif %}
,shibboleth: true
},
ui: {
......
......@@ -32,6 +32,7 @@ window.ADIM_CONFIG = {
username: "{{ user.username }}",
fullName: "{{ user.get_full_name }}",
full_name: "{{ user.get_full_name }}"
,shibboleth: true
},
ui: {
......
......@@ -3,6 +3,7 @@
<html lang="fr">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width"/>
<title>{% block page_title %}ADIM{% endblock %}</title>
<link rel="stylesheet" type="text/css" media="all" href="{% static "css/libs.css" %}" />
......@@ -37,7 +38,7 @@
<ul class="dropdown-menu" role="menu">
<li class="dropdown-header">{{ user.username|default:user.email }}</li>
<li class="divider"></li>
<li><a href="{% url "logout" %}"><span class="glyphicon glyphicon-log-out"></span> Déconnexion</a></li>
<li><a id="adim-logout-but" href="{% url "logout" %}"><span class="glyphicon glyphicon-log-out"></span> Déconnexion</a></li>
</ul>
</li>
{% endif %}
......
......@@ -7,6 +7,7 @@ include(
'components/adim.py',
'components/local_defaults.py',
optional('shib_settings.py'),
optional('local_settings.py'),
'components/urls.py',
......
......@@ -6,7 +6,7 @@ AUTHENTICATION_BACKENDS = (
LOGIN_REDIRECT_URL = "adim.app:annotate-new"
LOGIN_URL = "adim.app:home"
SHIBAUTH_ATTR_PATTERN = r'.*'
SHIB_UID_ATTR = 'uniqueID'
SHIB_USERNAME_ATTR = 'mail'
SHIB_ATTR_MAP = {
'user': (
......
Django>=1.6.4,<=1.7.99
MySQL-python==1.2.5
Pillow==2.4.0
Django==1.7.7
django-autoslug==1.7.2
django-jsonfield==0.9.13
django-sendfile==0.3.6
django-split-settings==0.1.1
djangorestframework==2.4.4
drf-nested-routers==0.9.0
eav-django==1.4.7
python-memcached==1.53
MySQL-python==1.2.5
Pillow==2.7.0
python-ldap==2.4.19
django-jsonfield==0.9.13
drf-nested-routers
\ No newline at end of file
python-memcached==1.53
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: osx-64
binstar=0.10.1=py27_3
clyent=0.3.4=py27_0
freetype=2.4.10=1
jpeg=8d=1
libtiff=4.0.2=1
openssl=1.0.1k=1
pillow=2.7.0=py27_0
pip=6.1.1=py27_0
python=2.7.9=1
python-dateutil=2.4.2=py27_0
pytz=2015.2=py27_0
pyyaml=3.11=py27_0
readline=6.2=2
requests=2.6.0=py27_0
setuptools=15.0=py27_0
six=1.9.0=py27_0
sqlite=3.8.4.1=1
tk=8.5.18=0
yaml=0.1.4=1
zlib=1.2.8=0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment