Project Page:
stylehelper.codeplex.com
Product of:
40Fingers
CorrectModuleCss attribute
Some module load style sheets after skin.css, while they should be loaded before.
Although you can overwrite their styles by using a more specific selector or !important, I prefer them loading in the correct order.
If CorrectModuleCss = true, StyleHelper will look for style sheets from the /Desktopmodules/ and /Admin/ folder and move them to position before skin.css.
(Only for style sheets loaded through Client Resource Management)
Example: <fortyfingers:STYLEHELPER ID="SH1" CorrectModuleCss="Trueg" runat="server" />
AddAfterBody attribute
This will render the passed string after the Body tag, before the From tag.
In some cases Google analytics needs code to be injected between Body and Form tag.
Example: <fortyfingers:STYLEHELPER ID="SH1" AddAfterBody="Injected after the Body tag" runat="server" />
BodyClass token: [CPState].
This will render "View, Edit or Layout" depending on the state of the controlpanel.
Default in BodyClass attribute = "CP-[CPState]", rendering:
CP-None, CP-View, CP-Edit or CP-Layout.
Fallback for setting unsupported doctype: do nothing :-)
Redirect: Some minor RedirectStop issues
Page Type Body Class
When you add this to the BodyClass Attribute: [PageType]
The Body element on the page will get a class indicating if this is the Home, Splash, Login page etc.
The injected class will be like this: "PageType_xxx"
Where "xxx" can be replaced by "Home", "Splash", "Login", "Register", "User", "Search" or "Normal" depending on the Site Settings.
Remove Javascript files
The new "RemoveJsFile" attribute allows you to remove JS files that have been injected using DNN Client Resource Mangement (CRM).
This version will only remove DNN's JS files, not the ones injected by Modules!
In short; when a JS link in the HEAD of the page looks like this: ..../file.js?cdv=xx you can remove it.
(Don't include the ?cdv=xx" part when referencing a file for removal)
Example: <fortyfingers:STYLEHELPER ID="SH1" RemoveJsFile="/jquery-ui.min.js" runat="server" />
Will remove jQuery UI from the page.
Remove multiple items using a comma separated list
This can be used to redirect Users that don't have view rights on a page.
I used this to give logged in users a better explanation than the standard DNN message.
Should be used in combination with the RedirectTo attribute for the redirect URL.
Ignores the redirectmode attribute as the redirect needs to be done before DNN processes the page.
Example: <fortyfingers:STYLEHELPER ID="SH1" IfNoViewRights="true" RedirectTo="/NoViewRights.aspx" runat="server" />
Redirect users without view rights to a page (using this skin) to the "/NoViewRights.aspx" page.
Remove Control
This will hide the control based on its server id (the ID in the ascx file).
Can be used to remove for instance a pane, based on one of the conditions. RemoveControl="RightPane" will remove the RightPane from the page source.
Multiple ID's can be passed like this: RemoveControl="BottomPane||RightPane"
IE11 detection correction
ASP.NET detects IE11 as "internetexplorer", while previous version returned "ie"
That's corrected now, StyleHelper now also return "ie" for IE11. :-)
[BcLevel] token for BodyClass
Renders a class for the levels in te breadcrumb.
BodyClass="[BcLevel]" will render a class for the current pages level and it's parents
Issue with multiple RemoveFromHead Values
Lead to an error, is fixed now.
[Culture] and [Language] to BodyClass
The current Page Culture and the Page Language are added to the Body element's CSS class.
The default template for the bodyclass is now:
"[BcName] [BcId] [BcNr] [UserPageRoles] Cult-[Culture] Lang-[Language]"
[Culture] renders the current Page Culture
[Language] renders the current Page Language
Example of rendered body tag:
<body id="Body" class="... Cult-en-US Lang-en">
Issue where injected elements were removed
The order of injecting and removing was incorrect.
Because of this a combination of removing and injecting could also remove the injected element.
Issue in mobile detection Regex.
Issue with comma separated values
IfUserMode
Condition based on the User Mode
Possible values:
Remove individual style sheets in DNN 6.1+
I had problems removing style sheets in DNN 6.1+
I now found a way to remove them anyway, without adding a custom provider.
Simply use the RemveoCssFile attribute as you would use it in DNN 5.
RemoveFromHead
Allows you to remove elements from the head of the page, depending of their attributes
For instance:
<fortyfingers:STYLEHELPER ID="SH1" RemoveFromHead="rel=SHORTCUT ICON" runat="server" />
will remove the favicon.
This will not work for the style sheets or JS as they are injected in a different way.
Pass multiple pairs separated by two pipe characters.
AddToHead support tokens
Now allows the use of tokens for the path.
For instance:
<fortyfingers:STYLEHELPER ID="SH1" IfBrowser="!IE<9" AddToHead="<script src='[S]Js/40fingers.js' type='text/javascript'></script>" runat="server" />
Will inject a JS file for all browsers bu IE below version 9.
Tokens:
[S] = Skin folder
[P] = Portal Home directory
[M] = Skin object home folder
[R] = Installation Root
[D] = DesktopModules Folder
Page Order class in Body Class:
On upgraded DNN installtions where some pages have a Culturecode and some not the order was calculated incorrectly.
This has been corrected by removing a not needed CultureCode check.
Fixed SuperUser Detection:
Passing IfRole="SuperUsers" did not detect Host users
This has been corrected now and the code has been rewritten.
Added ContentFalse attribute
This is the content that gets injected when the conditions are not met.
IfQs also to test if a query String Parameter exists
You can now pass a QS paramter without value
Where IfQS="ProductId:122" would test for a QS parameter ProductId with value 122
IfQS="ProductId" allows you to test if querystring parameter ProductId exists (has any value).
Added attribute Content
The passed value of this attribute will be injected if the set conditions are met.
This will be expanded in the future (load HTML file content and the use of tokens).
The code change for DNN6 caused stylsheets not be removed in DNN 5 anymore, fixed now..
Also added a warning for DNN6 users if the try something that does not work in DNN6.
Added attribute DetectMobileRegex1
You can use this attribute to overwrite the first regex used by the detectmobilebrowser.com method
Added attribute DetectMobileRegex2
You can use this attribute to overwrite the second regex used by the detectmobilebrowser.com method
Added Attribute: DetectMobileIncludeTablet
On detectmobilebrowser.com/about there's a method to include tablets as mobile devices (by changing the first regex).
If you set DetectMobileIncludeTablet to True, the first regex is replaced and Tablets are treated as mobile (although I'm not 100% sure this is up to date).
Intro: Redirect Logic changes
The way redirect were handled in a previous version was quite basic.
I mostly used it to redirect Mobile devices fromthe Home page of a regular website to a mobile site
I came a cross a more complex problem for a client were certain page should be redirected to the matching mobile pages.
To support that I restructured Redirecting and when to stop redirecting.
New attribute: RedirectName
You can give a redirect a name, to separate several redirects used on one site.
2 redirect with a different name will not influence each other
This way you can for instance have a Mobile redirect and a redirect for Internet Explorer 6 in the same skin.
It also allows you to share the same redirect over different skins using the same RedirectName.
New Attribute: RedirectBaseUrl
You can use this as a base for redirecting.
If set this will be combined with the RedirectUrl to the Url to redirect to.
You can use the RedirectBaseUrl in the RedirectStop to stop redirecting if you link back from any page on the redirect site.
New Attribute: RedirectStop With this attribute you set how you on what conditions the redirect is refused
If the redirect is refused, it depends on the RedirectMode attribute what happens the next time the user visits the site.
Possible Values:
Relationships with RedirectMode
With "RedirectStop" you set on what conditions redirect should NOT take place.
With "RedirectMode" you set what should happen after a redirect did not take place.
Examples:
IfMobile="True" RedirectTo="m.site.com" RedirectMode="Session"Will redirect the first visit of every session.
IfMobile="True" RedirectTo="m.site.com" RedirectMode="Once" RedirectStop="Revisit"Will redirect the first visit to this page of every session.
IfMobile="True" RedirectTo="m.site.com" RedirectMode="Always" RedirectStop="Never"Will always redirect the visitor to the mobile site. Visitng the regular site with a mobile device is impossible this way.
Changed Attribute: RedirectMode
You can now use: Always, Once, Session & Never
Never; was added as a way to not remove the the skin object, but switch the rediect off for testing purposes.
Session is the new default value, this used to be "Once". This was changed because session is the most common scenario.
Mobile Detection uses: detectmobilebrowsers.com/