Changeset 24
- Timestamp:
- Sep 8, 2010, 4:17:21 PM (14 years ago)
- Location:
- branches/lazarus
- Files:
-
- 40 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/lazarus/Common/UHtmlClasses.pas
r23 r24 6 6 7 7 uses 8 UXmlClasses, Classes, SysUtils ;8 UXmlClasses, Classes, SysUtils, Contnrs, UStringListEx; 9 9 10 10 type 11 TStringArray = array of string;12 13 11 TDomainAddress = class(TPersistent) 14 12 private … … 97 95 public 98 96 BlockType: TBlockType; 99 SubItems: T List; // of THtmlElement;97 SubItems: TObjectList; // of THtmlElement; 100 98 constructor Create; 101 99 destructor Destroy; override; … … 113 111 114 112 TSizeUnits = (suPixels, suPercents); 113 115 114 THtmlSize = record 116 115 Width: Integer; … … 130 129 end; 131 130 132 THtml Page= class131 THtmlDocument = class 133 132 private 134 133 function GetAsXmlDocument: TXmlDocument; 135 134 public 136 135 Title: string; 137 Charset: string; 136 ContentEncoding: string; 137 ContentLanguage: string; 138 138 Body: THtmlBlock; 139 Styles: TStringList; 140 Scripts: TStringList; 139 141 property AsXmlDocument: TXmlDocument read GetAsXmlDocument; 140 142 constructor Create; … … 142 144 end; 143 145 144 function Explode(Separator: Char; Source: string): TStringArray;145 146 146 implementation 147 148 function Explode(Separator: Char; Source: string): TStringArray;149 begin150 SetLength(Result, 0);151 while Pos(Separator, Source) > 0 do begin152 SetLength(Result, Length(Result) + 1);153 Result[High(Result)] := Copy(Source, 1, Pos(Separator, Source) - 1);154 Delete(Source, 1, Length(Result[High(Result)]) + 1);155 end;156 SetLength(Result, Length(Result) + 1);157 Result[High(Result)] := Source;158 end;159 147 160 148 function LeftCutString(var Source, Output: string; Delimiter: string; Allowed: string = ''): Boolean; … … 210 198 end; 211 199 212 { THtml Page}213 214 constructor THtml Page.Create;200 { THtmlDocument } 201 202 constructor THtmlDocument.Create; 215 203 begin 216 204 Body := THtmlBlock.Create; 217 end; 218 219 destructor THtmlPage.Destroy; 205 Styles := TStringList.Create; 206 Scripts := TStringList.Create; 207 ContentLanguage := 'en'; 208 ContentEncoding := 'utf-8'; 209 end; 210 211 destructor THtmlDocument.Destroy; 220 212 begin 221 213 Body.Free; 214 Styles.Free; 215 Scripts.Free; 222 216 inherited; 223 217 end; 224 218 225 function THtmlPage.GetAsXmlDocument: TXmlDocument; 219 function THtmlDocument.GetAsXmlDocument: TXmlDocument; 220 var 221 DocType: TXMLTag; 222 HTMLTag: TXMLTag; 223 I: Integer; 226 224 begin 227 225 Result := TXmlDocument.Create; 228 226 with Result, Content do begin 229 227 Formated := True; 230 TagName := 'html'; 231 with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin 232 TagName := 'head'; 228 DocType := TXMlTag.Create; 229 DocType.Name := '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"'; 230 Doctype.EndTagSymbol := ''; 231 SubElements.Add(DocType); 232 HTMLTag := TXMLTag.Create; 233 with HTMLTag do begin 234 Name := 'html'; 233 235 with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin 234 TagName := 'title'; 235 with TXmlString(SubElements[SubElements.Add(TXmlString.Create)]) do begin 236 Text := Title; 236 Name := 'head'; 237 with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin 238 Name := 'title'; 239 with TXmlString(SubElements[SubElements.Add(TXmlString.Create)]) do begin 240 Text := Title; 241 end; 242 end; 243 with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin 244 Name := 'meta'; 245 Attributes.AddNameValue('http-equiv', 'Content-Language'); 246 Attributes.AddNameValue('content', ContentLanguage); 247 end; 248 with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin 249 Name := 'meta'; 250 Attributes.AddNameValue('http-equiv', 'Content-Type'); 251 Attributes.AddNameValue('content', 'text/html; charset=' + ContentEncoding); 252 end; 253 for I := 0 to Styles.Count - 1 do 254 with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin 255 Name := 'link'; 256 Attributes.AddNameValue('rel', 'stylesheet'); 257 Attributes.AddNameValue('href', Styles[I]); 258 Attributes.AddNameValue('type', 'text/css'); 259 Attributes.AddNameValue('media', 'all'); 260 end; 261 for I := 0 to Scripts.Count - 1 do 262 with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin 263 Name := 'script'; 264 ShringEmpty := False; 265 Attributes.AddNameValue('type', 'text/javascript'); 266 Attributes.AddNameValue('src', Scripts[I]); 237 267 end; 238 268 end; 239 269 with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin 240 TagName := 'meta'; 241 Attributes.AddNameValue('http-equiv', 'Content-Language'); 242 Attributes.AddNameValue('content', 'cs'); 243 end; 244 with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin 245 TagName := 'meta'; 246 Attributes.AddNameValue('http-equiv', 'Content-Type'); 247 Attributes.AddNameValue('content', 'text/html; charset=' + Charset); 270 Name := 'body'; 271 SubElements.Add(Body.AsXmlElement); 248 272 end; 249 273 end; 250 with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin 251 TagName := 'body'; 252 SubElements.Add(Body.AsXmlElement); 253 254 255 end; 274 SubElements.Add(HTMLTag); 256 275 end; 257 276 end; … … 261 280 constructor THtmlBlock.Create; 262 281 begin 263 SubItems := T List.Create;282 SubItems := TObjectList.Create; 264 283 end; 265 284 266 285 destructor THtmlBlock.Destroy; 267 var 268 I: Integer; 269 begin 270 for I := 0 to SubItems.Count - 1 do THtmlElement(SubItems[I]).Free; 286 begin 271 287 SubItems.Free; 272 288 inherited; … … 280 296 with TXmlTag(Result) do begin 281 297 case BlockType of 282 btBlockLevel: TagName := 'div';283 btInline: TagName := 'span';284 btNoTag: TagName := '';298 btBlockLevel: Name := 'div'; 299 btInline: Name := 'span'; 300 btNoTag: Name := ''; 285 301 end; 286 302 for I := 0 to SubItems.Count - 1 do … … 351 367 procedure TIpAddress.SetAsString(const Value: string); 352 368 var 353 Parts: TStringArray; 354 begin 355 Parts := Explode('.', Value); 369 Parts: TStringListEx; 370 begin 356 371 try 372 Parts := TStringListEx.Create; 373 Parts.Explode('.', Value); 374 try 357 375 // if Length(Parts) = 4 then begin 358 Octets[0] := StrToInt(Parts[3]);359 Octets[1] := StrToInt(Parts[2]);360 Octets[2] := StrToInt(Parts[1]);361 Octets[3] := StrToInt(Parts[0]);376 Octets[0] := StrToInt(Parts[3]); 377 Octets[1] := StrToInt(Parts[2]); 378 Octets[2] := StrToInt(Parts[1]); 379 Octets[3] := StrToInt(Parts[0]); 362 380 // end else raise EConvertError.Create('String to IP address conversion error'); 363 except 364 raise EConvertError.Create('String to IP address conversion error'); 381 except 382 raise EConvertError.Create('String to IP address conversion error'); 383 end; 384 finally 385 Parts.Free; 365 386 end; 366 387 end; … … 430 451 procedure TDomainAddress.SetAsString(const Value: string); 431 452 var 432 StrArray: TString Array;453 StrArray: TStringListEx; 433 454 I: Integer; 434 455 begin 435 StrArray := Explode('.', Value); 436 SetLength(Levels, Length(StrArray)); 437 for I := 0 to High(StrArray) do Levels[High(StrArray) - I] := StrArray[I]; 456 try 457 StrArray := TStringListEx.Create; 458 StrArray.Explode('.', Value); 459 SetLength(Levels, StrArray.Count); 460 for I := 0 to StrArray.Count do 461 Levels[StrArray.Count - I] := StrArray[I]; 462 finally 463 StrArray.Free; 464 end; 438 465 end; 439 466 … … 455 482 Result := TXmlTag.Create; 456 483 with TXmlTag(Result) do begin 457 TagName := 'a';484 Name := 'a'; 458 485 Attributes.Add('href='+Target.AsString); 459 486 if Assigned(Content) then SubElements.Add(Content.AsXmlElement); … … 522 549 Result := TXmlTag.Create; 523 550 with TXmlTag(Result) do begin 524 TagName := 'img';551 Name := 'img'; 525 552 Attributes.AddNameValue('src', Source.AsString); 526 553 Attributes.AddNameValue('width', IntToStr(Size.Width)); -
branches/lazarus/Common/UXmlClasses.pas
r23 r24 5 5 interface 6 6 7 uses Classes, SysUtils, Contnrs, StrUtils ;7 uses Classes, SysUtils, Contnrs, StrUtils, UStringListEx; 8 8 9 9 type 10 TStringListEx = class(TStringList)11 public12 procedure AddNameValue(Name, Value: string);13 end;14 15 10 TXmlElement = class 16 11 private … … 31 26 function GetAsString: string; override; 32 27 public 33 EndTagSymbol: Char; 34 TagName: string; 28 EndTagSymbol: string; 29 ShringEmpty: Boolean; 30 Name: string; 35 31 Attributes: TStringListEx; 36 SubElements: T List; // of TXmlElement;32 SubElements: TObjectList; // of TXmlElement; 37 33 constructor Create; 38 34 destructor Destroy; override; … … 41 37 TXmlDocument = class 42 38 private 39 MainTag: TXmlTag; 43 40 function FormatStructure(Text: string): string; 44 41 function GetAsString: string; 45 42 public 46 43 Formated: Boolean; 47 MainTag: TXmlTag;48 44 Content: TXmlTag; 49 45 XmlVersion: string; … … 60 56 constructor TXmlTag.Create; 61 57 begin 58 ShringEmpty := True; 62 59 Attributes := TStringListEx.Create; 63 60 Attributes.NameValueSeparator := '='; 64 SubElements := T List.Create;61 SubElements := TObjectList.Create; 65 62 EndTagSymbol := '/'; 66 63 end; 67 64 68 65 destructor TXmlTag.Destroy; 69 var70 I: Integer;71 66 begin 72 67 Attributes.Free; 73 for I := 0 to SubElements.Count - 1 do TXmlElement(SubElements[I]).Free;74 68 SubElements.Free; 75 69 inherited; … … 90 84 AttributesText := AttributesText + ' ' + Attributes.Names[I] + '="' + Attributes.ValueFromIndex[I] + '"'; 91 85 92 if TagName <> '' then begin93 if Content <> ''then94 Result := '<' + TagName + AttributesText + '>' + Content + '<' + EndTagSymbol + TagName + '>'95 else Result := '<' + TagName + AttributesText + EndTagSymbol + '>';86 if Name <> '' then begin 87 if (Content <> '') or not ShringEmpty then 88 Result := '<' + Name + AttributesText + '>' + Content + '<' + EndTagSymbol + Name + '>' 89 else Result := '<' + Name + AttributesText + EndTagSymbol + '>'; 96 90 end else Result := Content; 97 91 end; … … 116 110 begin 117 111 inherited; 118 Encoding := ' windows-1250';112 Encoding := 'utf-8'; 119 113 XmlVersion := '1.0'; 120 114 MainTag := TXmlTag.Create; 121 115 with MainTag do begin 122 TagName := '?xml';116 Name := '?xml'; 123 117 EndTagSymbol := '?'; 124 Attributes.Add ('version=1.0');125 Attributes.Add ('encoding=windows-1250');118 Attributes.AddNameValue('version', '1.0'); 119 Attributes.AddNameValue('encoding', 'utf-8'); 126 120 end; 127 121 Content := TXmlTag.Create; … … 172 166 function TXmlDocument.GetAsString: string; 173 167 begin 174 Result := MainTag.AsString + 175 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' 176 + Content.AsString; 168 Result := MainTag.AsString + Content.AsString; 177 169 if Formated then Result := FormatStructure(Result); 178 170 end; 179 171 180 { TStringListEx }181 182 procedure TStringListEx.AddNameValue(Name, Value: string);183 begin184 Add(Name + NameValueSeparator + Value);185 end;186 187 172 end. -
branches/lazarus/UCore.pas
r23 r24 6 6 7 7 uses 8 USqlDatabase ;8 USqlDatabase, Classes, SysUtils, StrUtils; 9 9 10 10 type … … 12 12 TPageProducer = function: string; 13 13 14 function MakeLink(Text, URL: string): string; 15 function NavigationMakeLink(Module, Page: string): string; 14 16 function InsertIcon(FileName: string): string; 17 function IconedLink(Link, Text: string): string; 15 18 function HtmlLink(Text, Target: string): string; 16 19 function ShowHeader(Title, Path: string): string; … … 18 21 function Explode(Separator: Char; Data: string): TArrayOfString; 19 22 function HumanDate(Date: string): string; 20 procedure RegisterPage(Name: string; Producer: TPageProducer);21 23 function PagesList(URL: string; Page, TotalCount, CountPerPage: Integer): string; 22 24 function StrRepeat(Data: string; Count: Integer): string; 23 24 type25 TRegistredPage = record26 Name: string;27 Producer: TPageProducer;28 end;29 30 var31 Pages: array of TRegistredPage;32 Database: TSqlDatabase;33 25 34 26 implementation 35 27 36 28 uses 37 SysUtils, UConfig; 38 39 procedure RegisterPage(Name: string; Producer: TPageProducer); 40 begin 41 SetLength(Pages, Length(Pages) + 1); 42 Pages[High(Pages)].Name := Name; 43 Pages[High(Pages)].Producer := Producer; 44 end; 29 UConfig; 45 30 46 31 function HtmlLink(Text, Target: string): string; … … 110 95 end; 111 96 112 procedure Init; 113 var 114 DbRows: TDbRows; 97 function LastPos(const SubStr: String; const S: String): Integer; 115 98 begin 116 Database := TSqlDatabase.Create; 117 with Database do begin 118 Hostname := DatabaseHostName; 119 Database := DatabaseDatabase; 120 UserName := DatabaseUserName; 121 Password := DatabasePassword; 122 Connect; 123 end; 124 DbRows := Database.Query('SET NAMES utf8'); 125 DbRows.Free; 99 Result := Pos(ReverseString(SubStr), ReverseString(S)); 100 101 if (Result <> 0) then 102 Result := ((Length(S) - Length(SubStr)) + 1) - Result + 1; 126 103 end; 127 104 128 procedure Done; 105 function IconedLink(Link, Text: string): string; 106 var 107 Extension: string; 108 Icon: string; 129 109 begin 130 Database.Free; 110 Extension := Copy(Link, LastPos(Link, '.') + 1, Length(Link)); 111 Icon := '<img src="images/icons/' + Extension + '.gif" alt="' + Extension + '"> '; 112 Result := Icon + '<a href="' + Link + '">' + Text + '</a>'; 113 end; 114 115 function MakeLink(Text, URL: string): string; 116 begin 117 Result := '<a href="' + URL + '">' + Text + '</a>'; 118 end; 119 120 function NavigationMakeLink(Module, Page: string): string; 121 begin 122 Result := '?m=' + Module + '&p=' + Page; 131 123 end; 132 124 … … 179 171 initialization 180 172 181 Init;182 183 173 finalization 184 174 185 Done;186 175 end. -
branches/lazarus/index.lpi
r23 r24 28 28 </local> 29 29 </RunParams> 30 <Units Count="4 6">30 <Units Count="49"> 31 31 <Unit0> 32 32 <Filename Value="index.pas"/> 33 33 <IsPartOfProject Value="True"/> 34 34 <UnitName Value="index"/> 35 <IsVisibleTab Value="True"/>36 35 <EditorIndex Value="0"/> 37 36 <WindowIndex Value="0"/> 38 37 <TopLine Value="1"/> 39 <CursorPos X=" 20" Y="7"/>40 <UsageCount Value="1 45"/>38 <CursorPos X="50" Y="18"/> 39 <UsageCount Value="155"/> 41 40 <Loaded Value="True"/> 42 41 <LoadedDesigner Value="True"/> … … 47 46 <IsPartOfProject Value="True"/> 48 47 <UnitName Value="UMainPage"/> 49 <WindowIndex Value="0"/> 50 <TopLine Value="68"/> 51 <CursorPos X="1" Y="89"/> 52 <UsageCount Value="145"/> 48 <EditorIndex Value="10"/> 49 <WindowIndex Value="0"/> 50 <TopLine Value="224"/> 51 <CursorPos X="20" Y="238"/> 52 <UsageCount Value="151"/> 53 <Loaded Value="True"/> 53 54 <DefaultSyntaxHighlighter Value="Delphi"/> 54 55 </Unit1> … … 59 60 <TopLine Value="291"/> 60 61 <CursorPos X="1" Y="311"/> 61 <UsageCount Value="14 5"/>62 <UsageCount Value="144"/> 62 63 <DefaultSyntaxHighlighter Value="Delphi"/> 63 64 </Unit2> 64 65 <Unit3> 65 66 <Filename Value="UXmlClasses.pas"/> 66 <UsageCount Value="14 5"/>67 <UsageCount Value="144"/> 67 68 <DefaultSyntaxHighlighter Value="Delphi"/> 68 69 </Unit3> 69 70 <Unit4> 70 71 <Filename Value="UCore.pas"/> 72 <IsPartOfProject Value="True"/> 71 73 <UnitName Value="UCore"/> 72 <EditorIndex Value=" 9"/>73 <WindowIndex Value="0"/> 74 <TopLine Value="1 0"/>75 <CursorPos X="1" Y=" 23"/>76 <UsageCount Value="1 45"/>74 <EditorIndex Value="16"/> 75 <WindowIndex Value="0"/> 76 <TopLine Value="1"/> 77 <CursorPos X="1" Y="16"/> 78 <UsageCount Value="155"/> 77 79 <Loaded Value="True"/> 78 80 <DefaultSyntaxHighlighter Value="Delphi"/> … … 84 86 <TopLine Value="217"/> 85 87 <CursorPos X="5" Y="236"/> 86 <UsageCount Value="14 5"/>88 <UsageCount Value="144"/> 87 89 <DefaultSyntaxHighlighter Value="Delphi"/> 88 90 </Unit5> 89 91 <Unit6> 90 92 <Filename Value="Pages/UFinancePage.pas"/> 91 <IsPartOfProject Value="True"/>92 93 <UnitName Value="UFinancePage"/> 93 94 <WindowIndex Value="0"/> 94 95 <TopLine Value="10"/> 95 96 <CursorPos X="27" Y="19"/> 96 <UsageCount Value="14 5"/>97 <UsageCount Value="144"/> 97 98 <DefaultSyntaxHighlighter Value="Delphi"/> 98 99 </Unit6> … … 102 103 <TopLine Value="17"/> 103 104 <CursorPos X="34" Y="30"/> 104 <UsageCount Value="14 5"/>105 <UsageCount Value="144"/> 105 106 <DefaultSyntaxHighlighter Value="Delphi"/> 106 107 </Unit7> … … 111 112 <TopLine Value="204"/> 112 113 <CursorPos X="25" Y="226"/> 113 <UsageCount Value="14 5"/>114 <UsageCount Value="144"/> 114 115 <DefaultSyntaxHighlighter Value="Delphi"/> 115 116 </Unit8> 116 117 <Unit9> 117 118 <Filename Value="Pages/UNewsPage.pas"/> 118 <IsPartOfProject Value="True"/>119 119 <UnitName Value="UNewsPage"/> 120 120 <WindowIndex Value="0"/> 121 121 <TopLine Value="102"/> 122 122 <CursorPos X="25" Y="107"/> 123 <UsageCount Value="14 5"/>123 <UsageCount Value="144"/> 124 124 <DefaultSyntaxHighlighter Value="Delphi"/> 125 125 </Unit9> … … 129 129 <TopLine Value="2320"/> 130 130 <CursorPos X="30" Y="2342"/> 131 <UsageCount Value="1 4"/>131 <UsageCount Value="13"/> 132 132 <DefaultSyntaxHighlighter Value="Delphi"/> 133 133 </Unit10> … … 138 138 <TopLine Value="40"/> 139 139 <CursorPos X="9" Y="59"/> 140 <UsageCount Value="13 3"/>140 <UsageCount Value="132"/> 141 141 <DefaultSyntaxHighlighter Value="Delphi"/> 142 142 </Unit11> 143 143 <Unit12> 144 144 <Filename Value="/usr/share/fpcsrc/rtl/objpas/sysutils/datih.inc"/> 145 <TopLine Value="115"/> 146 <CursorPos X="10" Y="117"/> 147 <UsageCount Value="1"/> 145 <EditorIndex Value="15"/> 146 <WindowIndex Value="0"/> 147 <TopLine Value="105"/> 148 <CursorPos X="10" Y="119"/> 149 <UsageCount Value="14"/> 150 <Loaded Value="True"/> 148 151 <DefaultSyntaxHighlighter Value="Delphi"/> 149 152 </Unit12> … … 152 155 <TopLine Value="34"/> 153 156 <CursorPos X="3" Y="624"/> 154 <UsageCount Value=" 1"/>157 <UsageCount Value="0"/> 155 158 <DefaultSyntaxHighlighter Value="Delphi"/> 156 159 </Unit13> … … 159 162 <IsPartOfProject Value="True"/> 160 163 <UnitName Value="UConfig"/> 161 <EditorIndex Value=" 8"/>164 <EditorIndex Value="7"/> 162 165 <WindowIndex Value="0"/> 163 166 <TopLine Value="1"/> 164 167 <CursorPos X="88" Y="11"/> 165 <UsageCount Value="1 20"/>168 <UsageCount Value="130"/> 166 169 <Loaded Value="True"/> 167 170 <DefaultSyntaxHighlighter Value="Delphi"/> … … 172 175 <TopLine Value="108"/> 173 176 <CursorPos X="1" Y="134"/> 174 <UsageCount Value="1 20"/>177 <UsageCount Value="130"/> 175 178 <DefaultSyntaxHighlighter Value="None"/> 176 179 </Unit15> … … 180 183 <TopLine Value="1"/> 181 184 <CursorPos X="1" Y="1"/> 182 <UsageCount Value="1 20"/>185 <UsageCount Value="130"/> 183 186 <DefaultSyntaxHighlighter Value="JScript"/> 184 187 </Unit16> … … 189 192 <TopLine Value="608"/> 190 193 <CursorPos X="44" Y="627"/> 191 <UsageCount Value="11 4"/>194 <UsageCount Value="113"/> 192 195 <DefaultSyntaxHighlighter Value="Delphi"/> 193 196 </Unit17> … … 198 201 <TopLine Value="39"/> 199 202 <CursorPos X="25" Y="58"/> 200 <UsageCount Value="11 4"/>203 <UsageCount Value="113"/> 201 204 <DefaultSyntaxHighlighter Value="Delphi"/> 202 205 </Unit18> 203 206 <Unit19> 204 207 <Filename Value="Pages/UUserPage.pas"/> 205 <IsPartOfProject Value="True"/>206 208 <UnitName Value="UUserPage"/> 207 209 <WindowIndex Value="0"/> 208 210 <TopLine Value="1"/> 209 211 <CursorPos X="69" Y="19"/> 210 <UsageCount Value="1 10"/>212 <UsageCount Value="109"/> 211 213 <DefaultSyntaxHighlighter Value="Delphi"/> 212 214 </Unit19> … … 217 219 <TopLine Value="1"/> 218 220 <CursorPos X="52" Y="124"/> 219 <UsageCount Value="10 7"/>221 <UsageCount Value="106"/> 220 222 <DefaultSyntaxHighlighter Value="Delphi"/> 221 223 </Unit20> … … 225 227 <TopLine Value="1"/> 226 228 <CursorPos X="19" Y="4"/> 227 <UsageCount Value=" 5"/>229 <UsageCount Value="4"/> 228 230 <DefaultSyntaxHighlighter Value="Delphi"/> 229 231 </Unit21> … … 231 233 <Filename Value="../../../../other/powtils/release/1.7.1/main/dynpwu.pas"/> 232 234 <UnitName Value="dynpwu"/> 233 <EditorIndex Value="10"/> 234 <WindowIndex Value="0"/> 235 <TopLine Value="19"/> 235 <WindowIndex Value="0"/> 236 <TopLine Value="29"/> 236 237 <CursorPos X="2" Y="38"/> 237 <UsageCount Value="35"/> 238 <Loaded Value="True"/> 238 <UsageCount Value="34"/> 239 239 <DefaultSyntaxHighlighter Value="Delphi"/> 240 240 </Unit22> … … 242 242 <Filename Value="../../../../other/powtils/release/1.7.1/main/pwbuffer.pas"/> 243 243 <UnitName Value="pwbuffer"/> 244 <EditorIndex Value="11"/> 245 <WindowIndex Value="0"/> 246 <TopLine Value="67"/> 244 <WindowIndex Value="0"/> 245 <TopLine Value="62"/> 247 246 <CursorPos X="6" Y="62"/> 248 <UsageCount Value="12"/> 249 <Loaded Value="True"/> 247 <UsageCount Value="11"/> 250 248 <DefaultSyntaxHighlighter Value="Delphi"/> 251 249 </Unit23> … … 253 251 <Filename Value="../../../../other/powtils/release/1.7.1/main/pwbase64enc.pas"/> 254 252 <UnitName Value="pwbase64enc"/> 255 <EditorIndex Value="14"/> 256 <WindowIndex Value="0"/> 257 <TopLine Value="53"/> 253 <WindowIndex Value="0"/> 254 <TopLine Value="125"/> 258 255 <CursorPos X="9" Y="141"/> 259 <UsageCount Value="12"/> 260 <Loaded Value="True"/> 256 <UsageCount Value="11"/> 261 257 <DefaultSyntaxHighlighter Value="Delphi"/> 262 258 </Unit24> … … 264 260 <Filename Value="../../../../other/powtils/release/1.7.1/main/pwdirutil_test.pas"/> 265 261 <UnitName Value="pwdirutil_test"/> 266 <EditorIndex Value="12"/>267 262 <WindowIndex Value="0"/> 268 263 <TopLine Value="1"/> 269 264 <CursorPos X="1" Y="1"/> 270 <UsageCount Value="12"/> 271 <Loaded Value="True"/> 265 <UsageCount Value="11"/> 272 266 <DefaultSyntaxHighlighter Value="Delphi"/> 273 267 </Unit25> … … 275 269 <Filename Value="../../../../other/powtils/release/1.7.1/main/pwdefaultcfg.pas"/> 276 270 <UnitName Value="pwdefaultcfg"/> 277 <EditorIndex Value="13"/> 278 <WindowIndex Value="0"/> 279 <TopLine Value="92"/> 271 <WindowIndex Value="0"/> 272 <TopLine Value="103"/> 280 273 <CursorPos X="29" Y="112"/> 281 <UsageCount Value="12"/> 282 <Loaded Value="True"/> 274 <UsageCount Value="11"/> 283 275 <DefaultSyntaxHighlighter Value="Delphi"/> 284 276 </Unit26> … … 286 278 <Filename Value="../../../../other/powtils/release/1.7.1/main/pwhtmtils.pas"/> 287 279 <UnitName Value="pwHTMtils"/> 288 <EditorIndex Value="15"/>289 280 <WindowIndex Value="0"/> 290 281 <TopLine Value="1"/> 291 282 <CursorPos X="12" Y="10"/> 292 <UsageCount Value="12"/> 293 <Loaded Value="True"/> 283 <UsageCount Value="11"/> 294 284 <DefaultSyntaxHighlighter Value="Delphi"/> 295 285 </Unit27> … … 300 290 <TopLine Value="1"/> 301 291 <CursorPos X="8" Y="1"/> 302 <UsageCount Value=" 10"/>292 <UsageCount Value="9"/> 303 293 <DefaultSyntaxHighlighter Value="Delphi"/> 304 294 </Unit28> … … 306 296 <Filename Value="../../../../other/powtils/release/1.7.1/main/pwhtmw.pas"/> 307 297 <UnitName Value="pwHTMw"/> 308 <EditorIndex Value="16"/>309 298 <WindowIndex Value="0"/> 310 299 <TopLine Value="1803"/> 311 300 <CursorPos X="39" Y="1806"/> 312 <UsageCount Value="12"/> 313 <Loaded Value="True"/> 301 <UsageCount Value="11"/> 314 302 <DefaultSyntaxHighlighter Value="Delphi"/> 315 303 </Unit29> … … 320 308 <TopLine Value="173"/> 321 309 <CursorPos X="10" Y="192"/> 322 <UsageCount Value=" 10"/>310 <UsageCount Value="9"/> 323 311 <DefaultSyntaxHighlighter Value="Delphi"/> 324 312 </Unit30> … … 326 314 <Filename Value="../../../../other/powtils/release/1.7.1/main/pwmailprep.pas"/> 327 315 <UnitName Value="pwmailprep"/> 328 <EditorIndex Value="7"/>329 316 <WindowIndex Value="0"/> 330 317 <TopLine Value="31"/> 331 318 <CursorPos X="3" Y="49"/> 332 <UsageCount Value="12"/> 333 <Loaded Value="True"/> 319 <UsageCount Value="11"/> 334 320 <DefaultSyntaxHighlighter Value="Delphi"/> 335 321 </Unit31> … … 340 326 <TopLine Value="2569"/> 341 327 <CursorPos X="27" Y="2594"/> 342 <UsageCount Value=" 10"/>328 <UsageCount Value="9"/> 343 329 <DefaultSyntaxHighlighter Value="Delphi"/> 344 330 </Unit32> … … 349 335 <TopLine Value="112"/> 350 336 <CursorPos X="23" Y="125"/> 351 <UsageCount Value="2 1"/>337 <UsageCount Value="20"/> 352 338 <DefaultSyntaxHighlighter Value="Delphi"/> 353 339 </Unit33> … … 358 344 <TopLine Value="1"/> 359 345 <CursorPos X="1" Y="1"/> 360 <UsageCount Value="2 1"/>346 <UsageCount Value="20"/> 361 347 <DefaultSyntaxHighlighter Value="Delphi"/> 362 348 </Unit34> … … 365 351 <EditorIndex Value="6"/> 366 352 <WindowIndex Value="0"/> 367 <TopLine Value=" 562"/>368 <CursorPos X="1 4" Y="579"/>369 <UsageCount Value="1 0"/>353 <TopLine Value="254"/> 354 <CursorPos X="15" Y="268"/> 355 <UsageCount Value="15"/> 370 356 <Loaded Value="True"/> 371 357 <DefaultSyntaxHighlighter Value="Delphi"/> … … 377 363 <TopLine Value="10"/> 378 364 <CursorPos X="22" Y="23"/> 379 <UsageCount Value="1 0"/>365 <UsageCount Value="15"/> 380 366 <Loaded Value="True"/> 381 367 <DefaultSyntaxHighlighter Value="Delphi"/> … … 388 374 <TopLine Value="1140"/> 389 375 <CursorPos X="26" Y="1143"/> 390 <UsageCount Value="1 0"/>376 <UsageCount Value="15"/> 391 377 <Loaded Value="True"/> 392 378 <DefaultSyntaxHighlighter Value="Delphi"/> … … 398 384 <TopLine Value="43"/> 399 385 <CursorPos X="5" Y="61"/> 400 <UsageCount Value="1 0"/>386 <UsageCount Value="15"/> 401 387 <Loaded Value="True"/> 402 388 <DefaultSyntaxHighlighter Value="Delphi"/> … … 408 394 <TopLine Value="50"/> 409 395 <CursorPos X="10" Y="63"/> 410 <UsageCount Value="1 0"/>396 <UsageCount Value="15"/> 411 397 <Loaded Value="True"/> 412 398 <DefaultSyntaxHighlighter Value="Delphi"/> … … 419 405 <WindowIndex Value="0"/> 420 406 <TopLine Value="22"/> 421 <CursorPos X=" 40" Y="41"/>422 <UsageCount Value=" 20"/>407 <CursorPos X="58" Y="29"/> 408 <UsageCount Value="30"/> 423 409 <Loaded Value="True"/> 424 410 <DefaultSyntaxHighlighter Value="Delphi"/> … … 427 413 <Filename Value="Common/UCGIApplication.pas"/> 428 414 <IsPartOfProject Value="True"/> 429 <UsageCount Value="20"/> 415 <UnitName Value="UCGIApplication"/> 416 <EditorIndex Value="9"/> 417 <WindowIndex Value="0"/> 418 <TopLine Value="1"/> 419 <CursorPos X="1" Y="1"/> 420 <UsageCount Value="30"/> 421 <Loaded Value="True"/> 430 422 <DefaultSyntaxHighlighter Value="Delphi"/> 431 423 </Unit41> … … 433 425 <Filename Value="Common/UDatabase.pas"/> 434 426 <IsPartOfProject Value="True"/> 435 <UsageCount Value=" 20"/>427 <UsageCount Value="30"/> 436 428 <DefaultSyntaxHighlighter Value="Delphi"/> 437 429 </Unit42> … … 439 431 <Filename Value="Common/UHtmlClasses.pas"/> 440 432 <IsPartOfProject Value="True"/> 441 <UsageCount Value="20"/> 433 <UnitName Value="UHtmlClasses"/> 434 <IsVisibleTab Value="True"/> 435 <EditorIndex Value="13"/> 436 <WindowIndex Value="0"/> 437 <TopLine Value="229"/> 438 <CursorPos X="76" Y="246"/> 439 <UsageCount Value="30"/> 440 <Loaded Value="True"/> 442 441 <DefaultSyntaxHighlighter Value="Delphi"/> 443 442 </Unit43> … … 445 444 <Filename Value="Common/USqlDatabase.pas"/> 446 445 <IsPartOfProject Value="True"/> 447 <UsageCount Value="20"/> 446 <UnitName Value="USqlDatabase"/> 447 <EditorIndex Value="11"/> 448 <WindowIndex Value="0"/> 449 <TopLine Value="1"/> 450 <CursorPos X="1" Y="1"/> 451 <UsageCount Value="30"/> 452 <Loaded Value="True"/> 448 453 <DefaultSyntaxHighlighter Value="Delphi"/> 449 454 </Unit44> … … 451 456 <Filename Value="Common/UXmlClasses.pas"/> 452 457 <IsPartOfProject Value="True"/> 453 <UsageCount Value="20"/> 458 <UnitName Value="UXmlClasses"/> 459 <EditorIndex Value="8"/> 460 <WindowIndex Value="0"/> 461 <TopLine Value="110"/> 462 <CursorPos X="1" Y="113"/> 463 <UsageCount Value="30"/> 464 <Loaded Value="True"/> 454 465 <DefaultSyntaxHighlighter Value="Delphi"/> 455 466 </Unit45> 467 <Unit46> 468 <Filename Value="Application/UCustomCGIApplication.pas"/> 469 <IsPartOfProject Value="True"/> 470 <UnitName Value="UCustomCGIApplication"/> 471 <EditorIndex Value="12"/> 472 <WindowIndex Value="0"/> 473 <TopLine Value="24"/> 474 <CursorPos X="5" Y="38"/> 475 <UsageCount Value="30"/> 476 <Loaded Value="True"/> 477 <DefaultSyntaxHighlighter Value="Delphi"/> 478 </Unit46> 479 <Unit47> 480 <Filename Value="/usr/share/fpcsrc/rtl/inc/varianth.inc"/> 481 <WindowIndex Value="0"/> 482 <TopLine Value="501"/> 483 <CursorPos X="10" Y="503"/> 484 <UsageCount Value="9"/> 485 <DefaultSyntaxHighlighter Value="Delphi"/> 486 </Unit47> 487 <Unit48> 488 <Filename Value="/usr/share/fpcsrc/rtl/inc/mathh.inc"/> 489 <EditorIndex Value="14"/> 490 <WindowIndex Value="0"/> 491 <TopLine Value="64"/> 492 <CursorPos X="14" Y="78"/> 493 <UsageCount Value="14"/> 494 <Loaded Value="True"/> 495 <DefaultSyntaxHighlighter Value="Delphi"/> 496 </Unit48> 456 497 </Units> 457 <JumpHistory Count=" 20" HistoryIndex="19">498 <JumpHistory Count="30" HistoryIndex="28"> 458 499 <Position1> 459 <Filename Value=" ../../../../other/powtils/release/1.7.1/main/pwhtmw.pas"/>460 <Caret Line=" 1" Column="1" TopLine="1"/>500 <Filename Value="Common/UHtmlClasses.pas"/> 501 <Caret Line="203" Column="24" TopLine="189"/> 461 502 </Position1> 462 503 <Position2> 463 <Filename Value=" ../../../../other/powtils/release/1.7.1/main/pwhtmw.pas"/>464 <Caret Line=" 63" Column="6" TopLine="43"/>504 <Filename Value="Common/UHtmlClasses.pas"/> 505 <Caret Line="217" Column="14" TopLine="204"/> 465 506 </Position2> 466 507 <Position3> 467 <Filename Value=" ../../../../other/powtils/release/1.7.1/main/pwhtmw.pas"/>468 <Caret Line=" 682" Column="1" TopLine="663"/>508 <Filename Value="Common/UHtmlClasses.pas"/> 509 <Caret Line="254" Column="13" TopLine="241"/> 469 510 </Position3> 470 511 <Position4> 471 <Filename Value=" ../../../../other/powtils/release/1.7.1/main/pwhtmw.pas"/>472 <Caret Line=" 63" Column="8" TopLine="44"/>512 <Filename Value="Application/UCustomCGIApplication.pas"/> 513 <Caret Line="174" Column="1" TopLine="162"/> 473 514 </Position4> 474 515 <Position5> 475 <Filename Value=" ../../../../other/powtils/release/1.7.1/main/pwhtmw.pas"/>476 <Caret Line=" 1399" Column="76" TopLine="1380"/>516 <Filename Value="Common/UHtmlClasses.pas"/> 517 <Caret Line="248" Column="28" TopLine="239"/> 477 518 </Position5> 478 519 <Position6> 479 <Filename Value=" ../../../../other/powtils/release/1.7.1/main/pwhtmw.pas"/>480 <Caret Line=" 73" Column="9" TopLine="45"/>520 <Filename Value="Common/UHtmlClasses.pas"/> 521 <Caret Line="247" Column="28" TopLine="239"/> 481 522 </Position6> 482 523 <Position7> 483 <Filename Value=" ../../../../other/powtils/release/1.7.1/main/pwhtmw.pas"/>484 <Caret Line=" 1399" Column="76" TopLine="1380"/>524 <Filename Value="Common/UHtmlClasses.pas"/> 525 <Caret Line="212" Column="16" TopLine="201"/> 485 526 </Position7> 486 527 <Position8> 487 <Filename Value=" ../../../../other/powtils/release/1.7.1/main/pwhtmw.pas"/>488 <Caret Line="1 837" Column="1" TopLine="1799"/>528 <Filename Value="Application/UCustomCGIApplication.pas"/> 529 <Caret Line="175" Column="14" TopLine="161"/> 489 530 </Position8> 490 531 <Position9> 491 <Filename Value=" ../../../../other/powtils/release/1.7.1/main/pwhtmw.pas"/>492 <Caret Line=" 75" Column="31" TopLine="61"/>532 <Filename Value="Common/UHtmlClasses.pas"/> 533 <Caret Line="259" Column="18" TopLine="247"/> 493 534 </Position9> 494 535 <Position10> 495 <Filename Value=" ../../../../other/powtils/release/1.7.1/main/pwhtmw.pas"/>496 <Caret Line=" 1399" Column="76" TopLine="1380"/>536 <Filename Value="Application/UCustomCGIApplication.pas"/> 537 <Caret Line="98" Column="86" TopLine="74"/> 497 538 </Position10> 498 539 <Position11> 499 <Filename Value=" ../../../../other/powtils/release/1.7.1/main/pwmailprep.pas"/>500 <Caret Line=" 1" Column="1" TopLine="1"/>540 <Filename Value="Common/UHtmlClasses.pas"/> 541 <Caret Line="261" Column="1" TopLine="247"/> 501 542 </Position11> 502 543 <Position12> 503 <Filename Value=" ../../../../other/powtils/release/1.7.1/main/pwmailprep.pas"/>504 <Caret Line=" 49" Column="3" TopLine="29"/>544 <Filename Value="Application/UCustomCGIApplication.pas"/> 545 <Caret Line="98" Column="79" TopLine="84"/> 505 546 </Position12> 506 547 <Position13> 507 <Filename Value=" index.pas"/>508 <Caret Line=" 14" Column="1" TopLine="1"/>548 <Filename Value="Common/UHtmlClasses.pas"/> 549 <Caret Line="428" Column="34" TopLine="414"/> 509 550 </Position13> 510 551 <Position14> 511 <Filename Value=" index.pas"/>512 <Caret Line=" 45" Column="9" TopLine="19"/>552 <Filename Value="Application/UCustomCGIApplication.pas"/> 553 <Caret Line="98" Column="81" TopLine="84"/> 513 554 </Position14> 514 555 <Position15> 515 <Filename Value=" index.pas"/>516 <Caret Line=" 28" Column="12" TopLine="10"/>556 <Filename Value="Application/UCustomCGIApplication.pas"/> 557 <Caret Line="33" Column="1" TopLine="30"/> 517 558 </Position15> 518 559 <Position16> 519 <Filename Value=" index.pas"/>520 <Caret Line=" 43" Column="18" TopLine="19"/>560 <Filename Value="Application/UCustomCGIApplication.pas"/> 561 <Caret Line="91" Column="39" TopLine="77"/> 521 562 </Position16> 522 563 <Position17> 523 <Filename Value=" index.pas"/>524 <Caret Line=" 28" Column="8" TopLine="19"/>564 <Filename Value="Pages/UMainPage.pas"/> 565 <Caret Line="171" Column="29" TopLine="157"/> 525 566 </Position17> 526 567 <Position18> 527 <Filename Value=" index.pas"/>528 <Caret Line=" 24" Column="1" TopLine="11"/>568 <Filename Value="Pages/UMainPage.pas"/> 569 <Caret Line="16" Column="7" TopLine="2"/> 529 570 </Position18> 530 571 <Position19> 531 <Filename Value=" UCore.pas"/>532 <Caret Line=" 179" Column="1" TopLine="28"/>572 <Filename Value="Pages/UMainPage.pas"/> 573 <Caret Line="62" Column="18" TopLine="48"/> 533 574 </Position19> 534 575 <Position20> 535 <Filename Value=" /usr/share/fpcsrc/rtl/unix/sysutils.pp"/>536 <Caret Line=" 1143" Column="26" TopLine="1140"/>576 <Filename Value="Pages/UMainPage.pas"/> 577 <Caret Line="82" Column="18" TopLine="68"/> 537 578 </Position20> 579 <Position21> 580 <Filename Value="Pages/UMainPage.pas"/> 581 <Caret Line="139" Column="18" TopLine="125"/> 582 </Position21> 583 <Position22> 584 <Filename Value="Pages/UMainPage.pas"/> 585 <Caret Line="169" Column="18" TopLine="155"/> 586 </Position22> 587 <Position23> 588 <Filename Value="Pages/UMainPage.pas"/> 589 <Caret Line="217" Column="18" TopLine="203"/> 590 </Position23> 591 <Position24> 592 <Filename Value="Pages/UMainPage.pas"/> 593 <Caret Line="238" Column="16" TopLine="224"/> 594 </Position24> 595 <Position25> 596 <Filename Value="Common/UHtmlClasses.pas"/> 597 <Caret Line="253" Column="43" TopLine="234"/> 598 </Position25> 599 <Position26> 600 <Filename Value="Common/UHtmlClasses.pas"/> 601 <Caret Line="250" Column="1" TopLine="234"/> 602 </Position26> 603 <Position27> 604 <Filename Value="Common/UHtmlClasses.pas"/> 605 <Caret Line="258" Column="1" TopLine="235"/> 606 </Position27> 607 <Position28> 608 <Filename Value="Application/UCustomCGIApplication.pas"/> 609 <Caret Line="90" Column="6" TopLine="75"/> 610 </Position28> 611 <Position29> 612 <Filename Value="Common/UHtmlClasses.pas"/> 613 <Caret Line="248" Column="76" TopLine="224"/> 614 </Position29> 615 <Position30> 616 <Filename Value="Common/UXmlClasses.pas"/> 617 <Caret Line="113" Column="1" TopLine="110"/> 618 </Position30> 538 619 </JumpHistory> 539 620 </ProjectOptions> … … 544 625 </Target> 545 626 <SearchPaths> 546 <OtherUnitFiles Value="/usr/lib/mysql/;/usr/lib64/mysql/;Pages/;Common/ "/>627 <OtherUnitFiles Value="/usr/lib/mysql/;/usr/lib64/mysql/;Pages/;Common/;Application/"/> 547 628 <UnitOutputDirectory Value="bin"/> 548 629 <LCLWidgetType Value="gtk2"/> -
branches/lazarus/index.pas
r23 r24 4 4 5 5 uses 6 UCore, USqlDatabase, SysUtils, 7 UCGIApplication, UStringListEx; 8 9 type 10 11 { TMyCGIApplication } 12 13 TMyCGIApplication = class(TCGIApplication) 14 procedure Execute; override; 15 end; 6 UCore, USqlDatabase, SysUtils, Contnrs, 7 UCGIApplication, UStringListEx, UMainPage, UCustomCGIApplication; 16 8 17 9 var 18 Application: TMyCGIApplication; 19 20 { TMyCGIApplication } 21 22 procedure TMyCGIApplication.Execute; 23 var 24 I: Integer; 25 PageName: string; 26 begin 27 Output.Add('Hello friend'); 28 SysInfo; 29 30 PageName := Query.Values['p']; 31 if PageName = '' then PageName := 'index'; 32 I := 0; 33 while (I < Length(Pages)) and (Pages[I].Name <> PageName) do Inc(I); 34 if I < Length(Pages) then Output.Add(Pages[I].Producer) 35 else Output.Add('Stránka nenalezena'); 36 end; 10 Application: TCustomCGIApplication; 37 11 38 12 begin 39 Application := TMyCGIApplication.Create; 40 Application.Run; 41 Application.Free; 13 Application := TCustomCGIApplication.Create; 14 with Application do 15 try 16 RegisterPage('index', MainPage); 17 Run; 18 finally 19 Free; 20 end; 42 21 end.
Note:
See TracChangeset
for help on using the changeset viewer.