]> git.mxchange.org Git - friendica.git/commitdiff
frio: add the possibility for the admin to change the colors for non personal pages
authorrabuzarus <>
Mon, 23 Oct 2017 18:26:31 +0000 (20:26 +0200)
committerrabuzarus <>
Mon, 23 Oct 2017 18:26:31 +0000 (20:26 +0200)
view/theme/frio/config.php
view/theme/frio/css/style.css
view/theme/frio/style.php

index e3164697bae61cc42c53ddd44ae844dc3af57800..8add86ea05ec85f76ab0c1efd15d74d7672fe15f 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Friendica\App;
+use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
 
@@ -24,24 +25,59 @@ function theme_post(App $a) {
        }
 }
 
+function theme_admin_post(App $a) {
+       if (!local_user()) {
+               return;
+       }
+
+       if (isset($_POST['frio-settings-submit'])) {
+               Config::set('frio', 'schema',           $_POST["frio_schema"]);
+               Config::set('frio', 'nav_bg',           $_POST["frio_nav_bg"]);
+               Config::set('frio', 'nav_icon_color',   $_POST["frio_nav_icon_color"]);
+               Config::set('frio', 'link_color',       $_POST["frio_link_color"]);
+               Config::set('frio', 'background_color', $_POST["frio_background_color"]);
+               Config::set('frio', 'contentbg_transp', $_POST["frio_contentbg_transp"]);
+               Config::set('frio', 'background_image', $_POST["frio_background_image"]);
+               Config::set('frio', 'bg_image_option',  $_POST["frio_bg_image_option"]);
+               Config::set('frio', 'css_modified',     time());
+       }
+}
+
 function theme_content(App $a) {
        if (!local_user()) {
                return;
        }
        $arr = array();
 
-       $arr["schema"]           = PConfig::get(local_user(),'frio', 'schema');
-       $arr["nav_bg"]           = PConfig::get(local_user(),'frio', 'nav_bg');
-       $arr["nav_icon_color"]   = PConfig::get(local_user(),'frio', 'nav_icon_color');
-       $arr["link_color"]       = PConfig::get(local_user(),'frio', 'link_color');
-       $arr["bgcolor"]          = PConfig::get(local_user(),'frio', 'background_color');
-       $arr["contentbg_transp"] = PConfig::get(local_user(),'frio', 'contentbg_transp');
-       $arr["background_image"] = PConfig::get(local_user(),'frio', 'background_image');
-       $arr["bg_image_option"]  = PConfig::get(local_user(),'frio', 'bg_image_option');
+       $arr["schema"]           = PConfig::get(local_user(), 'frio', 'schema');
+       $arr["nav_bg"]           = PConfig::get(local_user(), 'frio', 'nav_bg');
+       $arr["nav_icon_color"]   = PConfig::get(local_user(), 'frio', 'nav_icon_color');
+       $arr["link_color"]       = PConfig::get(local_user(), 'frio', 'link_color');
+       $arr["bgcolor"]          = PConfig::get(local_user(), 'frio', 'background_color');
+       $arr["contentbg_transp"] = PConfig::get(local_user(), 'frio', 'contentbg_transp');
+       $arr["background_image"] = PConfig::get(local_user(), 'frio', 'background_image');
+       $arr["bg_image_option"]  = PConfig::get(local_user(), 'frio', 'bg_image_option');
 
        return frio_form($arr);
 }
 
+function theme_admin(App $a) {
+       if (!local_user()) {
+               return;
+       }
+       $arr = array();
+
+       $arr["schema"]           = Config::get('frio', 'schema');
+       $arr["nav_bg"]           = Config::get('frio', 'nav_bg');
+       $arr["nav_icon_color"]   = Config::get('frio', 'nav_icon_color');
+       $arr["link_color"]       = Config::get('frio', 'link_color');
+       $arr["bgcolor"]          = Config::get('frio', 'background_color');
+       $arr["contentbg_transp"] = Config::get('frio', 'contentbg_transp');
+       $arr["background_image"] = Config::get('frio', 'background_image');
+       $arr["bg_image_option"]  = Config::get('frio', 'bg_image_option');
+
+       return frio_form($arr);
+}
 
 function frio_form($arr) {
        require_once("view/theme/frio/php/schema.php");
index f15faf3896afa28e4a5bc5e46b47d6db74cf471f..ab8e3d5a53bb842642869f5ed049d2680562f736 100644 (file)
@@ -2817,6 +2817,14 @@ section.help-content-wrapper li {
     font-size: 0.96em;
 }
 
+/*Admin Page*/
+#adminpage #frio_background_image .image-select {
+    display: none;
+}
+#adminpage #frio_background_image.input-group {
+    display: block;
+}
+
 /* Register Page*/
 #register-openid-wrapper, #register-name-wrapper, #register-invite-wrapper, #profile-publish-wrapper {
     margin-top: 20px;
index 041f890e29085117551e45f9aee78156bbf8b53b..7b1b8a350d2a96b38afb2a94acaf69091d5915e6 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 require_once 'view/theme/frio/php/PHPColors/Color.php';
 
+use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 
 $schemecss = "";
@@ -29,6 +30,25 @@ if (! $a->install) {
                if (empty($modified)) {
                        PConfig::set($uid, 'frio', 'css_modified', time());
                }
+       } else {
+               Config::load('frio');
+
+               // Load frios system config.
+               $schema           = Config::get("frio", "schema");
+               $nav_bg           = Config::get("frio", "nav_bg");
+               $nav_icon_color   = Config::get("frio", "nav_icon_color");
+               $link_color       = Config::get("frio", "link_color");
+               $bgcolor          = Config::get("frio", "background_color");
+               $contentbg_transp = Config::get("frio", "contentbg_transp");
+               $background_image = Config::get("frio", "background_image");
+               $bg_image_option  = Config::get("frio", "bg_image_option");
+               $modified         = Config::get("frio", "css_modified");
+
+               // There is maybe the case that the user did never modify the theme settings.
+               // In this case we store the present time.
+               if (empty($modified)) {
+                       Config::set('frio', 'css_modified', time());
+               }
        }
 }