Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Tiribulus on May 17, 2010, 10:04:29 PM

Title: Where is the div for the main menu?
Post by: Tiribulus on May 17, 2010, 10:04:29 PM
Before I put my head through my monitor would someone be so kind as to tell me what file the main menu of buttons is found in. I have searched high and low and though I've been there before, I cannot find where that main menu is. I have a minor issue I'm convinced I can fix if I can just find where it's called from. It's /theme/______/index.template.php in v.1, but it appears not in v.2.
Thanks.
Title: Re: Where is the div for the main menu?
Post by: flapjack on May 17, 2010, 10:45:32 PM
if you are looking for the content of the menu, you will find it in \Sources\Subs.php, search for: function setupMenuContext()
if you want to change the appearance of the menu, it's still in index.template.php, search for: function template_menu()
Title: Re: Where is the div for the main menu?
Post by: Tiribulus on May 18, 2010, 12:48:32 PM
Excellent, I'll take a look.
Thanks
Title: Re: Where is the div for the main menu?
Post by: Tiribulus on May 18, 2010, 06:08:20 PM
OK, it appears I'm in over my head. This issue is for the media button for Aeva Media and it appears he has his own way of producing that menu piece, I'm thinking so it will work with other themes. Maybe I should Ask NAO, but if anybody knows what is causing the missing rounded bottom in the screenshot I would be very grateful.
Thanks:
(http://gregnmary.gotdns.com/pix/menu.jpg)
Title: Re: Where is the div for the main menu?
Post by: Arantor on May 18, 2010, 07:53:25 PM
Can you post the main chunk of code from Subs.php where all the menu items are defined please?

/me thinks there's a missing is_last in there.
Title: Re: Where is the div for the main menu?
Post by: Tiribulus on May 18, 2010, 08:22:41 PM
I hope this is the piece. I included the part where it appears to my untrained eyes that the aeva media button is from.

// All the buttons we can possible want and then some, try pulling the final list of buttons from cache first.
if (($menu_buttons = cache_get_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $cacheTime)) === null || time() - $cacheTime <= $modSettings['settings_updated'])
{
$buttons = array(
'home' => array(
'title' => $txt['home'],
'href' => $modSettings['sp_portal_mode'] == 3 && empty($context['disable_sp']) ? $modSettings['sp_standalone_url'] : $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
// 'target' => '_blank',
),
'forum' => array(
'title' => empty($txt['sp-forum']) ? 'Forum' : $txt['sp-forum'],
'href' => $scripturl . ($modSettings['sp_portal_mode'] == 1 && empty($context['disable_sp']) ? '?action=forum' : ''),
'show' => in_array($modSettings['sp_portal_mode'], array(1, 3)) && empty($context['disable_sp']),
'sub_buttons' => array(
),
),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),
'search' => array(
'title' => $txt['search'],
'href' => $scripturl . '?action=search',
'show' => $context['allow_search'],
'sub_buttons' => array(
),
),
'admin' => array(
'title' => $txt['admin'],
'href' => $scripturl . '?action=admin',
'show' => $context['allow_admin'],
'sub_buttons' => array(
'featuresettings' => array(
'title' => $txt['modSettings_title'],
'href' => $scripturl . '?action=admin;area=featuresettings',
'show' => allowedTo('admin_forum'),
),
'packages' => array(
'title' => $txt['package'],
'href' => $scripturl . '?action=admin;area=packages',
'show' => allowedTo('admin_forum'),
),
'errorlog' => array(
'title' => $txt['errlog'],
'href' => $scripturl . '?action=admin;area=logs;sa=errorlog;desc',
'show' => allowedTo('admin_forum') && !empty($modSettings['enableErrorLogging']),
),
'permissions' => array(
'title' => $txt['edit_permissions'],
'href' => $scripturl . '?action=admin;area=permissions',
'show' => allowedTo('manage_permissions'),
),
'portal' => array(
'title' => $txt['sp-adminCatTitle'],
'href' => $scripturl . '?action=admin;area=portalconfig',
'show' => allowedTo(array('sp_admin', 'sp_manage_settings')),
'is_last' => true,
),
),
),
'moderate' => array(
'title' => $txt['moderate'],
'href' => $scripturl . '?action=moderate',
'show' => $context['allow_moderation_center'],
'sub_buttons' => array(
'modlog' => array(
'title' => $txt['modlog_view'],
'href' => $scripturl . '?action=moderate;area=modlog',
'show' => !empty($modSettings['modlog_enabled']),
),
'poststopics' => array(
'title' => $txt['mc_unapproved_poststopics'],
'href' => $scripturl . '?action=moderate;area=postmod;sa=posts',
'show' => $modSettings['postmod_active'],
),
'attachments' => array(
'title' => $txt['mc_unapproved_attachments'],
'href' => $scripturl . '?action=moderate;area=attachmod;sa=attachments',
'show' => $modSettings['postmod_active'],
),
'reports' => array(
'title' => $txt['mc_reported_posts'],
'href' => $scripturl . '?action=moderate;area=reports',
'show' => true,
'is_last' => true,
),
),
),
'profile' => array(
'title' => $txt['profile'],
'href' => $scripturl . '?action=profile',
'show' => $context['allow_edit_profile'],
'sub_buttons' => array(
'summary' => array(
'title' => $txt['summary'],
'href' => $scripturl . '?action=profile',
'show' => true,
),
'account' => array(
'title' => $txt['account'],
'href' => $scripturl . '?action=profile;area=account',
'show' => allowedTo(array('profile_identity_any', 'profile_identity_own', 'manage_membergroups')),
),
'profile' => array(
'title' => $txt['forumprofile'],
'href' => $scripturl . '?action=profile;area=forumprofile',
'show' => allowedTo(array('profile_extra_any', 'profile_extra_own')),
'is_last' => true,
),
),
),
'pm' => array(
'title' => $txt['pm_short'],
'href' => $scripturl . '?action=pm',
'show' => $context['allow_pm'],
'sub_buttons' => array(
'pm_read' => array(
'title' => $txt['pm_menu_read'],
'href' => $scripturl . '?action=pm',
'show' => allowedTo('pm_read'),
),
'pm_send' => array(
'title' => $txt['pm_menu_send'],
'href' => $scripturl . '?action=pm;sa=send',
'show' => allowedTo('pm_send'),
'is_last' => true,
),
),
),
'calendar' => array(
'title' => $txt['calendar'],
'href' => $scripturl . '?action=calendar',
'show' => $context['allow_calendar'],
'sub_buttons' => array(
'view' => array(
'title' => $txt['calendar_menu'],
'href' => $scripturl . '?action=calendar',
'show' => allowedTo('calendar_post'),
),
'post' => array(
'title' => $txt['calendar_post_event'],
'href' => $scripturl . '?action=calendar;sa=post',
'show' => allowedTo('calendar_post'),
'is_last' => true,
),
),
),


// [Downloads] button
'downloads' => array(
'title' => $txt['downloads_menu'],
'href' => $scripturl . '?action=downloads',
'show' => $context['allow_downloads_view'],
'icon' => '',
),
  // Aeva Media changes
  'media' => array( 'title' => (isset($txt['aeva_gallery']) ? $txt['aeva_gallery'] : 'Media') . (!allowedTo('aeva_access_unseen') || empty($user_info['aeva_unseen']) || $user_info['aeva_unseen'] == -1 ? '' : ' [<b>' . $user_info['aeva_unseen'] . '</b>]'), 'href' => $scripturl . '?action=media', 'show' => allowedTo('aeva_access'), 'sub_buttons' => !allowedTo('aeva_access_unseen') || empty($user_info['aeva_unseen']) || $user_info['aeva_unseen'] == -1 ? array() : array( 'aeva_home' => array( 'title' => $txt['aeva_home'], 'href' => $scripturl . '?action=media', 'show' => true, ), 'aeva_unseen' => array( 'title' => $txt['aeva_unseen'], 'href' => $scripturl . '?action=media;sa=unseen', 'show' => true, ), ), ), // End Aeva Media changes 
'mlist' => array(
'title' => $txt['members_title'],
'href' => $scripturl . '?action=mlist',
'show' => $context['allow_memberlist'],
'sub_buttons' => array(
'mlist_view' => array(
'title' => $txt['mlist_menu_view'],
'href' => $scripturl . '?action=mlist',
'show' => true,
),
'mlist_search' => array(
'title' => $txt['mlist_search'],
'href' => $scripturl . '?action=mlist;sa=search',
'show' => true,
'is_last' => true,
),
),
),
'login' => array(
'title' => $txt['login'],
'href' => $scripturl . '?action=login',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
),
'register' => array(
'title' => $txt['register'],
'href' => $scripturl . '?action=register',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),
'logout' => array(
'title' => $txt['logout'],
'href' => $scripturl . '?action=logout;%1$s=%2$s',
'show' => !$user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),
);

