How to enable the signin link for user

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
3/26/2010 10:29:03 AM
Gravatar
Total Posts 156

Re: How to enable the signin link for user

I have come up with a customized admin panel and basically don't want it to be visible unless the user is signed in.  I tried incorporating your usercontrol suggestion I'm getting weird results.

Here's what the menu looks like when the user is signed in:  http://bit.ly/9ThUbL

The following is my usercontrol code:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="AdminOnlyLinks.ascx.cs" ClassName="AdminOnlyLinks.ascx" Inherits="Controls_AdminOnlyLinks" %>
<div id="admin">
<div id="buttons">
<portal:LogoutLink id="LogoutLink" runat="server" CssClass="logoff" RenderAsListItem="false" />
<portal:SiteMapLink id="SiteMapLink1" runat="server" />
<a href="/Admin/ContentCatalog.aspx">Content Manager</a>
<a href="/Admin/PageTree.aspx">Add/Edit Pages</a>
<asp:ContentPlaceHolder ID="pageEditContent" runat="server"></asp:ContentPlaceHolder>
</div>
<a id="show_hide" class="arrow down" href="javascript:toggleVisibility()"></a>
</div>

 

However, when I insert  <cc1:AdminOnlyLinks id="hiddenlinks1" runat="server" /> , I get the following: http://bit.ly/abpQNZ

I get an error in the log:

 

2010-03-26 12:16:42,268 ERROR mojoPortal.Web.mojoBasePage - Error setting master page. Will try setting to default skin.en-US - 131.156.71.164
System.Web.HttpParseException: Unknown server tag 'cc1:AdminOnlyLinks'. ---> System.Web.HttpParseException: Unknown server tag 'cc1:AdminOnlyLinks'. ---> System.Web.HttpException: Unknown server tag 'cc1:AdminOnlyLinks'.

I added a directive to the layout.master as like so:

<%@ Register Src="~/Controls/Custom/AdminOnlyLinks.ascx" TagName="AdminOnlyLinks" TagPrefix="cc1" %>

 

Here's the code-behind file just in case:

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

using mojoPortal.Web;
using mojoPortal.Web.UI;
using mojoPortal.Web.Framework;
using mojoPortal.Business;
using mojoPortal.Business.WebHelpers;


public partial class Controls_AdminOnlyLinks : System.Web.UI.UserControl
{

protected void Page_Load(object sender, EventArgs e)
{
PageSettings currentPageSettings = CacheHelper.GetCurrentPage();
SiteSettings siteSettings = CacheHelper.GetSiteSettings(currentPageSettings.SiteId);
string siteRoot = WebUtils.GetSiteRoot();

if (
(WebUser.IsAdminOrContentAdminOrRoleAdmin)
|| (
(WebConfigSettings.UseRelatedSiteMode)
&& (WebUser.IsInRoles(siteSettings.SiteRootEditRoles))
)
)
{
this.Visible = true;
}

else
{ this.Visible = false; }
}
}

3/28/2010 4:07:44 PM
Gravatar
Total Posts 2239

Re: How to enable the signin link for user

Hi,

Sorry it has taken me so long to respond. I have been out of the office for a couple days.

Try removing the contentplaceholder from your user control and let me know if that helps at all. I copied your code a test site of mine and having the contentplaceholder threw an error. It wasn't the same error you are posting but after removing the contentplaceholder everything worked as it should.

You may want to make sure your <%@ register line is exactly as you posted it.

HTH,
Joe D.

3/29/2010 10:18:09 AM
Gravatar
Total Posts 156

Re: How to enable the signin link for user

Removed the ContentPlaceHolder like you suggested - didn't help.  This is what I have in the log:

 

2010-03-29 10:17:04,033 ERROR mojoPortal.Web.mojoBasePage - Error setting master page. Will try setting to default skin.en-US - 131.156.71.164
System.Web.HttpParseException: ContentPlaceHolder can only be used in .master files. ---> System.Web.HttpParseException: ContentPlaceHolder can only be used in .master files. ---> System.Web.HttpException: ContentPlaceHolder can only be used in .master files.
at System.Web.UI.WebControls.ContentPlaceHolderBuilder.Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, String tagName, String ID, IDictionary attribs)
at System.Web.UI.ControlBuilder.CreateBuilderFromType(TemplateParser parser, ControlBuilder parentBuilder, Type type, String tagName, String id, IDictionary attribs, Int32 line, String sourceFileName)
at System.Web.UI.ControlBuilder.CreateChildBuilder(String filter, String tagName, IDictionary attribs, TemplateParser parser, ControlBuilder parentBuilder, String id, Int32 line, VirtualPath virtualPath, Type& childType, Boolean defaultProperty)
at System.Web.UI.TemplateParser.ProcessBeginTag(Match match, String inputText)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
--- End of inner exception stack trace ---
at System.Web.UI.TemplateParser.ProcessException(Exception ex)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
--- End of inner exception stack trace ---
at System.Web.UI.TemplateParser.ProcessException(Exception ex)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
at System.Web.UI.TemplateParser.ParseInternal()
at System.Web.UI.TemplateParser.Parse()
at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection)
at System.Web.UI.Page.get_Master()
at mojoPortal.Web.mojoBasePage.SetupMasterPage()
at mojoPortal.Web.mojoBasePage.OnPreInit(EventArgs e)
2010-03-29 10:17:11,500 ERROR mojoPortal.Web.mojoBasePage - Error setting master page. Will try setting to default skin.en-US - 131.156.71.164
System.Web.HttpParseException: ContentPlaceHolder can only be used in .master files. ---> System.Web.HttpParseException: ContentPlaceHolder can only be used in .master files. ---> System.Web.HttpException: ContentPlaceHolder can only be used in .master files.
at System.Web.UI.WebControls.ContentPlaceHolderBuilder.Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, String tagName, String ID, IDictionary attribs)
at System.Web.UI.ControlBuilder.CreateBuilderFromType(TemplateParser parser, ControlBuilder parentBuilder, Type type, String tagName, String id, IDictionary attribs, Int32 line, String sourceFileName)
at System.Web.UI.ControlBuilder.CreateChildBuilder(String filter, String tagName, IDictionary attribs, TemplateParser parser, ControlBuilder parentBuilder, String id, Int32 line, VirtualPath virtualPath, Type& childType, Boolean defaultProperty)
at System.Web.UI.TemplateParser.ProcessBeginTag(Match match, String inputText)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
--- End of inner exception stack trace ---
at System.Web.UI.TemplateParser.ProcessException(Exception ex)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
--- End of inner exception stack trace ---
at System.Web.UI.TemplateParser.ProcessException(Exception ex)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
at System.Web.UI.TemplateParser.ParseInternal()
at System.Web.UI.TemplateParser.Parse()
at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection)
at System.Web.UI.Page.get_Master()
at mojoPortal.Web.mojoBasePage.SetupMasterPage()
at mojoPortal.Web.mojoBasePage.OnPreInit(EventArgs e)

