Listing SDK - ASP.NET jMedia Kit

ASP.NET jMedia Kit support advance Listing SDK that can help you design content listing on hundreds of ways within minutes without making manual effort to create listings.

Features

Listing SDK can help you customize the way contents loaded within your application. It can help you generate listings in hundreds of ways depends on core entity of contents.

It is supported with almost every type of contents available including Videos, Photos, Blogs, Forums, Q&A, Polls, Classified Listings and more.

You can extend Listing SDK with any custom contents you are willing to ad in your solution.

Use Cases

Listing can help you customize the way contents loaded on different pages. It can help you do customization without doing manual codes. List of possibilities include

e.g Listing SDK for videos may have the following capabilities.

  • Recently Added Videos
  • Most Viewed Videos
  • Featured Videos
  • Most Viewed Videos Today
  • This Week Added Videos
  • Entertainment Videos
  • Videos added in March 2018
  • {tag} Videos
  • Related Videos based on {title} or {tags} or {search term}
  • Load Videos via Search Term
  • hundreds of more ways

There are two core listing modules that can use Listing SDK to render lists

  • Short Listing: That can be used for generating limited content listing on any specific page. e.g Load Top 10 Featured Videos on Home Page.
  • Main Listing This can be full page listing with pagination and other actions.

Example Code

Some basic usage example for generating both short and main listings via Listing SDK.

Sort Listing Example

e.g You want to load Top 10 Featured Videos

   // path of partial module, it can be any customize module path or built-in module available with ASP.NET jMedia Kit
   var VideoViewPath = Config.ThemePath + "videos/partials/_List_SM_01.cshtml";
   @Html.Partial(VideoViewPath, new Jugnoon.models.VideoListViewModel()
   {
       BrowseText = "Browse All",
       BrowseUrl = "/videos/featured",
       HeadingTitle = "Featured Videos",
       ListObject = new Jugnoon.Scripts.ListItems() // this handles each item layout control,
       {
           TitleLength = 25,
           showRating = false
       },
       QueryOptions = new VideoEntity()
       {
           iscache = true, // enable cache
           order = "date_added desc",
           isfeatured = 1, // 0: normal, 1: featured, 2: paid, 3: all
           ispublic = true, // only public videos
           pagesize = 6,
           type = 0 // 0: videos, 1: audio
       }
   })

You can initiate VideoListViewModel within controller and pass it to view also but it makes architecture little bit difficult if single page have more than one module to load contents.

You can copy paste this module on any page with simple attributes customization to generate different level of listings with contents.

Some content attributes depend on content entity e.g VideoEntity as it may have its own attributes like isYOutubeVideo, Duration etc.

Beside content specific attributes there are some attributes that are shared with all listings as VideoListViewModel extends from ListViewModel

Some important attributes of ListViewModel includes

  • HeadingTitle: Configure heading title for listing.
  • isListStatus: Display list status on main listing e.g showing 1 to 10 records of 3400 records
  • isListNav: Display navigation or tabs if available with listing.
  • PageTitle: Set page title on main listing.
  • PageDescription: Set page description on main listing.
  • NoRecordFoundText: Set message to display if not records found.
  • ListMode: Optionally used if your listing support multiple listing layouts e.g Grid Style, List Style etc
  • DefaultUrl: Set default pagination url, used in main listing.
  • PaginationUrl: Set pagination urls, used in main listing
  • BrowseText: Set browse url text.
  • BrowseUrl: Set browse url
  • ListObject: Handle each item layout settings e.g show title, show rating, show thumbnail only, show user etc.
  • and more

ListObject is datatype of ListItems that can help you pass parameters to control output of each item. It is important as within application in some areas you only need to display videos thumbnail and in some cases you need to display title and rating, in some cases you need to display thumbnail on right and content on left.

ListObject settings will help you make a single listing component to handle every type of layouts.

You can customize ListObject attributes by adding your own. List of main attributes include

  • showTitle: Toggle on / off title
  • showDuration: Toggle on / off duraction
  • showDate: Toggle on / off date
  • showUser: Toggle on / off user
  • showRating: Toggle on / off ratings
  • showDescription: Toggle on / off description
  • showViews: Toggle on / off views
  • showDownloads: Toggle on / off downloads
  • TitleLength: set maximum length of title to display, 0 for unlimited
  • and more

Query Entity

In video listing example, VideoEntity entity used main QueryOptions attribute that is responsible for querying database with set parameters.

Some query parameters are specific to content type e.g videos may have different attributes than blog entity.

All query entities extended from main ContentEntity that have set of features available in all query options.

ContentEntity main attribute includes

  • Order: Used to pass list of fields for OrderBy clause
  • Month: Used to pass month number to filter contents based on month.
  • Year: Used to filter cotents based on year.
  • filter: Filter records by views (0: All, 1: today, 2: this week, 3: this month). Having limited support with some contents.
  • datefilter: Filter records by added date (0: All, 1: today, 2: this week, 3: this month
  • searchtype: Use to set search to target broad search, tag search, category search, both tag or category search.
  • iscache: Use to toggle on / off cache for selected items.
  • loadlikedUsed for special cases, query to load only liked contents but it need username parameter too to load liked contents of specific user.
  • loadfavorited: Used to load favorited contents of specific user.
  • pagenumber: Used to load content of specific page.
  • pagesize: Used to load specific number of content for specific page.
  • term: Used to load content with specific term. Used for searches
  • loadall: Used to load all contents without pagination. Useful for loading content for dropdowns
  • ispublic: Used to restrict loading public contents only.
  • and more.

Main Listing

Main listing also have same architecture and using same Listing SDK, but having more attributes and different implementation structure.

As only one main listing available by default on each page, it is better to initialize main listing model on Controller level and pass model to view for further rendering of list.

e.g You can use the following code to load and configure settings for complete main listing at controller level.

  var ListEntity = new VideoListViewModel()
  {
    isListStatus = true, // enable list stats showing
    isListNav = true, // enable navigation
    QueryOptions = new VideoEntity() // setup query option
    {
          type = MediaType,
          pagenumber = (int)pagenumber,
          term = "",
          iscache = true,
          isenabled = 1,
          isreviewed = 1,
          isfeatured = 3, // all
          pagesize = 20,
          order = "created_at desc",
    },
    ListObject = new Jugnoon.Scripts.ListItems()
    {
          ColWidth = "col-md-4 col-masonry mb20",
          ListType = 0, // 0: grid 1: list
          ItemType = 1, // 0: div, 1: a
          showRating = true,
          showViews = true,
          showDate = true
    },
      DefaultUrl = "/videos",
      PaginationUrl = "/videos/[p],
      NoRecordFoundText = "No Videos Found!",
      HeadingTitle = "Recent Videos"
    };
    // better to load videos in controller level or can use this code at view level
    ListEntity.TotalRecords = VideoBLL.Count(ListEntity.QueryOptions);
    if(ListEntity.TotalRecords > 0)
    {
       ListEntity.DataList = VideoBLL.LoadItems(ListEntity.QueryOptions);
    }

Articles