コード例 #1
0
        /// <summary>
        /// Gets a list of the <see cref="Event"/>s for this module.  Does not take the <paramref name="listTag"/> or <paramref name="context"/> into account,
        /// effectively only supporting one data source.
        /// </summary>
        /// <remarks>
        /// The <paramref name="context"/> parameter should always be <c>null</c> unless the Engage:List tag is nested inside of another Engage:List.
        /// </remarks>
        /// <param name="listTag">The Engage:List <see cref="Tag"/> for which to return a data source</param>
        /// <param name="context">The current <see cref="Event"/> being processed, or <c>null</c> if no list is currently being processed</param>
        /// <returns>A list of the <see cref="Event"/>s over which the given <paramref name="listTag"/> should be processed</returns>
        private IEnumerable <ITemplateable> GetEvents(Tag listTag, ITemplateable context)
        {
            var dateRange = this.IsManageEvents
                                ? new DateRange(DateRangeBound.CreateUnboundedBound(), DateRangeBound.CreateUnboundedBound())
                                : ModuleSettings.GetDateRangeFor(this);

            var events = EventCollection.Load(
                this.PortalId,
                dateRange.GetStartDateUtc(),
                dateRange.GetEndDateUtc(),
                this.SortExpression,
                this.CurrentPageIndex - 1,
                this.RecordsPerPage,
                this.Status.Equals("All", StringComparison.OrdinalIgnoreCase),
                !this.IsManageEvents && this.IsFeatured,
                !this.IsManageEvents && this.HideFullEvents,
                IsLoggedIn ? this.UserInfo.Email : null,
                this.FilterCategoryIds ?? this.CategoryIds);

            this.TotalNumberOfEvents = events.TotalRecords;
            this.TemplateProvider.ItemPagingState = new ItemPagingState(this.CurrentPageIndex, events.TotalRecords, this.RecordsPerPage);

            return(((IEnumerable <Event>)events).Select(e =>
            {
                if (string.IsNullOrEmpty(e.Category.Name))
                {
                    e.Category.Name = this.Localize("DefaultCategory", this.LocalSharedResourceFile);
                }

                return (ITemplateable)e;
            }));
        }
コード例 #2
0
        /// <summary>Creates a <see cref="Panel" /> from a tag, setting its <see cref="Panel.CssClass" /> and supplying Text or inner controls, if it has any.</summary>
        /// <param name="tag">The tag whose content is being represented.</param>
        /// <param name="slide">The object from which to get the property.</param>
        /// <param name="resourceFile">The resource file from which to get localized resources.</param>
        /// <returns>The created container</returns>
        private Panel CreateRotatorContainer(Tag tag, ITemplateable slide, string resourceFile)
        {
            Panel container = null;

            try
            {
                container          = new Panel();
                container.CssClass = TemplateEngine.GetAttributeValue(tag, slide, null, resourceFile, "CssClass", "class");

                if (tag.HasChildTags)
                {
                    TemplateEngine.ProcessTags(container, tag.ChildTags, slide, null, resourceFile, this.ProcessTags, this.GetSlides);
                }
                else
                {
                    var innerText = TemplateEngine.GetAttributeValue(tag, slide, (ITemplateable)null, resourceFile, "Text");
                    if (!string.IsNullOrEmpty(innerText))
                    {
                        container.Controls.Add(new LiteralControl(innerText));
                    }
                }

                return(container);
            }
            catch
            {
                if (container != null)
                {
                    container.Dispose();
                }

                throw;
            }
        }
コード例 #3
0
        internal bool ProcessTag(Control container, Tag tag, ITemplateable templateItem, string resourceFile)
        {
            if (tag.TagType == TagType.Open && tag.LocalName.Equals("BACKHYPERLINK", StringComparison.OrdinalIgnoreCase))
            {
                TemplateEngine.AddControl(container, TemplateEngine.CreateLink(tag, templateItem, this.TemplateProvider.GlobalItem, resourceFile, Globals.NavigateURL()));
            }
            else
            {
                return this.ProcessCommonTag(container, tag, (Event)templateItem, resourceFile);
            }

            return true;
        }
