#
#	ITSV GmbH
#	CCDB - Command and Control Database
#
#	FILE:				dquerymfile_allMAFILESinfo.txt
#	DESCRIPTION:		DQUERY definition for allMAFILESinfo
#
#
@querytitle				zeige alle MVBRFAUSW managed files an
@querydescription		zeigt alle Einträge der Tabelle CCMFILES mit der MFILETYPE 'dmvbrfausw' mit Ihren Attributen an
@group					SVCLMVBRFAUSWDATALOAD
@querytype				dbselect
@sql					select mf.MFILEID, mf.MFILENAME, mf.MFILEATTRIBS, maf.TRAEGER as MAFILES_TRAEGER, maf.FTIMESTAMP as MAFILES_FTIMESTAMP, '' as LADEN, '' as ENTLADEN
						  from CCMFILES mf
							left join SVCLMAFILES maf on maf.MFILEID=mf.MFILEID
						 where MFILETYPE='dmvbrfausw'
@post_query
	let lcn = that.result.findColumn("LADEN");
	let ucn = that.result.findColumn("ENTLADEN");
	for (let ri=0; ri<that.result.getRowCount(); ri++) {
		let crow = that.result.getRowObject(ri);
		let mfa = JSON.parse(crow.MFILEATTRIBS);
		if (mfa.loadstate!="loaded" && !crow.MAFILES_FTIMESTAMP && (lcn>=0)) {
			that.result.setCellValue(ri,lcn,"laden");
		}
		if (mfa.loadstate=="loaded" && crow.MAFILES_FTIMESTAMP && (ucn>=0)) {
			that.result.setCellValue(ri,ucn,"entladen");
		}
	}
@tableclass	excelFilterTable
#
@decoration.decorate_colcell.MFILEID.hyperlink.href		/dquery?dataname=SHOWFILE&mfileid=@@row.MFILEID@@
@decoration.decorate_colcell.MFILEID.hyperlink.title	Informationen über managed file @@row.MFILEID@@ anzeigen
#
@decoration.decorate_colcell.LADEN.hyperlink.href		/dquery?dataname=loadMVBRFAUSW&mfileid=@@row.MFILEID@@
@decoration.decorate_colcell.LADEN.hyperlink.title		Daten aus managed file @@row.MFILEID@@ laden
#
@decoration.decorate_colcell.ENTLADEN.hyperlink.href	/dquery?dataname=unloadMVBRFAUSW&mfileid=@@row.MFILEID@@
@decoration.decorate_colcell.ENTLADEN.hyperlink.title	Daten für managed file @@row.MFILEID@@ aus CCMVBRFAUSW entladen