// Now we put the buttons in the context so the theme can use them.
$menu_buttons = array();
foreach ($buttons as $act => $button)
if (!empty($button['show']))
{
$button['active_button'] = false;

// Make sure the last button truely is the last button.
if (!empty($button['is_last']))
{
if (isset($last_button))
unset($menu_buttons[$last_button]['is_last']);
$last_button = $act;
}

// Go through the sub buttons if there are any.
if (!empty($button['sub_buttons']))
foreach ($button['sub_buttons'] as $key => $subbutton)
{
if (empty($subbutton['show']))
unset($button['sub_buttons'][$key]);
}

$menu_buttons[$act] = $button;
}

if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2)
cache_put_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $menu_buttons, $cacheTime);
}
Title: Re: Where is the div for the main menu?
Post by: Arantor on May 18, 2010, 08:26:15 PM
Yup, that's it.

I *think* it should be dealt with by:

Code (find) Select
'href' => $scripturl . '?action=media;sa=unseen', 'show' => true, ), ), ), // End Aeva Media changes

Code (replace) Select
'href' => $scripturl . '?action=media;sa=unseen', 'show' => true, 'is_last' => true ), ), ), // End Aeva Media changes

If that does fix it, would be good to notify Nao of this too.
Title: Re: Where is the div for the main menu?
Post by: Tiribulus on May 18, 2010, 08:37:10 PM
Very good man.
That was indeed it. Thanks for your help once again. Knowing NAO, it's tough to believe he would not have found something like this by now, compulsive perfectionist that he is, but I will run over there and let him know in case he hasn't.
Thanks again.
Title: Re: Where is the div for the main menu?
Post by: Arantor on May 18, 2010, 08:38:27 PM
It's one of those more subtle things - it doesn't show on all themes.

