diff --git a/src/admin/reports.php b/src/admin/reports.php index ad244c4..6c0f27c 100644 --- a/src/admin/reports.php +++ b/src/admin/reports.php @@ -5,7 +5,7 @@ * ----------------------------------------------------------------- * Search Admin File * - * -> Helps administrating message parsers + * -> Helps administrating report modules * * All directives are explained within this file * @@ -69,23 +69,24 @@ if ( isset($_GET['op']) ) if ( isset($_GET['id']) ) { //PreInit these values - $content['ParserID'] = DB_RemoveBadChars($_GET['id']); - if ( isset($content['PARSERS'][ $content['ParserID'] ]) ) + $content['ReportID'] = DB_RemoveBadChars($_GET['id']); + if ( isset($content['REPORTS'][ $content['ReportID'] ]) ) { // Get Reference to parser! - $myParser = $content['PARSERS'][ $content['ParserID'] ]; + $myReport = $content['REPORTS'][ $content['ReportID'] ]; - $content['DisplayName'] = $myParser['DisplayName']; - $content['Description'] = $myParser['Description']; + $content['DisplayName'] = $myReport['DisplayName']; + $content['Description'] = $myReport['Description']; - if ( strlen($myParser['ParserHelpArticle']) > 0 ) + if ( strlen($myReport['ReportHelpArticle']) > 0 ) { $content['EnableHelpArticle'] = true; - $content['ParserHelpArticle'] = $myParser['ParserHelpArticle']; + $content['ReportHelpArticle'] = $myReport['ReportHelpArticle']; } + /* // check for custom fields - if ( isset($myParser['CustomFieldsList']) && count($myParser['CustomFieldsList']) > 0 ) + if ( isset($myReport['CustomFieldsList']) && count($myReport['CustomFieldsList']) > 0 ) { // Needs custom fields! $content['EnableCustomField'] = true; @@ -106,13 +107,14 @@ if ( isset($_GET['op']) ) } } } + */ } else { $content['ISSHOWDETAILS'] = false; $content['ISERROR'] = true; - $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_PARSERS_ERROR_IDNOTFOUND'], $content['ParserID'] ); + $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_REPORTS_ERROR_IDNOTFOUND'], $content['ReportID'] ); } } else @@ -246,20 +248,21 @@ if ( isset($_GET['op']) ) // Default mode! if ( !isset($_POST['op']) && !isset($_GET['op']) ) { - if ( isset($content['PARSERS']) ) + if ( isset($content['REPORTS']) ) { // Default Mode = List Searches - $content['LISTPARSERS'] = "true"; + $content['LISTREPORTS'] = "true"; $i = 0; // Help counter! - foreach ($content['PARSERS'] as &$myParser ) + foreach ($content['REPORTS'] as &$myReport ) { // Set if help link is enabled - if ( strlen($myParser['ParserHelpArticle']) > 0 ) - $myParser['ParserHelpEnabled'] = true; + if ( strlen($myReport['ReportHelpArticle']) > 0 ) + $myReport['ReportHelpEnabled'] = true; else - $myParser['ParserHelpEnabled'] = false; + $myReport['ReportHelpEnabled'] = false; + /* // Find out if we need to INIT something! if ( isset($myParser['CustomFieldsList']) && count($myParser['CustomFieldsList']) > 0 ) { @@ -278,28 +281,29 @@ if ( !isset($_POST['op']) && !isset($_GET['op']) ) } } } + */ // --- Set CSS Class if ( $i % 2 == 0 ) - $myParser['cssclass'] = "line1"; + $myReport['cssclass'] = "line1"; else - $myParser['cssclass'] = "line2"; + $myReport['cssclass'] = "line2"; $i++; // --- } } else { - $content['LISTPARSERS'] = "false"; + $content['LISTREPORTS'] = "false"; $content['ISERROR'] = true; - $content['ERROR_MSG'] = $content['LN_PARSERS_ERROR_NOPARSERS']; + $content['ERROR_MSG'] = $content['LN_REPORTS_ERROR_NOREPORTS']; } } // --- END Custom Code // --- BEGIN CREATE TITLE $content['TITLE'] = InitPageTitle(); -$content['TITLE'] .= " :: " . $content['LN_ADMINMENU_MSGPARSERSOPT']; +$content['TITLE'] .= " :: " . $content['LN_ADMINMENU_REEPORTSOPT']; // --- END CREATE TITLE // --- Parsen and Output diff --git a/src/classes/reports/report.class.php b/src/classes/reports/report.class.php index 88b0895..50a836f 100644 --- a/src/classes/reports/report.class.php +++ b/src/classes/reports/report.class.php @@ -49,7 +49,8 @@ abstract class Report { public $_reportVersion = 1; // Internally Version of the ReportEngine public $_reportID = "report.syslog.base.class"; // ID for the report, needs to be unique! public $_reportTitle = "Base Report Class"; // Display name for the report - public $_reportDescription = "This is the base class for all reports" + public $_reportDescription = "This is the base class for all reports"; + public $_reportHelpArticle = "http://"; // Configuration Properties protected $_filterString = ""; diff --git a/src/classes/reports/report.eventlog.monilog.class.php b/src/classes/reports/report.eventlog.monilog.class.php index fec7534..dcf2172 100644 --- a/src/classes/reports/report.eventlog.monilog.class.php +++ b/src/classes/reports/report.eventlog.monilog.class.php @@ -41,8 +41,8 @@ if ( !defined('IN_PHPLOGCON') ) } // --- -// --- Required Includes! -require_once($gl_root_path . 'include/constants_errors.php'); +// --- Basic Includes! +require_once($gl_root_path . 'classes/reports/report.class.php'); // --- class Report_monilog extends Report { @@ -50,8 +50,8 @@ class Report_monilog extends Report { public $_reportVersion = 1; // Internally Version of the ReportEngine public $_reportID = "report.eventlog.monilog.class"; // ID for the report, needs to be unique! public $_reportTitle = "EventLog Summary Report"; // Display name for the report - public $_reportDescription = "This is a EventLog Summary Report based on Monilog" - + public $_reportDescription = "This is a EventLog Summary Report based on Monilog"; + public $_reportHelpArticle = ""; /* private $_currentOffset = -1; private $_currentStartPos = -1; diff --git a/src/images/icons/document_chart.png b/src/images/icons/document_chart.png new file mode 100644 index 0000000..15d86d5 Binary files /dev/null and b/src/images/icons/document_chart.png differ diff --git a/src/images/icons/presentation_chart.png b/src/images/icons/presentation_chart.png new file mode 100644 index 0000000..8c0b462 Binary files /dev/null and b/src/images/icons/presentation_chart.png differ diff --git a/src/include/functions_config.php b/src/include/functions_config.php index dfa5dcf..d213815 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -233,7 +233,7 @@ function InitMessageParsers() if ( file_exists($szIncludeFile) ) { // Try to include - if ( @include_once($szIncludeFile) !== false ) + if ( include_once($szIncludeFile) ) { // Set ParserClassName $szParserClass = "MsgParser_" . $myParserID; @@ -272,12 +272,13 @@ function InitMessageParsers() else { // DEBUG ERROR - OutputDebugMessage("FATAL Error in InitMessageParsers while including report file '" . $szIncludeFile . "' with error: '" . $php_errormsg . "'", DEBUG_ERROR); + OutputDebugMessage("InitMessageParsers: Failed including msgparser file '" . $szIncludeFile . "' with error: '" . $php_errormsg . "'", DEBUG_ERROR); } } else { // DEBUG ERROR + OutputDebugMessage("InitMessageParsers: MsgParserfile '" . $szIncludeFile . "' does not exist!", DEBUG_ERROR); } } } @@ -304,28 +305,26 @@ function InitReportModules() $myReportCat = $out[1]; $myReportID = $out[2]; - // Check if parser file include exists $szIncludeFile = $szDirectory . $myFile; if ( file_exists($szIncludeFile) ) { // Try to include - if ( @include_once($szIncludeFile) !== false ) + if ( include_once($szIncludeFile) ) { // Set ParserClassName $szReportClass = "Report_" . $myReportID; - echo $szReportClass . "!
"; - exit; // Create Instance and get properties - $tmpParser = new $szParserClass(); // Create an instance - $szParserName = $tmpParser->_ClassName; - $szParserDescription = $tmpParser->_ClassDescription; - $szParserHelpArticle = $tmpParser->_ClassHelpArticle; - + $tmpReport = new $szReportClass(); // Create an instance + $szReportName = $tmpReport->_reportTitle; + $szReportDescription = $tmpReport->_reportDescription; + $szReportVersion= $tmpReport->_reportVersion; + $szReportHelpArticle = $tmpReport->_reportHelpArticle; +/* // check for required fields! - if ( $tmpParser->_ClassRequiredFields != null && count($tmpParser->_ClassRequiredFields) > 0 ) + if ( $tmpReport->_ClassRequiredFields != null && count($tmpParser->_ClassRequiredFields) > 0 ) { $bCustomFields = true; $aCustomFieldList = $tmpParser->_ClassRequiredFields; @@ -336,31 +335,39 @@ function InitReportModules() $bCustomFields = false; $aCustomFieldList = null; } + */ - // Add entry to msg parser list! - $content['PARSERS'][$myParserID] = array ( - "ID" => $myParserID, - "DisplayName" => $szParserName, - "Description" => $szParserDescription, - "CustomFields" => $bCustomFields, - "CustomFieldsList" => $aCustomFieldList, - "ParserHelpArticle" => $szParserHelpArticle, + // Add entry to report modules list! + $content['REPORTS'][$myReportID] = array ( + "ID" => $myReportID, + "DisplayName" => $szReportName, + "Description" => $szReportDescription, + "ReportVersion" => $szReportVersion, + "ReportHelpArticle" => $szReportHelpArticle, +// "CustomFields" => $bCustomFields, +// "CustomFieldsList" => $aCustomFieldList, ); + + } else { // DEBUG ERROR - OutputDebugMessage("FATAL Error in InitReportModules while including report file '" . $szIncludeFile . "' with error: '" . $php_errormsg . "'", DEBUG_ERROR); + OutputDebugMessage("InitReportModules: Failed including report file '" . $szIncludeFile . "' with error: '" . $php_errormsg . "'", DEBUG_ERROR); } - } else { // DEBUG ERROR + OutputDebugMessage("InitReportModules: Reportfile '" . $szIncludeFile . "' does not exist!", DEBUG_ERROR); } } } } + + // TODO: compare update report modules registered in database + + } /* diff --git a/src/lang/en/admin.php b/src/lang/en/admin.php index 158642a..0e5e6ac 100644 --- a/src/lang/en/admin.php +++ b/src/lang/en/admin.php @@ -385,4 +385,26 @@ $content['LN_CMD_DELETINGOLDERTHEN'] = "Performing deletion of data entries olde $content['LN_CMD_DELETEDROWS'] = "Successfully Deleted '%1' rows in the logstream source.'"; $content['LN_CMD_'] = ""; +// Report Options +$content['LN_REPORTS_EDIT'] = "Edit Report"; +$content['LN_REPORTS_DELETE'] = "Remove Report"; +$content['LN_REPORTS_ID'] = "Report ID"; +$content['LN_REPORTS_NAME'] = "Report Name"; +$content['LN_REPORTS_DESCRIPTION'] = "Report Description"; +$content['LN_REPORTS_ERROR_NOREPORTS'] = "There were no valid reports found in your installation."; +$content['LN_REPORTS_HELP'] = "Help"; +$content['LN_REPORTS_HELP_CLICK'] = "Click here for more help"; +$content['LN_REPORTS_INFO'] = "Show more Information for this report module."; +$content['LN_REPORTS_INIT'] = "Initialize settings for this report module."; +$content['LN_REPORTS_REMOVE'] = "Remove settings for this report module."; +$content['LN_REPORTS_ERROR_IDNOTFOUND'] = "There was no report with ID '%1' found."; +$content['LN_REPORTS_ERROR_INVALIDID'] = "Invalid report id."; +$content['LN_REPORTS_DETAILS'] = "Details for this report"; +$content['LN_REPORTS_WARNREMOVE'] = "You are about to remove the custom settings needed by the '%1' report. However you can add these settings again if you change your mind."; +$content['LN_REPORTS_ERROR_HASBEENREMOVED'] = "All settings for the report '%1' have been removed."; +$content['LN_REPORTS_ERROR_HASBEENADDED'] = "All required settings for the report '%1' have been added."; +$content['LN_REPORTS_ERROR_NOFIELDS'] = "The report '%1' does not have any custom settings which can be added."; +$content['LN_REPORTS_'] = ""; + + ?> \ No newline at end of file diff --git a/src/templates/admin/admin_reports.html b/src/templates/admin/admin_reports.html index 30e22ee..24cc00d 100644 --- a/src/templates/admin/admin_reports.html +++ b/src/templates/admin/admin_reports.html @@ -21,60 +21,60 @@

- + - - - + + + - + - + - +
{LN_PARSERS_ID}{LN_PARSERS_NAME}{LN_PARSERS_DESCRIPTION}{LN_REPORTS_ID}{LN_REPORTS_NAME}{LN_REPORTS_DESCRIPTION} {LN_GEN_ACTIONS}
{ID}{DisplayName}{DisplayName} {Description} - - - + + + - + - -   - - -   - + +   + + +   +
- + - + - - + + - + - + - + - + - + - - + +
{LN_PARSERS_DETAILS}{LN_REPORTS_DETAILS}
{LN_PARSERS_ID}{ParserID}{LN_REPORTS_ID}{ReportID}
{LN_PARSERS_NAME}{LN_REPORTS_NAME} {DisplayName}
{LN_PARSERS_DESCRIPTION}{LN_REPORTS_DESCRIPTION} {Description}
{LN_PARSERS_CUSTOMFIELDS}{LN_REPORTS_CUSTOMSETTINGS}
{FieldCaption} ({FieldDefine}) @@ -82,21 +82,21 @@

{LN_PARSERS_HELP}{LN_PARSERS_HELP_CLICK}{LN_REPORTS_HELP}{LN_REPORTS_HELP_CLICK}
- - {LN_PARSERS_INIT} - - - {LN_PARSERS_REMOVE} - + + {LN_REPORTS_INIT} + + + {LN_REPORTS_REMOVE} +