manuelbernhardt / tm

Oxiras Test Management Suite
http://www.oxiras.com
1 stars 0 forks source link

Tree node open/closed status per user #126

Open gwenael-alizon opened 13 years ago

gwenael-alizon commented 13 years ago

At the moment the status of the tree nodes, open or closed, is stored at treeNode level. It however likely makes sense to have this status depend on the logged in user.

manuelbernhardt commented 13 years ago

With a bit of luck, enabling this plugin should do the trick: http://www.jstree.com/documentation/cookies

manuelbernhardt commented 13 years ago

this should be added in tree.js

dziga commented 13 years ago

I've added plugin and jQuery cookie plugin (as this depends on it). It does save the state of selection, but not open/close state. It seems that controller gives nodes with status open at each load, I think that might be the issue.

@manuelbernhardt can u confirm this, I didn't manage to find where status of nodes is set for each tree (if closed/opened).

gwenael-alizon commented 13 years ago

I was not able either to find how the cookie gets overwritten, but the value in the DB is definitely used somehow: when the "opened" is set to false / 0 / empty in tm_ProjectTreeNode, the cookie seems to work just fine. Now somewhere (tree module?) the value is set to true upon creation.

manuelbernhardt commented 13 years ago

Allright so this is related to the way the tree data is serialized with taking into account the "open" value all the time (i.e. the value stored in the database). I am not entirely sure how the tree behaves if there is no status passed for the nodes, I suppose it shows them as closed by default tough.

So a fix of the tree plugin involving a configuration parameter to add to application.conf should take care of this, I will have a look.

gwenael-alizon commented 13 years ago

Thanks Manu to have looked into it. The proper value for the "save_opened" param in tree.js is "jstree_open" I believe (it is also the default value), otherwise it does not save the state properly.

Now even then the behavior is still funky (checked both in FF and Chrome). Here are a couple of examples (true also the other way round):

manuelbernhardt commented 13 years ago
gwenael-alizon commented 13 years ago

Still not working for me. Looking at the cookie values that are stored (both jstree_open and jstree_select), the issue seems to be that the cookie only contain the state of one given tree (the last one). Additionally I get a number of "PLAY_ERRORS" cookies, but without any visible content, when moving from one tree to another.

manuelbernhardt commented 13 years ago

I tested this in firefox. Make sure you:

PLAY_ERRORS is a cookie of Play for storing the error scope, this should not be a problem

gwenael-alizon commented 13 years ago

The cookie still seems to only store the status of one tree at a time. It gives the impression that the status is stored for 2 trees when one node is selected only because the node selected in jstree_selected makes the parents being opened

manuelbernhardt commented 13 years ago

That would mean that perhaps jsTree expects to be explicitly given a different cookie name in the configuration, one for each tree. It would be somewhat strange tough because even if two trees were to use the same cookie, given that the nodes are namespaced, this should still work.

One way of testing this would be to modify tree.js so that the configuration parameters for the cookie plugin in regards to cookie name (opened, selected - I think) are prefixed with the tree name. the tree name variable should be declared somewhere early in tree.js so it should be possible to pass it to the plugin configuration if I am not mistaken