removed injext context as it was moved to theme level

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/client-context-library@134012 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-11-10 10:45:45 +00:00
parent 3708911e98
commit cf4456a0cd
1 changed files with 1 additions and 35 deletions

View File

@ -9,7 +9,6 @@ import com.google.gwt.core.client.EntryPoint;
*/
public class GCubeClientContext implements EntryPoint {
public static final String VRE_ID_ATTR_NAME = "gcube-vreid";
public static final String USER_ID_ATTR_NAME = "gcube-userId";
public void onModuleLoad() {}
@ -22,37 +21,4 @@ public class GCubeClientContext implements EntryPoint {
return groupId;
}-*/;
public static native String getCurrentUserId() /*-{
var userId;
if ($wnd.Liferay != null) {
userId = $wnd.Liferay.ThemeDisplay.getUserId();
console.log("current userid is = " + userId);
}
return userId;
}-*/;
public static native void injectContext() /*-{
if ($wnd.Liferay != null) {
var userId;
var groupId;
if ($wnd.Liferay.ThemeDisplay.isSignedIn()) {
userId = $wnd.Liferay.ThemeDisplay.getUserId();
groupId = $wnd.Liferay.ThemeDisplay.getScopeGroupId();
console.log('userId is = ' + userId);
console.log("groupId is = " + groupId);
}
else {
groupId = $wnd.Liferay.ThemeDisplay.getScopeGroupId();
console.log('Not logged in, injecting groupId only');
}
$wnd.XMLHttpRequest.prototype.realSend = $wnd.XMLHttpRequest.prototype.send;
var newSend = function(vData) {
this.setRequestHeader(@org.gcube.portal.clientcontext.client.GCubeClientContext::USER_ID_ATTR_NAME, userId);
this.setRequestHeader(@org.gcube.portal.clientcontext.client.GCubeClientContext::VRE_ID_ATTR_NAME, groupId);
this.realSend(vData);
};
$wnd.XMLHttpRequest.prototype.send = newSend;
}
}-*/;
}