<%@page pageEncoding="utf-8" contentType="text/html; charset=UTF-8" %>
<%@ page import ="org.dbforms.config.DbFormsConfigRegistry,java.sql.Connection,java.sql.Statement,java.sql.ResultSet,de.superx.common.SxUser" %>
<%
String mandantenid="default";
//Ermittlung der Mandantenid zuerst aus Session,
//wenn leer (d.h. User ist noch nicht angemeldet)
//dann über request-Parameter
Object mandantobject=request.getSession().getAttribute("MandantenID");
if(mandantobject != null)
mandantenid=mandantobject.toString();
String mandantparam=request.getParameter("MandantenID");
if(mandantparam !=null && !mandantenid.equals(""))
mandantenid=mandantparam;
String username="";
String loginPortlet="";
StringBuffer defaultReport=new StringBuffer();
String defaultReportParam=request.getParameter("report_id");
String defaultMandantenIDParam=request.getParameter("MandantID");
StringBuffer LinkMandantenID=new StringBuffer("");
String MandantenID_Login=mandantenid;
LinkMandantenID.append("");
defaultReport.append("?a=b");
if(defaultReportParam != null && !defaultReportParam.toString().equals(""))
defaultReport.append("&report_id="+defaultReportParam.toString());
if((defaultMandantenIDParam == null || defaultMandantenIDParam.toString().equals("")) && !mandantenid.equals("default")) {
defaultMandantenIDParam=mandantenid;
}
if(defaultMandantenIDParam != null && !defaultMandantenIDParam.toString().equals("")) {
defaultReport.append("&MandantID="+defaultMandantenIDParam.toString());
LinkMandantenID.append("");//"/"+defaultMandantenIDParam.toString());
MandantenID_Login=defaultMandantenIDParam.toString();
}
//Daten aus Datenbank werden in Variablen gespeichert
Connection conmm=null;
//out.println("Getting Connection for mandantenid="+mandantenid);
try {
conmm = DbFormsConfigRegistry.instance().lookup().getConnection(mandantenid);
//System.out.println("Got Connection");
Statement st;
st=conmm.createStatement();
ResultSet rs;
String hs_logo="";
rs = st.executeQuery("select trim(contents_short) from sx_captions where id='REPORT_LOGO_FILE' and contents_short is not null and trim(contents_short) != '' ");
while (rs.next())
{ if(rs.getObject(1) !=null)
hs_logo=rs.getObject(1).toString();
}
//System.out.println("hs_logo="+hs_logo);
String hs_link="";
rs = st.executeQuery("select contents_short from sx_captions where id='REPORT_HEADING_URL'");
while (rs.next())
{ if(rs.getObject(1) !=null)
hs_link=rs.getObject(1).toString();
}
//System.out.println("hs_link="+hs_link);
String hs_inst="";
rs = st.executeQuery("select contents_short from sx_captions where id='REPORT_HEADING_INSTITUTION'");
while (rs.next())
{ if(rs.getObject(1) !=null)
hs_inst=rs.getObject(1).toString();
}
String custom_css="";
rs = st.executeQuery("select content from sx_repository where id='CUSTOM_CSS' and today() between gueltig_seit and gueltig_bis and aktiv=1");
while (rs.next())
{ if(rs.getObject(1) !=null)
custom_css=rs.getString(1);
}
//Login-Portlet?
int loginPortletCount=0;
rs = st.executeQuery("select count(*) from sx_portlet where today() between gueltig_von and gueltig_bis and type='HTML' and visible in ('login')");
while (rs.next())
{
if(rs.getObject(1) !=null )
loginPortletCount=rs.getInt(1);
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" class="has-navbar-fixed-top">
<head>
<title>SuperX</title>
<%@ include file="htmlhead.inc" %>
</head>
<body>
<%
if (request.getParameter("logoff") != null&&request.getSession()!=null) { request.getSession().invalidate(); };
if (request.getSession()!=null&&request.getSession().getAttribute("sessiontype")!=null&&request.getSession().getAttribute("sessiontype").equals("superx")
&& request.getSession().getAttribute("user")!=null) {
%>
<!-- Inhalt wenn angemeldet -->
<nav class="navbar is-fixed-top" role="navigation" aria-label="main navigation">
<%@ include file="topbar_left.inc" %>
<%@ include file="topbar_right.inc" %>
</nav>
<div class="card">
<div class="card-content">
<div class="media-content has-text-centered">
<p class="title is-4"><%= hs_inst %></p>
<div id="nd_info_tiles">
<div class="grid">
<%
rs = st.executeQuery("select caption,content,comment as icon,nvl(art2,'has-background-primary-light'::varchar(255)) as tileclass,tid from sx_repository where art='WELCOME_LINK' and today() between gueltig_seit and gueltig_bis and aktiv=1 order by sort1");
while (rs.next())
{
if(rs.getObject(1) !=null && rs.getObject(2) !=null && rs.getObject(3) !=null && rs.getObject(4) !=null)
{
String welcomeLink=rs.getString(2);
if (mandantenid.toString().equals("default")) {
welcomeLink="/superx/" +welcomeLink;
} else {
//Mandantenlink:
if(welcomeLink.indexOf("?") >-1)
welcomeLink+="&MandantID="+ mandantenid.toString();
else
welcomeLink+="?MandantID="+ mandantenid.toString();
welcomeLink="/superx/"+welcomeLink;
}
%>
<jsp:include page="menuelement.jsp" >
<jsp:param name="caption" value="<%= rs.getObject(1) %>" />
<jsp:param name="content" value="<%= welcomeLink %>" />
<jsp:param name="icon" value="<%= rs.getObject(3) %>" />
<jsp:param name="tileclass" value="<%= rs.getString(4) %>" />
<jsp:param name="tid" value="<%= rs.getString(5) %>" />
</jsp:include>
<%
}
}
%>
</div>
<!--Beginn Info-Kacheln-->
<section class="info-tiles">
<div id="nd_portlets" class="portlet_grid">
<div class="grid">
<%
rs = st.executeQuery("select name,class,icon,content,visible,sortnr_initial,tid from sx_portlet where today() between gueltig_von and gueltig_bis and type='HTML' and visible in ('all','post_login') order by sortnr_initial,tid");
while (rs.next())
{
if(rs.getObject(1) !=null && rs.getObject(2) !=null && rs.getObject(3) !=null && rs.getObject(4) !=null)
{
%>
<jsp:include page="portlet.jsp" >
<jsp:param name="name" value="<%= rs.getObject(1) %>" />
<jsp:param name="classname" value="<%= rs.getObject(2) %>" />
<jsp:param name="icon" value="<%= rs.getObject(3) %>" />
<jsp:param name="content" value="<%= rs.getString(4) %>" />
<jsp:param name="tid" value="<%= rs.getString(7) %>" />
</jsp:include>
<%
}
}
rs.close();
st.close();
conmm.close();
%>
</div>
</div>
</section>
</div>
</div>
<%
de.superx.common.SxUser user= (de.superx.common.SxUser) request.getSession().getAttribute("user");
if(user != null)
{
//username=(de.superx.common.SxUser) user.getName();
//System.out.println(user.toString());
username= user.toString();
}
else
{
System.out.println("No user found");
}
%>
</div>
</div>
<%@ include file="footer.inc" %>
<% }else {%>
<!-- Inhalt wenn nicht angemeldet-->
<%
if(request.getRemoteUser() != null)
{
username=request.getRemoteUser();
//int ende=username.indexOf("@");
//if(ende >-1)
// username=username.substring(0,ende);
%>
<jsp:forward page="servlet/SuperXmlAnmeldung" >
<jsp:param name="kennung" value="<%= username %>" />
<jsp:param name="requestedServlet" value="../index.jsp"/>
<jsp:param name="alt_redirect_url" value="../index.jsp" />
</jsp:forward>
<%
} %>
<nav class="navbar is-fixed-top" role="navigation" aria-label="main navigation">
<%@ include file="topbar_left.inc" %>
</nav>
<!---Beginn Login-Dialog-->
<% if(loginPortletCount == 0 )
{
%>
<%@ include file="sx_login.inc" %>
<%
}
else
{
%>
<div id="nd_login" class="portlet_grid">
<div class="grid">
<%
rs = st.executeQuery("select name,class,icon,content,visible,sortnr_initial,tid from sx_portlet where today() between gueltig_von and gueltig_bis and type='HTML' and visible in ('all','login','pre_login') order by sortnr_initial,tid");
while (rs.next())
{
if(rs.getObject(1) !=null && rs.getObject(2) !=null && rs.getObject(3) !=null && rs.getObject(4) !=null)
{
%>
<jsp:include page="portlet.jsp" >
<jsp:param name="name" value="<%= rs.getObject(1) %>" />
<jsp:param name="classname" value="<%= rs.getObject(2) %>" />
<jsp:param name="icon" value="<%= rs.getObject(3) %>" />
<jsp:param name="content" value="<%= rs.getString(4) %>" />
<jsp:param name="tid" value="<%= rs.getString(7) %>" />
</jsp:include>
<%
}
}
%>
</div>
</div>
<%
rs.close();
st.close();
conmm.close();
}
%>
<!---Ende Login-Dialog-->
</body>
</html>
<%
}
} //Check DB connection
catch (Exception e) {
out.print("<html><body>Fehler bei Datenverbindung: "+e+ " MandantID"+mandantenid);
}
%>