コード例 #4
0
        internal bool ProcessTag(Control container, Tag tag, ITemplateable templateItem, string resourceFile)
        {
            if (tag.TagType == TagType.Open && tag.LocalName.Equals("BACKHYPERLINK", StringComparison.OrdinalIgnoreCase))
            {
                TemplateEngine.AddControl(container, TemplateEngine.CreateLink(tag, templateItem, this.TemplateProvider.GlobalItem, resourceFile, Globals.NavigateURL()));
            }
            else
            {
                return(this.ProcessCommonTag(container, tag, (Event)templateItem, resourceFile));
            }

            return(true);
        }
コード例 #5
0
        private bool ProcessTags(Control container, Tag tag, ITemplateable slide, string resourceFile)
        {
            if (tag.TagType != TagType.Open)
            {
                return(false);
            }

            switch (tag.LocalName.ToUpperInvariant())
            {
            case "ROTATEBACK":
                AddControl(container, this.CreateBackButton(tag, slide, resourceFile));
                break;

            case "ROTATENEXT":
                AddControl(container, this.CreateNextButton(tag, slide, resourceFile));
                break;

            case "ROTATEPAUSE":
                AddControl(container, this.CreatePauseButton(tag, slide, resourceFile));
                break;

            case "ROTATEPLAY":
                AddControl(container, this.CreatePlayButton(tag, slide, resourceFile));
                break;

            case "PAGER":
                AddControl(container, this.CreatePager(tag, slide, resourceFile));
                break;

            case "PAGERITEM":
                AddControl(container, this.CreatePagerItem(tag, slide, resourceFile));
                break;

            case "CURRENTINDEX":
                AddControl(container, CreateCurrentIndexControl(tag, slide, resourceFile));
                break;

            case "TOTALCOUNT":
                AddControl(container, CreateTotalCountControl(tag, slide, resourceFile));
                break;
            }

            return(false);
        }
コード例 #6
0
        /// <summary>Creates a <c>div</c> tag for the given <paramref name="tag" />.
        /// Then sets the tag to be the container for a pager item (which, when clicked, rotates to its associated slide).</summary>
        /// <param name="tag">The tag whose content is being represented.</param>
        /// <param name="slide">The object from which to get the property.</param>
        /// <param name="resourceFile">The resource file from which to get localized resources.</param>
        /// <returns>The created pager item</returns>
        private Control CreatePagerItem(Tag tag, ITemplateable slide, string resourceFile)
        {
            Panel pagerItemWrapper = null;

            try
            {
                pagerItemWrapper          = this.CreateRotatorContainer(tag, slide, resourceFile);
                pagerItemWrapper.CssClass = Utility.AddCssClass(pagerItemWrapper.CssClass, "pager-item-" + slide.GetValue("INDEX"));
                return(pagerItemWrapper);
            }
            catch
            {
                if (pagerItemWrapper != null)
                {
                    pagerItemWrapper.Dispose();
                }

                throw;
            }
        }
コード例 #7
0
        /// <summary>Creates a <c>div</c> tag for the given <paramref name="tag" />.
        /// Then sets the tag to pause rotation when clicked.</summary>
        /// <param name="tag">The tag whose content is being represented.</param>
        /// <param name="slide">The object from which to get the property.</param>
        /// <param name="resourceFile">The resource file from which to get localized resources.</param>
        /// <returns>The created pause button</returns>
        private Control CreatePauseButton(Tag tag, ITemplateable slide, string resourceFile)
        {
            Panel pauseButton = null;

            try
            {
                pauseButton          = this.CreateRotatorContainer(tag, slide, resourceFile);
                pauseButton.CssClass = Utility.AddCssClass(pauseButton.CssClass, "rotator-pause");
                return(pauseButton);
            }
            catch
            {
                if (pauseButton != null)
                {
                    pauseButton.Dispose();
                }

                throw;
            }
        }
