SVG: validní i v XHTML.
authorFrantišek Kučera <franta-hg@frantovo.cz>
Wed, 28 Apr 2010 01:29:22 +0200
changeset 1166d9647a51193
parent 115 b278b6b2d552
child 117 607fbe95edda
SVG: validní i v XHTML.
java/nekurak.net-web/web/WEB-INF/tags/nekurak/hlasovani.tag
java/nekurak.net-web/web/WEB-INF/tags/nekurak/stranka.tag
     1.1 --- a/java/nekurak.net-web/web/WEB-INF/tags/nekurak/hlasovani.tag	Wed Apr 28 00:36:21 2010 +0200
     1.2 +++ b/java/nekurak.net-web/web/WEB-INF/tags/nekurak/hlasovani.tag	Wed Apr 28 01:29:22 2010 +0200
     1.3 @@ -25,23 +25,24 @@
     1.4  
     1.5      <c:choose>
     1.6  	<c:when test="${svgUvnitrXhtml}">
     1.7 -	    <svg xmlns="http://www.w3.org/2000/svg"
     1.8 -		 xmlns:xlink="http://www.w3.org/1999/xlink"
     1.9 -		 width="200" height="200">
    1.10 +	    <svg:svg xmlns:svg="http://www.w3.org/2000/svg"
    1.11 +		     xmlns:xlink="http://www.w3.org/1999/xlink"
    1.12 +		     version="1.1" baseProfile="full"
    1.13 +		     width="200" height="200">
    1.14  
    1.15  
    1.16 -		<style type="text/css">
    1.17 +		<svg:style type="text/css">
    1.18  		    rect.ne {
    1.19 -			fill:  url(#ne_prechod);
    1.20 +			fill:  url(#ne_prechod_${podnik});
    1.21  			stroke: black;
    1.22  		    }
    1.23  		    rect.ano {
    1.24 -			fill: url(#ano_prechod);
    1.25 +			fill: url(#ano_prechod_${podnik});
    1.26  			stroke: black;
    1.27  		    }
    1.28  
    1.29  		    a:hover rect.ano, a:hover rect.ne {
    1.30 -			fill: url(#zvyrazneny_prechod);
    1.31 +			fill: url(#zvyrazneny_prechod_${podnik});
    1.32  		    }
    1.33  
    1.34  		    a:hover text {
    1.35 @@ -55,7 +56,7 @@
    1.36  
    1.37  
    1.38  		    rect.pozadi {
    1.39 -			fill: url(#pozadi_prechod);
    1.40 +			fill: url(#pozadi_prechod_${podnik});
    1.41  		    }
    1.42  
    1.43  		    text {
    1.44 @@ -63,50 +64,50 @@
    1.45  			font-family: Sans;
    1.46  		    }
    1.47  
    1.48 -		</style>
    1.49 +		</svg:style>
    1.50  
    1.51  		<!-- pozadí – přechod -->
    1.52 -		<defs>
    1.53 -		    <linearGradient id="pozadi_prechod" x1="0%" y1="0%" x2="100%" y2="100%">
    1.54 -			<stop offset="20%" style="stop-color:rgb(245,245,255); stop-opacity:0.5"/>
    1.55 -			<stop offset="100%" style="stop-color:silver; stop-opacity:0.8"/>
    1.56 -		    </linearGradient>
    1.57 -		</defs>
    1.58 +		<svg:defs>
    1.59 +		    <svg:linearGradient id="pozadi_prechod_${podnik}" x1="0%" y1="0%" x2="100%" y2="100%">
    1.60 +			<svg:stop offset="20%" style="stop-color:rgb(245,245,255); stop-opacity:0.5"/>
    1.61 +			<svg:stop offset="100%" style="stop-color:silver; stop-opacity:0.8"/>
    1.62 +		    </svg:linearGradient>
    1.63 +		</svg:defs>
    1.64  
    1.65  		<!-- nekuřácký graf – přechod -->
    1.66 -		<defs>
    1.67 -		    <linearGradient id="ne_prechod" x1="0%" y1="0%" x2="100%" y2="100%">
    1.68 -			<stop offset="0%" style="stop-color:white; stop-opacity:1"/>
    1.69 -			<stop offset="100%" style="stop-color:blue; stop-opacity:1"/>
    1.70 -		    </linearGradient>
    1.71 -		</defs>
    1.72 +		<svg:defs>
    1.73 +		    <svg:linearGradient id="ne_prechod_${podnik}" x1="0%" y1="0%" x2="100%" y2="100%">
    1.74 +			<svg:stop offset="0%" style="stop-color:white; stop-opacity:1"/>
    1.75 +			<svg:stop offset="100%" style="stop-color:blue; stop-opacity:1"/>
    1.76 +		    </svg:linearGradient>
    1.77 +		</svg:defs>
    1.78  
    1.79  		<!-- zvýrazněný graf – přechod -->
    1.80 -		<defs>
    1.81 -		    <linearGradient id="zvyrazneny_prechod" x1="0%" y1="0%" x2="100%" y2="100%">
    1.82 -			<stop offset="0%" style="stop-color:white; stop-opacity:1"/>
    1.83 -			<stop offset="100%" style="stop-color:green; stop-opacity:1"/>
    1.84 -		    </linearGradient>
    1.85 -		</defs>
    1.86 +		<svg:defs>
    1.87 +		    <svg:linearGradient id="zvyrazneny_prechod_${podnik}" x1="0%" y1="0%" x2="100%" y2="100%">
    1.88 +			<svg:stop offset="0%" style="stop-color:white; stop-opacity:1"/>
    1.89 +			<svg:stop offset="100%" style="stop-color:green; stop-opacity:1"/>
    1.90 +		    </svg:linearGradient>
    1.91 +		</svg:defs>
    1.92  
    1.93  		<!-- kuřácký graf – přechod -->
    1.94 -		<defs>
    1.95 -		    <linearGradient id="ano_prechod" x1="0%" y1="0%" x2="100%" y2="100%">
    1.96 -			<stop offset="0%" style="stop-color:white; stop-opacity:1"/>
    1.97 -			<stop offset="100%" style="stop-color:red; stop-opacity:1"/>
    1.98 -		    </linearGradient>
    1.99 -		</defs>
   1.100 +		<svg:defs>
   1.101 +		    <svg:linearGradient id="ano_prechod_${podnik}" x1="0%" y1="0%" x2="100%" y2="100%">
   1.102 +			<svg:stop offset="0%" style="stop-color:white; stop-opacity:1"/>
   1.103 +			<svg:stop offset="100%" style="stop-color:red; stop-opacity:1"/>
   1.104 +		    </svg:linearGradient>
   1.105 +		</svg:defs>
   1.106  
   1.107  		<!-- pozadí a linka -->
   1.108 -		<rect x="0" y="0" width="200" height="200" class="pozadi"/>
   1.109 -		<line x1="10" y1="180" x2="190" y2="180" class="ramecek"/>
   1.110 +		<svg:rect x="0" y="0" width="200" height="200" class="pozadi"/>
   1.111 +		<svg:line x1="10" y1="180" x2="190" y2="180" class="ramecek"/>
   1.112  
   1.113  		<!-- nadpis grafu -->
   1.114 -		<text x="60" y="20"><fmt:message key="hlasovani.graf.nadpis"/>:</text>
   1.115 +		<svg:text x="60" y="20"><fmt:message key="hlasovani.graf.nadpis"/>:</svg:text>
   1.116  
   1.117  		<!-- žádné hlasy -->
   1.118  		<c:if test="${hlasuAno == 0 &amp;&amp; hlasuNe == 0}">
   1.119 -		    <text x="30" y="100"><fmt:message key="hlasovani.graf.zadneHlasy"/></text>
   1.120 +		    <svg:text x="30" y="100"><fmt:message key="hlasovani.graf.zadneHlasy"/></svg:text>
   1.121  		</c:if>
   1.122  
   1.123  		<!-- vypočteme si výšky sloupců grafu -->
   1.124 @@ -117,20 +118,20 @@
   1.125  		<fmt:message key="hlasovani.graf.popisSloupce" var="hlasuNeLokalizace">
   1.126  		    <fmt:param value="${hlasuNe}"/>
   1.127  		</fmt:message>
   1.128 -		<a xlink:href="javascript:hlasovani.hlasuj(${podnik}, false);" xlink:title="${hlasuNeLokalizace}">
   1.129 -		    <text x="30" y="195" class="ne"><fmt:message key="hlasovani.graf.nekourit"/></text>
   1.130 -		    <rect x="30" y="${180 - hlasuNeVyska}" width="50" height="${hlasuNeVyska}" class="ne"/>
   1.131 -		</a>
   1.132 +		<svg:a xlink:href="javascript:hlasovani.hlasuj(${podnik}, false);" xlink:title="${hlasuNeLokalizace}">
   1.133 +		    <svg:text x="30" y="195" class="ne"><fmt:message key="hlasovani.graf.nekourit"/></svg:text>
   1.134 +		    <svg:rect x="30" y="${180 - hlasuNeVyska}" width="50" height="${hlasuNeVyska}" class="ne"/>
   1.135 +		</svg:a>
   1.136  
   1.137  		<!-- kuřáci -->
   1.138  		<fmt:message key="hlasovani.graf.popisSloupce" var="hlasuAnoLokalizace">
   1.139  		    <fmt:param value="${hlasuAno}"/>
   1.140  		</fmt:message>
   1.141 -		<a xlink:href="javascript:hlasovani.hlasuj(${podnik}, true);" xlink:title="${hlasuAnoLokalizace}">
   1.142 -		    <text x="130" y="195" class="ano"><fmt:message key="hlasovani.graf.kourit"/></text>
   1.143 -		    <rect x="120" y="${180 - hlasuAnoVyska}" width="50" height="${hlasuAnoVyska}" class="ano"/>
   1.144 -		</a>
   1.145 -	    </svg>
   1.146 +		<svg:a xlink:href="javascript:hlasovani.hlasuj(${podnik}, true);" xlink:title="${hlasuAnoLokalizace}">
   1.147 +		    <svg:text x="130" y="195" class="ano"><fmt:message key="hlasovani.graf.kourit"/></svg:text>
   1.148 +		    <svg:rect x="120" y="${180 - hlasuAnoVyska}" width="50" height="${hlasuAnoVyska}" class="ano"/>
   1.149 +		</svg:a>
   1.150 +	    </svg:svg>
   1.151  	</c:when>
   1.152  	<c:otherwise>
   1.153  	    <object data="hlasovani-svg.jsp?podnik=${podnik}&amp;amp;hlasuAno=${hlasuAno}&amp;amp;hlasuNe=${hlasuNe}" type="image/svg+xml"/>
     2.1 --- a/java/nekurak.net-web/web/WEB-INF/tags/nekurak/stranka.tag	Wed Apr 28 00:36:21 2010 +0200
     2.2 +++ b/java/nekurak.net-web/web/WEB-INF/tags/nekurak/stranka.tag	Wed Apr 28 01:29:22 2010 +0200
     2.3 @@ -10,7 +10,8 @@
     2.4      <jsp:directive.attribute name="titulek" type="java.lang.String" required="false"/>
     2.5      <jsp:directive.tag description="Obaluje všechny stránky – obsahuje XHTML záhlaví a zápatí"/>
     2.6  
     2.7 -    <jsp:output doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd"
     2.8 +    <jsp:output doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
     2.9 +		doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"
    2.10  		doctype-root-element="html"
    2.11  		omit-xml-declaration="false"/>
    2.12