Sunday, October 09, 2011

Just for fun, the Recurring Event "Join Now" buttons on IADN’s Webinar page automatically toggle between:

 and


You’d have to wait for a session to be about to start to see the toggle, but it toggles 5 minutes before the session starts. This avoids some confusion where folks think since there is a Join Now button, that the session will automatically start when they click the button. This way, the button is not active unless the webinar is in session, or about to be in session.


It loads a page named test.a5w every 1 minute and updates just the named DIV, not the whole page. Test.a5w contains whatever content you want to have appear:

(Click here to see where I grabbed the jquery code)

Javascript goes in the Head area:

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function() {
$("#loaddiv").load("test.a5w");
var refreshId = setInterval(function() {
$("#loaddiv").load('test.a5w?randval='+ Math.random());
}, 60000);
$.ajaxSetup({ cache: false });
});
</script>



And then this where you want the content to appear:

<div id="loaddiv">
</div>

And here is the test.a5w page (DBF):

dim tbl as p
tbl = table.open("[PathAlias.ADB_Path]\event_item")
query.filter = "status = 'rec'"
query.order = "sortlevel"
indx = tbl.query_create()

join_yes = "<a target='_meeting' href="+tbl.url+"><img border=0 width=\"60px\" src=\"images/join_now.gif\" title=\"Join Now\"></a>"
join_no  = "<img border=0 width=\"60px\" src=\"images/join_not_now.gif\" title=\"Not in Session, check back\">"

lst = ""
tbl.fetch_first()

while .not. tbl.fetch_eof()
lst = lst + "<div class=\"adbox\" style=\"text-align:left;margin-left:5px;display: inline-table;\">"
lst = lst + "<div style=\"float:left;width:710px\"><h3 style=\"margin-top:0;margin-bottom:2px\">"+tbl.title+"</h3>"+tbl.short_desc+"<br></div>"
if dow(date()) = val(tbl.Recurring_Dow) .and. between(toseconds(time()),toseconds(tbl.recurring_starttime)-300,toseconds(tbl.recurring_endtime))
    lst = lst + join_yes
    else
    lst = lst + join_no
end if
lst = lst + "</div>"
tbl.fetch_next()
end while

tbl.close()
?lst