This is a migrated thread and some comments may be shown as answers.

Define css files dynamically

12 Answers 120 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
viex
Top achievements
Rank 1
viex asked on 21 Sep 2007, 10:37 AM
Hi,

I would like to define dynamically css files used in the custom "Apply CSS class" drop down.

for example, in some pages or spweb, i would like to show custom css class.
However, in other ones, i don't want to show them.
i.e. : Depending on the context, i need different css class

I did not find a way to do it easily with the current RadHtmlField.
One solution would be to define a different config file for each spweb or page, but it would be really difficult to maintain (because there is more information in the config file than the css files only)

I think RadEditor defines a Property called "CssFiles" which can be used to define css file.
However, the MOSSRadEditor (the derived class of RadEditor) which is contained in the RadHtmlField is private, so I can't define the property.

I think there are at least 2 solutions:
- Show the property "CssFiles" on the RadHtmlField
- change "private MOSSRadEditor radEditorControl" to "protected ..."
or....?

Thank you,

Sylvain

12 Answers, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 21 Sep 2007, 03:47 PM
Hello,

We have decided to make the radEditorControl protected so it can be used from derived controls. This should provide you with the ability to change virtually every property dynamically. The update will be available in the next MOSS editor release (planned for next week).

All the best,
Lini
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
viex
Top achievements
Rank 1
answered on 24 Sep 2007, 07:17 AM
Hello,

Thank you for your quick answer.
I am looking forward to test the next release :)

Regards,

Sylvain


0
Tom
Top achievements
Rank 1
answered on 24 Sep 2007, 03:42 PM
I am also looking forward to that feature. That and the MOSSLinkManger bug correction.

Thanks,
Tom
0
Lini
Telerik team
answered on 25 Sep 2007, 07:28 AM
Hi Tom,

I just checked the changelog for the upcoming release and did not see an issue, related to the link manager. Could you describe it or post a link to the thread where it is discussed, so I can add it in the changelog?

Sincerely yours,
Lini
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
viex
Top achievements
Rank 1
answered on 04 Oct 2007, 07:25 AM
Hi,

Do you know when the next release will come up?
I need the fix for defining css files for tomorrow (the fix is to change a private attribute to protected ...).

If there is no release this week, is it possible for you to send me a pre-release version?

I can't open a support ticket because I did not buy RadEditor for MOSS yet (only rad controls for Asp.net...)

Thanks a lot

Sylvain
0
Tom
Top achievements
Rank 1
answered on 04 Oct 2007, 02:26 PM

Set a custom path to the ToolConfig.xml in the RadE Tag

Place the RadE tag on the PageLayout into a User Control.

In the onload event of the user control you can use CAML to scan the listid via the SPSiteDataQuery.

Replace the custom path to whatever configuration you want for that listid/


 

0
viex
Top achievements
Rank 1
answered on 04 Oct 2007, 02:40 PM
Hi tom,

thx for the solution, but I don't want to define All settin each time.
I just want to change the css files !
...
0
Tom
Top achievements
Rank 1
answered on 04 Oct 2007, 03:43 PM
I assume you installed this throught the convetional solution package telerik provides (can be found in a whitepaper on this site):

Then just add a class file called CssEditor.css to
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\wpresources\RadEditorSharePoint\4.3.2.0__1f131a624888eeed\RadControls\Editor

(change 4.3.2 to 4.3.1 for older version)

The editor will add your styles to the defualt styles listed in the dropdown.

However, if you want to change the actual dropdown for 1 to N users you will have to follow my last post and confiure the ToolsXML file.

And you will want to move the file into a central location and so that your customization isn't lost when you install future versions.

Hope this helps.

Tom

0
viex
Top achievements
Rank 1
answered on 04 Oct 2007, 04:06 PM
Thank you for your quick reply.

However :
If I understood your explanation, in the end, your solution is to define programmatically (depending on the context) the path to a config file.

The problem is that, depending on the context, I want to include file1.css, file2.css, file3.css and file4.css; or file2.css and file25.css...

I cannot write the config files for all combinations (because there is too many css files and because the number of css files change).

Thanks anyway ;)

Sylvain
0
Tom
Top achievements
Rank 1
answered on 04 Oct 2007, 04:43 PM
I see the difference, now. I haven't had to push the editor in that way yet...

I have a couple therories that may do it, but would need to be taken into the lab to prove them out. 

At a minimum you need a lookup table (likely XML), a way to read the context of the page loading and then a routine to match things up.

Assuming this is already done, maybe there is a way to dynamically put these properties directly into the RadE tag itself.

You would still have to use a usercontrol, but if the tag properties override the loaded css it could work.

The other thought would be to define one massive CssEditor.css file and then using the various to ToolConfig.xml method, you could hide / show the classes in the various ToolConfigs based on the page loading context.

This would be about as much maintenance as keeping on top of all of the different css files and probably the first thing I would try.

Let me know how it finally turns out.

Tom












0
viex
Top achievements
Rank 1
answered on 05 Oct 2007, 06:30 AM
I just saw the new Release : the 4.4.0 version.

Now the MOSSRadEditor in the RadHtmlField is protected, so I will be able to define css files.
I did not test it yet, but I have good hopes.

Thanks Telerik team (and tom)
0
Lini
Telerik team
answered on 05 Oct 2007, 08:45 AM
Indeed, version 4.40 was released yesterday. Let us know if you have any problems with the new bits.

Lini
the Telerik team
Tags
WebParts for SharePoint
Asked by
viex
Top achievements
Rank 1
Answers by
Lini
Telerik team
viex
Top achievements
Rank 1
Tom
Top achievements
Rank 1
Share this question
or