2008-08-19 Esteban Sanchez <estebans@artica.es>

* include/locale.class.php: Fixes in Translate_Locale() to work
        properly. Tab style correction in all the file, use tabs instead of
        blankspaces.

        * godmode/setup/setup.php: Added locale configuration option.

        * pandoradb_data.sql: Added locale to tconfig.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1013 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
esanchezm 2008-08-20 09:19:27 +00:00
parent 85a10ec9ab
commit b1c689f17b
4 changed files with 497 additions and 474 deletions

View File

@ -1,3 +1,13 @@
2008-08-19 Esteban Sanchez <estebans@artica.es>
* include/locale.class.php: Fixes in Translate_Locale() to work
properly. Tab style correction in all the file, use tabs instead of
blankspaces.
* godmode/setup/setup.php: Added locale configuration option.
* pandoradb_data.sql: Added locale to tconfig.
2008-08-19 Esteban Sanchez <estebans@artica.es> 2008-08-19 Esteban Sanchez <estebans@artica.es>
* include/locale.class.php: Check $ENV["TMPDIR"] existance to avoid * include/locale.class.php: Check $ENV["TMPDIR"] existance to avoid

View File

@ -45,6 +45,7 @@ if ($update_settings) {
$config["graph_color2"] = (string) get_parameter ('graph_color2'); $config["graph_color2"] = (string) get_parameter ('graph_color2');
$config["graph_color3"] = (string) get_parameter ('graph_color3'); $config["graph_color3"] = (string) get_parameter ('graph_color3');
$config["sla_period"] = (int) get_parameter ("sla_period"); $config["sla_period"] = (int) get_parameter ("sla_period");
$config["locale"] = (string) get_parameter ("locale");
$config["style"] = substr ($config["style"], 0, strlen ($config["style"]) - 4); $config["style"] = substr ($config["style"], 0, strlen ($config["style"]) - 4);
process_sql ("UPDATE tconfig SET VALUE='".$config["remote_config"]."' WHERE token = 'remote_config'"); process_sql ("UPDATE tconfig SET VALUE='".$config["remote_config"]."' WHERE token = 'remote_config'");
@ -61,6 +62,7 @@ if ($update_settings) {
process_sql ("UPDATE tconfig SET VALUE='".$config["graph_color2"]."' WHERE token = 'graph_color2'"); process_sql ("UPDATE tconfig SET VALUE='".$config["graph_color2"]."' WHERE token = 'graph_color2'");
process_sql ("UPDATE tconfig SET VALUE='".$config["graph_color3"]."' WHERE token = 'graph_color3'"); process_sql ("UPDATE tconfig SET VALUE='".$config["graph_color3"]."' WHERE token = 'graph_color3'");
process_sql ("UPDATE tconfig SET VALUE='".$config["sla_period"]."' WHERE token = 'sla_period'"); process_sql ("UPDATE tconfig SET VALUE='".$config["sla_period"]."' WHERE token = 'sla_period'");
process_sql ("UPDATE tconfig SET VALUE='".$config["locale"]."' WHERE token = 'locale'");
} }
echo "<h2>".__('Pandora Setup')." &gt; "; echo "<h2>".__('Pandora Setup')." &gt; ";
@ -72,32 +74,40 @@ $table->width = '500px';
$table->data = array (); $table->data = array ();
$table->data[0][0] = __('Language Code for Pandora'); $table->data[0][0] = __('Language Code for Pandora');
$table->data[0][1] = print_select_from_sql ('SELECT id_language, name FROM tlanguage', 'language_code', $config["language"], '', '', '', true); $table->data[0][1] = print_select_from_sql ('SELECT id_language, name FROM tlanguage', 'language_code', $config["language"], '', '', '', true);
$table->data[1][0] = __('Remote config directory'); if (isset ($LOCALE)) {
$table->data[1][1] = print_input_text ('remote_config', $config["remote_config"], '', 30, 100, true); $locales = array ();
$table->data[2][0] = __('Graph color (min)'); foreach ($LOCALE->Get_Locales_Array () as $locale) {
$table->data[2][1] = print_input_text ('graph_color1', $config["graph_color1"], '', 8, 8, true); $locales[$locale] = $LOCALE->Translate_Locale ($locale);
$table->data[3][0] = __('Graph color (avg)'); }
$table->data[3][1] = print_input_text ('graph_color2', $config["graph_color2"], '', 8, 8, true); $table->data[1][0] = __('Locale');
$table->data[4][0] = __('Graph color (max)'); $table->data[1][1] = print_select ($locales, 'locale', $config["locale"], '', '', '', true);
$table->data[4][1] = print_input_text ('graph_color3', $config["graph_color3"], '', 8, 8, true); }
$table->data[5][0] = __('SLA period'); $table->data[2][0] = __('Remote config directory');
$table->data[5][1] = print_input_text ('sla_period', $config["sla_period"], '', 5, 5, true); $table->data[2][1] = print_input_text ('remote_config', $config["remote_config"], '', 30, 100, true);
$table->data[5][0] = __('Max. days before compact data'); $table->data[3][0] = __('Graph color (min)');
$table->data[5][1] = print_input_text ('days_compact', $config["days_compact"], '', 5, 5, true); $table->data[3][1] = print_input_text ('graph_color1', $config["graph_color1"], '', 8, 8, true);
$table->data[6][0] = __('Max. days before purge'); $table->data[4][0] = __('Graph color (avg)');
$table->data[6][1] = print_input_text ('days_purge', $config["days_purge"], '', 5, 5, true); $table->data[4][1] = print_input_text ('graph_color2', $config["graph_color2"], '', 8, 8, true);
$table->data[7][0] = __('Graphic resolution (1-low, 5-high)'); $table->data[5][0] = __('Graph color (max)');
$table->data[7][1] = print_input_text ('graph_res', $config["graph_res"], '', 5, 5, true); $table->data[5][1] = print_input_text ('graph_color3', $config["graph_color3"], '', 8, 8, true);
$table->data[8][0] = __('Compact interpolation in hours (1 Fine-20 bad)'); $table->data[6][0] = __('SLA period');
$table->data[8][1] = print_input_text ('step_compact', $config["step_compact"], '', 5, 5, true); $table->data[6][1] = print_input_text ('sla_period', $config["sla_period"], '', 5, 5, true);
$table->data[9][0] = __('Show unknown modules in global view'); $table->data[6][0] = __('Max. days before compact data');
$table->data[9][1] = print_checkbox ('show_unknown', 1, $config["show_unknown"], true); $table->data[6][1] = print_input_text ('days_compact', $config["days_compact"], '', 5, 5, true);
$table->data[10][0] = __('Show last fired alerts in global view'); $table->data[7][0] = __('Max. days before purge');
$table->data[10][1] = print_checkbox ('show_lastalerts', 1, $config["show_lastalerts"], true); $table->data[7][1] = print_input_text ('days_purge', $config["days_purge"], '', 5, 5, true);
$table->data[11][0] = __('Style template'); $table->data[8][0] = __('Graphic resolution (1-low, 5-high)');
$table->data[11][1] = print_select ($file_styles, 'style', $config["style"], '', '', '', true); $table->data[8][1] = print_input_text ('graph_res', $config["graph_res"], '', 5, 5, true);
$table->data[12][0] = __('Block size for pagination'); $table->data[9][0] = __('Compact interpolation in hours (1 Fine-20 bad)');
$table->data[12][1] = print_input_text ('block_size', $config["block_size"], '', 5, 5, true); $table->data[9][1] = print_input_text ('step_compact', $config["step_compact"], '', 5, 5, true);
$table->data[10][0] = __('Show unknown modules in global view');
$table->data[10][1] = print_checkbox ('show_unknown', 1, $config["show_unknown"], true);
$table->data[11][0] = __('Show last fired alerts in global view');
$table->data[11][1] = print_checkbox ('show_lastalerts', 1, $config["show_lastalerts"], true);
$table->data[12][0] = __('Style template');
$table->data[12][1] = print_select ($file_styles, 'style', $config["style"], '', '', '', true);
$table->data[13][0] = __('Block size for pagination');
$table->data[13][1] = print_input_text ('block_size', $config["block_size"], '', 5, 5, true);
echo '<form id="form_setup" method="POST" action="index.php?sec=gsetup&amp;sec2=godmode/setup/setup">'; echo '<form id="form_setup" method="POST" action="index.php?sec=gsetup&amp;sec2=godmode/setup/setup">';
print_input_hidden ('update_settings', 1); print_input_hidden ('update_settings', 1);

