Define CSS class's on tables in Sitecore - css

In one of my Sitecore solutions the user needs to have some predefined CSS class's that they can put on their tables created in the richtext editor from the back office.
When I go to the Table wizard I can see the CSS class dropdown list, but the only option that's available is one called "Clear class".
How can I define some more class's in that drop down list?

You want to find the following setting in the web.config:
<!-- WEB SITE STYLESHEET
CSS file for HTML content of Sitecore database.
The file pointed to by WebStylesheet setting is automatically included in Html and Rich Text fields.
By using it, you can make the content of HTML fields look the same as the actual Web Site
-->
<setting name="WebStylesheet" value="/default.css" />
Whatever that CSS file is, that's the one where you can add your new classes. Once you change it, clear your browser cache and re-open the browser. The RTE should then get the new classes.

Problem:
Need to add predefined css in external css to RadEditor in Sitecore CMS
Solution:
Add css class to default.css which can be found in WEB_ROOT/Web.config on the following line:
<setting name="WebStylesheet" value="/default.css" />
Example css:
.cufon {
font-weight: bold;
color: #666;
}
Modify the ToolsFile.xml defined in where the Sitecore uses the RadEditor (in my case: WEB_ROOT/sitecore/shell/Controls/Rich Text Editor/Default.aspx) and add the following lines:
<classes>
<class name="Clear Class" value="" />
<class name="Cufon Book" value=".cufonBook" />
<class name="Cufon Light" value=".cufonLight" />
</classes>
Reference:
RadControls – CSS Styles http://www.telerik.com/help/aspnet-ajax/cssstyles.html
how to load css classes from my own project specfic css in Sitecore’s RAD editor? how to load css classes from my own project specfic css in Sitecore's RAD editor?

Related

CSS not loading in Jira server report

I am developing a jira server report and I am not able to load my css file.
In my atlassian-plugin.xml I define my web-resource like this:
<web-resource key="jira-reports-resources" name="wl-jira-report-plugin Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<resource type="download" name="jira-report-plugin.css" location="/css/jira-report-plugin.css"/>
<resource type="download" name="jira-report-plugin.js" location="/js/jira-report-plugin.js"/>
<resource type="download" name="images/" location="/images"/>
<context>jira-reports-context</context>
</web-resource>
and my report like this:
<report name="Massnahmen Verantwortlichkeit Report" i18n-name-key="report.massnahme.name"
key="massnahme-report" class="com.example.reports.massnahme.MassnahmeReport">
<description key="report.massnahme.description"></description>
<resource name="view" type="velocity" location="/templates/reports/massnahme/view.vm"/>
<resource name="i18n" type="i18n" location="report-massnahme"/>
<label key="report.massnahme.label"></label>
<!-- the properties of this report which the user must select before running it -->
<properties>
<property>
<key>departmentLeaderId</key>
<name>report.massnahme.input.user.name</name>
<description>report.massnahme.input.user.description</description>
<type>multiselect</type>
<values class="com.example.reports.massnahme.generator.MassnahmeUserGenerator"/>
</property>
</properties>
</report>
In my report java class I add the WebResourceManager into the velocityParams and in my view.vm I call it in the first row:
$webResourceManager.requireResourcesForContext("jira-reports-context")
In my view.vm I use a table-based presentation and I want to use a accordion technique to fold rows in my table. My javascript is loaded and the click listener works as intended. But my css file is completely ignored. When I inspect the page in chrome the css classes are not loaded at all. I tried some easy things like
.test-table{
border: 1px solid black;
}
and nothing is showing up.
How do I have to define my css class for using it in a report? I was surprised to see that I can not add css or javascript to the report element itself. Or do I have an error in my code definition? Any ideas?
Try this
webResourceManager.requireResource("groupId.artifactid:web-resource").
Example from the below link:
webResourceManager.requireResource("com.avvd.jira.plugin.inquirer:inquirer-resources")
https://community.atlassian.com/t5/Answers-Developer-Questions/Velocity-don-t-load-resource/qaq-p/489704
Thanks
Try not to use "-" in your context string, replace all the "-" with "."
<context>jira.reports.context</context>
and
$webResourceManager.requireResourcesForContext("jira.reports.context")
Even the answer was not quite correct, the link #MrKumar posted showed me the correct way. Apparently for CustomFields the approach using the method requireResource() is outdated and one should put these resources in <context>atl.general</context>. It worked directly with my reports too.

