Sign In  |  Register
 
 DotNetNuke Powered!
DotNetNuke Support Forums

Hide Mode: View / Edit Control bar unless user has edit permission to tab

Rate this topic:

Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.

AuthorMessages
John Mitchell
Posts:3085



04/17/2007 10:13 AM  

In version 4.5 of DNN there was a new feature added to allow users with edit permissions to any module on a page to switch into "View" mode like the administrator can.  The ugly side affect of this new feature is that you also get a "slim" control bar at the top of the page.  Several people have complained about this change in the appearance on their sites, but the only answer from the Core Team has been that it was a much requested feature, and that now it is only an issue of training the end user what it means and why it is there.

One quick way to get around it, and what they did for the Forums on DotNetNuke.com is to set the cache time in module settings to -1.  That is a pretty un-intuitive way of hiding the thing, but hey at least it is documented (here anyway)!

I have a feeling the way this has been implemented will get changed in the core, but until it does, here is an easy work-around.
Just place the following code in the skin that you are seeing this slim control bar on.

 

<% 
    If Not DotNetNuke.Security.Permissions.TabPermissionController.HasTabPermission("EDIT") Then
        ControlPanel.visible = false
    End If
%>
pgdt
Posts:1



04/19/2007 11:14 AM  
Hi John
Thanks for the tip; however when developing a custom module where we want to show a gidview to all but only allow certain security groups to edit a record we displayed the edit column with the IsEditable function.
This was simply done by specifying the visibility state of the edit column.
<asp:ImageButtonID="btnEdit"runat="server"CommandName="Edit"ImageUrl="~/images/edit.gif" Visible='<%# IsEditable %>'/>
 
With dnn 4.5.0 and 4.5.1 you can not be sure that the user would be in view or edit mode at all time. In View mode the IsEditable = false.
 
The work arround we found was:
 
Declare a new Boolean in the protected section:
Protected isShowEdit AsBoolean = false
 
On the page_Load set the variable following:
 
isShowEdit = DotNetNuke.Security.Permissions.ModulePermissionController._
HasModulePermission(ModuleConfiguration.ModulePermissions, "EDIT")
 
Then simply replace IsEditable with isShowEdit through out the page even on ModuleActions
 
Actions.Add(GetNextActionID, Localization.GetString(Entities.Modules.Actions.ModuleActionType.AddContent, LocalResourceFile), Entities.Modules.Actions.ModuleActionType.AddContent, "", "add.gif", EditUrl(), False, DotNetNuke.Security.SecurityAccessLevel.View, isShowEdit, False)
 
Then with code for skin as specified above the application is back to normal in dnn 4.5
 
Thanks

Gerhard du Toit
Qualityworks
John Mitchell
Posts:3085



04/19/2007 11:26 AM  

Hi Gerhard,

Thanks for adding that work-around for custom modules that have edit abilities.

Most end users will not need or be able to change the module code, but it is very useful for developers.

vitkoz
Posts:2



04/26/2007 9:29 AM  

Thank you so much for taking time to post this!!!!!!!!!!

I was really disappointed at that invention. Surely it's a GREAT idea for real admins/super users - I for one am super happy to be able to switch from edit to view and see what it looks like immediately. However, for modules developed with "classic" approach, where a user goes into "edit" mode to modify a record, for example, that bar is a foo-foo. And educating users has nothing to do with that. To a regular data processing clerk this bar is confusing, disturbing and weird.

One tiny addition to your post...  - the skin really needs to HAVE that ControlPanel area in order to be hidden. You see, if the skin doesn't have it, it still shows up the first thing on the page. However, your code dies not being able to find ControlPanel...

So, guys and girls out there, add a TD tag with id="ControlPanel" and runat="server" to your skin together with that code, and your unsuspected users will continue to be clueless but not confused. (Of course, you should modify the TD tag to your satisfaction... just keep ID part and RUNAT)

Again, thank you very much for this timely post.

Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.

Forums >DotNetNuke Support >Tips-And-Tricks > Hide Mode: View / Edit Control bar unless user has edit permission to tab



ActiveForums 3.7
Visit our Store for great DotNetNuke Modules and Skins
DNNMasters Sitemap/Google Sitemap 3.0

Item codeSM3-01
Price$29.00
Product Information 
DotNetNuke CSS NavMenu 3.3 (Developers)

Item codeCSSNM33DEV
Base Price$149.00
Product Information 
Snapsis PageBlaster 3.3.2 for DotNetNuke - Professional Edition

AuthorJohn Mitchell
Base Price$79.00
Product Information