# HG changeset patch
# User paulb
# Date 1129135899 0
# Node ID 53b52525871b651fc3c6456e6409e1007ac480f5
# Parent d6c3dbeae8eec7aae14b5454750467f8fcbcdae6
[project @ 2005-10-12 16:51:38 by paulb]
Added a platforms in-page resource which permits the dynamic addition and
removal of platforms.
diff -r d6c3dbeae8ee -r 53b52525871b examples/Common/PEP241/Resources/pep241_template.xhtml
--- a/examples/Common/PEP241/Resources/pep241_template.xhtml Wed Oct 12 16:33:14 2005 +0000
+++ b/examples/Common/PEP241/Resources/pep241_template.xhtml Wed Oct 12 16:51:39 2005 +0000
@@ -8,6 +8,8 @@
+
+
@@ -65,16 +67,32 @@
Platforms |
+
+
Platform name |
- |
+
|
- |
+
+
+
Supported platforms |
diff -r d6c3dbeae8ee -r 53b52525871b examples/Common/PEP241/__init__.py
--- a/examples/Common/PEP241/__init__.py Wed Oct 12 16:33:14 2005 +0000
+++ b/examples/Common/PEP241/__init__.py Wed Oct 12 16:51:39 2005 +0000
@@ -29,6 +29,9 @@
document_resources = {
"categories" : "pep241_categories.xml"
}
+ in_page_resources = {
+ "platforms" : ("pep241_output_platforms.xsl", "platforms-node")
+ }
def respond_to_form(self, trans, form):
@@ -37,6 +40,7 @@
'form' information.
"""
+ in_page_resource = self.get_in_page_resource(trans)
parameters = form.get_parameters()
documents = form.get_documents()
selectors = form.get_selectors()
@@ -85,8 +89,12 @@
# Ensure that an output stylesheet exists.
- trans_xsl = self.prepare_output("pep241")
- stylesheet_parameters = {}
+ if in_page_resource in self.in_page_resources.keys():
+ trans_xsl = self.prepare_fragment("pep241", in_page_resource)
+ stylesheet_parameters = self.prepare_parameters(parameters)
+ else:
+ trans_xsl = self.prepare_output("pep241")
+ stylesheet_parameters = {}
# Complete the response.
@@ -113,6 +121,9 @@
resource = MapResource({
# Static resources:
"styles" : DirectoryResource(os.path.join(directory, "styles"), {"css" : "text/css"}),
+ "scripts" : DirectoryResource(os.path.join(directory, "scripts"), {"js" : "text/javascript"}),
+ # In-page resources:
+ "platforms" : pep241_resource,
# Main page:
"" : pep241_resource
})