DotNetNuke/Evoq - add custom stylesheets just before closing head

I'm trying to add two custom css stylesheets just before the closing </head> without breaking skin and/or hacking skin?
I built two css files to turn site into responsive design without actually touching any of the skin/template code so it's necessary to have in last ordering of css files.
Your best best is to register it using the DNN CSS Include skin object, adding it to your skin and simply setting a priority that is high.
<dnn:DnnCssInclude runat="server" FilePath="~/Your-PathHere" Priority="100" />
You just need to be sure that you have the following register in your skin as well.
<%# Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %>
The full API Details for Client Resource Management will help. Highest DNN priority appears to be 35

How to apply a CSS class to all instances of a control in ASP.NET

I am trying to implement the jQuery UI framework for my ASP.NET project. And the way I thought of going about doing this is to just apply CSS to my controls.
For example, I have a bunch of GridView controls. Is there an easy way to apply a CSS class to all of them at once instead of using the "onRender" event on each instance like I have read online?
You can create a .skin file that specifies the CssClass to apply to each GridView. See ASP.NET Themes and Skins in MSDN Library for more information.
// In your App_Themes/SomeTheme/Default.skin file:
<asp:GridView runat="server" CssClass="YourCssClass" />
// In Web.config:
<pages styleSheetTheme="SomeTheme" />
If you want to apply a css class to all instances of GridViews is your ASP.NET app, you could look at the skin files for an ASP.NET theme.
http://msdn.microsoft.com/en-us/library/ykzx33wh.aspx#ThemesAndControlSkins

Creating ASP.NET composite control. How to apply properties associated with SkinID?

I am creating a custom composite control based off of an asp:Label control. I'd like to be able to have the label's default properties be skinable as well as additional properties that I add to my control.
But when I add a skin definition to the Default.skin file in my themes directory, and add the control to my page with the SkinId specified, I cannot figure out how to get the control to render with the Skinned properties.
Additional points:
My custom control is defined in a separate library/dll.
I added one test property, and added the [Themeable(false)] attribute. Then I set that property in the .skin file. I didn't get any errors when I tried to view the page, so it appears to me that the .skin file is not getting applied or that the control def in the skin file doesn't get matched up with the control def in the aspx page.
From the skin file:
<ctrl:ExtendedLabel SkinId="test" runat="server"
Expandable="true" Lookup="true" Required="true"
RequiredCssClass="required" Text="Hello" />
From the aspx page:
<ctrl:ExtendedLabel SkinID="test" runat="server"/>
From web.config:
<pages>
<controls>
<add tagPrefix="ctrl" namespace="MyCompany.WebControls"
assembly="MyCompany.Web" />
</controls>
</pages>
I added a test property to the control, marked it as [Themeable(false)] in order to test if I'd get the runtime error when setting that property in the skin file. No error.
Notice that the pages tag doesn't have a styleSheetTheme attribute. I do however, have a Base page class that overrides StyleSheetTheme property, which seems to work for everything else.
If I add the styleSheetTheme attribute to the pages tag in web.config, the skin stuff works, including getting the error if I try to set the non-Themeable property.
What's the difference? How can I get it to work with the Base page class property code?
What are you getting when you try this? I just created a simple test project and was able to skin a custom property on a web custom control. My steps were:
Create the custom control.
Add [Themeable(true)] attribute to the class definition in the code-behind file.
Add a Label control to my custom control.
Add a property named "LabelText" to my custom control, which gets/sets the label controls Text value.
In web.config, add 'theme="TestTheme"' to the system.web/pages section.
In web.config, add '<add tagPrefix="mine" tagName="Test" src="~/UI/Test.ascx" />' to the system.web/pages/controls section.
In my Default.skin file, added '<mine:Test runat="server" LabelText="Test Text" />
In Default.aspx, added '<mine:Test id="test1" runat="server" />'
Load the page up and see the text "Test Text", which was only present in the Skin file.
Hopefully one of my steps above will be something you forgot, but if not, please update your question with details on what you are trying and what you are seeing.

