#
# DQUERY configuration for DQUERY alltextFragInfo
#
#	issue 201909191810
#
@querytitle 		alle Text-Fragemente
@description 		zeigt alle Textfragmente an, jedes Feld kann bearbeitet werden
@group 				ADMINTEXTFRAG
@attributenames		whereclause:string:{{whereclauseoptions}}
@whereclauseoptions	{"labeltext":"Auswahl","typedesc":"SQL WHERE-clause zur Auswahl von Textfragmenten, als Felder stehen zur Verfügung: type,ident,version,parent,child_index,frag_index,data","maxlen":"132","is_optional":"true"}
@querytype			dbselect
@sql				select type,ident,version,parent,child_index,frag_index,data,'' as "Bearbeiten",'' as "Information" 
					  from CCTEXTFRAG {{whereclause}}
					 order by parent,ident,child_index,frag_index asc
@post_query	
	let ri, ci, crow;
	let ecn = that.result.findColumn("Bearbeiten");
	let icn = that.result.findColumn("Information");
	for (ri=0; ri<that.result.getRowCount(); ri++) {
		for (ci=0; ci<that.result.rows[ri].length; ci++) {
			let cot = typeof(that.result.rows[ri][ci]);
			/* present all data as string, CRLF escaped to &#13:&#10; to prevent accidential indentation and similar in textareas */
			that.result.rows[ri][ci] = String(that.result.rows[ri][ci]).replace(/\r/g,"&#13;").replace(/\n/g,"&#10;");
		}
		if (ecn && icn) {
			crow = that.result.getRowObject(ri);
			that.result.rows[ri][ecn] = { rawhtml:
											"<ul>"+
											"  <li><a href=\"/dquery?dataname=performObjectAction&objtype=textfrag&key="+crow.ident+"%%%"+crow.child_index+"%%%"+crow.frag_index+"&action=copy\">kopieren</a></li>"+
											"</ul>"
										};
		}
	}
	if (that.query.whereclause) {
		that.query.toptext += "<h3>Informationen</h3><br/>Auswahl: \""+that.query.whereclause+"\", "+that.result.getRowCount()+" Einträge ausgewählt";
	} else {
		that.query.toptext += "<h3>Informationen</h3><br/>Alle Textfragmente in der Datenbank, "+that.result.getRowCount()+" Einträge";
	}
@toptext 
	<h3>Weitere Aktionen</h3>
	<ul>
	  <li><a href="/dquery?dataname=newTextFragment">neues Textfragment hinzuf&uuml;gen</a></li>
	  <li><a href="/dquery?dataname=selTextfragInfo">ausgew&auml;hlte Textfragmente anzeigen</a></li>
	</ul>
@decoration.debug	true
@decoration.decorate_colcell.0	$CONTROL:werteingabe:c0options
@c0options.control_type	edit
@c0options.value	@@celldata@@
@c0options.url	/dquery?dataname=performObjectAction&objtype=textfrag&key=@@row.ident@@%%%@@row.child_index@@%%%@@row.frag_index@@&attribute=type&action=SET
@c0options.submitlabel	Type ändern
@c0options.textinput_fieldname	value
@decoration.decorate_colcell.1	$CONTROL:werteingabe:c1options
@c1options.control_type	edit
@c1options.value	@@celldata@@
@c1options.url	/dquery?dataname=performObjectAction&objtype=textfrag&key=@@row.ident@@%%%@@row.child_index@@%%%@@row.frag_index@@&attribute=ident&action=SET
@c1options.submitlabel	ID ändern
@c1options.textinput_fieldname	value
@c1options.textinput_textarea	true
@decoration.decorate_colcell.2	$CONTROL:werteingabe:c2options
@c2options.control_type	edit
@c2options.value	@@celldata@@
@c2options.url	/dquery?dataname=performObjectAction&objtype=textfrag&key=@@row.ident@@%%%@@row.child_index@@%%%@@row.frag_index@@&attribute=version&action=SET
@c2options.submitlabel	Version ändern
@c2options.textinput_fieldname	value
@c1options.textinput_textarea	true
@decoration.decorate_colcell.3	$CONTROL:werteingabe:c3options
@c3options.control_type	edit
@c3options.value	@@celldata@@
@c3options.url	/dquery?dataname=performObjectAction&objtype=textfrag&key=@@row.ident@@%%%@@row.child_index@@%%%@@row.frag_index@@&attribute=parent&action=SET
@c3options.submitlabel	Parent ändern
@c3options.textinput_fieldname	value
@c1options.textinput_textarea	true
@decoration.decorate_colcell.4	$CONTROL:werteingabe:c4options
@c4options.control_type	edit
@c4options.value	@@celldata@@
@c4options.url	/dquery?dataname=performObjectAction&objtype=textfrag&key=@@row.ident@@%%%@@row.child_index@@%%%@@row.frag_index@@&attribute=child_index&action=SET
@c4options.submitlabel	child_index ändern
@c4options.textinput_fieldname	value
@c4options.textinput_textarea	true
@decoration.decorate_colcell.5	$CONTROL:werteingabe:c5options
@c5options.control_type	edit
@c5options.value	@@celldata@@
@c5options.url	/dquery?dataname=performObjectAction&objtype=textfrag&key=@@row.ident@@%%%@@row.child_index@@%%%@@row.frag_index@@&attribute=frag_index&action=SET
@c5options.submitlabel	frag_index ändern
@c5options.textinput_fieldname	value
@c5options.textinput_textarea	true
@decoration.decorate_colcell.6	$CONTROL:werteingabe:c6options
@c6options.control_type	edit
@c6options.value	@@celldata@@
@c6options.url	/dquery?dataname=performObjectAction&objtype=textfrag&key=@@row.ident@@%%%@@row.child_index@@%%%@@row.frag_index@@&attribute=data&action=SET
@c6options.submitlabel	Daten ändern
@c6options.textinput_fieldname	value
@c6options.textinput_textarea	true
@title		Text-Fragmente

