]> ruin.nu Git - ndwebbie.git/commitdiff
possible to chose stylesheet
authorMichael Andreen <harv@ruin.nu>
Tue, 9 Jan 2007 16:03:50 +0000 (16:03 +0000)
committerMichael Andreen <harv@ruin.nu>
Tue, 9 Jan 2007 16:03:50 +0000 (16:03 +0000)
ND.pm
ND/Web/Pages/Settings.pm [new file with mode: 0644]
nd.css [deleted file]
startup.pl
stylesheets/echoke.css [new file with mode: 0644]
stylesheets/nd.css [new file with mode: 0644]
templates/settings.tmpl [new file with mode: 0644]
templates/skel.tmpl

diff --git a/ND.pm b/ND.pm
index c3391f2bcc2ddf74781cfd62e2de3a4ca49f488c..8b2fdb3d9b2e872213e899edf86c686a1fa490c2 100755 (executable)
--- 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 (file)
index 0000000..c059bc6
--- /dev/null
@@ -0,0 +1,60 @@
+#**************************************************************************
+#   Copyright (C) 2006 by Michael Andreen <harvATruinDOTnu>               *
+#                                                                         *
+#   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 (<stylesheets/*.css>){
+               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 (file)
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;
-}
index 31d64d68a3d79c3af7fe1b0a52f5a5bd92bb6b95..5dc2eb7656a1bc7e2f6c7b9e3976c5a15bf89b22 100644 (file)
@@ -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 (file)
index 0000000..8c24dae
--- /dev/null
@@ -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 (file)
index 0000000..4e031f1
--- /dev/null
@@ -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 (file)
index 0000000..146940f
--- /dev/null
@@ -0,0 +1,10 @@
+<form action="<TMPL_VAR NAME=PAGE>" method="post"><fieldset> <legend>Style</legend>
+       <input type="hidden" name="page" value="<TMPL_VAR NAME=PAGE>"/>
+       <input type="hidden" name="cmd" value="stylesheet"/>
+       Stylesheet: <select name="stylesheet">
+                               <TMPL_LOOP StyleSheets>
+                                       <option value="<TMPL_VAR NAME=Style>" <TMPL_IF NAME=Selected>selected="selected"</TMPL_IF>><TMPL_VAR NAME=Style></option>
+                               </TMPL_LOOP>
+                               </select>
+       <br/><input type="submit" value="Change"/>
+</fieldset></form>
index 7d006720011a46b1414458551b5e7cdb653176b7..c7d1d075c4d7c05f81b4cfd1791e230c6e739dc1 100644 (file)
@@ -5,7 +5,7 @@
 <head>
        <title>NewDawn: <TMPL_VAR NAME=TITLE></title>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
-       <link rel="stylesheet" type="text/css" href="/nd.css"/>
+       <link rel="stylesheet" type="text/css" href="/stylesheets/<TMPL_IF CSS><TMPL_VAR NAME=CSS><TMPL_ELSE>nd</TMPL_IF>.css"/>
        <script type="text/javascript" src="/raid.js"></script>
        <TMPL_VAR NAME=HEADER>
 </head>
@@ -13,6 +13,7 @@
 <div id="leftbar">
        <ul class="linkbar">
                <li><a href="/main">Main page</a></li>
+               <li><a href="/settings">Settings</a></li>
                <li><a href="/forum">Forum</a></li>
                <li><a href="/forum/allUnread">New posts <TMPL_IF UnreadPosts>(<b><TMPL_VAR NAME=UnreadPosts></b>)</TMPL_IF></a></li>
        </ul>   <p>Tick: <TMPL_VAR NAME=TICK></p>