diff --git a/src/admin/reports.php b/src/admin/reports.php index b9ceb20..44c0193 100644 --- a/src/admin/reports.php +++ b/src/admin/reports.php @@ -320,9 +320,13 @@ if ( isset($_GET['op']) ) $content['outputFormat'] = REPORT_OUTPUT_HTML; CreateOutputformatList( $content['outputFormat'] ); + // Create Outputtargetlist + $content['outputTarget'] = REPORT_TARGET_STDOUT; + CreateOutputtargetList( $content['outputTarget'] ); + // Other settings ... TODO! - $content['customFilters'] = ""; - $content['outputTarget'] = ""; +// $content['customFilters'] = ""; +// $content['outputTarget'] = ""; $content['scheduleSettings'] = ""; } else @@ -394,10 +398,14 @@ if ( isset($_GET['op']) ) // Create Outputlist $content['outputFormat'] = $mySavedReport['outputFormat']; CreateOutputformatList( $content['outputFormat'] ); + + // Create Outputtargetlist + $content['outputTarget'] = $mySavedReport['outputFormat']; + CreateOutputtargetList( $content['outputTarget'] ); // Other settings ... TODO! // $content['customFilters'] = ""; - $content['outputTarget'] = ""; +// $content['outputTarget'] = ""; $content['scheduleSettings'] = ""; } else @@ -830,7 +838,7 @@ if ( isset($_POST['op']) ) if ( isset($_POST['report_customcomment']) ) { $content['customComment'] = DB_RemoveBadChars($_POST['report_customcomment']); } else {$content['report_customcomment'] = ""; } if ( isset($_POST['report_filterString']) ) { $content['filterString'] = DB_RemoveBadChars($_POST['report_filterString']); } else {$content['report_filterString'] = ""; } if ( isset($_POST['outputFormat']) ) { $content['outputFormat'] = DB_RemoveBadChars($_POST['outputFormat']); } - + if ( isset($_POST['outputTarget']) ) { $content['outputTarget'] = DB_RemoveBadChars($_POST['outputTarget']); } // Read Custom Filters foreach ( $content['CUSTOMFILTERS'] as &$tmpCustomFilter ) @@ -854,7 +862,7 @@ if ( isset($_POST['op']) ) // TODO! // customFilters, outputTarget, scheduleSettings // $content['customFilters'] = ""; - $content['outputTarget'] = ""; +// $content['outputTarget'] = ""; $content['scheduleSettings'] = ""; // --- Check mandotary values diff --git a/src/classes/reports/report.class.php b/src/classes/reports/report.class.php index 0435975..e6063ca 100644 --- a/src/classes/reports/report.class.php +++ b/src/classes/reports/report.class.php @@ -66,7 +66,8 @@ abstract class Report { protected $_arrCustomFilters = null; // Array contains list of available custom filters, used for admin interface! protected $_customFilters = ""; // Xml Filterstring containing values for the custom filters protected $_outputFormat = REPORT_OUTPUT_HTML; // Default HTML Output - protected $_outputTarget = ""; + protected $_outputTarget = REPORT_TARGET_STDOUT;// Default is stdout + protected $_arrOutputTargetDetails = null; // Array containing helper settings for the output Target protected $_scheduleSettings = ""; protected $_mySourceID = ""; @@ -217,8 +218,33 @@ abstract class Report { */ public function SetOutputTarget($newOutputTarget) { - // Set new OutputTarget - $this->_outputTarget = $newOutputTarget; + // Only set if valid string + if ( strlen($newOutputTarget) > 0 ) + { + // First of all split by comma + $tmpValues = explode( ",", $newOutputTarget ); + + //Loop through mappings + foreach ($tmpValues as &$myValue ) + { + // Split subvalues + $tmpArray = explode( "=>", $myValue ); + + // Get tmp fieldID + $tmpFieldID = trim($tmpArray[0]); + + if ( $tmpFieldID == REPORT_TARGET_TYPE ) + { + // Set new OutputTarget + $this->_outputTarget = trim($tmpArray[1]); + } + else + { + // Set into Details Array + $this->_arrOutputTargetDetails[$tmpFieldID] == trim($tmpArray[1]); + } + } + } } /* diff --git a/src/classes/reports/report.eventlog.monilog.class.php b/src/classes/reports/report.eventlog.monilog.class.php index 9eba1fc..aaafec3 100644 --- a/src/classes/reports/report.eventlog.monilog.class.php +++ b/src/classes/reports/report.eventlog.monilog.class.php @@ -286,15 +286,11 @@ class Report_monilog extends Report { } } } - - } // --- Private functions... - - /** * Helper function to consolidate events */ diff --git a/src/include/constants_logstream.php b/src/include/constants_logstream.php index 7cab322..d3682b6 100644 --- a/src/include/constants_logstream.php +++ b/src/include/constants_logstream.php @@ -90,6 +90,15 @@ define('ALIGN_RIGHT', 'right'); define('REPORT_OUTPUT_HTML', 'html'); define('REPORT_OUTPUT_PDF', 'pdf'); +// Defines for Report output targets +define('REPORT_TARGET_STDOUT', 'stdout'); +define('REPORT_TARGET_FILE', 'file'); +define('REPORT_TARGET_EMAIL', 'mail'); + +// Further helper defines for output targets +define('REPORT_TARGET_TYPE', 'type'); +define('REPORT_TARGET_FILENAME', 'filename'); + // Defines for sorting define('SORTING_ORDER_ASC', 'asc'); define('SORTING_ORDER_DESC', 'desc'); diff --git a/src/include/functions_common.php b/src/include/functions_common.php index 08deff6..7e4981e 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -412,6 +412,26 @@ function CreateOutputformatList( $selectedOutputformat ) if ( $selectedOutputformat == $content['OUTPUTFORMATS'][REPORT_OUTPUT_PDF]['formatid'] ) { $content['OUTPUTFORMATS'][REPORT_OUTPUT_PDF]['formatselected'] = "selected"; } else { $content['OUTPUTFORMATS'][REPORT_OUTPUT_PDF]['formatselected'] = ""; } } +function CreateOutputtargetList( $selectedOutputtarget ) +{ + global $content; + + // REPORT_TARGET_STDOUT + $content['OUTPUTTARGETS'][REPORT_TARGET_STDOUT]['targetid'] = REPORT_TARGET_STDOUT; + $content['OUTPUTTARGETS'][REPORT_TARGET_STDOUT]['targetdisplayname'] = $content['LN_GEN_REPORT_TARGET_STDOUT']; + if ( $selectedOutputtarget == $content['OUTPUTTARGETS'][REPORT_TARGET_STDOUT]['targetid'] ) { $content['OUTPUTTARGETS'][REPORT_TARGET_STDOUT]['targetselected'] = "selected"; } else { $content['OUTPUTTARGETS'][REPORT_TARGET_STDOUT]['targetselected'] = ""; } + + // REPORT_TARGET_FILE + $content['OUTPUTTARGETS'][REPORT_TARGET_FILE]['targetid'] = REPORT_TARGET_FILE; + $content['OUTPUTTARGETS'][REPORT_TARGET_FILE]['targetdisplayname'] = $content['LN_GEN_REPORT_TARGET_FILE']; + if ( $selectedOutputtarget == $content['OUTPUTTARGETS'][REPORT_TARGET_FILE]['targetid'] ) { $content['OUTPUTTARGETS'][REPORT_TARGET_FILE]['targetselected'] = "selected"; } else { $content['OUTPUTTARGETS'][REPORT_TARGET_FILE]['targetselected'] = ""; } + +// // REPORT_TARGET_EMAIL +// $content['OUTPUTTARGETS'][REPORT_TARGET_EMAIL]['targetid'] = REPORT_TARGET_EMAIL; +// $content['OUTPUTTARGETS'][REPORT_TARGET_EMAIL]['targetdisplayname'] = $content['LN_GEN_REPORT_TARGET_EMAIL']; +// if ( $selectedOutputtarget == $content['OUTPUTTARGETS'][REPORT_TARGET_EMAIL]['targetid'] ) { $content['OUTPUTTARGETS'][REPORT_TARGET_EMAIL]['targetselected'] = "selected"; } else { $content['OUTPUTTARGETS'][REPORT_TARGET_EMAIL]['targetselected'] = ""; } +} + function CreatePagesizesList() { global $content; diff --git a/src/lang/en/admin.php b/src/lang/en/admin.php index 01ac1c5..4e6daa9 100644 --- a/src/lang/en/admin.php +++ b/src/lang/en/admin.php @@ -411,6 +411,7 @@ $content['LN_REPORTS_CUSTOMTITLE'] = "Report Title"; $content['LN_REPORTS_CUSTOMCOMMENT'] = "Comment / Description"; $content['LN_REPORTS_FILTERSTRING'] = "Filterstring"; $content['LN_REPORTS_OUTPUTFORMAT'] = "Outputformat"; +$content['LN_REPORTS_OUTPUTTARGET'] = "Outputtarget"; $content['LN_REPORTS_HASBEENADDED'] = "The Savedreport '%1' has been successfully added."; $content['LN_REPORTS_HASBEENEDIT'] = "The Savedreport '%1' has been successfully edited."; $content['LN_REPORTS_SOURCEID'] = "Logstream source"; diff --git a/src/lang/en/main.php b/src/lang/en/main.php index 0eb5372..03941cf 100644 --- a/src/lang/en/main.php +++ b/src/lang/en/main.php @@ -104,7 +104,9 @@ $content['LN_ERROR_DB_DBFIELDNOTFOUND'] = "Database Field mapping for at least o $content['LN_DEBUGMESSAGE'] = "Debug Message"; $content['LN_GEN_REPORT_OUTPUT_HTML'] = "HTML Format"; $content['LN_GEN_REPORT_OUTPUT_PDF'] = "PDF Format"; - + $content['LN_GEN_REPORT_TARGET_STDOUT'] = "Direct Output"; + $content['LN_GEN_REPORT_TARGET_FILE'] = "Save into File"; + $content['LN_GEN_REPORT_TARGET_EMAIL'] = "Send as Email"; // Topmenu Entries $content['LN_MENU_SEARCH'] = "Search"; diff --git a/src/templates/admin/admin_reports.html b/src/templates/admin/admin_reports.html index 3b6c381..11935f5 100644 --- a/src/templates/admin/admin_reports.html +++ b/src/templates/admin/admin_reports.html @@ -254,6 +254,16 @@ +