SuperX-Kernmodul
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

175 lines
4.8 KiB

<%@page pageEncoding="UTF-8" contentType="text/html" %>
<%@ page import ="org.dbforms.config.DbFormsConfigRegistry,java.sql.Connection,java.sql.PreparedStatement,java.sql.Statement,java.sql.ResultSet" %>
<%if (request.getParameter("logoff") != null&&request.getSession()!=null) {
request.getSession().invalidate();
};
StringBuffer LinkMandantID=new StringBuffer("");
int MAXCHARLENGTH_OF_KEYS = 50;
String ALLOWED_KEY_CHARS = "abcdefghijklmnopqrstuvwxyzäöüßABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜ_1234567890";
String IdOutput=request.getParameter("output");
String defaultMandantenIDParam=request.getParameter("MandantID");
//Check Validity:
boolean entryOK=true;
if(IdOutput.length()> MAXCHARLENGTH_OF_KEYS)
entryOK=false;
for (int i = 0; i < IdOutput.length(); i++) {
char lookingAt = IdOutput.charAt(i);
if (ALLOWED_KEY_CHARS.indexOf(lookingAt)==-1) {
entryOK=false;
}
}
if(!entryOK)
throw new IllegalArgumentException(
"output Parameter contains forbidden characters or length");
if(defaultMandantenIDParam != null && !defaultMandantenIDParam.toString().equals("")) {
LinkMandantID.append("/"+defaultMandantenIDParam.toString());
}
if (request.getSession()!=null&&request.getSession().getAttribute("sessiontype")!=null&&
request.getSession().getAttribute("sessiontype").equals("superx")) {
Object mandantobject=request.getSession().getAttribute("MandantenID");
Object userid=request.getSession().getAttribute("UserID");
String mandantenid="";
if(mandantobject != null)
mandantenid=mandantobject.toString();
else
{
if(defaultMandantenIDParam != null)
mandantenid=defaultMandantenIDParam.toString();
}
//der superx-Default-Mandant ist bei dbforms ein Leerstring
if(mandantenid.equals("default"))
mandantenid="";
Connection conmm=null;
try {
conmm = DbFormsConfigRegistry.instance().lookup().getConnection(mandantenid);
//Ausgabe holen:
PreparedStatement st_output;
ResultSet rs_output;
st_output=conmm.prepareStatement("select trim(content) from sx_repository where id=? and today() between gueltig_seit and gueltig_bis and aktiv=1");
st_output.setString(1,IdOutput);
rs_output = st_output.executeQuery();
String sb_output="";
while (rs_output.next())
{ if(rs_output.getObject(1) !=null)
sb_output=rs_output.getObject(1).toString().trim();
}
rs_output.close();
st_output.close();
if(sb_output==null || sb_output.equals(""))
sb_output="<p>Text konnte nicht geladen werden, wenden Sie sich an den Administrator</p>";
//Ende Ausgabe holen
//Titel holen:
PreparedStatement st_titel;
ResultSet rs_titel;
st_titel=conmm.prepareStatement("select trim(caption) from sx_repository where id=? and today() between gueltig_seit and gueltig_bis and aktiv=1");
st_titel.setString(1,IdOutput);
rs_titel = st_titel.executeQuery();
String sb_titel="";
while (rs_titel.next())
{ if(rs_titel.getObject(1) !=null)
sb_titel=rs_titel.getObject(1).toString();
}
rs_titel.close();
st_titel.close();
if(sb_titel==null || sb_titel.equals(""))
sb_titel="Show HTML content";
//Ende Titel holen
//Plattform holen:
Statement st_plattform;
ResultSet rs_plattform;
st_plattform=conmm.createStatement();
String sql_plattform = "select apnr from konstanten where beschreibung='PLATTFORM'";
rs_plattform = st_plattform.executeQuery(sql_plattform);
String sb_plattform="";
while (rs_plattform.next())
{ if(rs_plattform.getObject(1) !=null)
sb_plattform=rs_plattform.getObject(1).toString();
}
rs_plattform.close();
st_plattform.close();
if(sb_plattform==null || sb_plattform.equals(""))
sb_plattform="2";
//Ende Platform holen
String sb_plattform_his="1";
conmm.close();
%>
<html>
<head>
<meta http-equiv="content-type" content="text/html;">
<title><%=sb_titel.toString() %></title>
<link rel="stylesheet" type="text/css" href="/superx/xml/css/fontello-codes.css" />
<%
if(sb_plattform.toString().equals(sb_plattform_his.toString())) {
%>
<LINK href="/superx<%= LinkMandantID.toString() %>/xml/his1/css/HISinOne.css" type="text/css" REL="stylesheet">
<%
} else {
%>
<LINK href="/superx<%= LinkMandantID.toString() %>/style/superx.css" type="text/css" REL="stylesheet">
<%
}
%>
</head>
<body>
<%
if(!(sb_output == null || sb_output.toString().equals(""))) {
%>
<%=sb_output.toString() %>
<%
}
else {
out.print("<p>Text konnte nicht geladen werden, wenden Sie sich an den Administrator</p>");
%>
</body>
</html>
<%
} }//ende Suche DB Verbindung
catch (Exception e) {
out.print("<html><body>Fehler bei Datenverbindung: "+e+ " <br>MandantID: "+mandantenid+"</body></html>");
}
}
else {
if (request.getSession()!=null) session.invalidate();
String send_redirect="/superx" + LinkMandantID.toString() + "/index.jsp";
response.sendRedirect(send_redirect);
return;
}
%>