[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] sections: Fix layout pref

"Jonny Bradley \(@jonnybradley\) via TikiWiki-cvs" <[email protected]> Mon, 29 Jun 2026 15:45:30 +0000
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a42931ab2cdb_381408a07043768@gitlab-sidekiq-low-urgency-cpu-bound-v2-656d6f88d7-c9cvt.mail>

Jonny Bradley pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
d943f486 by Jonny Bradley at 2026-06-29T15:29:52+00:00
[FIX] sections: Fix layout pref
---
* [FIX] uab: Don't try and set the layout on dropdowns that don't exist - `.tab-content select[name=site_layout_admin]` finds nothing now.

* [FIX] sections: Previous fixes for the regressions made it impossible to change layout, hopefully this addresses that without other harms...

See merge request tikiwiki/tiki!10618

- - - - -


3 changed files:

- admin/include_look.php
- lib/setup/theme.php
- lib/smarty_tiki/FunctionHandler/HtmlBodyAttributes.php


Changes:

=====================================
admin/include_look.php
=====================================
@@ -1124,30 +1124,32 @@ function edit_custom_mode(el,id,name,icon){
 
     var setupThemeLayouts = function (themeDropDown, optionDropDown, layoutDropDown) {
         themeDropDown,optionDropDown.on("change", function() {
-            var theme_option = optionDropDown.find("option:selected").val();
-            var theme_name = themeDropDown.find("option:selected").val();
-            if (theme_option){
+            const theme_option = optionDropDown.find("option:selected").val();
+            let theme_name = themeDropDown.find("option:selected").val();
+            if (theme_option) {
                 theme_name += ":" + theme_option;
             }
-            var layouts = theme_layouts[theme_name];
-            var current = layoutDropDown.val();
-            layoutDropDown.empty();
-            if (!theme_name){
-                layoutDropDown.append(\$('<option/>').attr('value','').text('Site layout'));
-                layoutDropDown.attr('disabled',true);
-            } else {
-                layoutDropDown.attr('disabled',false);
-                \$.each(layouts, function(i, val) {
-                    layoutDropDown.append(\$('<option/>').attr('value',i).text(val));
-                });
-
-                //try setting the option to the previously selected option and if no layout matched, set it to the SMARTY_DEFAULT_LAYOUT constant
-                layoutDropDown.val(current);
-                if (!layoutDropDown.val()){
-                    layoutDropDown.val("$default_layout");
+            if (layoutDropDown.length) {
+                const layouts = theme_layouts[theme_name];
+                const current = layoutDropDown.val();
+                layoutDropDown.empty();
+                if (!theme_name){
+                    layoutDropDown.append(\$('<option/>').attr('value','').text('Site layout'));
+                    layoutDropDown.attr('disabled',true);
+                } else {
+                    layoutDropDown.attr('disabled',false);
+                    \$.each(layouts, function(i, val) {
+                        layoutDropDown.append(\$('<option/>').attr('value',i).text(val));
+                    });
+    
+                    //try setting the option to the previously selected option and if no layout matched, set it to the SMARTY_DEFAULT_LAYOUT constant
+                    layoutDropDown.val(current);
+                    if (!layoutDropDown.val()){
+                        layoutDropDown.val("$default_layout");
+                    }
                 }
+                layoutDropDown.trigger("change");
             }
-            layoutDropDown.trigger("change");
 
         }).trigger("change");
     };


=====================================
lib/setup/theme.php
=====================================
@@ -116,8 +116,6 @@ Sections::onSectionChange(function ($section) {
         }
         /* Force the admin layout on admin pages */
         $prefs['site_layout_admin'] = 'admin';
-        /* Force the admin layout on setup/management pages too */
-        $prefs['site_layout'] = 'admin';
 
         include_once 'admin/define_admin_icons.php';
         foreach ($admin_icons as & $admin_icon) {


=====================================
lib/smarty_tiki/FunctionHandler/HtmlBodyAttributes.php
=====================================
@@ -50,8 +50,12 @@ class HtmlBodyAttributes extends Base
             $class .= ' sandbox ';
         }
 
-        if ($prefs['site_layout']) {
-            $class .= ' layout_' . $prefs['site_layout'];
+        if (Sections::getCurrentSection() === Sections::SECTION_ADMIN_LAYOUT) {
+            $class .= ' layout_admin';
+        } else {
+            if ($prefs['site_layout']) {
+                $class .= ' layout_' . $prefs['site_layout'];
+            }
         }
 
         if (! empty($_REQUEST['filegals_manager'])) {



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/d943f486d856ee049ce612ff91e18d46a9be8737

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/d943f486d856ee049ce612ff91e18d46a9be8737
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs