Exemplo n.º 1
0
        /// <summary>
        /// Generates the list channel items.
        /// </summary>
        /// <param name="rssChannel">The RSS channel.</param>
        /// <returns></returns>
        private string GenerateListChannelItems(RssChannel rssChannel)
        {
            DateTime lastBuildDate = DateTime.MinValue;

            MetaClass listMetaClass = DataContext.Current.GetMetaClass(this.Parameters.ClassName);

            foreach(EntityObject item in BusinessManager.List(this.Parameters.ClassName,
                this.CurrentProfile.Filters.ToArray(),
                this.CurrentProfile.Sorting.ToArray()))
            {
                RssItem rssItem = new RssItem();
                rssItem.Guid = new RssGuid();

                rssItem.Title = string.IsNullOrEmpty(listMetaClass.TitleFieldName) ?
                    ("#" + item.PrimaryKeyId.Value.ToString()) :
                    (string)item[listMetaClass.TitleFieldName];

                rssItem.Link = MakeFullLink(this.Page.ResolveUrl(string.Format(CultureInfo.CurrentUICulture, "~/Apps/MetaUIEntity/Pages/EntityList.aspx?ClassName={0}", listMetaClass.Name)));
                rssItem.Guid.IsPermaLink = "false";
                rssItem.Guid.Text = item.PrimaryKeyId.Value.ToString();

                rssItem.Description = RenderListEntityObjectDescription(listMetaClass, item);

                DateTime modified = (DateTime)item["Modified"];

                if (modified > lastBuildDate)
                    lastBuildDate = modified;

                rssItem.PubDate = RssXmlHelper.ToRfc822(modified);
                UserLight author = UserLight.Load((int)item["ModifierId"]);
                if(author!=null)
                    rssItem.Author = string.Format("{0} <{1}>", author.DisplayName, author.Email);

                rssChannel.Items.Add(rssItem);
            }

            if (lastBuildDate == DateTime.MinValue)
                lastBuildDate = DateTime.Now;

            return RssXmlHelper.ToRfc822(lastBuildDate);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Generates the channel items.
        /// </summary>
        /// <param name="rssChannel">The RSS channel.</param>
        /// <returns></returns>
        private string GenerateChannelItems(RssChannel rssChannel)
        {
            if (this.Parameters.ClassName.StartsWith("List_"))
            {
                return GenerateListChannelItems(rssChannel);
            }

            return RssXmlHelper.ToRfc822(DateTime.Now);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Generates the list channel information.
        /// </summary>
        /// <param name="channel">The channel.</param>
        private void GenerateListChannelInformation(RssChannel channel)
        {
            MetaClass listMetaClass = DataContext.Current.GetMetaClass(this.Parameters.ClassName);

            string strViewName = string.Empty;
            if (this.CurrentProfile != null)
                strViewName = Common.GetWebResourceString(this.CurrentProfile.Name, CultureInfo.CurrentUICulture);

            channel.Title = string.Format(CultureInfo.CurrentUICulture, RssResource.RssChannel_List_Title_Format, listMetaClass.FriendlyName, strViewName, Configuration.Domain);
            channel.Description = string.Format(CultureInfo.CurrentUICulture, RssResource.RssChannel_List_Description_Format, listMetaClass.FriendlyName, strViewName, Configuration.Domain);
            channel.Link = MakeFullLink(this.Page.ResolveUrl(string.Format(CultureInfo.CurrentUICulture, "~/Apps/MetaUIEntity/Pages/EntityList.aspx?ClassName={0}", listMetaClass.Name)));

            channel.Image.Url = MakeFullLink(this.Page.ResolveUrl("~/layouts/images/lists.gif"));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Generates the channel information.
        /// </summary>
        /// <param name="channel">The channel.</param>
        private void GenerateChannelInformation(RssChannel channel)
        {
            if(this.Parameters.ClassName.StartsWith("List_"))
            {
                string strListId = this.Parameters.ClassName.Replace("List_", string.Empty);
                int listId = int.Parse(strListId);

                if (!ListInfoBus.CanRead(listId))
                    throw new Mediachase.Ibn.AccessDeniedException();

                GenerateListChannelInformation(channel);
            }
        }