home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 October / Chip_2001-10_cd1.bin / zkuste / delphi / nastroje / d3456 / KBMWABD.ZIP / WABD_Admin.pas < prev    next >
Pascal/Delphi Source File  |  2001-06-29  |  22KB  |  683 lines

  1. unit WABD_Admin;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   WABD_Objects,WABD_Utils;
  8.  
  9. type     
  10.   TWABDAdmin = class(TDataModule)
  11.     frmAdmin: TWABD_Form;
  12.     WABD_Raw1: TWABD_HTMLSection;
  13.     tblSessions: TWABD_Table;
  14.     WABDAdminSession: TWABD_Session;
  15.     fsGenerel: TWABD_FormSection;
  16.     WABD_Button1: TWABD_Button;
  17.     WABD_Label1: TWABD_Label;
  18.     lSessionCnt: TWABD_Label;
  19.     fsSessions: TWABD_FormSection;
  20.     WABD_Button2: TWABD_Button;
  21.     WABD_Label16: TWABD_Label;
  22.     cbStats: TWABD_ComboBox;
  23.     tblStats: TWABD_Table;
  24.     fsStats: TWABD_FormSection;
  25.     WABD_Raw2: TWABD_HTMLSection;
  26.     fsStatHeader: TWABD_FormSection;
  27.     WABD_Label2: TWABD_Label;
  28.     lBufferSize: TWABD_Label;
  29.     WABD_Label4: TWABD_Label;
  30.     lSize: TWABD_Label;
  31.     WABD_Label6: TWABD_Label;
  32.     lAverage: TWABD_Label;
  33.     WABD_Label8: TWABD_Label;
  34.     lSum: TWABD_Label;
  35.     WABD_Label10: TWABD_Label;
  36.     lPointCount: TWABD_Label;
  37.     WABD_Label12: TWABD_Label;
  38.     lMin: TWABD_Label;
  39.     WABD_Label14: TWABD_Label;
  40.     lMax: TWABD_Label;
  41.     WABD_Label3: TWABD_Label;
  42.     lSite: TWABD_Label;
  43.     fsSetup: TWABD_FormSection;
  44.     WABD_Label5: TWABD_Label;
  45.     WABD_Label7: TWABD_Label;
  46.     eAdminUser: TWABD_Edit;
  47.     eAdminPassword: TWABD_Edit;
  48.     eAdminPasswordRetype: TWABD_Edit;
  49.     WABD_Label9: TWABD_Label;
  50.     btnSetAdminUser: TWABD_Button;
  51.     lPasswordStatus: TWABD_Label;
  52.     chbGarbageCollection: TWABD_CheckBox;
  53.     eGarbageInterval: TWABD_Edit;
  54.     WABD_Label11: TWABD_Label;
  55.     chbGatherStatistics: TWABD_CheckBox;
  56.     WABD_Label13: TWABD_Label;
  57.     eAdminText: TWABD_Edit;
  58.     btnSetGarbage: TWABD_Button;
  59.     lGarbageStatus: TWABD_Label;
  60.     WABD_Label15: TWABD_Label;
  61.     eTimeout: TWABD_Edit;
  62.     btnSetAdminText: TWABD_Button;
  63.     WABD_Label17: TWABD_Label;
  64.     lSessionID: TWABD_Label;
  65.     WABD_Label18: TWABD_Label;
  66.     eMaxSessions: TWABD_Edit;
  67.     btnMax: TWABD_Button;
  68.     WABD_Label19: TWABD_Label;
  69.     WABD_Label20: TWABD_Label;
  70.     WABD_Label21: TWABD_Label;
  71.     WABD_Label22: TWABD_Label;
  72.     btnSaveStats: TWABD_Button;
  73.     btnLoadStats: TWABD_Button;
  74.     btnClearStat: TWABD_Button;
  75.     btnClearAllStats: TWABD_Button;
  76.     frmLoggedOff: TWABD_Form;
  77.     rawLogout: TWABD_HTMLSection;
  78.     WABD_Label23: TWABD_Label;
  79.     eRouteWhen: TWABD_Edit;
  80.     WABD_Label24: TWABD_Label;
  81.     eRouteHow: TWABD_Edit;
  82.     WABD_Label25: TWABD_Label;
  83.     mRouteSites: TWABD_Memo;
  84.     WABD_Label26: TWABD_Label;
  85.     WABD_Label27: TWABD_Label;
  86.     WABD_Label28: TWABD_Label;
  87.     btnSetRoute: TWABD_Button;
  88.     WABD_Label29: TWABD_Label;
  89.     eMaxIdenticalUser: TWABD_Edit;
  90.     WABD_Label30: TWABD_Label;
  91.     WABD_Label31: TWABD_Label;
  92.     eInfo: TWABD_Edit;
  93.     btnSendTextSessions: TWABD_Button;
  94.     WABD_Label32: TWABD_Label;
  95.     chbNetworkStats: TWABD_CheckBox;
  96.     procedure WABDAdminSessionFirstLogon(RemoteHost: String);
  97.     procedure WABD_Button1UserClick(Sender: TObject);
  98.     procedure tblSessionsUserClick(Sender: TObject; RowIndex: Integer);
  99.     procedure WABD_Button2UserClick(Sender: TObject);
  100.     procedure cbStatsUserChange(Sender: TObject);
  101.     procedure btnSetAdminUserUserClick(Sender: TObject);
  102.     procedure btnSetGarbageUserClick(Sender: TObject);
  103.     procedure btnSetAdminTextUserClick(Sender: TObject);
  104.     procedure btnTerminateDLLUserClick(Sender: TObject);
  105.     procedure btnMaxUserClick(Sender: TObject);
  106.     procedure btnSaveStatsUserClick(Sender: TObject);
  107.     procedure btnLoadStatsUserClick(Sender: TObject);
  108.     procedure btnClearStatUserClick(Sender: TObject);
  109.     procedure btnClearAllStatsUserClick(Sender: TObject);
  110.     procedure btnSetRouteUserClick(Sender: TObject);
  111.     procedure btnSendTextSessionsUserClick(Sender: TObject);
  112.     procedure tblSessionsRenderCell(Sender: TWABD_Table; Row, Col: Integer;
  113.       var Text: String; var HAlign: TWABD_HorzAlignment;
  114.       var VAlign: TWABD_VertAlignment; var Color, BGColor: TColor;
  115.       var Size: Integer; var Bold, Italic, Underline, Fixed,
  116.       Strike: Boolean; var Width, Height: Integer;
  117.       var AllowWordWrap: Boolean);
  118.     procedure tblStatsRenderCell(Sender: TWABD_Table; Row, Col: Integer;
  119.       var Text: String; var HAlign: TWABD_HorzAlignment;
  120.       var VAlign: TWABD_VertAlignment; var Color, BGColor: TColor;
  121.       var Size: Integer; var Bold, Italic, Underline, Fixed,
  122.       Strike: Boolean; var Width, Height: Integer;
  123.       var AllowWordWrap: Boolean);
  124.   private
  125.     { Private declarations }
  126.     FAppSetupForm:TWABD_Form;
  127.  
  128.   public
  129.     { Public declarations }
  130.     constructor Create(AOwner:TComponent); override;
  131.     constructor CreateWithAppSetupForm(AOwner:TComponent; AppSetupForm:TWABD_Form);
  132.     procedure KillAllSessions;
  133.     procedure KillSession(SesID:integer);
  134.     procedure BuildSessionList;
  135.     procedure BuildStats(grpname:string);
  136.     procedure BuildSetup;
  137.     procedure Update;
  138.   end;
  139.  
  140. var
  141.   WABDAdmin: TWABDAdmin;
  142.  
  143. implementation
  144.  
  145. const
  146.   IDENT_SESSION='wabdstatses';
  147.   IDENT_SETUP='wabdstatsetup';
  148.   IDENT_APPSETUP='wabdappsetup';
  149.  
  150. {$R *.DFM}
  151.  
  152. constructor TWABDAdmin.Create(AOwner:TComponent);
  153. begin
  154.      FAppSetupForm:=nil;
  155.      inherited;
  156. end;
  157.  
  158. constructor TWABDAdmin.CreateWithAppSetupForm(AOwner:TComponent; AppSetupForm:TWABD_Form);
  159. begin
  160.      FAppSetupForm:=AppSetupForm;
  161.      inherited Create(AOwner);
  162. end;
  163.  
  164. procedure TWABDAdmin.Update;
  165. var
  166.    i:integer;
  167.    oi:integer;
  168.    lst:TList;
  169. begin
  170.      // Build list of stats.
  171.      oi:=cbStats.SelIndex;
  172.      with frmAdmin.Session.SessionMgr do
  173.      begin
  174.           cbStats.Lines.clear;
  175.           cbStats.Lines.Add(IDENT_SESSION+'=Sessions');
  176.           cbStats.Lines.Add(IDENT_SETUP+'=General setup');
  177.           if FAppSetupForm<>nil then cbStats.Lines.Add(IDENT_APPSETUP+'=Application setup');
  178.           if Stats<>nil then
  179.           begin
  180.               lst:=Stats.LockList;
  181.               try
  182.                  for i:=0 to lst.count-1 do
  183.                      cbStats.Lines.Add(TWABD_SesStatGroup(lst.Items[i]).Name);
  184.               finally
  185.                  Stats.UnlockList;
  186.               end;
  187.           end;
  188.      end;
  189.      cbStats.SelIndex:=oi;
  190.      if cbStats.SelIndex<0 then cbStats.SelIndex:=0;
  191.  
  192.      // Check choise.
  193.      if cbStats.Text=IDENT_SESSION then
  194.      begin
  195.           BuildSessionList;
  196.           tblSessions.Visible:=true;
  197.           tblStats.Visible:=false;
  198.           fsSetup.Visible:=false;
  199.      end else if cbStats.Text=IDENT_SETUP then
  200.      begin
  201.           BuildSetup;
  202.           fsSetup.Visible:=true;
  203.           tblSessions.Visible:=false;
  204.           tblStats.Visible:=false;
  205.      end else if cbStats.Text=IDENT_APPSETUP then
  206.      begin
  207.           FAppSetupForm.show;
  208.      end else if cbStats.Text<>'' then
  209.      begin
  210.           BuildStats(cbStats.Text);
  211.           tblStats.visible:=true;
  212.           tblSessions.visible:=false;
  213.           fsSetup.Visible:=false;
  214.      end;
  215.  
  216.      with frmAdmin.Session.SessionMgr do
  217.      begin
  218.           lSite.caption:=SiteName;
  219.      end;
  220.      lSessionID.caption:=inttostr(WABDAdminSession.sessionID);
  221. end;
  222.  
  223. procedure TWABDAdmin.KillAllSessions;
  224. var
  225.    i:integer;
  226.    lst:TList;
  227.    ses:TWABD_Session;
  228. begin
  229.      with frmAdmin.Session.SessionMgr do
  230.      begin
  231.           lst:=SessionList.LockList;
  232.           try
  233.              for i:=lst.Count-1 downto 0 do
  234.              begin
  235.                   ses:=TWABD_Session(lst.Items[i]);
  236.                   if ses.SessionID<>WABDAdminSession.SessionID then
  237.                   begin
  238.                        ses.LogOff;
  239.                        CheckLogOff(ses);
  240.                   end;
  241.              end;
  242.           finally
  243.              SessionList.UnlockList;
  244.           end;
  245.      end;
  246. end;
  247.  
  248. procedure TWABDAdmin.KillSession(SesID:integer);
  249. var
  250.    i:integer;
  251.    lst:TList;
  252.    ses:TWABD_Session;
  253. begin
  254.      with frmAdmin.Session.SessionMgr do
  255.      begin
  256.           lst:=SessionList.LockList;
  257.           try
  258.              for i:=0 to lst.Count-1 do
  259.              begin
  260.                   ses:=TWABD_Session(lst.Items[i]);
  261.                   if ses.SessionID=SesID then
  262.                   begin
  263.                        ses.LogOff;
  264.                        if SesID<>WABDAdminSession.sessionID then CheckLogOff(ses);
  265.                        break;
  266.                   end;
  267.              end;
  268.           finally
  269.              SessionList.UnlockList;
  270.           end;
  271.      end;
  272. end;
  273.  
  274. procedure TWABDAdmin.BuildSetup;
  275. begin
  276.      with frmAdmin.Session.SessionMgr do
  277.      begin
  278.           eAdminUser.text:=Admin.AdminUser;
  279.           eAdminPassword.text:=Admin.AdminPassword;
  280.           eAdminPasswordRetype.Text:='';
  281.           chbGarbageCollection.Checked:=GarbageCollection;
  282.           eGarbageInterval.Text:=inttostr(CheckTimeOutInterval);
  283.           chbGatherStatistics.Checked:=GatherStatistics;
  284.           chbNetworkStats.Checked:=NetworkStatistics;
  285.           eTimeOut.Text:=inttostr(DefaultSessionTimeout);
  286.           eAdminText.Text:=WebAdministrator;
  287.           eMaxSessions.Text:=inttostr(MaxConcurrentSessions);
  288.           eMaxIdenticalUser.Text:=inttostr(MaxIdenticalUser);
  289.           eRouteWhen.Text:=inttostr(ord(RouteWhen));
  290.           eRouteHow.Text:=inttostr(ord(RouteHow));
  291.           mRouteSites.Lines.Assign(RouteSites);
  292.      end;
  293. end;
  294.  
  295. procedure TWABDAdmin.BuildStats(grpname:string);
  296. var
  297.    i,j:integer;
  298.    grp:TWABD_SesStatGroup;
  299.    avg:double;
  300.    header:string;
  301.    lst,grplst:TList;
  302. const
  303.      Weekdays:array [1..7] of string = ( 'Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
  304.      MonthNames:array [1..12] of string = ( 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec' );
  305. begin
  306.  
  307.      with frmAdmin.Session.SessionMgr,tblStats do
  308.      begin
  309.           i:=Stats.IndexOf(grpname);
  310.  
  311.           lst:=Stats.LockList;
  312.           try
  313.               grp:=TWABD_SesStatGroup(lst.Items[i]);
  314.  
  315.               // Decide header.
  316.               case grp.GroupType of
  317.                  wabdstatgroupTurnAround: header:='msecs.';
  318.                  wabdstatgroupcount: header:='Count';
  319.                  wabdstatgroupvalue: header:='Value';
  320.               end;
  321.  
  322.               // Setup table.
  323.               grplst:=grp.LockList;
  324.               try
  325.                   Cells.SafeSetSize(4,1+24+1+31+1+12+1+7+1+grplst.count);
  326.                   j:=0;
  327.  
  328.                   // Build hourly list.
  329.                   Cells[0,j]:='*Hour';
  330.                   Cells[1,j]:='*Count';
  331.                   Cells[2,j]:='*Sum';
  332.                   Cells[3,j]:='*Avg.';
  333.                   inc(j);
  334.                   for i:=0 to 23 do
  335.                   begin
  336.                        Cells[0,j]:=inttostr(i);
  337.                        Cells[1,j]:=inttostr(grp.HourlyCount[i]);
  338.                        Cells[2,j]:=format('%.2f',[grp.HourlyValues[i]]);
  339.                        if grp.HourlyCount[i]>0 then
  340.                           Cells[3,j]:=format('%.2f',[grp.HourlyValues[i] / grp.HourlyCount[i]])
  341.                        else
  342.                            Cells[3,j]:='N/A';
  343.                        inc(j);
  344.                   end;
  345.  
  346.                   // Build hourly list.
  347.                   Cells[0,j]:='*Day';
  348.                   Cells[1,j]:='*Count';
  349.                   Cells[2,j]:='*Sum';
  350.                   Cells[3,j]:='*Avg.';
  351.                   inc(j);
  352.                   for i:=1 to 31 do
  353.                   begin
  354.                        Cells[0,j]:=inttostr(i);
  355.                        Cells[1,j]:=inttostr(grp.DailyCount[i]);
  356.                        Cells[2,j]:=format('%.2f',[grp.DailyValues[i]]);
  357.                        if grp.DailyCount[i]>0 then
  358.                           Cells[3,j]:=format('%.2f',[grp.DailyValues[i] / grp.DailyCount[i]])
  359.                        else
  360.                            Cells[3,j]:='N/A';
  361.                        inc(j);
  362.                   end;
  363.  
  364.                   // Build monthly list.
  365.                   Cells[0,j]:='*Month';
  366.                   Cells[1,j]:='*Count';
  367.                   Cells[2,j]:='*Sum';
  368.                   Cells[3,j]:='*Avg.';
  369.                   inc(j);
  370.                   for i:=1 to 12 do
  371.                   begin
  372.                        Cells[0,j]:=MonthNames[i];
  373.                        Cells[1,j]:=inttostr(grp.MonthlyCount[i]);
  374.                        Cells[2,j]:=format('%.2f',[grp.MonthlyValues[i]]);
  375.                        if grp.MonthlyCount[i]>0 then
  376.                           Cells[3,j]:=format('%.2f',[grp.MonthlyValues[i] / grp.MonthlyCount[i]])
  377.                        else
  378.                            Cells[3,j]:='N/A';
  379.                        inc(j);
  380.                   end;
  381.  
  382.                   // Build day list.
  383.                   Cells[0,j]:='*Weekday';
  384.                   Cells[1,j]:='*Count';
  385.                   Cells[2,j]:='*Sum';
  386.                   Cells[3,j]:='*Avg.';
  387.                   inc(j);
  388.                   for i:=1 to 7 do
  389.                   begin
  390.                        Cells[0,j]:=WeekDays[i];
  391.                        Cells[1,j]:=inttostr(grp.DayCount[i]);
  392.                        Cells[2,j]:=format('%.2f',[grp.DayValues[i]]);
  393.                        if grp.DayCount[i]>0 then
  394.                           Cells[3,j]:=format('%.2f',[grp.DayValues[i] / grp.DayCount[i]])
  395.                        else
  396.                            Cells[3,j]:='N/A';
  397.                        inc(j);
  398.                   end;
  399.  
  400.                   // Build list.
  401.                   Cells[0,j]:='*Timestamp';
  402.                   Cells[1,j]:='*User';
  403.                   Cells[2,j]:='*Info';
  404.                   Cells[3,j]:='*'+header;
  405.                   inc(j);
  406.                   for i:=grplst.Count-1 downto 0 do
  407.                       with PWABD_SesStatRec(grplst.Items[i])^do
  408.                       begin
  409.                            Cells[0,j]:=DateTimeToStr(Stamp);
  410.                            Cells[1,j]:=User;
  411.                            Cells[2,j]:=Info;
  412.                            Cells[3,j]:=floattostr(trunc(Value));
  413.                            inc(j);
  414.                       end;
  415.  
  416.                   // Build substat list.
  417.  
  418.                   // Show group values.
  419.                   lBufferSize.caption:=inttostr(grp.BufferSize);
  420.                   lSize.caption:=inttostr(grplst.Count);
  421.                   lPointCount.caption:=inttostr(grp.TotalCount);
  422.                   if grp.TotalCount>0 then
  423.                      avg:=grp.Sum / grp.TotalCount
  424.                   else
  425.                       avg:=0;
  426.                   lAverage.caption:=format('%.2f',[avg]);;
  427.                   lMin.caption:=format('%.2f',[grp.Min]);
  428.                   lMax.caption:=format('%.2f',[grp.Max]);
  429.                   lSum.caption:=format('%.2f',[grp.Sum]);
  430.               finally
  431.                   grp.UnlockList;
  432.               end;
  433.           finally
  434.               Stats.UnlockList;
  435.           end;
  436.      end;
  437. end;
  438.  
  439. procedure TWABDAdmin.BuildSessionList;
  440. var
  441.    i:integer;
  442.    lst:TList;
  443. begin
  444.      with frmAdmin.Session.SessionMgr,tblSessions do
  445.      begin
  446.           eInfo.Text:=Info;
  447.           lst:=SessionList.LockList;
  448.           try
  449.              lSessionCnt.caption:=inttostr(lst.count);
  450.  
  451.              Cells.SafeSetSize(6,lst.count+1);
  452.              Cells[0,0]:='SessionID';
  453.              Cells[1,0]:='User';
  454.              Cells[2,0]:='Browser';
  455.              Cells[3,0]:='Logged on';
  456.              Cells[4,0]:='Last access';
  457.              Cells[5,0]:='Timeout (secs.)';
  458.  
  459.              for i:=0 to lst.Count-1 do
  460.                with TWABD_Session(lst.Items[i]) do
  461.                begin
  462.                     Cells[0,i+1]:=IntToStr(SessionID);
  463.                     Cells[1,i+1]:=UserName;
  464.                     Cells[2,i+1]:=WABD_Browser[Request.Browser]+' '+FloatToStr(Request.BrowserVersion);
  465.                     Cells[3,i+1]:=DateTimeToStr(CreateTime);
  466.                     Cells[4,i+1]:=DateTimeToStr(LastAccess);
  467.                     Cells[5,i+1]:=inttostr(TimeOutLength-trunc(24*60*60*(now-LastAccess)));
  468.                end;
  469.           finally
  470.              SessionList.UnlockList;
  471.           end;
  472.      end;
  473. end;
  474.  
  475. procedure TWABDAdmin.WABDAdminSessionFirstLogon(RemoteHost: String);
  476. begin
  477.      Update;
  478. end;
  479.  
  480. procedure TWABDAdmin.WABD_Button1UserClick(Sender: TObject);
  481. begin
  482.      Update;
  483. end;
  484.  
  485. procedure TWABDAdmin.tblSessionsUserClick(Sender: TObject;
  486.   RowIndex: Integer);
  487. var
  488.    SesID:integer;
  489. begin
  490.      SesID:=StrToInt(tblSessions.Cells[0,RowIndex]);
  491.      KillSession(SesID);
  492.      if SesID=WABDAdminSession.sessionID then
  493.      begin
  494.           rawLogout.HTML.Text:=frmAdmin.Session.SessionMgr.Admin.LogoutHTML;
  495.           frmLoggedOff.Show;
  496.      end
  497.      else Update;
  498. end;
  499.  
  500. procedure TWABDAdmin.WABD_Button2UserClick(Sender: TObject);
  501. begin
  502.      KillAllSessions;
  503.      Update;
  504. end;
  505.  
  506. // Show stats.
  507. procedure TWABDAdmin.cbStatsUserChange(Sender: TObject);
  508. begin
  509.      Update;
  510. end;
  511.  
  512. // Setup admin username/password.
  513. procedure TWABDAdmin.btnSetAdminUserUserClick(Sender: TObject);
  514. begin
  515.      with frmAdmin.Session.SessionMgr do
  516.      begin
  517.           if (length(eAdminUser.Text)>0) and (eAdminPassword.Text = eAdminPasswordRetype.Text) then
  518.           begin
  519.                Admin.AdminUser:=Trim(eAdminUser.Text);
  520.                Admin.AdminPassword:=Trim(eAdminPassword.Text);
  521.                eAdminPasswordRetype.Text:='';
  522.                lPasswordStatus.caption:='New username and password is set.';
  523.           end
  524.           else
  525.               lPasswordStatus.caption:='Username not given or password retyped incorrectly.';
  526.      end;
  527.      Update;
  528. end;
  529.  
  530. // Setup garbage collection/stat collection.
  531. procedure TWABDAdmin.btnSetGarbageUserClick(Sender: TObject);
  532. var
  533.    i,t:integer;
  534. begin
  535.      with frmAdmin.Session.SessionMgr do
  536.      begin
  537.           try
  538.              i:=strtoint(eGarbageInterval.Text);
  539.              if (i<10) or (i>9999) then raise Exception.Create('Invalid value.');
  540.              t:=strtoint(eTimeOut.Text);
  541.              if (t<-1) then raise Exception.Create('Invalid value');
  542.           except
  543.              lGarbageStatus.caption:='Invalid interval entered.';
  544.              exit;
  545.           end;
  546.  
  547.           CheckTimeOutInterval:=i;
  548.           GarbageCollection:=chbGarbageCollection.Checked;
  549.           GatherStatistics:=chbGatherStatistics.Checked;
  550.           NetworkStatistics:=chbNetworkStats.Checked;
  551.           DefaultSessionTimeout:=t;
  552.           lGarbageStatus.caption:='Garbage/stat.collection setup is set.';
  553.      end;
  554.      Update;
  555. end;
  556.  
  557. procedure TWABDAdmin.btnSetAdminTextUserClick(Sender: TObject);
  558. begin
  559.      with frmAdmin.Session.SessionMgr do
  560.          WebAdministrator:=trim(eAdminText.Text);
  561.      Update;
  562. end;
  563.  
  564. procedure TWABDAdmin.btnTerminateDLLUserClick(Sender: TObject);
  565. begin
  566.      KillAllSessions;
  567.      KillSession(WABDAdminSession.SessionID);
  568.  
  569. end;
  570.  
  571. procedure TWABDAdmin.btnMaxUserClick(Sender: TObject);
  572. begin
  573.      with frmAdmin.Session.SessionMgr do
  574.         try
  575.            MaxConcurrentSessions:=strtoint(eMaxSessions.Text);
  576.            MaxIdenticalUser:=strtoint(eMaxIdenticalUser.Text);
  577.         except
  578.         end;
  579.      Update;
  580. end;
  581.  
  582. procedure TWABDAdmin.btnSaveStatsUserClick(Sender: TObject);
  583. begin
  584.      with frmAdmin.Session do
  585.           if SessionMgr.Stats<>nil then SessionMgr.Stats.Save(Request.DllName);
  586. end;
  587.  
  588. procedure TWABDAdmin.btnLoadStatsUserClick(Sender: TObject);
  589. begin
  590.      with frmAdmin.Session do
  591.           if SessionMgr.Stats<>nil then SessionMgr.Stats.Load(Request.DllName);
  592.      Update;
  593. end;
  594.  
  595. procedure TWABDAdmin.btnClearStatUserClick(Sender: TObject);
  596. var
  597.    grp:TWABD_SesStatGroup;
  598.    lst:TList;
  599.    i:integer;
  600. begin
  601.      with frmAdmin.Session.SessionMgr do
  602.      begin
  603.           if Stats=nil then exit;
  604.  
  605.           i:=Stats.IndexOf(cbStats.Text);
  606.           lst:=Stats.LockList;
  607.           try
  608.              grp:=TWABD_SesStatGroup(lst.Items[i]);
  609.              if grp=nil then exit;
  610.              grp.Zero;
  611.           finally
  612.              Stats.UnlockList;
  613.           end;
  614.      end;
  615.      Update;
  616. end;
  617.  
  618. procedure TWABDAdmin.btnClearAllStatsUserClick(Sender: TObject);
  619. begin
  620.      with frmAdmin.Session.SessionMgr do
  621.           if Stats<>nil then Stats.Zero;
  622.      Update;
  623. end;
  624.  
  625. procedure TWABDAdmin.btnSetRouteUserClick(Sender: TObject);
  626. begin
  627.      with frmAdmin.Session.SessionMgr do
  628.           try
  629.              RouteWhen:=TWABD_RouteWhen(strtoint(eRouteWhen.Text));
  630.              RouteHow:=TWABD_RouteHow(strtoint(eRouteHow.Text));
  631.              RouteSites.Assign(mRouteSites.Lines);
  632.           except
  633.                eRouteWhen.Text:=inttostr(ord(RouteWhen));
  634.                eRouteHow.Text:=inttostr(ord(RouteHow));
  635.                mRouteSites.Lines.Assign(RouteSites);
  636.           end;
  637. end;
  638.  
  639. procedure TWABDAdmin.btnSendTextSessionsUserClick(Sender: TObject);
  640. var
  641.    lst:TList;
  642.    s:string;
  643.    i:integer;
  644. begin
  645.      s:=Trim(eInfo.Text);
  646.      with frmAdmin.Session.SessionMgr do
  647.      begin
  648.           Info:=s;
  649.           lst:=SessionList.LockList;
  650.           try
  651.              for i:=0 to lst.count-1 do
  652.                  with TWABD_Session(lst.Items[i]) do
  653.                       Info:=s;
  654.           finally
  655.              SessionList.UnlockList;
  656.           end;
  657.      end;
  658. end;
  659.  
  660. procedure TWABDAdmin.tblSessionsRenderCell(Sender: TWABD_Table; Row,
  661.   Col: Integer; var Text: String; var HAlign: TWABD_HorzAlignment;
  662.   var VAlign: TWABD_VertAlignment; var Color, BGColor: TColor;
  663.   var Size: Integer; var Bold, Italic, Underline, Fixed, Strike: Boolean;
  664.   var Width, Height: Integer; var AllowWordWrap: Boolean);
  665. begin
  666.      if (Col=0) or (Row=0) then BGColor:=clSilver;
  667. end;
  668.  
  669. procedure TWABDAdmin.tblStatsRenderCell(Sender: TWABD_Table; Row,
  670.   Col: Integer; var Text: String; var HAlign: TWABD_HorzAlignment;
  671.   var VAlign: TWABD_VertAlignment; var Color, BGColor: TColor;
  672.   var Size: Integer; var Bold, Italic, Underline, Fixed, Strike: Boolean;
  673.   var Width, Height: Integer; var AllowWordWrap: Boolean);
  674. begin
  675.      if (length(Text)>0) and (Text[1]='*') then
  676.      begin
  677.           BGColor:=clSilver;
  678.           Text:=copy(Text,2,length(Text));
  679.      end;
  680. end;
  681.  
  682. end.
  683.