git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/liferay62-plugins/d4science-responsive-theme@134092 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e89c799746
commit
b1e7313be1
|
@ -1,6 +1,6 @@
|
||||||
name=d4science-responsive-theme
|
name=d4science-responsive-theme
|
||||||
module-group-id=liferay
|
module-group-id=liferay
|
||||||
module-incremental-version=2
|
module-incremental-version=3
|
||||||
tags=
|
tags=
|
||||||
short-description=
|
short-description=
|
||||||
change-log=
|
change-log=
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
/* The following function simply injects the Liferay object fields userId and scopeGroupId in the XMLHttpRequest header.
|
|
||||||
* So that every ajax call performed in the page has those parameters set.
|
|
||||||
* Author: Massimiliano Assante, CNR-ISTI */
|
|
||||||
function injectClientContext() {
|
|
||||||
if (Liferay != null) {
|
|
||||||
var userId;
|
|
||||||
var groupId;
|
|
||||||
if (Liferay.ThemeDisplay.isSignedIn()) {
|
|
||||||
userId = Liferay.ThemeDisplay.getUserId();
|
|
||||||
groupId = Liferay.ThemeDisplay.getScopeGroupId();
|
|
||||||
console.log('(d4science responsive) userId is = ' + userId);
|
|
||||||
console.log("groupId is = " + groupId);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
groupId = Liferay.ThemeDisplay.getScopeGroupId();
|
|
||||||
//console.log('Not logged in, injecting groupId only');
|
|
||||||
}
|
|
||||||
|
|
||||||
XMLHttpRequest.prototype.realSend = XMLHttpRequest.prototype.send;
|
|
||||||
var newSend = function(vData) {
|
|
||||||
this.setRequestHeader("gcube-userId", userId);
|
|
||||||
this.setRequestHeader("gcube-vreid", groupId);
|
|
||||||
this.realSend(vData);
|
|
||||||
};
|
|
||||||
XMLHttpRequest.prototype.send = newSend;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Author: Massimiliano Assante, CNR-ISTI
|
||||||
|
* */
|
||||||
|
|
||||||
|
/*The following function simply injects the Liferay object fields userId and scopeGroupId in the XMLHttpRequest header.
|
||||||
|
* So that every ajax call performed in the page has those parameters set.*/
|
||||||
|
function injectClientContext() {
|
||||||
|
if (Liferay != null) {
|
||||||
|
var userId;
|
||||||
|
var groupId;
|
||||||
|
if (Liferay.ThemeDisplay.isSignedIn()) {
|
||||||
|
userId = Liferay.ThemeDisplay.getUserId();
|
||||||
|
groupId = Liferay.ThemeDisplay.getScopeGroupId();
|
||||||
|
console.log("D4S groupId is = " + groupId);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
groupId = Liferay.ThemeDisplay.getScopeGroupId();
|
||||||
|
//console.log('Not logged in, injecting groupId only');
|
||||||
|
}
|
||||||
|
|
||||||
|
XMLHttpRequest.prototype.realSend = XMLHttpRequest.prototype.send;
|
||||||
|
var newSend = function(vData) {
|
||||||
|
this.setRequestHeader("gcube-userId", userId);
|
||||||
|
this.setRequestHeader("gcube-vreid", groupId);
|
||||||
|
this.realSend(vData);
|
||||||
|
};
|
||||||
|
XMLHttpRequest.prototype.send = newSend;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Override the expire function of the Liferay.Session javascript object. It makes the default behaviour and then open a modal
|
||||||
|
* */
|
||||||
|
$(function () {
|
||||||
|
AUI().use('liferay-session', function(A) {
|
||||||
|
console.log('Liferay session overrding');
|
||||||
|
if(Liferay.Session) {
|
||||||
|
console.log('Liferay session overridden ON');
|
||||||
|
Liferay.Session.expire = function() {
|
||||||
|
var instance = this;
|
||||||
|
instance.set('sessionState', 'expired', {});
|
||||||
|
$("#expirationModal").css("display", "block");
|
||||||
|
$("#expirationModal").modal({backdrop: 'static', keyboard: false},'show');
|
||||||
|
$("body div.alert.alert-block.popup-alert-warning.alert-error").html("Due to inactivity your session has expired, please <a class='refresh' href=''>Refresh</a>");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -17,13 +17,32 @@
|
||||||
|
|
||||||
$theme.include($top_head_include)
|
$theme.include($top_head_include)
|
||||||
<script type="text/javascript" src="$javascript_folder/jquery-1.12.0.min.js"></script>
|
<script type="text/javascript" src="$javascript_folder/jquery-1.12.0.min.js"></script>
|
||||||
<script type="text/javascript" src="$javascript_folder/gcube-context-injection.js"></script>
|
<script type="text/javascript" src="$javascript_folder/gcube-context.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="$css_class">
|
<body class="$css_class">
|
||||||
|
<!-- start customisation -->
|
||||||
|
<div class="modal" id="expirationModal" tabindex="-1" role="dialog" style="display: none;">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="label">Your session expired!</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div style="text-align:center; margin-bottom: 50px;">
|
||||||
|
<i class="icon-time" style="color: #AAA; font-size: 10em;"></i>
|
||||||
|
</div>
|
||||||
|
<div style="font-size: 18px; text-align:center; margin-bottom: 50px;">
|
||||||
|
Please try <a href="javascript:location.reload();">reload</a> this page or <a href="/c/portal/logout">logout</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
injectClientContext();
|
injectClientContext();
|
||||||
</script>
|
</script>
|
||||||
|
<!-- end customisation -->
|
||||||
<a href="#main-content" id="skip-to-content">#language ("skip-to-content")</a>
|
<a href="#main-content" id="skip-to-content">#language ("skip-to-content")</a>
|
||||||
|
|
||||||
$theme.include($body_top_include)
|
$theme.include($body_top_include)
|
||||||
|
|
Loading…
Reference in New Issue