Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Changing the Menu Structure Via CodeChanging the Menu Structure Via Code
Previous
 
Next
New Post
4/18/2011 12:48 AM
 

Hi Folks, 

I had a question about changing the parent of a page via code a while back. It was in connection with a menu issue. I am just getting around to an attempt to actually solve this issue. The situation is this.  

  1. There is a single site for one of our customers that involve various groups. The number of groups will grow and I have no control over that.
  2. Different groups can see pages specific to them and some common pages.
  3. The menu is horizontal and the customer likes it.
  4. For any single group the horizontal approach works well since none have all that many high level pages.
  5. However, for anyone with administrator or host rights the menu will get quite busy since they will see all high level menu buttons at once.    

I thought about adding a location page only visible to administrators and hosts and changing the parent page to the location page, i.e. one big dropdown list.  

The other option would be to switch to a vertical menu by changing the skin just for administrator and host roles. I sort of like this approach. I am using a commercial skin that has a number of horizontal and vertical user controls (ascx files).  It looks like you can have different skins for administrator and host roles for things like settings pages but I see no way to have completely different skins for the regular users and then switch them for the administrator and host roles. 

It seems like either of these approaches would require code in the skin’s code behind file or files. Is that correct? Perhaps I am missing something significant. Does anyone see some other approach that would be better?  

Any help or advice would be appreciated. 

Thanks,
G. M.

 

 

 
New Post
4/18/2011 7:34 AM
 
There are a couple of options. 



1) Use an alternate menu system that allows you to display just a couple of selected menus.  Hide Admin/Host in main menus and only show them from the special menu.  This is the approach being used in DNN 6 to split the menus



2) Hide the admin/host menus and just use the admin/host links in the control panel to access the admin/host consoles



3) use CSS/JavaScript to apply different styling to the admin/host menu.a little bit of jQuery would allow you to target the admin/host menu with code like



jQuery(function ($) {
 
$('.mainMenu span.root')
  .has("span.txt:contains('Admin')")
  .add('.mainMenu span.root.last')
  .addClass('specialMenu')
 
});


This will allow you to use standard CSS to provide alternate styling for the admin/host menus.


Joe Brinkman
DNN Corp.
 
New Post
4/18/2011 9:28 AM
 
One option would be to add code on your skin to display either a horizontal or vertical menu depending on what sort of user is currently logged on.

Put this block in your skin to test if the page is being view by ADMIN and show vertical menu

<% IF (DotNetNuke.Security.PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName.ToString) = "True" Or DotNetNuke.Security.PortalSecurity.IsInRoles(PortalSettings.ActiveTab.AdministratorRoles.ToString) = "True")  Then %>
<dnn:NAV runat="server" id="dnnNAV"  ProviderName="DNNMenuNavigationProvider" IndicateChildren="false" ControlOrientation="Vertical" CSSControl="mainMenu" />
<% End IF %>

Put this block in your skin to test if the page is being viewed by anyone else - and show horizontal menu

<% IF (DotNetNuke.Security.PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName.ToString) = "False" Or DotNetNuke.Security.PortalSecurity.IsInRoles(PortalSettings.ActiveTab.AdministratorRoles.ToString) = "False")  Then %>
<dnn:NAV runat="server" id="dnnNAV"  ProviderName="DNNMenuNavigationProvider" IndicateChildren="false" ControlOrientation="Horizontal" CSSControl="mainMenu" />
<% End IF %>

Westa
 
New Post
4/18/2011 10:34 AM
 

Thanks for the quick replies guys. I'll try your suggestions ASAP.

G. M.
 
New Post
4/21/2011 8:51 PM
 

Hi Folks,

It turned out that that our site was too busy with stuff like Flash movies and big logo banners for the vertical or horizontal menu to work very well especially with the commercial skin we are using. However, I had another idea. What about making the horizontal menu movable or “draggable”? It isn’t perfect but when it gets filled with a lot of buttons for administrators you can sort of move it up over the big banner we have so it doesn’t obscure stuff or get obscured. For now it works. I’ll have to take some time with Joe’s suggestions. They look like a more general solution for a pretty flexible menu system.

Here is the jQuery code I used.

These are the scripts for the jQuery libraries. 

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script>

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js" type="text/javascript"></script>

<script src="http://jquery-ui.googlecode.com/svn/tags/latest/external/jquery.bgiframe-2.1.2.js" type="text/javascript"></script>

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/i18n/jquery-ui-i18n.min.js" type="text/javascript"></script>

Here is the script to make the menu bar movable. I used Wes’ code to only allow the movable feature for administrators. I just put a div element around the menu and gave it and id of draggable.

<% IF (DotNetNuke.Security.PortalSecurity.IsInRoles(PortalSettings.AdministratorRoleName.ToString) = "True" Or DotNetNuke.Security.PortalSecurity.IsInRoles(PortalSettings.ActiveTab.AdministratorRoles.ToString) = "True")  Then %>
 

<script  type="text/javascript">

     $(document).ready(function(){

      $(function(){

           $("#draggable").draggable();

       });      

       });  

</script>

 <% End IF %>

I thought this thread had enough good stuff to make it 5 stars. Thanks for the help.

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Changing the Menu Structure Via CodeChanging the Menu Structure Via Code


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out