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

Forums / Developing with Sitefinity / How to create custom lists?

How to create custom lists?

13 posts, 0 answered
  1. Gary
    Gary avatar
    91 posts
    Registered:
    19 Jul 2007
    29 May 2008
    Link to this post
    I currently need to convert a site I originally created in Umbraco to Sitefinity. I had created several document types in Umbraco to maintain various types of business data, and maintained lists of items based on each document type, which were rendered within a page using XSLT macros. It was very easy for the end-user to maintain.

    In Sitefinity I first looked at using the list module, but, unlike generic content, news, and blog modules, there doesn't seem to be a supported way to define a new list with custom fields.

    On another project I maintained the data in SharePoint and published it to XML files, which were then read and rendered by user controls added to Sitefinity, but for this project SharePoint is not a preferred approach.

    An alternative would be to build a pluggable module from scratch, but it seems like this will be a lot of work (although ultimately quite useful for future projects as well).

    I am not sure what the best approach would be to implement comparable functionality for maintaining custom lists in Sitefinity. Does anyone have any suggestions?

    Thanks,
    Gary
  2. Gary
    Gary avatar
    91 posts
    Registered:
    19 Jul 2007
    30 May 2008
    Link to this post
    I've seen a few references to the new ContentView class, which appears to potentially be a good starting point for implementing custom lists. However, I cannot find any documentation on it, with the exception of the following link:

    http://www.sitefinity.com/help/DevelopersManual/Content_View_Class.html

    Does anyone have any details of this class (for example, what is its purpose?), or even experience inheriting from it to create a custom module?

    Thanks,
    Gary
  3. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    30 May 2008
    Link to this post
    Hi Gary Clarke,

    Thank you for using Sitefinity.

    Actually, you could not create a module by inheriting a public control (Content View is only a control). What we would suggest you to do is create a new pluggable module, but not from scratch! Please look at the following blog post that provides information on  how to inherit a generic content based control: Sample Events Module: Building a Pluggable Module Based on Generic Content Module  . You could then add new meta fields or extend the Content View control that will already be available for you.

    We are currently preparing examples such as the ones you are asking for. The Developer Manual is undergoing a major update and will be released in the following months. Still, here is some of the information that is ready for the Content View public control:


    What is Content View?
    The Content View control lists content items.

    Currently, there are two Sitefinity controls that only partially provide such functionality: the built-in modules Generic Content and Lists. The Generic Content module displays a single content item but it allows for various customizations. At the same time,  the Lists module lists several content items. However, it is not expandable and thus provides no possibility for usability improvements. The Content View control combines the most useful features of both modules. This makes it extendable, easy-to-use. It is built to work out-of-the-box and with some slight modifications to serve your purpose in many possible cases.


    Setting up Content View Properties
    The Content View control displays all items added to the Generic Content module in the form of a list. Modify its properties to achieve different behavior of the control. Following is a description of some of the properties of Content View, ordered by sections:

    Section Behavior

    Display Mode

    This is the most important property of the Content View control. Following are its possible values and their description:

            • Auto mode
    This mode is set by default. When this mode is selected, the control displays a list of content items. Each item could have a link to a mode where the page displays only that item. All this is handled by the control. The following applications could make use of this mode: blogs; news; galleries with thumbnails and full-sized images; job listings; real estate properties for sale.

            • Item List mode
    When this mode is selected, the control displays only a list of content items. This mode does not provide the ability to view the specific item in the page. Here are some examples where this mode would be useful: list of files for download; short news page; page with short advertisements; gallery of full-sized images.

            • Single Item mode
    When this mode is selected, the control displays only one content item on the page. To make it work, you will additionally need to add the tag by setting the SelectedItemId property.

            • Tags mode
    When this mode is selected, the control displays a list of content items tagged by a specific tag. Also, a single item could be viewed separately. To make this mode work, add the tag by setting the TagID property. Here is an example where this mode would be useful: when there is a bigger content base, and only part of it should be displayed. The solution is to tag some of the items with a specific tag and use this mode.

            • Categories mode
    Works exactly like Tags mode, except that the CategoryID property should be set. Categories are applicable for most of the cases for tags. Still, there is an important difference: the usage of categories is similar to that of folders - an item could belong only to category.

    AllowLinksToPrevNextItem
    This property enables links to the previous and next items from the list when viewing items separately.

    ItemListUrl and SingleItemUrl
    These properties allow displaying the List and Details views on two different pages. This is how to do it:
    1. Let’s say there is a page called Page1.aspx, and a Content View control is dropped on it. We want to make this page handle the display of the list of content items. We need to set the SingleItemUrl property to point to the URL of the page (Page2.aspx) where another Content View control will handle the display of the full content of only one content item.
    2. Page2.aspx needs to have the Content View control dropped on it and it will display the full content of only one content item. We need to set the ItemListUrl  to point to the page with the list of content items (Page1.aspx) so that the user can navigate back to it if needed.

    SortExpression
    This property provides the ability to sort the list of content items in a custom manner. It is set by default to “Publication_Date DESC” which sorts content items by their publication date in descending order (from old publication dates to new ones).

    SummarySettings
    This property provides the functionality to set the format of display of a content item summary. There are two options to make the settings: to provide several variables that define the summary, or to provide a meta field.

              Summary Variables
    For this option, the property includes four variables: type of unit (words/sentences/paragraphs); unit number (an integer); boolean of whether the html tags should be cleared (false if clearing should not occur); exceptions for the previous variable ("{x}" where x is the tag that should be excluded from the previous setting). For example, let's assume the following is saved in the SummarySettings property: "Words; 20; False; {img}". This means that there should be 20 Words (Words; 20), that html tags should not be cleared (False) except for the image ones ({img}). 
    Meta Fields
    If this summary option is chosen, only a meta field should be provided for this property. It should be placed in square brackets. For example, the following could be the input in this property field: [Summary] .

    ParentIDs
    There are cases in which the content resides in an abstract container, such as blog posts in blogs, images in galleries, and so on. This property allows for setting delimited IDs of these containers so that the control displays content items only from them.

    DateFrom
    Currently Not Implemented! This property will provide the ability to add a starting date which will filter out all older content items.

    AllowComments
    This property provides the ability to control whether comments can be added to content items. This is a functionality that is applicable for blog comments, comments about a picture in a gallery, and many other cases.

    AllowCommentsModeration
    This property provides the ability to add comments moderation to a content item. Keep in mind that only the public is provided - the administrative UI needs to be created.

    Various *Key properties (TagItemKey, ContentProviderKey, CategoryKey , ContentItemKey, PageKey)
    These properties are used as QueryString key names. All of them have default values. When using custom controls that derive from Content View, these properties should have values different from the default ones (those of the Content View control) so that the custom controls and Content View control can work on the same page. Also, when two instances of one and the same control deriving from Content View are added to a page, these properties should be set from the Control Designer for the very same reason.

     
    Section Data

    ProviderName

    When a custom control derives from Content View, the default value should be kept so that the control will be used without the need to set this property later. In order to set the custom control to work with a provider different from the default one, this property should be set to the provider’s name.


    Section Page Title

    PageTitleMode
    There are three modes for setting the page title: Append, DoNotSet, Replace.
            • Append
    When this mode is selected, the title of the current item will be appended to the page title.
            • DoNotSet
    When this mode is selected, there will be no change to the page title.
            • Replace
    When this mode is selected,  the page title will be replaced by the title of the current item.

    PageTitleMetaFields
    This property lists the meta fields which will be included in the page title. For example, they could be the following: Title, Theme, Author .

    PageTitleFormatString
    This property sets the string format of the page title by defining which meta fields will be included in the title, and in what order. The meta fields are the ones set in the PageTitleMetaFields property. The order depends on the one in which the meta fields have been inputted. The format is the following: "> {x}"  where {x} is replaced by the meta field placed on position x. For example, let's assume that the following meta fields are saved in the  PageTitleMetaFields property: Title, Theme, Author. If " > {0},{2}"  is saved in the PageTitleFormatString property, the meta fields will be the following: Title, Author .


    Section Paging

    AllowPaging
    This property provides the ability to allow users to page through the items. By default, it is set to true.

    ItemsPerPage
    This property provides the ability to set how the number of content items should be displayed on a page when paging is allowed. By default, it is set to 10.



    Hope this helps for now.


    Greetings,
    Sonya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  4. Gary
    Gary avatar
    91 posts
    Registered:
    19 Jul 2007
    05 Jun 2008
    Link to this post
    First, thank you very much for your detailed information about the Content View control.

    I reviewed the Sample Events module, but was unable to get it to compile due to naming conflicts with the Events module that is now integrated with Sitefinity.

    I did, however, also find the Sample Contacts module, which only required minor code changes to successfully compile (due to the upgraded RadControls), and this has proven invaluable. Many thanks to Ivan for his hard work putting these samples together.

    Continuing with the subject of this post, I would like to leverage the custom fields capability (described in Customizing Modules - Adding Custom Fields) programmatically (rather than by configuration). Can you provide some documentation on how this may be accomplished?

    I had read elsewhere that you are in the process of revamping Sitefinity documentation. One suggestion I would like to make is that more attention is given to the API Reference of the Developer Manual. It would be nice if classes had an overview (a small percentage do have a one line description, but it is not detailed enough to be helpful), if methods and properties contained a description, and if usage examples were included.

    Thank you,
    Gary
  5. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    06 Jun 2008
    Link to this post
    Hello Gary,

    Thank you for your feedback. All will be taken into account when creating the new version of the Developer Manual. We are specifically aware of the fact that the API reference needs to be thoroughly described and improved. Unfortunately, we would not be able to provide this in the first version of the manual. What we will do instead is describe all manager classes for the different Sitefinity parts. However, API reference will definitely be our first priority for the second edition of the manual which will be available in the following months after the first one.

    You ask about "Adding Custom Fields". Please let me know which exact topic you are talking about since there is no such topic in the Customizing Modules section. There is one topic that you are probably referring to: Add Custom Meta Fields (Modules -> Built-in Modules -> Generic Content Based Modules -> How-to). If this is the one you are talking about, there is no way of adding meta fields programmatically.
    As to the two sample modules you have implemented, we intend to release their updated versions next week.

    Let us know if you have further questions.

     
    Sincerely yours,
    Sonya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Gary
    Gary avatar
    91 posts
    Registered:
    19 Jul 2007
    06 Jun 2008
    Link to this post
    Details of the manager classes is an excellent start, and it is good to know that more API documentation details will be coming.

    Yes, I was referring to the custom meta fields, although in my UserManual_3_2.pdf document on page 204 they are referred to as "Adding Custom Fields". Perhaps this has changed in the latest service pack, which I will upgrade to right away.

    If there is no way of adding a custom meta field programmatically (except I guess by modifying web.config through code), then may I ask if there is a way for a custom module to incorporate this functionality? Perhaps it is in one the samples and I have just not found it yet.

    It's great news to hear that the updated samples will be available next week. Thanks!

    Regards,
    Gary
  7. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    09 Jun 2008
    Link to this post
    Hi Gary,

    My apologies, I was actually referring to topics in the Developer Manual.

    As to your question about custom modules, currently there is no easy way to do this and we will further investigate  the possibilities and usabilities of such a feature. What you could do for now is write us a description of the overall functionality you want to achieve so that we could suggest other possible solutions if there are such.

    Sorry for not being able to help.

    Greetings,
    Sonya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  8. Gary
    Gary avatar
    91 posts
    Registered:
    19 Jul 2007
    09 Jun 2008
    Link to this post
    Sonya,

    As you have suggested, here is a summary of the overall functionality I am trying to achieve:

    I want to give Sitefinity end-users the ability to maintain structured content, and I would like to do this in a re-usable way since I expect to use this functionality pervasively.

    For example, I have a page that display information about product manufacturers.

    My end-users are not sophisticated enough to understand the markup and styles needed to maintain this content in a consistent way for each manufacturer. Therefore, I need to separate the information from the presentation. I would define a list with the following attributes:

    • Manufacturer name
    • Manufacturer logo (image)
    • Manufacturer website URL
    • Manufacturer description

    Then I would create a control to render this data on a manufacturers page to display this information. I can make this arbitrarily complex since the end-user does not have to understand or work with any of the markup that comprises this page.

    To accomplish this I need to be able to define a list in Sitefinity with custom attributes. The current lists functionality in Sitefinity does not support this. It only allows two pre-defined attributes to be used -- headline and content.

    There is more I would like to do with this, but the example above is hopefully a good starting point to explain the concept.


    Regards,
    Gary
  9. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    13 Jun 2008
    Link to this post
    Hi Gary,

    Since the Lists module is not yet extended to provide the possibility of adding custom fields, there are only two possible way of achieving what you have described. One is by creating a module based on Generic Content and using the Content View control (see the description provided in one of my previous posts). Another way is to define a template in RadEditor that will set the structure of the content to be displayed.

    Hope this helps.

    Greetings,
    Sonya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  10. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    10 Nov 2008
    Link to this post
    are lists still unable to be extended with custom fields? is this a permanent situation or will this module eventually inherit from Generic Content?

    I'd love to be able to use Lists to create a "Links" page, with a Title, Url, Description and Category... I know I could use the GC module but the Lists module is so much more compact and simple.
  11. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    10 Nov 2008
    Link to this post
    Hi SelArom,

    Unfortunately yes - they are still limited regarding to additional metafields. We have plans for making this module Generic Content based (as well as Forums) indeed.

    Greetings,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  12. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    10 Nov 2008
    Link to this post
    sounds good, I can wait :) is this planned for 4.0?
  13. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    11 Nov 2008
    Link to this post
    Hi SelArom,

    The Forums module is scheduled to be reworked in order to be generic content based for Sitefinity 4.0 indeed. We are still not sure will we made the same for the List module in 4.0, but you will be able to Generic Content with some of its new features for a task like this. Yes, Generic Content will also be changed and it will become more flexible.

    Regards,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
13 posts, 0 answered