Here is an example of a jQuery plugin that uses the getRegisteredTeamraisers API method to show a logged in constituent a list of all TeamRaisers they are currently registered for, each linked to the Participant Center for the event. This plugin can be used on Convio Online Marketing (for example, PageBuilder), Convio CMS, or an external Web site (assuming the external site is using Convio's Single Sign-On API, and has some kind of proxy service akin to Convio's AjaxProxy).
To use this plugin, you'll need two things:
Once you've uploaded both JavaScript files to your site, you'll included them in the head of the page where the list is to be added like so:
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/jquery.myTeamRaisers.js"></script>
Example: The following will display a list of TeamRaiser events for the logged in constituent on a Convio Online Marketing page.
<script type="text/javascript">
$(function(){
$('#myTeamRaisers').myTeamRaisers({
'proxyURL':'AjaxProxy?auth=[[S86:true]]&cnv_url=',
'nonsecureConvioPath':'http://[[S29:DOMAIN]][[S29:PATH]]',
'secureConvioPath':'https://[[S29:SECURE_DOMAIN]][[S29:SECURE_PATH]]',
'apiKey':'[[S0:CONVIO_API_KEY]]',
'consID':'[[S1:cons_id]]'
});
});
</script>
<div id="myTeamRaisers"></div>
Example: The following will display a list of TeamRaiser events for the logged in constituent on a Convio CMS page.
<script type="text/javascript">
$(function(){
$('#myTeamRaisers').myTeamRaisers({
'proxyURL':'/system/proxy.jsp?__proxyFormat=json&__proxyURL=',
'nonsecureConvioPath':'http://[[S29:DOMAIN]][[S29:PATH]]',
'secureConvioPath':'https://'+'[[S29:SECURE_DOMAIN]][[S29:SECURE_PATH]]',
'apiKey':'[[S0:CONVIO_API_KEY]]',
'consID':'[[S1:cons_id]]'
});
});
</script>
<div id="myTeamRaisers"></div>
(You should, of course, include a conditional to first confirm that the user is logged in, seeing as the JavaScript will not work if they are not.)
myTeamRaisers() takes the following arguments:
proxyURL (required):
The URL of the proxy through which the AJAX request will be made. The
URL of the Convio API will be appended to this URL. An example might be
http://www.foo.org/proxy.php?url=.
nonsecureConvioPath (required):
The non-secure path to the Convio site where the API is to be called.
This should be something like http://www.mysite.org/site/.
secureConvioPath (required):
The secure path to the Convio site where the API is to be called. This
should be something like https://secure2.convio.net/organization/site/.
apiKey (required):
The Convio API key for the site.
consID (required):
The Convio cons_id of the logged in user.
acceptingRegistrationsOnly (optional):
One of either "true" or "false". Indicates whether to show only those
TeamRaiser events marked as Accepting Registrations. Default is "false".
acceptingDonationsOnly (optional):
One of either "true" or "false". Indicates whether to show only those
TeamRaiser events marked as Accepting Donations. Default is "false".
pageToLinkTo (optional):
One of either "entry" or "center". Indicates whether to link to the
landing page of the TeamRaiser or the Participant Center. Default is
"center".
includeEventDate (optional):
One of either "true" or "false". Indicates whether to show the event
date below the TeamRaiser link. Default is "false".
loadingImage (optional):
The URL of an image to display while the call is being made to the API.
(Get one at http://www.ajaxload.info)
loadingText (optional):
Text to display while the call is being made to the API.
Copyright 2010 Convio, Inc.