#
#			ITSV GmbH
#	CCDB - Command and Control Database
#
#	FILE:			dquerymfile_notepads.txt
#	DESCRIPTION:	DQUERY definition for DQUERY notepads
#					this query lists all CCDB-notepads
#
@querytitle				Liste von vorhandenen CCDB-notepads
@querydescription		Diese Abfrage listet alle in der CCDB-Datenbank vorhandenen notepads
@group					NOTEPADS
@querytype				dbselect
@sql					select ident,version,data from CCTEXTFRAG where type='CCDBNOTEPAD'
@title					Alle CCDB-Notepads
@post_query
	let qdata;
	for (let ri=0; ri<that.result.getRowCount(); ri++) {
		qdata = aux.txtObjDecode(that.result.getCellValue(ri,2));
		if (qdata.error) {
			that.result.setCellValue(ri,2,"Fehler: "+qdata.error);
		} else {
			if (qdata.description) {
				that.result.setCellValue(ri,2,qdata.description);
			} else if (qdata.content) {
				let c = "";
				let si = 0;
				while (!c) {
					if (si>=qdata.content.length) {
						if (qdata.content.length>0) {
							if (qdata.notepdaname) {
								c = "Name: "+qdata.notepadname+", Inhalt: "+qdata.content[0].type+" ...";
							} else {
								c = "Inhalt: "+qdata.content[0].type+" ...";
							}
						} else if (qdata.notepadname) {
							c = "Name: "+qdata.notepadname;
						} else {
							c = "<keine Informationen>";
						}
					} else {
						if (qdata.content[si].type="text") {
							c = "Inhalt: "+qdata.content[si].data + "...";
						}
					}
					si++;
				}
				that.result.setCellValue(ri,2,c);
			} else if (qdata.notepadname) {
				that.result.setCellValue(ri,2,"Name: "+qdata.notepadname);
			} else {
				that.result.setCellValue(ri,2,"Inhalt: " + that.result.getCellValue(ri,2).substr(0,30)+"...");
			}
		}
	}
@decoration		{
	decorate_colcell:	{
		ident:	{	hyperlink:	{	href:	"/dquery?dataname=NOTEPAD&p1=@@row.ident@@",
									title:	"CCDB-Notepad \"@@row.ident@@\" öffnen"	}	}
	}
	}

