Serendipity 2.0: Change in Backend themes / Compatibility

Discussion corner for Developers of Serendipity.
Post Reply
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Serendipity 2.0: Change in Backend themes / Compatibility

Post by garvinhicking »

Hey,

yesterday some of our developers (yellowled, timbalu, onli and me) had a chat about open issues left for Serendipity 2.0.

One of these issues is that we currently have a problem with backend themes like bulletproof, that come with an adapted stylesheet and some custom HTML, that relies on the "old" Serendipity 1.x backend code. Since our new backend HTML structure has been completely reworked and changed in several areas, the bulletproof CSS and also parts of its .tpl files no longer match our core.

There is no easy way to adapt this - we would need to edit the bulletproof admin theme to make it "compatible" to the new framework / javascript and HTML structure, and that would cost a lot of time for an effort that is simply not promising.

We firmly believe that the new backend (contained in the "2k11" theme) incorporates all the things that were improved by bulletproof, and takes it further.

So we have decided to drop supporting old backend theme, also ones that probably users created. We often talked about Serendipity needing to be able to move forward with the backend, and that custom admin themes are very hard to support, because forward compatibility in such an area is near impossible.

What we want to do now is:

1. Create a new kind of admin theme, possibly a new directory like /templates/_backend/XXX and move the admin portion of 2k11 to /templates/_backend/2k11. This will then prevent "old" backend template files from being utilized.

2. Custom admin themes can now be added in /templates/_backend/XXX - so if any user still prefers to create his own backend, he can use his old .tpl files, move them to the new location and adapt his CSS and .tpl files to match the modern 2k11 default theme.

3. Add the ability for a user to switch frontend and backend themes on their own. So if you have created a customized bulletproof frontend(!) theme, but are happy to work with the new 2k11 theme, you can now do this. Most likely we will add a separation like sidebar/event plugins in the theme section to have a tab for "backend" and "frontend" theme.

So, in a scenario where you copied templates/bulletproof to templates/mytheme *currently* you would see a broken backend because 2.0 uses the .tpl files that bulletproof also delivers. Once we have implemented steps #1-#3, your upgraded serendipity installation will still use your customized bulletproof frontend theme (yay) but will use 2k11 for the backend (yay). If you also customized the backend part of your theme, you will now need to incorporate your changes by create a new templates/_backend/mytheme theme.


Opinions on this? We're happy to hear your agreement or disagreement on this.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Serendipity 2.0: Change in Backend themes / Compatibilit

Post by yellowled »

Some elaboration on what Garvin said. I'll try and keep it short.
garvinhicking wrote:2. Custom admin themes can now be added in /templates/_backend/XXX - so if any user still prefers to create his own backend, he can use his old .tpl files, move them to the new location and adapt his CSS and .tpl files to match the modern 2k11 default theme.
Note that you won't have to write your own admin theme if you just want to adapt minor things (like changing the font-size or whatever you guys like differently than we do).

There will very likely be some way to add your own CSS to the backend easily. However, you better get your CSS books out for that since I will not be able to provide forum support for that. Also, there will most likely be no “backend theme options” or something like that.

Also note that the new backend shipped with 2.0 will most likely not be a final state. There is a lot of room for improvement still, but some of these changes are a bit complicated. We don't want to postpone the 2.0 release longer than necessary (there still is a lot to do anyway). While 2.0 will come with a new, refined backend theme, we will develop it even further for 2.x or even 2.0.x, so keep those suggestions coming. :)

YL
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Serendipity 2.0: Change in Backend themes / Compatibilit

Post by onli »

So, the commit was under https://github.com/s9y/Serendipity/comm ... c4af687d2c, just for the log.

Garvin, how about we go a step further? The proposal looks very good and seems to work fine. But: Can admin-templates have their own config.inc.php?
I would like to add the js-plugins into the js-hook of 2k11. In the current state, this sure would work, but it would be in 2k11/config.inc.php, which is problematic. If we split away the admin template, this would be more clear. We could move it to template/backends/2k11/ and have a config.inc.php in there.

Also, let's maybe use a seperate serendipity_getBackendFile. That is not necessary, but it could make the fallback a bit easier to see.

@Yellowled: Don't you think that tabs in the template-selection would be a good thing, or is that already on the agenda? I didn't see this in https://github.com/s9y/Serendipity/issues/151.
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Serendipity 2.0: Change in Backend themes / Compatibilit

Post by yellowled »

onli wrote:Don't you think that tabs in the template-selection would be a good thing, or is that already on the agenda? I didn't see this in https://github.com/s9y/Serendipity/issues/151.
Garvin and I actually talked about this on Skype, and I think we both felt it would be the wrong interface to dispay the current frontend and backend theme in a tab.

Tabs usually mean “alternate” options, and since any blog is going to need a frontend and backend theme, they're not really “alternate”. They might not even be connected (you could use e.g. BP frontend with the 2k11 backend).

YL
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Serendipity 2.0: Change in Backend themes / Compatibilit

Post by onli »

Are we talking about the same tabs? I mean a full page separation, like in the plugin menu - so that you have one list with backend themes and one with frontends. The overview could still show the two current ones though.

