Skip to content

Commit

Permalink
Item12481:Item12713: new default design
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/NatSkinPlugin@17215 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Jan 7, 2014
1 parent 3f1094c commit 9ac2c97
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 25 deletions.
2 changes: 1 addition & 1 deletion data/System/NatSkinPlugin.txt
Expand Up @@ -176,7 +176,7 @@ See NatSkin#Installation_Instructions
* Set SHORTDESCRIPTION = Theming engine for NatSkin
-->
| Plugin Author: | Michael Daum |
| Copyright ©: | 2003-2013, Michael Daum http://michaeldaumconsulting.com |
| Copyright ©: | 2003-2014, Michael Daum http://michaeldaumconsulting.com |
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/NatSkinPlugin.pm
@@ -1,7 +1,7 @@
###############################################################################
# NatSkinPlugin.pm - Plugin handler for the NatSkin.
#
# Copyright (C) 2003-2013 MichaelDaum http://michaeldaumconsulting.com
# Copyright (C) 2003-2014 MichaelDaum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/NatSkinPlugin/Config.spec
Expand Up @@ -5,7 +5,7 @@
# **STRING**
# This is the default style used for this site. Note, that theming and layout can be configured using preference settings
# per web, topic and user thus overriding settings specified here.
$Foswiki::cfg{NatSkin}{Style} = 'jazzynote';
$Foswiki::cfg{NatSkin}{Style} = 'customato';

# **STRING**
# Choose a default style variation. Note, that only variations shipped within the same theme package can be used,
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/NatSkinPlugin/ExternalLink.pm
@@ -1,7 +1,7 @@
###############################################################################
# NatSkinPlugin.pm - Plugin handler for the NatSkin.
#
# Copyright (C) 2003-2013 MichaelDaum http://michaeldaumconsulting.com
# Copyright (C) 2003-2014 MichaelDaum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/NatSkinPlugin/HtmlTitle.pm
@@ -1,7 +1,7 @@
###############################################################################
# NatSkinPlugin.pm - Plugin handler for the NatSkin.
#
# Copyright (C) 2003-2013 MichaelDaum http://michaeldaumconsulting.com
# Copyright (C) 2003-2014 MichaelDaum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/NatSkinPlugin/Revisions.pm
@@ -1,7 +1,7 @@
###############################################################################
# NatSkinPlugin.pm - Plugin handler for the NatSkin.
#
# Copyright (C) 2003-2013 MichaelDaum http://michaeldaumconsulting.com
# Copyright (C) 2003-2014 MichaelDaum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/NatSkinPlugin/Subscribe.pm
@@ -1,7 +1,7 @@
###############################################################################
# NatSkinPlugin.pm - Plugin handler for the NatSkin.
#
# Copyright (C) 2013 MichaelDaum http://michaeldaumconsulting.com
# Copyright (C) 2013-2014 MichaelDaum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
33 changes: 22 additions & 11 deletions lib/Foswiki/Plugins/NatSkinPlugin/ThemeEngine.pm
@@ -1,7 +1,7 @@
###############################################################################
# NatSkinPlugin.pm - Plugin handler for the NatSkin.
#
# Copyright (C) 2003-2013 MichaelDaum http://michaeldaumconsulting.com
# Copyright (C) 2003-2014 MichaelDaum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -42,7 +42,7 @@ sub new {
#writeDebug("new themegine");

