Ignore:
Timestamp:
Dec 25, 2011, 9:40:28 PM (13 years ago)
Author:
chronos
Message:
  • Upraveno: Přidáno analyzování HTTP POST informací.
  • Upraveno: Příprava pro zpracování hodnot z objektů HTML formulářů.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/UWebObjects.pas

    r66 r67  
    2222    FInputType: TQueryFormItemType;
    2323    FItemType: TQueryFormItemType;
     24    function GetName: string;
    2425    procedure SetItemType(const AValue: TQueryFormItemType);
     26    procedure SetName(AValue: string);
    2527  public
    2628    Caption: string;
     
    2830    Hint: string;
    2931    Value: THTMLInput;
     32    property Name: string read GetName write SetName;
    3033    property ItemType: TQueryFormItemType read FItemType write SetItemType;
    3134    constructor Create;
     
    3841    Title: string;
    3942    Rows: TListObject; // TListObject<TQueryFormItem>
     43    procedure Load(Items: TStringList);
    4044    function AddNewItem: TQueryFormItem;
    4145    constructor Create;
     
    4448
    4549  TQueryAction = class
    46     Name: string;
     50    Caption: string;
     51    Action: string;
    4752  end;
    4853
     
    5762    function AddNewGroup: TQueryFormGroup;
    5863    function AddNewAction: TQueryAction;
     64    procedure Load(Items: TStringList);
    5965    constructor Create;
    6066    destructor Destroy; override;
     
    7985    fitFileSelect: Value.InputType := itFileSelect;
    8086  end;
     87end;
     88
     89function TQueryFormItem.GetName: string;
     90begin
     91  Result := Value.ItemName;
     92end;
     93
     94procedure TQueryFormItem.SetName(AValue: string);
     95begin
     96  Value.ItemName := AValue;
    8197end;
    8298
     
    131147        with THtmlCell(Row.Cells.AddNew(THtmlCell.Create)) do begin
    132148          Value := THtmlInput.Create;
    133           Value.Assign(TQueryFormItem(Rows[I]).Value);
     149          THtmlInput(Value).Assign(TQueryFormItem(Rows[I]).Value);
    134150        end;
    135151      end;
     
    141157      Value := THtmlBlock.Create;
    142158      with THtmlInput(THtmlBlock(Value).SubItems.AddNew(THtmlInput.Create)) do begin
    143         Value := TQueryAction(Actions[I]).Name;
     159        Value := TQueryAction(Actions[I]).Caption;
    144160        InputType := itSubmit;
     161        ItemName := TQueryAction(Actions[I]).Action;
    145162      end;
    146163    end;
     
    160177end;
    161178
     179procedure TQueryForm.Load(Items: TStringList);
     180var
     181  I: Integer;
     182begin
     183  for I := 0 to Groups.Count - 1 do
     184    TQueryFormGroup(Groups[I]).Load(Items);
     185end;
     186
    162187constructor TQueryForm.Create;
    163188begin
     
    166191  Groups := TListObject.Create;
    167192  Method := 'post';
     193  Action.AsString := '';
    168194end;
    169195
     
    177203{ TQueryFormGroup }
    178204
     205procedure TQueryFormGroup.Load(Items: TStringList);
     206var
     207  I: Integer;
     208begin
     209  for I := 0 to Rows.Count - 1 do
     210  with TQueryFormItem(Rows[I]) do begin
     211    if Items.IndexOfName(Value.ItemName) <> -1 then
     212      Value.Value := Items.Values[Value.ItemName];
     213  end;
     214end;
     215
    179216function TQueryFormGroup.AddNewItem: TQueryFormItem;
    180217begin
Note: See TracChangeset for help on using the changeset viewer.