PDA

View Full Version : [ajaxboy] AutoUpdater



s0ct0j0c
21-04-2011, 02:03 PM
Aren't you sick of refreshing the page every one or two minutes?.
Doesn't it get old?.
Shouldn't you just have the page open, and see everything that goes on?
Do you like the facebook feeling that it keeps you updated while you are on the page?.
You spend alot of time on the forums, and need to keep refreshing the page?



Here is where AutoUpdater comes in..



If you answered yes to any of the questions above, this is a must have addon.


This is an early release of the AutoUpdater Addon v1.0.


This addon updates inbox and alerts messages with ajax without reloading the page.


This addon is FREE.




Features:




Check for new Inbox Messages (pops the red icon).
Check for new Alerts (pops the red icon).
Ability to set time inverval how often to check for new items. (1 second?, 5 seconds, 1 minute?.. 5 minutes?... etc)
2 internal timer engines - (PHP timer - which puts the a script to sleep, and Javascript timer which sets events for future time to occur.) You maybe use whichever you see fit (facebook uses the php option)
Ability to work with group permission. (in case you just want specific folks to have awesome features)
Play Sound when new messages arrive or alerts ( click sound ) - this allows you to leave the forums and do other stuff, and if you hear the sound you can go back.. a time saver if you work on the forums..

This addon is free to use. This is my first xenforo addon ( actual is my second one ) but my first one to public.

Popup bubbles
http://xenforomods.info/attachments/alerts-png.6475/?embedded=1




Admin Options


http://xenforomods.info/attachments/autoupdaterwsound-png.6476/?embedded=1


Current Limitations:



Currently the pop-up control that shows the new messages menu once you hover over it, it caches the menu. AutoUpdater does not update that menu currently like wise with the alerts menu.


As mentioned above, this is an early version of this addon, so you can expect more to come.. at least that is the idea at the moment.


Additionally it currently only works while on main forums and while browsing threads.


That said.. let me know if you run into any problems and I'll try to get you on the right direction.


timer engine...


If you are concerned about getting things really accurate I recommend the php timer engine option. The JavaScript option sets and caches events for the future, you could experience echo from events that were set in the past from time to time, after a while. For example if you have set the option to play sound, it might repeat it again, though it does not currently means any it would cause problems or other than small rare side effects.




System Resources:



This addon relays on small fast tiny ajax engine called cjax. Cjax is fast reliable ajax engine, that been around since 2007. If any resources
are taken at all, it will be by the request itself to the server. Cjax also uses a small javascript library which makes use of mainly two functions. If you are very concerned about system resources make the time interval higher so less requests are made.




Updates:

There are many other places where these kind of operations are needed, for example while during private conversations (check for new messages and if there a new ones, add it to the conversation). While posting, and all these places where it could be given more like "real time" feeling. Also there are immediate updates that could be used to update things like the popups, and the like. Also, updates with the latest threads, without refreshing the page. And facebook like friendly messages to keep you updated of site happenings.. and so on.. all that might fit.


Installation:



There is a template change on this addon. You are going to need to edit template "navigation_visitor_tab", and consequenty add the following:


On line 98:



PHP:
<xen:else>

<strong class="itemCount" id="ConversationsMenu_Counter" style="display:none">

</strong>

</xen:if>



On line 132:


PHP:
<xen:else />

<strong class="itemCount" id="AlertsMenu_Counter" style="display:none">

</strong>

</xen:if>





The zip includes "navigation_visitor_tab.tpl" which is the same template, with the changes applied. You may replace the orginal template by this one (In case you read this in the future, the current version of xenforo is 1.0 RC2 so there are not confusions).

If you run into any problems, post it here, so that we can work it out.


Usage:

Make sure to assign the "AutoUpdater" permission to desired group or users.
Set the addon's options to suit you better. Set the time interval to a appropriate time.. depending on what you consider appropriate for your site..


How do you know it is working?..


Send a message to yourself through other browser (and other user) or have someone send you a message.. wait at least the time for which the interval is set for and... it should pop up ..


Also when you load the page it displays a small loader indicator. Also, you can use firebug to see the ins and outs. In addition if you would like to see more info you can set it on debug mode.. in file AutoUpdater/Model/Cjax.php line 23, is a commented option to set it on debug mode, this allows for some more details in firebug.


Additionally, it has a switch to turn it on and off, it comes as off by default, make sure to turn it on.

I don't want to ask for branding feed as this is an early version of this addon, but if you love the idea feel free and donate (https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DGW43TEMKLS86).