More in this section
Forums / Sitefinity SDK / Content Sharing Across Multiple Sites

Content Sharing Across Multiple Sites

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
3 posts, 0 answered
  1. Mauro
    Mauro avatar
    4 posts
    10 Mar 2014
    03 Mar 2015
    Link to this post
    I have created a custom widget that will be used in sitefinity 7.0. It will be used in two sites. I need to know how do I let the user select which content provider to use for the widget? Also can I create a drop down list in the designer that will allow the user to select either the default provider of the Open Access Provider. Two sites one content management system.
  2. Atanas Valchev
    Atanas Valchev avatar
    414 posts
    04 Jan 2016
    06 Mar 2015
    Link to this post

    Would it be possible to share some more information regarding the type of content that this widget will display? Also, what will the widget do? Will the user just select the provider in the designer and then the widget should display the content?

    Atanas Valchev
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
  3. Mauro
    Mauro avatar
    4 posts
    10 Mar 2014
    06 Mar 2015 in reply to Atanas Valchev
    Link to this post

    The widget will display events in jquery fullcalendar. It will display the start, end time of event. Title, description, and url of events. Yes, the user will select the provider from a drop down list in the designer and the calendar will display the events or content.

    Here is what I have so far.
    namespace SitefinityWebApp.Custom.CalendarEvents.Model
        public class CalendarEvent
            public Guid id { get; set; }
            public string title { get; set; }
            public DateTime? start { get; set; }
            public DateTime? end { get; set; }
            public string url { get; set; }
            public string summary { get; set; }
            public bool sac { get; set; } //sac = ShowAndCancel

            public static IEnumerable<CalendarEvent> LoadAllEvents( DateTime start, DateTime end, string tagValue, string categoryValue, string categoryName, string tagName)
                var selectedCategories = StringToArray(categoryValue);
                var selectedTags = StringToArray(tagValue);
                //var Category = StringToArray(categoryName);
                //var Tags = StringToArray(tagName);
                var providerNames = SystemManager.CurrentContext.CurrentSite.SiteDataSourceLinks.Where(o => o.DataSourceName == typeof(EventsManager).FullName).Select(o => 0.ProviderName);

                var taxonomyManager = TaxonomyManager.GetManager();
                var taxon = taxonomyManager.GetTaxa<FlatTaxon>().Where(t => t.Name == "calendar-event").Single();

                var manager = EventsManager.GetManager();
                var ev = manager.GetEvents()
                    .Where(t => t.GetValue<TrackedList<Guid>>("Category").Any(j => selectedCategories.Contains(j))
                                    && t.GetValue<TrackedList<Guid>>("Tags").Any(j => selectedTags.Contains(j))
                                    && t.GetValue<TrackedList<Guid>>("Tags").Any(j => j == taxon.Id)
                                    && t.GetValue<TrackedList<Guid>>("Tags").Count > 0
                                    && t.Visible
                                    && t.Status == ContentLifecycleStatus.Live
                                    && t.EventStart >= start
                                    && t.EventStart <= end);

                var events = manager.GetEventsOccurrences(ev, start, end)
                    .ToList().Select(e => new CalendarEvent
                        id = e.Event.Id,
                        start = e.StartDate.ToLocalTime(),
                        end = ((DateTime)e.EndDate).ToLocalTime(),
                        title = e.Title,
                        url = e.Event.ItemDefaultUrl + "?StartDate=" + System.Web.HttpUtility.UrlEncode(string.Format("{0:ddd, MMM d, yyyy, h:mm tt}", e.StartDate.ToLocalTime())) + "&EndDate=" + System.Web.HttpUtility.UrlEncode(string.Format("{0:ddd, MMM d, yyyy, h:mm tt}", ((DateTime)e.EndDate).ToLocalTime())),
                        summary = String.IsNullOrEmpty(e.Event.Summary) ? String.IsNullOrEmpty(e.Event.Content) ? "This event does not have a description." : RemoveHTML(e.Event.Content.ToString()).Length > 200 ? RemoveHTML(e.Event.Content.ToString()).Substring(0, 200) : RemoveHTML(e.Event.Content.ToString()) : e.Event.Summary.ToString(),
                        sac = e.Event.GetValue<bool>("CancelEvent")
                return events;
            public static string RemoveHTML(string strHTML)
                return Regex.Replace(strHTML, "<(.|\n)*?>", "") + "...";

            private static DateTime ConvertFromUnixTimestamp(double timestamp)
                var origin = new DateTime(1970, 1, 1, 0, 0, 0, 0);
                return origin.AddSeconds(timestamp);

            /// The tag value as a comma delimited string.       
            private static Guid[] StringToArray(string data)
                var list = new List<Guid>();
                if (data != null)
                    var guids = data.Split(',');
                    foreach (var guid in guids)
                        Guid newGuid;
                        if (Guid.TryParse(guid, out newGuid))
               return list.ToArray();         


3 posts, 0 answered