[2.0] Backend sections created by additional plugins

Discussion corner for Developers of Serendipity.
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by yellowled »

Timbalu wrote:That depends where you want to work. I would not recommend to take the current released 4.07 version, since my dev version has improved much and that would foil my work on it.
That's what I meant. However, I haven't even tested the newer version yet. I'll just let you finish that, it's not as I have nothing else to do. I can easily do the other plugins for 2.0 first, I just wanted to avoid working on an old version if it's pointless.

YL
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by yellowled »

Soooo … I bit the bullet over the past couple of days and wrangled my way into the twitter plugin. Man, that thing is a mess! (Which is due to the fact that a lot of authors worked on this without really keeping a consistent coding style. ) And it didn't even have that much backend markup …

I guess I'll hold off on static pages until Ian finishes the dev version. I guess freetag is next, and then I'm probably going to need some help from onli with bayes.

Just so you guys don't wonder if I'm still working on this issue – yes, I am, but I won't have much time for it over the next couple of days, and this is something which definitely takes time, at least for me.

YL
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by yellowled »

So I'm currently working on the 2.0 backend for Spamblock Bayes. The section generated by Spamblock Bayes is fully smartified, which I like. However, my usual switch for 2.x/1.x backend won't work there since it's native PHP.

I could, of course, make the switch in the plugin's PHP file and include different .tpl files for the 2.0 backend. However, that might be harder to maintain, so I might (or not) need a version switch for .tpl files … or can I use $admin_vars.version_info for this?

Thoughts, ideas, statements that I am blind and it's way easier?

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

Re: [2.0] Backend sections created by additional plugins

Post by onli »

If you can't use $admin_vars.version_info or something, you could just use the php-code to generate a variable to give that variable to smarty when calling the templates.
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by yellowled »

onli wrote:If you can't use $admin_vars.version_info or something, you could just use the php-code to generate a variable to give that variable to smarty when calling the templates.
I guess so. Do I just add that to the array at the end of (some) calls of $this->smarty_show()?

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

Re: [2.0] Backend sections created by additional plugins

Post by onli »

Yes, exactly.
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by yellowled »

Hm. So in the PHP file I have (I already committed that, but did not increase the plugin's version number to not trigger spartacus)

Code: Select all

if ($serendipity['version'][0] == '1') {
    $s9ybackend = '1';
} else {
    $s9ybackend = '2';
}
and later on

Code: Select all

echo $this->smarty_show('admin/bayesNavigation.tpl', array('css' => $css,
'jquery_needed' => $jquery_needed,
'path' => $this->path,
'subpage' => $subpage,
's9ybackend' => $s9ybackend
));
but in bayesNavigation.tpl,

Code: Select all

{if $s9ybackend == '2'} … {/if}
does not work, but

Code: Select all

{if $subpage == 1} … {/if}
does. It might be the late hour, but I don't see why, especially since {$s9ybackend} in the same file emits ”2” … :?

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

Re: [2.0] Backend sections created by additional plugins

Post by onli »

You could try to get away from the strings and make everything ints, just by removing the ' '. If that doesn't help I would have to check that in the code, it looks like it should work normally.
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by yellowled »

onli wrote:You could try to get away from the strings and make everything ints, just by removing the ' '.
Oddly enough, that does indeed work. Hm. Thanks.

YL
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by yellowled »

So, I'm almost done with adapting the plugins we selected as a “must have” for 2.0. “Almost” means they might still need some (extra) CSS and/or JS for 2.0. I'm not sure how to properly procees from here, especially since the way CSS and/or JS are included by plugins is, well, messy at the moment.

Some plugins have their own stylesheet, some add inline styles. Same for JS. Especially with external CSS/JS (i.e. plugin-specific.css and plugin-specific.js as external files), I'm not sure how to handle that for 1.x/2.x. “Code of conduct” in refactoring the plugins' markup was to only modify those parts of the markup which actually need to change, so it won't be possible to just add new CSS classes for 2.x. We need some kind of switch for those (remember, we don't want to include styles for all additional_plugins to the 2k11 backend to not bloat its style.css).

Ideas? I would even consider a seperate devTalk for the remaining issues, I think this might need some discussion (or it might be easier to discuss there).

YL
Post Reply