コード例 #8
0
        /// <summary>Creates a <see cref="Label" /> whose content is the total number of <see cref="Slide" />s for this rotator.</summary>
        /// <param name="tag">The tag whose content is being represented.</param>
        /// <param name="slide">The object from which to get the property.</param>
        /// <param name="resourceFile">The resource file from which to get localized resources.</param>
        /// <returns>The <see cref="Label" /> instance that was created</returns>
        private static Control CreateTotalCountControl(Tag tag, ITemplateable slide, string resourceFile)
        {
            Label totalCountLabel = null;

            try
            {
                totalCountLabel          = new Label();
                totalCountLabel.CssClass = TemplateEngine.GetAttributeValue(tag, slide, null, resourceFile, "CssClass", "class");
                totalCountLabel.CssClass = Utility.AddCssClass(totalCountLabel.CssClass, "total-slide-count");
                return(totalCountLabel);
            }
            catch
            {
                if (totalCountLabel != null)
                {
                    totalCountLabel.Dispose();
                }

                throw;
            }
        }
コード例 #9
0
        /// <summary>Creates a <see cref="Label" /> whose content is the (1-based) index of the currently displayed <see cref="Slide" /></summary>
        /// <param name="tag">The tag whose content is being represented.</param>
        /// <param name="slide">The object from which to get the property.</param>
        /// <param name="resourceFile">The resource file from which to get localized resources.</param>
        /// <returns>The <see cref="Label" /> instance that was created</returns>
        private static Control CreateCurrentIndexControl(Tag tag, ITemplateable slide, string resourceFile)
        {
            Label currentSlideIndexWrapper = null;

            try
            {
                currentSlideIndexWrapper          = new Label();
                currentSlideIndexWrapper.CssClass = TemplateEngine.GetAttributeValue(tag, slide, null, resourceFile, "CssClass", "class");
                currentSlideIndexWrapper.CssClass = Utility.AddCssClass(currentSlideIndexWrapper.CssClass, "current-slide-index");
                currentSlideIndexWrapper.Text     = 1.ToString(CultureInfo.CurrentCulture);
                return(currentSlideIndexWrapper);
            }
            catch
            {
                if (currentSlideIndexWrapper != null)
                {
                    currentSlideIndexWrapper.Dispose();
                }

                throw;
            }
        }
コード例 #10
0
        /// <summary>Creates a <c>div</c> tag for the given <paramref name="tag" />.
        /// Then sets the tag to be the container for an auto-generated pager.</summary>
        /// <param name="tag">The tag whose content is being represented.</param>
        /// <param name="slide">The object from which to get the property.</param>
        /// <param name="resourceFile">The resource file from which to get localized resources.</param>
        /// <returns>The created pager container</returns>
        private Control CreatePager(Tag tag, ITemplateable slide, string resourceFile)
        {
            Panel pagerContainer = null;

            try
            {
                pagerContainer = this.CreateRotatorContainer(tag, slide, resourceFile);

                pagerContainer.CssClass      = Utility.AddCssClass(pagerContainer.CssClass, "rotator-pager");
                this.CycleOptions.PagerEvent = TemplateEngine.GetAttributeValue(tag, slide, (ITemplateable)null, resourceFile, "Event") ?? "click";

                return(pagerContainer);
            }
            catch
            {
                if (pagerContainer != null)
                {
                    pagerContainer.Dispose();
                }

                throw;
            }
        }
コード例 #11
0
        /// <summary>Creates a <see cref="Panel" /> from a tag, setting its <see cref="Panel.CssClass" /> and supplying Text or inner controls, if it has any.</summary>
        /// <param name="tag">The tag whose content is being represented.</param>
        /// <param name="slide">The object from which to get the property.</param>
        /// <param name="resourceFile">The resource file from which to get localized resources.</param>
        /// <returns>The created container</returns>
        private Panel CreateRotatorContainer(Tag tag, ITemplateable slide, string resourceFile)
        {
            Panel container = null;
            try
            {
                container = new Panel();
                container.CssClass = TemplateEngine.GetAttributeValue(tag, slide, null, resourceFile, "CssClass", "class");

                if (tag.HasChildTags)
                {
                    TemplateEngine.ProcessTags(container, tag.ChildTags, slide, null, resourceFile, this.ProcessTags, this.GetSlides);
                }
                else
                {
                    var innerText = TemplateEngine.GetAttributeValue(tag, slide, (ITemplateable)null, resourceFile, "Text");
                    if (!string.IsNullOrEmpty(innerText))
                    {
                        container.Controls.Add(new LiteralControl(innerText));
                    }
                }

                return container;
            }
            catch
            {
                if (container != null)
                {
                    container.Dispose();
                }

                throw;
            }
        }
