diff --git a/inc/config_cascade.php b/inc/config_cascade.php index b016de8a0b7da6693f94c1d1bf35d95ef7980439..96cd5d4b5811bc487b6b21aec1b26f7276d1178e 100644 --- a/inc/config_cascade.php +++ b/inc/config_cascade.php @@ -49,7 +49,7 @@ $config_cascade = array_merge( 'local' => array(DOKU_CONF.'wordblock.local.conf'), ), 'userstyle' => array( - 'default' => DOKU_CONF.'userstyle.css', + 'screen' => DOKU_CONF.'userstyle.css', 'rtl' => DOKU_CONF.'rtlstyle.css', 'print' => DOKU_CONF.'printstyle.css', 'feed' => DOKU_CONF.'feedstyle.css', diff --git a/lib/exe/css.php b/lib/exe/css.php index 4db81de0b4835cddc60c2f8b03c56d4ff96b48eb..98a34860ee9360d518e3ace1d48758d15902f175 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -30,10 +30,10 @@ function css_out(){ global $lang; global $config_cascade; - $style = ''; + $mediatype = 'screen'; if (isset($_REQUEST['s']) && in_array($_REQUEST['s'], array('all', 'print', 'feed'))) { - $style = $_REQUEST['s']; + $mediatype = $_REQUEST['s']; } $tpl = trim(preg_replace('/[^\w-]+/','',$_REQUEST['t'])); @@ -46,7 +46,7 @@ function css_out(){ } // The generated script depends on some dynamic options - $cache = getCacheName('styles'.$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'].DOKU_BASE.$tplinc.$style,'.css'); + $cache = getCacheName('styles'.$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'].DOKU_BASE.$tplinc.$mediatype,'.css'); // load template styles $tplstyles = array(); @@ -60,27 +60,29 @@ function css_out(){ // Array of needed files and their web locations, the latter ones // are needed to fix relative paths in the stylesheets $files = array(); - //if (isset($tplstyles['all'])) $files = array_merge($files, $tplstyles['all']); - if(!empty($style)){ - $files[DOKU_INC.'lib/styles/'.$style.'.css'] = DOKU_BASE.'lib/styles/'; - // load plugin, template, user styles - $files = array_merge($files, css_pluginstyles($style)); - if (isset($tplstyles[$style])) $files = array_merge($files, $tplstyles[$style]); - - if(isset($config_cascade['userstyle'][$style])){ - $files[$config_cascade['userstyle'][$style]] = DOKU_BASE; - } - }else{ - $files[DOKU_INC.'lib/styles/style.css'] = DOKU_BASE.'lib/styles/'; - // load plugin, template, user styles - $files = array_merge($files, css_pluginstyles('screen')); - if (isset($tplstyles['screen'])) $files = array_merge($files, $tplstyles['screen']); + // load core styles + $files[DOKU_INC.'lib/styles/'.$mediatype.'.css'] = DOKU_BASE.'lib/styles/'; + // load plugin styles + $files = array_merge($files, css_pluginstyles($mediatype)); + // load template styles + if (isset($tplstyles[$mediatype])) { + $files = array_merge($files, $tplstyles[$mediatype]); + } + // if old 'default' userstyle setting exists, make it 'screen' userstyle for backwards compatibility + if (isset($config_cascade['userstyle']['default'])) { + $config_cascade['userstyle']['screen'] = $config_cascade['userstyle']['default']; + } + // load user styles + if(isset($config_cascade['userstyle'][$mediatype])){ + $files[$config_cascade['userstyle'][$mediatype]] = DOKU_BASE; + } + // load rtl styles + // @todo: this currently adds the rtl styles only to the 'screen' media type + // but 'print' and 'all' should also be supported + if ($mediatype=='screen') { if($lang['direction'] == 'rtl'){ if (isset($tplstyles['rtl'])) $files = array_merge($files, $tplstyles['rtl']); } - if(isset($config_cascade['userstyle']['default'])){ - $files[$config_cascade['userstyle']['default']] = DOKU_BASE; - } } // check cache age & handle conditional request @@ -122,7 +124,7 @@ function css_out(){ // apply style replacements $css = css_applystyle($css,$tplinc); - + // place all @import statements at the top of the file $css = css_moveimports($css); @@ -278,20 +280,15 @@ function css_loadfile($file,$location=''){ * * @author Andreas Gohr <andi@splitbrain.org> */ -function css_pluginstyles($mode='screen'){ +function css_pluginstyles($mediatype='screen'){ global $lang; $list = array(); $plugins = plugin_list(); foreach ($plugins as $p){ - if($mode == 'all'){ - $list[DOKU_PLUGIN."$p/all.css"] = DOKU_BASE."lib/plugins/$p/"; - }elseif($mode == 'print'){ - $list[DOKU_PLUGIN."$p/print.css"] = DOKU_BASE."lib/plugins/$p/"; - }elseif($mode == 'feed'){ - $list[DOKU_PLUGIN."$p/feed.css"] = DOKU_BASE."lib/plugins/$p/"; - }else{ + $list[DOKU_PLUGIN."$p/$mediatype.css"] = DOKU_BASE."lib/plugins/$p/"; + // alternative for screen.css + if ($mediatype=='screen') { $list[DOKU_PLUGIN."$p/style.css"] = DOKU_BASE."lib/plugins/$p/"; - $list[DOKU_PLUGIN."$p/screen.css"] = DOKU_BASE."lib/plugins/$p/"; } if($lang['direction'] == 'rtl'){ $list[DOKU_PLUGIN."$p/rtl.css"] = DOKU_BASE."lib/plugins/$p/"; @@ -302,7 +299,7 @@ function css_pluginstyles($mode='screen'){ /** * Move all @import statements in a combined stylesheet to the top so they - * aren't ignored by the browser. + * aren't ignored by the browser. * * @author Gabriel Birke <birke@d-scribe.de> */ diff --git a/lib/styles/all.css b/lib/styles/all.css new file mode 100644 index 0000000000000000000000000000000000000000..dd9f464626875181b4ab0890d76d8dee954c5d1e --- /dev/null +++ b/lib/styles/all.css @@ -0,0 +1,48 @@ +/** + * Basic styles. These styles are needed for basic DokuWiki functions + * regardless of the used template. Templates can override them of course + */ + +div.clearer { + clear: both; + line-height: 0; + height: 0; + overflow: hidden; +} + +div.no { + display: inline; + margin: 0; + padding: 0; +} + +.hidden { + display: none; +} + +/* image alignment */ +.medialeft { + float: left; +} +.mediaright { + float: right; +} +.mediacenter { + display: block; + margin-left: auto; + margin-right: auto; +} + +/* table cell alignment */ +.leftalign { text-align: left; } +.centeralign { text-align: center; } +.rightalign { text-align: right; } + +/* underline */ +em.u { + font-style: normal; + text-decoration: underline; +} +em em.u { + font-style: italic; +} diff --git a/lib/styles/print.css b/lib/styles/print.css new file mode 100644 index 0000000000000000000000000000000000000000..16543473a431b5d9900dd5db98faf7cfcf3fbce0 --- /dev/null +++ b/lib/styles/print.css @@ -0,0 +1,24 @@ +/** + * Basic styles. These styles are needed for basic DokuWiki functions + * regardless of the used template. Templates can override them of course + */ + +/* messages with msg() */ +div.error, +div.info, +div.success, +div.notify { + display: none; +} + +/* section edit button */ +.secedit { + display: none; +} + +/* modal windows */ +.JSpopup, +#link__wiz, +#media__popup { + display: none; +} diff --git a/lib/styles/style.css b/lib/styles/screen.css similarity index 76% rename from lib/styles/style.css rename to lib/styles/screen.css index 395f82b7810ac41d2b40bdd5d4ea93554b5b5a91..0a6a4f295ce1f3e2a4d86af1fabe2239a4d7a9ec 100644 --- a/lib/styles/style.css +++ b/lib/styles/screen.css @@ -3,23 +3,6 @@ * regardless of the used template. Templates can override them of course */ -div.clearer { - clear: both; - line-height: 0; - height: 0; - overflow: hidden; -} - -div.no { - display: inline; - margin: 0; - padding: 0; -} - -.hidden { - display: none; -} - /* messages with msg() */ div.error, div.info, @@ -59,34 +42,6 @@ div.notify { border-bottom-color: #ffa; } - -/* image alignment */ -.medialeft { - float: left; -} -.mediaright { - float: right; -} -.mediacenter { - display: block; - margin-left: auto; - margin-right: auto; -} - -/* table cell alignment */ -.leftalign { text-align: left; } -.centeralign { text-align: center; } -.rightalign { text-align: right; } - -/* underline */ -em.u { - font-style: normal; - text-decoration: underline; -} -em em.u { - font-style: italic; -} - /* modal windows */ .JSpopup, #link__wiz,