Bookmark for custom page

Hi Team,

I created a custom page and I don't create a any ContentId & ContentTypeId to this page.

I want a bookmark to this custom page and I given the  below sample for custom page,

public void RegisterUrls(IUrlController controller)

{
      controller.AddPage("page-members-rewards", "members/{UserName}/testpage", null, userNameConstraints, "page-members-rewards");
}

Kindly guide me how to resolve this issue and bookmark button and also disabled here and I underline in blank box.

Regards,

Kiran Cherukuri.

Parents Reply Children
  • Hi  ,

    Thanks for you reply,

    I implemented ParseContext and send the data to it. 

    Now I can bookmark this page but its not reflecting in any content/application/group/user as shown in below attachment.

    Kindly help us to why its not showing here. Thanks!

  • Have you implemented IContentType using the same ContentTypeId, and enabled your content type? The item will then be listed in the content tab automatically. Or if you implemented IApplicationType or IContainerType, it will appear in Application or Group tab respectively.

  • Hi  ,

    I added the IContentType like below in my c# code,

    using System;
    using System.Collections.Generic;
    using System.Text;
    using Telligent.Evolution.Extensibility;
    using Telligent.Evolution.Extensibility.Api.Version1;
    using Telligent.Evolution.Extensibility.Content.Version1;
    using Telligent.Evolution.Extensibility.Version1;
    
    namespace Telligent.Test.Widget.Extension
    {
       public class TestContentType : IContentType, ITranslatablePlugin ,IBookmarkableContentType
        {
            IContentStateChanges _contentState = null;
            ITranslatablePluginController _translations = null;
    
            #region IPlugin Members
            string IPlugin.Name
            {
                get { return "Coupon Redeemption Content Type"; }
            }
            string IPlugin.Description
            {
                get { return "Coupon Redeemption Content Type"; }
            }
    
            void IPlugin.Initialize()
            {
    
            }
            #endregion
    
            #region IContentType Members
            Guid[] IContentType.ApplicationTypes
            {
                get { return new Guid[] { ContentTypes.ApplicationId }; }
            }
    
            void IContentType.AttachChangeEvents(IContentStateChanges stateChanges)
            {
                _contentState = stateChanges;
            }
    
            Guid IContentType.ContentTypeId
            {
                get { return ContentTypes.ContentTypeId; }
            }
    
            string IContentType.ContentTypeName
            {
                get { return _translations.GetLanguageResourceValue("ContentTypeName"); }
            }
    
            IContent IContentType.Get(Guid contentId)
            {
                return (IContent)PointsCouponData.GetCouponDetails(contentId.ToString());
                //return Apis.Get<IContents>().Get(contentId, ContentTypes.ContentTypeId);
            }
            #endregion
    
            #region ITranslatablePlugin Members
            Translation[] ITranslatablePlugin.DefaultTranslations
            {
                get
                {
                    var t = new Translation("en-US");
                    t.Set("ContentTypeName", "Coupon Redeemption ContentType Listings");
                    return new Translation[] { t };
                }
            }
    
            void ITranslatablePlugin.SetController(ITranslatablePluginController controller)
            {
                _translations = controller;
            }
            #endregion
    
            #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 read = new Guid("4F692E0C-9CAB-4d09-9126-684FAF41A085");
                //var permission = Apis.Get<IPermissions>().Get(read, userId, contentId, ContentTypes.ContentTypeId);
                //return permission.IsAllowed;
                return true;
            }
    
            #endregion
        }
    }
    

    I passed the url data in RegisterUrls() like below

    public void RegisterUrls(IUrlController controller)
            {
                controller.AddPage("page-members-custom", "r/test-details/{Giud}/{PageName}", null, null, "page-members-custom", new PageDefinitionOptions()
                {
                    DefaultPageXml = @"<contentFragmentPage pageName=""page-members-custom"" isCustom=""false"" layout=""HeaderTopContentLeftSidebarRight"" themeType="""">
          <regions>
            <region regionName=""RightSidebar"">
                <contentFragments>
                    <contentFragment type=""Telligent.Evolution.ScriptedContentFragments.ScriptedContentFragment, Telligent.Evolution.ScriptedContentFragments::57f01ee86a2c4a5a948833e829a6c709"" showHeader=""True"" cssClassAddition=""full-border with-header"" isLocked=""False"" configuration="""" />
                </contentFragments>
            </region>
            <region regionName=""Content"">
              <contentFragments>
                <contentFragment type=""Telligent.Evolution.ScriptedContentFragments.ScriptedContentFragment, Telligent.Evolution.ScriptedContentFragments::f54116426f5a4c189ce488dfe1b86cb7"" showHeader=""true"" cssClassAddition=""no-wrapper with-spacing responsive-1"" isLocked=""False"" configuration="""" />
             </contentFragments>
            </region>      
          </regions>
          <contentFragmentTabs />
        </contentFragmentPage>",
                    TitleFunction = () => _translations.GetLanguageResourceValue("page-members-custom"),
                    DescriptionFunction = () => _translations.GetLanguageResourceValue("page-members-custom-description"),
                    ParseContext = ParseUserContextByRewards
                });
            }
    		
    		   private void ParseUserContextByRewards(PageContext context)
            {
                var contentId = context.GetTokenValue("Giud");
    
                var item = new ContextItem()
                {
                    TypeName = "Rewards",
                    ApplicationId = new Guid("3858CD53-E3B3-443B-8E22-0C1D8AC711BA"),
                    ApplicationTypeId = ContentTypes.ApplicationId,
                    ContainerId = new Guid("5619DA54-61ED-4E92-AC09-3BDDCAE4A789"),
                    ContainerTypeId = new Guid("23B05A61-C3E5-4451-90D9-BFA00453BCE4"),
                    ContentId = new Guid(contentId.ToString()),
                    ContentTypeId = ContentTypes.ContentTypeId,
                    Id = contentId.ToString()
                };
                if (item != null)
                    context.ContextItems.Put(item);
            }

    I was enabled the contenttype like from my content types list.

    When I bookmark the page, bookmark happens and bookmark color changed to red color but It is not displayed in the bookmark list anywhere 

    You can check the above code references. Kindly check help me what is mistake done by me. Thanks!

     

  • Hi  ,

    I got one more issue with Point Transactions in the same page.

    I used the script code like below, when I run the point transaction script  api the points are not updated in profile page and I am not getting any error also.

    jQuery.telligent.evolution.post({
                                    url: jQuery.telligent.evolution.site.getBaseUrl() + 'api.ashx/v2/pointtransactions.json',
                                    data: {
                                        'Description': 'Add the points to user.',
                                        'UserId':2100,
                                        'Value': 50,
                                        'ContentId': '$contentId',
                                        'ContentTypeId': '$contentTypeId'
                                    },
                                    success: function(response) {
                                         jQuery.telligent.evolution.notifications.show("Success.", { type: 'success', duration: 10000 });
                                    }
                                });

    Kindly help to me what mistake I done here. Thanks!

  • Is your content type id included in the result of $core_v2_contentType.List() ?

    Is your bookmark included in the result of $core_v2_bookmark.List("%{ PageIndex = 0, PageSize = 10, SortBy = 'Date', SortOrder = 'Descending', ContentTypeIds = $contentTypeId }") where $contentTypeId is your Content type id?

    In your IContentType implementation, IContent IContentType.Get(Guid contentId) doesn't need to explicitly return an IContent, but the return type from your method PointsCouponData.GetCouponDetails(contentId.ToString()) needs to be a type that implements IContent.

    In your point transactions sample, how are you calling that script? Also where are you defining $contentId and $contentTypeId?

  • Bookmark Related Stuff

    $core_v2_contentType.List() return my coupon item 

    $core_v2_bookmark.List("%{ PageIndex = 0, PageSize = 10, SortBy = 'Date', SortOrder = 'Descending', ContentTypeIds = $contentTypeId }")

    doesn't return my bookmark related page but only notification color changed to red color when I visited the page.

    PointsCouponData.GetCouponDetails(contentId.ToString()) return type will be IContent and I implemented the IContent interface in the model and it returns correct when I debug and verified.

     

    Point Transaction related stuff

    I am calling the point transaction sample when I click submit button and I was declared contentid & contenttypeid  belongs to page details same as bookmark related data like contenttypeid.

    But still I am not getting any error in exception log as well as the page is not bookmarked & point transaction also not working.

    Can you please help me to resolve this issue, thanks!

     

  • Have you implemented an IApplication that corresponds to your ContentTypes.ApplicationId referenced in the Content Type? If so, you might check this thread to see if it applies to your situation: community.telligent.com/.../1613386