Merge remote-tracking branch 'origin/master'

This commit is contained in:
Michal Čihař 2012-05-29 15:46:07 +02:00
commit 6f136e4d2a
4 changed files with 110 additions and 103 deletions

View File

@ -75,6 +75,7 @@ class PMA_Theme
'navigation',
'pmd',
'rte',
'codemirror',
'jqplot'
);
@ -451,6 +452,23 @@ class PMA_Theme
: '';
}
/**
* Gets currently configured font size.
*
* @return String with font size.
*/
function getFontSize()
{
$fs = $GLOBALS['PMA_Config']->get('fontsize');
if (!is_null($fs)) {
return $fs;
}
if (isset($_COOKIE['pma_fontsize'])) {
return $_COOKIE['pma_fontsize'];
}
return '82%';
}
/**
* Generates code for CSS gradient using various browser extensions.
*
@ -485,11 +503,9 @@ class PMA_Theme
/**
* Returns CSS styles for CodeMirror editor based on query formatter colors.
*
* @param boolean $generic Whether to include generic CodeMirror CSS as well
*
* @return string CSS code.
*/
function getCssCodeMirror($generic = false)
function getCssCodeMirror()
{
if (! $GLOBALS['cfg']['CodemirrorEnable']) {
return '';
@ -529,97 +545,6 @@ class PMA_Theme
$result[] = ' color: ' . $GLOBALS['cfg']['SQP']['fmtColor']['digit_integer'] . ';';
$result[] = '}';
if ($generic) {
$height = ceil($GLOBALS['cfg']['TextareaRows'] * 1.2);
$result[] = <<<EOT
.CodeMirror {
font-size: 140%;
font-family: monospace;
background: #fff;
border: 1px solid #000;
}
.CodeMirror-scroll {
overflow: auto;
height: ${height}em;
/* This is needed to prevent an IE[67] bug where the scrolled content
is visible outside of the scrolling box. */
position: relative;
}
.CodeMirror-gutter {
position: absolute; left: 0; top: 0;
z-index: 10;
background-color: #f7f7f7;
border-right: 1px solid #eee;
min-width: 2em;
height: 100%;
}
.CodeMirror-gutter-text {
color: #aaa;
text-align: right;
padding: .4em .2em .4em .4em;
white-space: pre !important;
}
.CodeMirror-lines {
padding: .4em;
}
.CodeMirror pre {
-moz-border-radius: 0;
-webkit-border-radius: 0;
-o-border-radius: 0;
border-radius: 0;
border-width: 0; margin: 0; padding: 0; background: transparent;
font-family: inherit;
font-size: inherit;
padding: 0; margin: 0;
white-space: pre;
word-wrap: normal;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
}
.CodeMirror-wrap .CodeMirror-scroll {
overflow-x: hidden;
}
.CodeMirror textarea {
font-family: inherit !important;
font-size: inherit !important;
}
.CodeMirror-cursor {
z-index: 10;
position: absolute;
visibility: hidden;
border-left: 1px solid black !important;
}
.CodeMirror-focused .CodeMirror-cursor {
visibility: visible;
}
span.CodeMirror-selected {
background: #ccc !important;
color: HighlightText !important;
}
.CodeMirror-focused span.CodeMirror-selected {
background: Highlight !important;
}
.CodeMirror-matchingbracket {
color: #0f0 !important;
}
.CodeMirror-nonmatchingbracket {
color: #f22 !important;
}
EOT;
}
return implode("\n", $result);
}
}

View File

@ -16,8 +16,7 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) {
/* general tags */
html {
font-size: <?php echo (null !== $GLOBALS['PMA_Config']->get('fontsize') ? $GLOBALS['PMA_Config']->get('fontsize') : (
isset($_COOKIE['pma_fontsize']) ? $_COOKIE['pma_fontsize'] : '82%'));?>;
font-size: <?php echo $_SESSION['PMA_Theme']->getFontSize(); ?>
}
input,
@ -2124,8 +2123,6 @@ fieldset .disabled-field td {
top: 103px;
}
<?php echo $_SESSION['PMA_Theme']->getCssCodeMirror(true); ?>
.colborder {
cursor: col-resize;
height: 100%;
@ -2614,7 +2611,7 @@ table.jqplot-cursor-tooltip {
font-size: 0.75em;
z-index: 2;
}
td.jqplot-cursor-legend-swatch {
vertical-align: middle;
text-align: center;

View File

@ -0,0 +1,88 @@
.CodeMirror {
font-size: 140%;
font-family: monospace;
background: #fff;
border: 1px solid #000;
}
.CodeMirror-scroll {
overflow: auto;
height: <?php echo ceil($GLOBALS['cfg']['TextareaRows'] * 1.2); ?>em;
/* This is needed to prevent an IE[67] bug where the scrolled content
is visible outside of the scrolling box. */
position: relative;
}
.CodeMirror-gutter {
position: absolute; left: 0; top: 0;
z-index: 10;
background-color: #f7f7f7;
border-right: 1px solid #eee;
min-width: 2em;
height: 100%;
}
.CodeMirror-gutter-text {
color: #aaa;
text-align: right;
padding: .4em .2em .4em .4em;
white-space: pre !important;
}
.CodeMirror-lines {
padding: .4em;
}
.CodeMirror pre {
-moz-border-radius: 0;
-webkit-border-radius: 0;
-o-border-radius: 0;
border-radius: 0;
border-width: 0; margin: 0; padding: 0; background: transparent;
font-family: inherit;
font-size: inherit;
padding: 0; margin: 0;
white-space: pre;
word-wrap: normal;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;
}
.CodeMirror-wrap .CodeMirror-scroll {
overflow-x: hidden;
}
.CodeMirror textarea {
font-family: inherit !important;
font-size: inherit !important;
}
.CodeMirror-cursor {
z-index: 10;
position: absolute;
visibility: hidden;
border-left: 1px solid black !important;
}
.CodeMirror-focused .CodeMirror-cursor {
visibility: visible;
}
span.CodeMirror-selected {
background: #ccc !important;
color: HighlightText !important;
}
.CodeMirror-focused span.CodeMirror-selected {
background: Highlight !important;
}
.CodeMirror-matchingbracket {
color: #0f0 !important;
}
.CodeMirror-nonmatchingbracket {
color: #f22 !important;
}
<?php echo $_SESSION['PMA_Theme']->getCssCodeMirror(); ?>

View File

@ -16,8 +16,7 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) {
/* general tags */
html {
font-size: <?php echo (null !== $GLOBALS['PMA_Config']->get('fontsize') ? $GLOBALS['PMA_Config']->get('fontsize') : (
isset($_COOKIE['pma_fontsize']) ? $_COOKIE['pma_fontsize'] : '82%'));?>;
font-size: <?php echo $_SESSION['PMA_Theme']->getFontSize(); ?>
}
input,
@ -2588,8 +2587,6 @@ fieldset .disabled-field td {
top: 103px;
}
<?php echo $_SESSION['PMA_Theme']->getCssCodeMirror(true); ?>
.colborder {
cursor: col-resize;
height: 100%;