コード例 #12
0
        /// <summary>
        /// Gets a list of the <see cref="Event"/>s for this module.  Does not take the <paramref name="listTag"/> or <paramref name="context"/> into account,
        /// effectively only supporting one data source.
        /// </summary>
        /// <remarks>
        /// The <paramref name="context"/> parameter should always be <c>null</c> unless the Engage:List tag is nested inside of another Engage:List.
        /// </remarks>
        /// <param name="listTag">The Engage:List <see cref="Tag"/> for which to return a data source</param>
        /// <param name="context">The current <see cref="Event"/> being processed, or <c>null</c> if no list is currently being processed</param>
        /// <returns>A list of the <see cref="Event"/>s over which the given <paramref name="listTag"/> should be processed</returns>
        private IEnumerable<ITemplateable> GetEvents(Tag listTag, ITemplateable context)
        {
            var dateRange = this.IsManageEvents
                                ? new DateRange(DateRangeBound.CreateUnboundedBound(), DateRangeBound.CreateUnboundedBound())
                                : ModuleSettings.GetDateRangeFor(this);

            var events = EventCollection.Load(
                    this.PortalId,
                    dateRange.GetStartDateUtc(),
                    dateRange.GetEndDateUtc(),
                    this.SortExpression,
                    this.CurrentPageIndex - 1,
                    this.RecordsPerPage,
                    this.Status.Equals("All", StringComparison.OrdinalIgnoreCase),
                    !this.IsManageEvents && this.IsFeatured,
                    !this.IsManageEvents && this.HideFullEvents,
                    IsLoggedIn ? this.UserInfo.Email : null,
                    this.FilterCategoryIds ?? this.CategoryIds);

            this.TotalNumberOfEvents = events.TotalRecords;
            this.TemplateProvider.ItemPagingState = new ItemPagingState(this.CurrentPageIndex, events.TotalRecords, this.RecordsPerPage);

            return ((IEnumerable<Event>)events).Select(e =>
                {
                    if (string.IsNullOrEmpty(e.Category.Name))
                    {
                        e.Category.Name = this.Localize("DefaultCategory", this.LocalSharedResourceFile);
                    }

                    return (ITemplateable)e;
                });
        }
コード例 #13
0
        /// <summary>Creates a <see cref="Label" /> whose content is the (1-based) index of the currently displayed <see cref="Slide" /></summary>
        /// <param name="tag">The tag whose content is being represented.</param>
        /// <param name="slide">The object from which to get the property.</param>
        /// <param name="resourceFile">The resource file from which to get localized resources.</param>
        /// <returns>The <see cref="Label" /> instance that was created</returns>
        private static Control CreateCurrentIndexControl(Tag tag, ITemplateable slide, string resourceFile)
        {
            Label currentSlideIndexWrapper = null;
            try
            {
                currentSlideIndexWrapper = new Label();
                currentSlideIndexWrapper.CssClass = TemplateEngine.GetAttributeValue(tag, slide, null, resourceFile, "CssClass", "class");
                currentSlideIndexWrapper.CssClass = Utility.AddCssClass(currentSlideIndexWrapper.CssClass, "current-slide-index");
                currentSlideIndexWrapper.Text = 1.ToString(CultureInfo.CurrentCulture);
                return currentSlideIndexWrapper;
            }
            catch
            {
                if (currentSlideIndexWrapper != null)
                {
                    currentSlideIndexWrapper.Dispose();
                }

                throw;
            }
        }
