Changeset 66 for trunk/Application/UWebObjects.pas
- Timestamp:
- Dec 20, 2011, 9:37:35 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/UWebObjects.pas
r65 r66 38 38 Title: string; 39 39 Rows: TListObject; // TListObject<TQueryFormItem> 40 function AddNewItem: TQueryFormItem; 40 41 constructor Create; 41 42 destructor Destroy; override; 42 43 end; 43 44 45 TQueryAction = class 46 Name: string; 47 end; 48 44 49 TQueryForm = class(THtmlForm) 45 private 50 protected 51 function GetAsXmlElement: TXmlElement; override; 46 52 public 47 53 Title: string; 48 54 Groups: TListObject; // TListObject<TQueryFormGroup> 49 Actions: TListObject; // TListObject<THtmlInput> 50 function GetAsXmlElement: TXmlElement; override; 55 Actions: TListObject; // TListObject<TQueryAction> 56 ClassId: string; 57 function AddNewGroup: TQueryFormGroup; 58 function AddNewAction: TQueryAction; 51 59 constructor Create; 52 60 destructor Destroy; override; … … 90 98 I: Integer; 91 99 G: Integer; 100 Table: THtmlTable; 101 Row: THtmlRow; 92 102 begin 93 103 Result := inherited GetAsXmlElement; 94 104 with TXmlTag(Result).SubElements do begin 105 Table := THtmlTable.Create; 106 Table.ClassId := ClassId; 107 Row := THtmlRow(Table.Rows.AddNew(THtmlRow.Create)); 108 with THtmlCell(Row.Cells.AddNew(THtmlCell.Create)) do begin 109 ColSpan := 2; 110 Value := THtmlString.Create; 111 THtmlString(Value).Text := Title; 112 end; 113 with Table do 95 114 for G := 0 to Groups.Count - 1 do 96 115 with TQueryFormGroup(Groups[G]) do begin 97 with TXmlString(AddNew(TXmlString.Create)) do begin 98 Text := Title; 99 end; 100 with THtmlLineBreak.Create do begin 101 Add(AsXmlElement); 116 if Title <> '' then begin 117 Row := THtmlRow(Table.Rows.AddNew(THtmlRow.Create)); 118 with THtmlCell(Row.Cells.AddNew(THtmlCell.Create)) do begin 119 ColSpan := 2; 120 Value := THtmlString.Create; 121 THtmlString(Value).Text := Title; 122 end; 102 123 end; 103 124 for I := 0 to Rows.Count - 1 do 104 125 with TQueryFormItem(Rows[I]) do begin 105 with TXmlString(AddNew(TXmlString.Create)) do begin 106 Text := Caption + ': '; 126 Row := THtmlRow(Table.Rows.AddNew(THtmlRow.Create)); 127 with THtmlCell(Row.Cells.AddNew(THtmlCell.Create)) do begin 128 Value := THtmlString.Create; 129 THtmlString(Value).Text := Caption + ': '; 107 130 end; 108 Add(Value.AsXmlElement);109 with THtmlLineBreak.Create do begin110 Add(AsXmlElement);131 with THtmlCell(Row.Cells.AddNew(THtmlCell.Create)) do begin 132 Value := THtmlInput.Create; 133 Value.Assign(TQueryFormItem(Rows[I]).Value); 111 134 end; 112 135 end; 113 136 end; 114 with THtmlInput.Create do begin 115 Value := 'Přihlásit'; 116 InputType := itSubmit; 117 Add(AsXmlElement); 137 Row := THtmlRow(Table.Rows.AddNew(THtmlRow.Create)); 138 with THtmlCell(Row.Cells.AddNew(THtmlCell.Create)) do begin 139 ColSpan := 2; 140 for I := 0 to Actions.Count - 1 do 141 Value := THtmlBlock.Create; 142 with THtmlInput(THtmlBlock(Value).SubItems.AddNew(THtmlInput.Create)) do begin 143 Value := TQueryAction(Actions[I]).Name; 144 InputType := itSubmit; 145 end; 118 146 end; 147 Add(Table.AsXmlElement); 148 Table.Free; 119 149 end; 150 end; 151 152 function TQueryForm.AddNewGroup: TQueryFormGroup; 153 begin 154 Result := TQueryFormGroup(Groups.AddNew(TQueryFormGroup.Create)); 155 end; 156 157 function TQueryForm.AddNewAction: TQueryAction; 158 begin 159 Result := TQueryAction(Actions.AddNew(TQueryAction.Create)); 120 160 end; 121 161 … … 125 165 Actions := TListObject.Create; 126 166 Groups := TListObject.Create; 167 Method := 'post'; 127 168 end; 128 169 … … 135 176 136 177 { TQueryFormGroup } 178 179 function TQueryFormGroup.AddNewItem: TQueryFormItem; 180 begin 181 Result := TQueryFormItem(Rows.AddNew(TQueryFormItem.Create)); 182 end; 137 183 138 184 constructor TQueryFormGroup.Create;
Note:
See TracChangeset
for help on using the changeset viewer.