User State
Purpose
As with any complicated web application there are times when it is useful for the site to remember the state of the user interface. For example, if the user clicks 'Advanced' to open up a hidden section, when the user returns to this page the advanced section should remember its open state.
How it works
Traditionally web state has been remembered through the use of cookies. However, cookies have two problems: 1) there has been a EU Directive requiring site visitors to agree to the use of cookies, and 2) cookies are machine specific and so cannot remember state when logging into Rogo from any computer. The way Rogo has solved this problem is to use a database table (state) to store state information. There is also stateutils.class.php
class for saving and retrieving state in the database. State is held against a particular user ID and page (screen) and is stored in the form of interface object (state_name) and the state it is in (content). For example, state_name could be set to 'advanced' and content set to 'block' for visible. The JavaScript filestate.js
is often used. For any checkboxes with the class 'chk' a jQuery function will be called which ultimately calls set_state.php
through AJAX to record state transparently in the background.
Note
Cookies are still used for authentication purposes.