diff --git a/src/admin/reports.php b/src/admin/reports.php index 260e16b..170bc29 100644 --- a/src/admin/reports.php +++ b/src/admin/reports.php @@ -63,8 +63,6 @@ if ( isset($_GET['op']) ) { // Set Mode to edit $content['ISSHOWDETAILS'] = "true"; -// $content['SEARCH_FORMACTION'] = "editsearch"; -// $content['SEARCH_SENDBUTTON'] = $content['LN_SEARCH_EDIT']; if ( isset($_GET['id']) ) { @@ -114,29 +112,37 @@ if ( isset($_GET['op']) ) { $content['ISSHOWDETAILS'] = false; $content['ISERROR'] = true; - $content['ERROR_MSG'] = $content['LN_PARSERS_ERROR_INVALIDID']; + $content['ERROR_MSG'] = $content['LN_REPORTS_ERROR_INVALIDID']; } } - else if ($_GET['op'] == "removeparser") + else if ($_GET['op'] == "removereport") { 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'] ]; + + if ( !$myReport["NeedsInit"] ) + { + // Do the final redirect + RedirectResult( GetAndReplaceLangStr( $content['LN_REPORTS_ERROR_REPORTDOESNTNEEDTOBEREMOVED'], $myReport['DisplayName'] ) , "reports.php" ); + } // --- Ask for deletion first! if ( (!isset($_GET['verify']) || $_GET['verify'] != "yes") ) { // This will print an additional secure check which the user needs to confirm and exit the script execution. - PrintSecureUserCheck( GetAndReplaceLangStr( $content['LN_PARSERS_WARNREMOVE'], $myParser['DisplayName'] ), $content['LN_DELETEYES'], $content['LN_DELETENO'] ); + PrintSecureUserCheck( GetAndReplaceLangStr( $content['LN_REPORTS_WARNREMOVE'], $myReport['DisplayName'] ), $content['LN_DELETEYES'], $content['LN_DELETENO'] ); } // --- - // Check if we have fields to delete + // TODO WHATEVER + +/* // Check if we have fields to delete if ( isset($myParser['CustomFieldsList']) && count($myParser['CustomFieldsList']) > 0 ) { // Helper counter @@ -164,25 +170,30 @@ if ( isset($_GET['op']) ) $content['ISERROR'] = true; $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_PARSERS_ERROR_NOFIELDS'], $content['ParserID'] ); } + */ + } } else { $content['ISERROR'] = true; - $content['ERROR_MSG'] = $content['LN_PARSERS_ERROR_INVALIDID']; + $content['ERROR_MSG'] = $content['LN_REPORTS_ERROR_INVALIDID']; } } - else if ($_GET['op'] == "initparser") + else if ($_GET['op'] == "initreport") { 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'] ]; + $myParser = $content['REPORTS'][ $content['ReportID'] ]; + // TODO WHATEVER + + /* // check for custom fields if ( isset($myParser['CustomFieldsList']) && count($myParser['CustomFieldsList']) > 0 ) { @@ -223,17 +234,18 @@ if ( isset($_GET['op']) ) $content['ISERROR'] = true; $content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_PARSERS_ERROR_NOFIELDS'], $content['ParserID'] ); } + */ } else { $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 { $content['ISERROR'] = true; - $content['ERROR_MSG'] = $content['LN_PARSERS_ERROR_INVALIDID']; + $content['ERROR_MSG'] = $content['LN_REPORTS_ERROR_INVALIDID']; } } } diff --git a/src/classes/reports/report.eventlog.monilog.class.php b/src/classes/reports/report.eventlog.monilog.class.php index 881c626..ec7bfc2 100644 --- a/src/classes/reports/report.eventlog.monilog.class.php +++ b/src/classes/reports/report.eventlog.monilog.class.php @@ -52,7 +52,7 @@ class Report_monilog extends Report { public $_reportTitle = "EventLog Summary Report"; // Display name for the report public $_reportDescription = "This is a EventLog Summary Report based on Monilog"; public $_reportHelpArticle = ""; - public $_reportNeedsInit = true; // True means that this report needs additional init stuff + public $_reportNeedsInit = false; // True means that this report needs additional init stuff public $_reportInitialized = false; // True means report is installed /* private $_currentOffset = -1; diff --git a/src/include/constants_errors.php b/src/include/constants_errors.php index b36cd5d..246008c 100644 --- a/src/include/constants_errors.php +++ b/src/include/constants_errors.php @@ -67,4 +67,4 @@ define('ERROR_CHARTS_NOTCONFIGURED', 20); define('ERROR_MSG_SKIPMESSAGE', 21); define('ERROR_MSG_SCANABORTED', 23); -?> +?> \ No newline at end of file diff --git a/src/include/db_update_v9.txt b/src/include/db_update_v9.txt new file mode 100644 index 0000000..548e14f --- /dev/null +++ b/src/include/db_update_v9.txt @@ -0,0 +1,17 @@ +-- New Database Structure Updates +CREATE TABLE `logcon_savedreports` ( +`ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , +`reportid` VARCHAR( 255 ) NOT NULL , +`sourceid` INT NOT NULL , +`customTitle` VARCHAR( 255 ) NOT NULL , +`customComment` TEXT NOT NULL , +`filterString` TEXT NOT NULL , +`customFilters` TEXT NOT NULL , +`outputFormat` VARCHAR( 64 ) NOT NULL , +`outputTarget` TEXT NOT NULL , +`scheduleSettings` TEXT NOT NULL +) ENGINE = innodb COMMENT = 'Table to store saved reports'; + +-- Insert data + +-- Updated Data diff --git a/src/include/functions_config.php b/src/include/functions_config.php index a660088..467f712 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -324,8 +324,6 @@ function InitReportModules() $bNeedsInit = $tmpReport->_reportNeedsInit; $bInitialized = $tmpReport->_reportInitialized; - - /* // check for required fields! if ( $tmpReport->_ClassRequiredFields != null && count($tmpParser->_ClassRequiredFields) > 0 ) @@ -350,11 +348,46 @@ function InitReportModules() "ReportHelpArticle" => $szReportHelpArticle, "NeedsInit" => $bNeedsInit, "Initialized" => $bInitialized, + "ObjRef" => $tmpReport, // "CustomFields" => $bCustomFields, // "CustomFieldsList" => $aCustomFieldList, ); + // --- Now Search and populate savedReports | but only if DB Version is 9 or higher. + if ( $content['database_installedversion'] >= 9 ) + { + // --- Create SQL Query + $sqlquery = " SELECT " . + DB_SAVEDREPORTS . ".ID, " . + DB_SAVEDREPORTS . ".sourceid, " . + DB_SAVEDREPORTS . ".customTitle, " . + DB_SAVEDREPORTS . ".customComment, " . + DB_SAVEDREPORTS . ".filterString, " . + DB_SAVEDREPORTS . ".customFilters, " . + DB_SAVEDREPORTS . ".outputFormat, " . + DB_SAVEDREPORTS . ".outputTarget, " . + DB_SAVEDREPORTS . ".scheduleSettings " . + " FROM " . DB_SAVEDREPORTS . + " WHERE " . DB_SAVEDREPORTS . ".reportid = '" . $myReportID . "' " . + " ORDER BY " . DB_SAVEDREPORTS . ".customTitle"; + // Get Views from DB now! + $result = DB_Query($sqlquery); + $myrows = DB_GetAllRows($result, true); + if ( isset($myrows) && count($myrows) > 0 ) + { + // Add all savedreports + foreach ($myrows as &$mySavedReport) + { + // TODO: Perform whatever needs to be performed + + // Add saved report into global array + $content['REPORTS'][$myReportID]['SAVEDREPORTS'][ $mySavedReport['ID'] ] = $mySavedReport; + } + } + + } + // --- } else { @@ -524,6 +557,7 @@ function InitPhpLogConConfigFile($bHandleMissing = true) define('DB_VIEWS', $tblPref . "views"); define('DB_CHARTS', $tblPref . "charts"); define('DB_MAPPINGS', $tblPref . "dbmappings"); + define('DB_SAVEDREPORTS', $tblPref . "savedreports"); // Legacy support for old columns definition format! if ( isset($CFG['Columns']) && is_array($CFG['Columns']) ) diff --git a/src/include/functions_db.php b/src/include/functions_db.php index 48d11f7..b1e6d94 100644 --- a/src/include/functions_db.php +++ b/src/include/functions_db.php @@ -45,7 +45,7 @@ $errdesc = ""; $errno = 0; // --- Current Database Version, this is important for automated database Updates! -$content['database_internalversion'] = "8"; // Whenever incremented, a database upgrade is needed +$content['database_internalversion'] = "9"; // Whenever incremented, a database upgrade is needed $content['database_installedversion'] = "0"; // 0 is default which means Prior Versioning Database // --- diff --git a/src/lang/de/admin.php b/src/lang/de/admin.php index d812bf2..73b41e9 100644 --- a/src/lang/de/admin.php +++ b/src/lang/de/admin.php @@ -372,4 +372,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_ERROR_REPORTDOESNTNEEDTOBEREMOVED'] = "The report '%1' does not need to be removed or initialized."; +$content['LN_REPORTS_'] = ""; + ?> \ No newline at end of file diff --git a/src/lang/en/admin.php b/src/lang/en/admin.php index 0e5e6ac..39744dd 100644 --- a/src/lang/en/admin.php +++ b/src/lang/en/admin.php @@ -404,6 +404,7 @@ $content['LN_REPORTS_WARNREMOVE'] = "You are about to remove the custom settings $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_ERROR_REPORTDOESNTNEEDTOBEREMOVED'] = "The report '%1' does not need to be removed or initialized."; $content['LN_REPORTS_'] = ""; diff --git a/src/lang/it_IT/admin.php b/src/lang/it_IT/admin.php index 26a8e63..3d7198a 100644 --- a/src/lang/it_IT/admin.php +++ b/src/lang/it_IT/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_ERROR_REPORTDOESNTNEEDTOBEREMOVED'] = "The report '%1' does not need to be removed or initialized."; +$content['LN_REPORTS_'] = ""; + ?> \ No newline at end of file diff --git a/src/lang/pt_BR/admin.php b/src/lang/pt_BR/admin.php index d812bf2..73b41e9 100644 --- a/src/lang/pt_BR/admin.php +++ b/src/lang/pt_BR/admin.php @@ -372,4 +372,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_ERROR_REPORTDOESNTNEEDTOBEREMOVED'] = "The report '%1' does not need to be removed or initialized."; +$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 9a90df3..15a1059 100644 --- a/src/templates/admin/admin_reports.html +++ b/src/templates/admin/admin_reports.html @@ -27,7 +27,7 @@