diff --git a/src/chartgenerator.php b/src/chartgenerator.php index 9ff147a..31f34c7 100644 --- a/src/chartgenerator.php +++ b/src/chartgenerator.php @@ -139,9 +139,19 @@ if ( !$content['error_occured'] ) $stream = $stream_config->LogStreamFactory($stream_config); $stream->SetFilter($content['chart_defaultfilter']); + // Set Columns we want to open! - $content['ChartColumns'][] = SYSLOG_UID; - $content['ChartColumns'][] = $content['chart_field']; + $content['ChartColumns'] = array(); + // First add filter fields to array + $aFilterFields = $stream->ReturnFieldsByFilters(); + if ( $aFilterFields != null ) + $content['ChartColumns'] = $aFilterFields; + + // append mandetory fields + if ( !in_array(SYSLOG_UID, $content['ChartColumns']) ) + $content['ChartColumns'][] = SYSLOG_UID; + if ( !in_array($content['chart_field'], $content['ChartColumns']) ) + $content['ChartColumns'][] = $content['chart_field']; // Append fields from defaultfilter as well ! if ( strlen($content['chart_defaultfilter']) > 0 ) diff --git a/src/classes/logstream.class.php b/src/classes/logstream.class.php index c1b4c7c..d173537 100644 --- a/src/classes/logstream.class.php +++ b/src/classes/logstream.class.php @@ -567,6 +567,24 @@ abstract class LogStream { } + /** + * Helper function to return all fields needed for filters + * Can be helpful for functions which need to add filtering fields + */ + public function ReturnFieldsByFilters() + { + global $fields; + + if ( $this->_filters != null ) + { + // Return array keys + $aResult = array_keys($this->_filters); + return $aResult; + } + else // No fields at all! + return null; + } + /* * --- PIRVATE HELPERS! */ diff --git a/src/classes/logstreamdb.class.php b/src/classes/logstreamdb.class.php index 67fe32b..a56a9c7 100644 --- a/src/classes/logstreamdb.class.php +++ b/src/classes/logstreamdb.class.php @@ -1151,7 +1151,7 @@ class LogStreamDB extends LogStream { } } -//echo $this->_SQLwhereClause; +// echo $this->_SQLwhereClause; //$dbmapping[$szTableType][SYSLOG_UID] } else // No filters means nothing to do! diff --git a/src/lang/de/admin.php b/src/lang/de/admin.php index bc67076..8ae84b7 100644 --- a/src/lang/de/admin.php +++ b/src/lang/de/admin.php @@ -205,7 +205,7 @@ $content['LN_VIEWS_ERROR_DELSEARCH'] = "Löschen der Ansicht mit der id '%1' $content['LN_VIEWS_ERROR_HASBEENDEL'] = "Die Ansicht '%1' wurder erfolgreich gelöscht!"; $content['LN_VIEWS_ADDEDIT'] = "Hinzufügen/Bearbeiten einer Ansicht"; $content['LN_VIEWS_COLUMNLIST'] = "Konfigurierte Spalten"; -$content['LN_VIEWS_ADDCOLUMN'] = "Eine Spalte hinzufügen"; +$content['LN_VIEWS_ADDCOLUMN'] = "Eine Spalte hinzufuegen"; $content['LN_VIEWS_ERROR_DISPLAYNAMEEMPTY'] = "Der Name der Ansicht kann nicht leer sein."; $content['LN_VIEWS_COLUMN'] = "Spalte"; $content['LN_VIEWS_COLUMN_REMOVE'] = "Spalte löschen"; @@ -304,7 +304,7 @@ $content['LN_DBUPGRADE_ULTRASTATSDBVERSION'] = "LogAnalyzer Datenbank Version"; $content['LN_CHARTS_CENTER'] = "Charts Optionen"; $content['LN_CHARTS_EDIT'] = "Chart bearbeiten"; $content['LN_CHARTS_DELETE'] = "Chart löschen"; -$content['LN_CHARTS_ADD'] = "Neuen Chart hinzufügen"; +$content['LN_CHARTS_ADD'] = "Neuen Chart hinzufuegen"; $content['LN_CHARTS_ADDEDIT'] = "Hinzufügen/Bearbeiten eines Charts"; $content['LN_CHARTS_NAME'] = "Name des Charts"; $content['LN_CHARTS_ENABLED'] = "Chart aktiviert";