[2.0] Smartifying the backend

Mark threads with "[2.0]" for discussions about features in the longer-term future, "[1.6]" is for short-term. This is not the place for general discussions or plugin or template requests. Only features that are approved to happen by the core team should be listed here for better structuring.
Locked
User avatar
onli
Regular
Posts: 2214
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

[2.0] Smartifying the backend

Post by onli » Thu Feb 16, 2012 3:51 pm

This is a support effort for Restructuring the backend.

All those php-files in include/admin/ emit html-code. They should be converted to use smarty-templates, like in this example:
  • category.inc.php (DONE)
  • export.inc.php (DONE)
  • installer.inc.php (DONE)
  • upgrader.inc.php (DONE)
  • comments.inc.php (DONE)
  • groups.inc.php (DONE)
  • overview.inc.php (DONE)
  • users.inc.php (DONE)
  • configuration.inc.php (DONE)
  • images.inc.php (DONE)
  • personal.inc.php (DONE)
  • entries.inc.php (DONE)
  • plugins.inc.php (DONE)
  • entries_overview.inc.php (DONE)
  • import.inc.php (DONE)
  • templates.inc.php (DONE)
Commit finished files please to the 2.0-branch or show them here.
Last edited by onli on Sat Mar 03, 2012 2:24 pm, edited 13 times in total.

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: [2.0] Smartifying the backend

Post by Timbalu » Thu Feb 16, 2012 4:08 pm

Yes, but smartifying configuration.inc.php, personal.inc.php and overview.inc.php do not really need to, since they contain to less html code to smartify, as is (maybe the last somewhere else).
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

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

Re: [2.0] Smartifying the backend

Post by yellowled » Fri Feb 17, 2012 11:01 am

Could you drop me a note via email once you're done with this? I'm probably going to lose track pulling the 2.0 branch. Thank you. :)

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

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

Re: [2.0] Smartifying the backend

Post by onli » Fri Feb 17, 2012 2:22 pm

Sure.

Ian: That's true, some pages use internal function which emit html-code as well. In the long run, we should probably smartify them too. In the beginning, every page should have a template anyway, since we don't know what will be added to them.

I already used ob_start() and ob_get_content() as a workaround for serendipity_plugin_config.

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

Re: [2.0] Smartifying the backend

Post by onli » Tue Feb 21, 2012 5:06 pm

After extracting the html from the php, some steps need to be repeated again and again. This script should help.

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: [2.0] Smartifying the backend

Post by Timbalu » Tue Feb 28, 2012 5:53 pm

Malte, I found this script erroring...
I did have to take the sed regexes line by line, except one, I do not remember, which errored.
But it would be nice to have inner single quotes like #{serendipity_getFile file=\'\1\'}#g instead of #{serendipity_getFile file=\"\1\"}#g on the onehand and #{\1|escape:\'html\'}#g instead of #{\1|escape:\"html\"}#g.
I dont think we need $foo|escape:'html' either, as we are just rebuilding php's htmlspecialchars, which should be single |escape in Smarty.

Btw is it still possible to use ob_get_contents on function outputs, which throw some error notices with printf and return true/false at the end?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

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

Re: [2.0] Smartifying the backend

Post by onli » Tue Feb 28, 2012 8:36 pm

The very first line is wrong, it should be

Code: Select all

cp "$1" "$1"_backup
That's probably why the second didn't work.
But it would be nice to have inner single quotes
Why? That's not the way i convert it manually.
I dont think we need $foo|escape:'html' either, as we are just rebuilding php's htmlspecialchars, which should be single |escape in Smarty.
It never hurts to state the default explicit.
Btw is it still possible to use ob_get_contents on function outputs, which throw some error notices with printf and return true/false at the end?
Possible in technical terms? I think so, why shouldn't it?

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: [2.0] Smartifying the backend

Post by Timbalu » Tue Feb 28, 2012 9:57 pm

onli wrote:Why? That's not the way i convert it manually.
Well, its just of cosmetical nature I think:

Code: Select all

<img src="{serendipity_getFile file='/admin/img/error.png'}" alt="" />
:wink:
I finished another three files and uploaded them to the 2.0 branch. It might be good testing them carefully as some of them are complicated though.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

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

Re: [2.0] Smartifying the backend

Post by onli » Tue Feb 28, 2012 11:09 pm

Well, its just of cosmetical nature I think:
Na, that's not worth it. First of all it's not that way where i got it from, and i don't think it's prettier ;)
I finished another three files
Great :)
All of those files will need testing. But it will be tested at least when the new adminarea gets build. Just make sure they don't throw errors when only loading the page or following the easy-to-test options.

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

Re: [2.0] Smartifying the backend

Post by onli » Sat Mar 03, 2012 2:34 pm

That'd be it. All files have been smartified. Thank you very much for the help, Ian!

Work to be done: Some admin-files use functions to emit html-code, which themselves don't use smarty. They probably should get transformed too. A probably incomplete list:
  • show_plugins (functions_plugins_admin.inc.php)
  • serendipity_plugin_config (functions_plugins_admin.inc.php)
  • serendipity_printConfigTemplate
  • showMediaLibrary
  • serendipity_killPath
  • serendipity_moveMediaDirectory
Most important: Testing. I guess that most of the testing will be done anyway or would become invalid when the new backend gets build. But some events won't work at all, some forms not as expected, all that has to be fixed before this gets into any release.

It should now be possible to modify the admin-area more easily.
Last edited by onli on Sat Mar 03, 2012 3:41 pm, edited 2 times in total.

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

Re: [2.0] Smartifying the backend

Post by yellowled » Sat Mar 03, 2012 3:38 pm

onli wrote:That'd be it. All files have been smartified. Thank you very much for the help, Ian!
And thanks to both of you for the effort. :-)

Not quite sure as to how to proceed now, to be honest. Obviously, first of all all the .tpl files required for the backend need to be rewritten, but this only makes sense if we also rewrite those not placed in /include/admin/tpl/. Should I edit the ones in /templates/default/ or create a whole new directory or …? Can we go completely nuts in the 2.0 branch and try everything or should we first test it before committing to the core repo?

Garvin?

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

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

Re: [2.0] Smartifying the backend

Post by yellowled » Sat Mar 03, 2012 4:00 pm

yellowled wrote:Should I edit the ones in /templates/default/ or create a whole new directory or …? Can we go completely nuts in the 2.0 branch and try everything or should we first test it before committing to the core repo?
As for the first part, I think it makes sense to do that in 2k11. It doesn't have an admin theme yet, it will likely become the default or at least standard theme at some point, so it makes sense to add one, I guess.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

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

Re: [2.0] Smartifying the backend

Post by onli » Sat Mar 03, 2012 4:02 pm

I personally would be very happy if the code in default would eventually vanish.

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

Re: [2.0] Smartifying the backend

Post by yellowled » Sat Mar 03, 2012 4:25 pm

Me too, but that might be a long shot. However, given the fact that these tpl files are supposed to be "locked", we're gonna have to move them at some point anyway.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: [2.0] Smartifying the backend

Post by Timbalu » Sat Mar 03, 2012 4:41 pm

Well, moving the /tpl dir files to the templates/default/admin/ is no big deal, but this might be discussed later, as this is the point of Garvins concerns having a full public admin template spread out to the wild....
To keep this in our hands, we really should leave it where it is for the moment. And yes, default is the right place, as we did not smartify the files to have a fallback case.

So you have 3 or 4 possible points to work with:
  • - /include/tpl/ (internally smartified before)
    These could also keep smarty blocks for the upper mentioned functions in future.
  • - /include/admin/tpl/ (the ones now smartified by Malte and me)
  • - /templates/default/admin/ (index, entries, media*)
    and possibly at some time
  • -/include/admin/importers/tpl/
Going completely nuts is no good, a little bit of testing would be good to have before pushing! ;-)
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

Locked