3/30/2010 11:45:53 AM
Gravatar
Total Posts 2239

Re: How to enable the signin link for user

Hello,

I'm sorry but that doesn't make much sense. How would you get an error about ContentPlaceHolders only being used in master files after you have removed it from the code?

When I am troubleshooting something like this, I use the Clear Log button to clear the log and then when it reloads the page, the only data in the log are the errors encountered when generating that page. This ensures you aren't looking at old errors and makes finding the errors a lot easier.

I have copied the code I gave you to an entirely new site and it is working as expected. You may want to see if you make the code I posted work before modifying it and then post your results.

HTH,
Joe D.

3/30/2010 11:46:49 AM
Gravatar
Total Posts 2239

Re: How to enable the signin link for user

Hi,

I just wanted to say that I really like the site design you have created. Great Job!

Thanks,
Joe D.

3/30/2010 4:24:29 PM
Gravatar
Total Posts 156

Re: How to enable the signin link for user

Joe,

I previously tried commenting out the ContentPlaceHolder using <!-- and -->, but that did not work apparently.  I took that out completely and that resolved this "issue."  However, the real problem is that I do need those links in there regardless.  Also, even now that the ContentPlaceHolder is out, the rest of the links don't show up all of a sudden.

How do I go about this?

3/31/2010 1:54:34 PM
Gravatar
Total Posts 156

Re: How to enable the signin link for user

Thanks for the complements :)

Another important detail is that if I do take out " <asp:ContentPlaceHolder ID="pageEditContent" runat="server"></asp:ContentPlaceHolder>" and place it in the AdminOnlyLinks control, then mojoPortal complaints about the lack of pageEditContent in the layout.master.

So I how do I make sure that AdminOnlyLinks contains pageEditContent w/o causing any problems here?
 

4/9/2010 9:39:42 AM
Gravatar
Total Posts 156

Re: How to enable the signin link for userNo

Nothing hmm...

4/9/2010 9:53:52 AM
Gravatar
Total Posts 18439

Re: How to enable the signin link for user

Hi,

<asp:ContentPlaceHolder ID="pageEditContent" runat="server"></asp:ContentPlaceHolder> can only exist in layout.master, you must leave it there and not put it inside a UserControl.

However, that placeholder is only used if the individual admin links do not exist in the layout.master then the admin/edit links will be added inside it. However the admin/edit links are already shown/hidden based on user roles so only users with correct roles will see those. Most of the included skins have the admin/edit links directly in layout.master ie in the admin toolbar at the bottom.

You could try marking the pageEditContent placeholder with Visible="false" in layout.master and then add those individual links to your usercontrol

<portal:AdminMenuLink id="lnkAdminMenu" runat="server" />
  <portal:FileManagerLink id="lnkFileManager" runat="server" />
  <portal:NewPageLink id="lnkNewPage" runat="server" />
  <portal:PageEditFeaturesLink id="lnkPageContent" runat="server" />
  <portal:PageEditSettingsLink id="lnkPageSettings" runat="server" />

Hope it helps,

Joe

4/9/2010 9:57:00 AM
Gravatar
Total Posts 2239

Re: How to enable the signin link for user

Hi,

Sorry again for the delay.

You shouldn't take <asp:ContentPlaceHolder ID="pageEditContent" runat="server"></asp:ContentPlaceHolder> out of the layout.master. The ContentPlaceHolder I mentioned you should remove is the one that you had in your AdminOnlyLinks.ascx file.

I will create a zip for this control and put in the downloads page on my website. I will post here when I have done that. Once you have this code working, you can modify it for your own styling.

Thanks,
Joe D

4/9/2010 10:23:07 AM
Gravatar
Total Posts 2239

Re: How to enable the signin link for user

Hi,

I have created a download on my Website for this control. You can browse to http://i7media.net/downloads, click mojoPortal and then you will see the AdminOnlyLinks.zip download.

HTH,
Joe D.

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