# # ITSV GmbH # CCDB - Command and Control Database # # FILE: dquermfile_mfiles.txt # DESCRIPTION: DQUERY definition for CCDB DQUERY "mfiles" # @querytitle Managed files anzeigen @querydescription @group DATAFILE # @attributenames searchstring:string:{{searchstringoptions}},lpath:mfilelpath:{{lpathoptions}},mfiletype:mfiletype:{{mfiletypeoptions}},mfileattribs:string:{{mfileattribsoptions}},addwhereclause:string:{{addwhereclauseoptions}} @attributenames lpath:mfilelpath:{{lpathoptions}},mfiletype:mfiletype:{{mfiletypeoptions}},mfileattribs:string:{{mfileattribsoptions}},addwhereclause:string:{{addwhereclauseoptions}} @searchstringoptions.labeltext Suchbegriff @searchstringoptions.typedesc Ein Teil des Namens, der ID oder der Attribut-Definitionen, nach dem Managed files ausgesucht werden sollen @searchstringoptions.check_qexpression /* this is dummy code, it does not (yet) work */ if (qryatt.is_optional) return true; @lpathoptions {"labeltext":"logischer Pfad","typedesc":"Logischer Verzeichnispfad, aus dem managed files angezeigt werden sollen","is_optional":"true"} @mfiletypeoptions {"labeltext":"Managed File Type","typedesc":"Type der Managed Files, die angezeigt werden sollen","is_optional":"true"} @mfileattribsoptions {"labeltext":"Attribute","typedesc":"Wert des MFILEATTRIBS-Felds für die auszuwählenden managed-File Einträge","is_optional":"true"} @addwhereclauseoptions {"labeltext":"Auswahlbedingungen","typedesc":"SQL-where Ausdruck zur Einschränkung der Auswahl","is_optional":"true"} @querytype dbselect @toptext @pre_query that.fp = function(s, pos, c) { if (!pos) pos = 0; if (!c) c = '('; let npos = s.indexOf(c,pos); return npos; } that.fcp = function(s,pos) { if (!pos) pos = 0; let sta = (pos>=s.length)?'END':'SCAN'; pos = 0; let c = (pos>=s.length)?'':s.charAt(pos); let pc = 0; while (sta!='END') { c = (pos>=s.length)?'':s.charAt(pos); switch (sta) { case 'SCAN': pos = that.fp(s,pos,'('); if (pos<0) { pos = -1; sta = 'END'; } else { pos++; pc = 1; sta = 'PARS'; } break; case 'PARS': switch (c) { case '(': pc++; pos ++; break; case '"': sta = 'QUOT'; pos++; break; case ')': pc--; if (pc<1) { sta = 'END'; } else { pos++; } break; default: pos++; } break; case 'QUOT': switch (c) { case '"': sta = 'PARS' pos++; break; default: pos++; } break; default: sta = 'END'; pos = -1; } } return pos; } that.normalizeWhereClause = function(wc) { let op = "("; let cp = ")"; if (wc.substring(0,5).toUpperCase()=="WHERE") wc = wc.substring(5); wc = wc.trim(); if (wc.startsWith(op) && wc.endsWith(cp)) { let cpp = that.fcp(wc); if (cpp==(wc.length-1)) { return "WHERE "+wc; } else { return "WHERE ("+wc+")"; } } else { return "WHERE ("+wc+")"; } } that.query.whereclause = ""; that.query.wcactive = false; if (that.query.lpath) { that.query.lpath = that.query.lpath.trim(); if (that.query.lpath.substring(0,5).toUpperCase()=='WHERE') that.query.lpath = that.query.lpath.substring(5); if (!that.query.wcactive) that.query.whereclause = "WHERE "; that.query.whereclause += "(MFILELPATH='"+that.query.lpath+"')"; that.query.wcactive = true; that.query.title += " auf logischem Pfad \""+that.query.lpath+"\""; } if (that.query.mfiletype) { that.query.mfiletype = that.query.mfiletype.trim(); if (that.query.mfiletype.substring(0,5).toUpperCase()=='WHERE') that.query.mfiletype = that.query.mfiletype.substring(5); if (that.query.wcactive) { that.query.whereclause += " and "; } else { that.query.whereclause = "WHERE "; } that.query.whereclause += "(MFILETYPE='"+that.query.mfiletype+"')"; that.query.wcactive = true; that.query.title += " der Type "+that.query.mfiletype; } if (that.query.mfileattribs) { logger.debug("MFILES.UDBG.filter.mfileattribs="+that.query.mfileattribs); that.query.mfileattribs = that.query.mfileattribs.trim(); if (that.query.mfileattribs.substring(0,5).toUpperCase()=='WHERE') that.query.mfileattribs = that.query.mfileattribs.substring(5); if (that.query.wcactive) { that.query.whereclause += " and "; } else { that.query.whereclause = "WHERE "; } that.query.whereclause += "(MFILEATTRIBS='"+that.query.mfileattribs+"')"; that.query.wcactive = true; that.query.title += " mit Attributen \""+that.query.mfileattribs+"\""; } if (that.query.addwhereclause) { that.query.addwhereclause = that.query.addwhereclause.trim(); if (that.query.addwhereclause.substring(0,5).toUpperCase()=='WHERE') that.query.addwhereclause = that.query.addwhereclause.substring(5); if (that.query.wcactive) { that.query.whereclause += " and "; } else { that.query.whereclause = "WHERE "; } that.query.whereclause += "(" + that.query.addwhereclause + ")"; that.query.wcactive = true; that.query.title += " mit Bedingung\"( "+that.query.addwhereclause+")\"" } if (that.query.wcactive) { that.query.whereclause = that.normalizeWhereClause(that.query.whereclause); } @sql_mysql select mfileid as "Managed File ID", mfiletype as "Managed File Type", mfilename as "Ursprünglicher Dateiname", mfilepath as "Speicherpfad", mfilelpath as "Logischer Pfad", mfileattribs as "Attribute (JSON-Format)", mfileid as "Auswahl" from CCMFILES {{whereclause}} order by "Managed File ID" asc @options.notranslate true @post_query proc: { let escaped_whereclause = that.query.whereclause.replace(/\"/g,'"'); that.result.toptext = that.query.toptext + "\r\n"+ "

Weitere Aktionen

\r\n"+ "\r\n"; } # @title Managed Files @tableclass excelFilterTable @decoration.debug false @decoration.decorate_colcell.0.hyperlink.href /dquery?dataname=showfile&mfileid=@@celldata@@ @decoration.decorate_colcell.0.hyperlink.title Managed File Eigenschaften anzeigen @decoration.decorate_colcell.0.value @@celldata@@ @decoration.decorate_colcell.1.hyperlink.href /dquery?dataname=mfiles&mfiletype=@@celldata@@ @decoration.decorate_colcell.1.hyperlink.title Alle managed Files mit type @@celldata@@ anzeigen @decoration.decorate_colcell.4.hyperlink.href /dquery?dataname=mfiles&lpath=@@celldata@@ @decoration.decorate_colcell.4.hyperlink.title Alle managed files unter logischem Pfad @@celldata@@ anzeigen @decoration.decorate_colcell.6 $SELECTBOX