As it happens it's also a bug in SimpleDesk that I've been meaning to fix and just haven't gotten round to it (though at least this reminded me to put it on the tracker so I won't forget :P)
Title: Re: Where is the div for the main menu?
Post by: Nao 尚 on May 19, 2010, 02:54:42 AM
I looked into my own code for noisen.com, and the 'is_last' appears there, so I assume I had the bug happen to me (most likely when I added rounded corners to my menu or something), I fixed it, and I forgot to put the fix into the xml file. Sorry about that, will be in v1.2.
Title: Re: Where is the div for the main menu?
Post by: Tiribulus on May 19, 2010, 09:28:10 AM
No need for apologies.  Until Arantor told me it doesn't show up on all themes I was just surprised that something seemingly so visible hadn't been caught yet, but that explains it. You do fine work, but nobody can expect that there will never be something left to fix. Well, I guess we've seen that they can, but no reasonable person.
Title: Re: Where is the div for the main menu?
Post by: Arantor on May 19, 2010, 09:30:11 AM
Yup, it doesn't show on Curve or Core, in fact the only times I've ever seen it are on themes based on Aaron's Astronomy or Bright Forest themes. That's not to say there aren't other cases, but that's the only times I've ever actually seen it occur.
Title: Re: Where is the div for the main menu?
Post by: Nao 尚 on May 19, 2010, 09:54:50 AM
And probably my own, otherwise I don't see why I'd have fixed it there. ^^
Title: Re: Where is the div for the main menu?
Post by: Tiribulus on May 19, 2010, 09:59:08 AM
This one is the latest Bright Forest.
Title: Re: Where is the div for the main menu?
Post by: Arantor on May 19, 2010, 10:10:38 AM
That's why, then, it uses is_last to add the nice end to the menu.

@Nao, doesn't surprise me, it's why I really need to fix it in SimpleDesk but it's not been so irritating that it got "canhazfixNAO" status in my brain.