Смекни!
smekni.com

HTML и базы данных (стр. 4 из 4)

OrderCol := nil;

case OperKind of

1: Header.Add('<FORM METHOD="GET" ACTION="'+Request.ScriptName+'/AcceptOrder">');

2: Header.Add('<FORM METHOD="GET" ACTION="'+Request.ScriptName+'/EditPrice">');

end;//case

Header.Add('<BR>¦рЄхуюЁш : <I>'+FieldByName('GroupName').AsString+'</I><BR>');

Close;

//

Footer.Clear;

if OperKind=1 then Footer.Add('<BR>TЁюъ юяырЄv<INPUT TYPE="TEXT" NAME="WHENPAY" VALUE="">');

if OperKind>0 then

begin

Footer.Add('<INPUT TYPE="SUBMIT" VALUE="OK">'

+'<INPUT TYPE="RESET" VALUE="+Єьхэр"></FORM>');

end;

Footer.Add(Format('<A HREF="%s/GetGroup?Gr1=%d&Gr2=%d&Kind=%d">TхЁэєЄ№ё ъ юуыртыхэш¦</A><BR>',

[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 (CellRow<>0) then if (CellRow mod 2=0) then BgColor:='silver' else BgColor:='Gray';

if (OperKind>0) and (CellColumn=0) and (CellRow>0) then

begin

CellData := '<INPUT TYPE=HIDDEN NAME=H'+IntToStr(CellRow)+' VALUE="'+CellData+'">'

+CellData;

end;

if (OperKind>0) and (CellColumn=StoreQTP.Columns.Count-1) and (CellRow>0) then

begin

CellData := '<INPUT TYPE=CHECKBOX NAME=R'+IntToStr(CellRow)+' VALUE=1>¦рърчрЄ№';

s := '<BR><INPUT TYPE=TEXT NAME=T'+IntToStr(CellRow)+' SIZE=5 MAXLENGTH=8 VALUE="';

CellData := 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+'<BR><B>Tv єёях°эю чрЁхушёЄЁшЁютрэv</B>';

if UserStatus>0 then

Response.Content := Response.Content + '<BR>TvсхЁшЄх ЄютрЁэє¦ уЁєяяє ш ттхфшЄх чрърч<BR>'+CreateGroupList(0,0,1)

else

begin

Response.Content := Response.Content + '<BR>T ърўхёЄтх рфьшэшёЄЁрЄюЁр'

+'<BR><a href="http://'+Request.Host+HTMLPath+'/admmenu.htm"><B>TЄЁрэшЎр рфьшэшёЄЁрЄюЁр</B></A>';

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+'<BR>¦хчєы№ЄрЄv яюшёър <I>'+s+'</I>:<BR>'

+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'+'<BR>';

for i:=0 to E.ErrorCount -1 do

Response.Content := Response.Content + E.Errors[i].Message + '<BR>';

Response.Content := Response.Content + CommonEnd;

end;

end;

end;

end.

Библиографический список.

• Компьютер Пресс N2 1997г.

• П. Дарахвелидзе, Е. Марков «Программирование в Delphi 4»

• Компьютер Пресс N4 1997г.

• Компьютер Пресс N5 1998г.

• Computer Week Москва N4(210) 1999г.

• Computer Week Москва N17(223) 1996г.

• Computer Week Москва N18(224) 1998г.

• Компьютерра N15(142) 1996.