1 { Lazarus IDE wizard for fpweb package.
2
3 Copyright (C) 2010 Lagunov Aleksey alexs75@hotbox.ru
4
5 This library is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or (at your
8 option) any later version with the following modification:
9
10 As a special exception, the copyright holders of this library give you
11 permission to link this library with independent modules to produce an
12 executable, regardless of the license terms of these independent modules,and
13 to copy and distribute the resulting executable under terms of your choice,
14 provided that you also meet, for each linked independent module, the terms
15 and conditions of the license of that module. An independent module is a
16 module which is not derived from or based on this library. If you modify
17 this library, you may extend this exception to your version of the library,
18 but you are not obligated to do so. If you do not wish to do so, delete this
19 exception statement from your version.
20
21 This program is distributed in the hope that it will be useful, but WITHOUT
22 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
24 for more details.
25
26 You should have received a copy of the GNU Library General Public License
27 along with this library; if not, write to the Free Software Foundation,
28 Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA.
29 }
30
31 unit fpwebNewHTMLFormUnit;
32
33 {$mode objfpc}{$H+}
34
35 interface
36
37 uses
38 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ButtonPanel,
39 ComCtrls, StdCtrls, EditBtn;
40
41 type
42
43 { TfpwebNewHTMLFormForm }
44
45 TfpwebNewHTMLFormForm = class(TForm)
46 ButtonPanel1: TButtonPanel;
47 cbAction: TComboBox;
48 cbMetod: TComboBox;
49 cbEncType: TComboBox;
50 cbTarget: TComboBox;
51 cbAcceptCharset: TComboBox;
52 ComboBox6: TComboBox;
53 ComboBox7: TComboBox;
54 ComboBox8: TComboBox;
55 ComboBox9: TComboBox;
56 EditButton1: TEditButton;
57 Label1: TLabel;
58 Label10: TLabel;
59 Label2: TLabel;
60 Label3: TLabel;
61 Label4: TLabel;
62 Label5: TLabel;
63 Label6: TLabel;
64 Label7: TLabel;
65 Label8: TLabel;
66 Label9: TLabel;
67 PageControl1: TPageControl;
68 TabSheet1: TTabSheet;
69 TabSheet2: TTabSheet;
70 TabSheet3: TTabSheet;
71 procedure FormCreate(Sender: TObject);
72 private
73 procedure FillActionList;
74 public
HtmlTextnull75 function HtmlText(const S:string): string;
76 end;
77
78 var
79 fpwebNewHTMLFormForm: TfpwebNewHTMLFormForm;
80
81 implementation
82 uses fpWeb;
83
84 {$R *.lfm}
85
86 { TfpwebNewHTMLFormForm }
87
88 procedure TfpwebNewHTMLFormForm.FormCreate(Sender: TObject);
89 begin
90 cbAction.Items.Clear;
91 FillActionList;
92 end;
93
94 procedure TfpwebNewHTMLFormForm.FillActionList;
95 var
96 i, j:integer;
97 WD:TFPWebModule;
98 begin
99 for i:=0 to Screen.DataModuleCount - 1 do
100 begin
101 if Screen.DataModules[i] is TFPWebModule then
102 begin
103 WD:=Screen.DataModules[i] as TFPWebModule;
104 for j:=0 to WD.Actions.Count - 1 do
105 cbAction.Items.Add(WD.ActionVar +'='+ WD.Actions[j].Name);
106 end;
107 end;
108 end;
109
HtmlTextnull110 function TfpwebNewHTMLFormForm.HtmlText(const S:string): string;
111 begin
112 Result:='<FORM action="?'+cbAction.Text+
113 '" method="'+cbMetod.Text+'"';
114
115 if cbEncType.Text<>'' then
116 Result:=Result +' enctype="' + cbEncType.Text+ '"';
117
118 if cbTarget.Text <> '' then
119 Result:=Result +' target="' + cbTarget.Text + '"';
120
121 if cbAcceptCharset.Text <> '' then
122 Result:=Result +' accept-charset="' + cbAcceptCharset.Text + '">';
123
124 Result:=Result +'>' + LineEnding + S+ LineEnding + '</FORM>';
125 end;
126
127 end.
128
129