It was brought to our attention that the BODY field of activity items was not supporting embedded links. Upon investigation, we realized that our friend update bodies for all updates, even hi5 generated ones, do not allow HTML of any kind because truncation can result in malformed HTML issues. So, tonight, we came up with an interim solution you can take advantage of.
We will not be able to allow embedded links in the BODY of activites for launch, but we will allow you to customize the more >> link that follows each activity BODY. To do this we added support for the OpenSocial activity URL field. This field also supports view-params to direct users to particular pages within your app. Here's an example that will link to the viewer's canvas page for your app with an additional parameter:
function createActivity(title) {
var opts = {};
opts[opensocial.Activity.Field.TITLE] = title;
opts[opensocial.Activity.Field.BODY] = "Start sending gifts too!";
var viewParams = gadgets.json.stringify({"test":"w00t!"});
opts[opensocial.Activity.Field.URL] = "/apps/displayAppCanvas.do?appId=[APP_ID]&userId=" + viewer.getField(opensocial.Person.Field.ID) + "&view-params=" + encodeURIComponent(viewParams);
var activity = opensocial.newActivity(opts);
// Request the activity creation
opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH);
}
If no URL is set, the more >> link will continue to default to the VIEWER's (the user generating the update) canvas page.
This feature will be available on sandbox tomorrow.
We will not be able to allow embedded links in the BODY of activites for launch, but we will allow you to customize the more >> link that follows each activity BODY. To do this we added support for the OpenSocial activity URL field. This field also supports view-params to direct users to particular pages within your app. Here's an example that will link to the viewer's canvas page for your app with an additional parameter:
function createActivity(title) {
var opts = {};
opts[opensocial.Activity.Field.TITLE] = title;
opts[opensocial.Activity.Field.BODY] = "Start sending gifts too!";
var viewParams = gadgets.json.stringify({"test":"w00t!"});
opts[opensocial.Activity.Field.URL] = "/apps/displayAppCanvas.do?appId=[APP_ID]&userId=" + viewer.getField(opensocial.Person.Field.ID) + "&view-params=" + encodeURIComponent(viewParams);
var activity = opensocial.newActivity(opts);
// Request the activity creation
opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH);
}
If no URL is set, the more >> link will continue to default to the VIEWER's (the user generating the update) canvas page.
This feature will be available on sandbox tomorrow.
0 TrackBacks
Listed below are links to blogs that reference this entry: Activity Update.
TrackBack URL for this entry: http://www.hi5networks.com/cgi-bin/mt/mt-tb.cgi/95
© 2008 hi5Networks
Leave a comment