RE: [Zope] Tree tag cookie questions
I realize that Zope doesn't save the tree state, but that the browser does, sorry I wasn't clearer. The problem is that we have many pages generating what appears to the user to be the same tree, which of course it isn't. I'm using Yihaw, which gives me a 'Yihaw Folder' class that has an index_html containing this code (I root the tree at BASE3 because that's where all the Yihaw folders start living): <dtml-tree expr="REQUEST.resolve_url(BASE3)" branches_expr="objectValues('Yihaw Folder')" nowrap="1" sort="title"> <a href="&dtml-absolute_url;"> <img src="/Images/FolderIcon.gif" border="0"> <b><dtml-var title_or_id></b> </a> </dtml-tree> A user hits /folder1, generates a tree, modifies the tree state and gets a cookie. Then he hits one of the links above, goes to /folder1/folder2, generates a new tree, but with the state saved in the cookie. If he modifies the tree state yet again, does he get a new cookie, obliterating the previous tree state, or does the same cookie get modified, saying "for page /folder1/index_html the tree state is 'x', for page /folder1/folder2/index_html the tree state is 'y'?" My users seem to expect that they can return to a page and have whatever tree state they "saved" on that page reappear, and reading what you just wrote, I don't think that's true, is it? Obviously, it isn't happening, but it _appears_ (key concept!) that it is happening at some times and not others, and I'm trying to find out if it _can't_ happen, or if I did something wrong. Craig Dunigan Web Programmer Esker Software - Extending the Reach of Information mailto:craig.dunigan@esker.com Ph. 608.273.6000 Fax 608.273.8227 http://www.esker.com
-----Original Message----- From: Michel Pelletier [mailto:michel@digicool.com] Sent: Thursday, May 24, 2001 4:28 PM To: Dunigan, Craig Cc: 'zope@zope.org' Subject: Re: [Zope] Tree tag cookie questions
On Thu, 24 May 2001, Dunigan, Craig wrote:
At exactly what point does Zope send a cookie for the tree tag? It seems that it does so when the user expands or contracts the tree, but am I right about that?
Yes anytime the visual state of the tree changes, it sends a new value for the 'tree-s' cookie.
And does Zope save tree state for each and every page visited, if they all have a tree?
No, the *browser* saves the tree state. That's what the cookie is for.
In multiple cookies, or just one big cookie it keeps modifying?
There is just one cookie named 'tree-s', and it can only hold the state for one tree. This is why you cannot have two trees in the same document.
Is there perhaps a limit somewhere to how many tree states Zope can save for a single session?
Once again, Zope doesn't save the state, that's what the cookie is for.
Obviously, I'm having trouble with the tree tag behavior, but I might figure it out on my own if I can get some of these answers. Thanks.
What's the trouble? You haven't described your problem.
-Michel
On Thu, 24 May 2001, Dunigan, Craig wrote:
<dtml-tree expr="REQUEST.resolve_url(BASE3)"
You shouldn't use REQUEST.resolve_url. Use restrictedTraverse instead.
branches_expr="objectValues('Yihaw Folder')" nowrap="1" sort="title"> <a href="&dtml-absolute_url;"> <img src="/Images/FolderIcon.gif" border="0"> <b><dtml-var title_or_id></b> </a> </dtml-tree>
A user hits /folder1, generates a tree, modifies the tree state and gets a cookie. Then he hits one of the links above, goes to /folder1/folder2, generates a new tree, but with the state saved in the cookie. If he modifies the tree state yet again, does he get a new cookie, obliterating the previous tree state, or does the same cookie get modified, saying "for page /folder1/index_html the tree state is 'x', for page /folder1/folder2/index_html the tree state is 'y'?"
The former: the old cookie gets obliterated. There is only one 'tree-s' cookie, and it can only hold the state for one tree, the last tree viewed by the user.
My users seem to expect that they can return to a page and have whatever tree state they "saved" on that page reappear, and reading what you just wrote, I don't think that's true, is it?
Nope.
Obviously, it isn't happening, but it _appears_ (key concept!) that it is happening at some times and not others, and I'm trying to find out if it _can't_ happen, or if I did something wrong.
When it apears to happen, it may just be a caching issue. I'm sure you could try and extend the tree cookie to be more all-encompasing as you described above. This would have the upshot of allowing two trees on the same page. -Michel
From: "Dunigan, Craig" <craig.dunigan@esker.com>
that they can return to a page and have whatever tree state they "saved" on that page reappear, and reading what you just wrote, I don't think that's true, is it? Obviously, it isn't happening, but it _appears_ (key concept!) that it is happening at some times and not others, and I'm trying to find out if it _can't_ happen, or if I did something wrong.
As Michel explains in another email, the same cookie is used by all instances of the Tree tag, so there can effectively only be one tree state per site per browser. You could get around this by hacking the Tree tag, or by trying out the generic TreeMaker class from ZTUtils. It doesn't have all of the features of the Tree tag yet, but it has enough that I was able to write an example using Page Templates that works just like the standard Zope management tree. Unfortunately, that example is about all the documentation it has. If you're interested, check out http://www.zope.org/Members/4am/ZPT Cheers, Evan @ digicool & 4-am
participants (3)
-
Dunigan, Craig -
Evan Simpson -
Michel Pelletier