diff --git a/src/admin/reports.php b/src/admin/reports.php index 6c0f27c..260e16b 100644 --- a/src/admin/reports.php +++ b/src/admin/reports.php @@ -84,30 +84,23 @@ if ( isset($_GET['op']) ) $content['ReportHelpArticle'] = $myReport['ReportHelpArticle']; } - /* // check for custom fields - if ( isset($myReport['CustomFieldsList']) && count($myReport['CustomFieldsList']) > 0 ) + if ( $myReport['NeedsInit'] ) // && count($myReport['CustomFieldsList']) > 0 ) { // Needs custom fields! - $content['EnableCustomField'] = true; - $content['CustomFieldsList'] = $myParser['CustomFieldsList']; + $content['EnableNeedsInit'] = true; - foreach( $myParser['CustomFieldsList'] as $myField ) + if ( $myReport['Initialized'] ) { - // check if field is in define list! - if ( !array_key_exists($myField['FieldID'], $fields) ) - { - $content['ParserInitEnabled'] = true; - break; - } - else - { - $content['ParserDeleteEnabled'] = true; - break; - } + $content['InitEnabled'] = false; + $content['DeleteEnabled'] = true; + } + else + { + $content['InitEnabled'] = true; + $content['DeleteEnabled'] = false; } } - */ } else @@ -261,27 +254,24 @@ if ( !isset($_POST['op']) && !isset($_GET['op']) ) $myReport['ReportHelpEnabled'] = true; else $myReport['ReportHelpEnabled'] = false; - - /* - // Find out if we need to INIT something! - if ( isset($myParser['CustomFieldsList']) && count($myParser['CustomFieldsList']) > 0 ) + + // check for custom fields + if ( $myReport['NeedsInit'] ) // && count($myReport['CustomFieldsList']) > 0 ) { - foreach( $myParser['CustomFieldsList'] as $myField ) + // Needs custom fields! + $myReport['EnableNeedsInit'] = true; + + if ( $myReport['Initialized'] ) { - // check if field is in define list! - if ( !array_key_exists($myField['FieldID'], $fields) ) - { - $myParser['ParserInitEnabled'] = true; - break; - } - else - { - $myParser['ParserDeleteEnabled'] = true; - break; - } + $myReport['InitEnabled'] = false; + $myReport['DeleteEnabled'] = true; + } + else + { + $myReport['InitEnabled'] = true; + $myReport['DeleteEnabled'] = false; } } - */ // --- Set CSS Class if ( $i % 2 == 0 ) diff --git a/src/classes/reports/report.class.php b/src/classes/reports/report.class.php index 50a836f..a203c1c 100644 --- a/src/classes/reports/report.class.php +++ b/src/classes/reports/report.class.php @@ -51,6 +51,8 @@ abstract class Report { public $_reportTitle = "Base Report Class"; // Display name for the report public $_reportDescription = "This is the base class for all reports"; public $_reportHelpArticle = "http://"; + public $_reportNeedsInit = false; // True means that this report needs additional init stuff + public $_reportInitialized = false; // True means report is installed // Configuration Properties protected $_filterString = ""; @@ -92,6 +94,19 @@ abstract class Report { */ public abstract function verifyDataSource(); + + /** + * This function inits data for the report + */ + public abstract function InitReport(); + + + /** + * This function removes data for the report + */ + public abstract function RemoveReport(); + + /** * Helper function using the template parser to create the report */ diff --git a/src/classes/reports/report.eventlog.monilog.class.php b/src/classes/reports/report.eventlog.monilog.class.php index dcf2172..881c626 100644 --- a/src/classes/reports/report.eventlog.monilog.class.php +++ b/src/classes/reports/report.eventlog.monilog.class.php @@ -52,6 +52,8 @@ 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 $_reportInitialized = false; // True means report is installed /* private $_currentOffset = -1; private $_currentStartPos = -1; @@ -136,6 +138,27 @@ class Report_monilog extends Report { } + /** + * InitReport, empty + * + */ + public function InitReport() + { + // Nothing todo + return SUCCESS; + } + + + /** + * RemoveReport, empty + * + */ + public function RemoveReport() + { + // Nothing todo + return SUCCESS; + } + /** * validateLicense, check license code diff --git a/src/include/functions_config.php b/src/include/functions_config.php index d213815..a660088 100644 --- a/src/include/functions_config.php +++ b/src/include/functions_config.php @@ -321,6 +321,10 @@ function InitReportModules() $szReportDescription = $tmpReport->_reportDescription; $szReportVersion= $tmpReport->_reportVersion; $szReportHelpArticle = $tmpReport->_reportHelpArticle; + $bNeedsInit = $tmpReport->_reportNeedsInit; + $bInitialized = $tmpReport->_reportInitialized; + + /* // check for required fields! @@ -344,6 +348,8 @@ function InitReportModules() "Description" => $szReportDescription, "ReportVersion" => $szReportVersion, "ReportHelpArticle" => $szReportHelpArticle, + "NeedsInit" => $bNeedsInit, + "Initialized" => $bInitialized, // "CustomFields" => $bCustomFields, // "CustomFieldsList" => $aCustomFieldList, ); diff --git a/src/templates/admin/admin_reports.html b/src/templates/admin/admin_reports.html index 24cc00d..9a90df3 100644 --- a/src/templates/admin/admin_reports.html +++ b/src/templates/admin/admin_reports.html @@ -43,12 +43,14 @@ - -   - - -   - + + +   + + +   + + @@ -72,33 +74,24 @@ {LN_REPORTS_DESCRIPTION} {Description} - - - {LN_REPORTS_CUSTOMSETTINGS} - - -
{FieldCaption} ({FieldDefine}) - -

- - - {LN_REPORTS_HELP} {LN_REPORTS_HELP_CLICK} + - + {LN_REPORTS_INIT} - - + + {LN_REPORTS_REMOVE} - + +