+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Listing a News provider in the backend tab bar

Listing a News provider in the backend tab bar

2 posts, 0 answered
  1. Alessio S.
    Alessio S. avatar
    37 posts
    Registered:
    31 May 2010
    06 Jul 2010
    Link to this post
    Hi,
    in the website I'm customizing at the moment I have created a second provider for News content, which some additinal metafields and a custom editor page. In the backend I'd like to list it in the tab bar as if it were a separate module though, rather than listing it in the News providers box. Is it possible and which is the best way to do this? I looked into setting up a simple wrapper module which would use the News module classes and give it a different default provider but I'm not sure what I should inherit/override. I tried this:

    public class MyModule : NewsModule
    {
        public override string Name
        {
            get { return "MyModule"; }
        }
     
        public override string Title
        {
            get { return "MyModule"; }
        }
     
        public MyModule()
            : base()
        { }
    }

    And added the required entries to web.config:

    <sectionGroup name="telerik">
        <section name="myModule" type="Telerik.News.Configuration.SectionHandler, Telerik.News" requirePermission="false"/>
    </sectionGroup>
     
    <modules>
        .........
        <add type="MyDll.Data.MyModule, MyDll.Data" />
    </modules>
     
    <metaFields>
        .........
        <add key="MyModule.Title" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue=""/>
        .........
    </metaFields>
     
    <providers>
        .........
        <add name="MyModule" urlRewriteFormat="[Publication_Date]/[Title].aspx" urlDateTimeFormat="yy-MM-dd" urlWhitespaceChar="_" visible="False" defaultMetaField="Title" securityProviderName="" allowVersioning="True" applicationName="/ExtendedNews" versioningProviderName="" commentsModeration="true" connectionStringName="GenericContentConnection" type="MyDll.Data.MyModule, MyDll.Data" allowWorkflow="true"/>
    </providers>
     
    <myModule defaultGenericProvider="myProvider">
          <genericContentProviders>
            <add providerName="myProvider" publicationDateField="Publication_Date" expirationDateField="Expiration_Date" thumbnailUrlField="Thumbnail" urlRewriteFormat="[Publication_Date]/[Title].aspx" urlDateTimeFormat="yy-MM-dd" urlWhitespaceChar="_"/>
        </genericContentProviders>
    </myModule>

    But I get an error in the SF log:

    06/07/2010 15:44:13 [EXCEPTION]
    ************************************************************************************
    ID: 6098ec04-2772-4c21-aabc-f7d95dca495f; Code: 100103; Occurrence: 2; Sequence: 9
    ------------------------------------------------------------------------------------

    Application information:
        Machine name: PC120
        OS Version: Microsoft Windows NT 6.1.7600.0
        Product Version: 3.7.2096.2
        Application Path: [removed]
        Debug: True

    Process information:
        Process ID: 5988
        Process Name: WebDev.WebServer20

    Request information:
        Request URL: /website/Sitefinity/Default.aspx
        Rewrite URL: http://localhost:53448/website/Sitefinity/Default.aspx
        Url Referrer:    Is Authenticated: False
        Authentication Type:    User:     User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C; .NET4.0E)
        User Address: 127.0.0.1

    Variables:

    - L0 -------------------------------------------------------------------------------

    Exception Type: System.ArgumentException

    Message: È già stato aggiunto un elemento con la stessa chiave.

    Source: mscorlib

    Stack Trace:
       in System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
       in System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
       in Telerik.Rss.RssProviderService.Initialize()
       in Telerik.Framework.ServiceHost.Initialize()
    ------------------------------------------------------------------------------------

    Thanks,
    Alessio
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    06 Jul 2010
    Link to this post
    Hi Alessio S.,

    You should implement IIndexingSupportModule, IRssProviderModule in your custom class


    #region IIndexingSupportModule Members
      
       
    IServiceClientInfo[] IIndexingSupportModule.GetSeviceClients()
        {
            return new IServiceClientInfo[]
                {
                    new IndexingServiceClientInfo("NewsCustomIndex"
                        , typeof(NewsIndexProvider)
                        , typeof(NewsIndexSettingsControl).FullName
                        , typeof(NewsIndexViewControl).FullName
                        , "NewsCustomIndexProvider"
                        )
                };
        }
      
          
        #endregion
      
        #region IRssProviderModule Members
      
        RssProviderInfo[] IRssProviderModule.GetRssProviders()
        {
            return new RssProviderInfo[] { new RssProviderInfo(MyModule.ModuleName + " Rss Provider",
                    typeof(Telerik.News.Rss.RssChannelProvider).FullName + ", " + typeof(Telerik.News.Rss.RssChannelProvider).Assembly.FullName,
                new Dictionary<string, string>(),
                typeof(RssSettingsControl).FullName + ", " + typeof(Telerik.News.Rss.RssChannelProvider).Assembly.FullName,
                typeof(RssViewControl).FullName + ", " + typeof(Telerik.News.Rss.RssChannelProvider).Assembly.FullName)
                };
        }
      
      
        #endregion
        internal const string ModuleName = "NewsModuleCustom";


    Sincerely yours,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered