Skip to content

Commit 4bbbdc9

Browse files
committed
[KNOWAGE-9270] restore whatif JSPs
1 parent ef52d03 commit 4bbbdc9

3 files changed

Lines changed: 281 additions & 0 deletions

File tree

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
<!--
2+
Knowage, Open Source Business Intelligence suite
3+
Copyright (C) 2016 Engineering Ingegneria Informatica S.p.A.
4+
5+
Knowage is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU Affero General Public License as published by
7+
the Free Software Foundation, either version 3 of the License, or
8+
(at your option) any later version.
9+
10+
Knowage is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU Affero General Public License for more details.
14+
15+
You should have received a copy of the GNU Affero General Public License
16+
along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
-->
18+
19+
<%@page import="it.eng.knowage.commons.security.KnowageSystemConfiguration"%>
20+
<%@page import= "it.eng.spagobi.engines.whatif.common.WhatIfConstants" %>
21+
<%@page import= "java.util.Enumeration" %>
22+
<%@ page language="java"
23+
contentType="text/html; charset=UTF-8"
24+
pageEncoding="UTF-8" %>
25+
26+
27+
<%-- ---------------------------------------------------------------------- --%>
28+
<%-- JAVA IMPORTS --%>
29+
<%-- ---------------------------------------------------------------------- --%>
30+
<%@page import= "it.eng.spago.configuration.*" %>
31+
<%@page import= "it.eng.spago.base.*"%>
32+
<%@page import= "it.eng.spagobi.engines.whatif.WhatIfEngineConfig" %>
33+
<%@page import= "it.eng.spagobi.engines.whatif.WhatIfEngineInstance" %>
34+
<%@page import= "it.eng.spagobi.utilities.engines.EngineConstants" %>
35+
<%@page import= "it.eng.spagobi.commons.constants.SpagoBIConstants" %>
36+
<%@page import= "java.util.Locale"%>
37+
<%@page import= "it.eng.spagobi.services.common.EnginConf" %>
38+
<%@page import= "it.eng.spagobi.utilities.engines.rest.ExecutionSession" %>
39+
<%@page import="org.apache.commons.lang.StringEscapeUtils"%>
40+
<%@page import="it.eng.spagobi.utilities.KnowageStringUtils"%>
41+
<%@page import="it.eng.spago.security.IEngUserProfile" %>
42+
<%@page import="java.util.List"%>
43+
<%@page import="java.util.ArrayList"%>
44+
<%@page import="it.eng.spagobi.commons.bo.UserProfile"%>
45+
<%@page import="it.eng.spagobi.utilities.engines.EngineStartServletIOManager"%>
46+
<%@page import="it.eng.knowage.commons.utilities.urls.UrlBuilder"%>
47+
48+
49+
50+
51+
<%-- ---------------------------------------------------------------------- --%>
52+
<%-- JAVA CODE --%>
53+
<%-- ---------------------------------------------------------------------- --%>
54+
55+
<%
56+
String spagoBiContext = KnowageSystemConfiguration.getKnowageContext();
57+
String thisContext = request.getContextPath();
58+
UrlBuilder urlBuilder = new UrlBuilder(spagoBiContext, thisContext);
59+
60+
WhatIfEngineInstance whatIfEngineInstance;
61+
//UserProfile profile;
62+
Locale locale =null;
63+
String isFromCross;
64+
String spagobiContext = null;
65+
String documentLabel = null;
66+
String documentId = null;
67+
String engine = null;
68+
String sbiExecutionID = null;
69+
String mode = null;
70+
String schemaID = null;
71+
String schemaName = null;
72+
String cubeName = null;
73+
String currentContentId = null;
74+
String jsonTemplate = null;
75+
String editModeCurrentContentId = null;
76+
ExecutionSession es = new ExecutionSession(request, request.getSession());
77+
String curr_language=(String)es.getAttribute(SpagoBIConstants.AF_LANGUAGE);
78+
String curr_country=(String)es.getAttribute(SpagoBIConstants.AF_COUNTRY);
79+
String curr_script=(String)es.getAttribute(SpagoBIConstants.AF_SCRIPT);
80+
81+
whatIfEngineInstance = (WhatIfEngineInstance)es.getAttributeFromSession(EngineConstants.ENGINE_INSTANCE );
82+
83+
//load user profile
84+
IEngUserProfile userProfile = (IEngUserProfile)whatIfEngineInstance.getEnv().get(EngineConstants.ENV_USER_PROFILE);
85+
String userUniqueIdentifier="";
86+
String userId="";
87+
String userName="";
88+
List userRoles = new ArrayList();
89+
90+
//if (userProfile!=null) userId=(String)userProfile.getUserUniqueIdentifier();
91+
if (userProfile!=null){
92+
userId=(String)((UserProfile)userProfile).getUserId();
93+
userUniqueIdentifier=(String)userProfile.getUserUniqueIdentifier();
94+
userName=(String)((UserProfile)userProfile).getUserName();
95+
userRoles = (ArrayList)userProfile.getRoles();
96+
97+
}
98+
99+
100+
101+
102+
//profile = (UserProfile)whatIfEngineInstance.getEnv().get(EngineConstants.ENV_USER_PROFILE);
103+
locale = (Locale)whatIfEngineInstance.getEnv().get(EngineConstants.ENV_LOCALE);
104+
105+
if(whatIfEngineInstance.getEnv().get("DOCUMENT_LABEL" ) != null){
106+
documentLabel = (String)whatIfEngineInstance.getEnv().get("DOCUMENT_LABEL" );
107+
}
108+
if(whatIfEngineInstance.getEnv().get("DOCUMENT_ID" ) != null){
109+
documentId = (String)whatIfEngineInstance.getEnv().get("DOCUMENT_ID" );
110+
}
111+
112+
isFromCross = (String)whatIfEngineInstance.getEnv().get( "isFromCross");
113+
114+
if (isFromCross == null) {
115+
isFromCross = "false";
116+
}
117+
118+
WhatIfEngineConfig whatIfEngineConfig = WhatIfEngineConfig.getInstance();
119+
120+
// if server Host anc context are null means we are in standalone version
121+
if(!whatIfEngineInstance.isStandalone()) {
122+
spagobiContext = KnowageSystemConfiguration.getKnowageContext();
123+
}
124+
125+
sbiExecutionID = request.getParameter("SBI_EXECUTION_ID" );
126+
if(request.getParameter("mode") != null){
127+
mode = request.getParameter("mode");
128+
129+
}else if(request.getParameter(EngineStartServletIOManager.ON_EDIT_MODE) != null){
130+
mode = "edit";
131+
}else{
132+
mode = "full" ;
133+
}
134+
if(request.getParameter("schemaID") != null){
135+
schemaID = request.getParameter("schemaID");
136+
}else{
137+
schemaID = "-1";
138+
}
139+
if(request.getParameter("cubeName") != null){
140+
cubeName = request.getParameter("cubeName");
141+
}
142+
if(request.getParameter("schemaName") != null){
143+
schemaName = request.getParameter("schemaName");
144+
}
145+
if(request.getParameter("currentContentId") != null){
146+
currentContentId = request.getParameter("currentContentId");
147+
}
148+
if(request.getParameter("template") != null){
149+
jsonTemplate = KnowageStringUtils.escape(request.getParameter("template"),'\'','\\');
150+
}
151+
if(request.getParameter("SBI_ARTIFACT_VERSION_ID") != null){
152+
editModeCurrentContentId = request.getParameter("SBI_ARTIFACT_VERSION_ID");
153+
}
154+
155+
156+
if(request.getParameter("ENGINE") != null){
157+
158+
engine = request.getParameter("ENGINE");
159+
}
160+
%>
161+
162+
<%@include file="../../commons/includeMessageResource.jspf"%>
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<!--
2+
Knowage, Open Source Business Intelligence suite
3+
Copyright (C) 2016 Engineering Ingegneria Informatica S.p.A.
4+
5+
Knowage is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU Affero General Public License as published by
7+
the Free Software Foundation, either version 3 of the License, or
8+
(at your option) any later version.
9+
10+
Knowage is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU Affero General Public License for more details.
14+
15+
You should have received a copy of the GNU Affero General Public License
16+
along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
-->
18+
19+
<script type="text/javascript" src="<%=urlBuilder.getResourcePath(spagoBiContext,"/js/lib/messageResource/messageResourceKnowageCustom.js")%>"></script>
20+
21+
<%@page import="it.eng.knowage.commons.utilities.LocalePropertiesUtilities"%>
22+
23+
<script type="text/javascript" nonce="<%= request.getAttribute("cspNonce") %>">
24+
//Function that gets the properties file's content in an synchronous way
25+
getSynch=function(url, callback){
26+
var xmlhttp;
27+
28+
//Get XMLHttpRequest
29+
if (window.XMLHttpRequest) {
30+
xmlhttp = new XMLHttpRequest();
31+
} else {
32+
//For IE6, IE5
33+
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
34+
}
35+
36+
xmlhttp.open('GET', url, false);
37+
xmlhttp.overrideMimeType('text/plain; charset=UTF-8');
38+
xmlhttp.send();
39+
callback(xmlhttp.responseText)
40+
}
41+
42+
if (!String.prototype.endsWith) {
43+
String.prototype.endsWith = function(search, this_len) {
44+
if (this_len === undefined || this_len > this.length) {
45+
this_len = this.length;
46+
}
47+
return this.substring(this_len - search.length, this_len) === search;
48+
};
49+
}
50+
51+
52+
var isEditOlap = function(){
53+
54+
55+
return ('${pageContext.request.requestURL}').endsWith("edit.jsp")?"../":"";
56+
}
57+
58+
//Initialization of the messageResource object
59+
messageResource.init({
60+
filePath : isEditOlap() + '../../js/spagobi/messages/'
61+
, defaultLocale : 'en_US'
62+
, ajaxFunction : getSynch
63+
});
64+
65+
//Load of default file (en_US): it can be used if a message of the current locale is missing
66+
messageResource.load('messages', function(){});
67+
messageResource.setCurrentLocale('<%=LocalePropertiesUtilities.getAngularPropertiesFileName(locale, "_")%>');
68+
69+
//en_US has already been loaded: if current locale is en_US it is not necessary to load it again
70+
if ('<%=LocalePropertiesUtilities.getAngularPropertiesFileName(locale, "_")%>'!='en_US'){
71+
messageResource.load('messages', function(){});
72+
}
73+
74+
75+
</script>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
<%-- ---------------------------------------------------------------------- --%>
3+
<%-- JAVA IMPORTS --%>
4+
<%-- ---------------------------------------------------------------------- --%>
5+
<%@include file="/WEB-INF/jsp/commons/angular/angularResource.jspf"%>
6+
7+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
8+
<html ng-app="olapManager">
9+
<head>
10+
<meta charset="UTF-8">
11+
<title>OLAP</title>
12+
<script type="text/javascript" nonce="<%= request.getAttribute("cspNonce") %>">
13+
var JSsbiExecutionID = '<%= sbiExecutionID %>'
14+
var toolbarVisibleBtns = '<%= whatIfEngineInstance.getModelConfig().getToolbarVisibleButtons() %>'
15+
var toolbarClickedBtns = '<%= whatIfEngineInstance.getModelConfig().getToolbarClickedButtons() %>'
16+
var drillType = '<%= whatIfEngineInstance.getModelConfig().getDrillType() %>'
17+
var locker = '<%= whatIfEngineInstance.getModelConfig().getLocker() %>'
18+
var status = '<%= whatIfEngineInstance.getModelConfig().getStatus()%>'
19+
var mode = '<%= mode %>'
20+
var engineName = '<%= engine %>'
21+
var schemaID = '<%= schemaID %>'
22+
var schemaName = '<%= schemaName %>'
23+
var cubeName = '<%= cubeName %>'
24+
var currentContentId = '<%= currentContentId %>'
25+
var editModeCurrentContentId = '<%= editModeCurrentContentId %>'
26+
var jsonTemplate = '<%= jsonTemplate %>'
27+
</script>
28+
</head>
29+
<body layout="row" ng-controller="olapController" class="kn-olap">
30+
31+
<div ng-if="showLoadingMask" layout-fill style='position:fixed;z-index: 500;background:rgba(0,0,0, 0.3);'>
32+
<md-progress-circular md-mode='indeterminate' style='top:50%;left:50%' ></md-progress-circular>
33+
</div>
34+
35+
<div layout="column" flex>
36+
<main-toolbar ng-hide="true" loading></main-toolbar>
37+
<filter-panel loading></filter-panel>
38+
<olap-panel loading></olap-panel>
39+
</div>
40+
<div style="width:2px"></div>
41+
<sbi-side-nav></sbi-side-nav>
42+
43+
</body>
44+
</html>

0 commit comments

Comments
 (0)