コード例 #14
0
        /// <summary>Creates a <c>div</c> tag for the given <paramref name="tag" />.
        /// Then sets the tag to resume rotation when clicked.</summary>
        /// <param name="tag">The tag whose content is being represented.</param>
        /// <param name="slide">The object from which to get the property.</param>
        /// <param name="resourceFile">The resource file from which to get localized resources.</param>
        /// <returns>The created play button</returns>
        private Control CreatePlayButton(Tag tag, ITemplateable slide, string resourceFile)
        {
            Panel playButton = null;
            try
            {
                playButton = this.CreateRotatorContainer(tag, slide, resourceFile);

                playButton.CssClass = Utility.AddCssClass(playButton.CssClass, "rotator-play");
                playButton.CssClass = Utility.AddCssClass(playButton.CssClass, "rotator-play-on");

                return playButton;
            }
            catch
            {
                if (playButton != null)
                {
                    playButton.Dispose();
                }

                throw;
            }
        }
コード例 #15
0
 /// <summary>Gets a list of the <see cref="Slide" />s for this module.</summary>
 /// <param name="listTag">The Engage:List <see cref="Tag" /> for which to return a data source</param>
 /// <param name="context">The current <see cref="ITemplateable" /> item being processed, or <c>null</c> if no list is currently being processed</param>
 /// <remarks>Does not take the <paramref name="listTag" /> or <paramref name="context" /> into account, effectively only supporting one data source.</remarks>
 /// <returns>A list of the <see cref="Slide" />s for this module.</returns>
 private IEnumerable <ITemplateable> GetSlides(Tag listTag, ITemplateable context)
 {
     return(this.Slides.ConvertAll(input => (ITemplateable)input));
 }
コード例 #16
0
        /// <summary>Creates a <c>div</c> tag for the given <paramref name="tag" />.
        /// Then sets the tag to be the container for a pager item (which, when clicked, rotates to its associated slide).</summary>
        /// <param name="tag">The tag whose content is being represented.</param>
        /// <param name="slide">The object from which to get the property.</param>
        /// <param name="resourceFile">The resource file from which to get localized resources.</param>
        /// <returns>The created pager item</returns>
        private Control CreatePagerItem(Tag tag, ITemplateable slide, string resourceFile)
        {
            Panel pagerItemWrapper = null;
            try
            {
                pagerItemWrapper = this.CreateRotatorContainer(tag, slide, resourceFile);
                pagerItemWrapper.CssClass = Utility.AddCssClass(pagerItemWrapper.CssClass, "pager-item-" + slide.GetValue("INDEX"));
                return pagerItemWrapper;
            }
            catch
            {
                if (pagerItemWrapper != null)
                {
                    pagerItemWrapper.Dispose();
                }

                throw;
            }
        }
コード例 #17
0
        /// <summary>Creates a <c>div</c> tag for the given <paramref name="tag" />.
        /// Then sets the tag to be the container for an auto-generated pager.</summary>
        /// <param name="tag">The tag whose content is being represented.</param>
        /// <param name="slide">The object from which to get the property.</param>
        /// <param name="resourceFile">The resource file from which to get localized resources.</param>
        /// <returns>The created pager container</returns>
        private Control CreatePager(Tag tag, ITemplateable slide, string resourceFile)
        {
            Panel pagerContainer = null;
            try
            {
                pagerContainer = this.CreateRotatorContainer(tag, slide, resourceFile);

                pagerContainer.CssClass = Utility.AddCssClass(pagerContainer.CssClass, "rotator-pager");
                this.CycleOptions.PagerEvent = TemplateEngine.GetAttributeValue(tag, slide, (ITemplateable)null, resourceFile, "Event") ?? "click";

                return pagerContainer;
            }
            catch
            {
                if (pagerContainer != null)
                {
                    pagerContainer.Dispose();
                }

                throw;
            }
        }
