PDA

View Full Version : admin addon, new menu item (possibly bug, maybe not)


Dkozikowski
01-04-2007, 06:01 PM
I am developing a small and simple addon that makes a new menu item due to the inability of workspaces under the General Info tab.

Now, for the bug *i think*

When you're viewing your addons, my new menu item disapears. You then must goto any other tab except addons to make it re-appear. Take a look at the screen shots bellow:

This screen shot was taken while viewing the ADDONS:
http://www.dwilkinsjr.com/public/pixelpost/forumFiles/pp_admin_addon.gif

This screen shot was taken while viewing GENERAL INFO:
http://www.dwilkinsjr.com/public/pixelpost/forumFiles/pp_admin_geninfo.gif

Notice that the STAT menu item is not vissible when viewing ADDONS but is when viewing GENERAL INFO.

Is this a bug or is this meant to be like this?

Dkozikowski
01-05-2007, 05:14 AM
Yes, no, maybe ? :confused:

Dennis
01-05-2007, 07:44 AM
I'm not sure. Like I express earlier I'm no export on the admin workspaces. So perhaps GeoS can shed some light on this.

austriaka
01-05-2007, 09:30 AM
which workspace is it in?

LGK

Dkozikowski
01-05-2007, 04:08 PM
"Stats" is in the workspace called admin_main_menu which creates a new menu item.

My coding is fine. I think this is a pixelpost issue.

The only reasoning behind this that i could think of is, becuase the new menu item was created by an addon, it does not show when you're viewing your addons incase you decide to turn it off, but, it's a pain if you want to jump from the addons view to the new workspace becuase you are forced to view a non addon created menu before you can view a menu created by an addon.

Dennis
01-06-2007, 03:07 PM
I've done some digging. In functions.php located in the includes folder you can find the function eval_addon_admin_workspace_menu

I suspect there is the source of the problem, although I'm not sure I would expect


if ($funcs['workspace']=='admin_main_menu_contents' & $_GET['view']!=strtolower($funcs['menu_name'])) continue;
this line has something to do with it.

To be more precise: $_GET['view']!=strtolower($funcs['menu_name'])) could be a condition which causes the stats menu to disappear.

I'm sorry I don't have the time to get into this any further at the moment but please confirm my suspicions. Perhaps we can fix it then in 1.6.

Dkozikowski
01-08-2007, 06:30 PM
I took a quick look at it and was unable to get anything resolved.


if ($funcs['workspace']=='admin_main_menu_contents' & $_GET['view']!=strtolower($funcs['menu_name'])) continue;


does not seem to be the problem. strtolower should only take the output and make sure its all lowercase if i'm not mistaken

Dennis
01-09-2007, 06:02 AM
yeah well, I still think the if statement has something to do with it.

Dkozikowski
01-09-2007, 06:22 AM
I'm going to play around with it a little more later. I'll report my findings if any.

austriaka
01-09-2007, 06:36 AM
have a look at the complete code sniplet:
// no menu
if ($menu_name=='')
{
if ($funcs['workspace']=='admin_main_menu_contents' & $_GET['view']!=strtolower($funcs['menu_name']) ){
continue;
}
call_user_func ($funcs['function_name'] );
} // end if menu is empty
If menu_name is empty and you are in admin_main_menu_contents (contents!!) and $_GET['view'] is not empty: no content(!!) to show in admin panel, so continue.

KArin

Dkozikowski
01-09-2007, 06:47 AM
have a look at the complete code sniplet:
Do you have something in the workspace admin_main_menu_contents?
KArin

Yes i do.

austriaka
01-09-2007, 07:59 AM
I guess reason for vanishing menu item is here (in functions.php, line 511++)
function create_admin_addon_array()
{
global $addon_admin_functions;
global $pixelpost_db_prefix;
$acounter = 0;
$dir = "../addons/";
if( $_GET['view'] != "addons" ) {
//-----------
$query_ad_s = "select * from {$pixelpost_db_prefix}addons where status='on' and type='admin'";
$query_ad_s = mysql_query($query_ad_s);
//-----------
while (list($id,$filename,$status,$addon_type)= mysql_fetch_row($query_ad_s)) {
//$addontype = strtolower(current(explode('_', $filename)));
$dir = "../addons/";
include($dir.$filename.".php");
} // end while
} // end if not addons


//return $addon_admin_functions;
}

admin_addons are only included if( $_GET['view'] != "addons" ). That makes sense because admin_addons should perform their functions only in their own menu. Unfortunately admin menu title is performed within the addon function as well, so it will only be shown when not in menu "Addons"...

Don't know if I am right, it is somewhat like a funny riddle. But if this is true you are right: it is a bug in Pixelpost...
You can override this behaviour by hacking the index.php (line 258++) and inserting the menu item directly here but I strongly believe it wasn't thought like that ;-)
KArin

Dennis
01-10-2007, 04:26 PM
GeoS and myself discussed it briefly today and GeoS offered to take a good look at it this weekend.

Dkozikowski
01-10-2007, 04:30 PM
Thank you! If GEOS can get this resolved for 1.6 that would be great!

Dennis
01-13-2007, 03:02 PM
GeoS and myself have looked into this and it isn't a bug. This behavior is by design. We don't have any desire to adjust this. We are even considering to remove the "admin_main_menu" workspace because it will never show the menu items when viewing the "addons".

I've started a thread to add more workspaces. So if you need more, leave a reaction here (http://forum.pixelpost.org/showthread.php?p=41464#post41464) and we see if we can do it.

austriaka
01-13-2007, 10:52 PM
but how should it be possible then to add new menu items?
KArin

Dennis
01-14-2007, 07:49 AM
but how should it be possible then to add new menu items?
KArin

File it under one of the pre-defined categories. Like the stats addon could be placed under General Info

austriaka
01-14-2007, 10:32 AM
Hm, listing a new admin addon in a submenu makes it hard to create it with its own submenus, or not?
It is possible, but the whole submenu routine gets a little bit complicated then
KArin

Dennis
01-14-2007, 12:11 PM
I helped Dave with that just a few days ago. It isn't really that hard.

Dkozikowski
01-14-2007, 12:15 PM
Yeah, me and KArin both got it to work quite nicley!

KArin, it would not be difficult. The only change would be to change all the references in our menu items from STATS to INFO. This should do the trick.

schonhose, please let us know if the new menu item workspace is going away for sure so i can make adjustments to my current addon!