Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-09-16 14:27:25

richards
Member
From: Johnson City, TN
Registered: 2005-01-30
Posts: 10
Website

Admin Plugin: adding a new tab

I’ve been learning a bit about textpattern however I wanted to add a new admin side tab with a custom name.

if (@txpinterface == ‘admin’)
{ // add priveleges to determine who is allowed // to view these events // priveleges to access event “bnr_commerce_conf” add_privs(‘bnr_commerce_conf’, ’1,2’); // priveleges to access event “bnr_commerce_products” add_privs(‘bnr_commerce_products’, ’1,2’); // an area tab, “bnr_commerce” // sub-tab “configuration” calls event “bnr_commerce_conf” register_tab(‘bnr_commerce’, ‘configuration’, ‘bnr_commerce_conf’); // sub-tab “products” calls event “bnr_commerce_products” register_tab(‘bnr_commerce’, ‘products’, ‘bnr_commerce_products’); // use function “bnr_commerce_setup” to handle event “bnr_commerce_conf” register_callback(‘bnr_commerce_setup’, ‘bnr_commerce_conf’); // use function “bnr_commerce_manage” to handle event “bnr_commerce_products” register_callback(‘bnr_commerce_manage’, ‘bnr_commerce_products’);
}
function bnr_commerce_setup($event, $step)
{ // handle bnr_commerce_conf
}
function bnr_commerce_manage($event, $step)
{ // handle bnr_commerce_products
}

Mary has tried addressing this through email and Im on the plugin list as well. I have yet to be able to create my own tab without manually editing the mysql txp_lang table and manually adding the name into the system there first. Is this a bug or am I just not doing this correctly?

Another option is to use the extensions tab that is available and create tabs such as in the admin>preferences> advanced settings and manage languages tabs. Is there any info on doing this? I’d like to group configuration screens together.

Any help, advice would be greatly appreciated and welcomed.

Last edited by richards (2005-09-16 14:29:27)

Offline

#2 2005-09-16 15:15:15

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: Admin Plugin: adding a new tab

If I read that correctly, you’re trying to make a top-level tab? (if so, this currently isn’t yet supported in Textpattern)

// -------------------------------------------------------------
   function register_page_extension($func, $event, $step='', $top=0)
        {
                # For now this just does the same as register_callback
                register_callback($func, $event, $step, $top);
        }

txplib_misc.php

Offline

#3 2005-09-16 15:19:57

richards
Member
From: Johnson City, TN
Registered: 2005-01-30
Posts: 10
Website

Re: Admin Plugin: adding a new tab

Thanks that’s good info to know, what about admin>preferences> advanced settings and manage languages tabs?

Offline

#4 2005-09-16 15:53:23

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: Admin Plugin: adding a new tab

Those I believe are specific to only that module (/include/txp_prefs.php). They are styled with class="navlink", which creates that look/feel. They are not actually “tabs” (like those in the main navigation), and probably are a good option if you want to copy that functionality within your admin plugin’s subtab. Look for this line (and ones like it) within txp_prefs.php to see how it’s being done:

sLink('prefs','list_languages',gTxt('manage_languages'),'navlink')

Offline

Board footer

Powered by FluxBB