Changeset 138


Ignore:
Timestamp:
Sep 9, 2022, 8:20:25 PM (21 months ago)
Author:
chronos
Message:
  • Modified: Removed TemplateGenerics package. Generics usage replaced by standard Generics.Collections.
Location:
trunk
Files:
2 added
1 deleted
50 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/UWebObjects.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, UHtmlClasses, UXmlClasses, SpecializedDictionary,
    7   Generics.Collections;
     6  Classes, SysUtils, UHtmlClasses, UXmlClasses, Generics.Collections;
    87
    98type
     
    4241    Title: string;
    4342    Rows: TQueryFormItemList;
    44     procedure Load(Items: TDictionaryStringString);
     43    procedure Load(Items: TDictionary<string, string>);
    4544    function AddNewItem: TQueryFormItem;
    4645    constructor Create;
     
    6968    function AddNewGroup: TQueryFormGroup;
    7069    function AddNewAction(Caption, Action: string): TQueryAction;
    71     procedure Load(Items: TDictionaryStringString);
     70    procedure Load(Items: TDictionary<string, string>);
    7271    constructor Create;
    7372    destructor Destroy; override;
     
    8483begin
    8584  I := 0;
    86   while (I < Count) and (TQueryFormItem(Items[I]).Value.ItemName <> AValue) do Inc(I);
    87   if I < Count then Result := TQueryFormItem(Items[I])
     85  while (I < Count) and (Items[I].Value.ItemName <> AValue) do Inc(I);
     86  if I < Count then Result := Items[I]
    8887    else Result := nil;
    8988end;
     
    141140    Table := THtmlTable.Create;
    142141    Table.ClassId := ClassId;
    143     Row := THtmlRow(Table.Rows.AddNew(THtmlRow.Create));
    144     with THtmlCell(Row.Cells.AddNew(THtmlCell.Create)) do begin
     142    Row := Table.Rows.AddRow;
     143    with Row.Cells.AddCell do begin
    145144      ColSpan := 2;
    146145      Value := THtmlString.Create;
     
    149148    with Table do
    150149    for G := 0 to Groups.Count - 1 do
    151     with TQueryFormGroup(Groups[G]) do begin
     150    with Groups[G] do begin
    152151      if Title <> '' then begin
    153         Row := THtmlRow(Table.Rows.AddNew(THtmlRow.Create));
    154         with THtmlCell(Row.Cells.AddNew(THtmlCell.Create)) do begin
     152        Row := Table.Rows.AddRow;
     153        with Row.Cells.AddCell do begin
    155154          ColSpan := 2;
    156155          Value := THtmlString.Create;
     
    159158      end;
    160159      for I := 0 to Rows.Count - 1 do
    161       with TQueryFormItem(Rows[I]) do begin
    162         Row := THtmlRow(Table.Rows.AddNew(THtmlRow.Create));
    163         with THtmlCell(Row.Cells.AddNew(THtmlCell.Create)) do begin
     160      with Rows[I] do begin
     161        Row := Table.Rows.AddRow;
     162        with Row.Cells.AddCell do begin
    164163          Value := THtmlString.Create;
    165164          THtmlString(Value).Text := Caption;
     
    167166          THtmlString(Value).Text := THtmlString(Value).Text + ': ';
    168167        end;
    169         with THtmlCell(Row.Cells.AddNew(THtmlCell.Create)) do begin
     168        with Row.Cells.AddCell do begin
    170169          Value := THtmlInput.Create;
    171           THtmlInput(Value).Assign(TQueryFormItem(Rows[I]).Value);
     170          THtmlInput(Value).Assign(Rows[I].Value);
    172171        end;
    173172      end;
    174173    end;
    175     Row := THtmlRow(Table.Rows.AddNew(THtmlRow.Create));
    176     with THtmlCell(Row.Cells.AddNew(THtmlCell.Create)) do begin
     174    Row := Table.Rows.AddRow;
     175    with Row.Cells.AddCell do begin
    177176      ColSpan := 2;
    178177      Value := THtmlBlock.Create;
    179178      for I := 0 to Actions.Count - 1 do
    180       with THtmlInput(THtmlBlock(Value).SubItems.AddNew(THtmlInput.Create)) do begin
    181         Value := TQueryAction(Actions[I]).Caption;
     179      with THtmlBlock(Value).SubItems.AddInput do begin
     180        Value := Actions[I].Caption;
    182181        InputType := itSubmit;
    183         ItemName := TQueryAction(Actions[I]).Action;
     182        ItemName := Actions[I].Action;
    184183      end;
    185184    end;
     
    203202end;
    204203
    205 procedure TQueryForm.Load(Items: TDictionaryStringString);
     204procedure TQueryForm.Load(Items: TDictionary<string, string>);
    206205var
    207206  I: Integer;
    208207begin
    209208  for I := 0 to Groups.Count - 1 do
    210     TQueryFormGroup(Groups[I]).Load(Items);
     209    Groups[I].Load(Items);
    211210end;
    212211
     
    229228{ TQueryFormGroup }
    230229
    231 procedure TQueryFormGroup.Load(Items: TDictionaryStringString);
    232 var
    233   I: Integer;
     230procedure TQueryFormGroup.Load(Items: TDictionary<string, string>);
     231var
     232  I: Integer;
     233  Item: string;
    234234begin
    235235  for I := 0 to Rows.Count - 1 do
    236   with TQueryFormItem(Rows[I]) do begin
    237     if Items.SearchKey(Value.ItemName) <> -1 then
    238       Value.Value := Items.Values[Value.ItemName];
     236  with Rows[I] do begin
     237    if Items.TryGetValue(Value.ItemName, Item) then
     238      Value.Value := Item;
    239239  end;
    240240end;
  • trunk/Application/UWebSession.pas

    r137 r138  
    66  Classes, SysUtils, UHTTPServer, USqlDatabase, UHTTPSessionMySQL, UUser,
    77  UHtmlClasses, UWebPage, UUtils, UXmlClasses, DateUtils, UModularSystem,
    8   UPageList, UWebApp, SpecializedList;
     8  UPageList, UWebApp, UGenerics;
    99
    1010type
     
    8686  try
    8787    BaseUrlParts := TListString.Create;
    88     BaseUrlParts.Explode(BaseURL, '/', StrToStr);
     88    BaseUrlParts.Explode('/', BaseURL);
    8989    while (BaseUrlParts.Count > 0) and (Request.Path.Count > 0) and
    9090      (BaseUrlParts[0] = Request.Path[0]) do begin
     
    104104    except
    105105      on E: Exception do begin
    106         THTMLString(Self.HtmlDocument.Body.SubItems.AddNew(THtmlString.Create)).
    107           Text := Format(SError, [E.Message]);
     106        Self.HtmlDocument.Body.SubItems.AddString.Text := Format(SError, [E.Message]);
    108107        GeneratePage(Page.Page);
    109108      end;
  • trunk/Modules/Base/UModuleBase.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, UModularSystem, SpecializedDictionary, UWebPage, UWebApp,
     6  Classes, SysUtils, UModularSystem, UGenerics, UWebPage, UWebApp,
    77  UWebSession, UHTTPServer;
    88
  • trunk/Modules/IS/UModuleIS.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, UModularSystem, SpecializedDictionary, USqlDatabase,
    7   UModuleBase;
     6  Classes, SysUtils, UModularSystem, USqlDatabase, UModuleBase, UGenerics;
    87
    98type
  • trunk/Modules/News/UNews.pas

    r137 r138  
    9797  DbRows := TDbRows.Create;
    9898  Database.Select(DbRows, 'NewsCategory', '*', 'Id=' + IntToStr(Category));
    99   Output := '<div class="NewsPanel"><div class="Title">' + DbRows[0].Values['Caption'];
     99  Output := '<div class="NewsPanel"><div class="Title">' + DbRows[0].Items['Caption'];
    100100  Output := Output + '<div class="Action"><a href="aktuality/index.php?category=' + IntToStr(Category) + '">Zobrazit</a>';
    101101  if ModuleUser.User.CheckPermission('News', 'Insert', 'Group', Category) then
     
    113113    Output := Output + '<table class="NewsTable">';
    114114    for I := 0 to DbRows.Count - 1 do begin
    115       if DbRows[I].Values['Name'] = '' then Author := DbRows[I].Values['Author']
    116         else Author := DbRows[I].Values['Name'];
     115      if DbRows[I].Items['Name'] = '' then Author := DbRows[I].Items['Author']
     116        else Author := DbRows[I].Items['Name'];
    117117      Output := Output + '<tr><td onclick="window.location=''aktuality/index.php?action=view&amp;id=' +
    118         DbRows[I].Values['Id'] + '''" onmouseover="zobraz(' + '''new' + IntToStr(Category) +
    119           IntToStr(Index) + ''')" style="cursor: pointer; margin: 0px;"><table class="NewsItemFrame"><tr><td style="font-size: ' + IntToStr(FontSize) + 'pt"><strong>' + DbRows[I].Values['Title'] +
     118        DbRows[I].Items['Id'] + '''" onmouseover="zobraz(' + '''new' + IntToStr(Category) +
     119          IntToStr(Index) + ''')" style="cursor: pointer; margin: 0px;"><table class="NewsItemFrame"><tr><td style="font-size: ' +
     120          IntToStr(FontSize) + 'pt"><strong>' + DbRows[I].Items['Title'] +
    120121          '</strong></td><td align="right" style="font-size: ' + IntToStr(FontSize) + 'pt">' +
    121           Author + ' (' + HumanDate(SQLToDateTime(DbRows[I].Values['Date'])) + ')</td></tr></table>';
    122       Output := Output + '<div id="new' + IntToStr(Category) + IntToStr(Index) + '" class="NewsTableItem">' + ModifyContent(DbRows[I].Values['Content']);
    123       if DbRows[I].Values['Link'] <> '' then Output := Output + '<br/><a href="' + DbRows[I].Values['Link'] + '">Odkaz</a>';
    124 
    125       if DbRows[I].Values['Enclosure'] <> '' then begin
     122          Author + ' (' + HumanDate(SQLToDateTime(DbRows[I].Items['Date'])) + ')</td></tr></table>';
     123      Output := Output + '<div id="new' + IntToStr(Category) + IntToStr(Index) + '" class="NewsTableItem">' + ModifyContent(DbRows[I].Items['Content']);
     124      if DbRows[I].Items['Link'] <> '' then Output := Output + '<br/><a href="' + DbRows[I].Items['Link'] + '">Odkaz</a>';
     125
     126      if DbRows[I].Items['Enclosure'] <> '' then begin
    126127        Output := Output + '<br />Přílohy: ';
    127         Enclosures := Explode(';', DbRows[I].Values['Enclosure']);
     128        Enclosures := Explode(';', DbRows[I].Items['Enclosure']);
    128129        for J := 0 to Length(Enclosures) - 1  do begin
    129130          if FileExists(UploadedFilesFolder + Enclosures[J]) then
     
    173174    NewSetting := TNewsSettingItem.Create;
    174175    with NewSetting do begin
    175       CategoryId := StrToInt(DbRows[I].Values['Id']);
     176      CategoryId := StrToInt(DbRows[I].Items['Id']);
    176177      Index := I;
    177178      Enabled := True;
    178179      ItemCount := 6; // System->Config['Web']['News']['Count']
    179180      DaysAgo := 30; // System->Config['Web']['News']['DaysAgo']
    180       Group := StrToInt(DbRows[I].Values['Group']);
     181      Group := StrToInt(DbRows[I].Items['Group']);
    181182    end;
    182183    Settings.Add(NewSetting);
     
    205206  Column: Integer;
    206207  I: Integer;
     208  Action: string;
    207209begin
    208210  Output := '';
     
    211213  LoadSettingsFromCookies;
    212214
    213   if HandlerData.Request.Query.SearchKey('Action') <> -1 then begin
     215  if HandlerData.Request.Query.TryGetValue('Action', Action) then begin
    214216    // Show news customize menu
    215     if HandlerData.Request.Query.Values['Action'] = 'CustomizeNews' then begin
     217    if Action = 'CustomizeNews' then begin
    216218      Output := Output + ShowCustomizeMenu;
    217219    end;
     
    251253  with TNewsSettingItem(Settings[I]) do begin
    252254    Database.Select(DbRows, 'NewsCategory', '*', 'Id=' + IntToStr(CategoryId));
    253     Output := Output + '<tr><td>' + DbRows[0].Values['Caption'] +
     255    Output := Output + '<tr><td>' + DbRows[0].Items['Caption'] +
    254256      '</td><td align="center"><input type="text" size="2" name="NewsCategoryIndex' +
    255257      IntToStr(I) + '" value="' + IntToStr(Index) + '" /></td><td align="center"><input type="checkbox" name="NewsCategoryEnabled' + IntToStr(I) + '"';
  • trunk/Modules/Portal/UModulePortal.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, UModularSystem, USqlDatabase,
    7   UUtils, UWebSession, SpecializedList, UUser, UWebPage, UHtmlClasses,
    8   UModuleBase, UModuleUser, UModuleNews;
     6  Classes, SysUtils, UModularSystem, USqlDatabase, UUtils, UWebSession, UUser,
     7  UWebPage, UHtmlClasses, UModuleBase, UModuleUser, UModuleNews, UGenerics;
    98
    109type
     
    187186    //Navigation := '<a href="' + NavigationLink(PathTreePath) + '">' + PathTreeItem[0] + '</a> &gt; ';
    188187    ScriptName := Copy(ScriptName, Length(Core.BaseURL), Length(ScriptName));
    189     ScriptNameParts.Explode(ScriptName, '/', StrToStr);
     188    ScriptNameParts.Explode('/', ScriptName);
    190189    ScriptNameParts.Delete(0);
    191190    (*
  • trunk/Modules/Portal/UPagePortal.pas

    r137 r138  
    55uses
    66  Classes, SysUtils, FileUtil, UWebPage, UHTTPServer, USqlDatabase, UUtils,
    7   SpecializedDictionary, UWebSession, UHtmlClasses, UModularSystem, UModuleUser,
     7  UGenerics, UWebSession, UHtmlClasses, UModularSystem, UModuleUser,
    88  UModuleNews;
    99
     
    7070    for I := 0 to HyperLinks.Count - 1 do begin
    7171      HyperLink := Hyperlinks[I];
    72       if HyperLink.Values['IconFile'] = '' then
    73           HyperLink.Values['IconFile'] := 'clear.png';
    74         if Copy(HyperLink.Values['URL'], 1, 4) <> 'http' then
    75           HyperLink.Values['URL'] := NavigationLink(HyperLink.Values['URL']);
    76         if ((HyperLink.Values['PermissionModule'] = '') or
    77         ((HyperLink.Values['PermissionModule'] <> '') and
    78         ModuleUser.User.CheckPermission(HyperLink.Values['PermissionModule'], HyperLink.Values['PermissionOperation']))) then
    79         Result := Result + '<img alt="' + HyperLink.Values['Name'] + '" src="images/favicons/' + HyperLink.Values['IconFile'] + '" width="16" height="16" /> <a href="' + HyperLink.Values['URL'] + '">' + HyperLink.Values['Name'] + '</a><br />';
     72      if HyperLink.Items['IconFile'] = '' then
     73          HyperLink.Items['IconFile'] := 'clear.png';
     74        if Copy(HyperLink.Items['URL'], 1, 4) <> 'http' then
     75          HyperLink.Items['URL'] := NavigationLink(HyperLink.Items['URL']);
     76        if ((HyperLink.Items['PermissionModule'] = '') or
     77        ((HyperLink.Items['PermissionModule'] <> '') and
     78        ModuleUser.User.CheckPermission(HyperLink.Items['PermissionModule'], HyperLink.Items['PermissionOperation']))) then
     79        Result := Result + '<img alt="' + HyperLink.Items['Name'] + '" src="images/favicons/' + HyperLink.Items['IconFile'] + '" width="16" height="16" /> <a href="' + HyperLink.Items['URL'] + '">' + HyperLink.Items['Name'] + '</a><br />';
    8080    end;
    81     Result := ShowPanel(HyperlinkGroups[0].Values['Name'], Result);
     81    Result := ShowPanel(HyperlinkGroups[0].Items['Name'], Result);
    8282
    8383  finally
     
    9898  DbRows2: TDbRows;
    9999  I, J: Integer;
     100  Action: string;
    100101begin
    101102  try
     
    104105  Output := '';
    105106  with Session.Request do
    106   if Query.SearchKey('Action') <> -1 then begin
    107     if Query.Values['Action'] = 'CustomizeNewsSave' then begin
     107  if Query.TryGetValue('Action', Action) then begin
     108    if Action = 'CustomizeNewsSave' then begin
    108109      //Output := $this->System->Modules['News']->CustomizeSave();
    109110    end else
    110     if Query.Values['Action'] = 'LoginForm' then begin
     111    if Action = 'LoginForm' then begin
    111112      Form := TQueryForm.Create; // UserLogin
    112113      Form.AddNewAction('Přihlásit', '?Action=Login');
     
    115116        '<a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
    116117    end else
    117     if Query.Values['Action'] = 'Login' then begin
     118    if Action = 'Login' then begin
    118119      Form := TQueryForm.Create; // UserLogin
    119120      Form.Load(Session.Request.Post);
     
    131132      end;
    132133    end else
    133     if Query.Values['Action'] = 'Logout' then begin
     134    if Action = 'Logout' then begin
    134135      ModuleUser.UserOnline.Logout;
    135136      Output := Output + SystemMessage('Odhlášení', 'Uživatel odhlášen');
    136137    end else
    137     if Query.Values['Action'] = 'UserOptions' then begin
     138    if Action = 'UserOptions' then begin
    138139      UserOptions := TQueryForm.Create; // UserOptions
    139140      //UserOptions.LoadValuesFromDatabase(Session.User.Id);
     
    141142      Output := Output + UserOptions.AsXmlElement.AsString;
    142143    end else
    143     if Query.Values['Action'] = 'UserOptionsSave' then begin
     144    if Action = 'UserOptionsSave' then begin
    144145      UserOptions := TQueryForm.Create; // UserOptions
    145146      UserOptions.Load(Session.Request.Post);
     
    151152      Output := Output + UserOptions.AsXmlElement.AsString;
    152153    end else
    153     if Query.Values['Action'] = 'UserRegister' then begin
     154    if Action = 'UserRegister' then begin
    154155      Form := TQueryForm.Create; //'UserRegister');
    155156      Form.Load(Session.Request.Post);
     
    157158      Output := Output + Form.AsXmlElement.AsString;
    158159    end else
    159     if Query.Values['Action'] = 'UserRegisterConfirm' then begin
     160    if Action = 'UserRegisterConfirm' then begin
    160161      //Session.User.RegisterConfirm($_GET['User'], $_GET['H']);
    161162      Output := Output + SystemMessage('Potvrzení registrace', 'Registrace potvrzena');
    162163    end else
    163     if Query.Values['Action'] = 'PasswordRecovery' then begin
     164    if Action = 'PasswordRecovery' then begin
    164165      Form := TQueryForm.Create; // PasswordRecovery
    165166      Form.AddNewAction('Obnovit', '?Action=PasswordRecovery2');
    166167      Output := Output + Form.AsXmlElement.AsString;
    167168    end else
    168     if Query.Values['Action'] = 'PasswordRecovery2' then begin
     169    if Action = 'PasswordRecovery2' then begin
    169170      Form := TQueryForm.Create; // PasswordRecovery
    170171      Form.Load(Session.Request.Post);
     
    175176      //end;
    176177    end else
    177     if Query.Values['Action'] = 'PasswordRecoveryConfirm' then begin
     178    if Action = 'PasswordRecoveryConfirm' then begin
    178179      //Session.User.PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']);
    179180      Output := Output + SystemMessage('Obnova hesla', 'Potvrzení obnovení hesla');
    180181    end (*else
    181     if Query.Values['Action'] = 'UserRegisterSave' then begin
     182    if Action = 'UserRegisterSave' then begin
    182183          Form := TQueryForm.Create; // UserRegister
    183184          Form.Load(Session.Request.Post);
     
    189190      end;
    190191    end else
    191     if Query.Values['Action'] = 'MemberOptions' then begin
     192    if Action = 'MemberOptions' then begin
    192193          $UserOptions = new Form('MemberOptions');
    193194          $DbResult = $this->Database->query('SELECT Member.Id, Member.InternetTariffNextMonth, Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->Modules['User']->User['Member']);
     
    200201          $Output .= $UserOptions->ShowEditForm();
    201202     end else
    202      if Query.Values['Action'] = 'MemberOptionsSave' then begin
     203     if Action = 'MemberOptionsSave' then begin
    203204          $UserOptions = new Form('MemberOptions');
    204205          $UserOptions->LoadValuesFromForm();
     
    235236    for I := 0 to DbRows.Count - 1 do begin
    236237      PanelColumn := DbRows[I];
    237       if PanelColumn.Values['Width'] <> '' then
    238           Width := ' width="' + PanelColumn.Values['Width'] + '"'
     238      if PanelColumn.Items['Width'] <> '' then
     239          Width := ' width="' + PanelColumn.Items['Width'] + '"'
    239240        else Width := '';
    240241      Output := Output + '<td valign="top"' + Width + '>';
    241242      Session.Database.Query(DbRows2, 'SELECT * FROM `Panel` WHERE `PanelColumn`=' +
    242         PanelColumn.Values['Id'] + ' ORDER BY `Order`');
     243        PanelColumn.Items['Id'] + ' ORDER BY `Order`');
    243244      for J := 0 to DbRows2.Count - 1 do begin
    244245        Panel := DbRows2[J];
    245         if Panel.Values['Module'] = 'HyperlinkGroup' then
    246           Output := Output + ShowLinks(StrToInt(Panel.Values['Parameters']))
    247         else if Panel.Values['Module'] = 'OnlineHostList' then
     246        if Panel.Items['Module'] = 'HyperlinkGroup' then
     247          Output := Output + ShowLinks(StrToInt(Panel.Items['Parameters']))
     248        else if Panel.Items['Module'] = 'OnlineHostList' then
    248249          Output := Output + ShowPanel('Online počítače', OnlineHostList)
    249         else if Panel.Values['Module'] = 'UserOptions' then
     250        else if Panel.Items['Module'] = 'UserOptions' then
    250251        begin
    251252          if ModuleUser.User.Id <> UnknownUser then
    252253            Output := Output + ShowPanel('Přihlášený uživatel', UserPanel);
    253254        end else
    254         if Panel.Values['Module'] = 'Webcam' then
     255        if Panel.Items['Module'] = 'Webcam' then
    255256          Output := Output + ShowPanel('Kamery', WebcamPanel)
    256         else if Panel.Values['Module'] = 'NewsGroupList' then
     257        else if Panel.Items['Module'] = 'NewsGroupList' then
    257258          Output := Output + ShowPanel('Aktuality',
    258259          ModuleNews.Show(HandlerData)); //,
     
    263264    Output := Output + '</tr></table>';
    264265    with TWebSession(HandlerData) do begin
    265       with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do
     266      with HtmlDocument.Body, SubItems.AddString do
    266267        Text := Text + Output;
    267268    end;
  • trunk/Modules/System/UModuleSystem.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, UModularSystem, SpecializedDictionary;
     6  Classes, SysUtils, UModularSystem, UGenerics;
    77
    88type
     
    7575    for I := 0 to DbRows.Count - 1 do
    7676    with DbRows[I] do begin
    77       Module := Manager.FindModuleByName(Values['Name']);
     77      Module := Manager.FindModuleByName(Items['Name']);
    7878      if Assigned(Module) then
    79         if Values['Installed'] = '1' then Module.SetInstalledState(True)
     79        if Items['Installed'] = '1' then Module.SetInstalledState(True)
    8080          else Module.SetInstalledState(False);
    8181    end;
     
    165165
    166166      Index := 0;
    167       while (Index < DbRows.Count) and (DbRows[Index].Values['Name'] <> Identification) do Inc(Index);
     167      while (Index < DbRows.Count) and (DbRows[Index].Items['Name'] <> Identification) do Inc(Index);
    168168      if Index >= DbRows.Count then Core.CommonDatabase.Insert('SystemModule', Data)
    169169        else Core.CommonDatabase.Update('SystemModule', Data, 'Name="' + Identification + '"');
  • trunk/Modules/TV/UPageTV.pas

    r137 r138  
    5656  with TWebSession(HandlerData) do begin
    5757    ModuleUser.LoadUserInfo;
    58     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     58    with HtmlDocument.Body, SubItems.AddString do begin
    5959      Text := 'Stažení přehrávače: <a href="http://www.videolan.org/vlc/">VLC Media Player</a><br/>' +
    6060    'Seznam všech kanálů do přehrávače: <a href="playlist/">Playlist</a><br/>' +
     
    7070        with DbRows[I] do begin
    7171          TuneUp := '&nbsp;';
    72           if Values['StreamWeb'] <> '' then
    73             TuneUp := MakeLink('Naladit', Values['StreamWeb']);
    74           if Values['Stream'] <> '' then
    75             TuneUp := MakeLink('Naladit', NavigationLink('/tv/playlist?id=' + Values['ShortName']));
    76           Text := Text + '<tr><td>' + MakeLink(Values['Name'], Values['Homepage']) +
     72          if Items['StreamWeb'] <> '' then
     73            TuneUp := MakeLink('Naladit', Items['StreamWeb']);
     74          if Items['Stream'] <> '' then
     75            TuneUp := MakeLink('Naladit', NavigationLink('/tv/playlist?id=' + Items['ShortName']));
     76          Text := Text + '<tr><td>' + MakeLink(Items['Name'], Items['Homepage']) +
    7777            '</td><td align="center">' +
    78             Values['Language'] + '</td><td align="center">' + Values['Category'] + '</td>' +
     78            Items['Language'] + '</td><td align="center">' + Items['Category'] + '</td>' +
    7979            '<td>' + TuneUp + '</td></tr>';
    8080        end;
     
    9999  I: Integer;
    100100  Text: string;
     101  Id: string;
    101102begin
    102103  with TWebSession(HandlerData) do begin
    103       Response.Headers.Add('Content-Type', 'audio/mpegurl');
    104       Response.Headers.Add('Content-Disposition', 'attachment; filename=playlist.m3u');
    105       try
    106         DbRows := TDbRows.Create;
     104    Response.Headers.Add('Content-Type', 'audio/mpegurl');
     105    Response.Headers.Add('Content-Disposition', 'attachment; filename=playlist.m3u');
     106    try
     107      DbRows := TDbRows.Create;
    107108
    108109      Text := '#EXTM3U' + LineEnding;
    109       if Request.Query.SearchKey('id') <> -1 then begin
    110         Database.Select(DbRows, 'TV', '*', ' (`Stream` <> "") AND (`ShortName`="' + Database.EscapeString(Request.Query.Values['id']) + '") ');
     110      if Request.Query.TryGetValue('id', Id) then begin
     111        Database.Select(DbRows, 'TV', '*', ' (`Stream` <> "") AND (`ShortName`="' + Database.EscapeString(Id) + '") ');
    111112        if DbRows.Count > 0 then begin
    112           Text := Text + '#EXTINF:0,' + DbRows[0].Values['Name'] + LineEnding
    113           + DbRows[0].Values['Stream'] + LineEnding;
     113          Text := Text + '#EXTINF:0,' + DbRows[0].Items['Name'] + LineEnding
     114          + DbRows[0].Items['Stream'] + LineEnding;
    114115        end;
    115116      end else begin
    116117        Database.Select(DbRows, 'TV', '*', ' (`Stream` <> "") ORDER BY `Name` ');
    117118        for I := 0 to DbRows.Count - 1 do begin
    118           Text := Text + '#EXTINF:0,' + DbRows[I].Values['Name'] + LineEnding
    119           + DbRows[I].Values['Stream'] + LineEnding;
     119          Text := Text + '#EXTINF:0,' + DbRows[I].Items['Name'] + LineEnding
     120          + DbRows[I].Items['Stream'] + LineEnding;
    120121        end;
    121122      end;
    122123      Response.Content.WriteString(Text);
    123124
    124       finally
    125         DbRows.Free;
    126       end
     125    finally
     126      DbRows.Free;
     127    end
    127128  end;
    128129end;
  • trunk/Modules/User/UUser.pas

    r137 r138  
    55uses
    66  Classes, SysUtils, synacode, USqlDatabase, UCommon, UHTTPServer,
    7   SpecializedDictionary;
     7  UGenerics;
    88
    99const
     
    6262  DbRows: TDbRows;
    6363  Id: Integer;
    64 begin
    65   try
    66     DbRows := TDbRows.Create;
    67     if HandlerData.Request.Cookies.SearchKey('SessionId') <> -1 then begin
     64  SessionId: string;
     65begin
     66  try
     67    DbRows := TDbRows.Create;
     68    if HandlerData.Request.Cookies.TryGetValue('SessionId', SessionId) then begin
    6869    Database.Query(DbRows, 'SELECT * FROM `UserOnline` WHERE `SessionId`="' +
    69       HandlerData.Request.Cookies.Values['SessionId'] + '"');
     70      SessionId + '"');
    7071    if DbRows.Count > 0 then begin
    7172      // Update exited
    72       Id := StrToInt(DbRows[0].Values['Id']);
    73       if DbRows[0].Values['User'] = '' then User := UnknownUser
    74         else User := StrToInt(DbRows[0].Values['User']);
     73      Id := StrToInt(DbRows[0].Items['Id']);
     74      if DbRows[0].Items['User'] = '' then User := UnknownUser
     75        else User := StrToInt(DbRows[0].Items['User']);
    7576      Database.Query(DbRows, 'UPDATE `UserOnline` SET `ActivityTime` = NOW() WHERE `Id`=' + IntToStr(Id));
    7677    end else begin
    7778      // Create new record
    7879      Database.Query(DbRows, 'INSERT INTO `UserOnline` (`User`, `ActivityTime`, `SessionId`, `ScriptName`) ' +
    79         'VALUES (NULL, NOW(), "' + HandlerData.Request.Cookies.Values['SessionId'] + '", "")');
     80        'VALUES (NULL, NOW(), "' + SessionId + '", "")');
    8081      Id := Database.LastInsertId;
    8182      User := UnknownUser;
     
    9091var
    9192  DbRows: TDbRows;
     93  SessionId: string;
    9294begin
    9395  Logout;
     96  if HandlerData.Request.Cookies.TryGetValue('SessionId', SessionId) then
    9497  try
    9598    DbRows := TDbRows.Create;
     
    97100    if DbRows.Count > 0 then begin
    98101      Database.Query(DbRows, 'UPDATE `UserOnline` SET `User` = ' + IntToStr(User) + ', `LoginTime` = NOW() WHERE `SessionId`="' +
    99         HandlerData.Request.Cookies.Values['SessionId'] + '"');
     102        SessionId + '"');
    100103      Self.User := User;
    101104    end else
     
    109112var
    110113  DbRows: TDbRows;
     114  SessionId: string;
    111115begin
    112116  if Id = UnknownUser then Update;
    113117  if User <> UnknownUser then begin
     118    if HandlerData.Request.Cookies.TryGetValue('SessionId', SessionId) then
    114119    try
    115120      DbRows := TDbRows.Create;
    116121      Database.Query(DbRows, 'UPDATE `UserOnline` SET `User` = NULL WHERE `SessionId`="' +
    117         HandlerData.Request.Cookies.Values['SessionId'] + '"');
     122        SessionId + '"');
    118123    finally
    119124      DbRows.Free;
     
    197202    DbRows := TDbRows.Create;
    198203    Database.Query(DbRows, 'SELECT `Id` FROM `User` WHERE `Name`="' + Name + '"');
    199     if DbRows.Count = 1 then Result := StrToInt(DbRows[0].Items[0].Value)
     204    if DbRows.Count = 1 then Result := StrToInt(DbRows[0].Items['Id'])
    200205      else Result := UnknownUser;
    201206  finally
     
    212217    Database.Query(DbRows, 'SELECT `Id` FROM `User` WHERE `Name`="' + Name + '" AND ' +
    213218      '`Password` = SHA1(CONCAT("' + Password + '", Salt))');
    214     if DbRows.Count = 1 then Result := StrToInt(DbRows[0].Items[0].Value)
     219    if DbRows.Count = 1 then Result := StrToInt(DbRows[0].Items['Id'])
    215220      else Result := UnknownUser;
    216221  finally
     
    228233    Database.Query(DbRows, 'SELECT * FROM `User` WHERE `Id`="' + IntToStr(Id) + '"');
    229234    if DbRows.Count = 1 then begin
    230       Name := DbRows[0].Values['Name'];
    231       FullName := DbRows[0].Values['FullName'];
    232       Email := DbRows[0].Values['Email'];
     235      Name := DbRows[0].Items['Name'];
     236      FullName := DbRows[0].Items['FullName'];
     237      Email := DbRows[0].Items['Email'];
    233238    end else
    234239      raise ENotFound.Create(Format(SUserNotFound, [IntToStr(Id)]));
     
    254259    try
    255260      DbRows2 := TDbRows.Create;
    256       OperationId := StrToInt(DbRows[0].Values['Id']);
     261      OperationId := StrToInt(DbRows[0].Items['Id']);
    257262
    258263      // Check user-operation relation
     
    268273        '`User` = ' + IntToStr(Id) + ' AND `AssignedGroup` IS NOT NULL');
    269274      if DbRows2.Count > 0 then begin
    270         if CheckGroupPermission(StrToInt(DbRows2[0].Values['AssignedGroup']), OperationId) then begin
     275        if CheckGroupPermission(StrToInt(DbRows2[0].Items['AssignedGroup']), OperationId) then begin
    271276          Result := True;
    272277          Exit;
     
    301306        '`User` = ' + IntToStr(Id) + ' AND `AssignedGroup` IS NOT NULL');
    302307      if DbRows2.Count > 0 then begin
    303         if CheckGroupPermission(StrToInt(DbRows2[0].Values['AssignedGroup']), Operation) then begin
     308        if CheckGroupPermission(StrToInt(DbRows2[0].Items['AssignedGroup']), Operation) then begin
    304309          Result := True;
    305310          Exit;
  • trunk/Modules/User/UUserControlPage.pas

    r137 r138  
    8787      AddNewAction('Přihlásit', 'Login');
    8888    end;
    89     if HandlerData.Request.Post.SearchKey('Login') <> -1 then begin
     89    if HandlerData.Request.Post.ContainsKey('Login') then begin
    9090      Form.Load(HandlerData.Request.Post);
    91       with THtmlString(SubItems.AddNew(THtmlString.Create)) do
     91      with SubItems.AddString do
    9292        Text := 'Přihlášení uživatele: ' + TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value;
    9393      UserId := ModuleUser.User.GetIdByNamePassword(TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value,
    9494        TQueryFormGroup(Form.Groups[0]).Rows.FindByName('Password').Value.Value);
    9595      if UserId = -1 then begin
    96         with THtmlString(SubItems.AddNew(THtmlString.Create)) do
     96        with SubItems.AddString do
    9797          Text := '<br/>Chybné jméno nebo heslo';
    9898      end else ModuleUser.UserOnline.Login(UserId);
    9999      Form.Free;
    100100    end else
    101       SubItems.AddNew(Form);
     101      SubItems.Add(Form);
    102102  end;
    103103end;
     
    144144      AddNewAction('Registrovat', 'Register');
    145145    end;
    146     if HandlerData.Request.Post.SearchKey('Register') <> -1 then
     146    if HandlerData.Request.Post.ContainsKey('Register') then
    147147    with HandlerData.Request do begin
    148148      Form.Load(HandlerData.Request.Post);
    149       with THtmlString(SubItems.AddNew(THtmlString.Create)) do
     149      with SubItems.AddString do
    150150        Text := 'Registrace uživatele: ' + TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value;
    151151      ModuleUser.User.Add(TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value,
     
    156156      if UserId <> -1 then ModuleUser.UserOnline.Login(UserId);
    157157      Form.Free;
    158     end else SubItems.AddNew(Form);
     158    end else SubItems.Add(Form);
    159159  end;
    160160end;
     
    164164  with TWebSession(HandlerData), Core, HtmlDocument.Body do begin
    165165    ModuleUser.UserOnline.Logout;
    166     with THtmlString(SubItems.AddNew(THtmlString.Create)) do
     166    with SubItems.AddString do
    167167      Text := 'Uživatel odhlášen';
    168168  end;
     
    213213      AddNewAction('Uložit', 'Save');
    214214    end;
    215     if HandlerData.Request.Post.SearchKey('Save') <> -1 then
     215    if HandlerData.Request.Post.ContainsKey('Save') then
    216216    with HandlerData.Request do begin
    217217      Form.Load(HandlerData.Request.Post);
    218       with THtmlString(SubItems.AddNew(THtmlString.Create)) do
     218      with SubItems.AddString do
    219219        Text := 'Profil uživatele: ' + TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value + ' uložen';
    220220      ModuleUser.User.Name := TQueryFormGroup(Form.Groups[0]).Rows.FindByName('UserName').Value.Value;
     
    223223      ModuleUser.User.Save;
    224224      Form.Free;
    225     end else SubItems.AddNew(Form);
     225    end else SubItems.Add(Form);
    226226  end;
    227227end;
  • trunk/Modules/ZdechovNET/UAboutPage.lfm

    r97 r138  
    11object AboutPage: TAboutPage
    22  OldCreateOrder = False
     3  Raw = False
    34  Caption = 'Úvod'
    45  OnProduce = DataModuleProduce
    5   Height = 206
    6   HorizontalOffset = 259
    7   VerticalOffset = 250
    8   Width = 407
     6  Height = 309
     7  HorizontalOffset = 389
     8  VerticalOffset = 375
     9  Width = 611
     10  PPI = 144
    911end
  • trunk/Modules/ZdechovNET/UAboutPage.pas

    r137 r138  
    1212  TAboutPage = class(TWebPage)
    1313    procedure DataModuleProduce(HandlerData: THTTPHandlerData);
    14   private
    15     { private declarations }
    1614  public
    1715    ModuleUser: TModuleUser;
     
    3937  with TWebSession(HandlerData) do begin
    4038    ModuleUser.LoadUserInfo;
    41     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     39    with HtmlDocument.Body, SubItems.AddString do begin
    4240      Text := '<table><tr><td style="vertical-align: top;">' +
    4341        '<a href="' + NavigationLink('/images/pokryti.jpg') + '">' +
     
    8886        for I := 0 to DbRows.Count - 1 do begin
    8987          Text := Text + '<div>' +
    90             '<strong>' + DbRows[I].Values['Title'] + '</strong> ' +
    91             '<strong>(' + HumanDate(SQLToDateTime(DbRows[I].Values['Time'])) + ')</strong>' +
     88            '<strong>' + DbRows[I].Items['Title'] + '</strong> ' +
     89            '<strong>(' + HumanDate(SQLToDateTime(DbRows[I].Items['Time'])) + ')</strong>' +
    9290            '<br/>' +
    93             DbRows[I].Values['Text'] + '</div></br>';
     91            DbRows[I].Items['Text'] + '</div></br>';
    9492        end;
    9593      finally
  • trunk/Modules/ZdechovNET/UContactPage.lfm

    r97 r138  
    11object ContactPage: TContactPage
    22  OldCreateOrder = False
     3  Raw = False
    34  Caption = 'Kontakt'
    45  OnProduce = DataModuleProduce
    5   Height = 186
    6   HorizontalOffset = 295
    7   VerticalOffset = 245
    8   Width = 496
     6  Height = 279
     7  HorizontalOffset = 443
     8  VerticalOffset = 368
     9  Width = 744
     10  PPI = 144
    911end
  • trunk/Modules/ZdechovNET/UContactPage.pas

    r135 r138  
    3131procedure TContactPage.DataModuleProduce(HandlerData: THTTPHandlerData);
    3232begin
    33   with TWebSession(HandlerData), HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     33  with TWebSession(HandlerData), HtmlDocument.Body, SubItems.AddString do begin
    3434    ModuleUser.LoadUserInfo;
    3535    Text := '<strong>Kontaktní informace</strong><br/>' +
  • trunk/Modules/ZdechovNET/UDocumentsPage.pas

    r135 r138  
    3535  with TWebSession(HandlerData) do begin
    3636    ModuleUser.LoadUserInfo;
    37     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     37    with HtmlDocument.Body, SubItems.AddString do begin
    3838      Text := Text + '<strong>Úřední dokumenty:</strong><br/>' +
    3939        IconedLink(NavigationLink('/docs/rozhrani.pdf'), 'Technická specifikace účastnických rozhraní') + ' ' +
  • trunk/Modules/ZdechovNET/UHistoryPage.pas

    r135 r138  
    3939  with TWebSession(HandlerData) do begin
    4040    ModuleUser.LoadUserInfo;
    41     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     41    with HtmlDocument.Body, SubItems.AddString do begin
    4242      Text := '<table>';
    4343      try
     
    4646        for I := 0 to DbRows.Count - 1 do begin
    4747          Text := Text + '<tr><td style="text-align: right; vertical-align: top;">' +
    48             HumanDate(SQLToDateTime(DbRows[I].Values['Date'])) + '&nbsp;- </td><td>' +
    49             DbRows[I].Values['Text'] + '</td></tr>';
     48            HumanDate(SQLToDateTime(DbRows[I].Items['Date'])) + '&nbsp;- </td><td>' +
     49            DbRows[I].Items['Text'] + '</td></tr>';
    5050        end;
    5151      finally
  • trunk/Modules/ZdechovNET/UHostingPage.pas

    r135 r138  
    3939  with TWebSession(HandlerData) do begin
    4040    ModuleUser.LoadUserInfo;
    41     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     41    with HtmlDocument.Body, SubItems.AddString do begin
    4242      Text := 'V nabídce je provoz virtualizovaných Linuxových serverů dle dohodnutých parameterů.<br/><br/>' +
    4343      '<strong>Standardní varianty:</strong><br/>' +
     
    4848        Database.Query(DbRows, 'SELECT * FROM VPSHosting ORDER BY Price DESC');
    4949        for I := 0 to DbRows.Count - 1 do
    50           Text := Text + '<tr><td>' + DbRows[I].Values['Name'] + '</td><td align="center">' +
    51             DbRows[I].Values['Internet'] + '</td><td align="center">' + DbRows[I].Values['Memory'] +
    52             '</td><td align="center">' + DbRows[I].Values['Space'] + '</td><td align="center">' +
    53             DbRows[I].Values['CPU'] + '</td><td align="center">' + DbRows[I].Values['Price'] + '</td></tr>';
     50          Text := Text + '<tr><td>' + DbRows[I].Items['Name'] + '</td><td align="center">' +
     51            DbRows[I].Items['Internet'] + '</td><td align="center">' + DbRows[I].Items['Memory'] +
     52            '</td><td align="center">' + DbRows[I].Items['Space'] + '</td><td align="center">' +
     53            DbRows[I].Items['CPU'] + '</td><td align="center">' + DbRows[I].Items['Price'] + '</td></tr>';
    5454      finally
    5555        DbRows.Free;
     
    6969        Database.Query(DbRows, 'SELECT * FROM `HostedProject` WHERE `Active`=1 AND `WebHosting`=0');
    7070        for I := 0 to DbRows.Count - 1 do
    71           if DbRows[I].Values['Homepage'] <> '' then
    72           Text := Text + '<li><a href="' + DbRows[I].Values['Homepage'] + '">' +
    73             DbRows[I].Values['Name'] + '</a></li>'
    74             else Text := Text + '<li>' + DbRows[I].Values['Name'] + '</li>';
     71          if DbRows[I].Items['Homepage'] <> '' then
     72          Text := Text + '<li><a href="' + DbRows[I].Items['Homepage'] + '">' +
     73            DbRows[I].Items['Name'] + '</a></li>'
     74            else Text := Text + '<li>' + DbRows[I].Items['Name'] + '</li>';
    7575        Text := Text + '</ul>';
    7676      finally
     
    8383        Database.Query(DbRows, 'SELECT * FROM `HostedProject` WHERE `Active`=1 AND `WebHosting`=1');
    8484        for I := 0 to DbRows.Count - 1 do
    85           Text := Text + '<li><a href="' + DbRows[I].Values['Homepage'] + '">' +
    86             DbRows[I].Values['Name'] + '</a></li>';
     85          Text := Text + '<li><a href="' + DbRows[I].Items['Homepage'] + '">' +
     86            DbRows[I].Items['Name'] + '</a></li>';
    8787        Text := Text + '</ul>';
    8888      finally
  • trunk/Modules/ZdechovNET/UIPTVPage.pas

    r137 r138  
    8989  with TWebSession(HandlerData) do begin
    9090    ModuleUser.LoadUserInfo;
    91     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     91    with HtmlDocument.Body, SubItems.AddString do begin
    9292      Channels := TChannels.Create;
    9393      with Channels do begin
  • trunk/Modules/ZdechovNET/UInternetPage.pas

    r135 r138  
    3535  with TWebSession(HandlerData) do begin
    3636    ModuleUser.LoadUserInfo;
    37     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     37    with HtmlDocument.Body, SubItems.AddString do begin
    3838      Text := Text + 'V síti je možné využít také doplňkovou nabídku výhodného připojení k internetu. ' +
    3939      'Tarify se liší v základu minimální a maximální rychlostí. U všech placených tarifů je také k dispozici bonusová sdílená rychlost z volné kapacity sítě.<br/><br/>' +
  • trunk/Modules/ZdechovNET/ULinksPage.pas

    r135 r138  
    3333procedure TLinksPage.DataModuleProduce(HandlerData: THTTPHandlerData);
    3434begin
    35   with TWebSession(HandlerData), HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     35  with TWebSession(HandlerData), HtmlDocument.Body, SubItems.AddString do begin
    3636    ModuleUser.LoadUserInfo;
    3737    Text := '<strong>Odkazy související s obcí:</strong><br/>' +
    3838
    39     '<a href="http://www.zdechov.cz/">Obec Zděchov</a> - oficiální stránky  obce<br/>' +
    40     '<a href="http://zdechovskagrapa.sweb.cz/">Zděchovská grapa</a> - místní motokrosové závody<br/>' +
    41     '<a href="http://skiareal.zdechov.net/">Skiareál</a> - areál se sjezdovkou pro lyžaře i snowboardisty<br/>' +
    42     '<a href="http://sdh.zdechov.net/">SDH Zděchov</a> - Sbor Dobrovolných Hasičů Zděchov<br/>' +
    43     '<a href="http://fotbal.zdechov.net/">TJ Sokol Zděchov</a> - stránky věnované Zděchovskému fotbalovému týmu<br/>' +
    44     '<a href="http://farnost.zdechov.net/">Farnost Zděchov</a> - informace k místní farnosti<br/>' +
     39    '<a href="https://www.zdechov.cz/">Obec Zděchov</a> - oficiální stránky  obce<br/>' +
     40    '<a href="https://motokros.zdechov.net/">Zděchovská grapa</a> - místní motokrosové závody<br/>' +
     41    '<a href="https://skiareal.zdechov.net/">Skiareál</a> - areál se sjezdovkou pro lyžaře i snowboardisty<br/>' +
     42    '<a href="https://sdh.zdechov.net/">SDH Zděchov</a> - Sbor Dobrovolných Hasičů Zděchov<br/>' +
     43    '<a href="https://fotbal.zdechov.net/">TJ Sokol Zděchov</a> - stránky věnované Zděchovskému fotbalovému týmu<br/>' +
     44    '<a href="https://farnost.zdechov.net/">Farnost Zděchov</a> - informace k místní farnosti<br/>' +
    4545    '<br/>' +
    4646
    4747    '<strong>Odkazy související s okolím:</strong><br/>' +
    48     '<a href="http://www.valassko-hornovsacko.cz/">Valašsko - Horní Vsacko</a> - informační stránky oblasti<br/>' +
     48    '<a href="https://www.valassko-hornovsacko.cz/">Valašsko - Horní Vsacko</a> - informační stránky oblasti<br/>' +
    4949    '<br/>' +
    5050
     
    5757
    5858    '<strong>Komunitní sítě v okolí:</strong><br/>' +
    59     '<a href="http://www.hovnet.cz/">Hovnet</a> - síť v Hovězí, Janové, Huslenkách a dalších obcích<br/>' +
     59    '<a href="https://www.hovnet.cz/">Hovnet</a> - síť v Hovězí, Janové, Huslenkách a dalších obcích<br/>' +
    6060    //'<a href="http://czvk3.net/">czvk3net</a> - síť ve Valašských Kloboucích<br/>' +
    61     '<a href="http://hvfree.net/">HvFree.net</a> - síť v Tylovicích, Hážovicích, Viganticích a Hutisku<br/>' +
     61    '<a href="https://hvfree.net/">HvFree.net</a> - síť v Tylovicích, Hážovicích, Viganticích a Hutisku<br/>' +
    6262    '<a href="http://www.ustinet.cz/">Ústí.Net</a> - síť v Ústí u Vsetína<br/>' +
    6363    '<br/>';
  • trunk/Modules/ZdechovNET/UModuleZdechovNET.pas

    r137 r138  
    264264procedure TModuleZdechovNET.Upgrade;
    265265begin
    266   inherited Upgrade;
     266  inherited;
    267267end;
    268268
     
    277277begin
    278278  with Session do
    279   with TXmlTag(HtmlDocument.Body.SubItems.AddNew(TXmlTag.Create)) do begin
    280     Name := 'ul';
    281     Attributes.Values['class'] := 'Footer';
    282     with TXmlTag(SubElements.AddNew(TXmlTag.Create)) do begin
    283       Name := 'li';
    284       with TXmlString(SubElements.AddNew(TXmlString.Create)) do begin
    285         Text := TCore(MainModule).Admin;
     279  with HtmlDocument.Body.SubItems.AddList do begin
     280    ClassId := 'Footer';
     281    with SubItems.AddString do begin
     282      Text := TCore(MainModule).Admin;
     283    end;
     284    with SubItems.AddString do begin
     285      Text := TCore(MainModule).AdminEmail;
     286    end;
     287    if TCore(MainModule).ShowRuntimeInfo then begin
     288      with SubItems.AddString do begin
     289        Text := 'Doba generování: ' +
     290          FloatToStr(Round(((Now - TimeStart) / OneMillisecond) * 100) / 100) + ' s / '; // + ini_get('max_execution_time') + ' s';
     291      end;
     292      with SubItems.AddString do begin
     293        //Text := 'Použitá paměť: '  + System.PrefixMultiplier.AddPrefixMultipliers(memory_get_peak_usage(FALSE), 'B').' / '.ini_get('memory_limit').'B';
    286294      end;
    287295    end;
    288     with TXmlTag(SubElements.AddNew(TXmlTag.Create)) do begin
    289       Name := 'li';
    290       with TXmlString(SubElements.AddNew(TXmlString.Create)) do begin
    291         Text := TCore(MainModule).AdminEmail;
    292       end;
    293     end;
    294     if TCore(MainModule).ShowRuntimeInfo then begin
    295       with TXmlTag(SubElements.AddNew(TXmlTag.Create)) do begin
    296         Name := 'li';
    297         with TXmlString(SubElements.AddNew(TXmlString.Create)) do begin
    298           Text := 'Doba generování: ' +
    299             FloatToStr(Round(((Now - TimeStart) / OneMillisecond) * 100) / 100) + ' s / '; // + ini_get('max_execution_time') + ' s';
    300         end;
    301       end;
    302       with TXmlTag(SubElements.AddNew(TXmlTag.Create)) do begin
    303         Name := 'li';
    304         with TXmlString(SubElements.AddNew(TXmlString.Create)) do begin
    305           //Text := 'Použitá paměť: '  + System.PrefixMultiplier.AddPrefixMultipliers(memory_get_peak_usage(FALSE), 'B').' / '.ini_get('memory_limit').'B';
    306         end;
    307       end;
    308     end;
    309296  end;
    310297end;
    311298
    312299procedure TModuleZdechovNET.TopMenu(Session: TWebSession);
    313 begin
    314   with Session, THtmlString(HtmlDocument.Body.SubItems.InsertNew(1, THtmlString.Create)) do begin
     300var
     301  Output: THtmlString;
     302begin
     303  Output := THtmlString.Create;
     304  Session.HtmlDocument.Body.SubItems.Insert(1, Output);
     305  with Output do begin
    315306    Text := '<div class="Navigation">';
    316307    // Visitor
     
    326317      '<li>' + MakeLink('Kamery', NavigationLink('/kamery/')) + '</li>' +
    327318      '<li><a href="https://mail.zdechov.net/">Pošta</a></li>' +
    328       '<li><a href="http://wiki.zdechov.net/">Wiki</a></li>' +
     319      '<li><a href="https://wiki.zdechov.net/">Wiki</a></li>' +
    329320      '</ul><ul class="MenuItem2">'; //<li>&nbsp;</li>';
    330321    if False and Assigned(ModuleBase.Pages.FindByName('uzivatel')) then begin
     
    356347  with ASession do begin
    357348    if Page.Raw then begin
    358       Response.Content.WriteString(THtmlString(HtmlDocument.Body.SubItems[0]).Text);
     349      Response.Content.WriteString(HtmlDocument.Body.AsXmlElement.AsString);
    359350    end else begin
    360351      HtmlDocument.ContentLanguage := 'cs';
  • trunk/Modules/ZdechovNET/UNetworkPage.pas

    r135 r138  
    3737  with TWebSession(HandlerData) do begin
    3838    ModuleUser.LoadUserInfo;
    39     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     39    with HtmlDocument.Body, SubItems.AddString do begin
    4040      Text := MakeLink('Dokumenty', NavigationLink('/dokumenty/')) + '<br/>' +
    4141        MakeLink('Historie', NavigationLink('/historie/')) + '<br/>' +
  • trunk/Modules/ZdechovNET/UPlansPage.pas

    r135 r138  
    3939  with TWebSession(HandlerData) do begin
    4040    ModuleUser.LoadUserInfo;
    41     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     41    with HtmlDocument.Body, SubItems.AddString do begin
    4242      Text := '<table>';
    4343      try
     
    4747        Database.Query(DbRows, 'SELECT * FROM `Plans` WHERE (`TimeFinished` IS NULL) AND (`Public`=1) ORDER BY `TimeCreate`');
    4848        for I := 0 to DbRows.Count - 1 do begin
    49           Text := Text + '<li>' + DbRows[I].Values['Description'] + '</li>';
     49          Text := Text + '<li>' + DbRows[I].Items['Description'] + '</li>';
    5050        end;
    5151        Text := Text + '</ul></div><br/>';
     
    5555        Database.Query(DbRows, 'SELECT * FROM `Plans` WHERE (`TimeFinished` IS NOT NULL) AND (`Public`=1) ORDER BY `TimeCreate`');
    5656        for I := 0 to DbRows.Count - 1 do begin
    57           Text := Text + '<li>' + DbRows[I].Values['Description'] + '<br/>' +
    58             '<i style="padding-left: 30px;">' + DbRows[I].Values['Conclusion'] + '</i></li>';
     57          Text := Text + '<li>' + DbRows[I].Items['Description'] + '<br/>' +
     58            '<i style="padding-left: 30px;">' + DbRows[I].Items['Conclusion'] + '</i></li>';
    5959        end;
    6060        Text := Text + '</ul></div><br/>';
  • trunk/Modules/ZdechovNET/UProjectsPage.pas

    r135 r138  
    3939  with TWebSession(HandlerData) do begin
    4040    ModuleUser.LoadUserInfo;
    41     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     41    with HtmlDocument.Body, SubItems.AddString do begin
    4242      try
    4343        DbRows := TDbRows.Create;
     
    4747        Database.Query(DbRows, 'SELECT * FROM `Plans` ORDER BY `TimeCreate` DESC');
    4848        for I := 0 to DbRows.Count - 1 do begin
    49           Text := Text + '<tr><td>' + DbRows[I].Values['TimeCreate'] + '</td>' +
    50             '<td>' + DbRows[I].Values['TimeFinished'] + '</td>' +
    51             '<td>' + DbRows[I].Values['Description'] + '</td>' +
    52             '<td>' + DbRows[I].Values['Public'] + '</td></tr>';
     49          Text := Text + '<tr><td>' + DbRows[I].Items['TimeCreate'] + '</td>' +
     50            '<td>' + DbRows[I].Items['TimeFinished'] + '</td>' +
     51            '<td>' + DbRows[I].Items['Description'] + '</td>' +
     52            '<td>' + DbRows[I].Items['Public'] + '</td></tr>';
    5353        end;
    5454        Text := Text + '</table>';
  • trunk/Modules/ZdechovNET/URobotsPage.pas

    r137 r138  
    3737  with TWebSession(HandlerData) do begin
    3838    ModuleUser.LoadUserInfo;
    39     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     39    with HtmlDocument.Body, SubItems.AddString do begin
    4040      Text := 'User-agent: *' + LineEnding +
    4141        'Disallow: /*?';
  • trunk/Modules/ZdechovNET/UVoIPPage.pas

    r135 r138  
    3535  with TWebSession(HandlerData) do begin
    3636    ModuleUser.LoadUserInfo;
    37     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     37    with HtmlDocument.Body, SubItems.AddString do begin
    3838      Text := 'Volejte levněji do pevných a mobilních sítí s sekundovou tarifikací a bez měsíčního paušálu.' +
    3939      ' A v rámci sítě a těch co mají v obci VoIP od stejného operátora dokonce zdarma. <br/>' +
  • trunk/Modules/ZdechovNET/UWebCamPage.pas

    r137 r138  
    4545  Value: Integer;
    4646  NotFound: Boolean;
     47  WidthValue: string;
    4748begin
    4849  with TWebSession(HandlerData) do begin
    4950    ModuleUser.LoadUserInfo;
    50     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     51    with HtmlDocument.Body, SubItems.AddString do begin
    5152      Text := '';
    5253      CameraId := -1;
     
    6465      //HandlerData.Request.Query.Values['W'] := 'dsd';
    6566      //HandlerData.Request.Query.Values['H'] := 'dsd';
    66       if (HandlerData.Request.Query.SearchKey('W') = -1) then begin
    67         ImageWidth := 640;
    68       end else begin
    69         ImageWidth := StrToInt(HandlerData.Request.Query.Values['W']);
    70       end;
     67      if HandlerData.Request.Query.TryGetValue('W', WidthValue) then
     68        ImageWidth := StrToInt(WidthValue)
     69        else ImageWidth := 640;
    7170
    7271      Text := Text + '<table style="width: 100%"><tr><td style="width: 20%" valign="top">' +
     
    8483        Database.Query(DbRows, 'SELECT * FROM `Webcam` WHERE `Enabled`=1');
    8584        for I := 0 to DbRows.Count - 1 do begin
    86           Text := Text + MakeLink(DbRows[I].Values['Name'], NavigationLink(
    87             '/kamery/' + DbRows[I].Values['Id'] + '/?W=' + IntToStr(ImageWidth))) + '<br/>';
     85          Text := Text + MakeLink(DbRows[I].Items['Name'], NavigationLink(
     86            '/kamery/' + DbRows[I].Items['Id'] + '/?W=' + IntToStr(ImageWidth))) + '<br/>';
    8887        end;
    8988      finally
     
    125124    ImageWidthThumb := 160;
    126125    for I := 0 to DbRows.Count - 1 do begin
    127       ImageHeightThumb := Round(ImageWidthThumb * StrToInt(DbRows[I].Values['Height']) / StrToInt(DbRows[I].Values['Width']));
    128       WebCamImage := 'images/webcam/' + DbRows[I].Values['ImageName'];
     126      ImageHeightThumb := Round(ImageWidthThumb * StrToInt(DbRows[I].Items['Height']) / StrToInt(DbRows[I].Items['Width']));
     127      WebCamImage := 'images/webcam/' + DbRows[I].Items['ImageName'];
    129128      Result := Result + '<span align="center" valign="middle" style="vertical-align: middle;">' + //DbRows[I].Values['Name'] + '<br/>' +
    130         '<a href="' + NavigationLink('/kamery/' + DbRows[I].Values['Id'] + '/?W=' + IntToStr(ImageWidth)) + '">' +
     129        '<a href="' + NavigationLink('/kamery/' + DbRows[I].Items['Id'] + '/?W=' + IntToStr(ImageWidth)) + '">' +
    131130        '<img name="theImage" src="' + NavigationLink('/' + WebCamImage) + '" width="' +
    132131        IntToStr(ImageWidthThumb) + '" height="' + IntToStr(ImageHeightThumb) + '" alt="' +
    133         DbRows[I].Values['Name'] + '"/></a></span> ';
     132        DbRows[I].Items['Name'] + '"/></a></span> ';
    134133    end;
    135134  finally
     
    153152      IntToStr(Id) + ') AND (`Enabled`=1)');
    154153    if DbRows.Count > 0 then begin
    155       WebCamImage := 'images/webcam/' + DbRows[0].Values['ImageName'];
    156       RefreshInterval := StrToInt(DbRows[0].Values['ImagePeriod']);
    157       ImageHeight := Round(ImageWidth * StrToInt(DbRows[0].Values['Height']) / StrToInt(DbRows[0].Values['Width']));
     154      WebCamImage := 'images/webcam/' + DbRows[0].Items['ImageName'];
     155      RefreshInterval := StrToInt(DbRows[0].Items['ImagePeriod']);
     156      ImageHeight := Round(ImageWidth * StrToInt(DbRows[0].Items['Height']) / StrToInt(DbRows[0].Items['Width']));
    158157
    159158      if FileExists(WebCamImage) then begin
     
    181180          '</script>' + #13#10 +
    182181
    183           '<br /><div align="center">' + DbRows[0].Values['Name'] + '<br/>' +
     182          '<br /><div align="center">' + DbRows[0].Items['Name'] + '<br/>' +
    184183          '<img name="theImageTemp" src="' + NavigationLink('/' + WebCamImage) + '" width="0" height="0" alt="Temp image"/>' +
    185184          '<img name="theImage" src="' + NavigationLink('/' + WebCamImage) + '" width="' + IntToStr(ImageWidth) +
    186185          '" height="' + IntToStr(ImageHeight) + '" alt="' +
    187           DbRows[0].Values['Name'] + '"/></div>';
     186          DbRows[0].Items['Name'] + '"/></div>';
    188187      end else Result := Result + '<br />Obrázek nenalezen.<br /><br />';
    189188      Result := Result + '<br/><div align="center">';
    190189      if LastFileDate <> '' then Result := Result + 'Aktualizace: <span id="lasttime">' +
    191190        LastFileDate + '</span>, ';
    192       Result := Result + 'Perioda: ' + IntToStr(RefreshInterval) + ' sekund, Typ: ' + DbRows[0].Values['DeviceType'] + '<br />' +
    193         '<br/>' + DbRows[0].Values['Description'];
    194       Result := Result + GetVideoArchive(DbRows[0].Values['Id']) + '</div>';
     191      Result := Result + 'Perioda: ' + IntToStr(RefreshInterval) + ' sekund, Typ: ' +
     192        DbRows[0].Items['DeviceType'] + '<br />' +
     193        '<br/>' + DbRows[0].Items['Description'];
     194      Result := Result + GetVideoArchive(DbRows[0].Items['Id']) + '</div>';
    195195    end else Result := Result + '<br />Id kamery nenalezeno.<br/><br>';
    196196  finally
  • trunk/Packages/Common/Common.lpk

    r137 r138  
    4242    <License Value="Copy left."/>
    4343    <Version Minor="10"/>
    44     <Files Count="31">
     44    <Files Count="32">
    4545      <Item1>
    4646        <Filename Value="StopWatch.pas"/>
     
    179179        <UnitName Value="UTestCase"/>
    180180      </Item31>
     181      <Item32>
     182        <Filename Value="UGenerics.pas"/>
     183        <UnitName Value="UGenerics"/>
     184      </Item32>
    181185    </Files>
    182186    <CompatibilityMode Value="True"/>
  • trunk/Packages/Common/Common.pas

    r137 r138  
    1414  UPersistentForm, UFindFile, UScaleDPI, UTheme, UStringTable, UMetaCanvas,
    1515  UGeometric, UTranslator, ULanguages, UFormAbout, UAboutDialog,
    16   UPixelPointer, UDataFile, UTestCase, LazarusPackageIntf;
     16  UPixelPointer, UDataFile, UTestCase, UGenerics, LazarusPackageIntf;
    1717
    1818implementation
  • trunk/Packages/Common/UCommon.pas

    r137 r138  
    77  {$IFDEF UNIX}baseunix,{$ENDIF}
    88  Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf, Graphics,
    9   FileUtil; //, ShFolder, ShellAPI;
     9  FileUtil, Generics.Collections; //, ShFolder, ShellAPI;
    1010
    1111type
     
    6565function GetFileFilterItemExt(Filter: string; Index: Integer): string;
    6666function IntToBin(Data: Int64; Count: Byte): string;
     67function Implode(Separator: Char; List: TList<string>): string;
    6768function LastPos(const SubStr: String; const S: String): Integer;
    6869function LoadFileToStr(const FileName: TFileName): AnsiString;
     
    313314end;
    314315
     316function Implode(Separator: Char; List: TList<string>): string;
     317var
     318  I: Integer;
     319begin
     320  Result := '';
     321  for I := 0 to List.Count - 1 do begin
     322    Result := Result + List[I];
     323    if I > 0 then Result := Result + Separator;
     324  end;
     325end;
     326
    315327{$IFDEF WINDOWS}
    316328function GetUserName: string;
  • trunk/Packages/CoolWeb/Common/UHtmlClasses.pas

    r137 r138  
    44
    55uses
    6   UXmlClasses, Classes, SysUtils, SpecializedList;
     6  UXmlClasses, Classes, SysUtils, Generics.Collections, UGenerics, UIpAddress;
    77
    88type
    9 
    10   { TDomainAddress }
    11 
    12   TDomainAddress = class(TPersistent)
    13   private
    14     function GetAsString: string;
    15     procedure SetAsString(const Value: string);
    16   public
    17     Levels: TListString;
    18     constructor Create;
    19     destructor Destroy; override;
    20     property AsString: string read GetAsString write SetAsString;
    21   end;
    22 
    23   TAddrClass = (acA, acB, acC, acD, acE);
    24 
    25   { TIpAddress }
    26 
    27   TIpAddress = class(TPersistent)
    28   private
    29     function GetAddrClass: TAddrClass;
    30     function GetAsCardinal: Cardinal;
    31     function GetAsString: string;
    32     function GetBroadcast: Boolean;
    33     procedure SetBroadcast(const Value: Boolean);
    34     procedure SetAsCardinal(const Value: Cardinal);
    35     procedure SetAsString(const Value: string);
    36   public
    37     Octets: array[0..3] of Byte;
    38     procedure Assign(Source: TPersistent); override;
    39     function IsAddressString(Value: string): Boolean;
    40     property AsCardinal: Cardinal read GetAsCardinal write SetAsCardinal;
    41     property AsString: string read GetAsString write SetAsString;
    42     property AddrClass: TAddrClass read GetAddrClass;
    43     property Broadcast: Boolean read GetBroadcast write SetBroadcast;
    44   end;
    45 
    46   THostAddressState = (asDomainName, asIpAddress);
    47   THostAddress = class(TPersistent)
    48   private
    49     function GetAsString: string;
    50     procedure SetAsString(const Value: string);
    51   public
    52     State: THostAddressState;
    53     DomainName: TDomainAddress;
    54     IpAddress: TIpAddress;
    55     constructor Create;
    56     destructor Destroy; override;
    57     property AsString: string read GetAsString write SetAsString;
    58   end;
     9  { TURL }
    5910
    6011  TURL = class(TPersistent)
     
    9041  end;
    9142
     43  THtmlString = class;
     44  THtmlBlock = class;
     45  THtmlList = class;
     46  THtmlInput = class;
     47
     48  { THtmlElements }
     49
     50  THtmlElements = class(TObjectList<THtmlElement>)
     51    function AddString(Text: string = ''): THtmlString;
     52    function AddBlock: THtmlBlock;
     53    function AddList: THtmlList;
     54    function AddInput: THtmlInput;
     55  end;
     56
    9257  TBlockType = (btNoTag, btBlockLevel, btInline);
    9358
     
    9560
    9661  THtmlString = class(THtmlElement)
    97   private
     62  protected
    9863    function GetAsXmlElement: TXmlElement; override;
    9964  public
     
    10570
    10671  THtmlLineBreak = class(THtmlElement)
    107   private
     72  protected
    10873    function GetAsXmlElement: TXmlElement; override;
    10974  public
     
    11681  public
    11782    BlockType: TBlockType;
    118     SubItems: TListObject; // TListObject<THtmlElement>;
     83    SubItems: THtmlElements;
     84    constructor Create;
     85    destructor Destroy; override;
     86  end;
     87
     88  TListType = (ltUnordered, ltOrdered);
     89
     90  { THtmlList }
     91
     92  THtmlList = class(THtmlElement)
     93  protected
     94    function GetAsXmlElement: TXmlElement; override;
     95  public
     96    ListType: TListType;
     97    SubItems: THtmlElements;
    11998    constructor Create;
    12099    destructor Destroy; override;
     
    122101
    123102  THtmlLink = class(THtmlElement)
    124   private
     103  protected
    125104    function GetAsXmlElement: TXmlElement; override;
    126105  public
     
    140119
    141120  THtmlImage = class(THtmlElement)
    142   private
     121  protected
    143122    function GetAsXmlElement: TXmlElement; override;
    144123  public
     
    156135
    157136  THtmlInput = class(THtmlElement)
    158   private
     137  protected
    159138    function GetAsXmlElement: TXmlElement; override;
    160139  public
     
    197176
    198177  THtmlCell = class(THtmlElement)
    199   private
     178  protected
    200179    function GetAsXmlElement: TXmlElement; override;
    201180  public
     
    207186  end;
    208187
     188  { THtmlCells }
     189
     190  THtmlCells = class(TObjectList<THtmlCell>)
     191    function AddCell: THtmlCell;
     192  end;
     193
    209194  { THtmlRow }
    210195
    211196  THtmlRow = class(THtmlElement)
    212   private
    213     function GetAsXmlElement: TXmlElement; override;
    214   public
    215     Cells: TListObject; // TListObject<THtmlCell>
    216     constructor Create;
    217     destructor Destroy; override;
     197  protected
     198    function GetAsXmlElement: TXmlElement; override;
     199  public
     200    Cells: THtmlCells;
     201    constructor Create;
     202    destructor Destroy; override;
     203  end;
     204
     205  { THtmlRows }
     206
     207  THtmlRows = class(TObjectList<THtmlRow>)
     208    function AddRow: THtmlRow;
    218209  end;
    219210
     
    224215    function GetAsXmlElement: TXmlElement; override;
    225216  public
    226     Rows: TListObject; // TListObject<THtmlRow>
     217    Rows: THtmlRows;
    227218    constructor Create;
    228219    destructor Destroy; override;
     
    242233
    243234implementation
    244 
    245 resourcestring
    246   SStringToIPConversionError = 'String to IP address conversion error';
    247235
    248236function LeftCutString(var Source, Output: string; Delimiter: string; Allowed: string = ''): Boolean;
     
    298286end;
    299287
     288{ THtmlCells }
     289
     290function THtmlCells.AddCell: THtmlCell;
     291begin
     292  Result := THtmlCell.Create;
     293  Add(Result);
     294end;
     295
     296{ THtmlRows }
     297
     298function THtmlRows.AddRow: THtmlRow;
     299begin
     300  Result := THtmlRow.Create;
     301  Add(Result);
     302end;
     303
     304{ THtmlList }
     305
     306function THtmlList.GetAsXmlElement: TXmlElement;
     307var
     308  I: Integer;
     309begin
     310  Result := TXmlTag.Create;
     311  with TXmlTag(Result) do begin
     312    case ListType of
     313      ltOrdered: Name := 'ol';
     314      ltUnordered: Name := 'ul';
     315    end;
     316    for I := 0 to SubItems.Count - 1 do begin
     317      with SubElements.AddTag('li') do
     318        SubElements.Add(SubItems[I].AsXmlElement);
     319    end;
     320  end;
     321end;
     322
     323constructor THtmlList.Create;
     324begin
     325  inherited;
     326  SubItems := THtmlElements.Create;
     327end;
     328
     329destructor THtmlList.Destroy;
     330begin
     331  FreeAndNil(SubItems);
     332  inherited;
     333end;
     334
     335{ THtmlElements }
     336
     337function THtmlElements.AddString(Text: string = ''): THtmlString;
     338begin
     339  Result := THtmlString.Create;
     340  Result.Text := Text;
     341  Add(Result);
     342end;
     343
     344function THtmlElements.AddBlock: THtmlBlock;
     345begin
     346  Result := THtmlBlock.Create;
     347  Add(Result);
     348end;
     349
     350function THtmlElements.AddList: THtmlList;
     351begin
     352  Result := THtmlList.Create;
     353  Add(Result);
     354end;
     355
     356function THtmlElements.AddInput: THtmlInput;
     357begin
     358  Result := THtmlInput.Create;
     359  Add(Result);
     360end;
     361
    300362{ THtmlCell }
    301363
     
    319381destructor THtmlCell.Destroy;
    320382begin
    321   Value.Free;
     383  FreeAndNil(Value);
    322384  inherited;
    323385end;
     
    332394  TXmlTag(Result).Name := 'tr';
    333395  for Column := 0 to Cells.Count - 1 do
    334     TXmlTag(Result).SubElements.AddNew(THtmlCell(Cells[Column]).AsXmlElement);
     396    TXmlTag(Result).SubElements.Add(Cells[Column].AsXmlElement);
    335397end;
    336398
    337399constructor THtmlRow.Create;
    338400begin
    339   Cells := TListObject.Create;
     401  Cells := THtmlCells.Create;
    340402end;
    341403
    342404destructor THtmlRow.Destroy;
    343405begin
    344   Cells.Free;
     406  FreeAndNil(Cells);
    345407  inherited;
    346408end;
     
    350412function THtmlTable.GetAsXmlElement: TXmlElement;
    351413var
    352   Row, Column: Integer;
     414  Row: Integer;
    353415begin
    354416  Result := inherited;
     
    356418    Name := 'table';
    357419    for Row := 0 to Rows.Count - 1 do
    358       SubElements.AddNew(THtmlRow(Rows[Row]).AsXmlElement);
     420      SubElements.Add(Rows[Row].AsXmlElement);
    359421  end;
    360422end;
     
    362424constructor THtmlTable.Create;
    363425begin
    364   Rows := TListObject.Create;
     426  Rows := THtmlRows.Create;
    365427end;
    366428
    367429destructor THtmlTable.Destroy;
    368430begin
    369   Rows.Free;
     431  FreeAndNil(Rows);
    370432  inherited;
    371433end;
     
    448510destructor THtmlForm.Destroy;
    449511begin
    450   Action.Free;
     512  FreeAndNil(Action);
    451513  inherited;
    452514end;
     
    465527destructor THtmlDocument.Destroy;
    466528begin
    467   Body.Free;
    468   Styles.Free;
    469   Scripts.Free;
     529  FreeAndNil(Body);
     530  FreeAndNil(Styles);
     531  FreeAndNil(Scripts);
    470532  inherited;
    471533end;
     
    473535function THtmlDocument.GetAsXmlDocument: TXmlDocument;
    474536var
    475   DocType: TXMLTag;
    476   HTMLTag: TXMLTag;
    477537  I: Integer;
    478538begin
    479539  Result := TXmlDocument.Create;
    480540  with Result, Content do begin
    481     DocType := TXMlTag.Create;
    482     DocType.Name := '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"';
    483     Doctype.EndTagSymbol := '';
    484     SubElements.Add(DocType);
    485     HTMLTag := TXMLTag.Create;
    486     with HTMLTag do begin
    487       Name := 'html';
    488       with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin
    489         Name := 'head';
    490         with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin
    491           Name := 'title';
    492           with TXmlString(SubElements[SubElements.Add(TXmlString.Create)]) do begin
    493             Text := Title;
    494           end;
     541    with SubElements.AddTag('!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"') do begin
     542      EndTagSymbol := '';
     543    end;
     544    with SubElements.AddTag('html') do begin
     545      with SubElements.AddTag('head') do begin
     546        with SubElements.AddTag('title') do begin
     547          SubElements.AddString(Title);
    495548        end;
    496         with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin
    497           Name := 'meta';
     549        with SubElements.AddTag('meta') do begin
    498550          Attributes.Add('http-equiv', 'Content-Language');
    499551          Attributes.Add('content', ContentLanguage);
    500552        end;
    501         with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin
    502           Name := 'meta';
     553        with SubElements.AddTag('meta') do begin
    503554          Attributes.Add('http-equiv', 'Content-Type');
    504555          Attributes.Add('content', 'text/html; charset=' + ContentEncoding);
    505556        end;
    506557        for I := 0 to Styles.Count - 1 do
    507         with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin
    508           Name := 'link';
     558        with SubElements.AddTag('link') do begin
    509559          Attributes.Add('rel', 'stylesheet');
    510560          Attributes.Add('href', Styles[I]);
     
    513563        end;
    514564        for I := 0 to Scripts.Count - 1 do
    515         with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin
    516           Name := 'script';
     565        with SubElements.AddTag('script') do begin
    517566          ShringEmpty := False;
    518567          Attributes.Add('type', 'text/javascript');
     
    520569        end;
    521570      end;
    522       with TXmlTag(SubElements[SubElements.Add(TXmlTag.Create)]) do begin
    523         Name := 'body';
     571      with SubElements.AddTag('body') do begin
    524572        SubElements.Add(Body.AsXmlElement);
    525573      end;
    526574    end;
    527     SubElements.Add(HTMLTag);
    528575  end;
    529576end;
     
    534581begin
    535582  inherited;
    536   SubItems := TListObject.Create;
     583  SubItems := THtmlElements.Create;
    537584end;
    538585
    539586destructor THtmlBlock.Destroy;
    540587begin
    541   SubItems.Free;
     588  FreeAndNil(SubItems);
    542589  inherited;
    543590end;
     
    555602    end;
    556603    for I := 0 to SubItems.Count - 1 do
    557       SubElements.Add(THtmlElement(SubItems[I]).AsXmlElement);
     604      SubElements.Add(SubItems[I].AsXmlElement);
    558605   end;
    559606end;
     
    580627end;
    581628
    582 { TIpAddress }
    583 
    584 procedure TIpAddress.Assign(Source: TPersistent);
    585 var
    586   I: Integer;
    587 begin
    588   if Assigned(Source) then begin
    589     if Source is TIpAddress then begin
    590       for I := 0 to High(Octets) do
    591         Octets[I] := TIpAddress(Source).Octets[I];
    592     end else inherited;
    593   end else inherited;
    594 end;
    595 
    596 function TIpAddress.IsAddressString(Value: string): Boolean;
    597 var
    598   Parts: TListString;
    599 begin
    600   Result := True;
    601   try
    602     Parts := TListString.Create;
    603     Parts.Explode(Value, '.', StrToStr);
    604     if Parts.Count = 4 then begin
    605       if (StrToInt(Parts[3]) < 0) or (StrToInt(Parts[3]) > 255) then Result := False;
    606       if (StrToInt(Parts[2]) < 0) or (StrToInt(Parts[2]) > 255) then Result := False;
    607       if (StrToInt(Parts[1]) < 0) or (StrToInt(Parts[1]) > 255) then Result := False;
    608       if (StrToInt(Parts[0]) < 0) or (StrToInt(Parts[0]) > 255) then Result := False;
    609     end else Result := False;
    610   finally
    611     Parts.Free;
    612   end;
    613 end;
    614 
    615 function TIpAddress.GetAddrClass: TAddrClass;
    616 begin
    617   if (Octets[3] and $80) = 0 then Result := acA
    618   else begin
    619     if (Octets[3] and $40) = 0 then Result := acB
    620     else begin
    621       if (Octets[3] and $20) = 0 then Result := acC
    622       else begin
    623         if (Octets[3] and $10) = 0 then Result := acD
    624         else Result := acE;
    625       end;
    626     end;
    627   end;
    628 end;
    629 
    630 function TIpAddress.GetAsCardinal: Cardinal;
    631 begin
    632   Result := Octets[0] or (Octets[1] shl 8) or (Octets[2] shl 16) or (Octets[3] shl 24);
    633 end;
    634 
    635 function TIpAddress.GetAsString: string;
    636 begin
    637   Result := IntToStr(Octets[3]) + '.' + IntToStr(Octets[2]) + '.' +
    638     IntToStr(Octets[1]) + '.' + IntToStr(Octets[0]);
    639 end;
    640 
    641 function TIpAddress.GetBroadcast: Boolean;
    642 begin
    643   Result := AsCardinal = High(Cardinal);
    644 end;
    645 
    646 procedure TIpAddress.SetAsCardinal(const Value: Cardinal);
    647 begin
    648   Octets[0] := Byte(Value);
    649   Octets[1] := Byte(Value shr 8);
    650   Octets[2] := Byte(Value shr 16);
    651   Octets[3] := Byte(Value shr 24);
    652 end;
    653 
    654 procedure TIpAddress.SetAsString(const Value: string);
    655 var
    656   Parts: TListString;
    657 begin
    658   try
    659     Parts := TListString.Create;
    660     Parts.Explode(Value, '.', StrToStr);
    661     try
    662 //    if Length(Parts) = 4 then begin
    663       Octets[0] := StrToInt(Parts[3]);
    664       Octets[1] := StrToInt(Parts[2]);
    665       Octets[2] := StrToInt(Parts[1]);
    666       Octets[3] := StrToInt(Parts[0]);
    667 //    end else raise EConvertError.Create('String to IP address conversion error');
    668     except
    669       raise EConvertError.Create(SStringToIPConversionError);
    670     end;
    671   finally
    672     Parts.Free;
    673   end;
    674 end;
    675 
    676 procedure TIpAddress.SetBroadcast(const Value: Boolean);
    677 begin
    678   AsCardinal := High(Cardinal);
    679 end;
     629{ TURL }
    680630
    681631constructor TURL.Create;
     
    686636destructor TURL.Destroy;
    687637begin
    688   Host.Free;
     638  FreeAndNil(Host);
    689639  inherited;
    690640end;
     
    724674end;
    725675
    726 
    727 { TDomainAddress }
    728 
    729 function TDomainAddress.GetAsString: string;
    730 begin
    731   try
    732     Levels.Reverse;
    733     Result := Levels.Implode('.', StrToStr);
    734   finally
    735     Levels.Reverse;
    736   end;
    737 end;
    738 
    739 procedure TDomainAddress.SetAsString(const Value: string);
    740 begin
    741   Levels.Explode(Value, '.', StrToStr);
    742   Levels.Reverse;
    743 end;
    744 
    745 constructor TDomainAddress.Create;
    746 begin
    747   Levels := TListString.Create;
    748 end;
    749 
    750 destructor TDomainAddress.Destroy;
    751 begin
    752   Levels.Free;
    753   inherited;
    754 end;
    755 
    756676{ THtmlLink }
    757677
     
    763683destructor THtmlLink.Destroy;
    764684begin
    765   Target.Free;
     685  FreeAndNil(Target);
    766686  inherited;
    767687end;
     
    791711end;
    792712
    793 { THostAddress }
    794 
    795 constructor THostAddress.Create;
    796 begin
    797   DomainName := TDomainAddress.Create;
    798   IpAddress := TIpAddress.Create;
    799   State := asDomainName;
    800   DomainName.AsString := 'localhost';
    801 end;
    802 
    803 destructor THostAddress.Destroy;
    804 begin
    805   DomainName.Free;
    806   IpAddress.Free;
    807   inherited;
    808 end;
    809 
    810 function THostAddress.GetAsString: string;
    811 begin
    812   case State of
    813     asDomainName: Result := DomainName.AsString;
    814     asIpAddress: Result := IpAddress.AsString;
    815   end;
    816 end;
    817 
    818 procedure THostAddress.SetAsString(const Value: string);
    819 begin
    820   if IpAddress.IsAddressString(Value) then begin
    821     State := asIpAddress;
    822     IpAddress.AsString := Value;
    823   end else begin
    824     State := asDomainName;
    825     DomainName.AsString := Value;
    826   end;
    827 end;
    828 
    829713{ THtmlImage }
    830714
     
    836720destructor THtmlImage.Destroy;
    837721begin
    838   Source.Free;
     722  FreeAndNil(Source);
    839723  inherited;
    840724end;
     
    889773destructor TQueryString.Destroy;
    890774begin
    891   Data.Free;
     775  FreeAndNil(Data);
    892776  inherited;
    893777end;
  • trunk/Packages/CoolWeb/Common/UXmlClasses.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, StrUtils, SpecializedList, SpecializedDictionary;
     6  Classes, SysUtils, StrUtils, Generics.Collections, UGenerics;
    77
    88type
     
    1212  public
    1313    property AsString: string read GetAsString;
     14  end;
     15
     16  TXmlTag = class;
     17  TXmlString = class;
     18
     19  { TXmlElements }
     20
     21  TXmlElements = class(TObjectList<TXmlElement>)
     22    function AddTag(Name: string): TXmlTag;
     23    function AddString(Text: string): TXmlString;
    1424  end;
    1525
     
    2939    Name: string;
    3040    Attributes: TDictionaryStringString;
    31     SubElements: TListObject; // TListObject<TXmlElement>;
     41    SubElements: TXmlElements;
    3242    constructor Create;
    3343    destructor Destroy; override;
     
    5262implementation
    5363
     64{ TXmlElements }
     65
     66function TXmlElements.AddTag(Name: string): TXmlTag;
     67begin
     68  Result := TXmlTag.Create;
     69  Result.Name := Name;
     70  Add(Result);
     71end;
     72
     73function TXmlElements.AddString(Text: string): TXmlString;
     74begin
     75  Result := TXmlString.Create;
     76  Result.Text := Text;
     77  Add(Result);
     78end;
     79
    5480{ THtmlElement }
    5581
     
    5884  ShringEmpty := True;
    5985  Attributes := TDictionaryStringString.Create;
    60   SubElements := TListObject.Create;
     86  SubElements := TXmlElements.Create;
    6187  EndTagSymbol := '/';
    6288end;
     
    6490destructor TXmlTag.Destroy;
    6591begin
    66   Attributes.Free;
    67   SubElements.Free;
     92  FreeAndNil(Attributes);
     93  FreeAndNil(SubElements);
    6894  inherited;
    6995end;
     
    74100  I: Integer;
    75101  Content: string;
     102  Attribute: TPair<string, string>;
    76103begin
    77104  Content := '';
     
    80107
    81108  AttributesText := '';
    82   for I := 0 to Attributes.Count - 1 do
    83     AttributesText := AttributesText + ' ' + Attributes.Keys[I] + '="' + Attributes[I].Value + '"';
     109  for Attribute in Attributes do
     110    AttributesText := AttributesText + ' ' + Attribute.Key + '="' + Attribute.Value + '"';
    84111
    85112  if Name <> '' then begin
     
    123150destructor TXmlDocument.Destroy;
    124151begin
    125   Content.Free;
    126   MainTag.Free;
     152  FreeAndNil(Content);
     153  FreeAndNil(MainTag);
    127154  inherited;
    128155end;
  • trunk/Packages/CoolWeb/CoolWeb.lpk

    r132 r138  
    4040    <License Value="GNU/GPL"/>
    4141    <Version Minor="3"/>
    42     <Files Count="18">
     42    <Files Count="19">
    4343      <Item1>
    4444        <Filename Value="WebServer/UHTTPServer.pas"/>
     
    121121        <UnitName Value="UWebUser"/>
    122122      </Item18>
     123      <Item19>
     124        <Filename Value="Common/UIpAddress.pas"/>
     125        <UnitName Value="UIpAddress"/>
     126      </Item19>
    123127    </Files>
    124128    <CompatibilityMode Value="True"/>
    125     <RequiredPkgs Count="8">
     129    <RequiredPkgs Count="7">
    126130      <Item1>
    127131        <PackageName Value="TurboPowerIProDsgn"/>
     
    140144      </Item5>
    141145      <Item6>
    142         <PackageName Value="TemplateGenerics"/>
    143         <MaxVersion Minor="3"/>
    144         <MinVersion Minor="3" Valid="True"/>
     146        <PackageName Value="synapse"/>
    145147      </Item6>
    146148      <Item7>
    147         <PackageName Value="synapse"/>
    148       </Item7>
    149       <Item8>
    150149        <PackageName Value="FCL"/>
    151150        <MinVersion Major="1" Valid="True"/>
    152       </Item8>
     151      </Item7>
    153152    </RequiredPkgs>
    154153    <UsageOptions>
  • trunk/Packages/CoolWeb/CoolWeb.pas

    r115 r138  
    55unit CoolWeb;
    66
     7{$warn 5023 off : no warning about unused units}
    78interface
    89
     
    1112  UTurboPowerForm, UHTTPSessionFile, UHTTPSessionMySQL, USqlDatabase,
    1213  UTCPServer, UPageList, UHtmlClasses, UMemoryStreamEx, UMIMEType,
    13   UXmlClasses, UWebPage, UWebApp, LazIDEReg, UWebUser, LazarusPackageIntf;
     14  UXmlClasses, UWebPage, UWebApp, LazIDEReg, UWebUser, UIpAddress,
     15  LazarusPackageIntf;
    1416
    1517implementation
  • trunk/Packages/CoolWeb/Modules/UPageList.pas

    r137 r138  
    77
    88type
     9
     10  { TPageList }
     11
    912  TPageList = class
    1013    TotalCount: Integer;
     
    1922    Around: Integer;
    2023    constructor Create;
     24    destructor Destroy; override;
    2125    function Hyperlink: string;
    2226    function Process: string;
     
    3337  QueryItems.SetStringServer;
    3438  HTMLId := '';
     39end;
     40
     41destructor TPageList.Destroy;
     42begin
     43  FreeAndNil(QueryItems);
     44  inherited;
    3545end;
    3646
  • trunk/Packages/CoolWeb/Modules/UWebUser.pas

    r137 r138  
    55uses
    66  Classes, SysUtils, synacode, USqlDatabase, UCommon, UHTTPServer,
    7   SpecializedDictionary;
     7  UGenerics;
    88
    99const
     
    6060  DbRows: TDbRows;
    6161  Id: Integer;
    62 begin
    63   try
    64     DbRows := TDbRows.Create;
    65     if HandlerData.Request.Cookies.SearchKey('SessionId') <> -1 then begin
     62  Value: string;
     63begin
     64  try
     65    DbRows := TDbRows.Create;
     66    if HandlerData.Request.Cookies.TryGetValue('SessionId', Value) then begin
    6667    Database.Query(DbRows, 'SELECT * FROM `UserOnline` WHERE `SessionId`="' +
    67       HandlerData.Request.Cookies.Values['SessionId'] + '"');
     68      Value + '"');
    6869    if DbRows.Count > 0 then begin
    6970      // Update exited
    70       Id := StrToInt(DbRows[0].Values['Id']);
    71       User := StrToInt(DbRows[0].Values['User']);
     71      Id := StrToInt(DbRows[0].Items['Id']);
     72      User := StrToInt(DbRows[0].Items['User']);
    7273      Database.Query(DbRows, 'UPDATE `UserOnline` SET `ActivityTime` = NOW() WHERE `Id`=' + IntToStr(Id));
    7374    end else begin
    7475      // Create new record
    7576      Database.Query(DbRows, 'INSERT INTO `UserOnline` (`User`, `ActivityTime`, `SessionId`, `ScriptName`) ' +
    76         'VALUES (1, NOW(), "' + HandlerData.Request.Cookies.Values['SessionId'] + '", "")');
     77        'VALUES (1, NOW(), "' + Value + '", "")');
    7778      Id := Database.LastInsertId;
    7879      User := 1;
     
    8889var
    8990  DbRows: TDbRows;
     91  SessionId: string;
    9092begin
    9193  Logout;
     94  if HandlerData.Request.Cookies.TryGetValue('SessionId', SessionId) then
    9295  try
    9396    DbRows := TDbRows.Create;
    9497    Database.Query(DbRows, 'UPDATE `UserOnline` SET `User` = ' + IntToStr(User) + ', `LoginTime` = NOW() WHERE `SessionId`="' +
    95       HandlerData.Request.Cookies.Values['SessionId'] + '"');
     98      SessionId + '"');
    9699  finally
    97100    DbRows.Free;
     
    103106var
    104107  DbRows: TDbRows;
     108  SessionId: string;
    105109begin
    106110  if Id = AnonymousUserId then Update;
    107   if User <> AnonymousUserId then begin
     111  if (User <> AnonymousUserId) and
     112    HandlerData.Request.Cookies.TryGetValue('SessionId', SessionId) then begin
    108113    try
    109114      DbRows := TDbRows.Create;
    110115      Database.Query(DbRows, 'UPDATE `UserOnline` SET `User` = ' + IntToStr(AnonymousUserId) + ' WHERE `SessionId`="' +
    111         HandlerData.Request.Cookies.Values['SessionId'] + '"');
     116        SessionId + '"');
    112117    finally
    113118      DbRows.Free;
     
    178183    DbRows := TDbRows.Create;
    179184    Database.Query(DbRows, 'SELECT `Id` FROM `User` WHERE `Name`="' + Name + '"');
    180     if DbRows.Count = 1 then Result := StrToInt(DbRows[0].Items[0].Value)
     185    if DbRows.Count = 1 then Result := StrToInt(DbRows[0].Items['Id'])
    181186      else Result := -1;
    182187  finally
     
    193198    Database.Query(DbRows, 'SELECT `Id` FROM `User` WHERE `Name`="' + Name + '" AND ' +
    194199      '`Password` = SHA1(CONCAT("' + Password + '", Salt))');
    195     if DbRows.Count = 1 then Result := StrToInt(DbRows[0].Items[0].Value)
     200    if DbRows.Count = 1 then Result := StrToInt(DbRows[0].Items['Id'])
    196201      else Result := -1;
    197202  finally
     
    208213    Database.Query(DbRows, 'SELECT * FROM `User` WHERE `Id`="' + IntToStr(Id) + '"');
    209214    if DbRows.Count = 1 then begin
    210       Name := DbRows[0].Values['Name'];
    211       FullName := DbRows[0].Values['FullName'];
    212       Email := DbRows[0].Values['Email'];
     215      Name := DbRows[0].Items['Name'];
     216      FullName := DbRows[0].Items['FullName'];
     217      Email := DbRows[0].Items['Email'];
    213218    end; // else raise ENotFound.Create(Format(SUserNotFound, [IntToStr(Id)]));
    214219  finally
     
    233238    try
    234239      DbRows2 := TDbRows.Create;
    235       OperationId := StrToInt(DbRows[0].Values['Id']);
     240      OperationId := StrToInt(DbRows[0].Items['Id']);
    236241
    237242      // Check user-operation relation
     
    247252        '`User` = ' + IntToStr(Id) + ' AND `AssignedGroup` IS NOT NULL');
    248253      if DbRows2.Count > 0 then begin
    249         if CheckGroupPermission(StrToInt(DbRows2[0].Values['AssignedGroup']), OperationId) then begin
     254        if CheckGroupPermission(StrToInt(DbRows2[0].Items['AssignedGroup']), OperationId) then begin
    250255          Result := True;
    251256          Exit;
     
    280285      '`User` = ' + IntToStr(Id) + ' AND `AssignedGroup` IS NOT NULL');
    281286    if DbRows2.Count > 0 then begin
    282       if CheckGroupPermission(StrToInt(DbRows2[0].Values['AssignedGroup']), Operation) then begin
     287      if CheckGroupPermission(StrToInt(DbRows2[0].Items['AssignedGroup']), Operation) then begin
    283288        Result := True;
    284289        Exit;
  • trunk/Packages/CoolWeb/Persistence/USqlDatabase.pas

    r137 r138  
    66
    77uses
    8   SysUtils, Classes, Dialogs, mysql50, TypInfo, SpecializedDictionary,
    9   SpecializedList;
     8  SysUtils, Classes, Dialogs, mysql50, TypInfo, UGenerics, Generics.Collections;
    109
    1110type
     
    2120  TLogEvent = procedure(Sender: TObject; Text: string) of object;
    2221
    23   TDbRows = class(TListObject)
     22  TDbRows = class(TList<TDictionaryStringString>)
    2423  private
    2524    function GetData(Index: Integer): TDictionaryStringString;
     
    155154    TimeParts := TListString.Create;
    156155
    157     Parts.Explode(Value, ' ', StrToStr);
    158     DateParts.Explode(Parts[0], '-', StrToStr);
     156    Parts.Explode(' ', Value);
     157    DateParts.Explode('-', Parts[0]);
    159158    Result := EncodeDate(StrToInt(DateParts[0]), StrToInt(DateParts[1]),
    160159      StrToInt(DateParts[2]));
    161160    if Parts.Count > 1 then begin
    162       TimeParts.Explode(Parts[1], ':', StrToStr);
     161      TimeParts.Explode(':', Parts[1]);
    163162      Result := Result + EncodeTime(StrToInt(TimeParts[0]), StrToInt(TimeParts[1]),
    164163        StrToInt(TimeParts[2]), 0);
     
    210209  Value: string;
    211210  DbResult: TDbRows;
     211  Item: TPair<string, string>;
    212212begin
    213213  LastUsedTable := ATable;
    214214  DbNames := '';
    215215  DbValues := '';
    216   for I := 0 to Data.Count - 1 do begin
    217     Value := Data.Items[I].Value;
     216  for Item in Data do begin
     217    Value := Item.Value;
    218218    StringReplace(Value, '"', '\"', [rfReplaceAll]);
    219219    if Value = 'NOW()' then DbValues := DbValues + ',' + Value
    220220    else DbValues := DbValues + ',"' + Value + '"';
    221     DbNames := DbNames + ',`' + Data.Keys[I] + '`';
     221    DbNames := DbNames + ',`' + Item.Key + '`';
    222222  end;
    223223  System.Delete(DbNames, 1, 1);
     
    274274  I: Integer;
    275275  DbResult: TDbRows;
     276  Item: TPair<string, string>;
    276277begin
    277278  LastUsedTable := ATable;
    278279  DbNames := '';
    279280  DbValues := '';
    280   for I := 0 to Data.Count - 1 do begin
    281     Value := Data.Items[I].Value;
     281  for Item in Data do begin
     282    Value := Item.Value;
    282283    StringReplace(Value, '"', '\"', [rfReplaceAll]);
    283284    if Value = 'NOW()' then DbValues := DbValues + ',' + Value
    284285    else DbValues := DbValues + ',"' + Value + '"';
    285     DbNames := DbNames + ',`' + Data.Keys[I] + '`';
     286    DbNames := DbNames + ',`' + Item.Key + '`';
    286287  end;
    287288  System.Delete(DbNames, 1, 1);
     
    314315  I: Integer;
    315316  DbResult: TDbRows;
     317  Item: TPair<string, string>;
    316318begin
    317319  LastUsedTable := ATable;
    318320  DbValues := '';
    319   for I := 0 to Data.Count - 1 do begin
    320     Value := Data.Items[I].Value;
     321  for Item in Data do begin
     322    Value := Item.Value;
    321323    StringReplace(Value, '"', '\"', [rfReplaceAll]);
    322324    if Value = 'NOW()' then DbValues := DbValues + ',' + Value
    323     else DbValues := DbValues + ',`' + Data.Keys[I] + '` =' + '"' + Value + '"';
     325    else DbValues := DbValues + ',`' + Item.Key + '` =' + '"' + Value + '"';
    324326  end;
    325327  System.Delete(DbValues, 1, 1);
  • trunk/Packages/CoolWeb/WebServer/UHTTPServer.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, UCommon, UMemoryStreamEx, UMIMEType,
    7   Synautil, SpecializedList, SpecializedDictionary, Syncobjs;
     6  Classes, SysUtils, UCommon, UMemoryStreamEx, UMIMEType, Synautil, Syncobjs,
     7  Generics.Collections, UGenerics;
    88
    99type
     
    7575  { TRequestHandlerList }
    7676
    77   TRequestHandlerList = class(TListObject)
     77  TRequestHandlerList = class(TObjectList<TRequestHandler>)
    7878    procedure Add(AName: string; AHandler: TRequestEvent);
    7979    function IndexOfName(AName: string): TRequestHandler;
     
    131131var
    132132  I: Integer;
     133  Item: TPair<string, string>;
    133134begin
    134135  with HandlerData, Response.Content do begin
     
    145146
    146147    WriteString('<h5>Request HTTP headers</h5>');
    147     for I := 0 to Request.Headers.Count - 1 do begin;
    148       with Request.Headers.Items[I] do
    149         WriteString(Key + ': ' + Value + '<br/>');
     148    for Item in Request.Headers do begin;
     149      WriteString(Item.Key + ': ' + Item.Value + '<br/>');
    150150    end;
    151151
    152152    WriteString('<h5>Request HTTP GET</h5>');
    153     for I := 0 to Request.Query.Count - 1 do begin
    154       with Request.Query.Items[I] do
    155       WriteString(Key + ': ' + Value + '<br/>');
     153    for Item in Request.Query do begin
     154      WriteString(Item.Key + ': ' + Item.Value + '<br/>');
    156155    end;
    157156
    158157    WriteString('<h5>Request HTTP cookies</h5>');
    159158    for I := 0 to Request.Cookies.Count - 1 do begin
    160       with Request.Cookies.Items[I] do
    161       WriteString(Key + ': ' + Value + '<br/>');
     159      WriteString(Item.Key + ': ' + Item.Value + '<br/>');
    162160    end;
    163161
     
    170168
    171169    WriteString('<h5>Request HTTP POST</h5>');
    172     for I := 0 to Request.Post.Count - 1 do begin
    173       with Request.Post.Items[I] do
    174       WriteString(Key + ': ' + Value + '<br/>');
     170    for Item in Request.Post do begin
     171      WriteString(Item.Key + ': ' + Item.Value + '<br/>');
    175172    end;
    176173
     
    181178    WriteString('<h5>Response HTTP headers</h5>');
    182179    with Response.Content do
    183     for I := 0 to Response.Headers.Count - 1 do begin
    184       with Response.Headers.Items[I] do
    185       WriteString(Key + ': ' + Value + '<br/>');
     180    for Item in Response.Headers do begin
     181      WriteString(Item.Key + ': ' + Item.Value + '<br/>');
    186182    end;
    187183
    188184    WriteString('<h5>Response HTTP cookies</h5>');
    189     for I := 0 to Response.Cookies.Count - 1 do begin;
    190       with Response.Cookies.Items[I] do
    191       WriteString(Key + ': ' + Value + '<br/>');
     185    for Item in Response.Cookies do begin;
     186      WriteString(Item.Key + ': ' + Item.Value + '<br/>');
    192187    end;
    193188  end;
     
    197192begin
    198193  with HandlerData, Response.Content do begin
    199     WriteString('<html><body>' + Format(SPageNotFound, [Request.Path.Implode('/', StrToStr)]) + '</body></html>');
     194    WriteString('<html><body>' + Format(SPageNotFound, [Implode('/', Request.Path)]) + '</body></html>');
    200195  end;
    201196end;
     
    218213begin
    219214  with HandlerData do begin
    220     FileName := DocumentRoot + DirectorySeparator + Request.Path.Implode('/', StrToStr);
     215    FileName := DocumentRoot + DirectorySeparator + Implode('/', Request.Path);
    221216    if FileExists(FileName) then begin
    222       Response.Headers.Values['Content-Type'] := GetMIMEType(Copy(ExtractFileExt(FileName), 2, 255));
     217      Response.Headers.Items['Content-Type'] := GetMIMEType(Copy(ExtractFileExt(FileName), 2, 255));
    223218      try
    224219        BinaryFile := TFileStream.Create(FileName, fmOpenRead);
     
    230225    with Response.Content do begin
    231226      //WriteLn(Format(SFileNotFound, [Request.Path.Implode('/', StrToStr)]));
    232       WriteString('<html><body>' + Format(SFileNotFound, [Request.Path.Implode('/', StrToStr)]) + '</body></html>');
     227      WriteString('<html><body>' + Format(SFileNotFound, [Implode('/', Request.Path)]) + '</body></html>');
    233228    end;
    234229  end;
     
    357352    Pair := TListString.Create;
    358353    Clear;
    359     Parts.Explode(Text, '&', StrToStr);
     354    Parts.Explode('&', Text);
    360355    for I := 0 to Parts.Count - 1 do begin
    361       Pair.Explode(Parts[I], '=', StrToStr);
     356      Pair.Explode('=', Parts[I]);
    362357      if Pair.Count >= 2 then
    363358        Add(Pair[0], Pair[1]);
     
    371366function TQueryParameterList.Syntetize: string;
    372367var
    373   I: Integer;
     368  Item: TPair<string, string>;
    374369begin
    375370  Result := '';
    376   for I := 0 to Count - 1 do
    377     Result := Result + '&amp;' + Keys[I] + '=' + Items[I].Value;
     371  for Item in Self do
     372    Result := Result + '&amp;' + Item.Key + '=' + Item.Value;
    378373  Result := Copy(Result, 6, Length(Result));
    379374end;
     
    391386    Pair := TListString.Create;
    392387    Clear;
    393     Parts.Explode(Text, ';', StrToStr);
     388    Parts.Explode(';', Text);
    394389    for I := 0 to Parts.Count - 1 do begin
    395       Pair.Explode(Parts[I], '=', StrToStr);
     390      Pair.Explode('=', Parts[I]);
    396391      if Pair.Count >= 2 then
    397392        Add(Trim(Pair[0]), Trim(Pair[1]));
     
    405400function TCookieList.Syntetize: string;
    406401var
    407   I: Integer;
     402  Item: TPair<string, string>;
    408403begin
    409404  Result := '';
    410   for I := 0 to Count - 1 do
    411     Result := Result + '; ' + Keys[I] + '=' + Items[I].Value;
     405  for Item in Self do
     406    Result := Result + '; ' + Item.Key + '=' + Item.Value;
    412407  Result := Copy(Result, 2, Length(Result));
    413408end;
  • trunk/Packages/CoolWeb/WebServer/UHTTPServerCGI.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, UHTTPServer, SpecializedList, IOStream;
     6  Classes, SysUtils, UHTTPServer, IOStream, Generics.Collections;
    77
    88type
     
    5454  Buffer: string;
    5555  Count: Integer;
     56  Item: TPair<string, string>;
    5657begin
    5758  HandlerData := THTTPHandlerData.Create;
     
    9697      EnvVars.Values['QUERY_STRING'] := Copy(EnvVars.Values['QUERY_STRING'], 1,
    9798        Length(EnvVars.Values['QUERY_STRING']) - 1);
    98     Request.Path.Explode(EnvVars.Values['QUERY_STRING'], '/', StrToStr);
     99    Request.Path.Explode('/', EnvVars.Values['QUERY_STRING']);
    99100    if Pos('?', EnvVars.Values['REQUEST_URI']) > 0 then begin
    100101      Request.Query.Parse(Copy(EnvVars.Values['REQUEST_URI'],
     
    129130    with Response do begin
    130131      // Generate cookies
    131       for I := 0 to Cookies.Count - 1 do
    132         Headers.Add('Set-Cookie', Cookies.Keys[I] + '=' + Cookies.Items[I].Value);
     132      for Item in Cookies do
     133        Headers.Add('Set-Cookie', Item.Key + '=' + Item.Value);
    133134        // + ';path=/;expires=' + RFC822DateTime(Now);
    134135
    135136      // Generate headers
    136       for I := 0 to Headers.Count - 1 do begin
    137         WriteLn(Headers.Keys[I] + ': ' + Headers.Items[I].Value);
     137      for Item in Headers do begin
     138        WriteLn(Item.Key + ': ' + Item.Value);
    138139      end;
    139140
  • trunk/Packages/CoolWeb/WebServer/UHTTPServerTCP.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, UHTTPServer, UTCPServer, SpecializedList, SynaUtil;
     6  Classes, SysUtils, UHTTPServer, UTCPServer, SynaUtil, Generics.Collections,
     7  UGenerics;
    78
    89type
     
    4243  I: Integer;
    4344  ContentLength: Integer;
     45  Value: string;
     46  Item: TPair<string, string>;
    4447begin
    4548  with TTCPClientThread(Sender), Socket do begin
     
    6063          WriteLn(IntToStr(Id) + ' ' + Line);
    6164          if (LineIndex = 0) then begin
    62             LineParts.Explode(Line, ' ', StrToStr);
     65            LineParts.Explode(' ', Line);
    6366            if (LineParts.Count >= 3) then begin
    6467              Request.Method := LineParts[0];
    6568              if Pos('?', LineParts[1]) > 0 then begin
    6669                Request.Query.Parse(Copy(LineParts[1], Pos('?', LineParts[1]) + 1, Length(LineParts[1])));
    67                 Request.Path.Explode(Copy(LineParts[1], 1, Pos('?', LineParts[1]) - 1), '/', StrToStr);
     70                Request.Path.Explode('/', Copy(LineParts[1], 1, Pos('?', LineParts[1]) - 1));
    6871              end else begin
    69                 Request.Path.Explode(LineParts[1], '/', StrToStr);
     72                Request.Path.Explode('/', LineParts[1]);
    7073                Request.Query.Clear;
    7174              end;
     
    7578            end;
    7679          end else begin
    77             LineParts.Explode(Line, ' ', StrToStr, 2);
     80            LineParts.Explode(' ', Line, 2);
    7881            if (LineParts.Count = 2) and (LineParts[0][Length(LineParts[0])] = ':') then begin
    7982              LineParts[0] := Copy(LineParts[0], 1, Length(LineParts[0]) - 1);
    8083              Request.Headers.Add(LineParts[0], LineParts[1]);
    81               //WriteLn(Line);
    8284            end;
    8385          end;
     
    8688
    8789        if Request.Method = 'POST' then begin
    88           ContentLength := StrToInt(Request.Headers.Values['Content-Length']);
     90          if Request.Headers.TryGetValue('Content-Length', Value) then
     91            ContentLength := StrToInt(Value);
    8992          SetLength(Line, ContentLength);
    9093          RecvBufferEx(PByte(Line), ContentLength, 1000);
     
    9699
    97100    // Process cookies
    98     if Request.Headers.SearchKey('Cookie') <> -1 then
    99       Request.Cookies.Parse(Request.Headers.Values['Cookie']);
     101    if Request.Headers.TryGetValue('Cookie', Value) then
     102      Request.Cookies.Parse(Value);
    100103
    101104    // Load session variables
     
    120123
    121124      // Handle cookies
    122       for I := 0 to Cookies.Count - 1 do
    123         Headers.Add('Set-Cookie', Cookies.Keys[I] + '=' + Cookies.Items[I].Value);
     125      for Item in Cookies do
     126        Headers.Add('Set-Cookie', Item.Key + '=' + Item.Value);
    124127        // + ';path=/;expires=' + RFC822DateTime(Now);
    125128
    126129      // Send headers
    127       for I := 0 to Headers.Count - 1 do begin
     130      for Item in Headers do begin
    128131        //WriteLn(Headers.Keys[I] + ': ' + Headers.Items[I].Value + #13#10);
    129         SendString(Headers.Keys[I] + ': ' + Headers.Items[I].Value + #13#10);
     132        SendString(Item.Key + ': ' + Item.Value + #13#10);
    130133      end;
    131134      SendString(#13#10);
  • trunk/Packages/CoolWeb/WebServer/UHTTPSessionFile.pas

    r137 r138  
    5555
    5656procedure THTTPSessionStorageFile.GetSessionId(HandlerData: THTTPHandlerData);
     57var
     58  Value: string;
    5759begin
    5860  with HandlerData do begin
    59     if Request.Cookies.SearchKey(SessionIdCookieName) <> -1 then begin
    60       SessionId := Request.Cookies.Values[SessionIdCookieName];
     61    if Request.Cookies.TryGetValue(SessionIdCookieName, Value) then begin
     62      SessionId := Value;
    6163    end else begin
    6264      SessionId := GetNewSessionId;
    63       Response.Cookies.Values[SessionIdCookieName] := SessionId;
     65      Response.Cookies.Items[SessionIdCookieName] := SessionId;
    6466    end;
    6567  end;
     
    9698    end else raise Exception.Create(SCantCreateSessionStorageDirectory);
    9799
    98     HandlerData.Response.Cookies.Values[SessionIdCookieName] := HandlerData.SessionId;
     100    HandlerData.Response.Cookies.Items[SessionIdCookieName] := HandlerData.SessionId;
    99101  finally
    100102    Lock.Release;
  • trunk/Packages/CoolWeb/WebServer/UHTTPSessionMySQL.pas

    r137 r138  
    6464
    6565procedure THTTPSessionStorageMySQL.GetSessionId(HandlerData: THTTPHandlerData);
     66var
     67  Value: string;
    6668begin
    6769  with HandlerData do begin
    68     if Request.Cookies.SearchKey(SessionIdCookieName) <> -1 then begin
    69       SessionId := Request.Cookies.Values[SessionIdCookieName];
     70    if Request.Cookies.TryGetValue(SessionIdCookieName, Value) then begin
     71      SessionId := Value;
    7072    end else begin
    7173      SessionId := GetNewSessionId;
     
    8789      HandlerData.SessionId + '"');
    8890    if DbRows.Count > 0 then begin
    89       HandlerData.Session.Text := DbRows[0].Values['Variables'];
     91      HandlerData.Session.Text := DbRows[0].Items['Variables'];
    9092    end else begin
    9193      HandlerData.SessionId := GetNewSessionId;
     
    114116    else Database.Query(DbRows2, 'INSERT INTO `HTTPSession` (`Time`,  `Variables`, `Identification`) VALUES (' +
    115117    'NOW(), "' + HandlerData.Session.Text + '", "' + HandlerData.SessionId + '")');
    116     HandlerData.Response.Cookies.Values[SessionIdCookieName] := HandlerData.SessionId;
     118    HandlerData.Response.Cookies.Items[SessionIdCookieName] := HandlerData.SessionId;
    117119  finally
    118120    DbRows2.Free;
  • trunk/Packages/PersistentData/Backend/UPDClientMemory.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, UPDClient, SpecializedList;
     6  Classes, SysUtils, UPDClient, Generics.Collections;
    77
    88type
     
    1919    function SearchObject(Id: Integer): TObjectProxy;
    2020  public
    21     Objects: TListObject;
     21    Objects: TObjectList<TObjectProxy>;
    2222    procedure ObjectLoad(AObject: TObjectProxy); override;
    2323    procedure ObjectSave(AObject: TObjectProxy); override;
     
    9696    else begin
    9797      AObject.Id := GetNewObjectId;
    98       Obj := TObjectProxy(Objects.AddNew(TObjectProxy.Create));
     98      Obj := TObjectProxy(Objects.Add(TObjectProxy.Create));
    9999      Obj.Assign(AObject);
    100100    end;
     
    118118  NewObject: TObjectProxy;
    119119  Table: string;
     120  Item: TPair<string, string>;
    120121begin
    121122  AList.Objects.Clear;
     
    131132
    132133      if AList.ColummsFilterUse then begin
    133         for P := 0 to Properties.Count - 1 do
    134         if AList.ColumnsFilter.IndexOf(Properties.Keys[I]) <> -1 then
    135           NewObject.Properties.Add(Properties.Keys[I], Properties[I].Value);
     134        for Item in Properties do
     135        if AList.ColumnsFilter.IndexOf(Item.Key) <> -1 then
     136          NewObject.Properties.Add(Item.Key, Item.Value);
    136137      end else NewObject.Properties.Assign(Properties);
    137138    end;
     
    172173begin
    173174  inherited;
    174   Objects := TListObject.Create;
     175  Objects := TObjectList<TObjectProxy>.Create;
    175176  BackendName := 'Memory';
    176177end;
  • trunk/Packages/PersistentData/Backend/UPDClientMySQL.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, USqlDatabase, UPDClient, SpecializedDictionary;
     6  Classes, SysUtils, USqlDatabase, UPDClient, UGenerics;
    77
    88type
  • trunk/Packages/PersistentData/PersistentData.lpk

    r87 r138  
    1 <?xml version="1.0"?>
     1<?xml version="1.0" encoding="UTF-8"?>
    22<CONFIG>
    3   <Package Version="4">
     3  <Package Version="5">
    44    <PathDelim Value="\"/>
    55    <Name Value="PersistentData"/>
     6    <Type Value="RunAndDesignTime"/>
    67    <Author Value="Chronos"/>
    78    <CompilerOptions>
     
    1213        <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
    1314      </SearchPaths>
     15      <Parsing>
     16        <SyntaxOptions>
     17          <SyntaxMode Value="Delphi"/>
     18          <CStyleOperator Value="False"/>
     19          <AllowLabel Value="False"/>
     20          <CPPInline Value="False"/>
     21        </SyntaxOptions>
     22      </Parsing>
    1423      <CodeGeneration>
    1524        <Checks>
     
    2029        </Checks>
    2130      </CodeGeneration>
    22       <Other>
    23         <CompilerMessages>
    24           <MsgFileName Value=""/>
    25         </CompilerMessages>
    26         <CompilerPath Value="$(CompPath)"/>
    27       </Other>
    2831    </CompilerOptions>
    2932    <Description Value="Generic data persistence layer"/>
     
    6568      </Item8>
    6669    </Files>
    67     <Type Value="RunAndDesignTime"/>
     70    <CompatibilityMode Value="True"/>
    6871    <RequiredPkgs Count="2">
    6972      <Item1>
  • trunk/Packages/PersistentData/UPDClient.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, SpecializedList, SpecializedDictionary;
     6  Classes, SysUtils, Generics.Collections, UGenerics;
    77
    88const
     
    5757    ObjectName: string;
    5858    Path: string;
    59     Objects: TListObject; // TListObject<TObjectProxy>
     59    Objects: TObjectList<TObjectProxy>;
    6060    procedure Clear;
    6161    constructor Create;
     
    7474  { TPDTypePropertyList }
    7575
    76   TPDTypePropertyList = class(TListObject)
     76  TPDTypePropertyList = class(TObjectList<TPDTypeProperty>)
    7777    Client: TPDClient;
    7878    procedure AddSimple(Name: string; TypeName: string; Unique: Boolean = False;
     
    100100  { TPDTypeList }
    101101
    102   TPDTypeList = class(TListObject)
     102  TPDTypeList = class(TObjectList<TPDType>)
    103103    Client: TPDClient;
    104104    function AddType(Name: string; DbType: string = ''): TPDType;
     
    147147  TPDClientClass = class of TPDClient;
    148148
    149   resourcestring
    150     SClientNotSet = 'Client not set';
    151     SNotSupported = 'Not supported';
    152     SVersionMismatch = 'Version mismatch, client: %0:s, server: %1:s. Please upgrade database.';
    153     SCantLoadObjectWithoutId = 'Can''t load object without id';
     149resourcestring
     150  SClientNotSet = 'Client not set';
     151  SNotSupported = 'Not supported';
     152  SVersionMismatch = 'Version mismatch, client: %0:s, server: %1:s. Please upgrade database.';
     153  SCantLoadObjectWithoutId = 'Can''t load object without id';
    154154
    155155
     
    163163  NewProperty: TPDTypeProperty;
    164164begin
    165   NewProperty := TPDTypeProperty(AddNew(TPDTypeProperty.Create));
     165  NewProperty := TPDTypeProperty(Add(TPDTypeProperty.Create));
    166166  NewProperty.Name := Name;
    167167  NewProperty.DbType := Client.Types.SearchByName(TypeName);
     
    175175function TPDTypeList.AddType(Name: string; DbType: string = ''): TPDType;
    176176begin
    177   Result := TPDType(AddNew(TPDType.Create));
     177  Result := TPDType(Add(TPDType.Create));
    178178  Result.Client := Client;
    179179  Result.Name := Name;
     
    280280begin
    281281  ColumnsFilter := TListString.Create;
    282   Objects := TListObject.Create;
     282  Objects := TObjectList<TObjectProxy>.Create;
    283283end;
    284284
     
    345345    NewObject.Load;
    346346
    347     DbVersion := NewObject.Properties.Values['Version'];
     347    DbVersion := NewObject.Properties.Items['Version'];
    348348    if Version <> DbVersion then
    349349      raise Exception.Create(Format(SVersionMismatch, [Version, DbVersion]));
     
    395395    Tables.Count := NewProxy.Objects.Count;
    396396    for I := 0 to NewProxy.Objects.Count - 1 do
    397       Tables[I] := TObjectProxy(NewProxy.Objects[I]).Properties.Values['TABLE_NAME'];
     397      Tables[I] := TObjectProxy(NewProxy.Objects[I]).Properties.Items['TABLE_NAME'];
    398398
    399399    for I := 0 to Types.Count - 1 do
  • trunk/Packages/PersistentData/UPersistentData.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, UPDClient, SpecializedList;
     6  Classes, SysUtils, UPDClient, Generics.Collections;
    77
    88type
     
    1616  TPDManager = class(TComponent)
    1717  public
    18     Items: TListObject;
     18    Items: TObjectList<TPDManagerItem>;
    1919    procedure Register(ClientClass: TPDClientClass);
    2020    procedure LoadToStrings(Strings: TStrings);
     
    7676begin
    7777  inherited;
    78   Items := TListObject.Create;
     78  Items := TObjectList<TPDManagerItem>.Create;
    7979end;
    8080
  • trunk/Pages/UPageAdmin.pas

    r137 r138  
    6161begin
    6262  with TWebSession(HandlerData) do begin
    63     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     63    with HtmlDocument.Body, SubItems.AddString do begin
    6464      TModuleSystem(ModuleManager.FindModuleByName('System')).UpdateModuleList;
    6565      Text := 'Seznam modulů synchronizován';
     
    7676begin
    7777  with TWebSession(HandlerData) do begin
    78     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
     78    with HtmlDocument.Body, SubItems.AddString do begin
    7979      Text := Text + '<strong>Registred modules:</strong><br/>' +
    8080        '<table class="WideTable"><tr><th>Name</th><th>Installed</th><th>Title</th><th>Version</th>' +
     
    9999  ModuleName: string;
    100100  Module: TModule;
     101  Name: string;
    101102begin
    102103  with TWebSession(HandlerData) do begin
    103     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    104       if Request.Query.SearchKey('name') <> -1 then begin
    105         ModuleName := Request.Query.Values['name'];
     104    with HtmlDocument.Body, SubItems.AddString do begin
     105      if Request.Query.TryGetValue('name', Name) then begin
     106        ModuleName := Name;
    106107        Module := ModuleManager.FindModuleByName(ModuleName);
    107108        if Assigned(Module) then begin
     
    121122  ModuleName: string;
    122123  Module: TModule;
     124  Name: string;
    123125begin
    124126  with TWebSession(HandlerData) do begin
    125     with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    126       if Request.Query.SearchKey('name') <> -1 then begin
    127         ModuleName := Request.Query.Values['name'];
     127    with HtmlDocument.Body, SubItems.AddString do begin
     128      if Request.Query.TryGetValue('name', Name) then begin
     129        ModuleName := Name;
    128130        Module := ModuleManager.FindModuleByName(ModuleName);
    129131        if Assigned(Module) then begin
  • trunk/ZdechovNET.lpi

    r137 r138  
    9393      </Modes>
    9494    </RunParams>
    95     <RequiredPackages Count="7">
     95    <RequiredPackages Count="6">
    9696      <Item1>
    9797        <PackageName Value="ModularSystem"/>
     
    103103      </Item2>
    104104      <Item3>
    105         <PackageName Value="TemplateGenerics"/>
    106         <DefaultFilename Value="Packages/TemplateGenerics/TemplateGenerics.lpk" Prefer="True"/>
     105        <PackageName Value="CoolWeb"/>
     106        <DefaultFilename Value="Packages/CoolWeb/CoolWeb.lpk" Prefer="True"/>
    107107      </Item3>
    108108      <Item4>
    109         <PackageName Value="CoolWeb"/>
    110         <DefaultFilename Value="Packages/CoolWeb/CoolWeb.lpk" Prefer="True"/>
     109        <PackageName Value="Common"/>
     110        <DefaultFilename Value="Packages/Common/Common.lpk" Prefer="True"/>
    111111      </Item4>
    112112      <Item5>
    113         <PackageName Value="Common"/>
    114         <DefaultFilename Value="Packages/Common/Common.lpk" Prefer="True"/>
     113        <PackageName Value="synapse"/>
     114        <DefaultFilename Value="Packages/synapse/synapse.lpk" Prefer="True"/>
    115115      </Item5>
    116116      <Item6>
    117         <PackageName Value="synapse"/>
    118         <DefaultFilename Value="Packages/synapse/synapse.lpk" Prefer="True"/>
     117        <PackageName Value="LCL"/>
    119118      </Item6>
    120       <Item7>
    121         <PackageName Value="LCL"/>
    122       </Item7>
    123119    </RequiredPackages>
    124120    <Units Count="40">
Note: See TracChangeset for help on using the changeset viewer.