
With version 2.0 just starting, it might be time to evaluate the use of javascript, and how it affects the design of the product. I'm basing this off of the fact that I see jQuery is included with Pligg, though, as a suggestion, you may want to check out Ext JS - JavaScript Library
In either case, the points below should apply to either library (or even ExtJS running on top of jQuery).
Design the browser to server communication with the idea that there is no javascript available. This would require moving away from the use of links with onClicks, and rather, built with hrefs that pass information directly to the server. Normally this would be done with GET requests, however, since you're looking at CI, you'd want to use it's URI functionality. So, for example..
To vote on story 5, the vote link before any javascript loads might have an href that looks like "/vote/5", and the A could have a class of "voteLink".
Then, have your javascript load. It can use the functionality that your javascript framework to use css selectors to grab all A elements with the class of voteLink, override the href, and add on onClick even for an xmlhttprequest to the same link, with the addition of a POST variable "aR = true".
On the backend, your script parses the URI, sending it to the vote controller, and using the first variable as the id the vote is being added to. Do your normal routine to validate and add a vote. Then at the display time, check to see if the POST variable aR exists.
If there is no aR, send the user back to the page the request came from, which will show them the new vote count. If the aR does exist, then load up a JSON format response, stating the vote was a success, and applying the new vote count.
I hope this makes sense, I'm still working on my first cup of coffee and going through server logs here at work.





Linear Mode




