Pier component state when redisplay the page

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

Pier component state when redisplay the page

dtrussardi@tiscali.it
Hi,
       
        i work with Pier 3.0.0

        I have a pier site with a menu to manage some pages.

        Some of this pages are configured to manage components.




        For test i add some  Counter seaside application instances.

        Now when display a specific page with some counter it work fine:

                i can change any specific counter instance in the page.




        My problem is when i change the menu for display another page.


        In this case when redisplay a page with the counters all instance are reset to 0.

       
        Now my question is:
               
                what do i do  for  redisplay the counter at  the last update ?


        I need to configure something ?

       
        Thanks for any considerations,


                Dario

       

       


       

       




       
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

dtrussardi@tiscali.it
Hi,
       
        my some other considerations:


> Hi,
>
> i work with Pier 3.0.0
>
> I have a pier site with a menu to manage some pages.
>
> Some of this pages are configured to manage components.
>
>
>
>
> For test i add some  Counter seaside application instances.
>
> Now when display a specific page with some counter it work fine:
>
> i can change any specific counter instance in the page

My Pier instance is based on PRDistribution where i declared

        counterwidget

        ^ counterwidget ifNil: [counterwidget := (PRComponent named: 'counter')
                        componentClass: WACounter;
                        title: 'Counter on-line';
                        yourself
                        ]


The relative page is declared with:

        (PRPage named: 'counterpage')
                                        title: 'Embed';
                                        contents:
        '+/system/components/counter+'

All works fine at the first display.

>
>
> My problem is when i change the menu for display another page.
>
>
> In this case when redisplay a page with the counters all instance are reset to 0.

        I remark the problem :
                when redisplay the counterpage   the counter is reset to 0.



I do some test in hold image based on Pier 2.0.6   and with it all works fine.

        ( i don't remember particular setting into Pier 2.0.6   Pharo image)

The WACounter remember is state and is right rendered when i redisplay  the relative page.

This is my objective.

How i read in some Pier documents my goal is to embedded seaside application / component  into Pier.

>
>
> Now my question is:
>
> what do i do  for  redisplay the counter at  the last update ?

I do some test adding the component directly in a page with Pier interface but the problem remain into Pier  3.0


>
>
> I need to configure something ?
>
>

Renewal my thanks for any considerations

        Dario
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

dtrussardi@tiscali.it

Ciao,

        i don't understund because but in my environment, when the pier rendering the Menu  based on:


        (PRPage named: 'menu')
                        contents:
'- *Home>/*
- *Chi siamo>/chisiamo*
- *Missione>/missione*
- *Despina>/despina*
- *Catalogo>/catalogo*
- *Menu on-line>/menuonline*
- *Blog>/blog*
- *Riferimenti>/riferimenti*';
                        yourself ]
               

        the relative anchor don't report any _K   parameter.



        Accordingly when i click on one menu item   the filter can't address the request  and create a new instance whenever.

        I update the menu page with the Pier interface but the error persist.





        Yesterday i have a problem with the first menu item : Home

        after the first display it lose the link to the home page.

        I solved the problem adding to my PierDistribution root  method the :

       

        self rootPage enumerator
                with;
                all;
                do:
                        [ :each |
                        each outgoingReferences
                                do: [ :link | (link isKindOf: PRInternalLink) ifTrue: [ link target: nil ] ].
                        each securityDecoration owner: self kernel users anyOne.
                        each securityDecoration group: self kernel groups anyOne ].


With this declaration the Home work fine, but i have the over problem


Thanks,

        Dario


