Startded implementing Outputtarget stuff

This commit is contained in:
Andre Lorbach 2009-12-17 14:56:09 +01:00
parent 97380a1a9b
commit e490a1df1f
8 changed files with 85 additions and 13 deletions

View File

@ -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

View File

@ -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]);
}
}
}
}
/*

View File

@ -286,15 +286,11 @@ class Report_monilog extends Report {
}
}
}
}
// --- Private functions...
/**
* Helper function to consolidate events
*/

View File

@ -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');

View File

@ -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;

View File

@ -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";

View File

@ -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";

View File

@ -254,6 +254,16 @@
</select>
</td>
</tr>
<tr>
<td align="left" class="cellmenu2" width="150" nowrap><b>{LN_REPORTS_OUTPUTTARGET}</b></td>
<td align="left" class="line1" width="100%">
<select name="outputTarget" size="1" STYLE="width: 415px">
<!-- BEGIN OUTPUTTARGETS -->
<option value="{formatid}" {targetselected}>{targetdisplayname}</option>
<!-- END OUTPUTTARGETS -->
</select>
</td>
</tr>
<tr>
<td align="center" colspan="2">