NetTalk Central

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Matthew51

Pages: 1 2 3 [4] 5 6 ... 11
46
Web Server - Ask For Help / Re: downloading a CSV file to Users desktop
« on: October 02, 2019, 12:47:10 PM »
The most you can do is inform the browser that you want a file downloaded. The browser then chooses where to save it. Most likely to the downloads folder. This is to protect users from attackers, or just bad web developers saving files they shouldn't to location their not allowed.

If the csv file is created at run time, and only expected to be downloaded once I recommend using a "start" button with a progress field. Beginning the file name with $$$ or @@@ and the server will delete the file after it's been served.

47
Web Server - Ask For Help / Re: SSL issue on 11.21 on Windows Server 2019
« on: September 27, 2019, 01:16:06 PM »
Double check everything in the Deploying a TLS Client or Server list

Failing that I think you would need Bruce to look at this.

48
Web Server - Ask For Help / Re: CAROUSEL in IndexPage and PageFooter
« on: September 27, 2019, 12:48:29 PM »
I had a similar problem, and I had to add 'slick.css' and 'slick-theme.css' to the CSS Style Files list. You can have them included in all.css. Be sure to run Gzipall after you add them.

49
Web Server - Ask For Help / Re: programatically restart the service
« on: September 27, 2019, 12:41:41 PM »
Their is no way for a service to start itself, something else always has to start it.

I recommend making a patch and management app. Most programs that want to be kept up to date have something like this. You can have your users run it manually, or having it start with windows, and stay down in the system tray. If you have SelfService that will make managing you service easy, see the example that's included for how to use it.

The patcher should do all the needed work from managing the service to downloading and applying the patch. It should also be able to determine that a patch is available, and notify the user.

50
Available For Hire / Re: Looking for contract work
« on: September 10, 2019, 01:08:16 PM »
Added me linked in profile. Feel free to connect even if you don't have work for me.

51
Web Server - Ask For Help / Re: Read clients lat/lon
« on: September 10, 2019, 12:58:36 PM »
I've use hidden fields to get values out of javascript when users log in. You just need to add a hidden field and a bit of code to the end of your javascript function:

document.[form name]_frm.[field equate].value = [javascript variable]

You can also use the NetTalk Javascript funtion SetSessionValue([value name], [javascript value]); and then read it in clarion using p_web.gsv([value name])

NetTalk also has location features built in though I haven't used it. You need to call p_web.GetLocation() at the start of the page, and then if the user accepts the data should be available in the following session variables on subsequent requests: _Longitude_, _Latitude_, _Altitude_, _Accuracy_, _AltitudeAccuracy_, _Heading_, _Speed_, _LocationUnixTime_, _LocationDate_=, _LocationTime_, _LocationError_.

52
Web Server - Share Knowledge / Browse search defaults to AND instead of OR
« on: September 09, 2019, 03:17:59 PM »
It least for my use case I consider an AND search to make more seance as the default search rather then OR, and my users aren't going to put in the + by themselves. Also just in case I have some advanced users I added a | character to indicate an OR search.

In your WebHandler procedure modify the GetLocatorVale embed to look like:
Code: [Select]
p_web.GetLocatorValue PROCEDURE(LONG p_type,String p_name,Long p_Where,String p_OnFields)

ReturnValue          ANY

! Start of "NetTalk Method Data Section"
! [Priority 5000]
i                           LONG
st                          StringTheory

! End of "NetTalk Method Data Section"

  CODE
  ! Start of "NetTalk Method Executable Code Section"
  ! [Priority 2500]
 
  ! Parent Call
  ReturnValue = PARENT.GetLocatorValue(p_type,p_name,p_Where,p_OnFields)
  ! [Priority 7500]
 
  ! End of "NetTalk Method Executable Code Section"
! Start of "NetTalk Method Routine Section"
! [Priority 5000]
    IF p_type = Net:Search
        st.SetValue(Clip(ReturnValue))
        st.Split(' ', '"')
        LOOP i = 2 TO st.Records()
            CASE Sub(st.GetLine(i), 1, 1)
            OF '-'
            OF '+'
            OF '|'
                st.SetLine(i, Sub(st.GetLine(i), 2, Len(st.GetLine(i)) -1))
            ELSE
                st.SetLine(i, '+' & st.GetLine(i))
            END
        END
        st.Join(' ')
        dbgView('Value: ' & st.GetValue())
        ReturnValue = st.GetValue()
    END

