Menu enhancements

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
2/14/2010 6:02:14 AM
Gravatar
Total Posts 101

Menu enhancements

Any chance of enhancing the menus ?


ie. Most skins have a tab/menu across the top with submenus in the left panel.

 

It would be nice if:


1) The top menu allowed dropdowns (like suckerfish in Joomla)

2) The submenus in the left panel had accordian effects (again from joomla/artisteer 2.4beta)

This may be possible via css ? And the current design ? Maybe using <div class="mojo-accordion"> in the submenu ?

A simple example of how it could be done would be nice...


Thanks.

2/14/2010 8:48:35 PM
Gravatar
Total Posts 101

Re: Menu enhancements

I've hacked togather a little content which can be placed in a left panel asa menu.. (see below):

<div class="mojo-accordion">
<h3> <a href="#">Programming Languages</a></h3>
<div>
<li class="AspNet-TreeView-Root AspNet-TreeView-Leaf">
<a href="http://www.php.net/">PHP</a>
</li>
<li class="AspNet-TreeView-Root AspNet-TreeView-Leaf">
<a href="http://www.ruby-lang.org/en/">Ruby</a>
</li>
<li class="AspNet-TreeView-Root AspNet-TreeView-Leaf">
<a href="http://www.python.org/">Python</a>
</li>
<li class="AspNet-TreeView-Root AspNet-TreeView-Leaf">
<a href="http://www.perl.org/">PERL</a>
</li>
<li class="AspNet-TreeView-Root AspNet-TreeView-Leaf">
<a href="http://java.sun.com/">Java</a>
</li>
<li class="AspNet-TreeView-Root AspNet-TreeView-Leaf">
<a href="http://en.wikipedia.org/wiki/C_Sharp">C#</a>
</li>
</div>
<h3><a href="#">Content Management System</a></h3>
<div>
<li class="AspNet-TreeView-Root AspNet-TreeView-Leaf">
<a href="http://www.joomla.org/">Joomla</a>
</li>
<li class="AspNet-TreeView-Root AspNet-TreeView-Leaf">
<a href="http://www.drupal.org/">Drupal</a>
</li>
<li class="AspNet-TreeView-Root AspNet-TreeView-Leaf">
<a href="http://www.pligg.com/">Pligg</a>
</li>
<li class="AspNet-TreeView-Root AspNet-TreeView-Leaf">
<a href="http://modxcms.com/">Modxcms</a>
</li>
</div>
<h3>
<a href="#">Test</a></h3>
<div>
<li class="AspNet-TreeView-Root AspNet-TreeView-Leaf">
<a href="/new-page-1.aspx"> Sobica</a>
</li>
<li class="AspNet-TreeView-Root AspNet-TreeView-Leaf">
<a href="/new-page-2.aspx"> New Page 2</a></li>
<li class="AspNet-TreeView-Root AspNet-TreeView-Leaf">
<a href="/123.aspx"> 123</a></li>
<li class="AspNet-TreeView-Root AspNet-TreeView-Leaf">
<a href="/test.aspx"> Test</a></li>
</div>
</div>

Sort of what I want, needs more work, but gives the idea of an accordian menu.

2/15/2010 8:01:39 AM
Gravatar
Total Posts 101

Re: Menu enhancements

///
/// jQueryAccordionMenu WebControl
///
/// Quick Hack to see if I can wrap the jQueryAccordian into a menu... 
/// Sort of works.. (add Web.config tag details, then hack the layout.master)
/// 
/// Ugly stuff... No knowledge of current page, no layout controls, doesn't work if no PageMenu is in layout.master.
///
///

using System.Web;
using System.Collections;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace mojoPortal.Web.UI
{
public class jQueryAccordionMenu : WebControl
{
private void RenderMenu(HtmlTextWriter writer, SiteMapNodeCollection startNode)
{
writer.Write("<div class='mojo-accordion'>");

foreach (SiteMapNode node in startNode)
{
string cleanURL = node.Url.StartsWith("~/") ? node.Url.Replace("~/", "/") : node.Url;

writer.Write(string.Format("<ul><a href='{0}'>{1}</a></ul><div>", cleanURL, node.Title));
foreach (SiteMapNode childNode in node.ChildNodes)
{
if (childNode.HasChildNodes)
{
RenderMenu(writer, childNode.ParentNode.ChildNodes);
break;
}
else
{
string cleanChildURL = childNode.Url.StartsWith("~/") ? childNode.Url.Replace("~/", "/") : childNode.Url;
writer.Write(string.Format("<li class='jQueryAccordionMenu-Leaf'><a href='{0}'>{1}</a><li>", cleanChildURL, childNode.Title));
}
}
writer.Write("</div>");
}

writer.Write("</div>");

}
protected override void Render(HtmlTextWriter writer)
{
RenderMenu(writer, SiteMap.RootNode.ChildNodes);
}
}
}
  

2/15/2010 9:51:39 AM
Gravatar
Total Posts 18439

Re: Menu enhancements

If you want to pursue implementing a menu with custom rendering, you should look at the css control adapters used in existing menus under Web/Controls/Adapters and see how they are implemented. For example not long ago I needed to render different css classes to support jQuery Superfish menu, so I implemented MenuAdapterSuperfish.cs and in Controls I implemented mojoMenuSuperfish.cs and mojoMenuSuperfishVertical.cs

If you implement it succesfully then we can add properties on PageMenu and SiteMenu and add code to use your menu based on settings.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.