Charts can now be enabled / deactivated by one click in Chartsadmin

This commit is contained in:
Andre Lorbach 2011-02-11 10:23:41 +01:00
parent d0af267fbb
commit a54591535c
7 changed files with 66 additions and 4 deletions

View File

@ -62,6 +62,13 @@ if ( !isset($_SESSION['SESSION_ISREADONLY']) || $_SESSION['SESSION_ISREADONLY']
$_GET['op'] == "add" || $_GET['op'] == "add" ||
$_GET['op'] == "delete" $_GET['op'] == "delete"
) )
||
( isset($_GET['miniop']) &&
(
$_GET['miniop'] == "setenabled"
)
)
) )
) )
DieWithFriendlyErrorMsg( $content['LN_ADMIN_ERROR_READONLY'] ); DieWithFriendlyErrorMsg( $content['LN_ADMIN_ERROR_READONLY'] );
@ -77,6 +84,47 @@ else
$content['READONLY_ISUSERONLY'] = ""; $content['READONLY_ISUSERONLY'] = "";
// --- // ---
if ( isset($_GET['miniop']) )
{
if ( isset($_GET['id']) && isset($_GET['newval']) )
{
if ( $_GET['miniop'] == "setenabled" )
{
//PreInit these values
$content['CHARTID'] = intval(DB_RemoveBadChars($_GET['id']));
$iNewVal = intval(DB_RemoveBadChars($_GET['newval']));
// Perform SQL Query!
$sqlquery = "SELECT * " .
" FROM " . DB_CHARTS .
" WHERE ID = " . $content['CHARTID'];
$result = DB_Query($sqlquery);
$mychart = DB_GetSingleRow($result, true);
if ( isset($mychart['DisplayName']) )
{
// Update enabled setting!
$result = DB_Query("UPDATE " . DB_CHARTS . " SET
chart_enabled = $iNewVal
WHERE ID = " . $content['CHARTID']);
DB_FreeQuery($result);
// Reload Charts from DB
LoadChartsFromDatabase();
}
else
{
$content['ISERROR'] = true;
$content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_CHARTS_ERROR_CHARTIDNOTFOUND'], $content['CHARTID'] );
}
}
}
else
{
$content['ISERROR'] = true;
$content['ERROR_MSG'] = $content['LN_CHARTS_ERROR_SETTINGFLAG'];
}
}
if ( isset($_GET['op']) ) if ( isset($_GET['op']) )
{ {
if ($_GET['op'] == "add") if ($_GET['op'] == "add")
@ -439,9 +487,17 @@ if ( !isset($_POST['op']) && !isset($_GET['op']) )
// --- Set enabled or disabled state // --- Set enabled or disabled state
if ( $myChart['chart_enabled'] == 1 ) if ( $myChart['chart_enabled'] == 1 )
{
$myChart['ChartEnabledImage'] = $content["MENU_SELECTION_ENABLED"]; $myChart['ChartEnabledImage'] = $content["MENU_SELECTION_ENABLED"];
$myChart['set_enabled'] = 0;
}
else else
{
$myChart['ChartEnabledImage'] = $content["MENU_SELECTION_DISABLED"]; $myChart['ChartEnabledImage'] = $content["MENU_SELECTION_DISABLED"];
$myChart['set_enabled'] = 1;
}
// --- // ---
// --- Set Chart default Filterstring // --- Set Chart default Filterstring

View File

@ -66,7 +66,7 @@ $LANG_EN = "en"; // Used for fallback
$LANG = "en"; // Default language $LANG = "en"; // Default language
// Default Template vars // Default Template vars
$content['BUILDNUMBER'] = "3.0.5"; $content['BUILDNUMBER'] = "3.0.6";
$content['UPDATEURL'] = "http://loganalyzer.adiscon.com/files/version.txt"; $content['UPDATEURL'] = "http://loganalyzer.adiscon.com/files/version.txt";
$content['TITLE'] = "Adiscon LogAnalyzer :: Release " . $content['BUILDNUMBER']; // Default page title $content['TITLE'] = "Adiscon LogAnalyzer :: Release " . $content['BUILDNUMBER']; // Default page title
$content['BASEPATH'] = $gl_root_path; $content['BASEPATH'] = $gl_root_path;

View File

@ -315,6 +315,8 @@ $content['LN_CHARTS_ERROR_DELCHART'] = "Löschen des Chart mit der id '%1' f
$content['LN_CHARTS_ERROR_HASBEENDEL'] = "Der Chart '%1' wurde erfolgreich gelöscht!"; $content['LN_CHARTS_ERROR_HASBEENDEL'] = "Der Chart '%1' wurde erfolgreich gelöscht!";
$content['LN_CHARTS_FILTERSTRING'] = "Custom Filter"; $content['LN_CHARTS_FILTERSTRING'] = "Custom Filter";
$content['LN_CHARTS_FILTERSTRING_HELP'] = "Use the same syntax as in the search field. For example if you want to generate a chart for 'server1', use this filter: source:=server1"; $content['LN_CHARTS_FILTERSTRING_HELP'] = "Use the same syntax as in the search field. For example if you want to generate a chart for 'server1', use this filter: source:=server1";
$content['LN_CHARTS_ERROR_CHARTIDNOTFOUND'] = "Error, ChartID with ID '%1' , was not found";
$content['LN_CHARTS_ERROR_SETTINGFLAG'] = "Error setting flag, invalid ChartID or operation.";
// Fields Options // Fields Options
$content['LN_FIELDS_CENTER'] = "Feld Options"; $content['LN_FIELDS_CENTER'] = "Feld Options";

View File

@ -315,7 +315,6 @@ $content['LN_CHARTS_NAME'] = "Chart Name";
$content['LN_CHARTS_ENABLED'] = "Chart enabled"; $content['LN_CHARTS_ENABLED'] = "Chart enabled";
$content['LN_CHARTS_ENABLEDONLY'] = "Enabled"; $content['LN_CHARTS_ENABLEDONLY'] = "Enabled";
$content['LN_CHARTS_ERROR_INVALIDORNOTFOUNDID'] = "The Chart-ID is invalid or could not be found."; $content['LN_CHARTS_ERROR_INVALIDORNOTFOUNDID'] = "The Chart-ID is invalid or could not be found.";
$content['LN_CHARTS_ERROR_IDNOTFOUND'] = "The Chart-ID could not be found in the database.";
$content['LN_CHARTS_WARNDELETESEARCH'] = "Are you sure that you want to delete the Chart '%1'? This cannot be undone!"; $content['LN_CHARTS_WARNDELETESEARCH'] = "Are you sure that you want to delete the Chart '%1'? This cannot be undone!";
$content['LN_CHARTS_ERROR_DELCHART'] = "Deleting of the Chart with id '%1' failed!"; $content['LN_CHARTS_ERROR_DELCHART'] = "Deleting of the Chart with id '%1' failed!";
$content['LN_CHARTS_ERROR_HASBEENDEL'] = "The Chart '%1' has been successfully deleted!"; $content['LN_CHARTS_ERROR_HASBEENDEL'] = "The Chart '%1' has been successfully deleted!";
@ -328,7 +327,8 @@ $content['LN_CHARTS_ASSIGNTO'] = "Assigned To";
$content['LN_CHARTS_PREVIEW'] = "Preview Chart in a new Window"; $content['LN_CHARTS_PREVIEW'] = "Preview Chart in a new Window";
$content['LN_CHARTS_FILTERSTRING'] = "Custom Filter"; $content['LN_CHARTS_FILTERSTRING'] = "Custom Filter";
$content['LN_CHARTS_FILTERSTRING_HELP'] = "Use the same syntax as in the search field. For example if you want to generate a chart for 'server1', use this filter: source:=server1"; $content['LN_CHARTS_FILTERSTRING_HELP'] = "Use the same syntax as in the search field. For example if you want to generate a chart for 'server1', use this filter: source:=server1";
$content['LN_CHARTS_ERROR_CHARTIDNOTFOUND'] = "Error, ChartID with ID '%1' , was not found";
$content['LN_CHARTS_ERROR_SETTINGFLAG'] = "Error setting flag, invalid ChartID or operation.";
// Fields Options // Fields Options
$content['LN_FIELDS_CENTER'] = "Fields Options"; $content['LN_FIELDS_CENTER'] = "Fields Options";

View File

@ -326,6 +326,8 @@ $content['LN_CHARTS_ASSIGNTO'] = "Assigned To";
$content['LN_CHARTS_PREVIEW'] = "Preview Chart in a new Window"; $content['LN_CHARTS_PREVIEW'] = "Preview Chart in a new Window";
$content['LN_CHARTS_FILTERSTRING'] = "Custom Filter"; $content['LN_CHARTS_FILTERSTRING'] = "Custom Filter";
$content['LN_CHARTS_FILTERSTRING_HELP'] = "Use the same syntax as in the search field. For example if you want to generate a chart for 'server1', use this filter: source:=server1"; $content['LN_CHARTS_FILTERSTRING_HELP'] = "Use the same syntax as in the search field. For example if you want to generate a chart for 'server1', use this filter: source:=server1";
$content['LN_CHARTS_ERROR_CHARTIDNOTFOUND'] = "Error, ChartID with ID '%1' , was not found";
$content['LN_CHARTS_ERROR_SETTINGFLAG'] = "Error setting flag, invalid ChartID or operation.";
// Fields Options // Fields Options
$content['LN_FIELDS_CENTER'] = "Fields Options"; $content['LN_FIELDS_CENTER'] = "Fields Options";

View File

@ -315,6 +315,8 @@ $content['LN_CHARTS_ERROR_DELCHART'] = "Deleting of the Chart with id '%1' faile
$content['LN_CHARTS_ERROR_HASBEENDEL'] = "The Chart '%1' has been successfully deleted!"; $content['LN_CHARTS_ERROR_HASBEENDEL'] = "The Chart '%1' has been successfully deleted!";
$content['LN_CHARTS_FILTERSTRING'] = "Custom Filter"; $content['LN_CHARTS_FILTERSTRING'] = "Custom Filter";
$content['LN_CHARTS_FILTERSTRING_HELP'] = "Use the same syntax as in the search field. For example if you want to generate a chart for 'server1', use this filter: source:=server1"; $content['LN_CHARTS_FILTERSTRING_HELP'] = "Use the same syntax as in the search field. For example if you want to generate a chart for 'server1', use this filter: source:=server1";
$content['LN_CHARTS_ERROR_CHARTIDNOTFOUND'] = "Error, ChartID with ID '%1' , was not found";
$content['LN_CHARTS_ERROR_SETTINGFLAG'] = "Error setting flag, invalid ChartID or operation.";
// Fields Options // Fields Options
$content['LN_FIELDS_CENTER'] = "Fields Options"; $content['LN_FIELDS_CENTER'] = "Fields Options";

View File

@ -42,7 +42,7 @@
<b>{DisplayName}</b> <b>{DisplayName}</b>
<!-- ENDIF ActionsAllowed!="true" --> <!-- ENDIF ActionsAllowed!="true" -->
</td> </td>
<td align="center" class="{cssclass}"><img src="{ChartEnabledImage}" width="16" align="center"></td> <td align="center" class="{cssclass}"><a href="{BASEPATH}admin/charts.php?miniop=setenabled&id={ID}&newval={set_enabled}"><img src="{ChartEnabledImage}" width="16" align="center"></a></td>
<td align="left" class="{cssclass}"><img src="{ChartTypeImage}" width="16" align="left"> <b>{ChartTypeText}</b></td> <td align="left" class="{cssclass}"><img src="{ChartTypeImage}" width="16" align="left"> <b>{ChartTypeText}</b></td>
<td align="left" class="{cssclass}"><img src="{ChartAssignedToImage}" width="16" align="left"> <b>{ChartAssignedToText}</b></td> <td align="left" class="{cssclass}"><img src="{ChartAssignedToImage}" width="16" align="left"> <b>{ChartAssignedToText}</b></td>
<td align="center" class="{cssclass}"> <td align="center" class="{cssclass}">