Changeset 100


Ignore:
Timestamp:
Oct 2, 2012, 2:52:20 PM (12 years ago)
Author:
chronos
Message:
  • Upraveno: V balíčku CoolWeb některé seznamy změněny z typu TStringList na TListString.
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/UWebObjects.pas

    r71 r100  
    66
    77uses
    8   Classes, SysUtils, UHtmlClasses, UXmlClasses, SpecializedList;
     8  Classes, SysUtils, UHtmlClasses, UXmlClasses, SpecializedList, SpecializedDictionary;
    99
    1010type
     
    4747    Title: string;
    4848    Rows: TQueryFormItemList;
    49     procedure Load(Items: TStringList);
     49    procedure Load(Items: TDictionaryStringString);
    5050    function AddNewItem: TQueryFormItem;
    5151    constructor Create;
     
    6868    function AddNewGroup: TQueryFormGroup;
    6969    function AddNewAction: TQueryAction;
    70     procedure Load(Items: TStringList);
     70    procedure Load(Items: TDictionaryStringString);
    7171    constructor Create;
    7272    destructor Destroy; override;
     
    197197end;
    198198
    199 procedure TQueryForm.Load(Items: TStringList);
     199procedure TQueryForm.Load(Items: TDictionaryStringString);
    200200var
    201201  I: Integer;
     
    223223{ TQueryFormGroup }
    224224
    225 procedure TQueryFormGroup.Load(Items: TStringList);
     225procedure TQueryFormGroup.Load(Items: TDictionaryStringString);
    226226var
    227227  I: Integer;
     
    229229  for I := 0 to Rows.Count - 1 do
    230230  with TQueryFormItem(Rows[I]) do begin
    231     if Items.IndexOfName(Value.ItemName) <> -1 then
     231    if Items.SearchKey(Value.ItemName) <> -1 then
    232232      Value.Value := Items.Values[Value.ItemName];
    233233  end;
  • trunk/Modules/TV/UPageTV.pas

    r99 r100  
    108108
    109109      Text := '#EXTM3U' + LineEnding;
    110       if Request.Query.IndexOf('id') <> -1 then begin
     110      if Request.Query.SearchKey('id') <> -1 then begin
    111111        Database.Select(DbRows, 'TV', '*', ' (`Stream` <> "") AND (`ShortName`="' + Database.EscapeString(Request.Query.Values['id']) + '") ');
    112112        if DbRows.Count > 0 then begin
  • trunk/Modules/User/UUserControlPage.pas

    r98 r100  
    9090      end;
    9191    end;
    92     if HandlerData.Request.Post.IndexOfName('Login') <> -1 then begin
     92    if HandlerData.Request.Post.SearchKey('Login') <> -1 then begin
    9393      Form.Load(HandlerData.Request.Post);
    9494      with THtmlString(SubItems.AddNew(THtmlString.Create)) do
     
    150150      end;
    151151    end;
    152     if HandlerData.Request.Post.IndexOfName('Register') <> -1 then
     152    if HandlerData.Request.Post.SearchKey('Register') <> -1 then
    153153    with HandlerData.Request do begin
    154154      Form.Load(HandlerData.Request.Post);
     
    222222      end;
    223223    end;
    224     if HandlerData.Request.Post.IndexOfName('Save') <> -1 then
     224    if HandlerData.Request.Post.SearchKey('Save') <> -1 then
    225225    with HandlerData.Request do begin
    226226      Form.Load(HandlerData.Request.Post);
  • trunk/Modules/ZdechovNET/UWebCamPage.pas

    r97 r100  
    5454      //HandlerData.Request.Query.Values['W'] := 'dsd';
    5555      //HandlerData.Request.Query.Values['H'] := 'dsd';
    56       if HandlerData.Request.Query.IndexOfName('Id') = -1 then CameraId := -1
     56      if HandlerData.Request.Query.SearchKey('Id') = -1 then CameraId := -1
    5757        else CameraId := StrToInt(HandlerData.Request.Query.Values['Id']);
    58       if (HandlerData.Request.Query.IndexOfName('W') = -1) then begin
     58      if (HandlerData.Request.Query.SearchKey('W') = -1) then begin
    5959        ImageWidth := 640;
    6060      end else begin
  • trunk/Packages/CoolWeb/Modules/UUser.pas

    r98 r100  
    6161  try
    6262    DbRows := TDbRows.Create;
     63    if HandlerData.Request.Cookies.SearchKey('SessionId') <> -1 then begin
    6364    Database.Query(DbRows, 'SELECT * FROM `UserOnline` WHERE `SessionId`="' +
    6465      HandlerData.Request.Cookies.Values['SessionId'] + '"');
     
    7576      User := 1;
    7677    end;
     78
     79    end;
    7780  finally
    7881    DbRows.Free;
  • trunk/Packages/CoolWeb/WebServer/UHTTPServer.pas

    r96 r100  
    1313  EEmptyHTTPHandler = class(Exception);
    1414
    15   TQueryParameterList = class(TStringList)
     15  TQueryParameterList = class(TDictionaryStringString)
    1616    procedure Parse(Text: string);
    1717    function Syntetize: string;
     
    2020  { TCookieList }
    2121
    22   TCookieList = class(TStringList)
     22  TCookieList = class(TDictionaryStringString)
    2323    procedure Parse(Text: string);
    2424    function Syntetize: string;
     
    148148    WriteString('<h5>Request HTTP headers</h5>');
    149149    for I := 0 to Request.Headers.Count - 1 do begin;
    150       WriteString(Request.Headers.Items[I].Value + '<br/>');
     150      with Request.Headers.Items[I] do
     151        WriteString(Key + ': ' + Value + '<br/>');
     152    end;
     153
     154    WriteString('<h5>Request HTTP GET</h5>');
     155    for I := 0 to Request.Query.Count - 1 do begin
     156      with Request.Query.Items[I] do
     157      WriteString(Key + ': ' + Value + '<br/>');
    151158    end;
    152159
    153160    WriteString('<h5>Request HTTP cookies</h5>');
    154     for I := 0 to Request.Cookies.Count - 1 do begin;
    155       WriteString(Request.Cookies.Strings[I] + '<br/>');
     161    for I := 0 to Request.Cookies.Count - 1 do begin
     162      with Request.Cookies.Items[I] do
     163      WriteString(Key + ': ' + Value + '<br/>');
    156164    end;
    157165
    158166    //WriteString('Session id: ' + SessionId);
    159167    WriteString('<h5>Session variables</h5>');
    160     for I := 0 to Session.Count - 1 do begin;
    161       WriteString(Session.Strings[I] + '<br/>');
     168    for I := 0 to Session.Count - 1 do begin
     169      with Session do
     170      WriteString(Names[I] + ': ' + ValueFromIndex[I] + '<br/>');
    162171    end;
    163172
    164173    WriteString('<h5>Request HTTP POST</h5>');
    165     for I := 0 to Request.Post.Count - 1 do begin;
    166       WriteString(Request.Post.Strings[I] + '<br/>');
     174    for I := 0 to Request.Post.Count - 1 do begin
     175      with Request.Post.Items[I] do
     176      WriteString(Key + ': ' + Value + '<br/>');
    167177    end;
    168178
     
    173183    WriteString('<h5>Response HTTP headers</h5>');
    174184    with Response.Content do
    175     for I := 0 to Response.Headers.Count - 1 do begin;
    176       WriteString(Response.Headers.Items[I].Value + '<br/>');
     185    for I := 0 to Response.Headers.Count - 1 do begin
     186      with Response.Headers.Items[I] do
     187      WriteString(Key + ': ' + Value + '<br/>');
    177188    end;
    178189
    179190    WriteString('<h5>Response HTTP cookies</h5>');
    180191    for I := 0 to Response.Cookies.Count - 1 do begin;
    181       WriteString(Response.Cookies.Strings[I] + '<br/>');
     192      with Response.Cookies.Items[I] do
     193      WriteString(Key + ': ' + Value + '<br/>');
    182194    end;
    183195  end;
     
    352364      Pair.Explode(Parts[I], '=', StrToStr);
    353365      if Pair.Count >= 2 then
    354         Values[Pair[0]] := Pair[1];
     366        Add(Pair[0], Pair[1]);
    355367    end;
    356368
     
    367379  Result := '';
    368380  for I := 0 to Count - 1 do
    369     Result := Result + '&amp;' + Names[I] + '=' + ValueFromIndex[I];
     381    Result := Result + '&amp;' + Keys[I] + '=' + Items[I].Value;
    370382  Result := Copy(Result, 6, Length(Result));
    371383end;
     
    387399      Pair.Explode(Parts[I], '=', StrToStr);
    388400      if Pair.Count >= 2 then
    389         Values[Trim(Pair[0])] := Trim(Pair[1]);
     401        Add(Trim(Pair[0]), Trim(Pair[1]));
    390402    end;
    391403  finally
     
    401413  Result := '';
    402414  for I := 0 to Count - 1 do
    403     Result := Result + '; ' + Names[I] + '=' + ValueFromIndex[I];
     415    Result := Result + '; ' + Keys[I] + '=' + Items[I].Value;
    404416  Result := Copy(Result, 2, Length(Result));
    405417end;
     
    447459destructor THTTPHandlerData.Destroy;
    448460begin
    449   Request.Free;
    450   Response.Free;
    451   Session.Free;
    452   inherited Destroy;
     461  FreeAndNil(Request);
     462  FreeAndNil(Response);
     463  FreeAndNil(Session);
     464  inherited;
    453465end;
    454466
  • trunk/Packages/CoolWeb/WebServer/UHTTPServerCGI.pas

    r84 r100  
    133133      // Generate cookies
    134134      for I := 0 to Cookies.Count - 1 do
    135         Headers.Add('Set-Cookie', Cookies.Names[I] + '=' + Cookies.ValueFromIndex[I]);
     135        Headers.Add('Set-Cookie', Cookies.Keys[I] + '=' + Cookies.Items[I].Value);
    136136        // + ';path=/;expires=' + RFC822DateTime(Now);
    137137
  • trunk/Packages/CoolWeb/WebServer/UHTTPServerTCP.pas

    r99 r100  
    121121      // Handle cookies
    122122      for I := 0 to Cookies.Count - 1 do
    123         Headers.Add('Set-Cookie', Cookies.Names[I] + '=' + Cookies.ValueFromIndex[I]);
     123        Headers.Add('Set-Cookie', Cookies.Keys[I] + '=' + Cookies.Items[I].Value);
    124124        // + ';path=/;expires=' + RFC822DateTime(Now);
    125125
  • trunk/Packages/CoolWeb/WebServer/UHTTPSessionFile.pas

    r84 r100  
    5858begin
    5959  with HandlerData do begin
    60     if Request.Cookies.IndexOfName(SessionIdCookieName) <> -1 then begin
     60    if Request.Cookies.SearchKey(SessionIdCookieName) <> -1 then begin
    6161      SessionId := Request.Cookies.Values[SessionIdCookieName];
    6262    end else begin
  • trunk/Packages/CoolWeb/WebServer/UHTTPSessionMySQL.pas

    r84 r100  
    6868begin
    6969  with HandlerData do begin
    70     if Request.Cookies.IndexOfName(SessionIdCookieName) <> -1 then begin
     70    if Request.Cookies.SearchKey(SessionIdCookieName) <> -1 then begin
    7171      SessionId := Request.Cookies.Values[SessionIdCookieName];
    7272    end else begin
  • trunk/Packages/TemplateGenerics/Generic/GenericDictionary.inc

    r84 r100  
    9999    Result := Result + 1;
    100100  end;
     101  if Result >= Count then Result := -1;
    101102end;
    102103
  • trunk/Pages/UPageAdmin.pas

    r99 r100  
    104104  with TWebSession(HandlerData) do begin
    105105    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    106       if Request.Query.IndexOfName('name') <> -1 then begin
     106      if Request.Query.SearchKey('name') <> -1 then begin
    107107        ModuleName := Request.Query.Values['name'];
    108108        Module := Core.ModuleManager.FindModuleByName(ModuleName);
     
    126126  with TWebSession(HandlerData) do begin
    127127    with HtmlDocument.Body, THtmlString(SubItems.AddNew(THtmlString.Create)) do begin
    128       if Request.Query.IndexOfName('name') <> -1 then begin
     128      if Request.Query.SearchKey('name') <> -1 then begin
    129129        ModuleName := Request.Query.Values['name'];
    130130        Module := Core.ModuleManager.FindModuleByName(ModuleName);
  • trunk/ZdechovNET.lpi

    r99 r100  
    244244        <IsPartOfProject Value="True"/>
    245245        <HasResources Value="True"/>
     246        <UnitName Value="UWebCamPage"/>
    246247      </Unit22>
    247248      <Unit23>
Note: See TracChangeset for help on using the changeset viewer.