From: Michael Andreen Date: Tue, 9 Jan 2007 16:03:50 +0000 (+0000) Subject: possible to chose stylesheet X-Git-Url: https://ruin.nu/git/?a=commitdiff_plain;h=8551be2ae42a4a4e7a425e2a71ead79c10bf9df4;p=ndwebbie.git possible to chose stylesheet --- diff --git a/ND.pm b/ND.pm index c3391f2..8b2fdb3 100755 --- a/ND.pm +++ b/ND.pm @@ -125,6 +125,8 @@ sub page { $ND::TEMPLATE->param(Targets => listTargets()); } $TEMPLATE->param(Coords => param('coords') ? param('coords') : '1:1:1'); + my ($css) = $DBH->selectrow_array(q{SELECT css FROM users WHERE uid = $1},undef,$ND::UID); + $TEMPLATE->param(CSS => $css); } $TEMPLATE->param(Error => $ERROR); diff --git a/ND/Web/Pages/Settings.pm b/ND/Web/Pages/Settings.pm new file mode 100644 index 0000000..c059bc6 --- /dev/null +++ b/ND/Web/Pages/Settings.pm @@ -0,0 +1,60 @@ +#************************************************************************** +# Copyright (C) 2006 by Michael Andreen * +# * +# This program is free software; you can redistribute it and/or modify * +# it under the terms of the GNU General Public License as published by * +# the Free Software Foundation; either version 2 of the License, or * +# (at your option) any later version. * +# * +# This program is distributed in the hope that it will be useful, * +# but WITHOUT ANY WARRANTY; without even the implied warranty of * +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +# GNU General Public License for more details. * +# * +# You should have received a copy of the GNU General Public License * +# along with this program; if not, write to the * +# Free Software Foundation, Inc., * +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * +#**************************************************************************/ + +package ND::Web::Pages::Settings; +use strict; +use warnings FATAL => 'all'; +use ND::Include; +use CGI qw/:standard/; +use ND::Web::Include; + +$ND::PAGES{settings} = {parse => \&parse, process => \&process, render=> \&render}; + +sub parse { + my ($uri) = @_; +} + +sub process { + +} + +sub render { + my ($DBH,$BODY) = @_; + + $ND::TEMPLATE->param(TITLE => 'Edit site preferences'); + + if (defined param 'cmd'){ + if(param('cmd') eq 'stylesheet'){ + my $query = $DBH->prepare(q{UPDATE users SET css = NULLIF($2,'') WHERE uid = $1}); + $query->execute($ND::UID,escapeHTML(param 'stylesheet')) or $ND::ERROR .= p $DBH->errstr; + } + } + my ($css) = $DBH->selectrow_array(q{SELECT css FROM users WHERE uid = $1},undef,$ND::UID); + my @stylesheets = ({Style => ''}); + $css = '' unless defined $css; + while (){ + if(m{stylesheets/(\w+)\.css}){ + push @stylesheets,{Style => $1, Selected => $1 eq $css ? 1 : 0}; + } + } + $BODY->param(StyleSheets => \@stylesheets); + return $BODY; +} + +1; diff --git a/nd.css b/nd.css deleted file mode 100644 index 4e031f1..0000000 --- a/nd.css +++ /dev/null @@ -1,187 +0,0 @@ -body { - padding-left: 15em; - /*padding-right: 12em;*/ - font-family: sans-serif; - color: black; - background-color: #D9D9D9; -} -#leftbar,#rightbar{ - padding: 0; - margin: 0; - position: absolute; - width: 14em; - top: 1em; -} -#leftbar{ - left: 1em; -} -#rightbar{ - right: 1em; -} - -legend { - color: black; - background: white; - border-style: solid; - border-width: 1px; - padding: 1px; -} -table.boards td { - /*border-style: solid; - border-width: 1px;*/ - padding: 2px; - border-collapse: separate; - border-spacing: 15pt; - font-size: larger; -} -table.boards{ - border-collapse: separate; - border-spacing: 5px; -} -table.boards th { - font-size: larger; -} -table.boards tr.even { - background: white; -} - -table.boards a { - text-decoration: none; - width: 100%; - display: block; -} -fieldset.forum-post { - width: 40em; -} -fieldset.forum-post legend b { - font-size: larger; -} -div.leftinfo{ - float: left; - padding-right: 2em; -} -p.claimlinks{ - clear: both; -} - -ul.linkbar { - list-style-type: none; - width: 13.5em; - padding: 0; - margin: 0; -} -ul.linkbar li { - background: white; - color: black; - margin: 0.5em 0; - padding: 0.3em; - /*border-right: 1em solid black;*/ -} -ul.linkbar a { - text-decoration: none; - width: 100%; - display: block; -} -input.coordsinput { - width: 4em; -} -input.small { - width: 1.7em; -} -tr.odd { - background: white; - color: black; -} -tr.total { - background: black; - color: red; -} - -td.ingal{ - background: blue; - color: black; -} -td.Defend{ - background: green; - color: black; -} -td.AllyDef{ - background: #00FF00; - color: black; -} -td.Attack{ - background: red; - color: black; -} - -a.Unclaim{ - color: green; -} -input.Unclaim{ - background: green; -} -a.Claim{ - color: blue; -} -a.Join{ - color: #00AAAA; -} -input.Join{ - background: #00AAAA; -} - -td.Friendly{ - background: green; - color: black; -} -td.Friendly a{ - color: yellow; - background: green; -} -td.Hostile{ - background: red; - color: black; -} -td.NAP{ - background: blue; - color: white; -} -td.NAP a{ - color: yellow; - background: blue; -} -table.old{ - border: outset 1pt; - border-collapse: separate; - border-color: red; -} - -table.closedPlanet{ - border: outset 2pt; - border-collapse: separate; - border-color: red; -} -li.bash{ - color: #FF9933; -} -div.clear { - clear: both; - height: 0; - margin: 0; - padding: 0; - line-height: 0.0; - font-size: 1px; -} - -td.LowestPrio{ - background: red; - color: black; -} -td.MediumPrio{ - background: yellow; - color: black; -} -td.HighestPrio{ - background: green; - color: black; -} diff --git a/startup.pl b/startup.pl index 31d64d6..5dc2eb7 100644 --- a/startup.pl +++ b/startup.pl @@ -37,6 +37,7 @@ use ND::Web::Pages::Resources; use ND::Web::Pages::PlanetNaps; use ND::Web::Pages::Motd; use ND::Web::Pages::Forum; +use ND::Web::Pages::Settings; diff --git a/stylesheets/echoke.css b/stylesheets/echoke.css new file mode 100644 index 0000000..8c24dae --- /dev/null +++ b/stylesheets/echoke.css @@ -0,0 +1,226 @@ +body +{ + padding-left: 15em; + font-size: medium; + color: gray; + font-family: Sans-Serif; + background-color: #f5f5f5; +} +#leftbar, #rightbar +{ + padding-right: 0px; + padding-left: 0px; + font-weight: bold; + padding-bottom: 0px; + margin: 0px; + width: 14em; + color: olive; + padding-top: 0px; + position: absolute; + top: 1em; +} +#leftbar{ + left: 1em; +} +#rightbar{ + right: 1em; +} + +legend { + color: black; + background: white; + border-style: solid; + border-width: 1px; + padding: 1px; +} +table.boards td +{ + border-right: #990000 thin solid; + padding-right: 2px; + border-top: #990000 thin solid; + padding-left: 2px; + font-size: larger; + padding-bottom: 2px; + border-left: #990000 thin solid; + padding-top: 2px; + border-bottom: #990000 thin solid; + border-collapse: separate; + border-spacing: 15pt; +} +table.boards{ + border-collapse: separate; + border-spacing: 5px; +} +table.boards th +{ + font-weight: bold; + font-size: larger; + color: #990000; +} +table.boards tr.even { + background: white; +} + +table.boards a { + text-decoration: none; + width: 100%; + display: block; +} +fieldset.forum-post { + width: 40em; +} +fieldset.forum-post legend b { + font-size: larger; +} +div.leftinfo{ + float: left; + padding-right: 2em; +} +p.claimlinks{ + clear: both; +} + +ul.linkbar +{ + padding-right: 0px; + padding-left: 0px; + padding-bottom: 0px; + margin: 0px; + width: 13.5em; + color: #000033; + padding-top: 0px; +} +ul.linkbar li { + background: white; + color: black; + margin: 0.5em 0; + padding: 0.3em; + /*border-right: 1em solid black;*/ +} +ul.linkbar a { + text-decoration: none; + width: 100%; + display: block; +} +input.coordsinput { + width: 4em; +} +input.small { + width: 1.7em; +} +tr.odd { + background: white; + color: black; +} +tr.total { + background: black; + color: red; +} + +td.ingal{ + background: blue; + color: black; +} +td.Defend{ + background: green; + color: black; +} +td.AllyDef +{ + background: #ccff00; + color: black; +} +td.Attack +{ + background: tomato; + color: black; +} + +a.Unclaim{ + color: #336666; +} +input.Unclaim{ + background: #336666; +} +a.Claim{ + color: blue; +} +a.Join{ + color: #00AAAA; +} +input.Join{ + background: #00AAAA; +} + +td.Friendly +{ + font-weight: bold; + background: #ccff00; + color: darkolivegreen; +} +td.Friendly a +{ + font-weight: bold; + font-size: larger; + background: #ccff00; + color: white; +} +td.Hostile +{ + font-weight: bold; + background: tomato; + color: black; +} +td.NAP +{ + background: turquoise; + color: white; +} +td.NAP a +{ + font-weight: bold; + font-size: larger; + color: white; + background: turquoise; +} +table.old{ + border: outset 1pt; + border-collapse: separate; + border-color: red; +} + +table.closedPlanet +{ + border-right: maroon 2pt outset; + border-top: maroon 2pt outset; + border-left: maroon 2pt outset; + border-bottom: maroon 2pt outset; + border-collapse: separate; +} +li.bash +{ + color: #336666; +} +div.clear { + clear: both; + height: 0; + margin: 0; + padding: 0; + line-height: 0.0; + font-size: 1px; +} + +td.LowestPrio{ + background: tomato; + color: white; +} +td.MediumPrio +{ + background: #b3b169; + color: white; +} +td.HighestPrio +{ + background: #336666; + color: white; +} diff --git a/stylesheets/nd.css b/stylesheets/nd.css new file mode 100644 index 0000000..4e031f1 --- /dev/null +++ b/stylesheets/nd.css @@ -0,0 +1,187 @@ +body { + padding-left: 15em; + /*padding-right: 12em;*/ + font-family: sans-serif; + color: black; + background-color: #D9D9D9; +} +#leftbar,#rightbar{ + padding: 0; + margin: 0; + position: absolute; + width: 14em; + top: 1em; +} +#leftbar{ + left: 1em; +} +#rightbar{ + right: 1em; +} + +legend { + color: black; + background: white; + border-style: solid; + border-width: 1px; + padding: 1px; +} +table.boards td { + /*border-style: solid; + border-width: 1px;*/ + padding: 2px; + border-collapse: separate; + border-spacing: 15pt; + font-size: larger; +} +table.boards{ + border-collapse: separate; + border-spacing: 5px; +} +table.boards th { + font-size: larger; +} +table.boards tr.even { + background: white; +} + +table.boards a { + text-decoration: none; + width: 100%; + display: block; +} +fieldset.forum-post { + width: 40em; +} +fieldset.forum-post legend b { + font-size: larger; +} +div.leftinfo{ + float: left; + padding-right: 2em; +} +p.claimlinks{ + clear: both; +} + +ul.linkbar { + list-style-type: none; + width: 13.5em; + padding: 0; + margin: 0; +} +ul.linkbar li { + background: white; + color: black; + margin: 0.5em 0; + padding: 0.3em; + /*border-right: 1em solid black;*/ +} +ul.linkbar a { + text-decoration: none; + width: 100%; + display: block; +} +input.coordsinput { + width: 4em; +} +input.small { + width: 1.7em; +} +tr.odd { + background: white; + color: black; +} +tr.total { + background: black; + color: red; +} + +td.ingal{ + background: blue; + color: black; +} +td.Defend{ + background: green; + color: black; +} +td.AllyDef{ + background: #00FF00; + color: black; +} +td.Attack{ + background: red; + color: black; +} + +a.Unclaim{ + color: green; +} +input.Unclaim{ + background: green; +} +a.Claim{ + color: blue; +} +a.Join{ + color: #00AAAA; +} +input.Join{ + background: #00AAAA; +} + +td.Friendly{ + background: green; + color: black; +} +td.Friendly a{ + color: yellow; + background: green; +} +td.Hostile{ + background: red; + color: black; +} +td.NAP{ + background: blue; + color: white; +} +td.NAP a{ + color: yellow; + background: blue; +} +table.old{ + border: outset 1pt; + border-collapse: separate; + border-color: red; +} + +table.closedPlanet{ + border: outset 2pt; + border-collapse: separate; + border-color: red; +} +li.bash{ + color: #FF9933; +} +div.clear { + clear: both; + height: 0; + margin: 0; + padding: 0; + line-height: 0.0; + font-size: 1px; +} + +td.LowestPrio{ + background: red; + color: black; +} +td.MediumPrio{ + background: yellow; + color: black; +} +td.HighestPrio{ + background: green; + color: black; +} diff --git a/templates/settings.tmpl b/templates/settings.tmpl new file mode 100644 index 0000000..146940f --- /dev/null +++ b/templates/settings.tmpl @@ -0,0 +1,10 @@ +
Style + + + Stylesheet: +
+
diff --git a/templates/skel.tmpl b/templates/skel.tmpl index 7d00672..c7d1d07 100644 --- a/templates/skel.tmpl +++ b/templates/skel.tmpl @@ -5,7 +5,7 @@ NewDawn: <TMPL_VAR NAME=TITLE> - + @@ -13,6 +13,7 @@