Question

How can I manage page state history in share (surf?) so that I remember for example which yui tab was active and on which page the pager was on?

I noticed that alfresco share does something like that after form submit. You get redirected to the exact same page url where you were before. If any "ajax state" (don't know what they are called) parameters are in url like #something=asdf you get the same url.

But when using manual navigation like moving through site pages those parameters aren't saved.

Is this even a good idea to do? To save page state in session for example?

Was it helpful?

Solution

Some pages have support for URL parameters that are passed in. In those cases the browser history is used, e.g. we editing metadata in the full page meta data view the user is send back to the page he is coming from. This is done in javascript by calling window.history.go(-1) after form submit but only works when parameters are set/retrieved by URL. The document library implements page specific javascript for setting the URL and parsing parameters from it.

I some places Alfresco uses the preference service to store user settings between different pages permanently. For example this is used in the document library for the "show folders" and "simple/thumbnail view" buttons. Here is some sample code from the document library javascript setting a preference option:

var PREFERENCES_DOCLIST = "org.alfresco.share.documentList",
      PREF_SHOW_FOLDERS = PREFERENCES_DOCLIST + ".showFolders";

var preferences = new Alfresco.service.Preferences(); 
this.services.preferences.set(PREF_SHOW_FOLDERS, true);

The evaluation of the properties is usually done in the Share component webscripts, you can have a look in share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\documentlibrary\include\documentlist.lib.js for an example.

In any case you have to dig into Alfresco's javascript code in the browser and the share tier to see how to implement it.

OTHER TIPS

You could check parameters sended to the server side after form submiting in the firebug (firefox plugin) and then you could use the same parameters. Also perhaps you should use yui history manager:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top