Customize FCK editor CSS stylesheet

View: New views
3 Messages — Rating Filter:   Alert me  

Customize FCK editor CSS stylesheet

by HENRY Pierre :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I would like to use my own template set's stylesheet for text edited in
FCK editor.

I know I can put this in /WEB-INF/etc/htmleditors/htmleditors_config.xml
as a css tag.

My problem is that our CSS is a jsp file that's included in the template
sets. So the path of the css file would be something like
/jsp/jahia/templates/<my site>/<template set in use>/css.jsp

The second specialty is that the css uses a parameter that is stored as
a site-level meta-data, to chose between 6 different color sets.

So in the ideal, what I would like to be able to do is to get the
current site's name, the value of the meta data for the current site,
call the jsp and use the generated result my stylesheet in fck editor
(or any other editor).

Any idea as to how to realize this, even partially ? Should the jsp-css
be stored in a static path, not in the templates directory ? Any pointer
welcome !

Best Regards

Pierre Henry
_______________________________________________
install_list mailing list
install_list@...
http://lists.jahia.org/cgi-bin/mailman/listinfo/install_list

Re: Customize FCK editor CSS stylesheet

by Sergiy Shyrkov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Pierre,

which version of Jahia are you using currently? Is it Jahia 5.0 SP3
(build 18957)?
In Jahia 5.0 SP3 it is possible to configure separate CSS stylesheet
(per virtual site or even per template) for the FCKeditor.

Kind regards
Sergiy

HENRY Pierre wrote:

> Hello,
>
> I would like to use my own template set's stylesheet for text edited in
> FCK editor.
>
> I know I can put this in /WEB-INF/etc/htmleditors/htmleditors_config.xml
> as a css tag.
>
> My problem is that our CSS is a jsp file that's included in the template
> sets. So the path of the css file would be something like
> /jsp/jahia/templates/<my site>/<template set in use>/css.jsp
>
> The second specialty is that the css uses a parameter that is stored as
> a site-level meta-data, to chose between 6 different color sets.
>
> So in the ideal, what I would like to be able to do is to get the
> current site's name, the value of the meta data for the current site,
> call the jsp and use the generated result my stylesheet in fck editor
> (or any other editor).
>
> Any idea as to how to realize this, even partially ? Should the jsp-css
> be stored in a static path, not in the templates directory ? Any pointer
> welcome !
>
> Best Regards
>
> Pierre Henry
> _______________________________________________
> install_list mailing list
> install_list@...
> http://lists.jahia.org/cgi-bin/mailman/listinfo/install_list
>
>  

_______________________________________________
install_list mailing list
install_list@...
http://lists.jahia.org/cgi-bin/mailman/listinfo/install_list

Parent Message unknown Re: Customize FCK editor CSS stylesheet

by Sergiy Shyrkov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Pierre,

for now you can configure one JSP, which will generate the CSS file (or
include others) based on the current site.
The solution is not perfect, as you said, but will work.

For example, you configure a file /jsp/jahia/engines/css/test_css.jsp
file for the FCKeditor (htmleditors_config.xml), with the following content:

<%@ page import="org.jahia.params.ProcessingContext,
org.jahia.services.sites.JahiaSite" %><%
    response.setHeader("Cache-Control","no-store, no-cache,
must-revalidate, max-age=0"); //HTTP 1.1
    response.addHeader("Cache-Control","post-check=0, pre-check=0");
    response.setHeader("Pragma","no-cache"); //HTTP 1.0
    response.setDateHeader ("Expires", -1);

JahiaSite site = (JahiaSite)
session.getAttribute(ProcessingContext.SESSION_SITE);
if (site != null) {
    String colorSet = "green"; // obtain the color set based on site data
    String cssPath = "/jsp/jahia/templates/" + site.getSiteKey() +
"/corporate_portal_templates/web_css.jsp"; // obtain the path to CSS or
a JSP, that generates CSS, based on the site key
   
    %><jsp:include page="<%=cssPath %>"/>
<% } %>

Based on the current site, you can include different CSS stylesheets or
calculate a path to a JSP, which will generate CSS styles.
The only problem I see here is that you will need to set proper response
headers to disabled client-side caching, as different stylessheets will
be served under the same URL.


Another possibility is to adjust the
/jsp/jahia/htmleditors/fckeditor/fckeditor_htmleditor.jsp according to
your needs and set the value of the JavaScript variable for FCKeditor:

   oFCKeditor.Config.EditorAreaCSS

to a proper path based on the current site, metadata or another
information. This should not be hard to change.
This approach seems more robust and consistent for me (also the
stylesheets can be cached by the client, improving the performance). The
advantage here is that your also have access to all Jahia objects
(ParamBean, JahiaData etc.) to be able to retrieve the required data.


Kind regards
Sergiy

HENRY Pierre wrote:

> Hello Sergiy,
>
> Thanks for the reply, but no we are still using Jahia 4.2.1.
>
> I think that I will just store the sylesheet jsp somewhere outside the templates, and create various css elements in the xml file, each with the color set parameter hard coded in the url. Users will have to select the right color set to match their site's color set. Not perfet but it will work in most cases. Until we migrate to 5.0 SP3...
>
> Best regards,
> Pierre Henry
>
> -----Message d'origine-----
> De : Sergiy Shyrkov [mailto:my.public.mailing@...]
> Envoyé : vendredi, 30. mai 2008 09:38
> À : In this list you can send questions and discuss installation problems as well as suggest installation improvements.
> Cc : HENRY Pierre
> Objet : Re: [install_list] Customize FCK editor CSS stylesheet
>
> Hello Pierre,
>
> which version of Jahia are you using currently? Is it Jahia 5.0 SP3 (build 18957)?
> In Jahia 5.0 SP3 it is possible to configure separate CSS stylesheet (per virtual site or even per template) for the FCKeditor.
>
> Kind regards
> Sergiy
>
> HENRY Pierre wrote:
>  
>> Hello,
>>
>> I would like to use my own template set's stylesheet for text edited
>> in FCK editor.
>>
>> I know I can put this in
>> /WEB-INF/etc/htmleditors/htmleditors_config.xml
>> as a css tag.
>>
>> My problem is that our CSS is a jsp file that's included in the
>> template sets. So the path of the css file would be something like
>> /jsp/jahia/templates/<my site>/<template set in use>/css.jsp
>>
>> The second specialty is that the css uses a parameter that is stored
>> as a site-level meta-data, to chose between 6 different color sets.
>>
>> So in the ideal, what I would like to be able to do is to get the
>> current site's name, the value of the meta data for the current site,
>> call the jsp and use the generated result my stylesheet in fck editor
>> (or any other editor).
>>
>> Any idea as to how to realize this, even partially ? Should the
>> jsp-css be stored in a static path, not in the templates directory ?
>> Any pointer welcome !
>>
>> Best Regards
>>
>> Pierre Henry
>> _______________________________________________
>> install_list mailing list
>> install_list@...
>> http://lists.jahia.org/cgi-bin/mailman/listinfo/install_list
>>
>>  
>>    
>
>
>  

_______________________________________________
install_list mailing list
install_list@...
http://lists.jahia.org/cgi-bin/mailman/listinfo/install_list
LightInTheBox - Buy quality products at wholesale price