Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-09-07 07:49:15

CHRISMDAY
New Member
Registered: 2011-09-07
Posts: 5

[feedback] Admin navigation suggestion

First off I love txp. I however being a photographer don’t post any text on my site so the “Content” menu really irks me. I only have one use for it and that’s “Images” which I use all the time, having to mouse over and select Images every time can be rather tiresome and slow down my workflow. I would love to see an option to add/change/reorder the top admin navigation menu.

Offline

#2 2011-09-07 08:02:31

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

Re: [feedback] Admin navigation suggestion

CHRISMDAY wrote:

I would love to see an option to add/change/reorder the top admin navigation menu.

As far as I’m aware, reordering is not possible but here are a couple of other avenues to explore:

  1. under Advanced Prefs, set the default tab to Images
  2. (more extreme) use a plugin such as smd_user_manager to alter the privileges for your account so you effectively ‘turn off’ the Write tab or any other tabs that you don’t use, thus making the interface smaller

Hope that helps a bit. Maybe one day we’ll be able to customise the tabs more. It’s on my list of things to play with, but it’s not the highest priority.

Last edited by Bloke (2011-09-07 08:04:41)


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

Offline

#3 2011-09-07 08:43:50

CHRISMDAY
New Member
Registered: 2011-09-07
Posts: 5

Re: [feedback] Admin navigation suggestion

Very odd. It was set to Images and it is still defaulting to Write.

Offline

#4 2011-09-07 08:48:34

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

Re: [feedback] Admin navigation suggestion

CHRISMDAY wrote:

Very odd. It was set to Images and it is still defaulting to Write.

D’oh! That only affects things when you first log in, not when you click Content. Sorry about that, should have thought it through.

Erm. I can’t remember if I saw a plugin once that allows you to choose a default tab when you click on a top-level tab. If not, there should be one…

Last edited by Bloke (2011-09-07 08:49:08)


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

Offline

#5 2011-09-07 08:59:05

CHRISMDAY
New Member
Registered: 2011-09-07
Posts: 5

Re: [feedback] Admin navigation suggestion

Seems odd to go to all the trouble to write an option in the preferences that only works on login. Most users stay logged in for weeks at a time on their personal PC’s. Having it already in the options is a perfect spot to change up some code for a probably ignored feature. It would also save someone the hassle of writing a plugin for it.

Offline

#6 2011-09-07 09:11:15

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [feedback] Admin navigation suggestion

Bloke wrote:

Erm. I can’t remember if I saw a plugin once that allows you to choose a default tab when you click on a top-level tab. If not, there should be one…

But is that possible? Without relaying the JavaScript I mean, or replacing the whole pagetop? Such JavaScript method won’t work with every theme out there, as it would expect certain structure. The menu is still hard-coded and build in areas(), isn’t it? And plugins can only add items to the plugin_areas array which is then appended to the menu, right?

But I guess, you could rebuild the theme::$menu, because Textpattern doesn’t take advantage of visibility, making everything public. The comments do mention abstract, but as there isn’t any keywords (for PHP4 b/c obviously), it’s doable if you can find correct hooking point, that is if there is one. Isn’t TXP done with themes already before plugins are loaded, or is it?

CHRISMDAY wrote:

Having it already in the options is a perfect spot to change up some code for a probably ignored feature. It would also save someone the hassle of writing a plugin for it.

Unfortunately the feature won’t directly work for that. There are more tab areas than just the Content. Originally the feature was as intended; to show certain page after log in. For example if someone wanted to show dashboard, they could. Ties well together with the hidden Home tab, which was added to the core with the changeable default page.

Last edited by Gocom (2011-09-07 09:16:34)

Offline

#7 2011-09-07 09:15:13

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

Re: [feedback] Admin navigation suggestion

CHRISMDAY wrote:

Seems odd to go to all the trouble to write an option in the preferences that only works on login.

I guess. But the idea was a default ‘start up’ tab. As you’re navigating the interface, having it default to that tab when you click on the corresponding top level tab might make sense, I’m not sure.