コード例 #18
0
        /// <summary>Creates a <c>div</c> tag for the given <paramref name="tag" />.
        /// Then sets the tag to cycle forward when clicked.</summary>
        /// <param name="tag">The tag whose content is being represented.</param>
        /// <param name="slide">The object from which to get the property.</param>
        /// <param name="resourceFile">The resource file from which to get localized resources.</param>
        /// <returns>The created next button</returns>
        private Control CreateNextButton(Tag tag, ITemplateable slide, string resourceFile)
        {
            Panel nextButton = null;
            try
            {
                nextButton = this.CreateRotatorContainer(tag, slide, resourceFile);

                nextButton.CssClass = Utility.AddCssClass(nextButton.CssClass, "rotator-next");

                return nextButton;
            }
            catch
            {
                if (nextButton != null)
                {
                    nextButton.Dispose();
                }

                throw;
            }
        }
コード例 #19
0
        /// <summary>Creates a <c>div</c> tag for the given <paramref name="tag" />.
        /// Then sets the tag to cycle back when clicked.</summary>
        /// <param name="tag">The tag whose content is being represented.</param>
        /// <param name="slide">The object from which to get the property.</param>
        /// <param name="resourceFile">The resource file from which to get localized resources.</param>
        /// <returns>The created back button</returns>
        private Control CreateBackButton(Tag tag, ITemplateable slide, string resourceFile)
        {
            Panel backButton = null;
            try
            {
                backButton = this.CreateRotatorContainer(tag, slide, resourceFile);

                backButton.CssClass = Utility.AddCssClass(backButton.CssClass, "rotator-prev");

                return backButton;
            }
            catch
            {
                if (backButton != null)
                {
                    backButton.Dispose();
                }

                throw;
            }
        }
コード例 #20
0
        /// <summary>Creates a <see cref="Label" /> whose content is the total number of <see cref="Slide" />s for this rotator.</summary>
        /// <param name="tag">The tag whose content is being represented.</param>
        /// <param name="slide">The object from which to get the property.</param>
        /// <param name="resourceFile">The resource file from which to get localized resources.</param>
        /// <returns>The <see cref="Label" /> instance that was created</returns>
        private static Control CreateTotalCountControl(Tag tag, ITemplateable slide, string resourceFile)
        {
            Label totalCountLabel = null;
            try
            {
                totalCountLabel = new Label();
                totalCountLabel.CssClass = TemplateEngine.GetAttributeValue(tag, slide, null, resourceFile, "CssClass", "class");
                totalCountLabel.CssClass = Utility.AddCssClass(totalCountLabel.CssClass, "total-slide-count");
                return totalCountLabel;
            }
            catch
            {
                if (totalCountLabel != null)
                {
                    totalCountLabel.Dispose();
                }

                throw;
            }
        }
コード例 #21
0
 /// <summary>Gets a list of the <see cref="Slide" />s for this module.</summary>
 /// <param name="listTag">The Engage:List <see cref="Tag" /> for which to return a data source</param>
 /// <param name="context">The current <see cref="ITemplateable" /> item being processed, or <c>null</c> if no list is currently being processed</param>
 /// <remarks>Does not take the <paramref name="listTag" /> or <paramref name="context" /> into account, effectively only supporting one data source.</remarks>
 /// <returns>A list of the <see cref="Slide" />s for this module.</returns>
 private IEnumerable<ITemplateable> GetSlides(Tag listTag, ITemplateable context)
 {
     return this.Slides.ConvertAll(input => (ITemplateable)input);
 }
コード例 #22
0
        private bool ProcessTags(Control container, Tag tag, ITemplateable slide, string resourceFile)
        {
            if (tag.TagType != TagType.Open)
            {
                return false;
            }

            switch (tag.LocalName.ToUpperInvariant())
            {
                case "ROTATEBACK":
                    AddControl(container, this.CreateBackButton(tag, slide, resourceFile));
                    break;
                case "ROTATENEXT":
                    AddControl(container, this.CreateNextButton(tag, slide, resourceFile));
                    break;
                case "ROTATEPAUSE":
                    AddControl(container, this.CreatePauseButton(tag, slide, resourceFile));
                    break;
                case "ROTATEPLAY":
                    AddControl(container, this.CreatePlayButton(tag, slide, resourceFile));
                    break;
                case "PAGER":
                    AddControl(container, this.CreatePager(tag, slide, resourceFile));
                    break;
                case "PAGERITEM":
                    AddControl(container, this.CreatePagerItem(tag, slide, resourceFile));
                    break;
                case "CURRENTINDEX":
                    AddControl(container, CreateCurrentIndexControl(tag, slide, resourceFile));
                    break;
                case "TOTALCOUNT":
                    AddControl(container, CreateTotalCountControl(tag, slide, resourceFile));
                    break;
            }

            return false;
        }
