# HG changeset patch # User wizard # Date 1282307617 -14400 # Node ID e36ffd8c29dbeb65a150c9c643421e54a1abc142 # Parent 4369d5458bb6fd3c3de54ecb3f3e24f5533c20d2 Fixed major bug in conversion from a POST request to the DOM document (when instanceId == 0) minor fixes diff -r 4369d5458bb6 -r e36ffd8c29db Lib/IMPL/DOM/Transform/PostToDOM.pm --- a/Lib/IMPL/DOM/Transform/PostToDOM.pm Fri Aug 20 08:28:43 2010 +0400 +++ b/Lib/IMPL/DOM/Transform/PostToDOM.pm Fri Aug 20 16:33:37 2010 +0400 @@ -51,7 +51,7 @@ my $value = $data->{$key->[0]}; my $node = $navi->NavigateCreate($key->[1]); - $node->nodeProperty(instanceId => $key->[2]) if $key->[2]; + $node->nodeProperty(instanceId => $key->[2]) if defined $key->[2]; $this->Transform($value); diff -r 4369d5458bb6 -r e36ffd8c29db Lib/IMPL/Object/List.pm --- a/Lib/IMPL/Object/List.pm Fri Aug 20 08:28:43 2010 +0400 +++ b/Lib/IMPL/Object/List.pm Fri Aug 20 16:33:37 2010 +0400 @@ -68,6 +68,24 @@ return $this; } +sub FindItem { + my ($this,$item) = @_; + + for (my $i = 0; $i < @$this; $i++ ) { + return $i if $this->[$i] == $item + } + return undef; +} + +sub FindItemStr { + my ($this,$item) = @_; + + for (my $i = 0; $i < @$this; $i++ ) { + return $i if $this->[$i] eq $item + } + return undef; +} + sub save { my ($this,$ctx) = @_; diff -r 4369d5458bb6 -r e36ffd8c29db Lib/IMPL/Web/DOM/FileNode.pm --- a/Lib/IMPL/Web/DOM/FileNode.pm Fri Aug 20 08:28:43 2010 +0400 +++ b/Lib/IMPL/Web/DOM/FileNode.pm Fri Aug 20 16:33:37 2010 +0400 @@ -13,7 +13,7 @@ $this->_parameterName() or $this->_parameterName( join '/', ( map { - $_->nodeProperty('instanceId') ? + (defined $_->nodeProperty('instanceId')) ? $_->nodeName . '['.$_->nodeProperty('instanceId').']': $_->nodeName } $this->_selectParents, $this ) @@ -43,7 +43,7 @@ $target ||= $this; my $query = $this->document->nodeProperty('query') or die new IMPL::InvalidOperationException("Failed to get a CGI query from the document"); - my $hFile = $query->upload($this->parameterName) or $query->cgi_error ? die new IMPL::IOException("Failed to open the uploaded file",$query->cgi_error) : return; + my $hFile = $query->upload($this->parameterName) or die new IMPL::IOException("Failed to open the uploaded file",$query->cgi_error,$this->parameterName,$this->nodeProperty('instanceId')); my ($hTemp,$tempFileName) = tempfile(); binmode($hTemp); @@ -54,7 +54,7 @@ seek $hTemp, 0,0; { local $_ = $tempFileName; - &$sub($this,$tempFileName,$hTemp); + $sub->($this,$tempFileName,$hTemp); } }