jQuery Menu and ASP.NET Sitemap

Is it possible to use an ASP.NET web.sitemap with a jQuery Superfish menu?
If not, are there any standards based browser agnostic plugins available that work with the web.sitemap file?
I found this question while looking for the same answer... everyone says it's possible but no-one gives the actual solution! I seem to have it working now so thought I'd post my findings...
Things I needed:
Superfish which also includes a version of jQuery
CSS Friendly Control Adaptors download DLL and .browsers file (into /bin and /App_Browsers folders respectively)
ASP.NET SiteMap (a .sitemap XML file and siteMap provider entry in web.config)
My finished Masterpage.master has the following head tag:
<head runat="server">
<script type="text/javascript" src="/script/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/script/superfish.js"></script>
<link href="~/css/superfish.css" type="text/css" rel="stylesheet" media="screen" runat="server" />
<script type="text/javascript">
$(document).ready(function() {
$('ul.AspNet-Menu').superfish();
});
</script>
</head>
Which is basically all the stuff needed for the jQuery Superfish menu to work. Inside the page (where the menu goes) looks like this (based on these instructions):
<asp:SiteMapDataSource ID="SiteMapDataSource" runat="server"
ShowStartingNode="false" />
<asp:Menu ID="Menu1" runat="server"
DataSourceID="SiteMapDataSource"
Orientation="Horizontal" CssClass="sf-menu">
</asp:Menu>
Based on the documentation, this seems like it SHOULD work - but it doesn't. The reason is that the CssClass="sf-menu" gets overwritten when the Menu is rendered and the <ul> tag gets a class="AspNet-Menu". I thought the line $('ul.AspNet-Menu').superfish(); would help, but it didn't.
ONE MORE THING
Although it is a hack (and please someone point me to the correct solution) I was able to get it working by opening the superfish.css file and search and replacing sf-menu with AspNet-Menu... and voila! the menu appeared. I thought there would be some configuration setting in the asp:Menu control where I could set the <ul> class but didn't find any hints via google.
Yes, it is totally possible.
I have used it with the ASP:Menu control and jQuery 1.2.6 with the Superfish plugin. Note, you will need the ASP.NET 2.0 CSS Friendly Control Adapters.
ASP.NET generates the ASP:Menu control as a table layout. The CSS Friendly Control Adapter will make ASP.NET generate the ASP:Menu control as a UL/LI layout inside a div.
This will allow easy integration of the jQuery and Superfish plugin because the Superfish plugin relies on a UL/LI layout.
It looks like you need to generate a UL for Superfish. You should be able to do this with ASP.Net from your site map. I think the site map control will do something like this. If not, it should be pretty trivial to call the site map directly from C# and generate the DOM programmatically. You could build a user control to do this, or do it in the master page.
Check out this MSDN article on how to programmatically enumerate the nodes in your site map.
Remember to add css classes for NonLink elements. Superfish css elements don't acccont for them. And if you're like me and have root menu's that are not links, then it renders horribly. Just add AspNet-Menu-NonLink elements to the superfish.css file and it should render fine.
The SiteMapDataSource control should be able to bind to any hierarchical data bound control. I'm not familiar with superfish but I know there are plenty of jQueryish controls out there to do this.
I created a neat little sample project you can use at http://simplesitemenu.codeplex.com/
It is a composite control which generates a nested UL/LI listing from your sitemap.
Enjoy!

Resources