コード例 #23
0
        private bool ProcessTag(Control container, Tag tag, ITemplateable templateItem, string resourceFile)
        {
            var currentEvent = (Event)templateItem;
            if (tag.TagType == TagType.Open)
            {
                switch (tag.LocalName.ToUpperInvariant())
                {
                    case "EVENTSORT":
                        this.SortAction = (SortAction)this.LoadControl(this.ActionsControlsFolder + "SortAction.ascx");
                        this.SortAction.ModuleConfiguration = this.ModuleConfiguration;
                        this.SortAction.LocalResourceFile = resourceFile;
                        this.SortAction.SortChanged += this.SortActions_SortChanged;

                        container.Controls.Add(this.SortAction);
                        break;
                    case "STATUSFILTER":
                        this.StatusFilterAction = (StatusFilterAction)this.LoadControl(this.ActionsControlsFolder + "StatusFilterAction.ascx");
                        this.StatusFilterAction.ModuleConfiguration = this.ModuleConfiguration;
                        this.StatusFilterAction.LocalResourceFile = resourceFile;
                        this.StatusFilterAction.SortChanged += this.SortActions_SortChanged;

                        container.Controls.Add(this.StatusFilterAction);
                        break;
                    case "CATEGORYFILTER":
                        this.CategoryFilterAction = (CategoryFilterAction)this.LoadControl(this.ActionsControlsFolder + "CategoryFilterAction.ascx");
                        this.CategoryFilterAction.ModuleConfiguration = this.ModuleConfiguration;
                        this.CategoryFilterAction.LocalResourceFile = resourceFile;
                        this.CategoryFilterAction.CategoryChanged += this.CategoryFilter_SortChanged;

                        container.Controls.Add(this.CategoryFilterAction);
                        break;
                    case "MULTIPLECATEGORYFILTER":
                        this.MultipleCategoriesFilterAction = (MultipleCategoriesFilterAction)this.LoadControl(this.ActionsControlsFolder + "MultipleCategoriesFilterAction.ascx");
                        this.MultipleCategoriesFilterAction.ModuleConfiguration = this.ModuleConfiguration;
                        this.MultipleCategoriesFilterAction.LocalResourceFile = resourceFile;
                        this.MultipleCategoriesFilterAction.CategoryChanged += this.MultipleCategoriesActions_SortChanged;

                        this.MultipleCategoriesFilterAction.DialogPosition = TemplateEngine.GetAttributeValue(tag, templateItem, this.TemplateProvider.GlobalItem, resourceFile, "DialogPosition", "my");
                        this.MultipleCategoriesFilterAction.ButtonPosition = TemplateEngine.GetAttributeValue(tag, templateItem, this.TemplateProvider.GlobalItem, resourceFile, "ButtonPosition", "at");
                        this.MultipleCategoriesFilterAction.CollisionBehavior = TemplateEngine.GetAttributeValue(tag, templateItem, this.TemplateProvider.GlobalItem, resourceFile, "CollisionBehavior", "collision");

                        container.Controls.Add(MultipleCategoriesFilterAction);
                        break;
                    case "READMORE":
                        var linkUrl = currentEvent != null
                                          ? this.BuildLinkUrl(
                                              this.DetailsTabId,
                                              this.DetailsModuleId,
                                              "EventDetail",
                                              Dnn.Events.Utility.GetEventParameters(currentEvent))
                                          : Globals.NavigateURL(this.DetailsTabId);

                        TemplateEngine.AddControl(container, TemplateEngine.CreateLink(tag, templateItem, this.TemplateProvider.GlobalItem, resourceFile, linkUrl));
                        break;
                    default:
                        return this.ProcessCommonTag(container, tag, currentEvent, resourceFile);
                }
            }
            else if (tag.TagType == TagType.Close)
            {
                return this.ProcessCommonTag(container, tag, currentEvent, resourceFile);
            }

            return false;
        }
