Browse Source

Sichten Button soll Pfad anzeigen, wenn in tiefer Verschachtelung etwas ausgewählt wurde #18

master
Daniel Quathamer 1 week ago
parent
commit
929ad98674
  1. 44
      src/de/superx/common/Field.java
  2. 10
      src/de/superx/common/SelectableItemNode.java
  3. 16
      src/de/superx/servlet/SuperXmlMaske.java
  4. 2
      superx/WEB-INF/conf/version.properties
  5. BIN
      superx/WEB-INF/lib/superx6.0.jar
  6. 154
      superx/edit/kern/maske_sicht_laden.jsp
  7. 2
      superx/xml/js/memtext/nd_functions.js
  8. 4
      superx/xml/nd_templates.xsl

44
src/de/superx/common/Field.java

@ -5,6 +5,7 @@ import static de.superx.servlet.SxSQL_Server.DEFAULT_MANDANTEN_ID; @@ -5,6 +5,7 @@ import static de.superx.servlet.SxSQL_Server.DEFAULT_MANDANTEN_ID;
import java.io.IOException;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
@ -28,6 +29,7 @@ import de.memtext.util.DateUtils; @@ -28,6 +29,7 @@ import de.memtext.util.DateUtils;
import de.memtext.util.NumberUtils;
import de.memtext.util.StringUtils;
import de.superx.rest.model.FieldType;
import de.superx.rest.model.Item;
import de.superx.sec.CheckExecution;
import de.superx.servlet.ExternalPool;
import de.superx.servlet.ServletUtils;
@ -1915,7 +1917,7 @@ public class Field extends NamedIdObject implements TemplateHashModel, TemplateM @@ -1915,7 +1917,7 @@ public class Field extends NamedIdObject implements TemplateHashModel, TemplateM
return false;
}
public StringBuffer getJSON(String param)
public StringBuffer getJSON(String param,boolean completeTree)
throws SQLException, DBServletException, KeyParentEqualException, CloneNotSupportedException, SichtException, TemplateException, IOException {
// System.out.println("defaultvaluestring:"+this.defaultwertString+"
// defaultvalue *"+getDefaultValue().getId()+"*");
@ -1929,7 +1931,7 @@ public class Field extends NamedIdObject implements TemplateHashModel, TemplateM @@ -1929,7 +1931,7 @@ public class Field extends NamedIdObject implements TemplateHashModel, TemplateM
if (param.startsWith("search:"))
addSearchJSON(param, result);
else
addRegularJSON(param, result);
addRegularJSON(param, result,completeTree);
result.append(")");
return result;
@ -1950,18 +1952,21 @@ public class Field extends NamedIdObject implements TemplateHashModel, TemplateM @@ -1950,18 +1952,21 @@ public class Field extends NamedIdObject implements TemplateHashModel, TemplateM
else
isFirstItem = false;
result.append(node.toJSON(this.getDefaultValue().getId(), false));
result.append(node.toJSON(this.getDefaultValue().getId(), "AllKids"));
}
}
result.append("]");
}
private void addRegularJSON(String param, StringBuffer result) {
private void addRegularJSON(String param, StringBuffer result, boolean completeTree) {
if (!this.getSelectableItemsTree().containsItemWithId(param))
throw new IllegalArgumentException("Im Feld " + getName() + " (" + getId() + ") gibt es kein Element " + param);
String kidsInclusion="onlyDirectKids";
if(completeTree)
kidsInclusion="AllKids";
SelectableItemNode startnode = getSelectableItemsTree().getById(param);
boolean isSingleRoot = startnode.getChildCount() < 2;
if (param.equals("xxxxxx-xxxxxx@")) {
result.append("{");
if (isOldOrganigrammArt() || isSicht()) {
@ -1985,9 +1990,26 @@ public class Field extends NamedIdObject implements TemplateHashModel, TemplateM @@ -1985,9 +1990,26 @@ public class Field extends NamedIdObject implements TemplateHashModel, TemplateM
// };
}
result.append("[");
/*if(completeTree)
{
if (startnode != null && startnode.getChildCount() > 0) {
Collection<SelectableItemNode> col = getSelectableItemsTree()
.getElements(SelectableItemTree.PREORDER_ENUM, false);
for (SelectableItemNode node2 : col) {
SelectableItem item = (SelectableItem) node2.getUserObject();
result.append("[");
result.append(node2.toJSON(this.getDefaultValue().getId(), isSingleRoot));
result.append("]");
}
}
}
else
{*/
boolean isFirstItem = true;
result.append("[");
for (Enumeration en = startnode.children(); en.hasMoreElements();) {
SelectableItemNode node = (SelectableItemNode) en.nextElement();
if (node.isHidden()) continue;
@ -1996,11 +2018,15 @@ public class Field extends NamedIdObject implements TemplateHashModel, TemplateM @@ -1996,11 +2018,15 @@ public class Field extends NamedIdObject implements TemplateHashModel, TemplateM
else
isFirstItem = false;
result.append(node.toJSON(this.getDefaultValue().getId(), isSingleRoot));
}
result.append(node.toJSON(this.getDefaultValue().getId(), kidsInclusion));//isSingleRoot));
result.append("]");
}
//}//Ende Lazy Loading
if (param.equals("xxxxxx-xxxxxx@")) result.append("}");
}
/**

10
src/de/superx/common/SelectableItemNode.java

@ -413,9 +413,12 @@ public class SelectableItemNode extends HideableNode @@ -413,9 +413,12 @@ public class SelectableItemNode extends HideableNode
return result;
}
public StringBuffer toJSON(Object defaultId, boolean isIncludingKids) {
public StringBuffer toJSON(Object defaultId, String kidsInclusion //boolean isIncludingKids, boolean isIncludingAllKids
) {
SelectableItem item = (SelectableItem) this.getUserObject();
boolean isIncludingKids=false;
if(kidsInclusion.equals("onlyDirectKids") || kidsInclusion.equals("AllKids"))
isIncludingKids=true;
StringBuffer result = new StringBuffer("{objectId:\"" + StringUtils.jsonAdapt(item.getId().toString(), true) + "\",title:\"" + StringUtils.jsonAdapt(getName(), true)
+ "\"");
if (EqualsUtil.areEqual(getKey(), defaultId)) result.append(",isSelected:true");
@ -434,7 +437,8 @@ public class SelectableItemNode extends HideableNode @@ -434,7 +437,8 @@ public class SelectableItemNode extends HideableNode
result.append(",");
else
isFirst = false;
result.append(kid.toJSON(defaultId, false));
result.append(kid.toJSON(defaultId, kidsInclusion));
}
result.append("]");
}

16
src/de/superx/servlet/SuperXmlMaske.java

@ -194,7 +194,7 @@ public class SuperXmlMaske extends AbstractSuperXServlet { @@ -194,7 +194,7 @@ public class SuperXmlMaske extends AbstractSuperXServlet {
InvalidKeyException, SichtException, IOException, ServletException, NoMainEntryException, InvalidDataTypeException {
if (user == null) throw new IllegalStateException("Kein user in der Session gefunden - bitte Browser neu starten!");
userid = request.getSession().getAttribute(SessionAttribute.UserID.toString()).toString();
boolean completeTree=false;
String tidString = getTid(request);
StringBuffer json = new StringBuffer("");
MaskenContainer mc = MaskenContainer.getFromRequest(request);
@ -204,8 +204,18 @@ public class SuperXmlMaske extends AbstractSuperXServlet { @@ -204,8 +204,18 @@ public class SuperXmlMaske extends AbstractSuperXServlet {
try {
for (Enumeration<String> en = request.getParameterNames(); en.hasMoreElements();) {
String aName = en.nextElement();
String fieldName="";
if (aName.startsWith("getJSON_")) {
Field f = maske.getField(aName.substring(8));
fieldName=aName.substring(8);
if (aName.startsWith("getJSON_COMPLETE"))
{
completeTree=true;
fieldName=aName.substring(16);
}
Field f = maske.getField(fieldName);
String param = getParameterString(request, aName);
if (((f.getArt() != Art.id_12_Sicht && !f.isOldOrganigrammArt())) && f.isDynamic() && param != null && param.equals("xxxxxx-xxxxxx@")) {
@ -225,7 +235,7 @@ public class SuperXmlMaske extends AbstractSuperXServlet { @@ -225,7 +235,7 @@ public class SuperXmlMaske extends AbstractSuperXServlet {
}
// verarbeitet auch search:
json.append(f.getJSON(param));
json.append(f.getJSON(param,completeTree));
}

2
superx/WEB-INF/conf/version.properties

@ -1,2 +1,2 @@ @@ -1,2 +1,2 @@
git.branch=HEAD
git.commit.hash=aefd4a5c2cf50e0ff91a3b4cecf1b3df09cc4b5d
git.commit.hash=1acb4db1ce6fcd8a161e2f73afb8c70c4242fe40

BIN
superx/WEB-INF/lib/superx6.0.jar

Binary file not shown.

154
superx/edit/kern/maske_sicht_laden.jsp

@ -35,7 +35,12 @@ if(referrerForm==null || referrerForm.equals("")) @@ -35,7 +35,12 @@ if(referrerForm==null || referrerForm.equals(""))
String params = request.getParameter("params");
String callurl="../../servlet/SuperXmlMaske?tid="+tid+"&getJSON_"+fname+"=xxxxxx-xxxxxx@";
String callurl="../../servlet/SuperXmlMaske?tid="+tid;
if(previousValue==null || previousValue.equals(""))
callurl+="&getJSON_"+fname+"=xxxxxx-xxxxxx@";
else
callurl+="&getJSON_COMPLETE"+fname+"=xxxxxx-xxxxxx@";
callurl+=params;
%>
@ -81,16 +86,6 @@ var previousValuesArray=ndMaskDialogPreviousValueToArray(previousValue); @@ -81,16 +86,6 @@ var previousValuesArray=ndMaskDialogPreviousValueToArray(previousValue);
var previousValuesCount=0;
if(previousValuesArray)
previousValuesCount=previousValuesArray.length;
var indeterminateValues="";
if(referrerForm.elements[fname+"-IndeterminateValues"])
{
indeterminateValues=referrerForm.elements[fname+"-IndeterminateValues"].value;
}
var indeterminateValuesArray=ndMaskDialogPreviousValueToArray(indeterminateValues);
var indeterminateValuesCount=0;
if(indeterminateValuesArray)
indeterminateValuesCount=indeterminateValuesArray.length;
//previousValuesCount=0; //TODO: wenn previousValue, dann klappt Aufklappen nicht immer
var treeNodes=new Array();
@ -110,7 +105,7 @@ var xhttp = new XMLHttpRequest(); @@ -110,7 +105,7 @@ var xhttp = new XMLHttpRequest();
xhttp.open("GET", url, true);
xhttp.send();
}
//202604 Label aktualisiert: Sicht in Sicht ändern
function renderSichtauswahl(content)
{
var targetDiv=document.getElementById("sichtauswahlDiv");
@ -118,7 +113,7 @@ var zs=""; @@ -118,7 +113,7 @@ 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 ändern</label>";
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);
@ -140,12 +135,12 @@ else @@ -140,12 +135,12 @@ else
zs+="Keine Sichtauswahl m&ouml;glich";
}
//Suche: 202605 is-small entfernt aus class=input und class=button, style für button ergänzt
//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-active' type='text' placeholder='' onBlur='ndSichtEintraegeSuchen(this.value);return false;'/>";
zs+="</div><div class='control'><button class='button is-rounded' onClick='ndSichtEintraegeSuchen(document.getElementById(\'sichtSuche\'));return false;'>";
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>";
@ -207,7 +202,8 @@ for(var j=0;j < content.nodes.length;j++) @@ -207,7 +202,8 @@ for(var j=0;j < content.nodes.length;j++)
{
var node=content.nodes[j];
zs +=renderNode(node,null,//parent
true,searchstring,previousValuesCount,previousValuesArray,zeilenanzahl);
true,searchstring,previousValuesCount,previousValuesArray,zeilenanzahl,0 //ebene
);
}
}
@ -216,14 +212,15 @@ targetDiv.innerHTML=zs; @@ -216,14 +212,15 @@ targetDiv.innerHTML=zs;
checkIndeterminates();
}
function renderNode(node,parentId,isRoot,searchstring,previousValuesCount,previousValuesArray,zeilenanzahl)
function renderNode(node,parentId,isRoot,searchstring,previousValuesCount,previousValuesArray,zeilenanzahl,ebene)
{
ebene++;
var zs="";
if(searchstring=="" || node.title.indexOf(searchstring)>-1)
{
if(node.objectId !="")
{
console.log("RenderNode"+node.objectId);
var checkedString="";
for(var i=0;i < previousValuesCount;i++)
{
@ -231,6 +228,7 @@ if(searchstring=="" || node.title.indexOf(searchstring)>-1) @@ -231,6 +228,7 @@ if(searchstring=="" || node.title.indexOf(searchstring)>-1)
checkedString="checked ";
}
var fldName="inp"+node.objectId;
var fldId="inp"+node.objectId;
var fldType="checkbox";
@ -246,7 +244,7 @@ if(searchstring=="" || node.title.indexOf(searchstring)>-1) @@ -246,7 +244,7 @@ if(searchstring=="" || node.title.indexOf(searchstring)>-1)
else
{
zs += "<li class='sichtentreeLI'>";
zs += "<li class='sichtentreeLI' id='liElem"+node.objectId+"'>";
if(isRoot)
{
zs+="<span style='margin-left:1.5rem'></span>";
@ -255,10 +253,12 @@ if(searchstring=="" || node.title.indexOf(searchstring)>-1) @@ -255,10 +253,12 @@ if(searchstring=="" || node.title.indexOf(searchstring)>-1)
{
if(node.isFolder=="true")
{
zs+="<span class='sichtentreeCaret' id='sichtentreeCaret_"+node.objectId+"'";
zs+="onClick=\"getChildNodes('"+node.objectId.trim()+"',this)\">";
zs+="</span>&nbsp;";
//if(previousValuesCount==0 && !isRoot)
// hideChildNodes(node.objectId.trim(),"sichtentreeCaret_"+node.objectId);
}
else
zs+="<span style='margin-left:15px'></span>";
@ -277,9 +277,12 @@ if(searchstring=="" || node.title.indexOf(searchstring)>-1) @@ -277,9 +277,12 @@ if(searchstring=="" || node.title.indexOf(searchstring)>-1)
{
for(var i=0;i < node.children.length;i++)
{
zs+="<ul style='margin-left:10px'>";
zs+="<ul style='margin-left:10px' id='childOf"+node.objectId+i+"' ";
if(ebene>1)
zs+="class='sichtentreeChildUL sichtentreeNested'";
zs+=">";
zs += renderNode(node.children[i],node.objectId,//parent
false,searchstring,previousValuesCount,previousValuesArray,zeilenanzahl);
false,searchstring,previousValuesCount,previousValuesArray,zeilenanzahl,ebene);
zs +="</ul>";
}
@ -340,17 +343,33 @@ if(node.apnr==targetNodeId) @@ -340,17 +343,33 @@ if(node.apnr==targetNodeId)
}
return parent;
}
/*function hideChildNodes(nodeId,spanElem)
{
var childUlId="childOf"+nodeId;
document.getElementById(childUlId).classList.toggle("sichtentreeNested");
}*/
function getChildNodes(nodeId,spanElem)
{
//spanElem.parentElement.querySelector(".sichtentreeNested").classList.toggle("sichtentreeActive");
var childUlId="childOf"+nodeId;
var childUlIdPrefix="childOf"+nodeId;
spanElem.classList.toggle("sichtentreeCaret-down");
var ulChildren = document.getElementById("liElem"+nodeId).getElementsByTagName('ul');
if(ulChildren.length>0)
{
for(var i=0;i<ulChildren.length;i++)
{
var childElem=ulChildren[i];
var childUlId=childUlIdPrefix+i;
if(document.getElementById(childUlId))
{
//Kind existiert bereits, wird nur unsichtbar:
document.getElementById(childUlId).classList.toggle("sichtentreeNested");
}
} //ende Schleife childUlIds
}
else
{
//Kind existiert noch nicht:
@ -375,7 +394,7 @@ var xhttp = new XMLHttpRequest(); @@ -375,7 +394,7 @@ var xhttp = new XMLHttpRequest();
{
var node=childrenJSON[j];
childrenHTML +=renderNode(node,nodeId,//parent
false,"",previousValuesCount,previousValuesArray,zeilenanzahl);
false,"",previousValuesCount,previousValuesArray,zeilenanzahl,0);
}
}
childUL.innerHTML=childrenHTML;
@ -391,17 +410,34 @@ var xhttp = new XMLHttpRequest(); @@ -391,17 +410,34 @@ var xhttp = new XMLHttpRequest();
function checkIndeterminates()
{
if(indeterminateValuesCount>0)
if(previousValuesCount>0)
{
for(var i=0;i < indeterminateValuesCount;i++)
{
for(var j=0;j < document.forms["selection"].elements.length;j++)
{
if(indeterminateValuesArray[i]==document.forms["selection"].elements[j].value)
var inpElem=document.forms["selection"].elements[j];
var inputType = inpElem.type;
var inputName = inpElem.name;
if((inputType=="checkbox" || inputType=="radio")
//&& (!inpElem.name=="metaCheckbox" //&&
//(!inpElem.indeterminate || inpElem.indeterminate==false)
)
{
//check if children are selected:
var parentElem=inpElem.parentElement;
var inpChildren = parentElem.getElementsByTagName('input');
if(inpChildren && inpChildren.length>0)
{
for(var i=0;i<inpChildren.length;i++)
{
var childInpElem=inpChildren[i];
if(inputName!=childInpElem.name && childInpElem.checked)
{
document.forms["selection"].elements[j].indeterminate=true;
}
}
}
}
}
}
@ -423,7 +459,7 @@ function ndSichtEintraegeSuchen(was) { @@ -423,7 +459,7 @@ function ndSichtEintraegeSuchen(was) {
{
var node=searchResultJSON[j];
searchResultHTML += renderNode(node,null,//parent
true,"",previousValuesCount,previousValuesArray,zeilenanzahl);
true,"",previousValuesCount,previousValuesArray,zeilenanzahl,0);
}
}
document.getElementById("sichtDiv").innerHTML=searchResultHTML+"</ul>";
@ -435,6 +471,8 @@ function ndSichtEintraegeSuchen(was) { @@ -435,6 +471,8 @@ function ndSichtEintraegeSuchen(was) {
}
</script>
<style type="text/css">
input.regularCheckbox
@ -459,16 +497,16 @@ input.parentCheckbox::before @@ -459,16 +497,16 @@ input.parentCheckbox::before
<nav class="navbar-dialogue is-fixed-top" role="navigation" aria-label="navigation">
<div class="navbar-brand">
<div class="navbar-item">
<p class="title-dialogue is-4" ><%=fname %></p>
<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>
<a onclick="ndMaskSichtDialogUebernehmen(document.forms['selection'],referrerForm)" style="color: white;">Übernehmen</a>
</button>
</p>
</div>
@ -478,57 +516,55 @@ input.parentCheckbox::before @@ -478,57 +516,55 @@ input.parentCheckbox::before
<div class="buttons">
<p class="reset_button">
<button class="button">
<a onclick="ndMaskDialogLeeren(document.forms['selection'],referrerForm)">Leeren</a>
<a onclick="ndMaskDialogLeeren(document.forms['selection'],referrerForm)" style="color: white;">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 class="button is-grey" onclick="window.close()">
X
</span>
</div>
</span>
</div>
</nav>
</div>
</nav>
<!--<div class="container"> doppelte scrollbalken verhindern-->
<form name="selection" onsubmit="return false;" style="margin:0px">
<form name="selection" onsubmit="return false;" style="margin:10px">
<div class="input-container sticky-filter"> <!--202606 sticky-filter ergänzt-->
<div class="input-container">
<div class="field is-grouped is-grouped-multiline">
<div class="input-container">
<div id="sichtauswahlDiv">
</div>
</div>
</div>
</div>
</div>
<% if(zeilenanzahl!=null && !zeilenanzahl.equals("1"))
{
%>
<div class="input-container"><!--202606 neu-->
<div class="buttons">
<input type="checkbox" name="metaCheckox" value="" style="margin-left:1.5rem;" onclick="ndMaskDialogToggleAllCheckboxes(document.forms['selection'],this)" />&#160; alle markieren
<input type="checkbox" name="metaCheckox" value="" style="margin-left:20px;" onclick="ndMaskDialogToggleAllCheckboxes(document.forms['selection'],this)" />&#160; alle markieren
</div>
</div><!--202606 neu-->
<hr />
<%
}
%>
<div id="sichtDiv" class="comboDiv">keine Auswahl m&ouml;glich
</div>
<div id="sichtDiv" class="comboDiv">keine Auswahl m&ouml;glich
</div>
</form>
<!--</div> container-->
</div> <!--Ende nd_navi-top-->
</div>
</body>
</html>

2
superx/xml/js/memtext/nd_functions.js

@ -45,7 +45,7 @@ function ndMaskeSichtLaden(fname,zeilenanzahl, caption) { @@ -45,7 +45,7 @@ function ndMaskeSichtLaden(fname,zeilenanzahl, caption) {
'hidden') continue;
//todo bei startsWith select_ label_ auch überspringen
if (e.value != '' && e.value.indexOf("(")==-1) //leere Felder müssen auch übergeben werden MB!!
if (e.value != '' && e.value.indexOf("(")==-1 && e.value.length < 100 && e.value.indexOf(",")==-1) //leere Felder müssen auch übergeben werden MB!!
// 1/2016 MB dies geht nicht weil ISO kodiert
//params+="&"+felder[i]["cb_name"]+"="+encodeURIComponent(e.value);
params += "&" + getEncoded(felder[i]["htmlname"]) + "=" + getEncoded(e.value);

4
superx/xml/nd_templates.xsl

@ -2229,11 +2229,11 @@ Seite 1 von 1 @@ -2229,11 +2229,11 @@ Seite 1 von 1
</xsl:attribute>
</input>
<input type="hidden">
<!--<input type="hidden">
<xsl:attribute name="name">
<xsl:value-of select="concat(name,'-IndeterminateValues')"/>
</xsl:attribute>
</input>
</input>-->
<!--<xsl:if test="string-length(sichten/sicht [ @selected='true' ]/@stand) &gt; 1 ">-->
<div id="{concat(name,'-Stand','-div')}" style="display:none">
Stand:&#160;<input type="text" size="10" class="sichtText">

Loading…
Cancel
Save