changeset 145:bd10093bb122

Minor changes
author wizard
date Wed, 21 Jul 2010 06:27:12 +0400
parents b56ebc31bf18
children 60fd224f3e3c
files Lib/IMPL/Web/TT/Document.pm Lib/IMPL/Web/TT/Form.pm
diffstat 2 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Lib/IMPL/Web/TT/Document.pm	Tue Jul 13 02:05:38 2010 +0400
+++ b/Lib/IMPL/Web/TT/Document.pm	Wed Jul 21 06:27:12 2010 +0400
@@ -77,7 +77,8 @@
                     	$this->_process(@_);
                     }
                 },
-                TRIM => 1,
+                POST_CHOMP => 2,
+                PRE_CHOMP => 2,
                 RECURSION => 1,
                 LOAD_TEMPLATES => [$this->provider]
             )
--- a/Lib/IMPL/Web/TT/Form.pm	Tue Jul 13 02:05:38 2010 +0400
+++ b/Lib/IMPL/Web/TT/Form.pm	Wed Jul 21 06:27:12 2010 +0400
@@ -76,6 +76,23 @@
 	};
 }
 
+sub makeContent {
+	my ($this,$mappings) = @_;
+	
+	my $formSchema = $this->schema->selectSingleNode(sub { $_->nodeName eq 'ComplexNode' and $_->name eq $this->base } )
+		or die new Exception("Cant find a schema element for the specified form", $this->base);
+
+	my $doc = $this->document;		
+	foreach my $itemSchema ( $formSchema->content->childNodes ) {
+		my $itemName = $itemSchema->name; 
+		if (my $controlClass = $mappings->{$itemName} ) {
+			my $contorl = $doc->CreateControl($itemName,$controlClass,$this->makeControlArgs($itemName));
+			$this->appendChild($contorl);
+		}
+	}
+	return;
+}
+
 sub formErrors {
 	my ($this) = @_;