コード例 #24
0
        private bool ProcessTag(Control container, Tag tag, ITemplateable templateItem, string resourceFile)
        {
            var currentEvent = (Event)templateItem;

            if (tag.TagType == TagType.Open)
            {
                switch (tag.LocalName.ToUpperInvariant())
                {
                case "EVENTSORT":
                    this.SortAction = (SortAction)this.LoadControl(this.ActionsControlsFolder + "SortAction.ascx");
                    this.SortAction.ModuleConfiguration = this.ModuleConfiguration;
                    this.SortAction.LocalResourceFile   = resourceFile;
                    this.SortAction.SortChanged        += this.SortActions_SortChanged;

                    container.Controls.Add(this.SortAction);
                    break;

                case "STATUSFILTER":
                    this.StatusFilterAction = (StatusFilterAction)this.LoadControl(this.ActionsControlsFolder + "StatusFilterAction.ascx");
                    this.StatusFilterAction.ModuleConfiguration = this.ModuleConfiguration;
                    this.StatusFilterAction.LocalResourceFile   = resourceFile;
                    this.StatusFilterAction.SortChanged        += this.SortActions_SortChanged;

                    container.Controls.Add(this.StatusFilterAction);
                    break;

                case "CATEGORYFILTER":
                    this.CategoryFilterAction = (CategoryFilterAction)this.LoadControl(this.ActionsControlsFolder + "CategoryFilterAction.ascx");
                    this.CategoryFilterAction.ModuleConfiguration = this.ModuleConfiguration;
                    this.CategoryFilterAction.LocalResourceFile   = resourceFile;
                    this.CategoryFilterAction.CategoryChanged    += this.CategoryFilter_SortChanged;

                    container.Controls.Add(this.CategoryFilterAction);
                    break;

                case "MULTIPLECATEGORYFILTER":
                    this.MultipleCategoriesFilterAction = (MultipleCategoriesFilterAction)this.LoadControl(this.ActionsControlsFolder + "MultipleCategoriesFilterAction.ascx");
                    this.MultipleCategoriesFilterAction.ModuleConfiguration = this.ModuleConfiguration;
                    this.MultipleCategoriesFilterAction.LocalResourceFile   = resourceFile;
                    this.MultipleCategoriesFilterAction.CategoryChanged    += this.MultipleCategoriesActions_SortChanged;

                    this.MultipleCategoriesFilterAction.DialogPosition    = TemplateEngine.GetAttributeValue(tag, templateItem, this.TemplateProvider.GlobalItem, resourceFile, "DialogPosition", "my");
                    this.MultipleCategoriesFilterAction.ButtonPosition    = TemplateEngine.GetAttributeValue(tag, templateItem, this.TemplateProvider.GlobalItem, resourceFile, "ButtonPosition", "at");
                    this.MultipleCategoriesFilterAction.CollisionBehavior = TemplateEngine.GetAttributeValue(tag, templateItem, this.TemplateProvider.GlobalItem, resourceFile, "CollisionBehavior", "collision");

                    container.Controls.Add(MultipleCategoriesFilterAction);
                    break;

                case "READMORE":
                    var linkUrl = currentEvent != null
                                          ? this.BuildLinkUrl(
                        this.DetailsTabId,
                        this.DetailsModuleId,
                        "EventDetail",
                        Dnn.Events.Utility.GetEventParameters(currentEvent))
                                          : Globals.NavigateURL(this.DetailsTabId);

                    TemplateEngine.AddControl(container, TemplateEngine.CreateLink(tag, templateItem, this.TemplateProvider.GlobalItem, resourceFile, linkUrl));
                    break;

                default:
                    return(this.ProcessCommonTag(container, tag, currentEvent, resourceFile));
                }
            }
            else if (tag.TagType == TagType.Close)
            {
                return(this.ProcessCommonTag(container, tag, currentEvent, resourceFile));
            }

            return(false);
        }