#
#		ITSV GmbH
#	CCDB - Command and Control Database
#
#	FILE:		dquermfile_queryinfo.txt
#	DESCRIPTION:	DQUERY definition for CCDB DQUERY "queryinfo"
#
@querytitle				Informationen zu einer Abfrage
@querydescription
@group							QUERIES
@paramnames						queryname:queryname
@formpagetitle					Informationen zu einer Abfrage
@formitems.paramformextension	<ul><li><a href="/dquery?dataname=addquery">Neue Abfrage hinzufügen</a></li></ul>
@querytype						dbselect
@sql	select qr.RWNAME as "ID",
			qr.RWVALUE as "AbfrageName",
			qr.RWDESC as "Beschreibung",
			qa.RWNAME as "Eigenschaft",
			(CASE WHEN qa.RWVALUE is null THEN '' ELSE qa.RWVALUE END) as "Wert",
			CONCAT(	'{"action": "',(CASE WHEN qa.RWVALUE is null THEN '' ELSE 'DELETE' END),
					'", "attribute": "',qa.RWNAME,'", "key": "',qr.RWNAME,'"}')  as "DeleteAction"
		  from CCRW qr
		    left outer join CCRW qa on qa.RWTYP='DQUERYPARAM' and qa.RWPARENT=qr.RWNAME
		 where qr.RWTYP='DQUERY' and qr.RWPARENT='QUERIES' and qr.RWNAME=::queryname::
@title
		Abfrage-Informationen über {{queryname}}
@post_query
		if (that.result.getRowCount()<1) {
			that.result.setResultAttribute('queryid','Fehler:');
			that.result.setResultAttribute('querytitle',
											'keine Informationen zu Abfrage "'+that.result.getResultAttribute('queryname')+'"');
		} else {
			that.result.setResultAttribute("title","Abfrage-Informationen zu "+that.result.getCellValue(0,0)+" - "+that.result.getCellValue(0,1));
			that.desc = that.result.getCellValue(0,2);
			if (that.desc) {
				that.result.setResultAttribute("toptext","Beschreibung:<br/>"+that.desc);
			}
			that.result.setResultAttribute('queryid',that.result.getCellValue(0,0));
			that.result.setResultAttribute('querytitle',that.result.getCellValue(0,1));
			for (let i=0; i<that.result.getRowCount(); i++) {
				that.result.setCellValue(i,4,aux.escapeCharEntities(that.result.getCellValue(i,4)));
			}
		}
@bottomtext
		<h3>Weitere Informationen</h3>
		<ul>
		<li><a href="/dquery?dataname=delquery&queryname=">
		Abfrage  löschen</a></li>
		<li><a href="/dquery?dataname=performObjectAction&objtype=query&key=&action=addAttribute">neues Attribut zu Abfrage  hinzufügen</a></li>
		</ul>
@decoration.decorate_colcell.3					$CONTROL:werteingabe:c3options
@c3options.control_type							edit
@c3options.value								@@celldata@@
@c3options.url									/dquery?dataname=performObjectAction&objtype=query&key=@@row.ID@@&attribute=@@row.Eigenschaft@@&action=RENAME
@c3options.submitlabel							Umbenennen
@c3options.textinput_fieldname					name
@decoration.decorate_colcell.4					$CONTROL:werteingabe:c4options
@c4options.control_type							edit
@c4options.value								@@celldata@@
@c4options.url									/dquery?dataname=performObjectAction&objtype=query&key=@@row.ID@@&attribute=@@row.Eigenschaft@@&action=SET
@c4options.submitlabel							Speichern
@c4options.textinput_fieldname					value
@c4options.textinput_textarea					true
@decoration.decorate_colcell.5.hyperlink.href	/dquery?dataname=performObjectAction&objtype=query&key=@@row.ID@@&attribute=@@row.Eigenschaft@@&action=DELETE
@decoration.decorate_colcell.5.hyperlink.title	Abfrage-Attribut @@row.Eigenschaft@@ für Abfrage ID=@@row.ID@@ löschen
@decoration.decorate_colcell.5.value			Löschen
