Re: Customize FCK editor CSS stylesheet
Sergiy Shyrkov <[email protected]> Fri, 30 May 2008 16:58:12 +0200
| Newsgroups | gmane.comp.cms.jahia.install |
|---|---|
| Message-ID | <[email protected]> |
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=3D"org.jahia.params.ProcessingContext, =
org.jahia.services.sites.JahiaSite" %><%
response.setHeader("Cache-Control","no-store, no-cache, =
must-revalidate, max-age=3D0"); //HTTP 1.1
response.addHeader("Cache-Control","post-check=3D0, pre-check=3D0");
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", -1);
JahiaSite site =3D (JahiaSite) =
session.getAttribute(ProcessingContext.SESSION_SITE);
if (site !=3D null) {
String colorSet =3D "green"; // obtain the color set based on site data
String cssPath =3D "/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=3D"<%=3DcssPath %>"/>
<% } %>
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 te=
mplates, and create various css elements in the xml file, each with the col=
or 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:[email protected]] =
> Envoy=E9 : vendredi, 30. mai 2008 09:38
> =C0 : In this list you can send questions and discuss installation proble=
ms 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 (buil=
d 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
>> [email protected]
>> http://lists.jahia.org/cgi-bin/mailman/listinfo/install_list
>>
>> =
>> =
>
>
> =
_______________________________________________
install_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/install_list