The IBookmarkableContentType plugin type provides support for bookmarking content.
Why should I make my content bookmarkable?
It can be important for users to save content. If you are creating a schedule users may want to return to this content and review it for changes.
Creating an IBookmarkableContentType plugin
The IBookmarkableContentType Plugin Type is defined in the Telligent.Evolution.Extensibility.Content.Version1 namespace. For the following example, we'll add the IBookmarkableContentType to the existing content type plugin defined in the Content Type Example , updating the LinkItemContentType definition to:
public class LinkItemContentType : IContentType, ITranslatablePlugin, IBookmarkableContentType
This interface is similar to the others, it requires you to define whether a user can bookmark or unbookmark content. It also should return if the content supports bookmarks. In this sample we arbitrarily selected the "Read Group" permission but any permission can be defined here. The following implementation of IBookmarkableContentType can be added to the LinkItemContentType implementation:
#region IBookmarkableContentType
public bool CanBookmark(Guid contentId, int userId)
{
return CanUseBookmarks(contentId, userId);
}
public bool CanUnBookmark(Guid contentId, int userId)
{
return CanUseBookmarks(contentId, userId);
}
public bool SupportsBookmarks
{
get { return true; }
}
private bool CanUseBookmarks(Guid contentId, int userId)
{
var content = LinksData.GetLink(contentId);
if (content == null)
return false;
var readGroupPermissionId = Telligent.Evolution.Extensibility.Apis.Get<IGroupPermissions>().ReadGroup;
var permissionCheck = Telligent.Evolution.Extensibility.Apis.Get<Telligent.Evolution.Extensibility.Api.Version2.IPermissions>().CheckPermission(readGroupPermissionId, userId, new Telligent.Evolution.Extensibility.Api.Version2.PermissionCheckOptions {
ContentId = content.ContentId,
ContentTypeId = content.ContentTypeId
});
return permissionCheck.IsAllowed;
}
#endregion
Once the project is rebuilt and the plugin is , bookmarking link items can now be performed using the core_v2_ui Script API 's Bookmark method.