2 edb Mar 11, 2006 07:41

I saw that .. :) thanks!!
oke so ..
inside test.php we have
/**
* Event handler: Called when displaying the tool menu.
*
* {@internal test_plugin::ToolMenu(-)}}
*
* @param array Associative array of parameters
* @return boolean did we display a toolbar?
*/
function ToolMenu( $params )
{
echo 'Hello, This is the ToolMenu for the TEST plugin.';
return true;
}
}
that might work for what I have in mind, it IS a tool, afterall... I will have to install this version this weekend and putz around
I have a (simply)marvelous plugin idea
Has no one ever told yah that curiosity killed the cat? :|
¥
;)
well shit!
I'm not too happy. I can add a "tool" to the tools page, but that presents a bit of problem with form submissions as tools.php?blah=blah doesnt return a valid page.
There REALLY needs to be a hook for adding standalone pages to the tabs. Consider this my official request, please.
As it stands, i have managed to add what I wanted by editing admin/_header.php and my extra page works, but still .. :( .... I really wanted this to NOT entail any file editing.
**
* This is the Admin UI object which handles the UI for the backoffice.
*
* @global AdminUI
*/
$AdminUI = & new AdminUI();
// Construct the menu:
$AdminUI->add_menu_entries(
NULL, // root
array(
'new' => array(
'text' => T_('Write'),
'href' => 'b2edit.php?blog='.$blog,
'style' => 'font-weight: bold;'
),
are we positive theres no "simple" way to call that function and add a tab via a plugin???
whoo, you can hook the AdminAfterMenuInit() event (create a function with that name) and call the helper method $this->register_menu_entry('your tab title').
See http://manual.b2evolution.net/CreatingPlugin#Tools_tab - which I've just created.
I've also just updated the test_plugin in CVS to fix its tab handling (Revision 1.25).
right on, ill take a looksee at that, thanks!
have my tab made.. the page is displaying.
One problem still exists.
I have a form that needs to be processed, and the result needs to be updated to that tabbed page. It doesnt seem to want to do that, clicking the update button returns nothing.
im using this right now to debug:
echo "<form action=\"http://www.village-idiot.org/path-to/blogs/admin.php?ctrl=tools&tab=plug_ID_25\" method=\"post\">\n";
I can remove all the necessary code from the function, and paste it over to a standalone php page, and the form works successfully (assuming I change the action, of course)
Ideas?
also, im assuming that plug_id isnt static, whats the proper way to make that work for any setup?
See function AdminTabPayload() in http://cvs.sourceforge.net/viewcvs.py/evocms/b2evolution/blogs/plugins/_test.plugin.php?view=markup
There's a TODO to make it less tedious, but the way it's done there should work also afterwards.
// TODO: this is tedious.. should either be a global function (get_admin_Form()) or a plugin helper..
$Form = new Form();
$Form->begin_form();
$Form->hidden_ctrl(); // needed to pass the "ctrl=tools" param
$Form->hiddens_by_key( get_memorized() ); // needed to pass all other memorized params, especially "tab"
$Form->text_input( $this->get_class_id().'_text', $this->param_text, '20', 'Text' );
$Form->button_input(); // default "submit" button
$Form->end_form();
thats great, however that doent explain how to integrate that into code that already exists. and where are those functions explained?
ill go paste that into another plugin and see what happens, my test plugin is long overwritten
edit: ok, i can figure this out with that, thanks!
I just did an install of the latest and greatest from CVS. A beast that calls itself "1.8 CVS". It appears that there is not a hook for a 'top level' new tab, but you can add a subtab to the tools tab. I will PM you with a URL and login credentials so's you can see the impact of the test plugin.