Massimiliano Assante 8 years ago
parent 1353f5afd0
commit 419afb7566

@ -25,7 +25,7 @@
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>

@ -38,5 +38,6 @@
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>com.liferay.ide.core.liferayNature</nature>
</natures>
</projectDescription>

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="d4science-responsive-theme">
<wb-module deploy-name="d4science-responsive-theme-theme">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/target/m2e-liferay/theme-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>

@ -11,7 +11,7 @@
<artifactId>d4science-responsive-theme</artifactId>
<packaging>war</packaging>
<name>d4science-responsive-theme Theme</name>
<version>6.3.0-SNAPSHOT</version>
<version>6.3.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>

@ -1,6 +1,6 @@
name=d4science-responsive-theme
module-group-id=liferay
module-incremental-version=1
module-incremental-version=2
tags=
short-description=
change-log=

@ -0,0 +1,27 @@
/* 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('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;
}
}

@ -20,7 +20,9 @@
</head>
<body class="$css_class">
<script>
injectClientContext();
</script>
<a href="#main-content" id="skip-to-content">#language ("skip-to-content")</a>
$theme.include($body_top_include)

Loading…
Cancel
Save