From 1c2d1019f48fa6b2dbc154f7534341ad0869a5d7 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 30 Oct 2005 16:28:28 +0100 Subject: Interwiki icons are set through CSS classes now darcs-hash:20051030152828-7ad00-58a99ca20a1d6ec62612a6281034c1dd669be44d.gz --- lib/exe/css.php | 41 ++++++++++++++++++++++++++++++++++- lib/exe/js.php | 2 +- lib/images/interwiki.png | Bin 0 -> 1089 bytes lib/tpl/default/design.css | 4 +--- lib/tpl/default/images/interwiki.png | Bin 1089 -> 0 bytes 5 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 lib/images/interwiki.png delete mode 100644 lib/tpl/default/images/interwiki.png (limited to 'lib') diff --git a/lib/exe/css.php b/lib/exe/css.php index 7b6523b41..a9e0efab5 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -7,10 +7,11 @@ */ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); -define('NOSESSION',true); // we do not use a session or authentication here (better caching) +if(!defined('NOSESSION')) define('NOSESSION',true); // we do not use a session or authentication here (better caching) require_once(DOKU_INC.'inc/init.php'); require_once(DOKU_INC.'inc/pageutils.php'); require_once(DOKU_INC.'inc/io.php'); +require_once(DOKU_INC.'inc/confutils.php'); // Main (don't run when UNIT test) if(!defined('SIMPLE_TEST')){ @@ -64,6 +65,9 @@ function css_out(){ // start output buffering and build the stylesheet ob_start(); + // print the default classes for Interwikilinks + css_interwiki(); + // load files foreach($files as $file => $location){ print css_loadfile($file, $location); @@ -108,6 +112,41 @@ function css_cacheok($cache,$files){ return true; } +/** + * Prints classes for interwikilinks + * + * Interwiki links have two classes: 'interwiki' and 'iw_$name>' where + * $name is the identifier given in the config. All Interwiki links get + * an default style with a default icon. If a special icon is available + * for an interwiki URL it is set in it's own class. Both classes can be + * overwritten in the template or userstyles. + * + * @author Andreas Gohr + */ +function css_interwiki(){ + + // default style + echo 'a.interwiki {'; + echo ' background: transparent url('.DOKU_BASE.'lib/images/interwiki.png) 0px 1px no-repeat;'; + echo ' padding-left: 16px;'; + echo '}'; + + // additional styles when icon available + $iwlinks = getInterwiki(); + foreach(array_keys($iwlinks) as $iw){ + if(@file_exists(DOKU_INC.'lib/images/interwiki/'.$iw.'.png')){ + echo "a.iw_$iw {"; + echo ' background-image: url('.DOKU_BASE.'lib/images/interwiki/'.$iw.'.png)'; + echo '}'; + }elseif(@file_exists(DOKU_INC.'lib/images/interwiki/'.$iw.'.gif')){ + echo "a.iw_$iw {"; + echo ' background-image: url('.DOKU_BASE.'lib/images/interwiki/'.$iw.'.gif)'; + echo '}'; + } + } + +} + /** * Loads a given file and fixes relative URLs with the * given location prefix diff --git a/lib/exe/js.php b/lib/exe/js.php index 9708dbc0d..b8b8c6401 100644 --- a/lib/exe/js.php +++ b/lib/exe/js.php @@ -7,7 +7,7 @@ */ if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); -define('NOSESSION',true); // we do not use a session or authentication here (better caching) +if(!defined('NOSESSION')) define('NOSESSION',true); // we do not use a session or authentication here (better caching) require_once(DOKU_INC.'inc/init.php'); require_once(DOKU_INC.'inc/pageutils.php'); require_once(DOKU_INC.'inc/io.php'); diff --git a/lib/images/interwiki.png b/lib/images/interwiki.png new file mode 100644 index 000000000..73d6f8d39 Binary files /dev/null and b/lib/images/interwiki.png differ diff --git a/lib/tpl/default/design.css b/lib/tpl/default/design.css index 7b84ea614..f68043fa9 100644 --- a/lib/tpl/default/design.css +++ b/lib/tpl/default/design.css @@ -214,10 +214,8 @@ a.windows:hover { text-decoration:underline; } -/* interwiki link */ +/* interwiki link (icon are set by dokuwiki) */ a.interwiki{ - background: transparent url(images/interwiki.png) 0px 1px no-repeat; - padding-left: 16px; color:#436976; text-decoration:none; } diff --git a/lib/tpl/default/images/interwiki.png b/lib/tpl/default/images/interwiki.png deleted file mode 100644 index 73d6f8d39..000000000 Binary files a/lib/tpl/default/images/interwiki.png and /dev/null differ -- cgit v1.2.3