unit UpFileSelectOnLineFrm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, DBClient, ZjGridDBA, ZJGrid;

type
  TUpFileSelectOnLineForm = class(TForm)
    ZJGrid1: TZJGrid;
    ZjGridDBA1: TZjGridDBA;
    cdsFiles: TClientDataSet;
    btnOK: TButton;
    btnCancel: TButton;
    cdsFilesID: TStringField;
    cdsFilesName: TStringField;
    cdsFilesUper: TStringField;
    cdsFilesSelect: TBooleanField;
  private
    { Private declarations }
  public
    { Public declarations }
    procedure InitData(AList: TList);
    procedure UpOnlineFiles;
  end;

implementation

uses UpFileManageUnit, Math, PHPWebDm;

{$R *.dfm}

{ TUpFileSelectOnLineForm }

procedure TUpFileSelectOnLineForm.InitData(AList: TList);
var i: Integer;
  vFile: TUpFile;
begin
  if AList.Count = 0 then Exit;

  if cdsFiles.RecordCount > 0 then
    cdsFiles.EmptyDataSet;

  for i := 0 to AList.Count - 1 do
  begin
    vFile := TUpFile(AList[i]);
    cdsFiles.Append;
    cdsFilesID.AsInteger := vFile.ID;
    cdsFilesName.AsString := vFile.DisplayName;
    cdsFilesUper.AsString := vFile.UperName;
    cdsFiles.Post;
  end;
end;

procedure TUpFileSelectOnLineForm.UpOnlineFiles;
var L: Integer;
  vA: array of string;
begin
  if cdsFiles.RecordCount = 0 then Exit;
  L := 0;
  cdsFiles.First;
  while not cdsfiles.Eof do
  begin
    if cdsFilesSelect.AsBoolean = True then
    begin
      Inc(L);
      SetLength(vA, L);
      vA[L - 1] := cdsFilesID.AsString;
    end;
    cdsFiles.Next;
  end;
//  if L > 0 then       AAAAA
//    PHPWeb.UpAttachment(PHPWeb.UserID, );
end;

end.