It seems to me that this is pretty much exactly the same situation as in the plugin menu - we have two different categories of the same base, event/sidebar-plugins, backend/frontend-themes.
More importantly: If we further decouple the themes, we could very easily have a situation where it is not possible anymore to show frontend and backend in one box, as they would not be any longer connected.

We can of course wait until we decide to do this, that is, if we do this.
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Serendipity 2.0: Change in Backend themes / Compatibilit

Post by yellowled »

onli wrote:Are we talking about the same tabs? I mean a full page separation, like in the plugin menu - so that you have one list with backend themes and one with frontends.
No, we weren't.

As far as I can see, what you meant isn't easy to implement, which would make it not worth the effort given the fact that there are only 5 or 6 backend themes altogether and only one will work properly in 2.0. Meaning this would be a possible future improvement, but not necessary for RC or stable.

YL
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Serendipity 2.0: Change in Backend themes / Compatibilit

Post by onli »

Some Bugs:
1. Seems like the config.inc.php of 2k11 gets read (either because of the backend setting, or through Engine: 2k11), even if 2k11 is not the frontend template.
2. If Engine: 2k11 is not set, it falls back to default(or bulletproof?) in the frontend
3. If Engine: 2k11 is not set, s9y didn't respect the sidebar-settings of the template. probably reading the config.inc.php of bulletproof?

Won't make this github-issues yet, as the proposal might still change.

@YL: If we decouple admin/backend-frontends, the current interface probably won't be (easily, with clean code and logic) possible.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Serendipity 2.0: Change in Backend themes / Compatibilit

Post by garvinhicking »

Hi!
1. Seems like the config.inc.php of 2k11 gets read (either because of the backend setting, or through Engine: 2k11), even if 2k11 is not the frontend template.
This is intentional, if engine 2k11 is used, we need config.inc.php due to the html5time modifier.
2. If Engine: 2k11 is not set, it falls back to default(or bulletproof?) in the frontend
Yes, also intentional. Non-2k11 templates need the default tpl file layout for the frontend.
3. If Engine: 2k11 is not set, s9y didn't respect the sidebar-settings of the template. probably reading the config.inc.php of bulletproof?
I'd need to reproduce that, sounds strange. Created as an issue, cannot look at this currently.

I don't think a serendipity_getBackendFile would be needed currently.

As for the interface, I feel currently this is the most stable approach. I'd say we change this when backend templates emerge where this no longer is a good solution. For now I find this option to be acceptable...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Serendipity 2.0: Change in Backend themes / Compatibilit

Post by onli »

Garvin, the current state doesn't work. If not using 2k11 for the frontend, it is not possible anymore to have a config.inc.php in a frontend-template, since the one of 2k11 will be read for the backend. This leads to a critical php-error when redefining the pre-event-hook, and even without that to properly quite strange behavior.

We either need to add various workarounds and live with a weird mixture state which hinders template development for years, or do that properly now in a one hour fix. Your choice.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Serendipity 2.0: Change in Backend themes / Compatibilit

Post by garvinhicking »

Hi!

I see those options:

1. We edit the config.inc.php of 2k11 to make sure that it is completely optional, and the 2k11 tpl files do not access any custom smarty modifiers (html5time) so that it will work when another template falls back to the 2k11 tpl files

2. We change the order of config.inc.php execution so that the current template's config.inc.php (remember: only of those themes that have Engine: 2k11 set) is parsed first, and after that the config.inc.php of the engine (here: 2k11) is read, and this will need to ensure that function declarations use a "if (!function_exists())" before it?

Do you see other ways?

I've just committed 3 new templates to github for us to now test IMO all scenarios for templates set as FRONTEND:
  • 2k11 -> should work as is, should only parse 2k11/config.inc.php
  • idea -> falls back to "default" tpl engine, should NOT parse 2k11/config.inc.php
  • 2k11-idea -> uses 2k11 fallback engines, provides no config.inc.php file, should parse 2k11/config.inc.php
  • 2k11-idea-config -> uses 2k11 fallback, provides custom config.inc.php file with a JS hooking
  • 2k11-idea-config2 -> uses 2k11 fallback, provides custom config.inc.php file, NO JS hooking
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Serendipity 2.0: Change in Backend themes / Compatibilit

Post by garvinhicking »

I just committed a patch that changes the config.inc.php of 2k11 to utilize a new functio naming scheme. This allows child-themes to have a config.inc.php with the "usual" pre-event hooks, and this will no longer show parse errors when both the child theme's config.inc.php AND 2k11 base config is loaded.

Opinions?
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Serendipity 2.0: Change in Backend themes / Compatibilit

Post by onli »

I'll have a look at your commit. Comment before that, disregard if your commit makes that outdated:

I think that a modification of the first version would be the way to go. Templates that want to rely on 2k11 should just implement the necessary function in their own config, and the config.inc.php of 2k11 should be completely ignored when having another template installed, regardless of the engine-setting. The html5time-modifier could be copied to the core though, to help template authors.

For me it was completely unexpected that the fallback-templates config.inc.php was read, and I thought this was only because of a bug in the implementation of the backend-template. To my knowledge, we never had this behaviour before.

I see the appeal of a merge though. If your commit works properly (are the config-options of 2k11 available in the new template? Can they be overwritten/disabled?), that could be nice. It just shouldn't be in any way related to the backend-template.
Post Reply