Author: jstroomer
Date: 2010-02-01 20:06:21 +0100 (Mon, 01 Feb 2010)
New Revision: 40771
Added:
CMSContainer/branches/b1_7/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/servlet/
CMSContainer/branches/b1_7/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/servlet/StylesheetServlet.java
CMSContainer/branches/b1_7/CMSContainer/migration/migration_1.7.1_to_1.7.2.txt
Modified:
CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/src/webapp/WEB-INF/web.xml
CMSContainer/branches/b1_7/CMSContainer/cmsc/sitemanagement/config/builders/sitemanagement/stylesheet.xml
CMSContainer/branches/b1_7/CMSContainer/cmsc/sitemanagement/src/webapp/editors/config/stylesheet/edit_stylesheet.xml
CMSContainer/branches/b1_7/CMSContainer/cmsc/sitemanagement/src/webapp/editors/config/stylesheet/load_stylesheet.xml
CMSContainer/branches/b1_7/CMSContainer_Portlets/portlets-newsletter/src/webapp/WEB-INF/templates/layout/newsletter/newsletter_advanced.jsp
CMSContainer/branches/b1_7/CMSContainer_Portlets/portlets-newsletter/src/webapp/WEB-INF/templates/layout_plain/newsletter/newsletter_advanced.jsp
CMSContainer/trunk/CMSContainer/cmsc/sitemanagement/src/webapp/editors/config/stylesheet/load_stylesheet.xml
CMSContainer/trunk/CMSContainer_Portlets/portlets-newsletter/src/webapp/WEB-INF/templates/layout/newsletter/newsletter_advanced.jsp
CMSContainer/trunk/CMSContainer_Portlets/portlets-newsletter/src/webapp/WEB-INF/templates/layout_plain/newsletter/newsletter_advanced.jsp
Log:
CMSC-1565 Extend stylesheet feature with stylesheet data from database
Backport to 1.7
Modified:
CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/src/webapp/WEB-INF/web.xml
===================================================================
---
CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/src/webapp/WEB-INF/web.xml
2010-02-01 19:04:32 UTC (rev 40770)
+++
CMSContainer/branches/b1_7/CMSContainer/cmsc/edit-webapp/src/webapp/WEB-INF/web.xml
2010-02-01 19:06:21 UTC (rev 40771)
@@ -273,6 +273,11 @@
<load-on-startup>1</load-on-startup>
</servlet>
+ <servlet>
+ <description>Returns css text</description>
+ <servlet-name>stylesheet</servlet-name>
+
<servlet-class>com.finalist.cmsc.servlet.StylesheetServlet</servlet-class>
+ </servlet>
<servlet-mapping>
<servlet-name>version</servlet-name>
@@ -306,7 +311,12 @@
<servlet-name>xmlcontent</servlet-name>
<url-pattern>/editors/repository/xml</url-pattern>
</servlet-mapping>
-
+
+ <servlet-mapping>
+ <servlet-name>stylesheet</servlet-name>
+ <url-pattern>/stylesheet/*</url-pattern>
+ </servlet-mapping>
+
<mime-mapping>
<extension>html</extension>
<mime-type>text/html</mime-type>
Modified:
CMSContainer/branches/b1_7/CMSContainer/cmsc/sitemanagement/config/builders/sitemanagement/stylesheet.xml
===================================================================
---
CMSContainer/branches/b1_7/CMSContainer/cmsc/sitemanagement/config/builders/sitemanagement/stylesheet.xml
2010-02-01 19:04:32 UTC (rev 40770)
+++
CMSContainer/branches/b1_7/CMSContainer/cmsc/sitemanagement/config/builders/sitemanagement/stylesheet.xml
2010-02-01 19:06:21 UTC (rev 40771)
@@ -61,6 +61,21 @@
<maxLength value="255"/>
</datatype>
</field>
+ <field name="text">
+ <gui>
+ <guiname xml:lang="nl">Text</guiname>
+ <guiname xml:lang="en">Tekst</guiname>
+ <guiname xml:lang="zh">文本</guiname>
+ </gui>
+ <editor>
+ <positions>
+ <input>5</input>
+ </positions>
+ </editor>
+ <datatype base="line"
xmlns="http://www.mmbase.org/xmlns/datatypes">
+ <maxLength value="512000"/>
+ </datatype>
+ </field>
<field name="media">
<gui>
<guiname xml:lang="nl">Media</guiname>
Modified:
CMSContainer/branches/b1_7/CMSContainer/cmsc/sitemanagement/src/webapp/editors/config/stylesheet/edit_stylesheet.xml
===================================================================
---
CMSContainer/branches/b1_7/CMSContainer/cmsc/sitemanagement/src/webapp/editors/config/stylesheet/edit_stylesheet.xml
2010-02-01 19:04:32 UTC (rev 40770)
+++
CMSContainer/branches/b1_7/CMSContainer/cmsc/sitemanagement/src/webapp/editors/config/stylesheet/edit_stylesheet.xml
2010-02-01 19:06:21 UTC (rev 40771)
@@ -32,4 +32,10 @@
<prompt xml:lang="zh">可覆盖</prompt>
<optionlist select="boolean" />
</field>
+ <field name="text" dtmaxlength="512000" ftype="text" rows="15">
+ <prompt xml:lang="en">Stylesheet body</prompt>
+ <prompt xml:lang="nl">Stylesheet tekst</prompt>
+ <prompt xml:lang="zh">脚本</prompt>
+ <optionlist select="boolean" />
+ </field>
</form-schema>
\ No newline at end of file
Modified:
CMSContainer/branches/b1_7/CMSContainer/cmsc/sitemanagement/src/webapp/editors/config/stylesheet/load_stylesheet.xml
===================================================================
---
CMSContainer/branches/b1_7/CMSContainer/cmsc/sitemanagement/src/webapp/editors/config/stylesheet/load_stylesheet.xml
2010-02-01 19:04:32 UTC (rev 40770)
+++
CMSContainer/branches/b1_7/CMSContainer/cmsc/sitemanagement/src/webapp/editors/config/stylesheet/load_stylesheet.xml
2010-02-01 19:06:21 UTC (rev 40771)
@@ -1,9 +1,10 @@
<?xml version="1.0"?>
<!DOCTYPE action PUBLIC "-//MMBase/DTD editwizard 1.0//EN"
"http://www.mmbase.org/dtd/wizard-schema_1_0.dtd">
<action type="load">
- <field name="title"/>
- <field name="description"/>
- <field name="resource"/>
- <field name="media"/>
- <field name="overwriteable"/>
- </action>
\ No newline at end of file
+ <field name="title"/>
+ <field name="description"/>
+ <field name="resource"/>
+ <field name="media"/>
+ <field name="overwriteable"/>
+ <field name="text"/>
+</action>
\ No newline at end of file
Added:
CMSContainer/branches/b1_7/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/servlet/StylesheetServlet.java
===================================================================
---
CMSContainer/branches/b1_7/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/servlet/StylesheetServlet.java
(rev 0)
+++
CMSContainer/branches/b1_7/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/servlet/StylesheetServlet.java
2010-02-01 19:06:21 UTC (rev 40771)
@@ -0,0 +1,57 @@
+/*
+ *
+ * This software is OSI Certified Open Source Software. OSI Certified is a
certification mark of the Open Source
+ * Initiative.
+ *
+ * The license (Mozilla version 1.0) can be read at the MMBase site. See
http://www.MMBase.org/license
+ */
+package com.finalist.cmsc.servlet;
+
+import java.io.IOException;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.mmbase.bridge.Node;
+import org.mmbase.servlet.BridgeServlet;
+
+/**
+ * @author
+ */
+...@suppresswarnings( { "serial", "unused" })
+public class StylesheetServlet extends BridgeServlet {
+
+ @Override
+ public void init(ServletConfig config) throws ServletException {
+ super.init(config);
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException {
+ renderText(request, response);
+ }
+
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse
response) throws IOException {
+ renderText(request, response);
+ }
+
+ private void renderText(HttpServletRequest request, HttpServletResponse
response) throws IOException {
+ String pathInfo = request.getPathInfo();
+ response.setContentType("text/css");
+ String number = null;
+ if (pathInfo != null) {
+ number = pathInfo.replaceAll("/|.css", "");
+ }
+ if (number != null) {
+ if (number.matches("[0-9]+")) {
+ Node stylesheet= getAnonymousCloud().getNode(number);
+ String text = stylesheet.getStringValue("text");
+ response.getWriter().print(text);
+ }
+ }
+
+ }
+}
Added:
CMSContainer/branches/b1_7/CMSContainer/migration/migration_1.7.1_to_1.7.2.txt
===================================================================
---
CMSContainer/branches/b1_7/CMSContainer/migration/migration_1.7.1_to_1.7.2.txt
(rev 0)
+++
CMSContainer/branches/b1_7/CMSContainer/migration/migration_1.7.1_to_1.7.2.txt
2010-02-01 19:06:21 UTC (rev 40771)
@@ -0,0 +1,47 @@
+MMigration document:
+
+From version: 1.7.1
+To version: 1.7.2
+
+
+
+Name: Extended the current stylesheet options in CMSc with dynamic
stylesheets, from the database
+Goal: Add a new field "text" to mm_stylesheet
+Type: manual action
+--- Start script ---
+ALTER TABLE mm_stylesheet ADD m_text TEXT;
+ALTER TABLE live_stylesheet ADD m_text TEXT;
+--- End script ---
+
+Check the layouts of your project. You should change the <c:forEach> that
displays the stylesheets to something like this:
+
+--- Start JSP ---
+<c:forEach var="style" items="${stylesheet}">
+ <c:choose>
+ <c:when test="${empty style.resource}">
+ <link rel="stylesheet" type="text/css"
href="${pageContext.request.contextPath}/stylesheet/${style.id}.css"
media="${style.media}" />
+ </c:when>
+ <c:otherwise>
+ <link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/${style.resource}'/>" media="${style.media}" />
+ </c:otherwise>
+ </c:choose>
+</c:forEach>
+--- End JSP ---
+
+If you have overridden the web.xml file in your project, make sure it contains
these declarations in the appropriate places
+--- Start XML ---
+<servlet>
+ <description>Returns css text</description>
+ <servlet-name>stylesheet</servlet-name>
+ <servlet-class>com.finalist.cmsc.servlet.StylesheetServlet</servlet-class>
+</servlet>
+<servlet-mapping>
+ <servlet-name>stylesheet</servlet-name>
+ <url-pattern>/stylesheet/*</url-pattern>
+</servlet-mapping>
+--- End XML ---
+
+Exceptions/errors/other problems and what to do:
+*
+*
+*
Modified:
CMSContainer/branches/b1_7/CMSContainer_Portlets/portlets-newsletter/src/webapp/WEB-INF/templates/layout/newsletter/newsletter_advanced.jsp
===================================================================
---
CMSContainer/branches/b1_7/CMSContainer_Portlets/portlets-newsletter/src/webapp/WEB-INF/templates/layout/newsletter/newsletter_advanced.jsp
2010-02-01 19:04:32 UTC (rev 40770)
+++
CMSContainer/branches/b1_7/CMSContainer_Portlets/portlets-newsletter/src/webapp/WEB-INF/templates/layout/newsletter/newsletter_advanced.jsp
2010-02-01 19:06:21 UTC (rev 40771)
@@ -12,8 +12,13 @@
<cmsc:insert-stylesheet var="stylesheet" />
<link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/css/stijl.css'/>" media="screen,projection,print" />
<link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/css/2column.css'/>" media="screen,projection,print" />
- <c:forEach var="style" items="${stylesheet}">
- <link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/${style.resource}'/>" media="${style.media}" />
+ <c:forEach var="style" items="${stylesheet}">
+ <c:if test="${style.resource eq ''}">
+ <link rel="stylesheet" type="text/css"
href="/servlet/StylesheetServlet?text=${style.text}" media="${style.media}" />
+ </c:if>
+ <c:if test="${style.resource ne '' }">
+ <link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/${style.resource}'/>" media="${style.media}" />
+ </c:if>
</c:forEach>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/css/stijl_ie.css'/>" media="screen,projection,print" />
Modified:
CMSContainer/branches/b1_7/CMSContainer_Portlets/portlets-newsletter/src/webapp/WEB-INF/templates/layout_plain/newsletter/newsletter_advanced.jsp
===================================================================
---
CMSContainer/branches/b1_7/CMSContainer_Portlets/portlets-newsletter/src/webapp/WEB-INF/templates/layout_plain/newsletter/newsletter_advanced.jsp
2010-02-01 19:04:32 UTC (rev 40770)
+++
CMSContainer/branches/b1_7/CMSContainer_Portlets/portlets-newsletter/src/webapp/WEB-INF/templates/layout_plain/newsletter/newsletter_advanced.jsp
2010-02-01 19:06:21 UTC (rev 40771)
@@ -12,8 +12,13 @@
<cmsc:insert-stylesheet var="stylesheet" />
<link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/css/stijl.css'/>" media="screen,projection,print" />
<link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/css/2column.css'/>" media="screen,projection,print" />
- <c:forEach var="style" items="${stylesheet}">
- <link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/${style.resource}'/>" media="${style.media}" />
+ <c:forEach var="style" items="${stylesheet}">
+ <c:if test="${style.resource eq ''}">
+ <link rel="stylesheet" type="text/css"
href="/servlet/StylesheetServlet?text=${style.text}" media="${style.media}" />
+ </c:if>
+ <c:if test="${style.resource ne '' }">
+ <link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/${style.resource}'/>" media="${style.media}" />
+ </c:if>
</c:forEach>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/css/stijl_ie.css'/>" media="screen,projection,print" />
Modified:
CMSContainer/trunk/CMSContainer/cmsc/sitemanagement/src/webapp/editors/config/stylesheet/load_stylesheet.xml
===================================================================
---
CMSContainer/trunk/CMSContainer/cmsc/sitemanagement/src/webapp/editors/config/stylesheet/load_stylesheet.xml
2010-02-01 19:04:32 UTC (rev 40770)
+++
CMSContainer/trunk/CMSContainer/cmsc/sitemanagement/src/webapp/editors/config/stylesheet/load_stylesheet.xml
2010-02-01 19:06:21 UTC (rev 40771)
@@ -1,10 +1,10 @@
<?xml version="1.0"?>
<!DOCTYPE action PUBLIC "-//MMBase/DTD editwizard 1.0//EN"
"http://www.mmbase.org/dtd/wizard-schema_1_0.dtd">
<action type="load">
- <field name="title"/>
- <field name="description"/>
- <field name="resource"/>
- <field name="media"/>
- <field name="overwriteable"/>
- <field name="text"/>
- </action>
\ No newline at end of file
+ <field name="title"/>
+ <field name="description"/>
+ <field name="resource"/>
+ <field name="media"/>
+ <field name="overwriteable"/>
+ <field name="text"/>
+</action>
\ No newline at end of file
Modified:
CMSContainer/trunk/CMSContainer_Portlets/portlets-newsletter/src/webapp/WEB-INF/templates/layout/newsletter/newsletter_advanced.jsp
===================================================================
---
CMSContainer/trunk/CMSContainer_Portlets/portlets-newsletter/src/webapp/WEB-INF/templates/layout/newsletter/newsletter_advanced.jsp
2010-02-01 19:04:32 UTC (rev 40770)
+++
CMSContainer/trunk/CMSContainer_Portlets/portlets-newsletter/src/webapp/WEB-INF/templates/layout/newsletter/newsletter_advanced.jsp
2010-02-01 19:06:21 UTC (rev 40771)
@@ -12,13 +12,13 @@
<cmsc:insert-stylesheet var="stylesheet" />
<link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/css/stijl.css'/>" media="screen,projection,print" />
<link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/css/2column.css'/>" media="screen,projection,print" />
- <c:forEach var="style" items="${stylesheet}">
- <c:if test="${style.resource eq ''}">
- <link rel="stylesheet" type="text/css"
href="/servlet/StylesheetServlet?text=${style.text}" media="${style.media}" />
- </c:if>
- <c:if test="${style.resource ne '' }">
- <link rel="stylesheet" type="text/css"
href="<cmsc:staticurl page='/${style.resource}'/>" media="${style.media}" />
- </c:if>
+ <c:forEach var="style" items="${stylesheet}">
+ <c:if test="${style.resource eq ''}">
+ <link rel="stylesheet" type="text/css"
href="/servlet/StylesheetServlet?text=${style.text}" media="${style.media}" />
+ </c:if>
+ <c:if test="${style.resource ne '' }">
+ <link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/${style.resource}'/>" media="${style.media}" />
+ </c:if>
</c:forEach>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/css/stijl_ie.css'/>" media="screen,projection,print" />
Modified:
CMSContainer/trunk/CMSContainer_Portlets/portlets-newsletter/src/webapp/WEB-INF/templates/layout_plain/newsletter/newsletter_advanced.jsp
===================================================================
---
CMSContainer/trunk/CMSContainer_Portlets/portlets-newsletter/src/webapp/WEB-INF/templates/layout_plain/newsletter/newsletter_advanced.jsp
2010-02-01 19:04:32 UTC (rev 40770)
+++
CMSContainer/trunk/CMSContainer_Portlets/portlets-newsletter/src/webapp/WEB-INF/templates/layout_plain/newsletter/newsletter_advanced.jsp
2010-02-01 19:06:21 UTC (rev 40771)
@@ -12,13 +12,13 @@
<cmsc:insert-stylesheet var="stylesheet" />
<link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/css/stijl.css'/>" media="screen,projection,print" />
<link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/css/2column.css'/>" media="screen,projection,print" />
- <c:forEach var="style" items="${stylesheet}">
- <c:if test="${style.resource eq ''}">
- <link rel="stylesheet" type="text/css"
href="/servlet/StylesheetServlet?text=${style.text}" media="${style.media}" />
- </c:if>
- <c:if test="${style.resource ne '' }">
- <link rel="stylesheet" type="text/css"
href="<cmsc:staticurl page='/${style.resource}'/>" media="${style.media}" />
- </c:if>
+ <c:forEach var="style" items="${stylesheet}">
+ <c:if test="${style.resource eq ''}">
+ <link rel="stylesheet" type="text/css"
href="/servlet/StylesheetServlet?text=${style.text}" media="${style.media}" />
+ </c:if>
+ <c:if test="${style.resource ne '' }">
+ <link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/${style.resource}'/>" media="${style.media}" />
+ </c:if>
</c:forEach>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="<cmsc:staticurl
page='/css/stijl_ie.css'/>" media="screen,projection,print" />
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs