<%@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); } %> SuperX <%@ include file="htmlhead.inc" %> <% 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) { %>

<%= hs_inst %>

<% 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; } %> <% } } %>
<% 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) { %> <% } } rs.close(); st.close(); conmm.close(); %>
<% 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"); } %>
<%@ include file="footer.inc" %> <% }else {%> <% if(request.getRemoteUser() != null) { username=request.getRemoteUser(); //int ende=username.indexOf("@"); //if(ende >-1) // username=username.substring(0,ende); %> <% } %> <% if(loginPortletCount == 0 ) { %> <%@ include file="sx_login.inc" %> <% } else { %>
<% 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) { %> <% } } %>
<% rs.close(); st.close(); conmm.close(); } %> <% } } //Check DB connection catch (Exception e) { out.print("Fehler bei Datenverbindung: "+e+ " MandantID"+mandantenid); } %>