1.1 --- a/examples/Common/Configurator/Resources/config_template.xhtml Sun May 08 22:07:29 2005 +0000
1.2 +++ b/examples/Common/Configurator/Resources/config_template.xhtml Sun May 08 22:08:32 2005 +0000
1.3 @@ -20,7 +20,7 @@
1.4 <h2>Base System</h2>
1.5
1.6 <p template:element="base-system">Model
1.7 - <select name="{template:multi-field-name('value')}" onchange="requestUpdate('{$application-url}cpu', '{template:multi-field-name('value')}', 'cpu-node', '{template:other-multi-field-name('value', ../cpu)}')">
1.8 + <select name="{template:multi-field-name('value')}" onchange="requestUpdate('{$application-url}cpu', '{template:multi-field-name('value')}', 'cpu-node', '{template:other-multi-field-names('value', ../cpu)}'); requestUpdate('{$application-url}memory', '{template:multi-field-name('value')}', 'memory', '{template:other-multi-field-names('value', ../../memory/memory-unit)}')">
1.9 <option template:element="base-system-enum" template:expr="@value-is-set" template:expr-attr="selected" template:value="@value"
1.10 value="{@value}"></option>
1.11 </select>
1.12 @@ -39,7 +39,7 @@
1.13 <div template:element="memory" class="memory">
1.14 <h2>Memory</h2>
1.15
1.16 - <p template:element="memory-unit">Memory unit
1.17 + <p id="memory-node" template:element="memory-unit">Memory unit
1.18 <select name="{template:multi-field-name('value')}">
1.19 <option template:element="memory-unit-enum" template:expr="@value-is-set" template:expr-attr="selected" template:value="@value"
1.20 value="{@value}"></option>
2.1 --- a/examples/Common/Configurator/__init__.py Sun May 08 22:07:29 2005 +0000
2.2 +++ b/examples/Common/Configurator/__init__.py Sun May 08 22:08:32 2005 +0000
2.3 @@ -55,15 +55,23 @@
2.4 documents = fields.make_documents(parameters.items())
2.5 elif method == "POST":
2.6 fields = XSLForms.Fields.Fields(encoding=self.encoding, values_are_lists=1)
2.7 - if path_info == "/cpu":
2.8 +
2.9 + # Handle requests for fragments.
2.10 +
2.11 + if path_info in ("/cpu", "/memory"):
2.12 text = trans.get_request_stream().read()
2.13 parameters = {}
2.14 for text_line in text.split("\r\n"):
2.15 text_parts = text_line.split("=")
2.16 - text_name, text_values = text_parts[0], ["=".join(text_parts[1:])]
2.17 - parameters[text_name] = text_values
2.18 + text_name, text_value = text_parts[0], "=".join(text_parts[1:])
2.19 + if not parameters.has_key(text_name):
2.20 + parameters[text_name] = []
2.21 + parameters[text_name].append(text_value)
2.22 else:
2.23 parameters = trans.get_fields_from_body(self.encoding)
2.24 +
2.25 + # Get the XML representation of the request.
2.26 +
2.27 documents = fields.make_documents(parameters.items())
2.28 print "*", libxml2dom.toString(documents["configuration"])
2.29 else:
2.30 @@ -129,6 +137,15 @@
2.31 stylesheet_parameters["element-path"] = XSLForms.Output.get_element_path(target_field_name)
2.32 print "*", stylesheet_parameters["element-path"]
2.33
2.34 + elif path_info == "/memory":
2.35 + trans_xsl = os.path.join(self.resource_dir, "config_output_memory.xsl")
2.36 + template_xml = os.path.join(self.resource_dir, "config_output.xsl")
2.37 + XSLForms.Prepare.ensure_stylesheet_fragment(template_xml, trans_xsl, "memory-node")
2.38 + target_field_name = parameters.get("target-field-name", [""])[0]
2.39 + print "*", target_field_name
2.40 + stylesheet_parameters["element-path"] = XSLForms.Output.get_element_path(target_field_name)
2.41 + print "*", stylesheet_parameters["element-path"]
2.42 +
2.43 stylesheet_parameters["application-url"] = \
2.44 "http://%s:%s%s" % (trans.get_server_name(), trans.get_server_port(), trans.get_path_without_query())
2.45