Jump to content

How to open a specific form depending on the requested url


Alexandre Trevizoli

Recommended Posts

Hi.

I need to open an form with IMAGE when I call a specific URL....
example:
http://localhost:8077/qrcode?code=20982109480129

In this case I don't need to open Login form (that have on application), I need only to open an form called fmQrCode (TunimForm).

and when user close this form, close session.

Thanks

 

Link to comment
Share on other sites

Maybe you can adapt my approach to your needs (simplified procedure):

procedure TUniMainModule.UniGUIMainModuleBeforeLogin(Sender: TObject;
  var Handled: Boolean);
var
  aApp : TUniGUIApplication;
  aBLIEwin : string;
begin
  Handled := false;
  try
    aApp := (Sender as TUniGUISession).UniApplication;

    aBLIEwin := aApp.Parameters.Values['BLIEWIN'];
    if not aBLIEwin.IsEmpty then
    begin
      if not Assigned(FdmUser) then
        FdmUser := TdmUser.Create(self);
      Handled := FdmUser.CheckLogin(aBLIEwin, FAutoStartAction);
    end;
  finally
    FIsLogin := Handled;
  end;

end;

This link http://localhost:8077/m?BLIEWI=param will bypass login form and in App.MainForm:

procedure TMainForm.UniFormShow(Sender: TObject);
var
  aAction : TAction;
begin
  aAction := UniMainModule.AutoStartAction;
  if Assigned(aAction) then
  begin
    UniMainModule.AutoStartAction := nil;
    ModuleExecute(aAction);
  end;
end;

HTH.

  • Like 2
Link to comment
Share on other sites

Hi Neo4.

Thanks for your answer.

on UniGUIMainModuleBeforeLogin, I could use fmQRCODE.showmodal?

How can I get URL information inside this event? I can get this information on UniGUIServerModuleHTTPCommand through ARequestInfo object.

Could I force ServerModule to open new session and instead of open Login form, open an desired form?

I guess it's should be possible.

Thanks

 

Link to comment
Share on other sites

Quote

on UniGUIMainModuleBeforeLogin, I could use fmQRCODE.showmodal?

Following my sample you would do it in

TMainForm.UniFormShow(Sender: TObject)

by

AutoStartAction
Quote

How can I get URL information inside this event? I can get this information on UniGUIServerModuleHTTPCommand through ARequestInfo object.

aApp := (Sender as TUniGUISession).UniApplication;

    aBLIEwin := aApp.Parameters.Values['BLIEWIN'];

 

In my sample BLIEWIN is parameter name, so by URL of  http://localhost:8077/m?BLIEWIN=param variable aBLIEWIN contains "param". At this point you can decide, wether to show a login form or not by setting procedure var

Handled 

 

HTH.

Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...