Note: In my testing I noticed a bug in netTalk where if the final ReturnValue had a + or - then quotes, ie.  (bud +"light Lime") it wouldn't remove the first quote and my filter would look something like: ( INSTRING('BUD',UPPER(Loc:Description),1,1) <> 0) AND ( INSTRING('"LIGHT LIME',UPPER(Loc:Description),1,1) <> 0)



53
Web Server - Ask For Help / Re: WebService Response
« on: September 05, 2019, 12:45:22 PM »
In the NetWebServiceMethod, Return tab. Change "Format return for" to Compactness.

54
Web Server - Ask For Help / Re: cURL - FileUpload to a NT-(SOAP)Server
« on: September 05, 2019, 12:16:17 PM »
Nether of those are SOAP Packets. One would look something like:
Code: [Select]
POST /FileUpload HTTP/1.1
Host: 192.168.178.113:88
User-Agent: curl/7.55.1
Accept: */*
Content-Length: 12455
Content-Type: text/xml
SOAPAction: http://192.168.178.113:88/FileUpload

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <FileUpload xmlns="FileService">
      <Manual>Bla Bla Bla</Manual>
    </FileUpload>
  </soap:Body>
</soap:Envelope>

Since you are only sending one piece of data Making a whole web service is a bit overkill. The simplest method would be to pair your first attemp with a NetWebSource procedure. You should be able to access the set packet in the ProcessedCode embed stored in p_web.RequestData.DataString. All that's left is to remove the http header. This can be done by looking for the first <13,10,13,10> and putting everything after that into a new string. NetTalk may have just the contents stored somewhere, but I can't find it.

You're second attempt looks like it would work with a NetWebForm. It may be a better option as a "proper" way to upload a file. But that would take some experimenting, and working through NetTalk build in Security.

55
You can change or remove the tooltip. Open up the field in the browse settings and it's on the general tab near the bottom.

I'm betting getting the template to blank it out automatically might not happen as it will need to know if you have changed it yourself.

Matthew

56
Available For Hire / Looking for contract work
« on: August 09, 2019, 03:28:20 PM »
I've been working with Net Talk web server for around 10 years now.  In that time I have made one very large web server, and several smaller ones.

I'm a firm believer that complexity in code is preferable to complexity to the end user. Though I do love it when I can make both simple.

I have interfaced with several 3rd party apis. Most http(s) based, but a few have Component Object Model or DLL. Most recently I made an interface to Quick Books Online.

I have also written interfaces to payment processors, both web based, and local using a credit terminal.

Check out me website https://www.bisware.ca/.

57
Web Server - Ask For Help / Re: Change form action
« on: August 09, 2019, 01:36:49 PM »
I did some poking around in that file and I got a solution that works. I'll post it here in case anyone else wants to do something similar.

At the end of SetFormSettings I added:
Code: [Select]
IF p_web.FormSettings.action = Net:InsertRecord
    p_web.ssv('PromotionFormSate', p_web.FormState)
ELSE
    p_web.DeleteSessionValue('PromotionFormSate')
END
IF p_web.IfExistsSessionValue('PromotionFormTempCreated')
    p_web.DeleteSessionValue('PromotionFormTempCreated')
END
If I was using a form to create the child record I could probably just read p_web.FormSettings.ParentState when writing the child record. But I'm using a button on a child browse, so I needed to save the form state in a session value

At the start of CancelForm I added:
Code: [Select]
IF p_web.FormSettings.action = Net:ChangeRecord AND p_web.gsv('PromotionFormTempCreated') = 1
    p_web.OpenFile(SQLFile)
    PMS:PromotionID = p_web.gsv('PMS:PromotionID')
    Bind('PromotionID', PMS:PromotionID)
    Bind('Result', ErrorCode#)
    SQLFile{PROP:SQL} = '&Result = CALL [Inventory].[DeletePromotion](&PromotionID[IN])'
    p_web.CloseFile(SQLFile)
END
The template does add code to delete the record if the session value [ProcedureName]:Primed is set to 1, but I wanted to delete it my way.

Right before the child record is added we check it we need to create the parent:
Code: [Select]
IF p_web.IfExistsSessionValue('PromotionFormSate')
    FormStateString = p_web.gsv('PromotionFormSate')
    p_web.RequestData.WebServer._GetSettingsQueue(p_web.SessionID, FormStateString, TempFormState)
    IF TempFormState.action = Net:InsertRecord
        p_web.OpenFile(Promotions)
        p_web.ssv('PromotionForm_CurrentAction', Net:ChangeRecord)
        p_web.SessionQueueToFile(Promotions)
        SetNull(PMS:EventID)
        IF p_web.AddFile(Promotions) = Level:Benign
            p_web.RequestData.WebServer._Wait()
            p_web.RequestData.WebServer._GetSettingsQueue(p_web.SessionID, FormStateString, TempFormState)
            p_web.RequestData.WebServer._SettingsQueue.Settings.action = Net:ChangeRecord
            Put(p_web.RequestData.WebServer._settingsQueue)
            p_web.RequestData.WebServer._Release()
            p_web.DeleteSessionValue('PromotionFormSate')
            p_web.ssv('PromotionFormTempCreated', 1)
        END
        p_web.CloseFile(Promotions)
    END
END
If you adding the child using a form then something similar would likely go in the PostInsert embed.

Edit: I wasn't comfortable putting file I/O in a critical section so I changed the last embed. I get the form state twice just in case, but the critical section is very small.

58
Web Server - Ask For Help / Re: IExplorer 10 only errors
« on: August 09, 2019, 12:43:32 PM »
I still have users running Windows XP. I just put a big red warning at the top of every page, and let them deal with the errors. Since yours is just a browser you could instead give them a few links to download a current browser.

Matthew

59
Web Server - Ask For Help / Re: Change form action
« on: August 07, 2019, 02:22:29 PM »
That isn't working even if I set "Prime Auto Inc even if not necessary", and it's not telling me why. I'm guessing it has something to do with how a few columns need to be set null, but I'm not sure where to do this.  I tried after "PreInsert" but that didn't work.

I also would like to create the parent right before the first child is added as I can force the user to fill in all the required information, and I am very confident the user is committed to creating the record, and won't navigate away leaving a ghost record that needs to be deleted (or click that convenient X in the popup window).

Thanks
Matthew

60
Web Server - Ask For Help / Change form action
« on: August 06, 2019, 01:28:27 PM »
NT: 10.36

My solution to a form with a child browse on it is to crate the parent record right before the first child is added. I'm having trouble convincing the program to switch from change to inset (If the user doesn't add a child record I was to remain on insert).

In a test button I've put:
Code: [Select]
p_web.ssv('PromotionForm_CurrentAction', Net:ChangeRecord)
p_web.FormSettings.action = Net:ChangeRecord
Do SetAction
Do CompleteForm
!p_web.SessionQueueToFile(Promotions)
dbgView('StoreID: ' & PMS:StoreID)
dbgView('Description: ' & PMS:Description)
PMS:PromotionID = st.MakeGuid()
dbgView('PromotionID: ' & PMS:PromotionID)
p_web.formsettings.recordid[1] = PMS:PromotionID
p_web.formsettings.FieldName[1] = 'PMS:PromotionID'
!Access:Promotions.Insert()
p_web.AddFile(Promotions)
p_web.ssv('UpdateNow', 1)
p_web.ssv('PromotionForm:Primed', 1)

And in procedure setup I've put:
Code: [Select]
  IF band(p_stage, Net:InsertRecord) = Net:InsertRecord AND p_web.gsv('UpdateNow') = 1
        p_stage -= Net:InsertRecord
        p_stage += Net:ChangeRecord
        p_web.FormSettings.action = Net:ChangeRecord
        dbgView('Changing State')
  END
  dbgView('Stage: ' & p_stage)
  dbgView('UpdateNow: ' & p_web.gsv('UpdateNow'))
  dbgView('Form action: ' & p_web.FormSettings.action)

But I still get a duplicate key error or the primary key.

Also I'm trying to prime the PK using the template, but the value keeps getting erased. The value used to be a SQL Identity, but I changed to make knowing the PK easier.

Thanks Matthew

Pages: 1 2 3 [4] 5 6 ... 11