NetTalk Central

Author Topic: Change StoreDataAs  (Read 4689 times)

Matthew

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • Email
Change StoreDataAs
« on: July 04, 2014, 04:18:16 AM »
Hello Bruce.

Is it possible that StoreDataAs will be related to session ID?

For example one logged user will be have net:StoreAsCentralEurope and the second net:StoreAsEastEurope.

I ask for it, because I added dynamically translation to my website which base on SessionValue, and I change all display text in Translate method.

But I also would like to change StoreDataAs value, that user can put some data in his language without changing some special signs.

Regards,
Matthew

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11204
    • View Profile
Re: Change StoreDataAs
« Reply #1 on: July 04, 2014, 06:10:38 AM »
Hi Matthew,

Would the same data be visible to multiple users? If so, then say I added it as CentralEurope, and you viewed it as EasternEurope, then there would be a problem.

cheers
Bruce

Matthew

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • Email
Re: Change StoreDataAs
« Reply #2 on: July 06, 2014, 10:21:42 PM »
Hello

I describe You what I have and what not working.

1. My website is multilanguage. Every user can change the language at runtime by clicking one of the flags (see attachment).
2. After that user works in choosing language - view and add data in that language.
3. When first user choose polish flag I overwrite StoreDataAs property:

       p_web.RequestData.WebServer._SitesQueue.Defaults.StoreDataAs = net:StoreAsCentralEurope
       PUT(p_web.RequestData.WebServer._SitesQueue)

    and everything is ok.
4. In same time other user want to change language to czech. Before that when he put some data in this language some signs are changing, because StoreDataAs property is set to
    net:StoreAsCentralEurope for example:

        in czech  -> nezveřejněné
        after put in textbox  -> nezveÿejnÿné

5. After change language to czech I overwrite StoreDataAs property:

       p_web.RequestData.WebServer._SitesQueue.Defaults.StoreDataAs = net:StoreAsEastEurope
       PUT(p_web.RequestData.WebServer._SitesQueue)

    and is ok.
6. But then the first user have something similar to previous situation, so he put:

        in polish  -> ąśćęłńżź
        after put in textbox  -> ÿÿćÿÿÿÿÿ

Question:
Is there any way to relate StoreDataAs to session ID, that every session will have own setting?

Regards,
Matthew

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11204
    • View Profile
Re: Change StoreDataAs
« Reply #3 on: July 08, 2014, 01:12:00 AM »
>> Is there any way to relate StoreDataAs to session ID, that every session will have own setting?

yes.

       p_web.RequestData.WebServer._SitesQueue.Defaults.StoreDataAs = net:StoreAsCentralEurope
       PUT(p_web.RequestData.WebServer._SitesQueue)


No. This is the setting for the server, not the user. (And you also didn't wrap it with the necessary WAIT and RELEASE section, which means that there was likely times when wierd stuff happened.

You should set it in WebHandler, in ProcessLink method, before parent call.

self.site.StoreDataAs = self.GetSessionValue('storeDataAs')
If self.site.StoreDataAs = 0 then self.site.StoreDataAs = net:StoreAsCentralEurope ! default value.

and of course when the user logs in set the
p_web.SetSessionValue('storeDataAs',net:StoreAsCentralEurope)

Bruce

Matthew

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • Email
Re: Change StoreDataAs
« Reply #4 on: July 08, 2014, 10:07:29 PM »
Thank You for Your advice, but it not working.

When I set StoreDataAs = net:StoreAsEastEurope globally for the server then everything is ok in czech. What I put in textbox, I see without any change, for example:
    in czech  -> nezveřejněné
    after put in textbox  -> nezveřejněné

But if I set StoreDataAs = net:StoreAsCentralEurope globally for the server and then always set it in WebHandler, in ProcessLink method, before parent call:
    self.site.StoreDataAs = net:StoreAsEastEurope
then some signs are still changing, for example:
    in czech  -> nezveřejněné
    after put in textbox  -> nezveÿejnÿné

Regards,
Matthew

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11204
    • View Profile
Re: Change StoreDataAs
« Reply #5 on: July 09, 2014, 05:06:51 AM »
Can you make a small example app for me Matthew? I'm going to need some data as well, containing the different charsets.
Remember I can't type these characters, and I can't visually tell Eastern Europe from Central Europe,  so give me plenty of instructions as well <g>.

cheers
Bruce

Matthew

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • Email
Re: Change StoreDataAs
« Reply #6 on: July 09, 2014, 11:53:52 PM »
I did some example. Compiled on:
Clarion  - 9.1
NetTalk - 8.15

See attachement.

Regards,
Matthew

[attachment deleted by admin]
« Last Edit: July 09, 2014, 11:55:38 PM by Matthew »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11204
    • View Profile
Re: Change StoreDataAs
« Reply #7 on: July 22, 2014, 07:16:11 AM »
the example contains no data and no instructions.
« Last Edit: July 23, 2014, 03:55:26 AM by Bruce »

Matthew

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • Email
Re: Change StoreDataAs
« Reply #8 on: July 23, 2014, 09:55:29 PM »
Sorry for no description. So:

1. The app does not required any data. Everything is inside.
2. After compiled (may be the latest version of Clarion and NetTalk) and run (default port 80), (web folder should copy while compiling) - You will see homepage (the only site.)
3. Homepage has every instruction to test my problem:
      a). display global setting of StoreDataAs (from server)
      b). You can choose language at runtime from Drop (English, Polish, Czech)
      c). After choosing language You will see example word in that language to paste to the textbox
      d). When You copy and paste that word and accept textbox control (by pressing tab for example) You will see that word after conversion by StoreDataAs parameter.
      e). You can compare the example word and the word after conversion - if they are the same.
4. Every explanation is in comment at right.
5. You can validate two methods (Translate and Process Link) in WebHandler, where I put my code.

When I set StoreDataAs as Central Europe (globally in server) then English and Polish is ok, but not Czech. Choose Czech language, copy example word and compare if they are the same.

Regards,
Matthew

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11204
    • View Profile
Re: Change StoreDataAs
« Reply #9 on: July 24, 2014, 05:15:05 AM »
Hi Matthew,

It's a great example app. I might add some more languages to it and include it in the shipping set if that's ok with you? I think it will make a useful tool as more languages, and possibly more characters need to be tested.

I think the problem was in my conversion function. I've taken the opportunity to refactor the AsciiToUtf and UtfToAscii methods to use the StringTheory conversion - something I've been wanting to do for a long time. Oce I did that your app seemed to work well.

I'm uploading build 8.21 today, so give it a try with that and you should be ok.

Cheers
Bruce

Matthew

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • Email
Re: Change StoreDataAs
« Reply #10 on: July 24, 2014, 10:09:10 PM »
Thank You.

Now it works perfect.

I have only one more question:
Could You add this changes in NetTalk 7, because I have also websites in NetTalk 7 which need similar translation.

Regards,
Matthew

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11204
    • View Profile
Re: Change StoreDataAs
« Reply #11 on: July 24, 2014, 10:13:42 PM »
Unfortunately I don't think I can at this point. I'm expecting some issues (and one already mentioned with regard to Portuguese) so it's not a "safe" move back to NT7.

You could of course just copy the AsciiToUtf and UtfToAscii methods from NT8 (netweb.clw) to NT7 (netweb.clw) - so feel free to give that a try if you like. But I wouldn't like to change (everyones) NT7 with this at this stage.

cheers
Bruce

Matthew

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • Email
Re: Change StoreDataAs
« Reply #12 on: July 25, 2014, 01:26:03 AM »
I understand that.

Thank You for Your help.

Regards,
Matthew