0)',[Gr1]);
try
Result := Result + GroupListProducer(GroupQuery,Kind);
if Gr10 then
Result := Result + Format('TхЁэєЄ№ё ъ
юуыртыхэш¦
',
[Request.ScriptName, 0,0, Kind]);
except
on E:EDBEngineError do
begin
Result := Result + '+°шсър BDE'+'
';
for i:=0 to E.ErrorCount -1 do
Result := Result + E.Errors[i].Message + '
';
end;
end;
end;
Result := Result+'¦юшёъ'
+CommonEnd;
end;
// QueryAction - GetGroup тvтюф ЄрсышЎv яю Єют.уЁєяях
threadvar OperKind : Integer;
procedure TWebModule1.WebModule1GetGroupAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var gn1,gn2 : Integer; OrderCol : THTMLTableColumn;
begin
with Request.QueryFields do
begin
gn1 := IndexOfName('Kind');
if (gn10) then OperKind := StrToIntDef(Values['Kind'],0);
if gn1>=0 then Delete(gn1);
gn1 := StrToIntDef(Values['Gr1'],0);
gn2 := StrToIntDef(Values['Gr2'],0);
end; //with
if gn1=0 then Response.Content := CommonLook+CreateGroupList(gn1,gn2,OperKind)
else if gn2=0 then Response.Content := CommonLook+CreateGroupList(gn1,gn2,OperKind)
else
begin
//define group name
with GroupQuery do
begin
SQL.Text := 'SELECT * FROM Groups WHERE (MainGroup=:gn1) and (SubGroup=:gn2)';
Params[0].AsInteger := gn1;
Params[1].AsInteger := gn2;
Open;
with StoreQTP do
begin
Header.Clear;
Header.Add(CommonLook);
if OperKind>0 then
begin
OrderCol := THTMLTableColumn.Create(StoreQTP.Columns);
OrderCol.Title.Caption := '¦рърч';
end
else
OrderCol := nil;
case OperKind of
1: Header.Add('');
2: Header.Add('');
end;//case
Header.Add('
¦рЄхуюЁш: '+FieldByName('GroupName').AsString+'
');
Close;
//
Footer.Clear;
if OperKind=1 then Footer.Add('
TЁюъ юяырЄv');
if OperKind>0 then
begin
Footer.Add(''
+'');
end;
Footer.Add(Format('TхЁэєЄ№ё ъ
юуыртыхэш¦
',
[Request.ScriptName, gn1,0, OperKind]));
end;//with storeqtp
end;//with groupquery
Response.Content := StoreQTP.Content;
if Assigned(OrderCol) then OrderCol.Free;
end; //generating table
end;
procedure TWebModule1.StoreQTPFormatCell(Sender: TObject;
CellRow, CellColumn: Integer; var BgColor: THTMLBgColor;
var Align: THTMLAlign; var VAlign: THTMLVAlign; var CustomAttrs,
CellData: String);
var s: string;
begin
if (CellRow0) then if (CellRow mod 2=0) then BgColor:='silver' else BgColor:='Gray';
if (OperKind>0) and (CellColumn=0) and (CellRow>0) then
begin
CellData := ''
+CellData;
end;
if (OperKind>0) and (CellColumn=StoreQTP.Columns.Count-1) and (CellRow>0) then
begin
CellData := '¦рърчрЄ№';
s := '
';
end;
end;
procedure TWebModule1.StoreQTPGetTableCaption(Sender: TObject;
var Caption: String; var Alignment: THTMLCaptionAlignment);
begin
Caption :='=рщфхэю чряшёхщ: '+ IntToStr(StoreQTP.Query.RecordCount);
end;
procedure TWebModule1.WebModule1ValidateAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
with ValidateQuery do
begin
Params[0].AsString := Request.QueryFields.Values['UserName'];
Params[1].AsString := Request.QueryFields.Values['Password'];
try
Open;
if RecordCount>0 then
begin
UserStatus := FieldByName('UserCategory').AsInteger;
Response.Content := CommonLook+'
Tv єёях°эю чрЁхушёЄЁшЁютрэv';
if UserStatus>0 then
Response.Content := Response.Content + '
TvсхЁшЄх ЄютрЁэє¦ уЁєяяє ш ттхфшЄх
чрърч
'+CreateGroupList(0,0,1)
else
begin
Response.Content := Response.Content + '
T ърўхёЄтх рфьшэшёЄЁрЄюЁр'
+'
TЄЁрэшЎр
рфьшэшёЄЁрЄюЁр';
end;
end
else
Response.Content := CommonLook+'Tр°ш фрээvх юЄёєЄёЄтє¦Є т срчх. +сЁрЄшЄхё№ ъ эрь яю рфЁхёє xxx@yyy.zzz';
finally
Close;
end;
end;
end;
procedure TWebModule1.WebModule1AcceptOrderAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
Response.Content := CommonLook+sOrderAccepted+CommonEnd;
// -ры№°х тёЄрт№Єх ётющ ъюф фы тъы¦ўхэш чрърчр т срчє
end;
procedure TWebModule1.WebModule1SearchAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var s: string;
begin
s:= Request.QueryFields.Values['Phrase'];
GroupQuery.SQL.Text := 'SELECT * FROM Groups WHERE GroupName LIKE "%'+s+'%"';
Response.Content := CommonLook+'
¦хчєы№ЄрЄv яюшёър '+s+':
'
+GroupListProducer(GroupQuery,0)+CommonEnd;
end;
procedure TWebModule1.WebModule1AddMSgAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var MCookies : TStringList;i: integer;
begin
Response.Content := CommonLook;
with AddMsgQuery do
try
Params[0].AsString:=Request.QueryFields.Values['Sender'];
Params[1].AsString:=Request.Host;
Params[2].AsDateTime:=Request.Date;
Params[3].AsMemo:=Request.QueryFields.Values['Message'];
Prepare;
ExecSQL;
MCookies := TStringList.Create;
MCookies.Add('User='+Request.PathTranslated);
MCookies.Add('Test='+Request.RemoteHost);
MCookies.Add('Time='+Request.UserAgent);
Response.SetCookieField(MCookies, '', Request.PathInfo , Date+1, False);
MCookies.Free;
Response.Content := Response.Content + 'Tр°х ёююс•хэшх яЁшэЄю' + CommonEnd;
except
on E:EDBEngineError do
begin
Response.Content := Response.Content + '+°шсър BDE'+'
';
for i:=0 to E.ErrorCount -1 do
Response.Content := Response.Content + E.Errors[i].Message + '
';
Response.Content := Response.Content + CommonEnd;
end;
end;
end;
end.
Библиографический список.1. Компьютер Пресс N2 1997г.
2. П. Дарахвелидзе, Е. Марков «Программирование в Delphi 4»
3. Компьютер Пресс N4 1997г.
4. Компьютер Пресс N5 1998г.
5. Computer Week Москва N4(210) 1999г.
6. Computer Week Москва N17(223) 1996г.
7. Computer Week Москва N18(224) 1998г.
8. Компьютерра N15(142) 1996.