|
|
|
Joined: 9/18/2005
Posts: 134
|
|
|
Hi All --
I have got purchased a DNN module with sources from a third-party DNN modules developer and they are not in active DNN development nowadays, therefore they can't help me and I'm asking my question here:
- there is the following code fragment in the subject module's View*.ascx:
public ModuleActionCollection ModuleActions
{
get
{
ModuleActionCollection Actions = new ModuleActionCollection();
Actions.Add(this.GetNextActionID(), "Form Settings", ModuleActionType.AddContent, "", "", this.EditUrl("MyModuleSettings"), false, SecurityAccessLevel.Edit, true, false);
Actions.Add(this.GetNextActionID(), "View Questions", ModuleActionType.AddContent, "", "", this.EditUrl("MyFormQuestions"), false, SecurityAccessLevel.Edit, true, false);
return Actions;
}
}
AFAIU this code fragment makes two module actions' link buttons visible for the users having Edit rights for this module. What I need to do is to make [View Questions] module action link button visible additionally for a specific User Name. How can I do that in module's code (i.e. without giving module edit rights to the user)?
Thank you.
-- Shamil
|
|
|
|
| |
|
|
|
DnnModule.com Joined: 7/2/2004
Posts: 362
|
|
|
Try change your code as followings:
public ModuleActionCollection ModuleActions
{
get
{
ModuleActionCollection Actions = new ModuleActionCollection();
Actions.Add(this.GetNextActionID(), "Form Settings", ModuleActionType.AddContent, "", "", this.EditUrl("MyModuleSettings"), false, SecurityAccessLevel.Edit, true, false);
if (UserId!=-1&&UserInfo.Username.ToLower()=="abc")
{
Actions.Add(this.GetNextActionID(), "View Questions", ModuleActionType.AddContent, "", "", this.EditUrl("MyFormQuestions"), false, SecurityAccessLevel.View, true, false);
}
return Actions;
}
}
Then user "abc" can view "View questions" action button. Note, you also need change "MyFormQuestions" module permission from "Edit" to "View". Otherwise, "abc" can't open it.
Over 20 + professional dnn modules for News Article, Store, Video Gallery, Photo Gallery, Ultra Flash Player,YouTube Video, Image Slide show, Skin Chameleon and much more from
DnnModule.com
|
|
|
|
| |
|
|
Joined: 9/18/2005
Posts: 134
|
|
|
Thank you, it worked well. I have got it edited this way:
public ModuleActionCollection ModuleActions { get { ModuleActionCollection Actions = new ModuleActionCollection(); if (UserId!=-1&&UserInfo.Username.ToLower()=="abc") { Actions.Add(this.GetNextActionID(), "View Questions", ModuleActionType.AddContent, "", "", this.EditUrl("MyFormQuestions"), false, SecurityAccessLevel.View, true, false); } else { Actions.Add(this.GetNextActionID(), "Form Settings", ModuleActionType.AddContent, "", "", this.EditUrl("MyModuleSettings"), false, SecurityAccessLevel.Edit, true, false); Actions.Add(this.GetNextActionID(), "Form Settings", ModuleActionType.AddContent, "", "", this.EditUrl("MyModuleSettings"), false, SecurityAccessLevel.Edit, true, false); } return Actions; } }
Still one issue remains:
- I do use "View Questions" action redirecting me to MyFormQuestions.ascx (one of View mode controls of my DNN module), and the latter is displayed using default DNN site skin not my custom skin, which is used for when displaying calling control (control with "View Questions" action link).
Is there any way to display MyFormQuestions.ascx View mode control using my custom skin, which is assigned as default skin for module owning/hosting MyQuestions.ascx?
I guess
this.EditUrl("MyFormQuestions")
part of the code should be replaced with something like
this.ViewUrl("MyFormQuestions")
but this.ViewUrl(...) method is missing in the base class PortalModuleBase...
How should I fix the code? - Will DotNetNuke.Common.Globals.NavigateURL("MyFormQuestions") work well?
Thank you.
-- Shamil
|
|
|
|
| |
|
|
Joined: 9/18/2005
Posts: 134
|
|
|
I should set this thread status as 'Resolved' - the remaining issue I mentioned in my last posting of this thread: "Having multiple views of a module displayed using custom DNN site skin not administration skin (the latter one, admin modules skin is in my case set as a different skin)" was addressed many times AFAIS:
http://technicalsmile.blogspot.com/2011/05/more-than-one-view-or-edit-controls-in.html
http://kemmis.info/blog/archive/2009/05/05/managing-views-in-your-dotnetnuke-module.aspx
and that remaining issue has some solutions - I can try to develop them later...
|
|
|
|
| |