Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2009-03-20 13:34:20

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Admin Side Theming! (r3149)

variaas wrote:

I like the idea of editing themes in the TXP admin interface.

Cool, I notice you never tried out the plugin demo on my site. That might give you an idea of what I did. Interested? Drop me a line.

Last edited by Bloke (2009-03-20 13:35:42)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Online

#14 2009-03-20 15:53:03

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Admin Side Theming! (r3149)

I wrote:

per-user or per-group themes (which I’m not sure will actually work now

I can’t find a way of making this work because the init() method of any theme reads the value of the theme_name_TODO in txp_prefs. Thus, as far as I can tell:

  1. if a plugin modifies that value it applies to all users — the same way TXP does out of the box — as it should
  2. if that pref is set in the core to be per user (probably not a good idea), then only an administrator/plugin can set a user’s theme because the prefs page is not available to most users to change their own (besides, we don’t want this feature by default, as it should only be for a plugin to manage if the site design requires it)
  3. per-priv themes are not possible to be read, for the same reason

I may be missing something fundamental here. Please anyone advise if there’s any way a plugin can set up its own theme list (global, per user, per priv) and have the core act on it when someone logs in. Thanks in advance.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Online

#15 2009-03-20 19:42:48

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: Admin Side Theming! (r3149)

This is such an awesome announcement. Thanks guys!

Offline

#16 2009-03-20 20:32:28

PascalL
Member
From: Switzerland
Registered: 2009-03-09
Posts: 132
Website

Re: Admin Side Theming! (r3149)

Woooot! Quite happy here!
Thank you developers!

Offline

#17 2009-03-21 09:27:07

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: Admin Side Theming! (r3149)

Bloke wrote:

permit .js files to be included in the theme which (from first glance) the built-in system does not (yet?)

Hint.

  • allow forced global, per-user or per-group themes (which I’m not sure will actually work now the per-user txp_prefs are around — need to test it)

I was contemplating about the separation of logged-out (i.e. global) vs. logged-in (i.e. private) themes but didn’t think it would gain much popularity.

Are we to expect an actual demand for such a feature?

Offline

#18 2009-03-21 09:56:27

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,596
Website

Re: Admin Side Theming! (r3149)

allow forced global, per-user or per-group themes (which I’m not sure will actually work now the per-user txp_prefs are around — need to test it)

I was contemplating about the separation of logged-out (i.e. global) vs. logged-in (i.e. private) themes but didn’t think it would gain much popularity. Are we to expect an actual demand for such a feature?

Robert, not quite sure what you mean by logged-out themes for the back-end. Surely when one’s logged out, the only part of the back-end one ever sees is the login box, the rest is the front-end, or have I missed something…

On a per-user-group (privs/roles), it would be useful to have some way of saying if_priv = xyz or if role = abc and show or not show certain information. At the moment, this is only possible for tabs.

I’ve been watching the svn developments with glee. I can see that one can replace certain chunks of the page with a custom display alternative. Would it be possible to do more structural changes such as:

  1. relocate items from one column to another
  2. following on from that, dispensing with the left-hand column altogether
  3. make an alternative display method for lists, e.g. a grid arrangement for images

Last question: you now have a new means of determining the tab that should open on logging in. Can you give a code example for what a plugin needs to include to be added to the pref drop-down, e.g. what one needs to add to the top of a dashboard plugin to be able to select it as the login page?

Last edited by jakob (2009-03-21 09:57:00)


TXP Builders – finely-crafted code, design and txp

Offline

#19 2009-03-21 10:18:44

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: Admin Side Theming! (r3149)

jakob wrote:

Robert, not quite sure what you mean by logged-out themes for the back-end. Surely when one’s logged out, the only part of the back-end one ever sees is the login box, the rest is the front-end, or have I missed something…

Frankly, yes. The active theme for a certain user can only be determined once she is logged in. On the log-in screen we’d therefore have to show a “global” theme which applies to all users – we don’t see who’s in front of the screen.

I’ve been watching the svn developments with glee. I can see that one can replace certain chunks of the page with a custom display alternative. Would it be possible to do more structural changes such as…

Possible: Yes. Planned for the next release: No. There are vast herds of dragons (plugins) which rely on the current markup.

Last question: you now have a new means of determining the tab that should open on logging in. Can you give a code example for what a plugin needs to include to be added to the pref drop-down, e.g. what one needs to add to the top of a dashboard plugin to be able to select it as the login page?

register_tab('admin', 'xyz_foobar', gTxt('xyz_foobar'));

See e.g. wet_haystack for a sample.

Offline

#20 2009-03-21 11:29:47

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: Admin Side Theming! (r3149)

jakob wrote:

….more structural changes such as:

  1. relocate items from one column to another
  2. following on from that, dispensing with the left-hand column altogether

In the hope I’m not missing something, which is very likely ;), I’d like to express some thoughts:

Jakob,
I understand what you are asking for but I wonder if it is really necessary to to this at server-side level (when the html is generated) given that this is quite easily doable (and I do it an a regular basis) with a few lines of Jquery.

In other words I think that we must differentiate between two cases:

  1. Presentational modifications (such as moving interface items around )
  2. Structural modifications (such as including or not a particular item in the actual html)

The difference being in the first case we operate after the html is rendered and in the latter before.

Till now we had to rely on js in either cases (just think at ied_hide_in_admin). From now on, if I understood correctly, a similar plugin could operate when the actual html is rendered (with all the discendig advantages – ie even disabling js and css certain items are not shown).

So, back to your concerns, I think you are right when you outline the usefulness of moving items around but IMHO there is no real need for php-coding it.
On the other side a very welcome change is the possibility to include or not some items in the page.

wet,
excuse the naïve question but I’d like to be reassured in one point: from now on will it be possible to include or not (rather than show or not) interface items?

Hope I’ve not totally missed the point…

Offline

#21 2009-03-21 11:44:05

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: Admin Side Theming! (r3149)

redbot wrote:

wet,
excuse the naïve question but I’d like to be reassured in one point: from now on will it be possible to include or not (rather than show or not) interface items?

Preamble: pluggable_ui() serves two distinct purposes: Provide a hook for either replacing or extending the current user interface. The choice of one mode vs. the other is based on how we assume plugin authors might gain the most out of it while we still retain a bit of integrity for the core application, and is subjective.

Replaceble UI elements can be identified by their usage as a value for the $default parameter to pluggable_ui(), like here.

Extendable UI elements simply add an empty hook with no $default like so. Basically, this is just a callback_event() invocation in disguise, for the sake of consistency.

In either case, a plugin would provide its own markup as a response to the appropriate event:

if (@txpinterface == 'admin') {
	register_callback('foo_extend_ui', 'section_ui', 'extend_detail_form');
}

function foo_extend_ui($event, $step, $context_data)
{
	return graf('now i am here');
}

The value of $context_data depends on the … context. On the write tab, for instance, $context_data holds the current article array. Play with dmp() if you like to nose around.

Offline

#22 2009-03-21 12:43:08

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: Admin Side Theming! (r3149)

Thank you for the explanation wet, very appreciated.
Being not a programmer I have to study it a little though, and then perhaps bother again with further [silly] questions.
Thanks for the patience!

Offline

#23 2009-03-21 12:54:59

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: Admin Side Theming! (r3149)

Hey I like the new tabs in the classic theme but I have to say that grey shadow around the tabs is bad for my eyes :P

It needs to be a bit strong to stop me squinting when ever I look up there.

Offline

#24 2009-03-21 14:31:19

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,079
Website

Re: Admin Side Theming! (r3149)

r3149 + is lovely. With a little bit of playing around, I could recreate my own theme quite easily. Gone are the hacks in txplib_head.php :-).

Thanks a lot Robert.

The latest rev mega-patch where I keep all my mods to txp core suddenly got a lot smaller.

PS – is it intentional that the remora theme doesn’t have any link to the site (view site ?).

Last edited by phiw13 (2009-03-21 14:32:26)


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

Board footer

Powered by FluxBB