[2.0] Backend sections created by additional plugins

Discussion corner for Developers of Serendipity.
User avatar
yellowled
Regular
Posts: 7007
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by yellowled » Fri May 23, 2014 11:02 am

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
yellowled
Regular
Posts: 7007
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by yellowled » Sat May 24, 2014 2:06 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
yellowled
Regular
Posts: 7007
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by yellowled » Mon Jun 02, 2014 8:18 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
onli
Regular
Posts: 2220
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by onli » Mon Jun 02, 2014 9:07 pm

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.

User avatar
yellowled
Regular
Posts: 7007
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by yellowled » Mon Jun 02, 2014 9:31 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
onli
Regular
Posts: 2220
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by onli » Mon Jun 02, 2014 9:37 pm

Yes, exactly.

User avatar
yellowled
Regular
Posts: 7007
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by yellowled » Mon Jun 02, 2014 11:32 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
onli
Regular
Posts: 2220
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by onli » Mon Jun 02, 2014 11:40 pm

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.

User avatar
yellowled
Regular
Posts: 7007
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by yellowled » Tue Jun 03, 2014 1:57 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
yellowled
Regular
Posts: 7007
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: [2.0] Backend sections created by additional plugins

Post by yellowled » Thu Jun 05, 2014 6:00 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

Post Reply