diff --git a/_test/tests/inc/parser/parser_media.test.php b/_test/tests/inc/parser/parser_media.test.php index abbcfe2130ddb3cfc0ca5e5b69f7ed524c054d0a..7d2ff49a228906aa7284ea0d498a9af6f65ba6b0 100644 --- a/_test/tests/inc/parser/parser_media.test.php +++ b/_test/tests/inc/parser/parser_media.test.php @@ -118,12 +118,12 @@ class TestOfDoku_Parser_Media extends TestOfDoku_Parser { $this->assertNotSame(false, $substr_start, 'Substring not found.'); // find $a_webm in $url - $a_webm = '<a href="' . DOKU_BASE . 'lib/exe/fetch.php?id=&cache=&media=wiki:kind_zu_katze.webm" class="media mediafile mf_webm" title="wiki:kind_zu_katze.webm (99.1 KB)">kind_zu_katze.webm</a>'; + $a_webm = '<a href="' . DOKU_BASE . 'lib/exe/fetch.php?id=&cache=&media=wiki:kind_zu_katze.webm" class="media mediafile mf_webm" title="wiki:kind_zu_katze.webm (99.1 KB)">kind_zu_katze.webm</a>'; $substr_start = strpos($url, $a_webm, $substr_start + strlen($source_ogv)); $this->assertNotSame(false, $substr_start, 'Substring not found.'); // find $a_webm in $url - $a_ogv = '<a href="' . DOKU_BASE . 'lib/exe/fetch.php?id=&cache=&media=wiki:kind_zu_katze.ogv" class="media mediafile mf_ogv" title="wiki:kind_zu_katze.ogv (44.8 KB)">kind_zu_katze.ogv</a>'; + $a_ogv = '<a href="' . DOKU_BASE . 'lib/exe/fetch.php?id=&cache=&media=wiki:kind_zu_katze.ogv" class="media mediafile mf_ogv" title="wiki:kind_zu_katze.ogv (44.8 KB)">kind_zu_katze.ogv</a>'; $substr_start = strpos($url, $a_ogv, $substr_start + strlen($a_webm)); $this->assertNotSame(false, $substr_start, 'Substring not found.'); diff --git a/inc/common.php b/inc/common.php index 539aed29098738566f8752352353e5e8a185e598..c19c9e907f4ac4be31598d79ac525846ea3d0d29 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1477,7 +1477,7 @@ function filesize_h($size, $dec = 1) { $i++; } - return round($size, $dec).' '.$sizes[$i]; + return round($size, $dec).' '.$sizes[$i]; } /** diff --git a/inc/html.php b/inc/html.php index d578b867358f341477e2885bef43de227480a1e1..443409f05e040f3ec5b440772e1e76ca6a6ccfc8 100644 --- a/inc/html.php +++ b/inc/html.php @@ -587,20 +587,7 @@ function html_revisions($first=0, $media_id = false){ $form->addElement((empty($editor))?('('.$lang['external_edit'].')'):'<bdi>'.editorinfo($editor).'</bdi>'); $form->addElement(form_makeCloseTag('span')); - if(isset($sizechange)) { - $class = 'sizechange'; - $value = filesize_h(abs($sizechange)); - if($sizechange > 0) { - $class .= ' positive'; - $value = '+' . $value; - } elseif($sizechange < 0) { - $class .= ' negative'; - $value = '-' . $value; - } - $form->addElement(form_makeOpenTag('span', array('class' => $class))); - $form->addElement($value); - $form->addElement(form_makeCloseTag('span')); - } + html_sizechange($sizechange, $form); $form->addElement('('.$lang['current'].')'); @@ -690,20 +677,7 @@ function html_revisions($first=0, $media_id = false){ } $form->addElement(form_makeCloseTag('span')); - if(isset($info['sizechange'])) { - $class = 'sizechange'; - $value = filesize_h(abs($info['sizechange'])); - if($info['sizechange'] > 0) { - $class .= ' positive'; - $value = '+' . $value; - } elseif($info['sizechange'] < 0) { - $class .= ' negative'; - $value = '-' . $value; - } - $form->addElement(form_makeOpenTag('span', array('class' => $class))); - $form->addElement($value); - $form->addElement(form_makeCloseTag('span')); - } + html_sizechange($info['sizechange'], $form); if ($media_id) $form->addElement(form_makeCloseTag('div')); @@ -913,20 +887,7 @@ function html_recent($first = 0, $show_changes = 'both') { } $form->addElement(form_makeCloseTag('span')); - if(isset($recent['sizechange'])) { - $class = 'sizechange'; - $value = filesize_h(abs($recent['sizechange'])); - if($recent['sizechange'] > 0) { - $class .= ' positive'; - $value = '+' . $value; - } elseif($recent['sizechange'] < 0) { - $class .= ' negative'; - $value = '-' . $value; - } - $form->addElement(form_makeOpenTag('span', array('class' => $class))); - $form->addElement($value); - $form->addElement(form_makeCloseTag('span')); - } + html_sizechange($recent['sizechange'], $form); $form->addElement(form_makeCloseTag('div')); $form->addElement(form_makeCloseTag('li')); @@ -2439,6 +2400,7 @@ function html_tabs($tabs, $current_tab = null) { echo '</ul>'.NL; } + /** * Prints a single tab * @@ -2463,3 +2425,28 @@ function html_tab($href, $caption, $selected=false) { echo $tab; } +/** + * Display size change + * + * @param int $sizechange - size of change in Bytes + * @param Doku_Form $form - form to add elements to + */ + +function html_sizechange($sizechange, Doku_Form $form) { + if(isset($sizechange)) { + $class = 'sizechange'; + $value = filesize_h(abs($sizechange)); + if($sizechange > 0) { + $class .= ' positive'; + $value = '+' . $value; + } elseif($sizechange < 0) { + $class .= ' negative'; + $value = '-' . $value; + } else { + $value = '±' . $value; + } + $form->addElement(form_makeOpenTag('span', array('class' => $class))); + $form->addElement($value); + $form->addElement(form_makeCloseTag('span')); + } +} diff --git a/lib/tpl/dokuwiki/css/_recent.css b/lib/tpl/dokuwiki/css/_recent.css index eaa565838ab6ecb90568a272ecc886306873b023..f1be15f977f281cd3c26e6e68953f58999cac7fc 100644 --- a/lib/tpl/dokuwiki/css/_recent.css +++ b/lib/tpl/dokuwiki/css/_recent.css @@ -47,21 +47,21 @@ /*____________ size differences ____________*/ -.dokuwiki li .sizechange { +.dokuwiki form.changes li .sizechange { font-size: 80%; - border-radius: 0.2em; - padding: 0.1em 0.2em + border-radius: .2em; + padding: .1em .2em; + /* cannot use non-guaranteed style.ini colour placeholders, dark templates need to overwrite */ + background-color: #ddd; } -.dokuwiki li .sizechange.positive { +.dokuwiki form.changes li .sizechange.positive { background-color: #cfc;; } - -.dokuwiki li .sizechange.negative { +.dokuwiki form.changes li .sizechange.negative { background-color: #fdd; } - /*____________ page navigator ____________*/ .dokuwiki div.pagenav {