diff --git a/ChangeLog b/ChangeLog index ee7a8db0b..63f8cd193 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,10 @@ phpMyAdmin - ChangeLog $Id$ $Source$ +2006-07-31 Sebastian Mendel + * css\phpmyadmin.css.php, libraries\Config.class.php, main.php, + themes\*: make font size user configurable + 2006-07-30 Marc Delisle * libraries/sqlparser.lib.php: bug #1526000, copy table on MySQL 5.0.23+, thanks to Rapsys Phoenix - rapsys @@ -21,9 +25,9 @@ $Source$ bug #1521910, with selected ... print view 2006-07-26 Marc Delisle - * server_privileges.php: bug #1526557, display error when admin + * server_privileges.php: bug #1526557, display error when admin lacks some privileges and tries to do a privilege change - * libraries/common.lib.php: bug #1523784, blank page after Edit + * libraries/common.lib.php: bug #1523784, blank page after Edit in IE6 via IIS 2006-07-22 Marc Delisle @@ -37,7 +41,7 @@ $Source$ * scripts/setup.php: Implement own var_export. 2006-07-19 Marc Delisle - * browse_foreigners.php: bug #1525393, no page selector in foreign key + * browse_foreigners.php: bug #1525393, no page selector in foreign key browse page 2006-07-19 Michal Čihař diff --git a/css/phpmyadmin.css.php b/css/phpmyadmin.css.php index 04b575a4f..30b378a2d 100644 --- a/css/phpmyadmin.css.php +++ b/css/phpmyadmin.css.php @@ -19,6 +19,14 @@ if ($GLOBALS['text_dir'] === 'ltr') { header('Content-Type: text/css; charset=ISO-8859-1'); ?> +html { + font-size: get('fontsize'); ?>; +} + +input, select, textarea { + font-size: 1em; +} + /* @deprecated */ .nowrap { white-space: nowrap; diff --git a/libraries/Config.class.php b/libraries/Config.class.php index a4aae21ce..cd5224402 100644 --- a/libraries/Config.class.php +++ b/libraries/Config.class.php @@ -309,6 +309,7 @@ class PMA_Config $this->checkIsHttps(); $this->checkCollationConnection(); + $this->checkFontsize(); } /** @@ -394,6 +395,7 @@ class PMA_Config } $this->checkCollationConnection(); + $this->checkFontsize(); //$this->checkPmaAbsoluteUri(); $this->settings = PMA_array_merge_recursive($this->settings, $cfg); return true; @@ -667,6 +669,29 @@ class PMA_Config } } + function checkFontsize() + { + $new_fontsize = ''; + + if (isset($_GET['fontsize'])) { + $new_fontsize = $_GET['fontsize']; + } elseif (isset($_POST['fontsize'])) { + $new_fontsize = $_POST['fontsize']; + } elseif (isset($_COOKIE['pma_fontsize'])) { + $new_fontsize = $_COOKIE['pma_fontsize']; + } + + if (preg_match('/^[0-9.]+(px|em|pt|\%)$/', $new_fontsize)) { + $this->set('fontsize', $new_fontsize); + } elseif (! $this->get('fontsize')) { + $this->set('fontsize', '100%'); + } + + if (function_exists('PMA_setCookie')) { + PMA_setCookie('pma_fontsize', $this->get('fontsize'), '100%'); + } + } + /** * checks if upload is enabled * @@ -835,5 +860,107 @@ class PMA_Config * @todo finish */ function save() {} + + /** + * returns options for font size selection + * + * @param string $current_size current selected font size with unit + * @return array selectable font sizes + */ + function getFontsizeOptions($current_size = '100%') + { + $unit = preg_replace('/[0-9.]*/', '', $current_size); + $value = preg_replace('/[^0-9.]*/', '', $current_size); + + $factors = array(); + $options = array(); + $options["$value"] = $value . $unit; + + if ($unit === '%') { + $factors[] = 1; + $factors[] = 5; + $factors[] = 10; + } elseif ($unit === 'em') { + $factors[] = 0.05; + $factors[] = 0.2; + $factors[] = 1; + } elseif ($unit === 'pt') { + $factors[] = 0.5; + $factors[] = 2; + } elseif ($unit === 'px') { + $factors[] = 1; + $factors[] = 5; + $factors[] = 10; + } else { + //unknown font size unit + $factors[] = 0.05; + $factors[] = 0.2; + $factors[] = 1; + $factors[] = 5; + $factors[] = 10; + } + + foreach ($factors as $key => $factor) { + $option_inc = $value + $factor; + $option_dec = $value - $factor; + while (count($options) < 21) { + $options["$option_inc"] = $option_inc . $unit; + if ($option_dec > $factors[0]) { + $options["$option_dec"] = $option_dec . $unit; + } + $option_inc += $factor; + $option_dec -= $factor; + if (isset($factors[$key + 1]) + && $option_inc >= $value + $factors[$key + 1]) { + break; + } + } + } + ksort($options); + return $options; + } + + /** + * returns html selectbox for font sizes + * + * @param string $current_size currently slected font size with unit + * @return string html selectbox + */ + function getFontsizeSelection() + { + $current_size = $_SESSION['PMA_Config']->get('fontsize'); + $options = PMA_Config::getFontsizeOptions($current_size); + + $return = '' . "\n"; + $return .= ''; + + return $return; + } + + /** + * return complete font size selection form + * + * @param string $current_size currently slected font size with unit + * @return string html selectbox + */ + function getFontsizeForm() + { + return '
' . "\n" + . PMA_generate_common_hidden_inputs() . "\n" + . PMA_Config::getFontsizeSelection() . "\n" + . '' . "\n" + . '
'; + } } ?> diff --git a/main.php b/main.php index 121fe4052..bbab48822 100644 --- a/main.php +++ b/main.php @@ -282,6 +282,9 @@ if ($GLOBALS['cfg']['ThemeManager']) { echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox(); echo ''; } +echo '
  • '; +echo PMA_Config::getFontsizeForm(); +echo '
  • '; PMA_printListItem($strPmaDocumentation, 'li_pma_docs', 'Documentation.html'); if ($cfg['ShowPhpInfo']) { diff --git a/themes/darkblue_orange/css/theme_right.css.php b/themes/darkblue_orange/css/theme_right.css.php index 3d3c21083..0aebb944e 100644 --- a/themes/darkblue_orange/css/theme_right.css.php +++ b/themes/darkblue_orange/css/theme_right.css.php @@ -6,30 +6,22 @@ ?> /******************************************************************************/ /* general tags */ - -* { - font-family: ; -} - -textarea { - font-family: ; -} - -body, table, tbody, tr, td { - font-size: ; -} -select, input, textarea { - font-size: 0.7em; -} - - body { + + font-family: ; + padding: 0; margin: 0.5em; color: ; background: ; } + +textarea, tt, pre, code { + font-family: ; +} + + h1 { font-size: 180%; font-weight: bold; diff --git a/themes/darkblue_orange/layout.inc.php b/themes/darkblue_orange/layout.inc.php index 63f103246..260a8ed82 100644 --- a/themes/darkblue_orange/layout.inc.php +++ b/themes/darkblue_orange/layout.inc.php @@ -53,7 +53,7 @@ $GLOBALS['cfg']['FontFamilyFixed'] = 'monospace'; * if not set the browser default will be used * (depending on browser, DTD and system settings) */ -$GLOBALS['cfg']['FontSize'] = '8pt'; +$GLOBALS['cfg']['FontSize'] = ''; /** * tables diff --git a/themes/original/css/theme_left.css.php b/themes/original/css/theme_left.css.php index ce114c82b..f7b7c64b1 100644 --- a/themes/original/css/theme_left.css.php +++ b/themes/original/css/theme_left.css.php @@ -6,20 +6,11 @@ if (!defined('PMA_MINIMUM_COMMON')) { ?> /******************************************************************************/ /* general tags */ - -* { - font-family: ; -} - -body, table, tbody, tr, td { - font-size: ; -} -select, input, textarea { - font-size: 0.7em; -} - body { + + font-family: ; + background: ; color: ; margin: 0; diff --git a/themes/original/css/theme_right.css.php b/themes/original/css/theme_right.css.php index 0d6ef3d6e..7faeb7cca 100644 --- a/themes/original/css/theme_right.css.php +++ b/themes/original/css/theme_right.css.php @@ -6,30 +6,22 @@ ?> /******************************************************************************/ /* general tags */ - -* { - font-family: ; -} - -textarea { - font-family: ; -} - -body, table, tbody, tr, td { - font-size: ; -} -select, input, textarea { - font-size: 0.7em; -} - - body { + + font-family: ; + padding: 0; margin: 0.5em; color: ; background: ; } + +textarea, tt, pre, code { + font-family: ; +} + + h1 { font-size: 140%; font-weight: bold;