]> git.mxchange.org Git - friendica.git/commitdiff
Use minimal mode to change site theme settings
authorHypolite Petovan <hypolite@mrpetovan.com>
Sat, 29 Dec 2018 05:21:57 +0000 (00:21 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sat, 29 Dec 2018 20:40:05 +0000 (15:40 -0500)
- Use textarea in colorbox instead of inline HTML
- Add mode propagation to site theme setting form
- Set theme for site theme settings form to load JS dependencies

mod/admin.php
view/templates/admin/site.tpl
view/theme/frio/templates/admin/site.tpl

index b906ad7d0557613856214e78d2fc8ed9302e823f..c0ad281d3b5e3a1ee9998751734d35e2103a7d7b 100644 (file)
@@ -89,12 +89,10 @@ function admin_post(App $a)
 
                                $theme = $a->argv[2];
                                if (is_file("view/theme/$theme/config.php")) {
-                                       $orig_theme = Renderer::$theme;
-                                       $orig_page = $a->page;
-                                       $orig_session_theme = $_SESSION['theme'];
+                                       $a->setCurrentTheme($theme);
+
                                        require_once "view/theme/$theme/theme.php";
                                        require_once "view/theme/$theme/config.php";
-                                       $_SESSION['theme'] = $theme;
 
                                        $init = $theme . '_init';
                                        if (function_exists($init)) {
@@ -103,17 +101,13 @@ function admin_post(App $a)
                                        if (function_exists('theme_admin_post')) {
                                                theme_admin_post($a);
                                        }
-
-                                       $_SESSION['theme'] = $orig_session_theme;
-                                       Renderer::$theme = $orig_theme;
-                                       $a->page = $orig_page;
                                }
 
                                info(L10n::t('Theme settings updated.'));
                                if ($a->isAjax()) {
                                        return;
                                }
-                               $return_path = 'admin/themes/' . $theme;
+                               $return_path = 'admin/themes/' . $theme . (!empty($_GET['mode']) ? '?mode=' . $_GET['mode'] : '');
                                break;
                        case 'tos':
                                admin_page_tos_post($a);
@@ -2312,12 +2306,10 @@ function admin_page_themes(App $a)
 
                $admin_form = '';
                if (is_file("view/theme/$theme/config.php")) {
-                       $orig_theme = Renderer::$theme;
-                       $orig_page = $a->page;
-                       $orig_session_theme = $_SESSION['theme'];
+                       $a->setCurrentTheme($theme);
+
                        require_once "view/theme/$theme/theme.php";
                        require_once "view/theme/$theme/config.php";
-                       $_SESSION['theme'] = $theme;
 
                        $init = $theme . "_init";
                        if (function_exists($init)) {
@@ -2327,10 +2319,6 @@ function admin_page_themes(App $a)
                        if (function_exists('theme_admin')) {
                                $admin_form = theme_admin($a);
                        }
-
-                       $_SESSION['theme'] = $orig_session_theme;
-                       Renderer::$theme = $orig_theme;
-                       $a->page = $orig_page;
                }
 
                $screenshot = [Theme::getScreenshot($theme), L10n::t('Screenshot')];
@@ -2345,7 +2333,7 @@ function admin_page_themes(App $a)
                        '$toggle' => L10n::t('Toggle'),
                        '$settings' => L10n::t('Settings'),
                        '$baseurl' => System::baseUrl(true),
-                       '$addon' => $theme,
+                       '$addon' => $theme . (!empty($_GET['mode']) ? '?mode=' . $_GET['mode'] : ''),
                        '$status' => $status,
                        '$action' => $action,
                        '$info' => Theme::getInfo($theme),
index dd40654b51b550204d250625ce298deeb50f6bfd..a7adfd5a1ab40506a51968f66f06866d97775c84 100644 (file)
@@ -9,7 +9,8 @@
                                        var theme = $("#id_theme :selected").val();
                                        $("#cnftheme").attr('href',"{{$baseurl}}/admin/themes/"+theme);
                                },*/
-                               href: "{{$baseurl}}/admin/themes/" + $("#id_theme :selected").val(),
+                               iframe: true,
+                               href: "{{$baseurl}}/admin/themes/" + $("#id_theme :selected").val() + "?mode=minimal",
                                onComplete: function(){
                                        $("div#fancybox-content form").submit(function(e){
                                                var url = $(this).attr('action');
index 7228b9022bd878ea3bdd78d6f9fa119d25fef434..5d4fd2506eb1908d928556706138da4f4860e23a 100644 (file)
@@ -10,7 +10,8 @@
                                        var theme = $("#id_theme :selected").val();
                                        $("#cnftheme").attr('href',"{{$baseurl}}/admin/themes/"+theme);
                                },*/
-                               href: "{{$baseurl}}/admin/themes/" + $("#id_theme :selected").val(),
+                iframe: true,
+                href: "{{$baseurl}}/admin/themes/" + $("#id_theme :selected").val() + "?mode=minimal",
                                onComplete: function(){
                                        $("div#fancybox-content form").submit(function(e){
                                                var url = $(this).attr('action');