diff --git a/.classpath b/.classpath index 1151b0d..91f2707 100644 --- a/.classpath +++ b/.classpath @@ -25,7 +25,7 @@ - + diff --git a/.project b/.project index 8cc6795..5f5d6a0 100644 --- a/.project +++ b/.project @@ -38,5 +38,6 @@ org.eclipse.m2e.core.maven2Nature org.eclipse.wst.common.project.facet.core.nature org.eclipse.wst.jsdt.core.jsNature + com.liferay.ide.core.liferayNature diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 48e3e54..5aea151 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,5 +1,5 @@ - + diff --git a/pom.xml b/pom.xml index 51efcd4..b2516c1 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ d4science-responsive-theme war d4science-responsive-theme Theme - 6.3.0-SNAPSHOT + 6.3.1-SNAPSHOT diff --git a/src/main/webapp/WEB-INF/liferay-plugin-package.properties b/src/main/webapp/WEB-INF/liferay-plugin-package.properties index 037980c..a26d537 100644 --- a/src/main/webapp/WEB-INF/liferay-plugin-package.properties +++ b/src/main/webapp/WEB-INF/liferay-plugin-package.properties @@ -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= diff --git a/src/main/webapp/js/gcube-context-injection.js b/src/main/webapp/js/gcube-context-injection.js new file mode 100644 index 0000000..791bea6 --- /dev/null +++ b/src/main/webapp/js/gcube-context-injection.js @@ -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; + } +} \ No newline at end of file diff --git a/src/main/webapp/templates/portal_normal.vm b/src/main/webapp/templates/portal_normal.vm index 3bab622..27e1955 100644 --- a/src/main/webapp/templates/portal_normal.vm +++ b/src/main/webapp/templates/portal_normal.vm @@ -20,7 +20,9 @@ - + #language ("skip-to-content") $theme.include($body_top_include)