Hi, is it possible add some kind of cookie via js to remember user selected tab? using session API maybee?

CommentFileSizeAuthor
#3 viewsdisplaytabs.zip7.07 KBcyborg_572

Comments

solipsist’s picture

Sure. I'd welcome a patch.

hixster’s picture

Any news on this?

cyborg_572’s picture

StatusFileSize
new7.07 KB

I was working on this for a website, and added a system that uses a cookie to track what tab was last selected. In loads the correct tab first in PHP, renewing the cookie each time as well. The javascript checks for the cookie and lets that take precedence over the default setting coming from the views module. The javascript also sets the cookie whenever the tab is switched.

Each view has it's own cookie named "vdtMemory-[view name]" and stores the name of the display to show, so there's no conflict with having this enabled on multiple views. It uses the default values for domain, path and security, but the expiration date is customizable on a per-view basis. All of this can be turned on or off on a per-view basis in the viewsdisplaytabs settings.

I'm going to have to apologize though, as I'm fairly new to Drupal, so I might not be using the greatest coding standards. I'm also still learning how to make a good patch, so I'm uploading the .module and the .js file. I started with the 6.x-1.0-beta6 files.

I hope this is helpful.

chrislabeard’s picture

I would love to have this feature. I've tried your upload, yes it remembers the tab but it seems it won't load the actual view just displays the default.

cyborg_572’s picture

yeah... I just recently noticed that too. I guess that's what I get for testing on a set of views that look very similar.

karengrey’s picture

setting a cookie is not best practice because:
There's a new EU law that has come into effect, that websites that require cookies now have to ask users to opt in to use them, rather than the old way of opting out.

Its best to set a variable into the $_SESSION that stores the active tab. Im working on this at the moment, but would be nice if it was there anyway like other exposed filters on views are.

cyborg_572’s picture

Session is generally tracked via cookies as well, isn't it?

EDIT: Never mind, I did some looking and I guess there's implications that session cookies are allowed, if I understand properly. It was some quick looking around.

hellomobe’s picture

How do we implement the $_SESSION for the view - mentioned in #6.

abaanda’s picture

Issue summary: View changes

anyone got this to work for the d7 port?