This site's style is based on the Indiana Skin submitted to DotNetNuke for their 2004 Skinning Contest and is the work of Borza Paul Valentin. Thanks, Borza, and I'm sorry you didn't win. Here is a screenshot of Borza's original.
It was important to me to present a consistent look across dnn, nGallery, and .Text and that they were part of a unified application. Thusfar, that integration was focused on 3 objects: 1) the header, 2) footer, and 3) passing a user's dnn identity to nGallery and .Text to preserve the dnn “[user fullname]” | Login/Logout in the top-right header area. This post will focus on unifying the header and footer.
nGallery
nGallery bases its skinning on templates, with template variables entered at runtime from the Definitions Class in the nGallery.Lib namespace. As in
///
/// This template variable is used to get the name of the album.
///
public static readonly string T_ALBUM_NAME = "[$NG_ALBUM_NAME$]";
These varables are populated in a base Page class, nGalleryPage : System.Web.UI.Page. I added custom template variables in my own Definitions Class and populated them in the nGalleryPage base class.
if (HttpContext.Current.Request.QueryString["uid"] != null)
{
uid = int.Parse(HttpContext.Current.Request.QueryString["uid"].ToString());
HttpCookie cookie = new HttpCookie(cookieName);
if (cookie == null)
{
cookie.Expires = DateTime.Now.AddMinutes(20);
cookie.Values.Add("uid", uid.ToString());
HttpContext.Current.Response.Cookies.Add(cookie);
}
else
{
cookie.Values["uid"] = uid.ToString();
HttpContext.Current.Response.Cookies.Set(cookie);
}
if (uid == int.Parse(XMLUtil.GetValue("AnonymousUserID").ToString()))
{
stringBuilder.Replace(nGallery.Lib.DBVT.Definitions.DnnDBVTVariables.Dnn_DBVT_LOGIN,
nGallery.Lib.DBVT.Util.ShowLoginLink());
stringBuilder.Replace(nGallery.Lib.DBVT.Definitions.DnnDBVTVariables.Dnn_DBVT_USERNAME,
nGallery.Lib.DBVT.Util.ShowRegisterLink());
}
else
{
stringBuilder.Replace(nGallery.Lib.DBVT.Definitions.DnnDBVTVariables.Dnn_DBVT_LOGIN,
nGallery.Lib.DBVT.Util.ShowLogoutLink());
stringBuilder.Replace(nGallery.Lib.DBVT.Definitions.DnnDBVTVariables.Dnn_DBVT_USERNAME,
nGallery.Lib.DBVT.Util.ShowRegisterLink(uid));
}
stringBuilder.Replace(nGallery.Lib.DBVT.Definitions.DnnDBVTVariables.Dnn_DBVT_ADMINLINK,
nGallery.Lib.DBVT.Util.ShowAdminLink(uid));
}
As you can see, I added a Util class to retrieve the desired user names and strings. A few things to note:
- For nGallery I created both a DotNetNuke Anonymous Public User account and a Public nGallery Access role to support all non-registered users
- I added a UserConfig Class shared across the apps, but here am only interested in the UserID (uid) to populate the header User Fullname | Login/Logout strings and URLs
- The ShowAdminLink(uid) displays the link to the nGallery administration area that I only want to show if users (like me) are in the nGallery Administrative Access role I created.
Finally, these template variables were plugged into my nGallery skin's template.header.html, as in
<TR>
<TD class=IndianaButtonContainer0 nowrap>[$DNN_DBVT_USERNAME$]</TD>
<TD class=IndianaButtonSeparator><SPAN class=OtherTabs>|</SPAN></TD>
<TD class=IndianaButtonContainer0 noWrap>[$DNN_DBVT_LOGIN$]</TD>
</TR>
.Text
I found .Text easier to customize, since it is based on a straightforward Skin controls (here, the header.ascx control), where I added simple Label webcontrols. I used the same nGallery.Lib custom methods I created to display User Fullname | Login/Logout string and URL info, which was pretty cool.