jQuery UI Cookie
Whilst working on a web application I have come to a point where I am finding it difficult to progress, so I am posting here today in hope that someone will be able to answer my question, or give me some pointers as to how I should tackle this problem.
I'll start off by giving some background information as to how this application functions, and will talk about the technical side of it later on. Effectively what I am creating is a virtual noticeboard for staff members to login to where they can view a noticeboard that displays multiple notes. The standard user cannot make notes, but can hide notes that they have read. When doing this, only the notes hidden will affect that particular user. Each user can also move each note around to whatever position they want, however, I am having issues saving the position they move this note to.
I am using jQuery UI to make each note movable. Each note is contained by a parent <div> (the noticeboard) and is restricted to move only within the parent <div>. Each note is created dynamically using PHP (created by an admin). As I mentioned before, I am having issues with storing the position of each note that is moved by each user, so that when they login again, the note is still in the same spot they last dragged it to.
So, my question. How would I write this cookie to store and read the position of every note that is created? Secondly, could this cookie be written so that it would work across all users, or would I need to approach this differently?
Thank you very much for giving the time to read over my problem, and any feedback will be greatly appreciated.
The problem with cookies is that they would only store the note position/visibility data on that particular user's local profile on his PC (unless you have profile roaming, and I'm assuming a Windows environment here of course). Surely what you want is for any user to log on from any PC anywhere and find the notes exactly as he left them?
Well, presumably you're authenticating the users anyway and are therefore storing their account details in a database, along with the notes created, etc. So I suggest that you store the *state* of each note for each user in the database too, recording the state every time the note is moved/hidden/shown via an AJAX call to the PHP backend (to update the database). To reduce the number of records being stored/manipulated you should only create a user's note record where the data differs from the base values for the note (i.e. when created by the admin, as stored in the note record).
Then, when a user logs in, use AJAX to retrieve and draw all the notes he has access to with any overridden or visibility settings for the user, driven by a suitable SQL query which joins the data tables together and overrides the base values where the user has made a change.
I appreciate the detailed response, however, I am dealing with the design and presentation side of the project and have been advised that cookies will be suitable as the users will be using the same computer every time anyway.
With that in mind, how would you recommend I pursue with this issue?
|All times are GMT +1. The time now is 03:22 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.