Link writer url properties

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
5/25/2007 9:47:33 AM
Gravatar
Total Posts 11

Link writer url properties

Suggestion for things such as SiteHome.OnPreInit() [/web/default.aspx.cs] SiteMapLink.Render()[/web/controls/SiteMapLink.cs] and PageMenu.RenderTreeView() [/web/controls/PageMenu.ascx.cs]:

Any control/class that writes out links to the screen (style sheets, sitemap links, etc) should have a property to set the link(s) to write.  For example: 

Currently, the code for stylesheets looks like so:

[code]

<portal:StyleSheet id="StyleSheet" runat="server" />

StyleSheet stylesheet = (StyleSheet)Master.FindControl("StyleSheet");
if (stylesheet != null)
{
string baseSkinUrl = SiteUtils.GetSkinBaseUrl(allowPageOverride);

stylesheet.LiteralStyleSheetUrl.Text
= "\n<link href='"
+ baseSkinUrl
+ "style.css' type='text/css' rel='stylesheet' />"
+ "\n<link href='"
+ baseSkinUrl
+ "styletext.css' type='text/css' rel='stylesheet' title='" + Resource.NormalTextLabel + "' />"
+ "\n<link href='"
+ baseSkinUrl
+ "styletextmedium.css' type='text/css' rel='alternate stylesheet' title='" + Resource.MediumTextLabel + "' />"
+ "\n<link href='"
+ baseSkinUrl
+ "styletextlarge.css' type='text/css' rel='alternate stylesheet' title='" + Resource.LargeTextLabel + "' />"
+ "\n<link href='"
+ baseSkinUrl
+ "styleprinter.css' type='text/css' rel='stylesheet' media='print' />";
}

[/code]

I suggest that it be changed to something like this:

[code]

<portal:StyleSheet id="StyleSheet" runat="server" files="style.css,styletext.css"/>

StyleSheet stylesheet = (StyleSheet)Master.FindControl("StyleSheet");

string[] files;
if (stylesheet != null)
{
string baseSkinUrl = SiteUtils.GetSkinBaseUrl(allowPageOverride);
files = stylesheet.Files.split(",");

for(int i = 0; i < files.length; i++){
stylesheet.LiteralStyleSheetUrl.Text += "\n<link href='"
+ baseSkinUrl + files[i] + "'"
+ type='text/css' rel='stylesheet' title='" + Resource.NormalTextLabel + "' />"

}

}

[/code]

 

5/25/2007 10:19:31 AM
Gravatar
Total Posts 18439

Re: Link writer url properties

My original intent was to encapsulate that in StyleSheet, however there are some complexities to support skins set at the page level, and user skins. In mojoBasePage we set the skins with allowOverride = false while in SiteHome it is true. SiteHome is used for all content system pages but other pages in the site inherit from mojoBasePage besides the content pages. This way pages outside the ocntent system use the site default skin by default.

I am doing some work for a customer to better enable partitioning sections of a site to use specific skins and to give them the appearance of being separate sites even though they are really sections within a site. That is also going to impact the implementation of stylesheets so once I have that all worked out I will tidy up the code a little, I admit its not the prettiest thing right now but its because I'm still working on the ideas.

Joe

5/25/2007 10:22:25 AM
Gravatar
Total Posts 18439

Re: Link writer url properties

Your code idea looks good, I may do just that at least for some of them, but note that there are some with rel=alternate and some with localized titles.

Thanks,

Joe

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