1717
1818use Illuminate \Support \Facades \Log ;
1919
20- function getFilterDefinitionXML ($ key , $ uitext , $ type , $ valuelist , $ defaultvalue ): string
21- {
22- $ xml = '<def> ' ;
23- $ xml .= add_XML_value ('key ' , $ key );
24- $ xml .= add_XML_value ('uitext ' , $ uitext );
25- $ xml .= add_XML_value ('type ' , $ type );
26- // type == bool, enum, number, string, date
27- // (enum not implemented yet...)
28- $ xml .= add_XML_value ('valuelist ' , $ valuelist );
29- $ xml .= add_XML_value ('defaultvalue ' , $ defaultvalue );
30- $ xml .= '</def> ' ;
31- return $ xml ;
32- }
33-
3420interface PageSpecificFilters
3521{
3622 public function getDefaultFilter ();
3723
3824 public function getDefaultShowLimit ();
3925
40- public function getFilterDefinitionsXML ();
41-
4226 public function getSqlField ($ field ): string ;
4327}
4428
@@ -56,8 +40,6 @@ public function getDefaultShowLimit(): bool
5640 return true ;
5741 }
5842
59- abstract public function getFilterDefinitionsXML (): string ;
60-
6143 abstract public function getSqlField ($ field ): string ;
6244}
6345
@@ -107,41 +89,6 @@ public function getDefaultFilter(): array
10789 ];
10890 }
10991
110- public function getFilterDefinitionsXML (): string
111- {
112- $ xml = '' ;
113-
114- $ xml .= getFilterDefinitionXML ('buildduration ' , 'Build Duration ' , 'number ' , '' , '0 ' );
115- $ xml .= getFilterDefinitionXML ('builderrors ' , 'Build Errors ' , 'number ' , '' , '0 ' );
116- $ xml .= getFilterDefinitionXML ('buildwarnings ' , 'Build Warnings ' , 'number ' , '' , '0 ' );
117- $ xml .= getFilterDefinitionXML ('buildname ' , 'Build Name ' , 'string ' , '' , '' );
118- $ xml .= getFilterDefinitionXML ('buildstamp ' , 'Build Stamp ' , 'string ' , '' , '' );
119- $ xml .= getFilterDefinitionXML ('buildstarttime ' , 'Build Start Time ' , 'date ' , '' , '' );
120- $ xml .= getFilterDefinitionXML ('buildtype ' , 'Build Type ' , 'string ' , '' , 'Nightly ' );
121- $ xml .= getFilterDefinitionXML ('configureduration ' , 'Configure Duration ' , 'number ' , '' , '0 ' );
122- $ xml .= getFilterDefinitionXML ('configureerrors ' , 'Configure Errors ' , 'number ' , '' , '0 ' );
123- $ xml .= getFilterDefinitionXML ('configurewarnings ' , 'Configure Warnings ' , 'number ' , '' , '0 ' );
124- $ xml .= getFilterDefinitionXML ('expected ' , 'Expected ' , 'bool ' , '' , '' );
125- $ xml .= getFilterDefinitionXML ('groupname ' , 'Group ' , 'string ' , '' , 'Nightly ' );
126- $ xml .= getFilterDefinitionXML ('hascoverage ' , 'Has Coverage ' , 'bool ' , '' , '' );
127- $ xml .= getFilterDefinitionXML ('hasctestnotes ' , 'Has CTest Notes ' , 'bool ' , '' , '' );
128- $ xml .= getFilterDefinitionXML ('hasdynamicanalysis ' , 'Has Dynamic Analysis ' , 'bool ' , '' , '' );
129- $ xml .= getFilterDefinitionXML ('hasusernotes ' , 'Has User Notes ' , 'bool ' , '' , '' );
130- $ xml .= getFilterDefinitionXML ('label ' , 'Label ' , 'string ' , '' , '' );
131- $ xml .= getFilterDefinitionXML ('revision ' , 'Revision ' , 'string ' , '' , '' );
132- $ xml .= getFilterDefinitionXML ('site ' , 'Site ' , 'string ' , '' , '' );
133- $ xml .= getFilterDefinitionXML ('buildgenerator ' , 'Submission Client ' , 'string ' , '' , '2.8 ' );
134- $ xml .= getFilterDefinitionXML ('subproject ' , 'SubProject ' , 'string ' , '' , '' );
135- $ xml .= getFilterDefinitionXML ('testsduration ' , 'Tests Duration ' , 'number ' , '' , '' , '0 ' );
136- $ xml .= getFilterDefinitionXML ('testsfailed ' , 'Tests Failed ' , 'number ' , '' , '0 ' );
137- $ xml .= getFilterDefinitionXML ('testsnotrun ' , 'Tests Not Run ' , 'number ' , '' , '0 ' );
138- $ xml .= getFilterDefinitionXML ('testspassed ' , 'Tests Passed ' , 'number ' , '' , '0 ' );
139- $ xml .= getFilterDefinitionXML ('testtimestatus ' , 'Tests Timing Failed ' , 'number ' , '' , '0 ' );
140- $ xml .= getFilterDefinitionXML ('updateduration ' , 'Update Duration ' , 'number ' , '' , '0 ' );
141- $ xml .= getFilterDefinitionXML ('updatedfiles ' , 'Updated Files ' , 'number ' , '' , '0 ' );
142- return $ xml ;
143- }
144-
14592 public function getSqlField ($ field ): string
14693 {
14794 // Some filters can return inaccurate results when we are also
@@ -358,24 +305,6 @@ public function getDefaultFilter(): array
358305 ];
359306 }
360307
361- public function getFilterDefinitionsXML (): string
362- {
363- $ xml = '' ;
364-
365- $ xml .= getFilterDefinitionXML ('buildname ' , 'Build Name ' , 'string ' , '' , '' );
366- $ xml .= getFilterDefinitionXML ('buildstarttime ' , 'Build Start Time ' , 'date ' , '' , '' );
367- $ xml .= getFilterDefinitionXML ('buildtype ' , 'Build Type ' , 'string ' , '' , 'Nightly ' );
368- $ xml .= getFilterDefinitionXML ('details ' , 'Details ' , 'string ' , '' , '' );
369- $ xml .= getFilterDefinitionXML ('groupname ' , 'Group ' , 'string ' , '' , 'Nightly ' );
370- $ xml .= getFilterDefinitionXML ('label ' , 'Label ' , 'string ' , '' , '' );
371- $ xml .= getFilterDefinitionXML ('revision ' , 'Revision ' , 'string ' , '' , '' );
372- $ xml .= getFilterDefinitionXML ('site ' , 'Site ' , 'string ' , '' , '' );
373- $ xml .= getFilterDefinitionXML ('status ' , 'Status ' , 'string ' , '' , '' );
374- $ xml .= getFilterDefinitionXML ('testname ' , 'Test Name ' , 'string ' , '' , '' );
375- $ xml .= getFilterDefinitionXML ('time ' , 'Time ' , 'number ' , '' , '' );
376- return $ xml ;
377- }
378-
379308 public function getSqlField ($ field ): string
380309 {
381310 $ sql_field = '' ;
@@ -460,20 +389,6 @@ public function getDefaultFilter(): array
460389 ];
461390 }
462391
463- public function getFilterDefinitionsXML (): string
464- {
465- $ xml = '' ;
466-
467- $ xml .= getFilterDefinitionXML ('details ' , 'Details ' , 'string ' , '' , '' );
468- $ xml .= getFilterDefinitionXML ('label ' , 'Label ' , 'string ' , '' , '' );
469- $ xml .= getFilterDefinitionXML ('status ' , 'Status ' , 'string ' , '' , '' );
470- $ xml .= getFilterDefinitionXML ('subproject ' , 'SubProject ' , 'string ' , '' , '' );
471- $ xml .= getFilterDefinitionXML ('testname ' , 'Test Name ' , 'string ' , '' , '' );
472- $ xml .= getFilterDefinitionXML ('timestatus ' , 'Time Status ' , 'string ' , '' , '' );
473- $ xml .= getFilterDefinitionXML ('time ' , 'Time ' , 'number ' , '' , '' );
474- return $ xml ;
475- }
476-
477392 public function getSqlField ($ field ): string
478393 {
479394 $ sql_field = '' ;
@@ -533,13 +448,6 @@ public function getDefaultFilter(): array
533448 ];
534449 }
535450
536- public function getFilterDefinitionsXML (): string
537- {
538- $ xml = '' ;
539- $ xml .= getFilterDefinitionXML ('subproject ' , 'SubProject ' , 'string ' , '' , '' );
540- return $ xml ;
541- }
542-
543451 public function getSqlField ($ field ): string
544452 {
545453 $ sql_field = '' ;
@@ -568,15 +476,6 @@ public function getDefaultFilter(): array
568476 ];
569477 }
570478
571- public function getFilterDefinitionsXML (): string
572- {
573- $ xml = '' ;
574- $ xml .= getFilterDefinitionXML ('buildname ' , 'Build Name ' , 'string ' , '' , '' );
575- $ xml .= getFilterDefinitionXML ('subproject ' , 'SubProject ' , 'string ' , '' , '' );
576- $ xml .= getFilterDefinitionXML ('testname ' , 'Test Name ' , 'string ' , '' , '' );
577- return $ xml ;
578- }
579-
580479 public function getSqlField ($ field ): string
581480 {
582481 $ sql_field = '' ;
@@ -637,62 +536,6 @@ function createPageSpecificFilters($page_id)
637536 }
638537}
639538
640- // Take a php $filterdata structure and return it as an XML string representation
641- //
642- function filterdata_XML ($ filterdata ): string
643- {
644- $ debug = $ filterdata ['debug ' ]; // '0' or '1' -- shows debug info in HTML output
645- $ filtercombine = $ filterdata ['filtercombine ' ]; // 'OR' or 'AND'
646- $ filters = $ filterdata ['filters ' ]; // an array
647- $ limit = $ filterdata ['limit ' ]; // an integer
648- $ pageId = $ filterdata ['pageId ' ]; // id of the "calling page"...
649- $ pageSpecificFilters = $ filterdata ['pageSpecificFilters ' ]; // an instance of PageSpecificFilters
650- $ showfilters = $ filterdata ['showfilters ' ]; // 0 or 1
651- $ showlimit = $ filterdata ['showlimit ' ]; // 0 or 1
652- $ colorblind = $ filterdata ['colorblind ' ]; // 0 or 1
653-
654- $ xml = '<filterdata> ' ;
655- $ xml .= add_XML_value ('debug ' , $ debug );
656- $ xml .= add_XML_value ('filtercombine ' , $ filtercombine );
657- $ xml .= add_XML_value ('limit ' , $ limit );
658- $ xml .= add_XML_value ('pageId ' , $ pageId );
659- $ xml .= add_XML_value ('script ' , $ _SERVER ['SCRIPT_NAME ' ]);
660- $ xml .= add_XML_value ('showfilters ' , $ showfilters );
661- $ xml .= add_XML_value ('showlimit ' , $ showlimit );
662- $ xml .= add_XML_value ('colorblind ' , $ colorblind );
663-
664- $ xml .= '<filterdefinitions> ' ;
665- $ xml .= $ pageSpecificFilters ->getFilterDefinitionsXML ();
666- $ xml .= '</filterdefinitions> ' ;
667-
668- $ xml .= '<filters> ' ;
669-
670- foreach ($ filters as $ filter ) {
671- if (array_key_exists ('filters ' , $ filter )) {
672- $ xml .= '<filter> ' ;
673- foreach ($ filter ['filters ' ] as $ subfilter ) {
674- $ xml .= '<subfilter> ' ;
675- $ xml .= add_XML_value ('field ' , $ subfilter ['field ' ]);
676- $ xml .= add_XML_value ('compare ' , $ subfilter ['compare ' ]);
677- $ xml .= add_XML_value ('value ' , $ subfilter ['value ' ]);
678- $ xml .= '</subfilter> ' ;
679- }
680- $ xml .= '</filter> ' ;
681- } else {
682- $ xml .= '<filter> ' ;
683- $ xml .= add_XML_value ('field ' , $ filter ['field ' ]);
684- $ xml .= add_XML_value ('compare ' , $ filter ['compare ' ]);
685- $ xml .= add_XML_value ('value ' , $ filter ['value ' ]);
686- $ xml .= '</filter> ' ;
687- }
688- }
689-
690- $ xml .= '</filters> ' ;
691-
692- $ xml .= '</filterdata> ' ;
693- return $ xml ;
694- }
695-
696539function get_sql_date_value ($ value ): string
697540{
698541 // transform from sql_value (assumed UTC)
@@ -1026,9 +869,6 @@ function get_filterdata_from_request($page_id = ''): array
1026869
1027870 $ filterdata ['sql ' ] = generate_filterdata_sql ($ filterdata );
1028871
1029- $ xml = filterdata_XML ($ filterdata );
1030- $ filterdata ['xml ' ] = $ xml ;
1031-
1032872 return $ filterdata ;
1033873}
1034874
0 commit comments