You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2006/06/18 15:53:30 UTC
svn commit: r415137 - in /lenya/trunk/src/modules/svg: shape/
shape/corner.js shape/corner.jx shape/tab.js shape/tab.jx sitemap.xmap
Author: andreas
Date: Sun Jun 18 06:53:29 2006
New Revision: 415137
URL: http://svn.apache.org/viewvc?rev=415137&view=rev
Log:
SVG module: Added support for corner and tab rendering
Added:
lenya/trunk/src/modules/svg/shape/
lenya/trunk/src/modules/svg/shape/corner.js
lenya/trunk/src/modules/svg/shape/corner.jx
lenya/trunk/src/modules/svg/shape/tab.js
lenya/trunk/src/modules/svg/shape/tab.jx
Modified:
lenya/trunk/src/modules/svg/sitemap.xmap
Added: lenya/trunk/src/modules/svg/shape/corner.js
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/svg/shape/corner.js?rev=415137&view=auto
==============================================================================
--- lenya/trunk/src/modules/svg/shape/corner.js (added)
+++ lenya/trunk/src/modules/svg/shape/corner.js Sun Jun 18 06:53:29 2006
@@ -0,0 +1,70 @@
+
+function corner() {
+
+ var where = cocoon.parameters["where"];
+ var r = cocoon.parameters["radius"];
+ var x;
+ var y;
+ var width;
+ var height;
+
+ if (where == "topLeft") {
+ x = r;
+ y = r;
+ width = r;
+ height = r;
+ }
+ else if (where == "topRight") {
+ x = 0;
+ y = r;
+ width = r;
+ height = r;
+ }
+ else if (where == "bottomLeft") {
+ x = r;
+ y = 0;
+ width = r;
+ height = r;
+ }
+ else if (where == "bottomRight") {
+ x = 0;
+ y = 0;
+ width = r;
+ height = r;
+ }
+ else if (where == "top") {
+ x = r;
+ y = 0;
+ width = 1;
+ height = r;
+ }
+ else if (where == "right") {
+ x = 0;
+ y = r;
+ width = r;
+ height = 1;
+ }
+ else if (where == "left") {
+ x = r;
+ y = 0;
+ width = r;
+ height = 1;
+ }
+ else if (where == "bottom") {
+ x = 0;
+ y = 0;
+ width = 1;
+ height = r;
+ }
+
+ cocoon.sendPage("view/corner", {
+ "backgroundColor" : cocoon.parameters["backgroundColor"],
+ "lineColor" : cocoon.parameters["lineColor"],
+ "x" : x,
+ "y" : y,
+ "r" : r,
+ "width" : width,
+ "height" : height
+ });
+
+}
\ No newline at end of file
Added: lenya/trunk/src/modules/svg/shape/corner.jx
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/svg/shape/corner.jx?rev=415137&view=auto
==============================================================================
--- lenya/trunk/src/modules/svg/shape/corner.jx (added)
+++ lenya/trunk/src/modules/svg/shape/corner.jx Sun Jun 18 06:53:29 2006
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+ width="${width}" height="${height}">
+
+ <svg:circle
+ cx="${x}" cy="${y}" r="${r}"
+ stroke="${lineColor}" stroke-width="1" fill="${backgroundColor}"/>
+
+ <jx:if test="${rectangle}">
+ <svg:rect x="0" y="" width="" height=""
+ fill="" stroke-width="0"/>
+ </jx:if>
+
+</svg>
\ No newline at end of file
Added: lenya/trunk/src/modules/svg/shape/tab.js
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/svg/shape/tab.js?rev=415137&view=auto
==============================================================================
--- lenya/trunk/src/modules/svg/shape/tab.js (added)
+++ lenya/trunk/src/modules/svg/shape/tab.js Sun Jun 18 06:53:29 2006
@@ -0,0 +1,33 @@
+
+function tab() {
+
+ var where = cocoon.parameters["where"];
+ var r = cocoon.parameters["radius"];
+ var x;
+ var y;
+ var width;
+ var height = 40;
+
+ if (where == "topLeft") {
+ x = r;
+ y = r;
+ width = 300;
+ }
+ else if (where == "topRight") {
+ x = -1;
+ y = r;
+ width = r;
+ }
+
+ cocoon.sendPage("view/tab", {
+ "backgroundColor" : cocoon.parameters["backgroundColor"],
+ "lineColor" : cocoon.parameters["lineColor"],
+ "where" : where,
+ "x" : x,
+ "y" : y,
+ "r" : r,
+ "width" : width,
+ "height" : height
+ });
+
+}
\ No newline at end of file
Added: lenya/trunk/src/modules/svg/shape/tab.jx
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/svg/shape/tab.jx?rev=415137&view=auto
==============================================================================
--- lenya/trunk/src/modules/svg/shape/tab.jx (added)
+++ lenya/trunk/src/modules/svg/shape/tab.jx Sun Jun 18 06:53:29 2006
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ width="${width}" height="${height}">
+
+ <defs>
+ <clipPath id="circlePath">
+ <rect x="0" y="0" width="${r}" height="${r}"/>
+ </clipPath>
+ <clipPath id="rectPath">
+ <svg:circle
+ cx="${x}" cy="${r}" r="${r}"/>
+ </clipPath>
+ </defs>
+
+ <svg:rect x="${x - r}" y="0" width="${width + r + 1}" height="${height + 1}"
+ fill="${backgroundColor}" stroke="${lineColor}" stroke-width="2"/>
+
+ <svg:rect x="0" y="0" width="${r}" height="${r}"
+ fill="#FFFFFF" stroke-width="0"/>
+
+ <g clip-path="url(#circlePath)">
+ <svg:circle
+ cx="${x}" cy="${r}" r="${r}"
+ stroke="${lineColor}" stroke-width="1" fill="${backgroundColor}"/>
+ </g>
+
+</svg>
\ No newline at end of file
Modified: lenya/trunk/src/modules/svg/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/svg/sitemap.xmap?rev=415137&r1=415136&r2=415137&view=diff
==============================================================================
--- lenya/trunk/src/modules/svg/sitemap.xmap (original)
+++ lenya/trunk/src/modules/svg/sitemap.xmap Sun Jun 18 06:53:29 2006
@@ -16,12 +16,53 @@
-->
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+ <map:flow language="javascript">
+ <map:script src="corner/corner.js"/>
+ <map:script src="corner/tab.js"/>
+ </map:flow>
<map:pipelines>
<map:pipeline>
+
+ <!--
+ Views for shape flowscripts.
+ -->
+ <map:match pattern="view/*">
+ <map:generate type="jx" src="shape/{1}.jx"/>
+ <map:serialize type="xml"/>
+ </map:match>
+
+ <!--
+ Internal pipeline to generate shape SVGs.
+ shape/{type}-{where}-{radius}-{backgroundColor}-{lineColor}
+ example: shape/corner-topLeft-5-FF0000-000000
+ -->
+ <map:match pattern="shape/*-*-*-*-*.svg">
+ <map:call function="{1}">
+ <map:parameter name="where" value="{2}"/>
+ <map:parameter name="radius" value="{3}"/>
+ <map:parameter name="backgroundColor" value="#{4}"/>
+ <map:parameter name="lineColor" value="#{5}"/>
+ </map:call>
+ </map:match>
+
+ <!--
+ This matches a shape URL.
+ {type}-{where}-{radius}-{backgroundColor}-{lineColor}
+ example: corner-topLeft-5-FF0000-000000
+ -->
+ <map:match pattern="*-*-*-*-*.png">
+ <map:generate src="cocoon:/shape/{1}-{2}-{3}-{4}-{5}.svg"/>
+ <map:serialize type="svg2png"/>
+ </map:match>
+
+ <!--
+ image resizing pipelines
+ -->
<map:match pattern="*/*/**.*">
-
+
<map:match type="regexp" pattern="(.*\.)(jpg|JPG|Jpg|jpeg|Jpeg|JPEG)$">
<map:generate src="dummy.xml"/>
<map:act type="resource-exists-enhanced">
@@ -107,7 +148,7 @@
</map:act>
</map:match>
</map:match>
-
+
</map:pipeline>
</map:pipelines>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org
Re: svn commit: r415137 - in /lenya/trunk/src/modules/svg: shape/
shape/corner.js shape/corner.jx shape/tab.js shape/tab.jx sitemap.xmap
Posted by Josias Thöny <jo...@wyona.com>.
On Mon, 2006-06-19 at 09:53 +0200, Andreas Hartmann wrote:
> Josias Thöny wrote:
> > Hi Andreas,
> >
> > The tabs look really cool with round corners, it's a very nice
> > improvement!
>
> Thanks, I thought if we have an SVG module we can as well
> use it for some eye candy :)
>
>
> > However, I have to change the following to make it work:
>
> > - <map:script src="corner/corner.js"/>
> > - <map:script src="corner/tab.js"/>
> > + <map:script src="shape/corner.js"/>
> > + <map:script src="shape/tab.js"/>
>
> Thanks a lot - I renamed the directory and forgot to purge my
> build directory before testing :/
>
> Would you mind checking it in?
done.
- Josias
>
> -- Andreas
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: svn commit: r415137 - in /lenya/trunk/src/modules/svg: shape/
shape/corner.js shape/corner.jx shape/tab.js shape/tab.jx sitemap.xmap
Posted by Andreas Hartmann <an...@apache.org>.
Josias Thöny wrote:
> Hi Andreas,
>
> The tabs look really cool with round corners, it's a very nice
> improvement!
Thanks, I thought if we have an SVG module we can as well
use it for some eye candy :)
> However, I have to change the following to make it work:
> - <map:script src="corner/corner.js"/>
> - <map:script src="corner/tab.js"/>
> + <map:script src="shape/corner.js"/>
> + <map:script src="shape/tab.js"/>
Thanks a lot - I renamed the directory and forgot to purge my
build directory before testing :/
Would you mind checking it in?
-- Andreas
--
Andreas Hartmann
Wyona Inc. - Open Source Content Management - Apache Lenya
http://www.wyona.com http://lenya.apache.org
andreas.hartmann@wyona.com andreas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Re: svn commit: r415137 - in /lenya/trunk/src/modules/svg: shape/
shape/corner.js shape/corner.jx shape/tab.js shape/tab.jx sitemap.xmap
Posted by Josias Thöny <jo...@wyona.com>.
Hi Andreas,
The tabs look really cool with round corners, it's a very nice
improvement!
However, I have to change the following to make it work:
Index: src/modules/svg/sitemap.xmap
===================================================================
--- src/modules/svg/sitemap.xmap (revision 415257)
+++ src/modules/svg/sitemap.xmap (working copy)
@@ -18,8 +18,8 @@
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:flow language="javascript">
- <map:script src="corner/corner.js"/>
- <map:script src="corner/tab.js"/>
+ <map:script src="shape/corner.js"/>
+ <map:script src="shape/tab.js"/>
</map:flow>
<map:pipelines>
-- Josias
On Sun, 2006-06-18 at 13:53 +0000, andreas@apache.org wrote:
> Author: andreas
> Date: Sun Jun 18 06:53:29 2006
> New Revision: 415137
>
> URL: http://svn.apache.org/viewvc?rev=415137&view=rev
> Log:
> SVG module: Added support for corner and tab rendering
>
> Added:
> lenya/trunk/src/modules/svg/shape/
> lenya/trunk/src/modules/svg/shape/corner.js
> lenya/trunk/src/modules/svg/shape/corner.jx
> lenya/trunk/src/modules/svg/shape/tab.js
> lenya/trunk/src/modules/svg/shape/tab.jx
> Modified:
> lenya/trunk/src/modules/svg/sitemap.xmap
>
> Added: lenya/trunk/src/modules/svg/shape/corner.js
> URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/svg/shape/corner.js?rev=415137&view=auto
> ==============================================================================
> --- lenya/trunk/src/modules/svg/shape/corner.js (added)
> +++ lenya/trunk/src/modules/svg/shape/corner.js Sun Jun 18 06:53:29 2006
> @@ -0,0 +1,70 @@
> +
> +function corner() {
> +
> + var where = cocoon.parameters["where"];
> + var r = cocoon.parameters["radius"];
> + var x;
> + var y;
> + var width;
> + var height;
> +
> + if (where == "topLeft") {
> + x = r;
> + y = r;
> + width = r;
> + height = r;
> + }
> + else if (where == "topRight") {
> + x = 0;
> + y = r;
> + width = r;
> + height = r;
> + }
> + else if (where == "bottomLeft") {
> + x = r;
> + y = 0;
> + width = r;
> + height = r;
> + }
> + else if (where == "bottomRight") {
> + x = 0;
> + y = 0;
> + width = r;
> + height = r;
> + }
> + else if (where == "top") {
> + x = r;
> + y = 0;
> + width = 1;
> + height = r;
> + }
> + else if (where == "right") {
> + x = 0;
> + y = r;
> + width = r;
> + height = 1;
> + }
> + else if (where == "left") {
> + x = r;
> + y = 0;
> + width = r;
> + height = 1;
> + }
> + else if (where == "bottom") {
> + x = 0;
> + y = 0;
> + width = 1;
> + height = r;
> + }
> +
> + cocoon.sendPage("view/corner", {
> + "backgroundColor" : cocoon.parameters["backgroundColor"],
> + "lineColor" : cocoon.parameters["lineColor"],
> + "x" : x,
> + "y" : y,
> + "r" : r,
> + "width" : width,
> + "height" : height
> + });
> +
> +}
> \ No newline at end of file
>
> Added: lenya/trunk/src/modules/svg/shape/corner.jx
> URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/svg/shape/corner.jx?rev=415137&view=auto
> ==============================================================================
> --- lenya/trunk/src/modules/svg/shape/corner.jx (added)
> +++ lenya/trunk/src/modules/svg/shape/corner.jx Sun Jun 18 06:53:29 2006
> @@ -0,0 +1,16 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<svg
> + xmlns:svg="http://www.w3.org/2000/svg"
> + xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
> + width="${width}" height="${height}">
> +
> + <svg:circle
> + cx="${x}" cy="${y}" r="${r}"
> + stroke="${lineColor}" stroke-width="1" fill="${backgroundColor}"/>
> +
> + <jx:if test="${rectangle}">
> + <svg:rect x="0" y="" width="" height=""
> + fill="" stroke-width="0"/>
> + </jx:if>
> +
> +</svg>
> \ No newline at end of file
>
> Added: lenya/trunk/src/modules/svg/shape/tab.js
> URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/svg/shape/tab.js?rev=415137&view=auto
> ==============================================================================
> --- lenya/trunk/src/modules/svg/shape/tab.js (added)
> +++ lenya/trunk/src/modules/svg/shape/tab.js Sun Jun 18 06:53:29 2006
> @@ -0,0 +1,33 @@
> +
> +function tab() {
> +
> + var where = cocoon.parameters["where"];
> + var r = cocoon.parameters["radius"];
> + var x;
> + var y;
> + var width;
> + var height = 40;
> +
> + if (where == "topLeft") {
> + x = r;
> + y = r;
> + width = 300;
> + }
> + else if (where == "topRight") {
> + x = -1;
> + y = r;
> + width = r;
> + }
> +
> + cocoon.sendPage("view/tab", {
> + "backgroundColor" : cocoon.parameters["backgroundColor"],
> + "lineColor" : cocoon.parameters["lineColor"],
> + "where" : where,
> + "x" : x,
> + "y" : y,
> + "r" : r,
> + "width" : width,
> + "height" : height
> + });
> +
> +}
> \ No newline at end of file
>
> Added: lenya/trunk/src/modules/svg/shape/tab.jx
> URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/svg/shape/tab.jx?rev=415137&view=auto
> ==============================================================================
> --- lenya/trunk/src/modules/svg/shape/tab.jx (added)
> +++ lenya/trunk/src/modules/svg/shape/tab.jx Sun Jun 18 06:53:29 2006
> @@ -0,0 +1,31 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<svg
> + xmlns:svg="http://www.w3.org/2000/svg"
> + xmlns="http://www.w3.org/2000/svg"
> + xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
> + xmlns:xlink="http://www.w3.org/1999/xlink"
> + width="${width}" height="${height}">
> +
> + <defs>
> + <clipPath id="circlePath">
> + <rect x="0" y="0" width="${r}" height="${r}"/>
> + </clipPath>
> + <clipPath id="rectPath">
> + <svg:circle
> + cx="${x}" cy="${r}" r="${r}"/>
> + </clipPath>
> + </defs>
> +
> + <svg:rect x="${x - r}" y="0" width="${width + r + 1}" height="${height + 1}"
> + fill="${backgroundColor}" stroke="${lineColor}" stroke-width="2"/>
> +
> + <svg:rect x="0" y="0" width="${r}" height="${r}"
> + fill="#FFFFFF" stroke-width="0"/>
> +
> + <g clip-path="url(#circlePath)">
> + <svg:circle
> + cx="${x}" cy="${r}" r="${r}"
> + stroke="${lineColor}" stroke-width="1" fill="${backgroundColor}"/>
> + </g>
> +
> +</svg>
> \ No newline at end of file
>
> Modified: lenya/trunk/src/modules/svg/sitemap.xmap
> URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/svg/sitemap.xmap?rev=415137&r1=415136&r2=415137&view=diff
> ==============================================================================
> --- lenya/trunk/src/modules/svg/sitemap.xmap (original)
> +++ lenya/trunk/src/modules/svg/sitemap.xmap Sun Jun 18 06:53:29 2006
> @@ -16,12 +16,53 @@
> -->
>
> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
> +
> + <map:flow language="javascript">
> + <map:script src="corner/corner.js"/>
> + <map:script src="corner/tab.js"/>
> + </map:flow>
>
> <map:pipelines>
>
> <map:pipeline>
> +
> + <!--
> + Views for shape flowscripts.
> + -->
> + <map:match pattern="view/*">
> + <map:generate type="jx" src="shape/{1}.jx"/>
> + <map:serialize type="xml"/>
> + </map:match>
> +
> + <!--
> + Internal pipeline to generate shape SVGs.
> + shape/{type}-{where}-{radius}-{backgroundColor}-{lineColor}
> + example: shape/corner-topLeft-5-FF0000-000000
> + -->
> + <map:match pattern="shape/*-*-*-*-*.svg">
> + <map:call function="{1}">
> + <map:parameter name="where" value="{2}"/>
> + <map:parameter name="radius" value="{3}"/>
> + <map:parameter name="backgroundColor" value="#{4}"/>
> + <map:parameter name="lineColor" value="#{5}"/>
> + </map:call>
> + </map:match>
> +
> + <!--
> + This matches a shape URL.
> + {type}-{where}-{radius}-{backgroundColor}-{lineColor}
> + example: corner-topLeft-5-FF0000-000000
> + -->
> + <map:match pattern="*-*-*-*-*.png">
> + <map:generate src="cocoon:/shape/{1}-{2}-{3}-{4}-{5}.svg"/>
> + <map:serialize type="svg2png"/>
> + </map:match>
> +
> + <!--
> + image resizing pipelines
> + -->
> <map:match pattern="*/*/**.*">
> -
> +
> <map:match type="regexp" pattern="(.*\.)(jpg|JPG|Jpg|jpeg|Jpeg|JPEG)$">
> <map:generate src="dummy.xml"/>
> <map:act type="resource-exists-enhanced">
> @@ -107,7 +148,7 @@
> </map:act>
> </map:match>
> </map:match>
> -
> +
> </map:pipeline>
>
> </map:pipelines>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
> For additional commands, e-mail: commits-help@lenya.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org