Skip to content
Snippets Groups Projects
Commit 26a63383 authored by juanf's avatar juanf
Browse files

SSDM-4448 : V3 openBIS facade providing now webapp context

SVN: 37551
parent 9501d749
No related branches found
No related tags found
No related merge requests found
...@@ -870,7 +870,66 @@ define([ 'jquery', 'util/Json' ], function(jquery, stjsUtil) { ...@@ -870,7 +870,66 @@ define([ 'jquery', 'util/Json' ], function(jquery, stjsUtil) {
} }
}); });
} }
/**
* =======================
* OpenBIS webapp context
* =======================
*
* Provides a context information for webapps that are embedded inside the OpenBIS UI.
*
* @class
*
*/
var openbisWebAppContext = function() {
this.getWebAppParameter = function(parameterName){
var match = location.search.match(RegExp("[?|&]"+parameterName+'=(.+?)(&|$)'));
if(match && match[1]){
return decodeURIComponent(match[1].replace(/\+/g,' '));
}else{
return null;
}
}
this.webappCode = this.getWebAppParameter("webapp-code");
this.sessionId = this.getWebAppParameter("session-id");
this.entityKind = this.getWebAppParameter("entity-kind");
this.entityType = this.getWebAppParameter("entity-type");
this.entityIdentifier = this.getWebAppParameter("entity-identifier");
this.entityPermId = this.getWebAppParameter("entity-perm-id");
this.getWebappCode = function() {
return this.webappCode;
}
this.getSessionId = function() {
return this.sessionId;
}
this.getEntityKind = function() {
return this.entityKind;
}
this.getEntityType = function() {
return this.entityType;
}
this.getEntityIdentifier = function() {
return this.entityIdentifier;
}
this.getEntityPermId = function() {
return this.entityPermId;
}
this.getParameter = function(parameterName) {
return this.getParameter(parameterName);
}
}
this.getWebAppContext = function() {
return new openbisWebAppContext();
}
} }
return facade; return facade;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment