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.
422 lines
13 KiB
422 lines
13 KiB
<%@page pageEncoding="utf-8" contentType="text/html; charset=UTF-8" %> |
|
<html> |
|
<head> |
|
<% |
|
if (request.getCharacterEncoding() == null) |
|
request.setCharacterEncoding("UTF-8"); |
|
Object userobject=request.getSession().getAttribute("UserID"); |
|
String userid; |
|
String filter=""; |
|
String sql=""; |
|
if(userobject == null) |
|
{ |
|
%> |
|
|
|
<jsp:forward page="/edit/not_authenticated.htm"/> |
|
<% |
|
} |
|
else |
|
userid=userobject.toString(); |
|
Object mandantobject=request.getSession().getAttribute("MandantenID"); |
|
String mandantenid=""; |
|
if(mandantobject != null) |
|
mandantenid=mandantobject.toString(); |
|
//der superx-Default-Mandant ist bei dbforms ein Leerstring |
|
if(mandantenid.equals("default")) |
|
mandantenid=""; |
|
String custom_css=""; //TODO |
|
String tid = request.getParameter("tid"); |
|
String fname = request.getParameter("Feldname"); |
|
String previousValue = request.getParameter("previousValue"); |
|
String zeilenanzahl = request.getParameter("zeilenanzahl"); |
|
|
|
String params = request.getParameter("params"); |
|
|
|
String callurl="../../servlet/SuperXmlMaske?tid="+tid+"&getJSON_"+fname+"=xxxxxx-xxxxxx@"; |
|
callurl+=params; |
|
|
|
%> |
|
|
|
<%@ include file="../../htmlhead_dialoge.inc" %> |
|
|
|
<title>Auswahl <%=fname %></title> |
|
</head> |
|
<style> |
|
</style> |
|
<script type="text/javascript" language="javascript"> |
|
|
|
var sichtContentJSON; |
|
var fname="<%= fname %>"; |
|
var maskentid="<%= tid %>"; |
|
var previousValue="<%= previousValue %>"; |
|
var zeilenanzahl="<%= zeilenanzahl %>"; |
|
var referrerWindow=window.opener; |
|
var referrerDocument=referrerWindow.document; |
|
var referrerForm=referrerDocument.forms[0]; |
|
previousValue=referrerForm.elements[fname].value; |
|
var referrerFormInputSichtid=referrerForm.elements[fname+"-Sicht"]; |
|
var referrerFormInputSichtstand=referrerForm.elements[fname+"-Stand"]; |
|
var referrerFormDivSichtauswahlInnerHTML=""; |
|
var referrerFormDivSichtstandInnerHTML=""; |
|
var selectedSichtid=""; |
|
var selectedSichtStand=""; |
|
if(referrerFormInputSichtid) |
|
{ |
|
var sichtauswahlDiv=referrerDocument.getElementById(fname+"-Sicht-div"); |
|
if(sichtauswahlDiv) |
|
referrerFormDivSichtauswahlInnerHTML=sichtauswahlDiv.innerHTML; |
|
selectedSichtid=referrerForm.elements[fname+"-Sicht"].value; |
|
} |
|
if(referrerFormInputSichtstand) |
|
{ |
|
var sichtstandDiv=referrerDocument.getElementById(fname+"-Stand-div"); |
|
if(sichtstandDiv) |
|
referrerFormDivSichtstandInnerHTML=sichtstandDiv.innerHTML; |
|
selectedSichtStand=referrerForm.elements[fname+"-Stand"].value; |
|
} |
|
var previousValuesArray=ndMaskDialogPreviousValueToArray(previousValue); |
|
|
|
var previousValuesCount=0; |
|
if(previousValuesArray) |
|
previousValuesCount=previousValuesArray.length; |
|
//previousValuesCount=0; //TODO: wenn previousValue, dann klappt Aufklappen nicht immer |
|
function initDialog(url,searchstring) |
|
{ |
|
var ret; |
|
var xhttp = new XMLHttpRequest(); |
|
xhttp.onreadystatechange = function() { |
|
if (this.readyState == 4 && this.status == 200) { |
|
sichtContentJSON= purgeval(this.responseText); |
|
//console.log(sichtContentJSON); |
|
renderSichtauswahl(sichtContentJSON); |
|
renderSicht(sichtContentJSON,searchstring); |
|
} |
|
}; |
|
xhttp.open("GET", url, true); |
|
xhttp.send(); |
|
} |
|
|
|
function renderSichtauswahl(content) |
|
{ |
|
var targetDiv=document.getElementById("sichtauswahlDiv"); |
|
var zs=""; |
|
//zs+="TTT"+JSON.stringify(content.sichten.selected); |
|
if(content && content.sichten.selected && content.sichten.selected.name ) |
|
{ |
|
zs += "<div class='field is-grouped is-grouped-multiline'><div class='input-container'><label class='label'>Sicht</label>"; |
|
//zs += "Ausgewählte Sicht: </span></div>"; |
|
//zs+=" <div class='field-body'><div class='field is-active'>"; |
|
zs+= buildSichtauswahlSelect(content); |
|
zs+="</div></div>"; |
|
if(content.sichten.selected.stand) |
|
{ |
|
zs += "<div class='input-container'>"; |
|
zs += "<label class='label'>Stand</label>"; |
|
zs+="<input type='date' class='input is-small' name='Standdatum' id='Standdatum' maxlength='10' size='3'"; |
|
zs+=" value='"+dateGermanToDateUS(content.sichten.stand)+"' onChange='sichtStandchange(this.value)'/>"; |
|
zs+="</div>"; |
|
|
|
// |
|
} |
|
//zs +="</div></div></div>";//von field is-grouped, damit Sicht und Standdatum in einer Zeile sind |
|
} |
|
else |
|
{ |
|
zs+="Keine Sichtauswahl möglich"; |
|
} |
|
|
|
//Suche: |
|
zs += "<div class='input-container'>"; |
|
zs += "<label class='label'>Suche</label>"; |
|
zs+="<div class='field has-addons'><div class='control'>"; |
|
zs+= "<input id='sichtSuche' class='input is-small is-active' type='text' placeholder='Suche' onBlur='ndSichtEintraegeSuchen(this.value);return false;'/>"; |
|
zs+="</div><div class='control'><button class='button is-small is-rounded' onClick='ndSichtEintraegeSuchen(document.getElementById(\'sichtSuche\'));return false;'>"; |
|
zs+="<span class='icon' aria-hidden='true' alt='Suche' title='Suche'><img src='../../images/search_blue.svg'/></span></button>"; |
|
zs+="</div></div></div>"; |
|
|
|
targetDiv.innerHTML=zs; |
|
} |
|
|
|
|
|
function buildSichtauswahlSelect(content) |
|
{ |
|
var zs="<div class='select is-small is-focused'><select id='sichtauswahlSelect' name='sichtauswahlSelect' style='max-width: 15rem;' onChange='sichtAuswahlchange(this.value)'>"; |
|
zs+="<option class='maskinput' value='"+content.sichten.selected.name_intern+"' selected>"; |
|
zs+=content.sichten.selected.name+"</option>"; |
|
for(var j=0;j < content.sichten.other.length;j++) |
|
{ |
|
var node=content.sichten.other[j]; |
|
zs+="<option class='maskinput' value='"; |
|
zs+=node.name_intern+"'"; |
|
zs+=">"+node.name+"</option>"; |
|
} |
|
zs+="</select>"; |
|
return zs; |
|
} |
|
|
|
function sichtAuswahlchange(gewaehlteSicht) |
|
{ |
|
var url="../../servlet/SuperXmlMaske?tid="+maskentid+"&getJSON_"+fname+"=xxxxxx-xxxxxx@"; |
|
url+="&"+fname+"-aktualisieren=true&" + fname + "-Sicht=" + gewaehlteSicht; |
|
|
|
initDialog(url,''); |
|
} |
|
|
|
function sichtStandchange(datumUS) |
|
{ |
|
var datum=dateUSToDateGerman(datumUS); |
|
console.log(datum); |
|
var url="../../servlet/SuperXmlMaske?tid="+maskentid+"&getJSON_"+fname+"=xxxxxx-xxxxxx@"; |
|
url+="&"+fname+"-aktualisieren=true&" + fname + "-Stand=" + datum; |
|
|
|
initDialog(url,''); |
|
|
|
} |
|
|
|
function renderSicht(content,searchstring) |
|
{ |
|
var targetDiv =document.getElementById("sichtDiv"); |
|
//targetDiv.innerHTML=JSON.stringify(content); |
|
var zs=""; |
|
//zs += "<p>"+selectedSichtid+"</p>"; |
|
//zs += "<p>"+selectedSichtStand+"</p>"; |
|
//zs += "<p>ttt"+previousValue+"</p>"; |
|
//zs +=referrerFormDivSichtauswahlInnerHTML; |
|
//zs +=referrerFormDivSichtstandInnerHTML; |
|
//zs +=JSON.stringify(content); |
|
zs +="<ul id='sichtentreeUL'>" |
|
if(content && content.nodes && content.nodes.length >0) |
|
{ |
|
//zs +="<li>content.nodes.length"+content.nodes.length+"</li>"; |
|
for(var j=0;j < content.nodes.length;j++) |
|
{ |
|
var node=content.nodes[j]; |
|
zs +=renderNode(node,true,searchstring,previousValuesCount,previousValuesArray,zeilenanzahl); |
|
} |
|
} |
|
|
|
zs +="</ul>"; |
|
targetDiv.innerHTML=zs; |
|
} |
|
|
|
function renderNode(node,isRoot,searchstring,previousValuesCount,previousValuesArray,zeilenanzahl) |
|
{ |
|
var zs=""; |
|
if(searchstring=="" || node.title.indexOf(searchstring)>-1) |
|
{ |
|
if(node.objectId !="") |
|
{ |
|
var checkedString=""; |
|
for(var i=0;i < previousValuesCount;i++) |
|
{ |
|
if(previousValuesArray[i]==node.objectId) |
|
checkedString="checked "; |
|
|
|
} |
|
|
|
var fldName="inp"+node.objectId; |
|
var fldId="inp"+node.objectId; |
|
var fldType="checkbox"; |
|
if(zeilenanzahl==1) |
|
{ |
|
fldName=fname; |
|
fldType="radio"; |
|
} |
|
zs += "<li class='sichtentreeLI'>"; |
|
if(node.isFolder=="true" && !isRoot) |
|
{ |
|
zs+="<span class='sichtentreeCaret' id='sichtentreeCaret_"+node.objectId+"'"; |
|
zs+="onClick=\"getChildNodes('"+node.objectId.trim()+"',this)\">"; |
|
zs+="</span> "; |
|
|
|
} |
|
else |
|
zs+="<span style='margin-left:10px'> </span>"; |
|
if (node.nodeattrib && node.nodeattrib == 2) |
|
{ //nicht selektierbar: |
|
zs +="<span style='margin-left:10px' class='is-unselectable'> </span>"; |
|
zs +="<span>"+node.title+"</span>\n"; |
|
} |
|
else { |
|
zs+="<input type='"+fldType+"' "+checkedString+ " name='"+fldName+ "' id='"+fldId+ "' value='"+node.objectId +"' /> "; |
|
zs +="<label for='"+fldId+"' id='label"+node.objectId +"'>"+node.title+"</label>\n"; |
|
} |
|
if(node.children && node.children.length >0 ) |
|
{ |
|
for(var i=0;i < node.children.length;i++) |
|
{ |
|
zs+="<ul>"; |
|
zs += renderNode(node.children[i],false,searchstring,previousValuesCount,previousValuesArray,zeilenanzahl); |
|
zs +="</ul>"; |
|
|
|
} |
|
} |
|
zs+="</li>"; |
|
|
|
} |
|
} //Ende wenn suchstring |
|
return zs; |
|
} |
|
|
|
function getChildNodes(nodeId,spanElem) |
|
{ |
|
//spanElem.parentElement.querySelector(".sichtentreeNested").classList.toggle("sichtentreeActive"); |
|
var childUlId="childOf"+nodeId; |
|
spanElem.classList.toggle("sichtentreeCaret-down"); |
|
|
|
if(document.getElementById(childUlId)) |
|
{ |
|
//Kind existiert bereits, wird nur unsichtbar: |
|
document.getElementById(childUlId).classList.toggle("sichtentreeNested"); |
|
} |
|
else |
|
{ |
|
//Kind existiert noch nicht: |
|
const childUL=document.createElement("ul"); |
|
childUL.id=childUlId; |
|
childUL.classList.add("sichtentreeChildUL"); |
|
spanElem.parentElement.appendChild(childUL); |
|
|
|
var url="../../servlet/SuperXmlMaske?tid="+maskentid+"&getJSON_"+fname+"="+nodeId; //xxxxxx-xxxxxx@"; |
|
var suburl=url+"&"+fname+"="+nodeId; |
|
var ret; |
|
var xhttp = new XMLHttpRequest(); |
|
xhttp.onreadystatechange = function() { |
|
if (this.readyState == 4 && this.status == 200) { |
|
childrenJSON= purgeval(this.responseText); |
|
//childUL.innerHTML=JSON.stringify(sichtContentJSON); |
|
var childrenHTML=""; |
|
if(childrenJSON && childrenJSON.length >0) |
|
{ |
|
//zs +="<li>content.nodes.length"+content.nodes.length+"</li>"; |
|
for(var j=0;j < childrenJSON.length;j++) |
|
{ |
|
var node=childrenJSON[j]; |
|
childrenHTML +=renderNode(node,false,"",previousValuesCount,previousValuesArray,zeilenanzahl); |
|
} |
|
} |
|
childUL.innerHTML=childrenHTML; |
|
//alert(JSON.stringify(childrenJSON)); |
|
} |
|
}; |
|
xhttp.open("GET", suburl, true); |
|
xhttp.send(); |
|
} |
|
|
|
} |
|
|
|
function ndSichtEintraegeSuchen(was) { |
|
var callurl = '/superx/servlet/SuperXmlMaske'; |
|
callurl += '?tid=' + maskentid + '&getJSON_' + fname + |
|
'=search:' + getEncoded(was); |
|
//document.getElementById('progressbar').style.display = ""; |
|
var xhttp = new XMLHttpRequest(); |
|
xhttp.onreadystatechange = function() { |
|
if (this.readyState == 4 && this.status == 200) { |
|
var searchResultJSON= purgeval(this.responseText); |
|
//document.getElementById("sichtDiv").innerHTML=JSON.stringify(searchResultJSON); |
|
var searchResultHTML="<ul>"; |
|
if(searchResultJSON && searchResultJSON.length >0) |
|
{ |
|
for(var j=0;j < searchResultJSON.length;j++) |
|
{ |
|
var node=searchResultJSON[j]; |
|
searchResultHTML += renderNode(node,true,"",previousValuesCount,previousValuesArray,zeilenanzahl); |
|
} |
|
} |
|
document.getElementById("sichtDiv").innerHTML=searchResultHTML+"</ul>"; |
|
//alert(JSON.stringify(childrenJSON)); |
|
} |
|
}; |
|
xhttp.open("GET", callurl, true); |
|
xhttp.send(); |
|
} |
|
|
|
|
|
|
|
|
|
</script> |
|
<body class="has-navbar-fixed-top" onload="initDialog('<%=callurl %>','')"> |
|
<div id="nd_navi_top"> |
|
<nav class="navbar is-fixed-top" role="navigation" ><!--aria-label="main navigation"--> |
|
<div class="navbar-brand"> |
|
|
|
<div class="navbar-item"> |
|
<p class="title is-4">Auswahl <%=fname %></p> |
|
</div> |
|
</div> |
|
|
|
<div class="navbar-end"><span class="navbar-end"> |
|
<div class="navbar-item is-hoverable"> |
|
<div class="buttons"> |
|
<p class="submit_button"> |
|
<button class="button" type="submit"> |
|
<a onclick="ndMaskSichtDialogUebernehmen(document.forms['selection'],referrerForm)">Übernehmen</a> |
|
</button> |
|
</p> |
|
</div> |
|
</div> |
|
|
|
<div class="navbar-item is-hoverable"> |
|
<div class="buttons"> |
|
<p class="reset_button"> |
|
<button class="button"> |
|
<a onclick="ndMaskDialogLeeren(document.forms['selection'],referrerForm)">Leeren</a> |
|
</button> |
|
</p> |
|
</div> |
|
</div> |
|
|
|
<div class="navbar-item is-hoverable"> |
|
<div class="buttons"> |
|
<p class="close_button"> |
|
<button class="button"> |
|
<span class="icon is-small"> |
|
<a onclick="window.close();"> |
|
<img src="../../images/close.svg" title="Schließen" aria-label="Schließen" /></a> |
|
</span> |
|
</button> |
|
</p> |
|
</div> |
|
</div> |
|
</span> |
|
</div> |
|
</nav> |
|
|
|
<!--<div class="container"> doppelte scrollbalken verhindern--> |
|
<form name="selection" onsubmit="return false;" style="margin:0px"> |
|
|
|
<div class="input-container"> |
|
<div class="field is-grouped is-grouped-multiline"> |
|
<div class="input-container"> |
|
<div id="sichtauswahlDiv"> |
|
</div> |
|
</div> |
|
|
|
|
|
</div> |
|
</div> |
|
<% if(zeilenanzahl!=null && !zeilenanzahl.equals("1")) |
|
{ |
|
%> |
|
|
|
<div class="buttons"> |
|
<input type="checkbox" name="metaCheckox" value="" style="margin-left:1.5rem;" onclick="ndMaskDialogToggleAllCheckboxes(document.forms['selection'],this)" />  alle markieren |
|
</div> |
|
<hr /> |
|
<% |
|
} |
|
%> |
|
|
|
|
|
<div id="sichtDiv" class="comboDiv">keine Auswahl möglich |
|
|
|
</div> |
|
|
|
|
|
|
|
</form> |
|
<!--</div> container--> |
|
</div> |
|
</body> |
|
</html>
|
|
|