Ignore:
Timestamp:
Sep 9, 2022, 8:20:25 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Removed TemplateGenerics package. Generics usage replaced by standard Generics.Collections.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.