added gcube client context inject
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/liferay62-plugins/d4science-responsive-theme@134055 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
1353f5afd0
commit
419afb7566
|
@ -25,7 +25,7 @@
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="owner.project.facets" value="java"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
|
|
1
.project
1
.project
|
@ -38,5 +38,6 @@
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||||
|
<nature>com.liferay.ide.core.liferayNature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?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-wtp/web-resources"/>
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-liferay/theme-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-liferay/theme-resources"/>
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -11,7 +11,7 @@
|
||||||
<artifactId>d4science-responsive-theme</artifactId>
|
<artifactId>d4science-responsive-theme</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<name>d4science-responsive-theme Theme</name>
|
<name>d4science-responsive-theme Theme</name>
|
||||||
<version>6.3.0-SNAPSHOT</version>
|
<version>6.3.1-SNAPSHOT</version>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name=d4science-responsive-theme
|
name=d4science-responsive-theme
|
||||||
module-group-id=liferay
|
module-group-id=liferay
|
||||||
module-incremental-version=1
|
module-incremental-version=2
|
||||||
tags=
|
tags=
|
||||||
short-description=
|
short-description=
|
||||||
change-log=
|
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>
|
</head>
|
||||||
|
|
||||||
<body class="$css_class">
|
<body class="$css_class">
|
||||||
|
<script>
|
||||||
|
injectClientContext();
|
||||||
|
</script>
|
||||||
<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