You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ru...@apache.org on 2010/09/12 12:55:11 UTC

svn commit: r996291 [2/2] - in /lenya/contributions/2_0_X/modules/quiz: ./ config/ config/cocoon-xconf/ resources/ resources/i18n/ resources/schemas/ samples/ xslt/

Added: lenya/contributions/2_0_X/modules/quiz/resources/schemas/xhtml.rng
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/quiz/resources/schemas/xhtml.rng?rev=996291&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/quiz/resources/schemas/xhtml.rng (added)
+++ lenya/contributions/2_0_X/modules/quiz/resources/schemas/xhtml.rng Sun Sep 12 10:55:10 2010
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!-- $Id: xhtml.rng 168097 2005-05-04 07:49:22Z jwkaltz $ -->
+
+<!--+
+    | XHTML doctype
+    +-->
+
+<!--+
+    | Namespaces:
+    | lenya namespace is required for embedding assets.
+    +-->
+
+<grammar ns="http://www.w3.org/1999/xhtml"
+         xmlns="http://relaxng.org/ns/structure/1.0"
+         xmlns:xhtml="http://www.w3.org/1999/xhtml"
+         xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
+         >
+
+
+<!-- include Lenya schema, for Lenya assets within xhtml -->
+<include href="fallback://lenya/resources/schemas/lenya.rng"/>
+
+<!-- include original XHTML basic schema
+<include href="fallback://lenya/modules/xhtml/resources/schemas/xhtml/xhtml-basic.rng">
+-->
+<!-- change to this to include XHTML transitional schema 
+<include href="fallback://lenya/modules/xhtml/resources/schemas/xhtml/xhtml.rng">
+-->
+<!-- change to this to include XHTML strict schema 
+-->
+<include href="fallback://lenya/modules/xhtmlukf/resources/schemas/xhtml/xhtml-strict.rng">
+
+  <define name="html">
+    <element name="html">
+      <ref name="html.attlist"/>
+      <ref name="head"/>
+      <ref name="body"/>
+    </element>
+  </define>
+
+  <define name="html.attlist">
+    <ref name="XHTML.version.attrib"/>
+    <ref name="I18n.attrib"/>
+  </define>
+
+</include>
+
+
+<!-- additional block elements -->
+<define name="Block.class" combine="choice">
+  <choice>
+    <ref name="lenya.asset"/>
+  </choice>
+</define>
+
+
+</grammar>

Added: lenya/contributions/2_0_X/modules/quiz/samples/default.xml
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/quiz/samples/default.xml?rev=996291&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/quiz/samples/default.xml (added)
+++ lenya/contributions/2_0_X/modules/quiz/samples/default.xml Sun Sep 12 10:55:10 2010
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<quiz xmlns="http://www.w3.org/1999/xhtml" xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml">
+  <continuation first=" " last="Answers are correct" text="next question"/>
+  <results>
+    <result max="0" min="0">bad</result>
+    <result max="10" min="1">good</result>
+    <text> </text>
+  </results>
+  <question>What is the circumference of the earth?
+    <answer points="0">
+      <text>30.000 km</text>
+      <explanation> to small</explanation>
+    </answer>
+    <answer points="2">
+      <text>40.000 km</text>
+      <explanation>right</explanation>
+    </answer>
+    <answer points="0">
+      <text>50.000 km</text>
+      <explanation>to large</explanation>
+		</answer>
+    <note>The circumference of the earth is 40.000 km </note>
+  </question>
+</quiz>

Added: lenya/contributions/2_0_X/modules/quiz/samples/samples.xml
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/quiz/samples/samples.xml?rev=996291&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/quiz/samples/samples.xml (added)
+++ lenya/contributions/2_0_X/modules/quiz/samples/samples.xml Sun Sep 12 10:55:10 2010
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<samples>
+  <sample name="Default Sample"
+    mime-type="application/xhtml+xml"
+    uri="fallback://lenya/modules/quiz/samples/default.xml"
+  />
+</samples>

