Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using CGI exe with IW
#1
Hi, I have a cgi exe of a third party that I need using to use with IW.
It works well using apache, IIS, AppServer ......

But I want to use IW.

The cgi.exe is named dgate.exe.

I did all setup after read the docs of cgi to use with a webserver.

It said just to copy a folder called cgi-bin  to wwwroot of the webserver.

To test I have to use: http://127.0.0.1:8888/cgi-bin/newweb/dgate.exe?mode=top

I did a test using a button click that run this code:

Code:
procedure TIWUserSession.load_dicom();
var
  CGIRunner: TIWCGIRunner;
  CGIModuleName: string;
  LFileName: string;
begin
  CGIModuleName := TIWAppInfo.GetAppPath + 'wwwroot\cgi-bin\newweb\dgate.exe';
  CGIRunner := TIWCGIRunner.Create;
  try
    // Set the name of the CGI module which runs our report
    CGIRunner.CGIModule := CGIModuleName;
    CGIRunner.CustomFields.Add('mode=top');
    // call the CGI application
    CGIRunner.Execute(WebApplication, WebApplication.Request);
    // Check status result. Zero indicates success. Anything else is an error
    if CGIRunner.StatusResult = 0 then
    begin
      //what I have to do here????
    end else
    begin
      WebApplication.ShowMessage('Error creating report: ' + CGIRunner.ErrorMessage);
    end;
  finally
    CGIRunner.Free;
  end;
end;

Here is the lua script executed by "dgate.exe" cgi to produce the html output:

Code:
HTML("Content-type: text/html\nCache-Control: no-cache\n");
HTML("<HEAD>")
print [[<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">]]
HTML("<TITLE>Conquest DICOM server - version %s</TITLE>", version)

HTML("</HEAD>")

HTML("<BODY BGCOLOR='CFDFCF'>")


HTML("<H1>Welcome to Conquest DICOM server - version %s</H1>", version)
HTML("<H2>Written by Conquest Project</H2>", version)
HTML("<IMG SRC='%sconquest.jpg' ALT='Written by Conquest Project'>", Global.WebCodeBase)
HTML("<HR>")

HTML("<HR>");

HTML("<table>");
key='' 
HTML("<tr>");
HTML("<FORM ACTION=\"dgate%s\"  onSubmit=\"if (this.patientnamematch.value == '' && this.patientidmatch.value == '') {alert('Please, fill the entry fields');return false;}\">", ex);
HTML("<INPUT NAME=mode    TYPE=HIDDEN VALUE=listpatients>");
HTML("<INPUT NAME=port    TYPE=HIDDEN VALUE=%s>", port);
HTML("<INPUT NAME=address TYPE=HIDDEN VALUE=%s>", address);
HTML("<INPUT NAME=key    TYPE=HIDDEN VALUE=%s>", key);
HTML("<td>Local Patient List");
HTML("<td>Patient ID: <INPUT NAME=patientidmatch TYPE=Text VALUE=>");
HTML("<td>Name: <INPUT NAME=patientnamematch TYPE=Text style=\"text-transform:uppercase;\" onkeyup=\"javascript:this.value=this.value.toUpperCase();\" VALUE=>");
HTML("<td>");
HTML("<td><INPUT TYPE=SUBMIT VALUE=Submit>");
HTML("</FORM>");
HTML("</tr>");

HTML("<tr>");
HTML("<FORM ACTION=\"dgate%s\" onSubmit=\"if (this.patientnamematch.value == '' && this.patientidmatch.value == '' && this.studydatematch.value == '') {alert('Please, fill the entry fields');return false;}\">", ex);
HTML("<INPUT NAME=mode    TYPE=HIDDEN VALUE=liststudies>");
HTML("<INPUT NAME=port    TYPE=HIDDEN VALUE=%s>", port);
HTML("<INPUT NAME=address TYPE=HIDDEN VALUE=%s>", address);
HTML("<INPUT NAME=key    TYPE=HIDDEN VALUE=%s>", key);
HTML("<td>Local Studies List");
HTML("<td>Patient ID: <INPUT NAME=patientidmatch TYPE=Text VALUE=>");
HTML("<td>Name: <INPUT NAME=patientnamematch TYPE=Text style=\"text-transform:uppercase;\" onkeyup=\"javascript:this.value=this.value.toUpperCase();\" VALUE=>");
HTML("<td>Date: <INPUT NAME=studydatematch id=studydatematch TYPE=Text VALUE=>");
HTML("<td><INPUT TYPE=SUBMIT VALUE=Submit>");
HTML("<tr><td><td><td><td>")
HTML([[<INPUT TYPE=BUTTON VALUE=Today onClick="var d=new Date(); document.getElementById('studydatematch').value=(d.getFullYear()).toString()+(d.getMonth()+101).toString().substring(1,3)+(d.getDate()+100).toString().substring(1,3)">]]);
HTML([[<INPUT TYPE=BUTTON VALUE=Yesterday onClick="var d=new Date(); d=new Date(d.valueOf()-864E5); document.getElementById('studydatematch').value=(d.getFullYear()).toString()+(d.getMonth()+101).toString().substring(1,3)+(d.getDate()+100).toString().substring(1,3)">]]);
HTML([[<INPUT TYPE=BUTTON VALUE='Last 7 days' onClick="var d=new Date(); var d1=new Date(d.valueOf()-7*864E5); document.getElementById('studydatematch').value=(d1.getFullYear()).toString()+(d1.getMonth()+101).toString().substring(1,3)+(d1.getDate()+100).toString().substring(1,3)+'-'+(d.getFullYear()).toString()+(d.getMonth()+101).toString().substring(1,3)+(d.getDate()+100).toString().substring(1,3)">]]);
HTML("</FORM>");
HTML("</tr>");


HTML("</table>");
HTML("</BODY>")



The cgi generate  a html page on the fly using your internal code with lua script. I can´t change that lua script from cgi.

How could I take the html page generated by dgate.exe to put after "if CGIRunner.StatusResult = 0 then" and show in the browser? 
Reply


Messages In This Thread
Using CGI exe with IW - by cprmlao@hotmail.com - 09-08-2019, 09:06 PM
RE: Using CGI exe with IW - by Alexandre Machado - 09-09-2019, 08:57 AM
RE: Using CGI exe with IW - by Alexandre Machado - 09-10-2019, 09:27 AM
RE: Using CGI exe with IW - by Alexandre Machado - 09-10-2019, 08:55 PM
RE: Using CGI exe with IW - by Alexandre Machado - 09-10-2019, 09:03 PM
RE: Using CGI exe with IW - by Alexandre Machado - 09-12-2019, 08:34 AM
RE: Using CGI exe with IW - by Alexandre Machado - 10-08-2019, 08:32 AM
RE: Using CGI exe with IW - by Alexandre Machado - 10-08-2019, 08:38 AM
RE: Using CGI exe with IW - by Alexandre Machado - 10-08-2019, 08:24 PM
RE: Using CGI exe with IW - by kudzu - 10-08-2019, 09:51 PM
RE: Using CGI exe with IW - by Alexandre Machado - 10-09-2019, 07:46 AM
RE: Using CGI exe with IW - by Alexandre Machado - 10-09-2019, 08:01 AM
RE: Using CGI exe with IW - by Alexandre Machado - 10-09-2019, 08:08 PM
RE: Using CGI exe with IW - by kudzu - 10-09-2019, 08:14 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)