From ff88bd8f8a28f825e659cfd2f62bd201a9508b83 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Wed, 19 Aug 2009 11:58:54 +0200 Subject: [PATCH] Implemented further stuff for the admin panel of the reports --- src/admin/reports.php | 46 ++++++------ src/classes/reports/report.class.php | 3 +- .../reports/report.eventlog.monilog.class.php | 8 +-- src/images/icons/document_chart.png | Bin 0 -> 696 bytes src/images/icons/presentation_chart.png | Bin 0 -> 910 bytes src/include/functions_config.php | 51 +++++++------ src/lang/en/admin.php | 22 ++++++ src/templates/admin/admin_reports.html | 68 +++++++++--------- 8 files changed, 116 insertions(+), 82 deletions(-) create mode 100644 src/images/icons/document_chart.png create mode 100644 src/images/icons/presentation_chart.png 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 0000000000000000000000000000000000000000..15d86d59ea3895251c3c90df892f5c57c06b4bf4 GIT binary patch literal 696 zcmV;p0!RIcP)WdKcYATc!{L3L*!GB7YTATcpIGch_b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cCUGGS;vd^NmawLs9f{nH50Qp>B|_{)88MH$cG4xxRO>e`%;bFNqS!vZCTB z5u=&W^)z%{FSA??6y5v=m}17ki_X9(eIFiW`=RV<2Gd(oG*A@TG*C<#H0qEnAhhE${)OOdm4VT;RJGJ%o9^krkvC0XclK>nmX(~fP zf8hzq6!wioVO}fHC4wpO?`W=TanmdoFn0=@lWV0!5d3pX@I=#dU4qk1GM4DoWL=tv)bDQyaM{8$i zXRja#i!@Dt!QtE1Hl8%mN{7OHCJ6E{5C}jnm-{s_F_D~^nfZv%NP(g#^YDbNc;l}N zboxRK4-bz^lJszPcJ@;yli9&@NlX*QZKc0qU8H{+m?Ma}hB"; - 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} +