> Hi,
>
> my some other considerations:
>
>
>> Hi,
>>
>> i work with Pier 3.0.0
>>
>> I have a pier site with a menu to manage some pages.
>>
>> Some of this pages are configured to manage components.
>>
>>
>>
>>
>> For test i add some  Counter seaside application instances.
>>
>> Now when display a specific page with some counter it work fine:
>>
>> i can change any specific counter instance in the page
>
> My Pier instance is based on PRDistribution where i declared
>
> counterwidget
>
> ^ counterwidget ifNil: [counterwidget := (PRComponent named: 'counter')
> componentClass: WACounter;
> title: 'Counter on-line';
> yourself
> ]
>
>
> The relative page is declared with:
>
> (PRPage named: 'counterpage')
> title: 'Embed';
> contents:
> '+/system/components/counter+'
>
> All works fine at the first display.
>
>>
>>
>> My problem is when i change the menu for display another page.
>>
>>
>> In this case when redisplay a page with the counters all instance are reset to 0.
>
> I remark the problem :
> when redisplay the counterpage   the counter is reset to 0.
>
>
>
> I do some test in hold image based on Pier 2.0.6   and with it all works fine.
>
> ( i don't remember particular setting into Pier 2.0.6   Pharo image)
>
> The WACounter remember is state and is right rendered when i redisplay  the relative page.
>
> This is my objective.
>
> How i read in some Pier documents my goal is to embedded seaside application / component  into Pier.
>
>>
>>
>> Now my question is:
>>
>> what do i do  for  redisplay the counter at  the last update ?
>
> I do some test adding the component directly in a page with Pier interface but the problem remain into Pier  3.0
>
>
>>
>>
>> I need to configure something ?
>>
>>
>
> Renewal my thanks for any considerations
>
> Dario
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

dtrussardi@tiscali.it
Ciao,

        i have do some test with the PRDistribution  register

        It create a default pier entry Welcome to Pier!


        It in appearance work fine but under where is the problem that i describe in these e-mails.


        The first time ( and when open a new session ) the anchor relative to the menu report  right href with the _s and _k parameter

                for example the Home anchor report :


                <a class=" active internal page" title="Welcome to Pier!" href="/pier?_s=9K76T_OM34OI-n_d&amp;_k=mZPHc-oUOnpyR1IQ&amp;_n&amp;1">Home</a>

       

        For each next sequence display  the menu anchor don't report any _s _k  value.

        Apparently it works fine, but in reality the system loses information and create a new instance of the page at any click.

        In my case, i lose the state of the component ( counter ) in the page and the error is apparent.
       

        Perhaps the problem is relative to the cookies where the system manage some information.


        If in the pier dispatcher entry point i disable the cookies the _s _k href value   aren't manage   even when the system create new session.


        Someone has some suggestions indication on how to solve the problem?

        For the pier entry is necessary - obligatory enabled the cookies ?

        Thank,

                Dario
 

>
> Ciao,
>
> i don't understund because but in my environment, when the pier rendering the Menu  based on:
>
>
> (PRPage named: 'menu')
> contents:
> '- *Home>/*
> - *Chi siamo>/chisiamo*
> - *Missione>/missione*
> - *Despina>/despina*
> - *Catalogo>/catalogo*
> - *Menu on-line>/menuonline*
> - *Blog>/blog*
> - *Riferimenti>/riferimenti*';
> yourself ]
>
>
> the relative anchor don't report any _K   parameter.
>
>
>
> Accordingly when i click on one menu item   the filter can't address the request  and create a new instance whenever.
>
> I update the menu page with the Pier interface but the error persist.
>
>
>
>
>
> Yesterday i have a problem with the first menu item : Home
>
> after the first display it lose the link to the home page.
>
> I solved the problem adding to my PierDistribution root  method the :
>
>
>
> self rootPage enumerator
> with;
> all;
> do:
> [ :each |
> each outgoingReferences
> do: [ :link | (link isKindOf: PRInternalLink) ifTrue: [ link target: nil ] ].
> each securityDecoration owner: self kernel users anyOne.
> each securityDecoration group: self kernel groups anyOne ].
>
>
> With this declaration the Home work fine, but i have the over problem
>
>
> Thanks,
>
> Dario
>
>
>> Hi,
>>
>> my some other considerations:
>>
>>
>>> Hi,
>>>
>>> i work with Pier 3.0.0
>>>
>>> I have a pier site with a menu to manage some pages.
>>>
>>> Some of this pages are configured to manage components.
>>>
>>>
>>>
>>>
>>> For test i add some  Counter seaside application instances.
>>>
>>> Now when display a specific page with some counter it work fine:
>>>
>>> i can change any specific counter instance in the page
>>
>> My Pier instance is based on PRDistribution where i declared
>>
>> counterwidget
>>
>> ^ counterwidget ifNil: [counterwidget := (PRComponent named: 'counter')
>> componentClass: WACounter;
>> title: 'Counter on-line';
>> yourself
>> ]
>>
>>
>> The relative page is declared with:
>>
>> (PRPage named: 'counterpage')
>> title: 'Embed';
>> contents:
>> '+/system/components/counter+'
>>
>> All works fine at the first display.
>>
>>>
>>>
>>> My problem is when i change the menu for display another page.
>>>
>>>
>>> In this case when redisplay a page with the counters all instance are reset to 0.
>>
>> I remark the problem :
>> when redisplay the counterpage   the counter is reset to 0.
>>
>>
>>
>> I do some test in hold image based on Pier 2.0.6   and with it all works fine.
>>
>> ( i don't remember particular setting into Pier 2.0.6   Pharo image)
>>
>> The WACounter remember is state and is right rendered when i redisplay  the relative page.
>>
>> This is my objective.
>>
>> How i read in some Pier documents my goal is to embedded seaside application / component  into Pier.
>>
>>>
>>>
>>> Now my question is:
>>>
>>> what do i do  for  redisplay the counter at  the last update ?
>>
>> I do some test adding the component directly in a page with Pier interface but the problem remain into Pier  3.0
>>
>>
>>>
>>>
>>> I need to configure something ?
>>>
>>>
>>
>> Renewal my thanks for any considerations
>>
>> Dario
>> _______________________________________________
>> Magritte, Pier and Related Tools ...
>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

dtrussardi@tiscali.it
In reply to this post by dtrussardi@tiscali.it
Ciao,
               
        some time ago i submit an e-mail about the object, but at today i don't  solve the problem.

        I beg to resubmit the matter again.

        I take this opportunity to wish a Happy New Year.

        Dario

> Hi,
>
> i work with Pier 3.0.0
>
> I have a pier site with a menu to manage some pages.
>
> Some of this pages are configured to manage components.
>
>
>
>
> For test i add some  Counter seaside application instances.
>
> Now when display a specific page with some counter it work fine:
>
> i can change any specific counter instance in the page.
>
>
>
>
> My problem is when i change the menu for display another page.
>
>
> In this case when redisplay a page with the counters all instance are reset to 0.
>
>
> Now my question is:
>
> what do i do  for  redisplay the counter at  the last update ?
>
>
> I need to configure something ?
>
>
> Thanks for any considerations,
>
>
> Dario
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

Yanni Chiu
On 24/12/12 4:48 AM, [hidden email] wrote:

>> I have a pier site with a menu to manage some pages.
>> Some of this pages are configured to manage components.
>>
>> For test i add some  Counter seaside application instances.
>>
>> Now when display a specific page with some counter it work fine:
>>
>> i can change any specific counter instance in the page.
>>
>> My problem is when i change the menu for display another page.
>>
>> In this case when redisplay a page with the counters all instance are reset to 0.
>>
>> Now my question is:
>>
>> what do i do  for  redisplay the counter at  the last update ?
>>
>> I need to configure something ?

IIUC, a Seaside component is created and initialized for each Seaside
session. I believe there is a way to set some initial values using link
parameters, but the details are not at my fingertips.

Can you say a bit more about how you are using the pier page to manage
components. Ideally, an example of the wiki markup, and maybe a code
snippet that configures the Pier component to create the WACounter  (or,
the steps done in Pier, if you're not doing this part in code).

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

dtrussardi@tiscali.it
Ciao,

        Happy New Year to all.

        Thank Yanni for your answer  ( sorry for my delay ).

> On 24/12/12 4:48 AM, [hidden email] wrote:
>>> I have a pier site with a menu to manage some pages.
>>> Some of this pages are configured to manage components.
>>>
>>> For test i add some  Counter seaside application instances.
>>>
>>> Now when display a specific page with some counter it work fine:
>>>
>>> i can change any specific counter instance in the page.
>>>
>>> My problem is when i change the menu for display another page.
>>>
>>> In this case when redisplay a page with the counters all instance are reset to 0.
>>>
>>> Now my question is:
>>>
>>> what do i do  for  redisplay the counter at  the last update ?
>>>
>>> I need to configure something ?
>
> IIUC, a Seaside component is created and initialized for each Seaside session. I believe there is a way to set some initial values using link parameters, but the details are not at my fingertips.
>

I found one example relative to this question creating a blog based on PRBlogKernelDistribution.

> Can you say a bit more about how you are using the pier page to manage components. Ideally, an example of the wiki markup, and maybe a code snippet that configures the Pier component to create the WACounter  (or, the steps done in Pier, if you're not doing this part in code).

It in the blog page, it rendering some counter example  based on the following code:

-------------------------------------------------------------------------------------------------------------------
blogPostEmbeddingComponents
        ^ (PBPost named: 'embedding-components')
                title: 'Embedding components';
                tags: #('components' 'embedding' 'Seaside');
                publication: TimeStamp now;
                contents:
'Embedding Seaside components is straightforward. Simply add a component to a node within the site''s tree structure, then add a reference to that component within a blog post. For example if you add a component as a child of this post, you can then then embed the component using the syntax. \+mychild\+. Here is an embedded ajaxified counter:

+ajaxcounter+

...and the standard counter:

+counter+

Test Seaside''s state management by clicking on the \+\+ and \-\- links. Pier blogs are ideal for demoing and describing your Seaside components. In fact you can use Pier as the basis for application development by embedding components in pages, especially if you are building a content-rich site.';
                addChild: ((PRComponent named: 'ajaxcounter')
                        componentClass: JQCounterFunctionalTest;
                        yourself);
                addChild: ((PRComponent named: 'counter')
                        componentClass: WACounter;
                        yourself);
                yourself.
-----------------------------------------------------------------------------------------------------------------------------------



You can  display the blog page and do some operations + - on one counter,

After  if you click on any menu item ( Home or Blog itself )  

        you lose the state of the counter instances.

But i need to remember the state of the counters instance ( or any other my root components ) so that when redisplay the page i display the

right last update value.


I hope that the example is understandable.

I remain available for any further information.

        Thanks for any considerations,


                Dario Trussardi



_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

Reza Razavi
In reply to this post by dtrussardi@tiscali.it
Hi,

Happy New Year!

I would suggest having also a look at Pier Widgets.

Cheers,
Reza

On January 2, 2013 at 5:13 PM [hidden email] [hidden email] wrote:
> Ciao,
> 
> Happy New Year to all.
> 
> Thank Yanni for your answer ( sorry for my delay ).
> 
> > On 24/12/12 4:48 AM, [hidden email] wrote:
> >>> I have a pier site with a menu to manage some pages.
> >>> Some of this pages are configured to manage components.
> >>> 
> >>> For test i add some Counter seaside application instances.
> >>> 
> >>> Now when display a specific page with some counter it work fine:
> >>> 
> >>> i can change any specific counter instance in the page.
> >>> 
> >>> My problem is when i change the menu for display another page.
> >>> 
> >>> In this case when redisplay a page with the counters all instance are reset to 0.
> >>> 
> >>> Now my question is:
> >>> 
> >>> what do i do for redisplay the counter at the last update ?
> >>> 
> >>> I need to configure something ?
> > 
> > IIUC, a Seaside component is created and initialized for each Seaside session. I believe there is a way to set some initial values using link parameters, but the details are not at my fingertips.
> > 
> 
> I found one example relative to this question creating a blog based on PRBlogKernelDistribution.
> 
> > Can you say a bit more about how you are using the pier page to manage components. Ideally, an example of the wiki markup, and maybe a code snippet that configures the Pier component to create the WACounter (or, the steps done in Pier, if you're not doing this part in code).
> 
> It in the blog page, it rendering some counter example based on the following code:
> 
> -------------------------------------------------------------------------------------------------------------------
> blogPostEmbeddingComponents
> ^ (PBPost named: 'embedding-components')
> title: 'Embedding components';
> tags: #('components' 'embedding' 'Seaside');
> publication: TimeStamp now;
> contents:
> 'Embedding Seaside components is straightforward. Simply add a component to a node within the site''s tree structure, then add a reference to that component within a blog post. For example if you add a component as a child of this post, you can then then embed the component using the syntax. \+mychild\+. Here is an embedded ajaxified counter:
> 
> +ajaxcounter+
> 
> ...and the standard counter:
> 
> +counter+
> 
> Test Seaside''s state management by clicking on the \+\+ and \-\- links. Pier blogs are ideal for demoing and describing your Seaside components. In fact you can use Pier as the basis for application development by embedding components in pages, especially if you are building a content-rich site.';
> addChild: ((PRComponent named: 'ajaxcounter')
> componentClass: JQCounterFunctionalTest;
> yourself);
> addChild: ((PRComponent named: 'counter')
> componentClass: WACounter;
> yourself);
> yourself.
> -----------------------------------------------------------------------------------------------------------------------------------
> 
> 
> 
> You can display the blog page and do some operations + - on one counter,
> 
> After if you click on any menu item ( Home or Blog itself ) 
> 
> you lose the state of the counter instances.
> 
> But i need to remember the state of the counters instance ( or any other my root components ) so that when redisplay the page i display the 
> 
> right last update value.
> 
> 
> I hope that the example is understandable.
> 
> I remain available for any further information.
> 
> Thanks for any considerations,
> 
> 
> Dario Trussardi
> 
> 
> 
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

Yanni Chiu
In reply to this post by dtrussardi@tiscali.it
On 02/01/13 11:13 AM, [hidden email] wrote:
> You can  display the blog page and do some operations + - on one counter,
>
> After  if you click on any menu item ( Home or Blog itself )
>
> you lose the state of the counter instances.
>
> But i need to remember the state of the counters instance ( or any other my root components ) so that when redisplay the page i display the
>
> right last update value.

The setup method I was thinking of is:

WAComponent>>initializeOwner: aStructure link: anInternalLink
        "Initialize the receiver with the settings from aStructure and
overriding parameters of anInternalLink."

Follow the code, for the exact syntax (see: PRLink
class>>parseParameters:with:), but I think the wiki syntax is something
like:

+mychild|param1=value1+

The problem you're having with losing the state, I think is due to the
links you're clicking - i.e. the links don't have the session
information. So you're getting a new component (i.e. losing the state)
with each new session. I've seen cases where clicking on the menu links
seems to start a new (Seaside) session. It has to do with how the menu
link is created.

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

dtrussardi@tiscali.it
In reply to this post by dtrussardi@tiscali.it
Hi,

i doubt that I have not expressed well:

> Ciao,
>
> Happy New Year to all.
>
> Thank Yanni for your answer  ( sorry for my delay ).
>
>> On 24/12/12 4:48 AM, [hidden email] wrote:
>>>> I have a pier site with a menu to manage some pages.
>>>> Some of this pages are configured to manage components.
>>>>
>>>> For test i add some  Counter seaside application instances.
>>>>
>>>> Now when display a specific page with some counter it work fine:
>>>>
>>>> i can change any specific counter instance in the page.
>>>>
>>>> My problem is when i change the menu for display another page.
>>>>
>>>> In this case when redisplay a page with the counters all instance are reset to 0.
>>>>
>>>> Now my question is:
>>>>
>>>> what do i do  for  redisplay the counter at  the last update ?
>>>>
>>>> I need to configure something ?
>>
>> IIUC, a Seaside component is created and initialized for each Seaside session. I believe there is a way to set some initial values using link parameters, but the details are not at my fingertips.
>>
>
> I found one example relative to this question creating a blog based on PRBlogKernelDistribution.
>
>> Can you say a bit more about how you are using the pier page to manage components. Ideally, an example of the wiki markup, and maybe a code snippet that configures the Pier component to create the WACounter  (or, the steps done in Pier, if you're not doing this part in code).
>
> It in the blog page, it rendering some counter example  based on the following code:
>
> -------------------------------------------------------------------------------------------------------------------
> blogPostEmbeddingComponents
> ^ (PBPost named: 'embedding-components')
> title: 'Embedding components';
> tags: #('components' 'embedding' 'Seaside');
> publication: TimeStamp now;
> contents:
> 'Embedding Seaside components is straightforward. Simply add a component to a node within the site''s tree structure, then add a reference to that component within a blog post. For example if you add a component as a child of this post, you can then then embed the component using the syntax. \+mychild\+. Here is an embedded ajaxified counter:
>
> +ajaxcounter+
>
> ...and the standard counter:
>
> +counter+
>
> Test Seaside''s state management by clicking on the \+\+ and \-\- links. Pier blogs are ideal for demoing and describing your Seaside components. In fact you can use Pier as the basis for application development by embedding components in pages, especially if you are building a content-rich site.';
> addChild: ((PRComponent named: 'ajaxcounter')
> componentClass: JQCounterFunctionalTest;
> yourself);
> addChild: ((PRComponent named: 'counter')
> componentClass: WACounter;
> yourself);
> yourself.
> -----------------------------------------------------------------------------------------------------------------------------------
>
>
>
> You can  display the blog page and do some operations + - on one counter,
>
> After  if you click on any menu item ( Home or Blog itself )  
>
> you lose the state of the counter instances.
>
> But i need to remember the state of the counters instance ( or any other my root components ) so that when redisplay the page i display the
>
> right last update value.

My problem is to remember the state of the counter when change the menu  in the same session.

If the session is new ( or has just expired ) it's right  generate a new instance of the counter.

But within the same session when change the menu, i expect that the system does not lose the references and don't  create new instance.

No one has a concrete example of how to solve the problem?

As for example the handle of WACounter of example above.

Thanks,

        Dario
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

Reza Razavi
In reply to this post by dtrussardi@tiscali.it
Hi Dario,

On January 3, 2013 at 12:32 PM [hidden email] [hidden email] wrote:

> But within the same session when change the menu, i expect that the system does not lose the references and don't create new instance.

As far as I can remember, this behavior is implemented by Pier Widgets.

> No one has a concrete example of how to solve the problem?

Any subclass of PRWidget should provide an example of how to solve that problem.

Cheers,
Reza 




_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

dtrussardi@tiscali.it

Hi,  Reza

thank,

i do some test and i think to found a my hold problem with Pier.

>> Ciao,
>>
>> i have do some test with the PRDistribution  register
>>
>> It create a default pier entry Welcome to Pier!
>>
>>
>> It in appearance work fine but under where is the problem that i describe in these e-mails.
>>
>>
>> The first time ( and when open a new session ) the anchor relative to the menu report  right href with the _s and _k parameter
>>
>> for example the Home anchor report :
>>
>>
>> <a class=" active internal page" title="Welcome to Pier!" href="/pier?_s=9K76T_OM34OI-n_d&amp;_k=mZPHc-oUOnpyR1IQ&amp;_n&amp;1">Home</a>
>>
>>
>>
>> For each next sequence display  the menu anchor don't report any _s _k  value.
>>
>> Apparently it works fine, but in reality the system loses information and create a new instance of the page at any click.
>>
>> In my case, i lose the state of the component ( counter ) in the page and the error is apparent.
>>
>>
>> Perhaps the problem is relative to the cookies where the system manage some information.
>>
>>
>> If in the pier dispatcher entry point i disable the cookies the _s _k href value   aren't manage   even when the system create new session.
>>
>>
>> Someone has some suggestions indication on how to solve the problem?
>>
>> For the pier entry is necessary - obligatory enabled the cookies ?




Thank for any considerations,

                Dario


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

Yanni Chiu
On 03/01/13 10:54 AM, [hidden email] wrote:
>
>>> The first time ( and when open a new session ) the anchor relative to the menu report  right href with the _s and _k parameter
>>> for example the Home anchor report :
>>>
>>> <a class=" active internal page" title="Welcome to Pier!" href="/pier?_s=9K76T_OM34OI-n_d&amp;_k=mZPHc-oUOnpyR1IQ&amp;_n&amp;1">Home</a>
>>>
>>> For each next sequence display  the menu anchor don't report any _s _k  value.
>>>
>>> Someone has some suggestions indication on how to solve the problem?

This behaviour has always disturbed me, and thanks to your question,
I've finally looked into it.

It seems that the menu is nothing more than a page with a list of
structure links, and is displayed through a PRDefaultView. If you look
at PRDefaultView>>isRestful, it returns true. Try an *experiment*, and
change it to return false. Does the change cause the generated anchor
links to have the "lost" _s and _k parameters?

The problem is that if your menu item points at a structure that is not
restful (and your counter state is not restful), then the menu item will
appear to misbehave. I think the fix is to create your own menu widget.
Maybe look at PRViewsWidget or PRCommandsWidget to see what code is needed.

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

Reza Razavi
In reply to this post by dtrussardi@tiscali.it
On January 4, 2013 at 4:29 AM Yanni Chiu [hidden email] wrote:
> It seems that the menu is nothing more than a page with a list of 
> structure links, and is displayed through a PRDefaultView.

Yes. The page (menu) itself is displayed as a PRDefaultView, which then searches for each of its outgoing links/Components in the current Context. So, the problem may also be related to the Context too. Replacing your Component with a Widget may provide a solution, since PRWidgets keep a pointer to their Context.

Cheers,
Reza


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

dtrussardi@tiscali.it
In reply to this post by Yanni Chiu
Ciao,

        thanks for any consideration.

> On 03/01/13 10:54 AM, [hidden email] wrote:
>>
>>>> The first time ( and when open a new session ) the anchor relative to the menu report  right href with the _s and _k parameter
>>>> for example the Home anchor report :
>>>>
>>>> <a class=" active internal page" title="Welcome to Pier!" href="/pier?_s=9K76T_OM34OI-n_d&amp;_k=mZPHc-oUOnpyR1IQ&amp;_n&amp;1">Home</a>
>>>>
>>>> For each next sequence display  the menu anchor don't report any _s _k  value.
>>>>
>>>> Someone has some suggestions indication on how to solve the problem?
>
> This behaviour has always disturbed me, and thanks to your question, I've finally looked into it.
>
> It seems that the menu is nothing more than a page with a list of structure links, and is displayed through a PRDefaultView. If you look at PRDefaultView>>isRestful, it returns true. Try an *experiment*, and change it to return false. Does the change cause the generated anchor links to have the "lost" _s and _k parameters?

I change the PRDefaultView>>isRestful   to ^false   and with it the menu anchor  manage the _k parameter.

With the _k parameters the request work fine  and don't  create a new instance of the page at any click.

I don't understund because the menu anchor don't manage the _s parameter  but the _k  is enough for my question.

>
> The problem is that if your menu item points at a structure that is not restful (and your counter state is not restful), then the menu item will appear to misbehave. I think the fix is to create your own menu widget. Maybe look at PRViewsWidget or PRCommandsWidget to see what code is needed.

In my image i have a deprecated PRMenuWidget it can use for solve this problematic ?

I look at PRViewsWidget and i think to define a new  PRNewMenuWidget
       
        and define a menuPage with

menuPage
        ^ menuWidget ifNil:
                [ menuWidget :=  (PRPage named: 'menu')
                addChild: ((PRComponent named: 'widgetmenu')
                                prototypeInstance: PRNewMenuWidget new;
                                yourself);
                contents: '+widgetmenu+'
        ]

Now i don't understand where i define the menu structure:

'- *Home>/*
- *Chi siamo>/chisiamo*
- *Missione>/missione*
- *Catalogo>/catalogo*
- *Offerte>/offerte*
- *Ordini>/menuonline*
- *Blog>/blog*
- *Riferimenti>/riferimenti*';

and how redefine the method  PRNewMenuWidget renderItem: aClass on: html
       
Thanks,

        Dario

P.S. i'm interested to understund the pier environment.  Where i can found some documentation?
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

Yanni Chiu
On 04/01/13 9:03 AM, [hidden email] wrote:
>
> In my image i have a deprecated PRMenuWidget it can use for solve this problematic ?

I didn't know PRMenuWidget was still included. Try using PRMenuWidget
instead of what I said about looking at PRViewsWidget for code inspiration.

Have a look at PRMenuWidget class>>defaultDocument

I think the code you need is something like:

menuPage
        | document widget |
        document := PRDocumentParser parse:
'- *Home>/*
- *Chi siamo>/chisiamo*
- *Missione>/missione*
- *Catalogo>/catalogo*
- *Offerte>/offerte*
- *Ordini>/menuonline*
- *Blog>/blog*
- *Riferimenti>/riferimenti*'.

        widget = PRMenuWidget new.
        widget write: document using: widget descriptionDocument.

        ^ menuWidget ifNil:
                [ menuWidget :=  (PRPage named: 'menu')
                addChild: ((PRComponent named: 'widgetmenu')
                                prototypeInstance: widget;
                                yourself);
                contents: '+widgetmenu+'
        ]

>
> P.S. i'm interested to understund the pier environment.  Where i can found some documentation?

Other than http://piercms.com, this mailing list is it, AFAIK.

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

Yanni Chiu
In reply to this post by Reza Razavi
On 04/01/13 2:21 AM, Reza Razavi wrote:
> On January 4, 2013 at 4:29 AM Yanni Chiu <[hidden email]> wrote:
>>  It seems that the menu is nothing more than a page with a list of
>>  structure links, and is displayed through a PRDefaultView.
>
> Yes. The page (menu) itself is displayed as a PRDefaultView, which then
> searches for each of its outgoing links/Components in the current
> Context. So, the problem may also be related to the Context too.
> Replacing your Component with a Widget may provide a solution, since
> PRWidgets keep a pointer to their Context.

Okay, the saved context in PRWidget seems to be the crucial difference.
Without using PRWidget, the context used to generate url's would be:
"PRCurrentContext value". I don't understand how a PRContext gets
associated with a Seaside session though.

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

Reza Razavi
In reply to this post by dtrussardi@tiscali.it
Hi Yanni,

I would suggest looking at the references to PRCurrentContextHolder, specifically PRPierFrame>>withContextDo:.

Cheers,
Reza

On January 4, 2013 at 6:05 PM Yanni Chiu [hidden email] wrote:
> On 04/01/13 2:21 AM, Reza Razavi wrote:
> > On January 4, 2013 at 4:29 AM Yanni Chiu [hidden email] wrote:
> >> It seems that the menu is nothing more than a page with a list of
> >> structure links, and is displayed through a PRDefaultView.
> >
> > Yes. The page (menu) itself is displayed as a PRDefaultView, which then
> > searches for each of its outgoing links/Components in the current
> > Context. So, the problem may also be related to the Context too.
> > Replacing your Component with a Widget may provide a solution, since
> > PRWidgets keep a pointer to their Context.
> 
> Okay, the saved context in PRWidget seems to be the crucial difference. 
> Without using PRWidget, the context used to generate url's would be: 
> "PRCurrentContext value". I don't understand how a PRContext gets 
> associated with a Seaside session though.
> 
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

dtrussardi@tiscali.it
In reply to this post by Yanni Chiu
Ciao,

        thanks Yanni.


> On 04/01/13 9:03 AM, [hidden email] wrote:
>>
>> In my image i have a deprecated PRMenuWidget it can use for solve this problematic ?
>
> I didn't know PRMenuWidget was still included. Try using PRMenuWidget instead of what I said about looking at PRViewsWidget for code inspiration.
>
> Have a look at PRMenuWidget class>>defaultDocument
>
> I think the code you need is something like:
>
> menuPage
> | document widget |
> document := PRDocumentParser parse:
> '- *Home>/*
> - *Chi siamo>/chisiamo*
> - *Missione>/missione*
> - *Catalogo>/catalogo*
> - *Offerte>/offerte*
> - *Ordini>/menuonline*
> - *Blog>/blog*
> - *Riferimenti>/riferimenti*'.
>
> widget = PRMenuWidget new.
> widget write: document using: widget descriptionDocument.
>
> ^ menuWidget ifNil:
> [ menuWidget :=  (PRPage named: 'menu')
> addChild: ((PRComponent named: 'widgetmenu')
> prototypeInstance: widget;
> yourself);
> contents: '+widgetmenu+'
> ]
>

I followed your indications  and the statements work.

The PRMenuWidget define :

        renderContentOn: html
        | visitor |
        visitor := PRMostSpecificInternalLinkVisitor new
                visit: self document.
        PRMenuRenderer new
                target: visitor target;
                continue: self document
                in: self on: html

But the menu anchor don't manage the  _k parameter.

I don't understund how the widgets works but in this my case

the PRContext
        urlOn: aRenderer
        "Answer a Seaside URL to get into the receiving context."

        | url |
        ^ aRenderer callbacks isNil
                ifTrue: [ self url ]
                ifFalse: [
                        url := aRenderer context actionUrl copy.
                        url purgeOtherFields; adaptToContext: self.
**** (self command isRestful and: [ self application hasCookieInContext: self requestContext ])
                                ifTrue: [ url purgeSeasideFields ]
                                ifFalse: [
                                        url queryFields
                                                at: '_n' put: nil;
                                                at: (aRenderer callbacks store: self activationCallback) put: nil ].
                        url ]


reference in any case the command ( see *** )

Now the  PRViewCommand
       
        isRestful
                ^ self viewComponentClass isRestful

and it answer the PRDefaultView isRestful  ->  ^true

So the problem remains.

I wonder if in any case the widget is managed as a PRViewCommand

 or if they exist precisely to avoid such management.

Some considerations about it and my menu management problem?

Ciao, thanks,

                Dario


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Pier component state when redisplay the page

Yanni Chiu
On 05/01/13 11:40 AM, [hidden email] wrote:
>
> So the problem remains.
>
> I wonder if in any case the widget is managed as a PRViewCommand
>
>   or if they exist precisely to avoid such management.
>
> Some considerations about it and my menu management problem?

Does anyone else have any suggestions?

Do you have to use a WACounter? Or, is that just for discussion
purposes. Can you create something like PRCounterWidget that subclasses
from PRWidget - that might work, but I've not tried it myself.

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki