1.1 --- a/examples/Common/PEP241/Resources/pep241_template.xhtml Wed Oct 12 16:33:14 2005 +0000
1.2 +++ b/examples/Common/PEP241/Resources/pep241_template.xhtml Wed Oct 12 16:51:39 2005 +0000
1.3 @@ -8,6 +8,8 @@
1.4 <meta name="generator" content="amaya 8.1a, see http://www.w3.org/Amaya/" />
1.5 <link xmlns:xlink="http://www.w3.org/1999/xlink" href="styles/styles.css"
1.6 rel="stylesheet" type="text/css" />
1.7 + <script type="text/javascript" src="scripts/sarissa.js"> </script>
1.8 + <script type="text/javascript" src="scripts/XSLForms.js"> </script>
1.9 </head>
1.10
1.11 <body>
1.12 @@ -65,16 +67,32 @@
1.13 <tr>
1.14 <th colspan="2" class="heading">Platforms</th>
1.15 </tr>
1.16 + </tbody>
1.17 + <tbody template:id="platforms-node" id="{template:this-element()}">
1.18 <tr template:element="platforms,platform">
1.19 <th>Platform name</th>
1.20 <td><input template:attribute-field="name" name="..." value="..." type="text" size="20" />
1.21 - <input type="submit" value="Remove!" name="..." template:selector-field="remove_platform" /></td>
1.22 + <input type="submit" value="Remove!" name="..." template:selector-field="remove_platform" onclick="
1.23 +return requestUpdate(
1.24 + 'platforms',
1.25 + '{template:other-attributes('name', ../platform)},{template:selector-name('remove_platform', .)}',
1.26 + '{template:other-elements(../..)}', '{template:other-attributes('name', ../platform)}',
1.27 + '/package')
1.28 +"/></td>
1.29 </tr>
1.30 <tr>
1.31 <th></th>
1.32 <td>
1.33 - <input type="submit" value="Add platform!" name="..." template:selector-field="add_platform,platform" /></td>
1.34 + <input type="submit" value="Add platform!" name="..." template:selector-field="add_platform,platform" onclick="
1.35 +return requestUpdate(
1.36 + 'platforms',
1.37 + '{template:other-attributes('name', .)},{template:other-attributes('name', platforms/platform)},{template:selector-name('add_platform', .)}',
1.38 + '{template:other-elements(.)}', '{template:other-attributes('name', platforms/platform)}',
1.39 + '/package')
1.40 +"/></td>
1.41 </tr>
1.42 + </tbody>
1.43 + <tbody>
1.44 <tr>
1.45 <th colspan="2" class="heading">Supported platforms</th>
1.46 </tr>
2.1 --- a/examples/Common/PEP241/__init__.py Wed Oct 12 16:33:14 2005 +0000
2.2 +++ b/examples/Common/PEP241/__init__.py Wed Oct 12 16:51:39 2005 +0000
2.3 @@ -29,6 +29,9 @@
2.4 document_resources = {
2.5 "categories" : "pep241_categories.xml"
2.6 }
2.7 + in_page_resources = {
2.8 + "platforms" : ("pep241_output_platforms.xsl", "platforms-node")
2.9 + }
2.10
2.11 def respond_to_form(self, trans, form):
2.12
2.13 @@ -37,6 +40,7 @@
2.14 'form' information.
2.15 """
2.16
2.17 + in_page_resource = self.get_in_page_resource(trans)
2.18 parameters = form.get_parameters()
2.19 documents = form.get_documents()
2.20 selectors = form.get_selectors()
2.21 @@ -85,8 +89,12 @@
2.22
2.23 # Ensure that an output stylesheet exists.
2.24
2.25 - trans_xsl = self.prepare_output("pep241")
2.26 - stylesheet_parameters = {}
2.27 + if in_page_resource in self.in_page_resources.keys():
2.28 + trans_xsl = self.prepare_fragment("pep241", in_page_resource)
2.29 + stylesheet_parameters = self.prepare_parameters(parameters)
2.30 + else:
2.31 + trans_xsl = self.prepare_output("pep241")
2.32 + stylesheet_parameters = {}
2.33
2.34 # Complete the response.
2.35
2.36 @@ -113,6 +121,9 @@
2.37 resource = MapResource({
2.38 # Static resources:
2.39 "styles" : DirectoryResource(os.path.join(directory, "styles"), {"css" : "text/css"}),
2.40 + "scripts" : DirectoryResource(os.path.join(directory, "scripts"), {"js" : "text/javascript"}),
2.41 + # In-page resources:
2.42 + "platforms" : pep241_resource,
2.43 # Main page:
2.44 "" : pep241_resource
2.45 })