// Get the values from the Configuration Element
uiTheme = application.ptSocialMedia.getUItheme();
// TODO - Figure out why are these commented out
// Load the Facebook Graph API JS Headers Headers
//application.ptSocialMedia.socialMediaService.loadFacebookJS();
// Load the Twitter @Anywhere and Widgets JS Headers Headers
//application.ptSocialMedia.socialMediaService.loadTwitterAnywhereJS();
//application.ptSocialMedia.socialMediaService.loadTwitterWidgetsJS();
// Load the JQuery Plugin Headers
application.ptSocialMedia.scripts.loadjQuery(noconflict=1);
// load header for jQuery UI
application.ptSocialMedia.scripts.loadJQueryUI(themeName=uiTheme);
// Load the JQuery TimeAgo Plugin Headers
application.ptSocialMedia.scripts.loadjQueryTimeAgo();
// Load the JQuery TimeAgo Plugin Headers
application.ptSocialMedia.scripts.loadCFJS();
// load headers for jQuery Cookie
application.ptSocialMedia.scripts.loadJQueryCookie();
// Load the Social Media App JS Headers
application.ptSocialMedia.socialMediaService.loadSocialMediaJS();
request.element.isStatic = 0;
// CacheValidUntil example code
/*
// ADD SOME CACHING //
// Get today's last X minute
minsToCache = 10;
rebuildDate = dateAdd("n", minsToCache, now());
// tells the element to cache until the end of today
request.element.cacheValidUntil = Mid(CreateODBCDateTime(rebuildDate),6,19);
// makes sure that the element is static
request.element.isStatic = 1;
*/
csMode = "";
if ( StructKeyExists(request,"renderstate") AND StructKeyExists(request.renderstate,"rendermode") )
csMode = request.renderstate.rendermode;
// Set the Default for the Show Error flag
showError = true;
showElementDump = false;
if ( StructKeyExists(request.params,"showElement") AND IsBoolean(request.params.showElement) )
showElementDump = request.params.showElement;
showDataDump = false;
if ( StructKeyExists(request.params,"showData") AND IsBoolean(request.params.showData) )
showDataDump = request.params.showData;
showFeedDump = false;
if ( StructKeyExists(request.params,"showFeed") AND IsBoolean(request.params.showFeed) )
showFeedDump = request.params.showFeed;
showSourceDataDump = false;
if ( StructKeyExists(request.params,"showSourceData") AND IsBoolean(request.params.showSourceData) )
showSourceDataDump = request.params.showSourceData;
noRenderHTML = false;
if ( StructKeyExists(request.params,"noHTML") AND IsBoolean(request.params.noHTML) )
noRenderHTML = request.params.noHTML;
showTestPost = false;
if ( StructKeyExists(request.params,"showTestPost") AND IsBoolean(request.params.showTestPost) )
showTestPost = request.params.showTestPost;
// Made it past the initial data check ... turn off the error
showError = false;
outputHTML = true;
// Get the values from the Configuration Element
appConfigStruct = application.ptSocialMedia.getAppConfig();
//application.ptSocialMedia.utils.doDump(appConfigStruct,"appConfigStruct",0);
// Set the UI theme from the Configuration Element
uiTheme = 'redmond';
if ( structKeyExists(appConfigStruct,"ui_theme") AND LEN(TRIM(appConfigStruct['ui_theme'])) )
uiTheme = appConfigStruct['ui_theme'];
//Set Ajax Proxy Path
AjaxPath = application.ADF.ajaxProxy;
//Set the Controller Bean and the RomoveMethod
ControllerBean = "feedController";
RemoveMethod = "removePost";
//application.ptSocialMedia.scripts.setDebugMode(debugMode=true);
// Get the data items in the RH
selectedFeeds = attributes.elementInfo.elementData.propertyValues;
// Since we are only worried about what is in the first array item grab that one
selectedFeedStruct = StructNew();
if ( ArrayLen(selectedFeeds) )
selectedFeedStruct = selectedFeeds[1];
// TODO: Add admin/contributor rights check around this DUMP
if ( showElementDump )
application.ptSocialMedia.utils.doDump(selectedFeedStruct,"selectedFeedStruct",0);
fbItems = ArrayNew(1);
twItems = ArrayNew(1);
ytItems = ArrayNew(1);
wpItems = ArrayNew(1);
fbData = StructNew();
twData = StructNew();
ytData = StructNew();
wpData = StructNew();
facebookLikeButtonStyle = "Button Count"; //Standard
likeStyle = "button_count";
likeWidth = 200;
twitterTweetButtonStyle = "No Count";
tweetStyle = "none";
showSourceLinks = "No Display";
sourceLinksPosition = "";
youTubeThumbImageHTML = "";
openYouTubePlayersInLB = "No";
lbYouTubePlayerWidth = "480"; //Default: 480x270 aspect ratio 16:9
lbYouTubePlayerHeight = "270";
youTubePlayerWidth = "309"; //Default: 309x174aspect ratio 16:9
youTubePlayerHeight = "193"; // Default 174
youTubePlayerHTML = "";
// Make sure Feed Selector Element Returns selected feed records
if ( StructKeyExists(selectedFeedStruct,"values") )
{
// Get the RenderLimit from the selected feed meta data
//if ( StructKeyExists(selectedFeedStruct.values,"renderLimit") )
//maxRenderLimit = selectedFeedStruct.values.renderLimit;
// Get the fbLikeButtonStyle from the selected feed meta data
if ( StructKeyExists(selectedFeedStruct.values,"fbLikeButtonStyle") )
facebookLikeButtonStyle = selectedFeedStruct.values.fbLikeButtonStyle;
// Get the tweetButtonStyle from the selected feed meta data
if ( StructKeyExists(selectedFeedStruct.values,"tweetButtonStyle") )
twitterTweetButtonStyle = selectedFeedStruct.values.tweetButtonStyle;
// Get the tweetButtonStyle from the selected feed meta data
if ( StructKeyExists(selectedFeedStruct.values,"displaySourcesLinks") )
showSourceLinks = selectedFeedStruct.values.displaySourcesLinks;
// Get the youtubePlayersInLB from the selected feed meta data
if ( StructKeyExists(selectedFeedStruct.values,"youtubePlayersInLB") )
openYouTubePlayersInLB = selectedFeedStruct.values.youtubePlayersInLB;
// Get the youtubePlayerSizeInLB from the selected feed meta data
// - Convert the value to a width and a height
if ( StructKeyExists(selectedFeedStruct.values,"youtubePlayerSizeInLB") AND LEN(TRIM(selectedFeedStruct.values.youtubePlayerSizeInLB)) ) {
youtubePlayerSizeInLB = selectedFeedStruct.values.youtubePlayerSizeInLB;
if ( IsNumeric(ListFirst(youtubePlayerSizeInLB,"x")) )
lbYouTubePlayerWidth = ListFirst(youtubePlayerSizeInLB,"x");
if ( IsNumeric(ListLast(youtubePlayerSizeInLB,"x")) )
lbYouTubePlayerHeight = ListLast(youtubePlayerSizeInLB,"x");
}
// Get the youtubePlayerSizeEmbedded from the selected feed meta data
// - Convert the value to a width and a height
if ( StructKeyExists(selectedFeedStruct.values,"youtubePlayerSizeEmbedded") AND LEN(TRIM(selectedFeedStruct.values.youtubePlayerSizeEmbedded)) ) {
youtubePlayerSizeEmbedded = selectedFeedStruct.values.youtubePlayerSizeEmbedded;
if ( IsNumeric(ListFirst(youtubePlayerSizeEmbedded,"x")) )
youTubePlayerWidth = ListFirst(youtubePlayerSizeEmbedded,"x");
if ( IsNumeric(ListLast(youtubePlayerSizeEmbedded,"x")) )
youTubePlayerHeight = ListLast(youtubePlayerSizeEmbedded,"x");
}
// Facebook Button CE Options: No Button, Standard, Button Count, Box Count
// FB Parameter Values: standard, button_count, box_count
if ( facebookLikeButtonStyle EQ "Button Count" )
likeStyle = "button_count";
else if ( facebookLikeButtonStyle EQ "Box Count" )
likeStyle = "box_count";
else if ( facebookLikeButtonStyle EQ "Standard" )
likeStyle = "standard";
// Twitter Button CE Options: No Button, No Count, Vertical Count, Horizontal Count
// Twitter Parameter Values: none, horizontal, vertical
if ( twitterTweetButtonStyle EQ "Vertical Count" )
tweetStyle = "vertical";
else if ( twitterTweetButtonStyle EQ "Horizontal Count" )
tweetStyle = "horizontal";
else if ( twitterTweetButtonStyle EQ "No Count" )
tweetStyle = "none";
// Get Feed Data from the Combined from the selected Feeds
fbItems = application.ptSocialMedia.feedController.buildCombinedFeedItems(
selectedFeeds=selectedFeedStruct
,sortOrder="desc"
,sortField="PublishedDate"
,excludeServiceList="twitter,youtube,wordpress"
,addTestData=showTestPost
,showFeedDump=showFeedDump
);
// Get Feed Data from the Combined from the selected Feeds
twItems = application.ptSocialMedia.feedController.buildCombinedFeedItems(
selectedFeeds=selectedFeedStruct
,sortOrder="desc"
,sortField="PublishedDate"
,excludeServiceList="facebook,youtube,wordpress"
,addTestData=showTestPost
,showFeedDump=showFeedDump
);
// Get Feed Data from the Combined from the selected Feeds
ytItems = application.ptSocialMedia.feedController.buildCombinedFeedItems(
selectedFeeds=selectedFeedStruct
,sortOrder="desc"
,sortField="PublishedDate"
,excludeServiceList="facebook,twitter,wordpress"
,addTestData=showTestPost
,showFeedDump=showFeedDump
);
// Get Feed Data from the Combined from the selected Feeds
wpItems = application.ptSocialMedia.feedController.buildCombinedFeedItems(
selectedFeeds=selectedFeedStruct
,sortOrder="desc"
,sortField="PublishedDate"
,excludeServiceList="facebook,twitter,youtube"
,addTestData=showTestPost
,showFeedDump=showFeedDump
);
// TODO: Add admin/contributor rights check around this DUMP
if ( showDataDump )
{
application.ptSocialMedia.utils.doDump(fbItems,"fbItems",0);
application.ptSocialMedia.utils.doDump(twItems,"twItems",0);
application.ptSocialMedia.utils.doDump(ytItems,"ytItems",0);
application.ptSocialMedia.utils.doDump(wpItems,"wpItems",0);
}
// Set the Max Number of Result to display
if ( ArrayLen(fbItems) )
fbData = fbItems[1];
// Set the Max Number of Result to display
if ( ArrayLen(twItems) )
twData = twItems[1];
// Set the Max Number of Result to display
if ( ArrayLen(ytItems) )
ytData = ytItems[1];
// Set the Max Number of Result to display
if ( ArrayLen(wpItems) )
wpData = wpItems[1];
}
if ( ArrayLen(fbItems) EQ 0 AND ArrayLen(twItems) EQ 0 AND ArrayLen(ytItems) EQ 0 AND ArrayLen(wpItems) EQ 0 )
showError = true;
if ( noRenderHTML )
outputHTML = false;
application.ADF.scripts.addFooterJS(timeagoFooterJS,"TERTIARY");