Added: lenya/contributions/2_0_X/modules/quiz/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/quiz/sitemap.xmap?rev=996291&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/quiz/sitemap.xmap (added)
+++ lenya/contributions/2_0_X/modules/quiz/sitemap.xmap Sun Sep 12 10:55:10 2010
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+<!-- =========================== Components ================================ -->
+
+  <map:components>
+    <map:serializers default="xhtml">
+      <map:serializer name="xml-get" src="org.apache.cocoon.serialization.XMLSerializer" mime-type="text/xml">
+        <doctype-public>-//W3C//DTD XHTML 1.0 Strict//EN</doctype-public>
+        <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</doctype-system>
+        <encoding>UTF-8</encoding>
+      </map:serializer>
+    </map:serializers>
+
+  </map:components>
+
+  <map:pipelines>
+    <map:pipeline type="profile-noncaching"> 
+<!-- webdav GET matcher -->
+      <map:match pattern="davget.xml">
+        <map:act type="set-header">
+          <map:parameter name="Last-Modified" value="{date-iso8601-rfc822:{page-envelope:document-lastmodified}}" />
+          <map:generate src="lenya-document:{page-envelope:document-uuid},lang={page-envelope:document-language}"/>
+          <map:transform type="uuid2url"/>
+          <map:transform type="proxy">
+            <map:parameter name="urls" value="absolute"/>
+          </map:transform>
+          <map:serialize type="xml-get"/>
+        </map:act>
+      </map:match>
+
+<!-- parametrized doctype matcher -->
+<!-- pattern="{format}.xml" -->
+      <map:match pattern="*.xml">
+        <map:generate src="cocoon:/{1}.xml/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-uuid}/{page-envelope:document-language}"/>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+<!-- {format}.xml/{pubId}/{area}/{uuid}/{language} -->
+      <map:match pattern="*.xml/*/*/*/*">
+        <map:generate src="lenya-document:{4},pub={2},area={3},lang={5}{link:rev}"/>
+
+        <map:transform src="fallback://lenya/modules/quiz/xslt/reqparaminclude.xsl"/>
+        <map:transform type="include"/>
+
+        <map:transform src="fallback://lenya/modules/quiz/xslt/quiz2{1}.xsl">
+          <map:parameter name="rendertype" value="{request-param:rendertype}"/>
+          <map:parameter name="nodeid" value="{doc-info:{2}:{3}:{4}:{5}:nodeName}"/>
+          <map:parameter name="language" value="{4}"/>
+          <map:parameter name="area" value="{3}"/>
+        </map:transform>
+        <map:serialize type="xml"/>
+      </map:match>
+
+      <map:match pattern="reqparam">
+        <map:generate type="request"/>
+        <map:serialize type="xml" />
+      </map:match>
+
+      <map:match pattern="icon/*/*/*/*">
+        <map:read src="fallback://lenya/modules/xhtml/resources/icons/xhtml.gif"/>
+      </map:match>
+
+      <map:match pattern="icon">
+        <map:read src="fallback://lenya/modules/xhtml/resources/icons/xhtml.gif" mime-type="image/gif"/>
+      </map:match>
+    </map:pipeline>
+
+  </map:pipelines>
+</map:sitemap>

