Changeset 24


Ignore:
Timestamp:
Sep 8, 2010, 4:17:21 PM (14 years ago)
Author:
george
Message:
  • Přidáno: Z PHP kódů převedeno zobrazení stránek a hlavního menu. Pro generování kostry použity třídy HTMLClasses a XMLClasses.
  • Přidáno: Styly a obrázky.
Location:
branches/lazarus
Files:
40 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/lazarus/Common/UHtmlClasses.pas

    r23 r24  
    66
    77uses
    8   UXmlClasses, Classes, SysUtils;
     8  UXmlClasses, Classes, SysUtils, Contnrs, UStringListEx;
    99
    1010type
    11   TStringArray = array of string;
    12 
    1311  TDomainAddress = class(TPersistent)
    1412  private
     
    9795  public
    9896    BlockType: TBlockType;
    99     SubItems: TList; // of THtmlElement;
     97    SubItems: TObjectList; // of THtmlElement;
    10098    constructor Create;
    10199    destructor Destroy; override;
     
    113111
    114112  TSizeUnits = (suPixels, suPercents);
     113
    115114  THtmlSize = record
    116115    Width: Integer;
     
    130129  end;
    131130
    132   THtmlPage = class
     131  THtmlDocument = class
    133132  private
    134133    function GetAsXmlDocument: TXmlDocument;
    135134  public
    136135    Title: string;
    137     Charset: string;
     136    ContentEncoding: string;
     137    ContentLanguage: string;
    138138    Body: THtmlBlock;
     139    Styles: TStringList;
     140    Scripts: TStringList;
    139141    property AsXmlDocument: TXmlDocument read GetAsXmlDocument;
    140142    constructor Create;
     
    142144  end;
    143145
    144 function Explode(Separator: Char; Source: string): TStringArray;
    145 
    146146implementation
    147 
    148 function Explode(Separator: Char; Source: string): TStringArray;
    149 begin
    150   SetLength(Result, 0);
    151   while Pos(Separator, Source) > 0 do begin
    152     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;
    159147
    160148function LeftCutString(var Source, Output: string; Delimiter: string; Allowed: string = ''): Boolean;
     
    210198end;
    211199
    212 { THtmlPage }
    213 
    214 constructor THtmlPage.Create;
     200{ THtmlDocument }
     201
     202constructor THtmlDocument.Create;
    215203begin
    216204  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';
     209end;
     210
     211destructor THtmlDocument.Destroy;
    220212begin
    221213  Body.Free;
     214  Styles.Free;
     215  Scripts.Free;
    222216  inherited;
    223217end;
    224218
    225 function THtmlPage.GetAsXmlDocument: TXmlDocument;
     219function THtmlDocument.GetAsXmlDocument: TXmlDocument;
     220var
     221  DocType: TXMLTag;
     222  HTMLTag: TXMLTag;
     223  I: Integer;
    226224begin
    227225  Result := TXmlDocument.Create;
    228226  with Result, Content do begin
    229227    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';
    233235      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]);
    237267        end;
    238268      end;
    239269      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);
    248272      end;
    249273    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);
    256275  end;
    257276end;
     
    261280constructor THtmlBlock.Create;
    262281begin
    263   SubItems := TList.Create;
     282  SubItems := TObjectList.Create;
    264283end;
    265284
    266285destructor THtmlBlock.Destroy;
    267 var
    268   I: Integer;
    269 begin
    270   for I := 0 to SubItems.Count - 1 do THtmlElement(SubItems[I]).Free;
     286begin
    271287  SubItems.Free;
    272288  inherited;
     
    280296  with TXmlTag(Result) do begin
    281297    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 := '';
    285301    end;
    286302    for I := 0 to SubItems.Count - 1 do
     
    351367procedure TIpAddress.SetAsString(const Value: string);
    352368var
    353   Parts: TStringArray;
    354 begin
    355   Parts := Explode('.', Value);
     369  Parts: TStringListEx;
     370begin
    356371  try
     372    Parts := TStringListEx.Create;
     373    Parts.Explode('.', Value);
     374    try
    357375//    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]);
    362380//    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;
    365386  end;
    366387end;
     
    430451procedure TDomainAddress.SetAsString(const Value: string);
    431452var
    432   StrArray: TStringArray;
     453  StrArray: TStringListEx;
    433454  I: Integer;
    434455begin
    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;
    438465end;
    439466
     
    455482  Result := TXmlTag.Create;
    456483  with TXmlTag(Result) do begin
    457     TagName := 'a';
     484    Name := 'a';
    458485    Attributes.Add('href='+Target.AsString);
    459486    if Assigned(Content) then SubElements.Add(Content.AsXmlElement);
     
    522549  Result := TXmlTag.Create;
    523550  with TXmlTag(Result) do begin
    524     TagName := 'img';
     551    Name := 'img';
    525552    Attributes.AddNameValue('src', Source.AsString);
    526553    Attributes.AddNameValue('width', IntToStr(Size.Width));
  • branches/lazarus/Common/UXmlClasses.pas

    r23 r24  
    55interface
    66
    7 uses Classes, SysUtils, Contnrs, StrUtils;
     7uses Classes, SysUtils, Contnrs, StrUtils, UStringListEx;
    88
    99type
    10   TStringListEx = class(TStringList)
    11   public
    12     procedure AddNameValue(Name, Value: string);
    13   end;
    14 
    1510  TXmlElement = class
    1611  private
     
    3126    function GetAsString: string; override;
    3227  public
    33     EndTagSymbol: Char;
    34     TagName: string;
     28    EndTagSymbol: string;
     29    ShringEmpty: Boolean;
     30    Name: string;
    3531    Attributes: TStringListEx;
    36     SubElements: TList; // of TXmlElement;
     32    SubElements: TObjectList; // of TXmlElement;
    3733    constructor Create;
    3834    destructor Destroy; override;
     
    4137  TXmlDocument = class
    4238  private
     39    MainTag: TXmlTag;
    4340    function FormatStructure(Text: string): string;
    4441    function GetAsString: string;
    4542  public
    4643    Formated: Boolean;
    47     MainTag: TXmlTag;
    4844    Content: TXmlTag;
    4945    XmlVersion: string;
     
    6056constructor TXmlTag.Create;
    6157begin
     58  ShringEmpty := True;
    6259  Attributes := TStringListEx.Create;
    6360  Attributes.NameValueSeparator := '=';
    64   SubElements := TList.Create;
     61  SubElements := TObjectList.Create;
    6562  EndTagSymbol := '/';
    6663end;
    6764
    6865destructor TXmlTag.Destroy;
    69 var
    70   I: Integer;
    7166begin
    7267  Attributes.Free;
    73   for I := 0 to SubElements.Count - 1 do TXmlElement(SubElements[I]).Free;
    7468  SubElements.Free;
    7569  inherited;
     
    9084    AttributesText := AttributesText + ' ' + Attributes.Names[I] + '="' + Attributes.ValueFromIndex[I] + '"';
    9185
    92   if TagName <> '' then begin
    93     if Content <> '' then
    94       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 + '>';
    9690  end else Result := Content;
    9791end;
     
    116110begin
    117111  inherited;
    118   Encoding := 'windows-1250';
     112  Encoding := 'utf-8';
    119113  XmlVersion := '1.0';
    120114  MainTag := TXmlTag.Create;
    121115  with MainTag do begin
    122     TagName := '?xml';
     116    Name := '?xml';
    123117    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');
    126120  end;
    127121  Content := TXmlTag.Create;
     
    172166function TXmlDocument.GetAsString: string;
    173167begin
    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;
    177169  if Formated then Result := FormatStructure(Result);
    178170end;
    179171
    180 { TStringListEx }
    181 
    182 procedure TStringListEx.AddNameValue(Name, Value: string);
    183 begin
    184   Add(Name + NameValueSeparator + Value);
    185 end;
    186 
    187172end.
  • branches/lazarus/UCore.pas

    r23 r24  
    66
    77uses
    8   USqlDatabase;
     8  USqlDatabase, Classes, SysUtils, StrUtils;
    99 
    1010type
     
    1212  TPageProducer = function: string;
    1313
     14function MakeLink(Text, URL: string): string;
     15function NavigationMakeLink(Module, Page: string): string;
    1416function InsertIcon(FileName: string): string;
     17function IconedLink(Link, Text: string): string;
    1518function HtmlLink(Text, Target: string): string;
    1619function ShowHeader(Title, Path: string): string;
     
    1821function Explode(Separator: Char; Data: string): TArrayOfString;
    1922function HumanDate(Date: string): string;
    20 procedure RegisterPage(Name: string; Producer: TPageProducer);
    2123function PagesList(URL: string; Page, TotalCount, CountPerPage: Integer): string;
    2224function StrRepeat(Data: string; Count: Integer): string;
    23 
    24 type
    25   TRegistredPage = record
    26     Name: string;
    27         Producer: TPageProducer;
    28   end;
    29  
    30 var
    31   Pages: array of TRegistredPage;
    32   Database: TSqlDatabase;
    3325
    3426implementation
    3527
    3628uses 
    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;
    4530
    4631function HtmlLink(Text, Target: string): string;
     
    11095end;
    11196
    112 procedure Init;
    113 var
    114   DbRows: TDbRows;
     97function LastPos(const SubStr: String; const S: String): Integer;
    11598begin
    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;
    126103end;
    127104
    128 procedure Done;
     105function IconedLink(Link, Text: string): string;
     106var
     107  Extension: string;
     108  Icon: string;
    129109begin
    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>';
     113end;
     114
     115function MakeLink(Text, URL: string): string;
     116begin
     117  Result := '<a href="' + URL + '">' + Text + '</a>';
     118end;
     119
     120function NavigationMakeLink(Module, Page: string): string;
     121begin
     122  Result := '?m=' + Module + '&amp;p=' + Page;
    131123end;
    132124
     
    179171initialization
    180172
    181 Init;
    182 
    183173finalization
    184174
    185 Done;
    186175end.
  • branches/lazarus/index.lpi

    r23 r24  
    2828      </local>
    2929    </RunParams>
    30     <Units Count="46">
     30    <Units Count="49">
    3131      <Unit0>
    3232        <Filename Value="index.pas"/>
    3333        <IsPartOfProject Value="True"/>
    3434        <UnitName Value="index"/>
    35         <IsVisibleTab Value="True"/>
    3635        <EditorIndex Value="0"/>
    3736        <WindowIndex Value="0"/>
    3837        <TopLine Value="1"/>
    39         <CursorPos X="20" Y="7"/>
    40         <UsageCount Value="145"/>
     38        <CursorPos X="50" Y="18"/>
     39        <UsageCount Value="155"/>
    4140        <Loaded Value="True"/>
    4241        <LoadedDesigner Value="True"/>
     
    4746        <IsPartOfProject Value="True"/>
    4847        <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"/>
    5354        <DefaultSyntaxHighlighter Value="Delphi"/>
    5455      </Unit1>
     
    5960        <TopLine Value="291"/>
    6061        <CursorPos X="1" Y="311"/>
    61         <UsageCount Value="145"/>
     62        <UsageCount Value="144"/>
    6263        <DefaultSyntaxHighlighter Value="Delphi"/>
    6364      </Unit2>
    6465      <Unit3>
    6566        <Filename Value="UXmlClasses.pas"/>
    66         <UsageCount Value="145"/>
     67        <UsageCount Value="144"/>
    6768        <DefaultSyntaxHighlighter Value="Delphi"/>
    6869      </Unit3>
    6970      <Unit4>
    7071        <Filename Value="UCore.pas"/>
     72        <IsPartOfProject Value="True"/>
    7173        <UnitName Value="UCore"/>
    72         <EditorIndex Value="9"/>
    73         <WindowIndex Value="0"/>
    74         <TopLine Value="10"/>
    75         <CursorPos X="1" Y="23"/>
    76         <UsageCount Value="145"/>
     74        <EditorIndex Value="16"/>
     75        <WindowIndex Value="0"/>
     76        <TopLine Value="1"/>
     77        <CursorPos X="1" Y="16"/>
     78        <UsageCount Value="155"/>
    7779        <Loaded Value="True"/>
    7880        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    8486        <TopLine Value="217"/>
    8587        <CursorPos X="5" Y="236"/>
    86         <UsageCount Value="145"/>
     88        <UsageCount Value="144"/>
    8789        <DefaultSyntaxHighlighter Value="Delphi"/>
    8890      </Unit5>
    8991      <Unit6>
    9092        <Filename Value="Pages/UFinancePage.pas"/>
    91         <IsPartOfProject Value="True"/>
    9293        <UnitName Value="UFinancePage"/>
    9394        <WindowIndex Value="0"/>
    9495        <TopLine Value="10"/>
    9596        <CursorPos X="27" Y="19"/>
    96         <UsageCount Value="145"/>
     97        <UsageCount Value="144"/>
    9798        <DefaultSyntaxHighlighter Value="Delphi"/>
    9899      </Unit6>
     
    102103        <TopLine Value="17"/>
    103104        <CursorPos X="34" Y="30"/>
    104         <UsageCount Value="145"/>
     105        <UsageCount Value="144"/>
    105106        <DefaultSyntaxHighlighter Value="Delphi"/>
    106107      </Unit7>
     
    111112        <TopLine Value="204"/>
    112113        <CursorPos X="25" Y="226"/>
    113         <UsageCount Value="145"/>
     114        <UsageCount Value="144"/>
    114115        <DefaultSyntaxHighlighter Value="Delphi"/>
    115116      </Unit8>
    116117      <Unit9>
    117118        <Filename Value="Pages/UNewsPage.pas"/>
    118         <IsPartOfProject Value="True"/>
    119119        <UnitName Value="UNewsPage"/>
    120120        <WindowIndex Value="0"/>
    121121        <TopLine Value="102"/>
    122122        <CursorPos X="25" Y="107"/>
    123         <UsageCount Value="145"/>
     123        <UsageCount Value="144"/>
    124124        <DefaultSyntaxHighlighter Value="Delphi"/>
    125125      </Unit9>
     
    129129        <TopLine Value="2320"/>
    130130        <CursorPos X="30" Y="2342"/>
    131         <UsageCount Value="14"/>
     131        <UsageCount Value="13"/>
    132132        <DefaultSyntaxHighlighter Value="Delphi"/>
    133133      </Unit10>
     
    138138        <TopLine Value="40"/>
    139139        <CursorPos X="9" Y="59"/>
    140         <UsageCount Value="133"/>
     140        <UsageCount Value="132"/>
    141141        <DefaultSyntaxHighlighter Value="Delphi"/>
    142142      </Unit11>
    143143      <Unit12>
    144144        <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"/>
    148151        <DefaultSyntaxHighlighter Value="Delphi"/>
    149152      </Unit12>
     
    152155        <TopLine Value="34"/>
    153156        <CursorPos X="3" Y="624"/>
    154         <UsageCount Value="1"/>
     157        <UsageCount Value="0"/>
    155158        <DefaultSyntaxHighlighter Value="Delphi"/>
    156159      </Unit13>
     
    159162        <IsPartOfProject Value="True"/>
    160163        <UnitName Value="UConfig"/>
    161         <EditorIndex Value="8"/>
     164        <EditorIndex Value="7"/>
    162165        <WindowIndex Value="0"/>
    163166        <TopLine Value="1"/>
    164167        <CursorPos X="88" Y="11"/>
    165         <UsageCount Value="120"/>
     168        <UsageCount Value="130"/>
    166169        <Loaded Value="True"/>
    167170        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    172175        <TopLine Value="108"/>
    173176        <CursorPos X="1" Y="134"/>
    174         <UsageCount Value="120"/>
     177        <UsageCount Value="130"/>
    175178        <DefaultSyntaxHighlighter Value="None"/>
    176179      </Unit15>
     
    180183        <TopLine Value="1"/>
    181184        <CursorPos X="1" Y="1"/>
    182         <UsageCount Value="120"/>
     185        <UsageCount Value="130"/>
    183186        <DefaultSyntaxHighlighter Value="JScript"/>
    184187      </Unit16>
     
    189192        <TopLine Value="608"/>
    190193        <CursorPos X="44" Y="627"/>
    191         <UsageCount Value="114"/>
     194        <UsageCount Value="113"/>
    192195        <DefaultSyntaxHighlighter Value="Delphi"/>
    193196      </Unit17>
     
    198201        <TopLine Value="39"/>
    199202        <CursorPos X="25" Y="58"/>
    200         <UsageCount Value="114"/>
     203        <UsageCount Value="113"/>
    201204        <DefaultSyntaxHighlighter Value="Delphi"/>
    202205      </Unit18>
    203206      <Unit19>
    204207        <Filename Value="Pages/UUserPage.pas"/>
    205         <IsPartOfProject Value="True"/>
    206208        <UnitName Value="UUserPage"/>
    207209        <WindowIndex Value="0"/>
    208210        <TopLine Value="1"/>
    209211        <CursorPos X="69" Y="19"/>
    210         <UsageCount Value="110"/>
     212        <UsageCount Value="109"/>
    211213        <DefaultSyntaxHighlighter Value="Delphi"/>
    212214      </Unit19>
     
    217219        <TopLine Value="1"/>
    218220        <CursorPos X="52" Y="124"/>
    219         <UsageCount Value="107"/>
     221        <UsageCount Value="106"/>
    220222        <DefaultSyntaxHighlighter Value="Delphi"/>
    221223      </Unit20>
     
    225227        <TopLine Value="1"/>
    226228        <CursorPos X="19" Y="4"/>
    227         <UsageCount Value="5"/>
     229        <UsageCount Value="4"/>
    228230        <DefaultSyntaxHighlighter Value="Delphi"/>
    229231      </Unit21>
     
    231233        <Filename Value="../../../../other/powtils/release/1.7.1/main/dynpwu.pas"/>
    232234        <UnitName Value="dynpwu"/>
    233         <EditorIndex Value="10"/>
    234         <WindowIndex Value="0"/>
    235         <TopLine Value="19"/>
     235        <WindowIndex Value="0"/>
     236        <TopLine Value="29"/>
    236237        <CursorPos X="2" Y="38"/>
    237         <UsageCount Value="35"/>
    238         <Loaded Value="True"/>
     238        <UsageCount Value="34"/>
    239239        <DefaultSyntaxHighlighter Value="Delphi"/>
    240240      </Unit22>
     
    242242        <Filename Value="../../../../other/powtils/release/1.7.1/main/pwbuffer.pas"/>
    243243        <UnitName Value="pwbuffer"/>
    244         <EditorIndex Value="11"/>
    245         <WindowIndex Value="0"/>
    246         <TopLine Value="67"/>
     244        <WindowIndex Value="0"/>
     245        <TopLine Value="62"/>
    247246        <CursorPos X="6" Y="62"/>
    248         <UsageCount Value="12"/>
    249         <Loaded Value="True"/>
     247        <UsageCount Value="11"/>
    250248        <DefaultSyntaxHighlighter Value="Delphi"/>
    251249      </Unit23>
     
    253251        <Filename Value="../../../../other/powtils/release/1.7.1/main/pwbase64enc.pas"/>
    254252        <UnitName Value="pwbase64enc"/>
    255         <EditorIndex Value="14"/>
    256         <WindowIndex Value="0"/>
    257         <TopLine Value="53"/>
     253        <WindowIndex Value="0"/>
     254        <TopLine Value="125"/>
    258255        <CursorPos X="9" Y="141"/>
    259         <UsageCount Value="12"/>
    260         <Loaded Value="True"/>
     256        <UsageCount Value="11"/>
    261257        <DefaultSyntaxHighlighter Value="Delphi"/>
    262258      </Unit24>
     
    264260        <Filename Value="../../../../other/powtils/release/1.7.1/main/pwdirutil_test.pas"/>
    265261        <UnitName Value="pwdirutil_test"/>
    266         <EditorIndex Value="12"/>
    267262        <WindowIndex Value="0"/>
    268263        <TopLine Value="1"/>
    269264        <CursorPos X="1" Y="1"/>
    270         <UsageCount Value="12"/>
    271         <Loaded Value="True"/>
     265        <UsageCount Value="11"/>
    272266        <DefaultSyntaxHighlighter Value="Delphi"/>
    273267      </Unit25>
     
    275269        <Filename Value="../../../../other/powtils/release/1.7.1/main/pwdefaultcfg.pas"/>
    276270        <UnitName Value="pwdefaultcfg"/>
    277         <EditorIndex Value="13"/>
    278         <WindowIndex Value="0"/>
    279         <TopLine Value="92"/>
     271        <WindowIndex Value="0"/>
     272        <TopLine Value="103"/>
    280273        <CursorPos X="29" Y="112"/>
    281         <UsageCount Value="12"/>
    282         <Loaded Value="True"/>
     274        <UsageCount Value="11"/>
    283275        <DefaultSyntaxHighlighter Value="Delphi"/>
    284276      </Unit26>
     
    286278        <Filename Value="../../../../other/powtils/release/1.7.1/main/pwhtmtils.pas"/>
    287279        <UnitName Value="pwHTMtils"/>
    288         <EditorIndex Value="15"/>
    289280        <WindowIndex Value="0"/>
    290281        <TopLine Value="1"/>
    291282        <CursorPos X="12" Y="10"/>
    292         <UsageCount Value="12"/>
    293         <Loaded Value="True"/>
     283        <UsageCount Value="11"/>
    294284        <DefaultSyntaxHighlighter Value="Delphi"/>
    295285      </Unit27>
     
    300290        <TopLine Value="1"/>
    301291        <CursorPos X="8" Y="1"/>
    302         <UsageCount Value="10"/>
     292        <UsageCount Value="9"/>
    303293        <DefaultSyntaxHighlighter Value="Delphi"/>
    304294      </Unit28>
     
    306296        <Filename Value="../../../../other/powtils/release/1.7.1/main/pwhtmw.pas"/>
    307297        <UnitName Value="pwHTMw"/>
    308         <EditorIndex Value="16"/>
    309298        <WindowIndex Value="0"/>
    310299        <TopLine Value="1803"/>
    311300        <CursorPos X="39" Y="1806"/>
    312         <UsageCount Value="12"/>
    313         <Loaded Value="True"/>
     301        <UsageCount Value="11"/>
    314302        <DefaultSyntaxHighlighter Value="Delphi"/>
    315303      </Unit29>
     
    320308        <TopLine Value="173"/>
    321309        <CursorPos X="10" Y="192"/>
    322         <UsageCount Value="10"/>
     310        <UsageCount Value="9"/>
    323311        <DefaultSyntaxHighlighter Value="Delphi"/>
    324312      </Unit30>
     
    326314        <Filename Value="../../../../other/powtils/release/1.7.1/main/pwmailprep.pas"/>
    327315        <UnitName Value="pwmailprep"/>
    328         <EditorIndex Value="7"/>
    329316        <WindowIndex Value="0"/>
    330317        <TopLine Value="31"/>
    331318        <CursorPos X="3" Y="49"/>
    332         <UsageCount Value="12"/>
    333         <Loaded Value="True"/>
     319        <UsageCount Value="11"/>
    334320        <DefaultSyntaxHighlighter Value="Delphi"/>
    335321      </Unit31>
     
    340326        <TopLine Value="2569"/>
    341327        <CursorPos X="27" Y="2594"/>
    342         <UsageCount Value="10"/>
     328        <UsageCount Value="9"/>
    343329        <DefaultSyntaxHighlighter Value="Delphi"/>
    344330      </Unit32>
     
    349335        <TopLine Value="112"/>
    350336        <CursorPos X="23" Y="125"/>
    351         <UsageCount Value="21"/>
     337        <UsageCount Value="20"/>
    352338        <DefaultSyntaxHighlighter Value="Delphi"/>
    353339      </Unit33>
     
    358344        <TopLine Value="1"/>
    359345        <CursorPos X="1" Y="1"/>
    360         <UsageCount Value="21"/>
     346        <UsageCount Value="20"/>
    361347        <DefaultSyntaxHighlighter Value="Delphi"/>
    362348      </Unit34>
     
    365351        <EditorIndex Value="6"/>
    366352        <WindowIndex Value="0"/>
    367         <TopLine Value="562"/>
    368         <CursorPos X="14" Y="579"/>
    369         <UsageCount Value="10"/>
     353        <TopLine Value="254"/>
     354        <CursorPos X="15" Y="268"/>
     355        <UsageCount Value="15"/>
    370356        <Loaded Value="True"/>
    371357        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    377363        <TopLine Value="10"/>
    378364        <CursorPos X="22" Y="23"/>
    379         <UsageCount Value="10"/>
     365        <UsageCount Value="15"/>
    380366        <Loaded Value="True"/>
    381367        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    388374        <TopLine Value="1140"/>
    389375        <CursorPos X="26" Y="1143"/>
    390         <UsageCount Value="10"/>
     376        <UsageCount Value="15"/>
    391377        <Loaded Value="True"/>
    392378        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    398384        <TopLine Value="43"/>
    399385        <CursorPos X="5" Y="61"/>
    400         <UsageCount Value="10"/>
     386        <UsageCount Value="15"/>
    401387        <Loaded Value="True"/>
    402388        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    408394        <TopLine Value="50"/>
    409395        <CursorPos X="10" Y="63"/>
    410         <UsageCount Value="10"/>
     396        <UsageCount Value="15"/>
    411397        <Loaded Value="True"/>
    412398        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    419405        <WindowIndex Value="0"/>
    420406        <TopLine Value="22"/>
    421         <CursorPos X="40" Y="41"/>
    422         <UsageCount Value="20"/>
     407        <CursorPos X="58" Y="29"/>
     408        <UsageCount Value="30"/>
    423409        <Loaded Value="True"/>
    424410        <DefaultSyntaxHighlighter Value="Delphi"/>
     
    427413        <Filename Value="Common/UCGIApplication.pas"/>
    428414        <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"/>
    430422        <DefaultSyntaxHighlighter Value="Delphi"/>
    431423      </Unit41>
     
    433425        <Filename Value="Common/UDatabase.pas"/>
    434426        <IsPartOfProject Value="True"/>
    435         <UsageCount Value="20"/>
     427        <UsageCount Value="30"/>
    436428        <DefaultSyntaxHighlighter Value="Delphi"/>
    437429      </Unit42>
     
    439431        <Filename Value="Common/UHtmlClasses.pas"/>
    440432        <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"/>
    442441        <DefaultSyntaxHighlighter Value="Delphi"/>
    443442      </Unit43>
     
    445444        <Filename Value="Common/USqlDatabase.pas"/>
    446445        <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"/>
    448453        <DefaultSyntaxHighlighter Value="Delphi"/>
    449454      </Unit44>
     
    451456        <Filename Value="Common/UXmlClasses.pas"/>
    452457        <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"/>
    454465        <DefaultSyntaxHighlighter Value="Delphi"/>
    455466      </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>
    456497    </Units>
    457     <JumpHistory Count="20" HistoryIndex="19">
     498    <JumpHistory Count="30" HistoryIndex="28">
    458499      <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"/>
    461502      </Position1>
    462503      <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"/>
    465506      </Position2>
    466507      <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"/>
    469510      </Position3>
    470511      <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"/>
    473514      </Position4>
    474515      <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"/>
    477518      </Position5>
    478519      <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"/>
    481522      </Position6>
    482523      <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"/>
    485526      </Position7>
    486527      <Position8>
    487         <Filename Value="../../../../other/powtils/release/1.7.1/main/pwhtmw.pas"/>
    488         <Caret Line="1837" Column="1" TopLine="1799"/>
     528        <Filename Value="Application/UCustomCGIApplication.pas"/>
     529        <Caret Line="175" Column="14" TopLine="161"/>
    489530      </Position8>
    490531      <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"/>
    493534      </Position9>
    494535      <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"/>
    497538      </Position10>
    498539      <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"/>
    501542      </Position11>
    502543      <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"/>
    505546      </Position12>
    506547      <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"/>
    509550      </Position13>
    510551      <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"/>
    513554      </Position14>
    514555      <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"/>
    517558      </Position15>
    518559      <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"/>
    521562      </Position16>
    522563      <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"/>
    525566      </Position17>
    526567      <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"/>
    529570      </Position18>
    530571      <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"/>
    533574      </Position19>
    534575      <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"/>
    537578      </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>
    538619    </JumpHistory>
    539620  </ProjectOptions>
     
    544625    </Target>
    545626    <SearchPaths>
    546       <OtherUnitFiles Value="/usr/lib/mysql/;/usr/lib64/mysql/;Pages/;Common/"/>
     627      <OtherUnitFiles Value="/usr/lib/mysql/;/usr/lib64/mysql/;Pages/;Common/;Application/"/>
    547628      <UnitOutputDirectory Value="bin"/>
    548629      <LCLWidgetType Value="gtk2"/>
  • branches/lazarus/index.pas

    r23 r24  
    44
    55uses
    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;
    168
    179var
    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;
    3711
    3812begin
    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;
    4221end.
Note: See TracChangeset for help on using the changeset viewer.