mirror of
https://github.com/rsyslog/loganalyzer.git
synced 2025-09-26 03:09:21 +02:00
Started implementing support for savedreports
This commit is contained in:
parent
8596a056a7
commit
4ed4be3459
@ -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'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -67,4 +67,4 @@ define('ERROR_CHARTS_NOTCONFIGURED', 20);
|
||||
define('ERROR_MSG_SKIPMESSAGE', 21);
|
||||
define('ERROR_MSG_SCANABORTED', 23);
|
||||
|
||||
?>
|
||||
?>
|
17
src/include/db_update_v9.txt
Normal file
17
src/include/db_update_v9.txt
Normal file
@ -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
|
@ -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']) )
|
||||
|
@ -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
|
||||
// ---
|
||||
|
||||
|
@ -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_'] = "";
|
||||
|
||||
?>
|
@ -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_'] = "";
|
||||
|
||||
|
||||
|
@ -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_'] = "";
|
||||
|
||||
?>
|
@ -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_'] = "";
|
||||
|
||||
?>
|
@ -27,7 +27,7 @@
|
||||
<td align="center" width="100" class="cellmenu1"><b>{LN_REPORTS_ID}</b></td>
|
||||
<td align="center" width="200" class="cellmenu1"><b>{LN_REPORTS_NAME}</b></td>
|
||||
<td align="center" width="300" class="cellmenu1"><b>{LN_REPORTS_DESCRIPTION}</b></td>
|
||||
<td align="center" width="125" class="cellmenu1" colspan="3" nowrap><b>{LN_GEN_ACTIONS}</b></td>
|
||||
<td align="center" width="125" class="cellmenu1" nowrap><b>{LN_GEN_ACTIONS}</b></td>
|
||||
</tr>
|
||||
<!-- BEGIN REPORTS -->
|
||||
<tr>
|
||||
@ -36,13 +36,9 @@
|
||||
<td align="left" class="{cssclass}" valign="top">{Description}</td>
|
||||
<td align="center" class="{cssclass}">
|
||||
<!-- IF ReportHelpEnabled="true" -->
|
||||
<a href="{ReportHelpArticle}" target="_blank"><img src="{MENU_HELP}" width="16" title="{LN_REPORTS_HELP}"></a>
|
||||
<a href="{ReportHelpArticle}" target="_blank"><img src="{MENU_HELP}" width="16" title="{LN_REPORTS_HELP}"></a>
|
||||
<!-- ENDIF ReportHelpEnabled="true" -->
|
||||
</td>
|
||||
<td align="center" class="{cssclass}">
|
||||
<a href="{BASEPATH}admin/reports.php?op=details&id={ID}"><img src="{MENU_INFORMATION}" width="16" title="{LN_REPORTS_INFO}"></a>
|
||||
</td>
|
||||
<td align="center" class="{cssclass}">
|
||||
<!-- IF EnableNeedsInit="true" -->
|
||||
<!-- IF InitEnabled="true" -->
|
||||
<a href="{BASEPATH}admin/reports.php?op=initreport&id={ID}"><img src="{MENU_PARSER_INIT}" width="16" title="{LN_REPORTS_INIT}"></a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user