Help with lua script

  • Mr Marcel,


    I am a newbie in lua script.


    I am trying translate the wado server main page to my language and I have some problems.
    My file script is teste.lua and I have settings in dicom.ini to it.
    Whe I use http://mysite.com/cgi-bin/dgate.exe?mode=teste, the main page appears ok in Broswse.


    The problems:
    1. After I click to "Listar Pacientes Locais" (List Local Patients), the part of this script

    if CGI('mode') == 'querypatients' then -- is never executed after I click to submit querypatients by input button


    It was calling the default english hander to this action, and I have a listing of patients in English


    2. I have also an error in this part:
    query = CGI('query_string');
    if (query) then -- Here I have an error why?




    Any help will be appreciated.
    Thanks in advance,
    Luiz

  • Hi,


    1) Normnalty you have to create a separate page script for querypatients, queryseries etc.


    You may set :


    [defaultpage]
    source = teste.lua


    then all undefined modes will go to your script. [anypage] will make any mode go to the script allowing a full blocking or recode of the web pages.


    2) CGI parses query_string, it does not return it. I guess lua function os.getenv can be used to get the entire query_string.


    Marcel

  • Mr Marcel,


    Please, may you help me to converter this piece of code to lua script. I am stuck in this piece of code.


    Regards,
    Luiz

  • My problem is no result to show on client browse. This code is passing html parameters to server and It´s returning no response.
    Here is what the conquest server is receiving:
    ---------------
    query:DICOMPatients|patientid,patientnam,patientsex,patientbir|PatientNam like '%RENATO%'|<TR><TD><A HREF=dgate.exe?port=3010&address=192.168.10.7&mode=nh_querystudies&key=&query=patientid+=+'%s'>%%0.0s %%0.0s %%0.0s%s</A><TD>%s<TD>%s<TD>%s</TR>"
    [CONQUESTSRV1] Query Tables: DICOMPatients
    [CONQUESTSRV1] Columns : patientid,patientnam,patientsex,patientbir
    [CONQUESTSRV1] Where : PatientNam like '%RENATO%'
    [CONQUESTSRV1] Order : (null)
    -----------
    Here is the lua code:
    query = "PatientNam like '%";
    command = "query:DICOMPatients|patientid,patientnam,patientsex,patientbir|"
    command = command .. query;
    s = string.format("|<TR><TD><A HREF=dgate%s?%s&mode=nh_querystudies&key=%s&query=patientid+=+", ex, extra, tostring(key or ''));
    s = s.."'%s'>%0.0s %0.0s %0.0s"
    command = command .. s
    command = command .."%s</A><TD>%s<TD>%s<TD>%s</TR>"
    HTML(servercommand(command))


    For two days, I have trying many workarounds without success.
    Please, could you help me with a solution?


    Regards,
    Luiz

  • Mr Marcel,
    I have look at log on server and the commands on server seem similar and corrects. They are in this post.
    Why my line "HTML(servercommand(command)) " show no results on client browse?

    - Original conquest web page output
    [CONQUESTSRV1] Connected by address: 020aa8c0
    [CONQUESTSRV1] Testing transfer: '1.2.840.10008.1.2' against list #0 = '1.2.840.10008.1.2'
    [CONQUESTSRV1] 0000,0002 18 UI AffectedSOPClassUID "1.2.840.10008.1.1"
    [CONQUESTSRV1] 0000,0100 2 US CommandField 48
    [CONQUESTSRV1] 0000,0110 2 US MessageID 1
    [CONQUESTSRV1] 0000,0800 2 US DataSetType 257
    [CONQUESTSRV1] 0002,0010 17 UI TransferSyntaxUID "1.2.840.10008.1.2"
    [CONQUESTSRV1] 9999,0400 240 LO ConquestConsoleComma "query:DICOMPatients|patientid,patientnam,patientsex,patientbir|PatientNam like '%RENATO%'|<TR><TD><A HREF=dgate.exe?port=3010&address=192.168.10.7&mode=querystudies&key=&query=patientid+=+'%s'>%0.0s %0.0s %0.0s%s</A><TD>%s<TD>%s<TD>%s</TR>"
    [CONQUESTSRV1] Query Tables: DICOMPatients
    [CONQUESTSRV1] Columns : patientid,patientnam,patientsex,patientbir
    [CONQUESTSRV1] Where : PatientNam like '%RENATO%'
    [CONQUESTSRV1] Order : (null)


    - My verison of conquest web page output
    [CONQUESTSRV1] 0000,0110 2 US MessageID 1
    [CONQUESTSRV1] 0000,0800 2 US DataSetType 257
    [CONQUESTSRV1] 0002,0010 17 UI TransferSyntaxUID "1.2.840.10008.1.2"
    [CONQUESTSRV1] 9999,0400 246 LO ConquestConsoleComma "query:DICOMPatients|patientid,patientnam,patientsex,patientbir|PatientNam like '%RENATO%'|<TR><TD><A HREF=dgate.exe?port=3010&address=192.168.10.7&mode=nh_querystudies&key=&query=patientid+=+'%s'>%0.0s %0.0s %0.0s%s</A><TD>%s<TD>%s<TD>%s</TR>"
    [CONQUESTSRV1] Query Tables: DICOMPatients
    [CONQUESTSRV1] Columns : patientid,patientnam,patientsex,patientbir
    [CONQUESTSRV1] Where : PatientNam like '%RENATO%'
    [CONQUESTSRV1] Order : (null)


    Regards,
    Luiz

  • Hi,


    using this style of server commands is very tedious. Better try something in the style of Link.lua in the webserver/Openclinica folder. Also if you install ZeroBraneStudio you can debug snippets in the server itself before you run them on the web interface.


    Marcel

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!