Start for adding light/dark theme
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 30 Aug 2019 14:50:55 +0000 (10:50 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 30 Aug 2019 14:50:55 +0000 (10:50 -0400)
Adding options for light dark
top bottom

models/adminServerStatsConfig.php
models/frontCookiePopUp.php
views/adminServerStatsConfig.html

index 5e3749e..821e832 100755 (executable)
@@ -74,8 +74,10 @@ class adminServerStatsConfig extends glmServerStatsBandwidthSupport
                     'send_percent'                  => FILTER_VALIDATE_INT,
                     'show_notifications'            => FILTER_VALIDATE_BOOLEAN,
                     'show_cookie_popup'             => FILTER_VALIDATE_BOOLEAN,
+                    'show_bottom'                   => FILTER_VALIDATE_BOOLEAN,
+                    'show_dark_theme'               => FILTER_VALIDATE_BOOLEAN,
                     'cookie_popup_timeout'          => FILTER_VALIDATE_INT,
-                    'cookie_message'                => FILTER_SANITIZE_STRING,
+                    'cookie_message'                => FILTER_UNSAFE_RAW,
                     'cookie_opt_gdpr'               => FILTER_VALIDATE_BOOLEAN,
                     'cookie_opt_access_logs'        => FILTER_VALIDATE_BOOLEAN,
                     'cookie_opt_permanent'          => FILTER_VALIDATE_BOOLEAN,
@@ -164,4 +166,4 @@ class adminServerStatsConfig extends glmServerStatsBandwidthSupport
 
 }
 
-?>
\ No newline at end of file
+?>
index 562c69d..cc94712 100755 (executable)
@@ -1,18 +1,32 @@
 <?php
 // Get Configuration for Cookie info popup
 $serverstatsConfig = get_option(GLM_SERVERSTATS_PLUGIN_CONFIG_OPTION);
+if ( $serverstatsConfig['show_dark_theme'] ) {
+    $bgColorBackground = '#002b38';
+    $bgColorButtons    = '#073642';
+    $colorText         = '#839496';
+    $buttonColorText   = '#ffffff';
+} else {
+    $bgColorBackground = '#eee8d5';
+    $bgColorButtons    = '#268bd2';
+    $colorText         = '#839496';
+    $buttonColorText   = '#ffffff';
+}
+if ( $serverstatsConfig['show_bottom'] ) {
+    $position = 'bottom: 0px;';
+} else {
+    $position = 'top: 0px;';
+}
 ?>
 <style>
     #cookieNoticeBox {
         position: absolute;
-        top: 200px;
-        left: 30px;
-        width: 70%;
+    <?php echo $position;?>
+        left: 0;
+        width: 100%;
         margin: 0 auto;
-        background: white;
+        background: <?php echo $bgColorBackground;?>;
         padding: 15px;
-        border: 2px solid black;
-        border-radius: 20px/20px;
         background-clip: padding-box;
         text-align: left;
         z-index: 99999 !important;
@@ -20,26 +34,34 @@ $serverstatsConfig = get_option(GLM_SERVERSTATS_PLUGIN_CONFIG_OPTION);
     }
     #cookieNoticeBox p {
         font-size: .9em;
+        color: <?php echo $colorText;?>;
     }
     #cookieNoticeBox .title {
         font-size: .9em;
         font-weight: bold;
         padding-bottom: .5em;
-        border-bottom: 2px solid black;
         margin-bottom: .5em;
+        color: #268bd2;
     }
     #cookieNoticeBox .button {
-        color: black;
+        color: <?php echo $buttonColorText;?>;
+        background: <?php echo $bgColorButtons;?>;
+        border: 1px solid black;
+        border-radius: 10px;
+
         font-size: 1rem;
-        background-color: lightgrey;
         padding: 2px 10px;
         z-index: 20;
         left: 0;
         top: 0;
         margin: 0;
-        border-radius: 4px;
         cursor: pointer;
     }
+    #cookieMoreInfo {
+        height: 50vh;
+        margin: 0;
+        overflow: auto;
+    }
 </style>
 <div id="cookieNoticeBox" class="opensearchserver.ignore">
     <div class="title">Please read!<br></div>
index c22e1aa..d8e861e 100755 (executable)
                         ]}
                         {include file="ui/f6/number.html"}
 
+                        {* Show Bottom *}
+                        {$ui = [
+                            'field' => 'show_bottom',
+                            'value' => {!empty($show_bottom)},
+                            'label' => 'Show at the Bottom'
+                        ]}
+                        {include file="ui/f6/checkbox.html"}
+
+                        {* Theme Options Dark or Light *}
+                        {$ui = [
+                            'field' => 'show_dark_theme',
+                            'value' => {!empty($show_dark_theme)},
+                            'label' => 'Show Dark Theme'
+                        ]}
+                        {include file="ui/f6/checkbox.html"}
+
                         {* cookie_message *}
                         {$ui = [
                             'field'         => 'cookie_message',