- Timestamp:
- Dec 31, 2010, 9:59:19 PM (14 years ago)
- Location:
- Network/CoolWeb
- Files:
-
- 7 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; -
Network/CoolWeb/Common/UPool.pas
r94 r104 6 6 7 7 uses 8 Classes, SysUtils, syncobjs, Specialized ObjectList;8 Classes, SysUtils, syncobjs, SpecializedList; 9 9 10 10 type -
Network/CoolWeb/Common/UXmlClasses.pas
r94 r104 5 5 interface 6 6 7 uses Classes, SysUtils, StrUtils, SpecializedList, SpecializedObjectList,7 uses Classes, SysUtils, StrUtils, SpecializedList, 8 8 SpecializedDictionary; 9 9 -
Network/CoolWeb/CoolWeb.lpk
r94 r104 8 8 <SearchPaths> 9 9 <OtherUnitFiles Value="WebServer;Persistence;Network;Modules;Common"/> 10 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS) /"/>10 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 11 11 </SearchPaths> 12 12 <Other> … … 87 87 <Item1> 88 88 <PackageName Value="TemplateGenerics"/> 89 <MaxVersion Minor="3" Valid="True"/> 90 <MinVersion Minor="3" Valid="True"/> 89 91 </Item1> 90 92 <Item2> -
Network/CoolWeb/Persistence/USqlDatabase.pas
r94 r104 3 3 {$mode Delphi}{$H+} 4 4 5 // Upraveno: 28.10.20105 // Modified: 2010-12-24 6 6 7 7 interface 8 8 9 9 uses 10 SysUtils, Classes, Dialogs, mysql50, TypInfo, SpecializedObjectList,10 SysUtils, Classes, Dialogs, mysql50, TypInfo, 11 11 SpecializedDictionary, SpecializedList; 12 12 -
Network/CoolWeb/WebServer/UHTTPServer.pas
r94 r104 7 7 uses 8 8 Classes, SysUtils, UTCPServer, UCommon, UMemoryStreamEx, UMIMEType, 9 Synautil, Specialized ObjectList, SpecializedList;9 Synautil, SpecializedList; 10 10 11 11 type … … 113 113 SEmptyHTTPHandler = 'No handler defined for HTTP server.'; 114 114 SFileNotFound = 'File %s not found.'; 115 SPageNotFound = 'Page %s not found.'; 115 116 116 117 implementation … … 163 164 begin 164 165 with HandlerData, Response.Stream do begin 165 WriteString('<html><body> Page ' + Request.Path + ' not found.</body></html>');166 WriteString('<html><body>' + Format(SPageNotFound, [Request.Path]) + '</body></html>'); 166 167 end; 167 168 end; … … 194 195 with Response.Stream do begin 195 196 WriteLn(Format(SFileNotFound, [Request.Path])); 196 WriteString('<html><body> File ' + Request.Path + ' not found.</body></html>');197 WriteString('<html><body>' + Format(SFileNotFound, [Request.Path]) + '</body></html>'); 197 198 end; 198 199 end; … … 386 387 WriteLn(hstdout^, 'Content-type: text/html'); 387 388 WriteLn(hstdout^); 388 Writeln(hstdout^, 'An unhandled exception occurred at $', HexStr(PtrUInt(Addr), SizeOf(PtrUInt) * 2), ' : ');389 Writeln(hstdout^, 'An unhandled exception occurred at $', HexStr(PtrUInt(Addr), SizeOf(PtrUInt) * 2), ' :<br/>'); 389 390 if Obj is exception then 390 391 begin 391 392 Message := Exception(Obj).ClassName + ' : ' + Exception(Obj).Message; 392 Writeln(hstdout^, Message );393 Writeln(hstdout^, Message + '<br/>'); 393 394 end 394 395 else 395 Writeln(hstdout^, 'Exception object ', Obj.ClassName, ' is not of class Exception. ');396 Writeln(hstdout^, BackTraceStrFunc(Addr) );396 Writeln(hstdout^, 'Exception object ', Obj.ClassName, ' is not of class Exception.<br/>'); 397 Writeln(hstdout^, BackTraceStrFunc(Addr) + '<br/>'); 397 398 if (FrameCount > 0) then 398 399 begin 399 400 for i := 0 to FrameCount - 1 do 400 401 if I < Length(TArrayOfPointer(Frames)) then 401 Writeln(hstdout^, BackTraceStrFunc(TArrayOfPointer(Frames)[i]) );402 end; 403 Writeln(hstdout^, '');402 Writeln(hstdout^, BackTraceStrFunc(TArrayOfPointer(Frames)[i]) + '<br/>'); 403 end; 404 Writeln(hstdout^, ''); 404 405 end; 405 406 … … 433 434 Writeln(hstderr^, BackTraceStrFunc(TArrayOfPointer(Frames)[i])); 434 435 end; 435 Writeln(hstderr^, '');436 Writeln(hstderr^, ''); 436 437 end; 437 438 -
Network/CoolWeb/WebServer/UHTTPServerCGI.pas
r94 r104 22 22 23 23 implementation 24 25 resourcestring 26 SEnvironmentVariables = 'Environment variables:'; 24 27 25 28 { THTTPServerCGI } … … 107 110 inherited; 108 111 with HandlerData, Response.Stream do begin 109 WriteString('<h5> Environment variables:</h5>');112 WriteString('<h5>' + SEnvironmentVariables + '</h5>'); 110 113 WriteString('<table border="1">'); 111 114 for I := 0 to EnvVars.Count - 1 do begin
Note:
See TracChangeset
for help on using the changeset viewer.