Browse Source

Merged revisions 8029-8030,8035,8079 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/trunk

........
r8029 | joost | 2007-07-12 22:56:35 +0200 (Thu, 12 Jul 2007) | 1 line

* THTML_Text can now produce text
........
r8030 | joost | 2007-07-12 22:58:15 +0200 (Thu, 12 Jul 2007) | 1 line

* Fixed some AV's
........
r8035 | joost | 2007-07-13 13:23:42 +0200 (Fri, 13 Jul 2007) | 1 line

* Generate error-message if WriteContent returns nil
........
r8079 | joost | 2007-07-16 21:50:12 +0200 (Mon, 16 Jul 2007) | 1 line

* Make THTMLDatasetFormProducer.Controls and .ButtonRow streamable for usage with Lazarus
........

git-svn-id: branches/fixes_2_2@8100 -

joost 18 years ago
parent
commit
684d31e237

+ 2 - 2
packages/fcl-web/src/fpdatasetform.pp

@@ -301,11 +301,11 @@ type
       // method of the form, Get or Post
     Property DataSource : TDataSource read FDataSource write FDataSource;
       // the data to use
-    property Controls : TFormFieldCollection read FControls;
+    property Controls : TFormFieldCollection read FControls write FControls;
       // configuration of the fields and how to generate the html
     property SeparateLabel : boolean read FSeparateLabel write SetSeparateLabel;
       // place label and value/edit in same table cell
-    property buttonrow : TFormButtonCollection read Fbuttonrow;
+    property buttonrow : TFormButtonCollection read Fbuttonrow write Fbuttonrow;
       // buttons to place in the form
     property TableCols : integer read FTableCols write FTableCols default 2;
       // number columns in the grid for 1 record

+ 8 - 5
packages/fcl-web/src/fphtml.pp

@@ -192,6 +192,7 @@ Uses dbugintf;
 
 resourcestring
   SErrRequestNotHandled = 'Web request was not handled by actions.';
+  SErrNoContentProduced = 'The content producer "%s" didn''t produce any content.';
 
 { THTMLContentProducer }
 
@@ -225,14 +226,16 @@ begin
     try
       FWriter.CurrentElement := ParentElement;
       el := WriteContent (FWriter);
+      if not assigned(el) then
+        Raise EHTMLError.CreateFmt(SErrNoContentProduced,[Self.Name]);
       result := el.asstring;
     finally
       if WCreated then
-        FWriter.Free;
+        FreeAndNil(FWriter);
     end;
   finally
     if created then
-      FDocument.Free;
+      FreeAndNil(FDocument);
   end;
 end;
 
@@ -419,7 +422,7 @@ Var
   M : TMemoryStream;
   
 begin
-  CreateDocument;
+  FDocument := CreateDocument;
   Try
     FWriter:=CreateWriter(FDocument);
     Try
@@ -435,10 +438,10 @@ begin
         end;
       FDocument.SaveToStream(AResponse.ContentStream);
     Finally
-      FWriter.Free;
+      FreeAndNil(FWriter);
     end;
   Finally
-    FDocument.Free;
+    FreeAndNil(FDocument);
   end;
 end;
 

+ 14 - 0
packages/fcl-xml/src/htmlelements.pp

@@ -119,6 +119,10 @@ type
   { THTML_text }
 
   THTML_text = class (THTMLCustomElement)
+    FNodeValue : DOMString;
+  protected
+    function  GetNodeValue: DOMString; override;
+    procedure SetNodeValue(const AValue: DOMString); override;
   public
     constructor create (AOwner: TDOMDocument); override;
     procedure WriteToStream (const aStream : TStream);  override;
@@ -295,6 +299,16 @@ end;
 
 { THTML_text }
 
+function THTML_text.GetNodeValue: DOMString;
+begin
+  Result := FNodeValue;
+end;
+
+procedure THTML_text.SetNodeValue(const AValue: DOMString);
+begin
+  FNodeValue := AValue;
+end;
+
 constructor THTML_text.create (AOwner: TDOMDocument);
 begin
   inherited create (AOwner);