Either way, Gocom is right. The best place to do this is not in a plugin but an admin-side theme. You can do it yourself if you like. The easiest way is with smd_admin_themes. Either clone your existing theme, or edit it directly (note: if it’s Classic or Remora, editing directly is not recommended), load up the .php file and inside the header() function, add this as the first line after the opening curly brace:

$this->menu['content']['event'] = 'image';

That’ll do the trick.

Last edited by Bloke (2011-09-07 09:17:19)


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

Offline

#8 2011-09-07 11:51:19

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

Re: [feedback] Admin navigation suggestion

Actually, can anyone see any obvious pitfalls with this core mod:

Index: textpattern/lib/txplib_theme.php
===================================================================
--- textpattern/lib/txplib_theme.php	(revision 3591)
+++ textpattern/lib/txplib_theme.php	(working copy)
@@ -186,6 +186,8 @@
 			unset($areas['extensions']);
 		}

+		$dflt_tab = get_pref('default_event', '');
+
 		foreach ($areas as $ar => $items)
 		{
 			$l_ = gTxt('tab_'.$ar);
@@ -203,6 +205,11 @@
 				{
 					if (has_privs($b))
 					{
+						if ($b == $dflt_tab)
+						{
+							$this->menu[$ar]['event'] = $dflt_tab;
+						}
+
 						$this->menu[$ar]['items'][] = array('label' => $a, 'event' => $b, 'active' => ($b == $event));
 					}
 				}

I think it does pretty much what is outlined above: anytime you hit a top-level tab, if one of its subtabs matches the one you’ve set as default, it chooses that tab instead of the pre-defined default subtab.

Does that make sense? Any better ways of doing it? Or is this not desirable from a usability standpoint?

EDIT: it works for new tabs added by smd_tabber too, and dashboards under the Home tab. Whichever one you pick in the advanced pref is chosen as default when you click the top-level item containing that subtab.

Last edited by Bloke (2011-09-07 11:55:37)


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

Offline

#9 2011-09-07 12:33:28

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [feedback] Admin navigation suggestion

Hoping TXP5 brings more of b::a($a->b()-c()->e()->d()); ;-) (That’s joke about the short identifiers TXP4 has, visible in that udiff)

Offline

#10 2011-09-07 12:54:37

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

Re: [feedback] Admin navigation suggestion

Gocom wrote:

Hoping TXP5 brings more of b::a($a->b()-c()->e()->d()); ;-)

Hehe. Blame Steve, it’s his original patch :-) Careful what you wish for, though. I prefer:

if ($squid == $aardvark) {
   $this->giraffe[$badger]['fish'] = $aardvark;
}

Makes everything so much more obvious :-)

Edit: and for real fun, this construct wins… trying to make sentences out of code, that still function correctly:

foreach($cold as $ice) {
   $ice['cube']++;
}

Totally keeps the amateurs out.

Last edited by Bloke (2011-09-07 13:00:33)


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

Offline

#11 2011-09-07 15:44:03

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: [feedback] Admin navigation suggestion

I thought rah_tabtor let you move tabs around -?- but now I see you can’t reorder built in tabs.

Last edited by MattD (2011-09-07 15:45:52)


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#12 2011-09-07 16:31:00

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [feedback] Admin navigation suggestion

MattD wrote:

I thought rah_tabtor let you move tabs around -?- but now I see you can’t reorder built in tabs.

Unfortunately it has no access to core tabs, core manages those. It can only duplicate tabs and append. The plugin is mainly only intended as easy way for moving Sections tab from Presentations and Extensions’ plugin tabs to core tabs so the additional Extensions tab can be hidden from site authors, end-users.

Bloke wrote:

trying to make sentences out of code, that still function correctly

Sounds nice. Fits perfectly appliances::ice_maker().

Last edited by Gocom (2011-09-07 16:42:22)

Offline

Board footer

Powered by FluxBB