Changeset 104 for Network/CoolWeb/Common/UHtmlClasses.pas
- Timestamp:
- Dec 31, 2010, 9:59:19 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Network/CoolWeb/Common/UHtmlClasses.pas
r94 r104 6 6 7 7 uses 8 UXmlClasses, Classes, SysUtils, SpecializedList , SpecializedObjectList;8 UXmlClasses, Classes, SysUtils, SpecializedList; 9 9 10 10 type … … 90 90 end; 91 91 92 { THtmlLineBreak } 93 94 THtmlLineBreak = class(THtmlElement) 95 private 96 function GetAsXmlElement: TXmlElement; override; 97 public 98 constructor Create; 99 end; 100 92 101 THtmlBlock = class(THtmlElement) 93 102 private … … 125 134 Source: TURL; 126 135 AlternateText: string; 136 constructor Create; 137 destructor Destroy; override; 138 end; 139 140 THtmlInputType = (itText, itComboBox, itRadioButton, itReset, itPassword, 141 itSubmit, itHidden, itFileSelect, itButton, itCheckBox); 142 143 { THtmlInput } 144 145 THtmlInput = class(THtmlElement) 146 private 147 function GetAsXmlElement: TXmlElement; override; 148 public 149 InputType: THtmlInputType; 150 Value: Variant; 151 constructor Create; 152 destructor Destroy; override; 153 end; 154 155 { THtmlForm } 156 157 THtmlForm = class(THtmlBlock) 158 private 159 public 160 Method: string; 161 Action: TURL; 162 function GetAsXmlElement: TXmlElement; override; 127 163 constructor Create; 128 164 destructor Destroy; override; … … 211 247 Result := False; 212 248 end; 249 end; 250 251 { THtmlLineBreak } 252 253 function THtmlLineBreak.GetAsXmlElement: TXmlElement; 254 begin 255 Result := inherited GetAsXmlElement; 256 TXmlTag(Result).Name := 'br'; 257 end; 258 259 constructor THtmlLineBreak.Create; 260 begin 261 end; 262 263 { THtmlInput } 264 265 function THtmlInput.GetAsXmlElement: TXmlElement; 266 var 267 InputTypeString: string; 268 begin 269 Result := TXmlTag.Create; 270 with TXmlTag(Result) do begin 271 Name := 'input'; 272 case InputType of 273 itButton: InputTypeString := 'button'; 274 itRadioButton: InputTypeString := 'radio'; 275 itCheckBox: InputTypeString := 'checkbox'; 276 itText: InputTypeString := 'text'; 277 itFileSelect: InputTypeString := 'file'; 278 itSubmit: InputTypeString := 'submit'; 279 itHidden: InputTypeString := 'hidden'; 280 itPassword: InputTypeString := 'password'; 281 end; 282 Attributes.Add('type', InputTypeString); 283 Attributes.Add('value', Value); 284 Attributes.Add('name', Name); 285 end; 286 end; 287 288 constructor THtmlInput.Create; 289 begin 290 291 end; 292 293 destructor THtmlInput.Destroy; 294 begin 295 inherited Destroy; 296 end; 297 298 { THtmlForm } 299 300 function THtmlForm.GetAsXmlElement: TXmlElement; 301 begin 302 Result := TXmlTag.Create; 303 with TXmlTag(Result) do begin 304 Name := 'form'; 305 Attributes.Add('action', Action.AsString); 306 Attributes.Add('method', Method); 307 end; 308 end; 309 310 constructor THtmlForm.Create; 311 begin 312 inherited; 313 Action := TURL.Create; 314 BlockType := btBlockLevel; 315 Method := 'get'; 316 end; 317 318 destructor THtmlForm.Destroy; 319 begin 320 Action.Free; 321 inherited Destroy; 213 322 end; 214 323 … … 294 403 constructor THtmlBlock.Create; 295 404 begin 405 inherited; 296 406 SubItems := TListObject.Create; 297 407 end; … … 323 433 function THtmlElement.GetAsXmlElement: TXmlElement; 324 434 begin 325 435 Result := TXmlTag.Create; 436 with TXmlTag(Result).Attributes do begin 437 if Name <> '' then Add('name', Name); 438 if Style <> '' then Add('style', Style); 439 if ClassId <> '' then Add('class', ClassId); 440 if Id <> '' then Add('id', Id); 441 end; 326 442 end; 327 443 … … 472 588 StrArray.Explode(Value, '.', StrToStr); 473 589 SetLength(Levels, StrArray.Count); 474 for I := 0 to StrArray.Count do475 Levels[StrArray.Count - I] := StrArray[I];590 for I := 0 to StrArray.Count - 1 do 591 Levels[StrArray.Count - 1 - I] := StrArray[I]; 476 592 finally 477 593 StrArray.Free;
Note:
See TracChangeset
for help on using the changeset viewer.