TIWAppForm = class(TIWForm)
Methods
class procedure SetAsMainForm;
Use this procedure to set your form as the main form of the application. The call to this class method must be done in the initialization section of your IW form unit. The IntraWeb Application Wizard already adds a call to this method to the form created by the wizard.
class procedure SetURL(const aPath: string; const aDocument: string);
Use this class procedure to set a relative ULR and HTML document to be mapped to the IW form. Same as URL Mapping.
The sample code below maps "/green.html" to the TGreenForm, ie, when the user access /green.html the TGreenForm is shown.
type
TGreenForm = class(TIWAppForm)
IWLabel1: TIWLabel;
public
end;
implementation
{$R *.dfm}
initialization
TGreenForm.SetURL('/', 'green.html');
end.
class function RequestAuth(aRequest: THttpRequest; var rGroup: string): Boolean; virtual;
Override this class procedure to inform if authorization will be requested when the form is to be rendered if Authorization is active in your application.
TfrmNewItem = class(TIWAppForm)
...
public
class function RequestAuth(aRequest: TWebRequest; var rGroup: string): Boolean; override;
end;
...
class function TfrmNewItem.RequestAuth(aRequest: TWebRequest; var rGroup: string): Boolean;
begin
// this will make the app request authorization, if no user is logged in
Result := not Assigned(UserSession.CurrentUser);
end;
Events
OnURLRequest: TOnURLRequest;
Use this event to implement special processment when a IW form is activated through a URL Request (ex: http://www.yoursite.com/green.html). See URL Mapping. You need to include unit IW.Http.Request in your uses clause (interface section).
procedure TGreenForm.IWAppFormURLRequest(aSender: TIWAppForm;
aRequest: THttpRequest);
begin
if Pos(aRequest.Referer, '192.168') = 0 then begin
WebApplication.TerminateAndRedirect('http://www.atozed.com');
end;
end;
initialization
TGreenForm.SetURL('/', 'green.html');
|