my $this = {
defaultStyle => $Foswiki::cfg{NatSkin}{Style} || 'jazzynote',
defaultStyle => $Foswiki::cfg{NatSkin}{Style} || 'customato',
defaultVariation => $Foswiki::cfg{NatSkin}{Variation} || 'off',
defaultLayout => $Foswiki::cfg{NatSkin}{Layout} || 'fixed',
defaultMenu => Foswiki::Func::isTrue($Foswiki::cfg{NatSkin}{Menu}, 1),
Expand All @@ -57,15 +57,24 @@ sub new {

# make sure there's a default record
unless (defined $Foswiki::cfg{NatSkin}{Themes}) {
$Foswiki::cfg{NatSkin}{Themes}{JazzyNote} = {
baseUrl => '%PUBURLPATH%/%SYSTEMWEB%/JazzyNoteTheme',
styles => {
jazzynote => 'JazzyNoteStyle.css'
$Foswiki::cfg{NatSkin}{Themes} = {
JazzyNote => {
baseUrl => '%PUBURLPATH%/%SYSTEMWEB%/JazzyNoteTheme',
styles => {
jazzynote => 'JazzyNoteStyle.css'
},
variations => {
green => 'GreenVariation.css',
red => 'RedVariation.css'
}
},
Customato => {
baseUrl => '%PUBURLPATH%/%SYSTEMWEB%/CustomatoTheme',
logoUrl => '%PUBURLPATH%/%SYSTEMWEB%/CustomatoTheme/foswiki-logo.png',
styles => {
whity => 'customato.css',
}
},
variations => {
green => 'GreenVariation.css',
red => 'RedVariation.css'
}
};
};

Expand All @@ -84,7 +93,9 @@ sub new {
sub getThemeRecord {
my ($this, $theStyle) = @_;

$theStyle ||= $this->{defaultStyle} ;
unless (defined $theStyle) {
$theStyle = lc($this->{skinState}{style});
}

my $themeId = $this->{knownStyles}{lc($theStyle)};
return unless defined $themeId;
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/NatSkinPlugin/UserActions.pm
@@ -1,7 +1,7 @@
###############################################################################
# NatSkinPlugin.pm - Plugin handler for the NatSkin.
#
# Copyright (C) 2003-2013 MichaelDaum http://michaeldaumconsulting.com
# Copyright (C) 2003-2014 MichaelDaum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/NatSkinPlugin/Utils.pm
@@ -1,7 +1,7 @@
###############################################################################
# NatSkinPlugin.pm - Plugin handler for the NatSkin.
#
# Copyright (C) 2003-2013 MichaelDaum http://michaeldaumconsulting.com
# Copyright (C) 2003-2014 MichaelDaum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/NatSkinPlugin/WebComponent.pm
@@ -1,7 +1,7 @@
###############################################################################
# NatSkinPlugin.pm - Plugin handler for the NatSkin.
#
# Copyright (C) 2003-2013 MichaelDaum http://michaeldaumconsulting.com
# Copyright (C) 2003-2014 MichaelDaum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
13 changes: 9 additions & 4 deletions lib/Foswiki/Plugins/NatSkinPlugin/WebLogo.pm
@@ -1,7 +1,7 @@
###############################################################################
# NatSkinPlugin.pm - Plugin handler for the NatSkin.
#
# Copyright (C) 2003-2013 MichaelDaum http://michaeldaumconsulting.com
# Copyright (C) 2003-2014 MichaelDaum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -45,6 +45,7 @@ sub render {

my $format = $params->{format};
$format = '<a href="$url" title="$alt">$logo</a>' unless defined $format;
my $height = $params->{height} || 50;

my $result = $format;
$result =~ s/\$logo/renderLogo()/ge;
Expand All @@ -54,6 +55,7 @@ sub render {
$result =~ s/\$variation/renderVariation()/ge;
$result =~ s/\$style/renderStyle()/ge;
$result =~ s/\$alt/renderAlt()/ge;
$result =~ s/\$height/$height/g;
$result =~ s/\$perce?nt/\%/go;
$result =~ s/\$nop//go;
$result =~ s/\$n/\n/go;
Expand Down Expand Up @@ -117,9 +119,12 @@ sub renderSrc {
Foswiki::Func::getPreferencesValue('WEBLOGOIMG') ||
$wikiLogoImage;

# HACK: override ProjectLogos with own version
$result =~ s/\%WIKILOGOIMG%/$wikiLogoImage/g;
$result =~ s/ProjectLogos\/foswiki-logo.*/NatSkin\/foswiki-logo.png/g;

# HACK: override ProjectLogos with own version
my $theme = Foswiki::Plugins::NatSkinPlugin::getThemeEngine->getThemeRecord;
my $logoUrl = $theme->{logoUrl} || '%PUBURLPATH%/%SYSTEMWEB%/NatSkin/foswiki-logo.png';
$result = $logoUrl if $result =~ /ProjectLogos\/foswiki-logo/;

return $result;
}
Expand All @@ -128,7 +133,7 @@ sub renderSrc {
sub renderLogo {

my $image = renderSrc();
return '<img class="natWebLogo natWebLogoImage" src="$src" alt="$alt" />' if $image;
return '<img class="natWebLogo natWebLogoImage" src="$src" alt="$alt" height="$height" />' if $image;
return '<span class="natWebLogo natWebLogoName">%WIKITOOLNAME%</span>';
}

Expand Down

0 comments on commit 9ac2c97

Please sign in to comment.