]> lifelog.hopto.org Git - LifeLog.git/commitdiff
imp %WEBAPP_SETTINGS
authorWill Budic <redacted>
Mon, 2 Oct 2023 08:35:33 +0000 (19:35 +1100)
committerWill Budic <redacted>
Mon, 2 Oct 2023 08:35:33 +0000 (19:35 +1100)
htdocs/cgi-bin/index.cnf
htdocs/cgi-bin/system/modules/HTMLIndexProcessorPlugin.pm
htdocs/cgi-bin/wsrc/main.css
htdocs/cgi-bin/wsrc/main_earth.css
htdocs/cgi-bin/wsrc/main_moon.css
htdocs/cgi-bin/wsrc/main_sun.css

index acf16ab7eaeb338739c30107c9c9803ad407b0b5..a181e45af5bd5bcb6767df59f6d55352809a7ae4 100644 (file)
@@ -1,4 +1,10 @@
-!CNF2.8
+!CNF3.0
+
+<<@<%WEBAPP_SETTINGS>
+    $LOG_PATH    = ../../dbLifeLog/
+    //We are reading only the css property, old way is the following hash, preserved as reminder.
+    $THEME       = css => wsrc/main.css, colBG => #c8fff8, colSHDW => #9baec8
+>>
 
 <<@<%HTTP_HEADER>
 -charset =   "UTF8"
index 909f2739fbbac82fc7b739183417cfad92feb72c..f92cc76cf57e0c8b353c64f22ff41f13f6745bcd 100644 (file)
@@ -34,6 +34,37 @@ sub convert ($self, $parser, $property) {
     my $tree         = $parser-> anon($property);
     die "Tree property '$property' is not available!" if(!$tree or ref($tree) ne 'CNFNode');
 try{
+    #TODO 20231002 Move -> %WEBAPP_SETTINGS into utility.
+    my %THEME;
+    my %wsettings = $parser -> collection('%WEBAPP_SETTINGS');
+    if(%wsettings){
+       my $theme = $wsettings{THEME};
+       my @els = split(/, /, $theme);
+       foreach (@els) {
+         my ($key,$val) = split(/\s*=>\s*/, $_);
+         $THEME{$key} = $val;
+         last if $key eq 'css'
+       }
+       my $theme_file = $wsettings{LOG_PATH}.'current_theme';
+       $theme_file =~ /^\.\.\/\.\.\// if(-e $theme_file);
+       if(-e $theme_file){
+         open my $fh, '<', $theme_file;
+         my $theme = <$fh>;
+         close($fh);
+         if($theme =~ m/standard/i){
+            $THEME{css} = "wsrc/main.css"
+         }elsif($theme =~ m/moon/i){
+            $THEME{css} = "wsrc/main_moon.css"
+         }
+         elsif($theme =~ m/sun/i){
+            $THEME{css} = "wsrc/main_sun.css"
+         }
+         elsif($theme =~ m/earth/i){
+            $THEME{css} = "wsrc/main_earth.css"
+         }
+       }
+    }
+
     if (exists $parser->{'HTTP_HEADER'}){
         $buffer .= $parser-> {'HTTP_HEADER'};
     }else{
@@ -61,7 +92,11 @@ try{
         if(ref($link) eq 'CNFNode'){
                 my $arr = $link->find('CSS/@@');
                 foreach (@$arr){
-                    push  @hhshCSS, {-type => 'text/css', -src => $_->val()};
+                    if($THEME{css} && $_->val() =~ /main.css$/){
+                        push  @hhshCSS, {-type => 'text/css', -src => $THEME{css}};
+                    }else{
+                        push  @hhshCSS, {-type => 'text/css', -src => $_->val()};
+                    }
                 }
                 $arr = $link->find('JS/@@');
                 foreach (@$arr){
index fc00ad032ce368fdb6f29fc98b57a4809d393af4..d87efa81e2fa40283dacfad1b25cb8dc0ac4d3e8 100644 (file)
@@ -1,15 +1,16 @@
 body{
     font-family: Segoe UI,Helvetica,Bookman,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji;
+    font-size: 14px;
     margin: 0;
     padding:0;
-}
-.content {
     background-image: url('images/page-bck-std.png');
     background-repeat: no-repeat;
     background-attachment: fixed;
-    margin: 0;
-    padding:0;
-    height: 100vh;
+    background-size: cover;
+}
+.content {
+   margin: 0;
+   padding:0;
 }
 p {
     font-family: Bookman;
index 8c3a4a634262932a2818f2d4fd17e9ca80ade76d..c976a5bc67bc90c498cde8dc8e722d826db7d786 100644 (file)
@@ -3,14 +3,13 @@ body{
     font-size: 14px;
     margin: 0;
     padding:0;
-}
-.content {
     background-image: url('images/page-bck-earth.png');
     background-repeat: no-repeat;
     background-attachment: fixed;
+}
+.content {
     margin: 0;
     padding:0;
-    height: 100vh;
 }
 p {
     font-family: Bookman;
index 78153924a950ed865a0537b3b0f292330752c23d..dc593141871b497dfcb97809f627470bed1699f9 100644 (file)
@@ -1,17 +1,16 @@
 body{
     font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Bookman,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji;
     font-size: 14px;
-    background-image: url('images/page-bck-moon.png');
     margin: 0;
     padding:0;
-}
-.content{
     background-image: url('images/page-bck-moon.png');
     background-repeat: no-repeat;
     background-attachment: fixed;
+    background-size: cover;
+}
+.content{
     margin: 0;
     padding:0;
-    height: 100vh;
 }
 p {
     font-family: Bookman;
index 8899bcbb5cb5b1e2f48713f66f74df2f6fab9b43..26ffd56677c340d34d73b6ce781dc101cf82764d 100644 (file)
@@ -4,17 +4,16 @@ body{
     background-color: #FFD700;
     margin: 0;
     padding:0;
-}
-.content {
-
     background-image: url('images/page-bck-sun.png');
     background-repeat: no-repeat;
     background-attachment: fixed;
+    background-size: cover;
+}
+.content {
     margin: 0;
     padding:0;
-    height: 100vh;
-
 }
+
 p {
     font-family: Bookman;
     margin-left: 70px;