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.

421 lines
14 KiB

<%@page pageEncoding="UTF-8" contentType="text/html" %>
<%@ page import ="org.dbforms.config.DbFormsConfigRegistry,java.sql.Connection,java.sql.Statement,java.sql.ResultSet" %>
<%if (request.getParameter("logoff") != null&&request.getSession()!=null) {
request.getSession().invalidate();
};
StringBuffer LinkMandantID=new StringBuffer("");
//Spezieller Bericht gewünscht?
StringBuffer defaultReport=new StringBuffer();
StringBuffer selectedReport=new StringBuffer();
defaultReport.append("?a=b");
String defaultTimeunit=request.getParameter("timeunit");
if(defaultTimeunit == null || defaultTimeunit.equals(""))
defaultTimeunit = "S";
if(defaultTimeunit != null && !defaultTimeunit.toString().equals(""))
defaultReport.append("&timeunit="+defaultTimeunit.toString());
String defaultReportParam=request.getParameter("report_id");
if(defaultReportParam != null && !defaultReportParam.toString().equals("")) {
defaultReport.append("&report_id="+defaultReportParam.toString());
selectedReport.append(defaultReportParam.toString());
}
String defaultMandantenIDParam=request.getParameter("MandantID");
String referrer=request.getParameter("referrer");
if(defaultMandantenIDParam != null && !defaultMandantenIDParam.toString().equals("")) {
defaultReport.append("&MandantID="+defaultMandantenIDParam.toString());
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;
Statement st5;
ResultSet l_rset5;
try {
conmm = DbFormsConfigRegistry.instance().lookup().getConnection(mandantenid);
st5=conmm.createStatement();
String queryMaskenRechte = "--alle Abfragen für die die Gruppe über Sachgebiete berechtigt \n"
+ "select distinct M.tid,M.name \n"
+ " from maskeninfo M, sachgeb_maske_bez S, group_sachgeb_bez G, user_group_bez U \n"
+ " where M.tid = S.maskeninfo_id \n"
+ " and S.sachgebiete_id = G.sachgebiete_id \n"
+ " and G.groupinfo_id = U.groupinfo_id \n"
+ " and U.userinfo_id = "
+ userid
+ " \n"
+ " union \n"
+ " --alle Abfragen für die die Gruppe berechtigt (Einzelrechte) \n"
+ " select distinct M.tid,M.name \n"
+ " from maskeninfo M, group_masken_bez G, user_group_bez U \n"
+ " where M.tid = G.maskeninfo_id \n"
+ " and G.groupinfo_id = U.groupinfo_id \n"
+ " and U.userinfo_id = "
+ userid
+ " \n"
+ " union \n"
+ "--alle Abfragen aus Sachgebieten für die der Nutzer Rechte hat \n"
+ " select distinct M.tid,M.name \n"
+ " from maskeninfo M \n"
+ " where \n"
+ " (M.tid in (select maskeninfo_id from sachgeb_maske_bez S where S.sachgebiete_id in \n"
+ " (select sachgebiete_id from user_sachgeb_bez U where U.userinfo_id="
+ userid
+ " ))) \n"
+ " union \n"
+ "--alle Abfragen für die Einzelrechte in user_masken_bez angegeben \n"
+ " select distinct M.tid,M.name \n"
+ " from maskeninfo M, user_masken_bez B \n"
+ " where \n"
+ " B.userinfo_id = "
+ userid
+ " \n"
+ " and (M.tid = B.maskeninfo_id \n"
+ " or B.maskeninfo_id = 0)";
l_rset5 = st5.executeQuery(queryMaskenRechte);
StringBuffer maskRights=new StringBuffer();
while (l_rset5.next())
{
maskRights.append(l_rset5.getObject(1)+",");
}
l_rset5.close();
st5.close();
//Semester ermitteln:
st5=conmm.createStatement();
String semestersql = "select tid,eintrag,akad_jahr_absolv from man_semester where today() >= sem_beginn order by 1 desc";
l_rset5 = st5.executeQuery(semestersql);
StringBuffer SemesterOptions=new StringBuffer();
StringBuffer SemesterArray=new StringBuffer();
int i=0;
SemesterArray.append("semArray= new Array();\n");
while (l_rset5.next())
{
i++;
SemesterOptions.append("<option value='"+l_rset5.getObject(1)+"'>"+l_rset5.getObject(2)+"</option>");
SemesterArray.append("semArray["+i+"] = new Array();");
SemesterArray.append("semArray["+i+"][1] = "+l_rset5.getObject(1)+";");
SemesterArray.append("semArray["+i+"][2] = "+l_rset5.getObject(3)+";\n");
}
l_rset5.close();
st5.close();
//Jahr ermitteln:
st5=conmm.createStatement();
String jahrsql2 = "select tid,tid from man_jahr where year(today()) >= tid order by 1 desc";
l_rset5 = st5.executeQuery(jahrsql2);
StringBuffer SelectJahrOptions=new StringBuffer();
while (l_rset5.next())
{
SelectJahrOptions.append("<option value='"+l_rset5.getObject(1)+"'>"+l_rset5.getObject(2)+"</option>");
}
l_rset5.close();
st5.close();
//maximales Jahr vor "heute" ermitteln
st5=conmm.createStatement();
String jahrsql = "select tid from man_jahr where year(today()) >= tid order by 1 desc";
l_rset5 = st5.executeQuery(jahrsql);
StringBuffer JahrOptions=new StringBuffer();
int jahre=0;
while (l_rset5.next())
{
jahre++;
JahrOptions.append("validYear["+jahre+"]="+l_rset5.getObject(1)+";\n");
}
l_rset5.close();
st5.close();
//Portlets holen
//st5=conmm.createStatement();
//StringBuffer portlet=new StringBuffer();
//l_rset5 = st5.executeQuery("select name,class,icon,content from sx_portlet where today() between gueltig_von and gueltig_bis and type='IFRAME_MAN' and (visible != 'false' or visible is null) order by sortnr_initial,tid");
//while (l_rset5.next())
//{
// if(l_rset5.getObject(1) !=null && l_rset5.getObject(2) !=null && l_rset5.getObject(3) !=null && l_rset5.getObject(4) !=null)
// portlet.append("<div style\"float:left;\"><iframe frameborder=\"0\" border=\"0\" cellspacing=\"0\" style=\"border-style: none;width: 330px; height: 330px;\" src=\""+ l_rset5.getString(4) +"\"></iframe> </div>");
// portlet.append("<span><iframe frameborder=\"0\" border=\"0\" cellspacing=\"0\" style=\"border-style: none;width: 330px; height: 330px;\" src=\""+ l_rset5.getString(4) +"\"></iframe> </span>");
//}
//l_rset5.close();
//st5.close();
//Hochschulnamen ermitteln:
Statement st_hs_name;
ResultSet rs_hs_name;
st_hs_name=conmm.createStatement();
String sql_hs_name = "select trim(contents_short) from sx_captions where id='REPORT_HEADING_INSTITUTION'";
rs_hs_name = st_hs_name.executeQuery(sql_hs_name);
String sb_hs_name="";
while (rs_hs_name.next())
{ if(rs_hs_name.getObject(1) !=null)
sb_hs_name=rs_hs_name.getObject(1).toString();
}
rs_hs_name.close();
st_hs_name.close();
if(sb_hs_name==null || sb_hs_name.equals(""))
sb_hs_name="Hochschule";
//Ende Hochschulnamen ermitteln
//Logopfad ermitteln:
Statement st_lg_path;
ResultSet rs_lg_path;
st_lg_path=conmm.createStatement();
String sql_lg_path = "select trim(contents_short) from sx_captions where id='REPORT_LOGO_FILE'";
rs_lg_path = st_lg_path.executeQuery(sql_lg_path);
String sb_lg_path="";
while (rs_lg_path.next())
{ if(rs_lg_path.getObject(1) !=null)
sb_lg_path="../"+rs_lg_path.getObject(1).toString();}
rs_lg_path.close();
st_lg_path.close();
if(sb_lg_path==null || sb_lg_path.equals("")|| sb_lg_path.equals("../"))
sb_lg_path="../../images/superx.gif";
//Ende Logopfad ermitteln
conmm.close();
int countMaskRights=0; boolean hasFinRights=false;boolean hasDrittRights=false;boolean hasManRights=false;
//String maskRights=request.getSession().getAttribute("UserMaskRights").toString();
if (maskRights.indexOf("14571000")>-1)
{countMaskRights++;hasFinRights=true;}
if (maskRights.indexOf("888880120")>-1)
{countMaskRights++;hasDrittRights=true;}
if (maskRights.indexOf("888881190")>-1)
{countMaskRights++;hasManRights=true;}
if (countMaskRights==0)
{
%>
<html>
<head>
<meta http-equiv="content-type" content="text/html;">
<title>Managementübersicht <%= sb_hs_name %></title>
<!-- <link rel="stylesheet" type="text/css" href="format.css">-->
<link rel="stylesheet" type="text/css" href="/superx/xml/css/fontello-codes.css" />
<link rel="stylesheet" type="text/css" href="/superx<%= LinkMandantID.toString() %>/xml/management/man.css" />
<link rel="stylesheet" type="text/css" href="/superx<%= LinkMandantID.toString() %>/xml/management/man_html.css" />
</head>
<script language="Javascript">
function oeffne(url)
{
self.maske.location.href=url;
}
function applyMerkmale(merkmale)
{
self.maske.applyMerkmale(merkmale);
}
</script>
<script type="text/javascript" src="js/dojo/dojo.js"></script>
<body>
<br/><br/><br/><br/><br/><h2 align="center"><font color=red>Sie haben keine Rechte für Finanz- oder Drittmittelbericht oder Managementübersicht</font><h2>
</body>
</html>
<% } else
//if (countMaskRights==1&&hasManRights) response.sendRedirect("/superx/servlet/SuperXmlTabelle?tid=888880190&Semester=20131");
//else
if (countMaskRights==1&&hasFinRights) response.sendRedirect("/superx/servlet/SuperXmlMaske?tid=14571000");
else
if (countMaskRights==1&&hasDrittRights) response.sendRedirect("/superx/servlet/SuperXmlMaske?tid=888880120");
else
{%>
<html>
<head>
<meta http-equiv="content-type" content="text/html;">
<title><%= sb_hs_name %></title>
<!-- <link rel="stylesheet" type="text/css" href="format.css">-->
<link rel="stylesheet" type="text/css" href="/superx<%= LinkMandantID.toString() %>/xml/management/man.css" />
<link rel="stylesheet" type="text/css" href="/superx<%= LinkMandantID.toString() %>/xml/management/man_html.css"/>
<script language="Javascript">
function oeffne(url)
{
self.maske.location.href=url;
}
function applyMerkmale(merkmale)
{
self.maske.applyMerkmale(merkmale);
}
//Jahr ist immer das letzte abgeschlossene Jahr
//Bsp
//SS 2012 am 10.12.2012 -> Jahr=2011
//SS 2012 am 10.1.2013 -> Jahr=2012
function SemUrl (choosenSem) {
var SemJahr=0;
for (var i=1;i<semArray.length;i++)
{
if(semArray[i][1]==choosenSem)
SemJahr=semArray[i][2];
}
if( SemJahr==0)
SemJahr=choosenSem.substring(0, 4);
var currentTime = new Date();
var currentYear=currentTime.getFullYear(); //z.B. 2013
var bezugsjahr=""; //z.B: bei SS 2013 =2012, bei WS 2013/2014 =2012
//in validYear stehen alle gültigen Bezugsjahre, z.B. 2014,2013,2011
//in der folgenden Schleife wird das letzte Jahr gesucht, das zum Jahr des gew. Semester passt
for(var i=1;i <=<%=jahre %>;i++)
{
if(validYear[i]<= SemJahr)
{
bezugsjahr=validYear[i];
break;
}
}
ausgabe="Semester="+choosenSem;
ausgabe +="&";
ausgabe +="Jahr="+bezugsjahr;
//ausgabe+="&maxoffset=100000";
//alert('/superx/servlet/SuperXmlTabelle?tid=888881190&'+ausgabe);
if(bezugsjahr=="")
{
alert('Kein gueltiges Bezugsjahr auswaehlbar');
return false;}
else
{
document.forms["management"].elements["Jahr"].value=bezugsjahr;
return true;
}
}
function JahrUrl (choosenJahr) {
//semesterOptiosn enthält "<option value=20142>WS 2014</option>"
var semstring="<%= SemesterOptions.toString() %>";
var WSJahr=choosenJahr+"2";
//wenn 2014 übergeben wird, wird daraus 20142 (=WS), und geprüft, ob 20142 in semstring ist (indexOf)
//wenn nicht, wird kein Semester übergeben.
if (semstring.indexOf(WSJahr)>-1)
{
document.forms["management"].elements["Semester"].value=WSJahr;
}
else
{
document.forms["management"].elements["Semester"].value="";
}
return true;
}
<%= SemesterArray.toString() %>
</script>
<script type="text/javascript" src="js/dojo/dojo.js"></script>
</head>
<body>
<br />
<p align="center"><%= sb_hs_name %></p>
<p align="center"><img src="<%= sb_lg_path %>" ></p>
<div align="center" id="Menue">
<form name="management" target="_self" action="/superx/servlet/SuperXmlTabelle">
<h2 align="center">Bitte w&auml;hlen Sie:</h2>
<% if (hasManRights) {
%>
<p class="menue">
<%
if(defaultTimeunit.equals("S"))
{
%>
<input type="submit" onclick="SemUrl(document.forms[0].elements['select_semester'].value);" value="Managementübersicht"></input> für
<select name="Semester" id="select_semester"><%= SemesterOptions.toString() %></select>
<script language="Javascript">
validYear=new Array();
<%= JahrOptions.toString() %>
</script>
<input type="hidden" name="Jahr" value="" />
<%
}
else
{
//Jahr:
%>
<input type="submit" onclick="JahrUrl(document.forms[0].elements['select_jahr'].value);" value="Managementübersicht"></input> für
<select name="Jahr" id="select_jahr"><%= SelectJahrOptions.toString() %></select>
<input type="hidden" name="Semester" value="" />
<%
}
if(!(selectedReport == null || selectedReport.toString().equals(""))) {
%>
<input type="hidden" name="Bericht" value="--<%=selectedReport.toString() %>--" />
<%
}
%>
<input type="hidden" name="tid" value="888881190" />
<input type="hidden" name="maxoffset" value="100000" />
</p><%}%>
<% if (hasFinRights) {%><p class="menue"> <input type="button" onclick="javascript:self.location.href='/superx/servlet/SuperXmlMaske?tid=14571000'" value="Finanzbericht"></input></p><%}%>
<% if (hasDrittRights) {%><p class="menue"> <input type="button" onclick="javascript:self.location.href='/superx/servlet/SuperXmlMaske?tid=888880120'" value="Drittmittelbericht"></input></p><%}%>
<% if (hasManRights) {
%>
<!--<div style="max-width:1400px;">-->
<span>
<%
// portlet.toString()
%>
</span>
<%}%>
</form>
</div>
</body>
</html>
<%
}
} //ende Suche DB Verbindung
catch (Exception e) {
out.print("<html><body>Fehler bei Datenverbindung: "+e+ " MandantID"+mandantenid);
}
}
else {
if (request.getSession()!=null) session.invalidate();
String send_redirect="/superx" + LinkMandantID.toString() + "/xml/management/index.jsp" + defaultReport.toString();
response.sendRedirect(send_redirect);
return;
}
%>