View File

@ -740,11 +740,13 @@ class Set_Locale {
if($locale == "UTF-8" || $locale == "C" || $locale == "POSIX") { if($locale == "UTF-8" || $locale == "C" || $locale == "POSIX") {
return $locale; //Pure UTF-8, C or POSIX is not localized to a country return $locale; //Pure UTF-8, C or POSIX is not localized to a country
} }
$lang_cntr = split("_",$langcntr_char[0]);
$lang = $lang_cntr[0]; $lang_country = split ("_",$locale);
$cntr = $lang_cntr[1]; $lang = $lang_country[0];
$char = $langcntr_char[1]; $country_char = split ("\.",$lang_country[1]);
unset ($langcntr_char, $lang_cntr); $cntr = isset($country_char[0]) ? $country_char[0] : "";
$char = isset($country_char[1]) ? $country_char[1] : "";
unset ($lang_country, $country_char);
if (in_array($lang,array_keys($this->lang_codes))) { if (in_array($lang,array_keys($this->lang_codes))) {
$lang = $this->lang_codes[$lang]; $lang = $this->lang_codes[$lang];

View File

@ -59,7 +59,8 @@ INSERT INTO `tconfig` VALUES
(17, 'graph_color1', '#38B800'), (17, 'graph_color1', '#38B800'),
(18, 'graph_color2', '#42D100'), (18, 'graph_color2', '#42D100'),
(19, 'graph_color3', '#89FF09'), (19, 'graph_color3', '#89FF09'),
(20, 'sla_period', '604800'); (20, 'sla_period', '604800'),
(21, 'locale', 'C'),;
UNLOCK TABLES; UNLOCK TABLES;
-- --