From a54591535c18c5cf4e430f7f4ed3cb83821d24a1 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 11 Feb 2011 10:23:41 +0100 Subject: [PATCH] Charts can now be enabled / deactivated by one click in Chartsadmin --- src/admin/charts.php | 56 +++++++++++++++++++++++++++ src/include/functions_common.php | 2 +- src/lang/de/admin.php | 2 + src/lang/en/admin.php | 4 +- src/lang/it_IT/admin.php | 2 + src/lang/pt_BR/admin.php | 2 + src/templates/admin/admin_charts.html | 2 +- 7 files changed, 66 insertions(+), 4 deletions(-) diff --git a/src/admin/charts.php b/src/admin/charts.php index b4aed41..f52219b 100644 --- a/src/admin/charts.php +++ b/src/admin/charts.php @@ -62,6 +62,13 @@ if ( !isset($_SESSION['SESSION_ISREADONLY']) || $_SESSION['SESSION_ISREADONLY'] $_GET['op'] == "add" || $_GET['op'] == "delete" ) + || + ( isset($_GET['miniop']) && + ( + $_GET['miniop'] == "setenabled" + ) + ) + ) ) DieWithFriendlyErrorMsg( $content['LN_ADMIN_ERROR_READONLY'] ); @@ -77,6 +84,47 @@ else $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 ($_GET['op'] == "add") @@ -439,9 +487,17 @@ if ( !isset($_POST['op']) && !isset($_GET['op']) ) // --- Set enabled or disabled state if ( $myChart['chart_enabled'] == 1 ) + { $myChart['ChartEnabledImage'] = $content["MENU_SELECTION_ENABLED"]; + $myChart['set_enabled'] = 0; + } else + { $myChart['ChartEnabledImage'] = $content["MENU_SELECTION_DISABLED"]; + $myChart['set_enabled'] = 1; + } + + // --- // --- Set Chart default Filterstring diff --git a/src/include/functions_common.php b/src/include/functions_common.php index d1ec6fa..5b12c8e 100644 --- a/src/include/functions_common.php +++ b/src/include/functions_common.php @@ -66,7 +66,7 @@ $LANG_EN = "en"; // Used for fallback $LANG = "en"; // Default language // Default Template vars -$content['BUILDNUMBER'] = "3.0.5"; +$content['BUILDNUMBER'] = "3.0.6"; $content['UPDATEURL'] = "http://loganalyzer.adiscon.com/files/version.txt"; $content['TITLE'] = "Adiscon LogAnalyzer :: Release " . $content['BUILDNUMBER']; // Default page title $content['BASEPATH'] = $gl_root_path; diff --git a/src/lang/de/admin.php b/src/lang/de/admin.php index 8ae84b7..5a0e130 100644 --- a/src/lang/de/admin.php +++ b/src/lang/de/admin.php @@ -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_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_ERROR_CHARTIDNOTFOUND'] = "Error, ChartID with ID '%1' , was not found"; +$content['LN_CHARTS_ERROR_SETTINGFLAG'] = "Error setting flag, invalid ChartID or operation."; // Fields Options $content['LN_FIELDS_CENTER'] = "Feld Options"; diff --git a/src/lang/en/admin.php b/src/lang/en/admin.php index 2f75175..e4205c6 100644 --- a/src/lang/en/admin.php +++ b/src/lang/en/admin.php @@ -315,7 +315,6 @@ $content['LN_CHARTS_NAME'] = "Chart Name"; $content['LN_CHARTS_ENABLED'] = "Chart 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_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_ERROR_DELCHART'] = "Deleting of the Chart with id '%1' failed!"; $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_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_ERROR_CHARTIDNOTFOUND'] = "Error, ChartID with ID '%1' , was not found"; +$content['LN_CHARTS_ERROR_SETTINGFLAG'] = "Error setting flag, invalid ChartID or operation."; // Fields Options $content['LN_FIELDS_CENTER'] = "Fields Options"; diff --git a/src/lang/it_IT/admin.php b/src/lang/it_IT/admin.php index 96eca62..12755c8 100644 --- a/src/lang/it_IT/admin.php +++ b/src/lang/it_IT/admin.php @@ -326,6 +326,8 @@ $content['LN_CHARTS_ASSIGNTO'] = "Assigned To"; $content['LN_CHARTS_PREVIEW'] = "Preview Chart in a new Window"; $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_ERROR_CHARTIDNOTFOUND'] = "Error, ChartID with ID '%1' , was not found"; +$content['LN_CHARTS_ERROR_SETTINGFLAG'] = "Error setting flag, invalid ChartID or operation."; // Fields Options $content['LN_FIELDS_CENTER'] = "Fields Options"; diff --git a/src/lang/pt_BR/admin.php b/src/lang/pt_BR/admin.php index a1f117d..102361a 100644 --- a/src/lang/pt_BR/admin.php +++ b/src/lang/pt_BR/admin.php @@ -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_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_ERROR_CHARTIDNOTFOUND'] = "Error, ChartID with ID '%1' , was not found"; +$content['LN_CHARTS_ERROR_SETTINGFLAG'] = "Error setting flag, invalid ChartID or operation."; // Fields Options $content['LN_FIELDS_CENTER'] = "Fields Options"; diff --git a/src/templates/admin/admin_charts.html b/src/templates/admin/admin_charts.html index ceb9e63..f7da9f8 100644 --- a/src/templates/admin/admin_charts.html +++ b/src/templates/admin/admin_charts.html @@ -42,7 +42,7 @@ {DisplayName} - + {ChartTypeText} {ChartAssignedToText}