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 - DonnEdwards

Pages: 1 [2] 3 4
16
Web Server - Ask For Help / Re: NT 12.19 and SecWin 7.15?
« on: June 17, 2021, 10:48:52 AM »
My limited experience with Secwin 7 and NT 12 is that they work really well together for making a web server appliction. I'm not sure why the documentation says otherwise. I guess it depends on what you are using it for. I didn't use the licensing part, just the login and permissions part.

17
Web Server - Ask For Help / Re: NT12 apostophe in browse forms
« on: June 13, 2021, 03:23:54 AM »
I solved it by setting the "Allow xHTML in column" check box on the column tab.

Jeff, you're a star! Thank you very much. My understanding of NT forms has also grown.
Best wishes
Donn

18
Web Server - Ask For Help / Re: NT12 apostophe in browse forms
« on: June 11, 2021, 10:08:56 AM »
Looks like the server is converting the character to an HTML entity.

What I don't understand is why the entity is not displayed correctly. It only does it with the apostrophe, but not the ampersand?

Normally a browser would expect ' if I wanted to display the entity phrase instead of the actual entity character.

What does this mean?
Fix: Added ' to _jsok.
I suspect it may have something to do with the issue, but no idea what.

19
Web Server - Ask For Help / NT12 apostophe in browse forms - solved
« on: June 10, 2021, 03:06:41 AM »
I noticed some bad punctuation in some of my imported data, so I ran a filter using StringTheory to remove any strange characters:

                stname.SetValue(stline.GetLine(12))                          ! STRING(200) !Section Name
                stname.replace('"','')                                       ! Remove extra quotes in data
                stname.replace('`','''')                                     ! fix bad punctuation
                stname.replace('\','/')                                      ! fix bad punctuation
                stname.KeepChars('0123456789 .,''&ABCDEFGHIJKLMNOPQRSTUVWXYZ-/:;!@#$%^&*()+?') ! Remove weird data               
                stname.replace(',',', ')                                     ! fix bad punctuation
                stname.replace('  ',' ')                                     ! fix bad punctuation
                mp:section_name        = CLIP(LEFT(stname.GetValue())) 


All the text data is in upper case. If I look at it in a Clarion ABC app, the attached image 1 shows the data as it appears in the tables.

If I display the same TPS file in a NT web server browse form, I get the second image. Wherever there is a normal apostophe (Character 39) it is displayed as ', which is weird because HTML is supposed to regard this as an HTML Entity

I have to restrain myself from editing ATTORNEY'S to the correct ATTORNEYS but that's another matter :-) Also, the "Change" form doesn't show the ', only the browse form.

So what is going on? How do I fix it? Is this a bug in NT 12.19 or have I broken something?

20
Web Server - Ask For Help / Re: Extra Buttons in Browse Forms
« on: May 31, 2021, 08:12:51 AM »
Hi Bruce
Thanks for the advice and assistance. I wasn't thinking "web" when I wrote the tagging code I used. Thanks for the reminder. I had a few problems getting the Tagging example to work, but it has been a great help.
Best wishes
Donn

21
Web Server - Ask For Help / Extra Buttons in Browse Forms
« on: May 30, 2021, 05:54:04 AM »
I have studied the code in the Buttons (28) example, but I'm still having problems.

Please take a look at the form I want to create (attached image)

1. Mark/unMark button

I want to be able to allow users to "mark" rows. The name of the person who mars the row is stored in the "selected_session" field. The heading is just "Selected" and instead of showing the name of the user, I show "Yes" if
AL1:selected_session = p_web.GSV('UserName')
If there is a different user name then I display "No".
If there is no user name I display "-"

If the column displays "Yes" then I want the text of the adjacent button to be "unMark", and if it is "-" then the text should be "Mark". At the moment I can't get this to work. Is there an equivalent of the Visual Basic IIF function in Clarion? I can't seem to find one.

Any suggestions would be most welcome.

2. Filter Display

I can't figure out how to display the value of a filter that is applied to the browse. An example would be "Category = 'Sales'" that I have drawn in to the image, but I have no idea how to put it there. Again, any suggestions would be most welcome.

3. Filter Button

Along with the filter display I would like a "Filter" button. in this case I want the user to be able to click it to show only the "marked" records I have in item 1.
AL1:selected_session = p_web.GSV('UserName')

I would like to be able to toggle the filter off again, so that all records can be displayed.

4. Mark Button operation

The Server Code for the Mark button is as follows:

  UD.Debug('This is the value of AL1:selected_session ' & AL1:selected_session)
  IF len(clip(AL1:selected_session)) <= 1
      AL1:selected_session =  p_web.GSV('UserName')
  ELSIF CLIP(AL1:selected_session) =  p_web.GSV('UserName')
      AL1:selected_session = ''
  END
  UD.Debug('This is the value of AL1:selected_session ' & AL1:selected_session)


I also have enabled the option to "Refresh browse row DATA after server code runs".

Each time the code runs, it gets the value of AL1:selected_session from the actual record, but after changing it, the record itself doesn't change, only the browse display. How do I update the record as well as the browse display?

Any suggestions, RTFM topics, etc will be greatly appreciated.

22

For the latter, check the user group webinar 263  from about 18:00 onwards.

Hope that helps.

Jane

Thank you Jane, that helps a great deal. From the video I took the attached screen shot. My working code is a little different for the Webhandler ProcessLink embed point after PARENT.ProcessLink(p_action)

    if p_web.GetSessionLoggedIn() = 0 then
!        UD.Debug('This is the value of p_web.GetValue(loc:login) ' & p_web.GetValue('loc:login'))
!        UD.Debug('This is the value of p_web.GetValue(loc:remember) ' & p_web.GetValue('loc:remember'))
        if p_web.GetValue('loc:login') and p_web.GetValue('loc:password') and p_web.GetValue('loc:remember') then
            if self.Authenticate(p_web.GetValue('loc:login'),p_web.GetValue('loc:password'))
                p_web.ValidateLogin()                   ! this sets the session to "logged in"
                p_web.SetSessionValue('loc:hash',0)     ! clear the hash, so this login can't get "replayed".                   
!                UD.Debug('This is the value of p_web.GetSessionLoggedIn() ' & p_web.GetSessionLoggedIn())
            end
        end
    end


Also, I had to modify the LoginForm so that the "Logout" menu item would work. After the statements
  p_web.site.SaveButton.TextValue = 'Login'
  p_web.site.SaveButton.Tooltip = 'Click here to Login'

the next bit of code should read

    p_web.SetSessionLoggedIn(0)
    p_web.DeleteCookie('loc__login')
    p_web.DeleteCookie('loc__password')
    p_web.deletesessionvalue('loc:login')
    p_web.deletesessionvalue('loc:password')
!   p_web.deletesessionvalue('loc:remember')
    p_web.deletevalue('loc:login')
    p_web.deletevalue('loc:password')


I will follow up on your advice about the "Remember me" button being cleared.

Many thanks
Donn

23
I have searched other forum posts dealing with the "remember me" option, but not found any answers for my question. The "BasicWithLogin (3)" example doesn't have a "remember me" option, and "LoginBeforeFrame (7)" has "remember me on this computer" but it doesn't.

I have a simple Web Server app that just needs to know who is using the app. So the login test is simple:

WebHandler / Embeds / Local Objects / p_web / Authenticate PROCEDURE(String pUser,String pPassword)

IF (pUser = 'Donn' AND pPassword = 'Donn') or (pUser = 'Brian' AND pPassword = 'Brian')
    ReturnValue = true
    p_web.SetSessionValue('UserName',pUser,'@s20')
    self.SetSessionLevel(2)
END


In the Priming section of the login form I have added:
loc:Remember = p_web.GetValue('loc:Remember')

and in the ValidateUpdate embed point I have made a small change to the sample code:

      if loc:remember = 1
        p_web.SetCookie('loc__login',loc:login,today()+30)       ! note the expiry date. It's good form
!            p_web.SetCookie('loc__password',loc:password,today()+30) ! to make sure your cookies expire sometime.
            p_web.SetCookie('loc__remember',loc:remember,today()+30)
      else
        ! don't remember, so clear cookies in browser.
        p_web.DeleteCookie('loc__login')
        p_web.DeleteCookie('loc__password')
        p_web.DeleteCookie('loc__remember')
      End


So now I can see that the cookie only has a value for loc__remember and loc__login and I have dropped the password requirement.

What I can't find is any example of the server inspecting the cookie and treating the user as logged in within the 30 days specified by the cookie.

I realize I need to run some code something like:

if p_web.GetSessionLoggedIn() = 0 then
        pUser = p_web.GetValue('loc:login')
        pRemember = p_web.GetValue('loc:remember')
        if pRemember then
               if pUser = 'Donn' or pUser = 'Brian' then
                   p_web.SetSessionValue('UserName',pUser,'@s20')
                   p_web.ValidateLogin()                   ! this sets the session to "logged in"
                   p_web.SetSessionLevel(2)
              end
       end
end


But where do I put this code so that it runs before a page is displayed?

Any advice or code correction will be most welcome.

24
Web Server - Ask For Help / PDF Tools 4.1 No longer sold
« on: May 20, 2021, 10:51:21 AM »
I need to do some PDF reports in my NetTalk Server app.

One of the options is C11EE. Another is PDF Tools 4.1. They stopped selling it earlier this year.

A third option is Klarisoft wPDF Control. There was an example app in NetTalk 9. But it isn't mentioned here: https://www.capesoft.com/docs/NetTalk12/NetWebReports.htm

Is the Klarisoft product still supported in NT12? If so, which bundle should I purchase?

The answer is in the NT Application Wizard. See attachment. If anyone has a PDF Tools License they wish to sell, please message me directly.

25
The Global extension works perfectly. See attached image. Thanks @Bruce

I tested it by adding and removing a record, and then looking in the TPS file. Sure enough the record is still there, but marked as deleted. It no longer shows up in the browse form.


26
I have a database that I plan to use for two apps:
1. Web Server app for office administration using a web browser
2. Web Server API app to provide a link to other systems and an Android (disconnected) app to be written by a third party developer.

When I generated the web server app using the NetTalk Wizard I didn't click the "Server API's to sync Disconnected Data" option, only the "Web Server App - for access via a browser" option.

So now I notice that the Web Server app (correctly) deletes a record when I ask it to, but I need it to mark it as deleted by setting the DeletedTimeStamp record to Now(), because it is sharing this data with the API server, and the other systems will need to know when a record is deleted.

a) What is the correct way to modify the Delete Record routine to set the DeletedTimeStamp record instead of actually deleting the record? Is there a flag I can set or do I need to modify some code?

b) Am I correct in assuming that I will need to filter the browse forms by adding DeletedTimeStamp = 0, or is there an option I can set to do this globally?

c) When I use the NetTalk Wizard to create the "Web Server API App" should I also select "Server API's to sync Disconnected Data" so the API App will "know" about the DeletedTimeStamp field and do a soft delete?

All advice will be gratefully received.

FWIW, all my tables have the three TimeStamp records required for Disconnected data.

27
Web Server - Ask For Help / Re: How to make a "sticky" ban list.
« on: May 10, 2021, 02:42:14 AM »
Thanks Bill. You have given me a lot to think about, and I am grateful for you sharing your experience.

28
Web Server - Ask For Help / Re: How to make a "sticky" ban list.
« on: May 09, 2021, 11:06:08 AM »
Thank you. How do you handle security? Using Secwin or something else? My app is a medical database, and they also want an  API server.

29
Web Server - Ask For Help / Re: How to make a "sticky" ban list.
« on: May 03, 2021, 12:00:48 PM »
I have been experimenting with PeerBlock and it is showing an interesting amount of random traffic of all kinds. I think I'll not worry about the ban list for now.

30
Web Server - Ask For Help / How to make a "sticky" ban list.
« on: May 03, 2021, 06:15:44 AM »
I have added around 10 IP addresses to my NT WebServer's ban list, and was wondering whether anyone has written the code to save these addresses to a text or INI file so that they can be re-loaded when I close the server and then run it again. I guess I could add them to the Windows Firewall, but I'm not sure if that's advisable.

Alternatively, is there a better way to get rid of random IPs that try to "exploit" my server?

Or am I worrying about nothing?

Pages: 1 [2] 3 4