Added: lenya/contributions/2_0_X/modules/quiz/xslt/quiz2xhtml.xsl
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/quiz/xslt/quiz2xhtml.xsl?rev=996291&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/quiz/xslt/quiz2xhtml.xsl (added)
+++ lenya/contributions/2_0_X/modules/quiz/xslt/quiz2xhtml.xsl Sun Sep 12 10:55:10 2010
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<xsl:stylesheet version="1.0" xmlns:h="http://apache.org/cocoon/request/2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:i="http://apache.org/cocoon/include/1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:ci="http://apache.org/cocoon/include/1.0" exclude-result-prefixes="xhtml lenya">
+
+  <xsl:param name="rendertype" select="''"/>
+  <xsl:param name="nodeid"/>
+  <xsl:param name="editor"/>
+  <xsl:param name="area"/>
+
+  <xsl:template match="/">
+    <script type="text/javascript">
+var points=0;
+var minpoints=<xsl:value-of select="5" />;
+var results = new Array();
+<xsl:for-each select="/xhtml:results/xhtml:result">
+results[<xsl:value-of select="position()-1"/>]=new Array(<xsl:value-of select="@min"/>,<xsl:value-of select="@max"/>);
+</xsl:for-each>
+
+function response(x,p) {
+  document.getElementById(x).style.display = "block";
+	postwork(x.substring(0,x.indexOf('_')));
+	points+=p;
+	window.document.result.points.value=points;
+}		
+function postwork(x) {
+  document.getElementById(x+'n').style.display = "block";
+  document.getElementById(x+'q').style.display = "block";
+  for (i=0;i &lt; document.getElementsByName(x+'a').length;i++) {
+    document.getElementsByName(x+'a')[i].disabled = true;
+  }
+}
+function showquestion(x) {
+  var idr='r0';
+  if (document.getElementById(x)==null) {
+	  document.getElementById('rsum').style.display = "block";
+	  for (var i=0; i &lt; results.length; i++) {
+		  if (points &gt;= results[i][0] &amp;&amp; points &lt;= results[i][1]) {
+			  document.getElementById('r'+(i+1)).style.display = "block";
+			}
+		}
+    document.getElementById(x-1).style.display = "none";
+	}
+	else {
+    document.getElementById(x).style.display = "block";
+    document.getElementById(x-1).style.display = "none";
+  }
+}
+
+</script>
+    <div id="body">
+      <xsl:apply-templates/>
+      <div id="result">
+        <div id="rsum" style="display:none">
+          <xsl:copy-of select="/xhtml:results/xhtml:text"/>
+        </div>
+        <form name="result" action="">
+          <xsl:value-of select="/xhtml:continuation/@first"/>
+          <input name="points" size="2" disabled="disabled" style="border : 0; background-color:#ffffff; color:#000000;"/>
+          <xsl:value-of select="/xhtml:continuation/@last"/>
+          <xsl:for-each select="/xhtml:results/xhtml:result">
+            <div id="r{position()}" style="display:none">
+              <xsl:copy-of select="."/>
+            </div>
+          </xsl:for-each>
+        </form>
+      </div>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="xhtml:continuation"></xsl:template>
+  <xsl:template match="xhtml:results"></xsl:template>
+  <xsl:template match="h:request"></xsl:template>
+
+  <xsl:template match="xhtml:question">
+    <xsl:variable name="gid">
+      <xsl:number count="xhtml:question"/>
+    </xsl:variable>
+    <xsl:variable name="displayquestion">
+      <xsl:choose>
+        <xsl:when test="$gid=1">display:block</xsl:when>
+        <xsl:otherwise>display:none</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <div id="{$gid}" style="{$displayquestion}">
+      <h2>
+        <xsl:value-of select="text()"/>
+      </h2>
+      <xsl:for-each select="xhtml:answer">
+        <input type="radio" id="{$gid}a" name="{$gid}a" value="{@true}" onclick="response('{$gid}_{position()}',{@points})"/>
+
+        <xsl:value-of select="xhtml:text"/>
+        <div id="{$gid}_{position()}" style="display:none">
+          <p>
+            <xsl:apply-templates select="xhtml:explanation"/>
+          </p>
+        </div>
+        <br/>
+      </xsl:for-each>
+      <br/>
+      <div id="{$gid}n" style="display:none">
+        <xsl:apply-templates select="xhtml:note/node()"/>
+      </div>
+      <div id="{$gid}q" style="display:none">
+        <p>
+          <a href="javascript:showquestion('{$gid+1}')">
+            <xsl:value-of select="/xhtml:continuation/@text"/>
+          </a>
+        </p>
+      </div>
+    </div>
+
+  </xsl:template>
+
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet> 

Added: lenya/contributions/2_0_X/modules/quiz/xslt/reqparam.xsl
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/quiz/xslt/reqparam.xsl?rev=996291&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/quiz/xslt/reqparam.xsl (added)
+++ lenya/contributions/2_0_X/modules/quiz/xslt/reqparam.xsl Sun Sep 12 10:55:10 2010
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:h="http://apache.org/cocoon/request/2.0">
+  <xsl:param name="formurl">uuuuu</xsl:param>
+
+  <xsl:template match="/">
+    <table>
+      <xsl:for-each select="/h:request/h:requestParameters/h:parameter">
+        <tr>
+          <td>
+            <xsl:value-of select="@name"/>
+          </td>
+          <td>=</td>
+          <td>
+            <xsl:value-of select="h:value"/>
+          </td>
+        </tr>
+      </xsl:for-each>
+    </table>
+  </xsl:template>
+
+  <xsl:template match="@*|*|processing-instruction()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
+    </xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet>

Added: lenya/contributions/2_0_X/modules/quiz/xslt/reqparaminclude.xsl
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/quiz/xslt/reqparaminclude.xsl?rev=996291&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/quiz/xslt/reqparaminclude.xsl (added)
+++ lenya/contributions/2_0_X/modules/quiz/xslt/reqparaminclude.xsl Sun Sep 12 10:55:10 2010
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!-- $Id: xhtml2xhtml.xsl 201776 2005-06-25 18:25:26Z gregor $ -->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:i="http://apache.org/cocoon/include/1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:ci="http://apache.org/cocoon/include/1.0" exclude-result-prefixes="xhtml lenya">
+
+  <xsl:param name="rendertype" select="''"/>
+  <xsl:param name="nodeid"/>
+  <xsl:param name="editor"/>
+  <xsl:param name="area"/>
+
+  <xsl:template match="/xhtml:quiz">
+    <xsl:apply-templates />
+    <i:include src="cocoon:/reqparam"/>
+  </xsl:template>
+
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+
+</xsl:stylesheet> 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org