Further report admin enhancements made

This commit is contained in:
Andre Lorbach 2009-08-24 16:46:03 +02:00
parent ff88bd8f8a
commit 8596a056a7
5 changed files with 82 additions and 55 deletions

View File

@ -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;
$content['InitEnabled'] = false;
$content['DeleteEnabled'] = true;
}
else
{
$content['ParserDeleteEnabled'] = true;
break;
$content['InitEnabled'] = true;
$content['DeleteEnabled'] = false;
}
}
}
*/
}
else
@ -262,26 +255,23 @@ if ( !isset($_POST['op']) && !isset($_GET['op']) )
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;
$myReport['InitEnabled'] = false;
$myReport['DeleteEnabled'] = true;
}
else
{
$myParser['ParserDeleteEnabled'] = true;
break;
$myReport['InitEnabled'] = true;
$myReport['DeleteEnabled'] = false;
}
}
}
*/
// --- Set CSS Class
if ( $i % 2 == 0 )

View File

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

View File

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

View File

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

View File

@ -43,12 +43,14 @@
<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 ReportInitEnabled="true" -->
&nbsp;<a href="{BASEPATH}admin/reports.php?op=initreport&id={ID}"><img src="{MENU_REPORT_INIT}" width="16" title="{LN_REPORTS_INIT}"></a>
<!-- ENDIF ReportInitEnabled="true" -->
<!-- IF ReportDeleteEnabled="true" -->
&nbsp;<a href="{BASEPATH}admin/reports.php?op=removereport&id={ID}"><img src="{MENU_REPORT_DELETE}" width="16" title="{LN_REPORTS_REMOVE}"></a>
<!-- ENDIF ReportDeleteEnabled="true" -->
<!-- IF EnableNeedsInit="true" -->
<!-- IF InitEnabled="true" -->
&nbsp;<a href="{BASEPATH}admin/reports.php?op=initreport&id={ID}"><img src="{MENU_PARSER_INIT}" width="16" title="{LN_REPORTS_INIT}"></a>
<!-- ENDIF InitEnabled="true" -->
<!-- IF DeleteEnabled="true" -->
&nbsp;<a href="{BASEPATH}admin/reports.php?op=removereport&id={ID}"><img src="{MENU_PARSER_DELETE}" width="16" title="{LN_REPORTS_REMOVE}"></a>
<!-- ENDIF DeleteEnabled="true" -->
<!-- ENDIF EnableNeedsInit="true" -->
</td>
</tr>
<!-- END REPORTS -->
@ -72,33 +74,24 @@
<td align="left" class="cellmenu2_naked" valign="top"><b>{LN_REPORTS_DESCRIPTION}</b></td>
<td align="left" class="line1">{Description}</td>
</tr>
<!-- IF EnableCustomSettings="true" -->
<tr>
<td align="left" class="cellmenu2_naked" valign="top"><b>{LN_REPORTS_CUSTOMSETTINGS}</b></td>
<td align="left" class="line1">
<!-- BEGIN CustomFieldsList -->
<br><B>{FieldCaption}</B> ({FieldDefine})
<!-- END CustomFieldsList -->
<br><br>
</td>
</tr>
<!-- ENDIF EnableCustomSettings="true" -->
<!-- IF EnableHelpArticle="true" -->
<tr>
<td align="left" class="cellmenu2"><b>{LN_REPORTS_HELP}</b></td>
<td align="center" class="line2"><a href="{ReportHelpArticle}" target="_blank">{LN_REPORTS_HELP_CLICK}</a></td>
</tr>
<!-- ENDIF EnableHelpArticle="true" -->
<!-- IF EnableNeedsInit="true" -->
<tr>
<td align="center" class="tableBackground" colspan="2">
<!-- IF ReportInitEnabled="true" -->
<!-- IF InitEnabled="true" -->
<a href="{BASEPATH}admin/reports.php?op=initreport&id={ReportID}"><img src="{MENU_PARSER_INIT}" width="16" title="{LN_REPORTS_INIT}"> {LN_REPORTS_INIT}</a>
<!-- ENDIF ReportInitEnabled="true" -->
<!-- IF ReportDeleteEnabled="true" -->
<!-- ENDIF InitEnabled="true" -->
<!-- IF DeleteEnabled="true" -->
<a href="{BASEPATH}admin/reports.php?op=removereport&id={ReportID}"><img src="{MENU_PARSER_DELETE}" width="16" title="{LN_REPORTS_REMOVE}"> {LN_REPORTS_REMOVE}</a>
<!-- ENDIF ReportDeleteEnabled="true" -->
<!-- ENDIF DeleteEnabled="true" -->
</td>
</tr>
<!-- ENDIF EnableNeedsInit="true" -->
</table>
<br><br>