Exemplo n.º 1
0
    /// <summary>
    /// Load transformations with dependence on current datasource type and datasource type.
    /// </summary>
    protected void LoadTransformations()
    {
        CMSBaseDataSource dataSource = DataSourceControl;

        if ((dataSource != null) && !String.IsNullOrEmpty(TransformationName))
        {
            BasicBingMaps.ItemTemplate = CMSAbstractDataProperties.LoadTransformation(this, TransformationName);
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        // Handle stop processing
        if (!StopProcessing)
        {
            // If displaying something
            if ((DisplayGlobalCategories) || (DisplayCustomCategories) || (DisplaySiteCategories))
            {
                // Get data set
                data = GetDataSet();

                if (RenderAsTree)
                {
                    CreateCategoryTrees(data);
                    StringBuilder sb = new StringBuilder();

                    // Render trees
                    sb.Append("<ul style=\"margin:0;\" class=\"CategoryListList\">");
                    RenderTree(sb, generalRoot);
                    RenderTree(sb, personalRoot);
                    sb.Append("</ul>");

                    ltlList.Text = sb.ToString();

                    rptCategoryList.Visible = false;
                }
                else
                {
                    rptCategoryList.DataSource = data;

                    if (String.IsNullOrEmpty(TransformationName))
                    {
                        rptCategoryList.ItemTemplate = CMSAbstractDataProperties.LoadTransformation(this, "[]");
                    }
                    else
                    {
                        rptCategoryList.ItemTemplate = CMSAbstractDataProperties.LoadTransformation(this, TransformationName);
                    }
                    rptCategoryList.HideControlForZeroRows = HideControlForZeroRows;
                    rptCategoryList.ZeroRowsText           = ZeroRowsText;
                    rptCategoryList.DataBindByDefault      = false;
                    rptCategoryList.DataBind();

                    ltlList.Visible = false;
                }
            }
            // Else show zero rows text
            else
            {
                lblInfo.Text    = ZeroRowsText;
                lblInfo.Visible = true;
            }
        }
    }
    /// <summary>
    /// Load transformations with dependence on datasource type and datasource state.
    /// </summary>
    protected void LoadTransformations()
    {
        CMSBaseDataSource docDataSource = DataSourceControl;

        if ((docDataSource != null) && (docDataSource.IsSelected) && (!String.IsNullOrEmpty(SelectedItemTransformationName)))
        {
            BasicRepeater.ItemTemplate = CMSAbstractDataProperties.LoadTransformation(this, SelectedItemTransformationName);

            if (!String.IsNullOrEmpty(SelectedItemFooterTransformationName))
            {
                BasicRepeater.FooterTemplate = CMSAbstractDataProperties.LoadTransformation(this, SelectedItemFooterTransformationName);
            }
            else
            {
                BasicRepeater.FooterTemplate = null;
            }

            if (!String.IsNullOrEmpty(SelectedItemHeaderTransformationName))
            {
                BasicRepeater.HeaderTemplate = CMSAbstractDataProperties.LoadTransformation(this, SelectedItemHeaderTransformationName);
            }
            else
            {
                BasicRepeater.HeaderTemplate = null;
            }
        }
        else
        {
            // Apply transformations if they exist
            if (!String.IsNullOrEmpty(TransformationName))
            {
                BasicRepeater.ItemTemplate = CMSAbstractDataProperties.LoadTransformation(this, TransformationName);
            }
            if (!String.IsNullOrEmpty(AlternatingItemTransformationName))
            {
                BasicRepeater.AlternatingItemTemplate = CMSAbstractDataProperties.LoadTransformation(this, AlternatingItemTransformationName);
            }
            if (!String.IsNullOrEmpty(FooterTransformationName))
            {
                BasicRepeater.FooterTemplate = CMSAbstractDataProperties.LoadTransformation(this, FooterTransformationName);
            }
            if (!String.IsNullOrEmpty(HeaderTransformationName))
            {
                BasicRepeater.HeaderTemplate = CMSAbstractDataProperties.LoadTransformation(this, HeaderTransformationName);
            }
            if (!String.IsNullOrEmpty(SeparatorTransformationName))
            {
                BasicRepeater.SeparatorTemplate = CMSAbstractDataProperties.LoadTransformation(this, SeparatorTransformationName);
            }
        }
    }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            if (!String.IsNullOrEmpty(TransformationName))
            {
                repTopContributors.ItemTemplate           = CMSAbstractDataProperties.LoadTransformation(this, TransformationName);
                repTopContributors.HideControlForZeroRows = HideControlForZeroRows;
                repTopContributors.ZeroRowsText           = ZeroRowsText;

                DataSet ds = null;

                // Try to get data from cache
                using (var cs = new CachedSection <DataSet>(ref ds, CacheMinutes, true, CacheItemName, "forumtopcontributors", SiteContext.CurrentSiteName, WhereCondition, SelectTopN))
                {
                    if (cs.LoadData)
                    {
                        // Get the data
                        ds = GetData();

                        // Save to the cache
                        if (cs.Cached)
                        {
                            // Save to the cache
                            cs.CacheDependency = GetCacheDependency();
                        }

                        cs.Data = ds;
                    }
                }

                repTopContributors.DataSource = ds;

                if (!DataHelper.DataSourceIsEmpty(repTopContributors.DataSource))
                {
                    repTopContributors.DataBind();
                }
            }
        }
    }
    /// <summary>
    /// Displays multibuy and order discounts summary based on provided transformation.
    /// </summary>
    private void DisplayOrderDiscountSummary()
    {
        if (!string.IsNullOrEmpty(OrderDiscountSummaryTransformationName))
        {
            TransformationInfo ti = TransformationInfoProvider.GetTransformation(OrderDiscountSummaryTransformationName);

            if (ti == null)
            {
                return;
            }

            uvMultiBuySummary.Visible      = true;
            uvMultiBuySummary.DataSource   = ShoppingCart.OrderRelatedDiscountSummaryItems;
            uvMultiBuySummary.ItemTemplate = CMSAbstractDataProperties.LoadTransformation(uvMultiBuySummary, ti.TransformationFullName);

            // Makes sure new data is loaded if the date changes and transformation needs to be reloaded
            uvMultiBuySummary.DataBind();
            uvMultiBuySummary.ReloadData(true);
        }
    }
Exemplo n.º 6
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            uniView.StopProcessing = true;
        }
        else
        {
            uniView.ControlContext = ControlContext;

            // Document properties
            uniView.NestedControlsID          = NestedControlsID;
            uniView.CacheItemName             = CacheItemName;
            uniView.CacheDependencies         = CacheDependencies;
            uniView.CacheMinutes              = CacheMinutes;
            uniView.CheckPermissions          = CheckPermissions;
            uniView.ClassNames                = ClassNames;
            uniView.CategoryName              = CategoryName;
            uniView.CombineWithDefaultCulture = CombineWithDefaultCulture;
            uniView.CultureCode               = CultureCode;
            uniView.MaxRelativeLevel          = MaxRelativeLevel;
            uniView.OrderBy             = OrderBy;
            uniView.SelectTopN          = SelectTopN;
            uniView.Columns             = Columns;
            uniView.SelectOnlyPublished = SelectOnlyPublished;
            uniView.FilterOutDuplicates = FilterOutDuplicates;
            uniView.Path = Path;

            uniView.SiteName       = SiteName;
            uniView.WhereCondition = WhereCondition;

            // CMSUniView properties
            uniView.LoadHierarchicalData             = LoadHierarchicalData;
            uniView.UseHierarchicalOrder             = UseHierarchicalOrder;
            uniView.HideHeaderAndFooterForSingleItem = HideHeaderAndFooterForSingleItem;
            uniView.HierarchicalDisplayMode          = HierarchicalDisplayMode;
            uniView.DelayedLoading = DelayedLoading;

            // Data source settings - must be before pager settings
            uniView.DataSourceName    = DataSourceName;
            uniView.DataSourceControl = DataSourceControl;

            // Pager
            uniView.LoadPagesIndividually = LoadPagesIndividually;
            uniView.EnablePaging          = EnablePaging;
            uniView.PageSize = PageSize;
            uniView.PagerControl.QueryStringKey = QueryStringKey;
            uniView.PagerControl.PagerMode      = PagerMode;
            uniView.PagerPosition = PagerPosition;
            uniView.PagerControl.HidePagerForSinglePage = HidePagerForSinglePage;
            uniView.PagerControl.GroupSize = GroupSize;
            uniView.PagerControl.DisplayFirstLastAutomatically    = DisplayFirstLastAutomatically;
            uniView.PagerControl.DisplayPreviousNextAutomatically = DisplayPreviousNextAutomatically;
            uniView.PagerControl.ResetScrollPositionOnPostBack    = ResetScrollPositionOnPostBack;

            // Pager transformations


            #region "UniPager template properties"

            // UniPager template properties
            if (!String.IsNullOrEmpty(PagesTemplate))
            {
                uniView.PagerControl.PageNumbersTemplate = CMSAbstractDataProperties.LoadTransformation(uniView.PagerControl, PagesTemplate);
            }

            if (!String.IsNullOrEmpty(CurrentPageTemplate))
            {
                uniView.PagerControl.CurrentPageTemplate = CMSAbstractDataProperties.LoadTransformation(uniView.PagerControl, CurrentPageTemplate);
            }

            if (!String.IsNullOrEmpty(SeparatorTemplate))
            {
                uniView.PagerControl.PageNumbersSeparatorTemplate = CMSAbstractDataProperties.LoadTransformation(uniView.PagerControl, SeparatorTemplate);
            }

            if (!String.IsNullOrEmpty(FirstPageTemplate))
            {
                uniView.PagerControl.FirstPageTemplate = CMSAbstractDataProperties.LoadTransformation(uniView.PagerControl, FirstPageTemplate);
            }

            if (!String.IsNullOrEmpty(LastPageTemplate))
            {
                uniView.PagerControl.LastPageTemplate = CMSAbstractDataProperties.LoadTransformation(uniView.PagerControl, LastPageTemplate);
            }

            if (!String.IsNullOrEmpty(PreviousPageTemplate))
            {
                uniView.PagerControl.PreviousPageTemplate = CMSAbstractDataProperties.LoadTransformation(uniView.PagerControl, PreviousPageTemplate);
            }

            if (!String.IsNullOrEmpty(NextPageTemplate))
            {
                uniView.PagerControl.NextPageTemplate = CMSAbstractDataProperties.LoadTransformation(uniView.PagerControl, NextPageTemplate);
            }

            if (!String.IsNullOrEmpty(PreviousGroupTemplate))
            {
                uniView.PagerControl.PreviousGroupTemplate = CMSAbstractDataProperties.LoadTransformation(uniView.PagerControl, PreviousGroupTemplate);
            }

            if (!String.IsNullOrEmpty(NextGroupTemplate))
            {
                uniView.PagerControl.NextGroupTemplate = CMSAbstractDataProperties.LoadTransformation(uniView.PagerControl, NextGroupTemplate);
            }

            if (!String.IsNullOrEmpty(DirectPageTemplate))
            {
                uniView.PagerControl.DirectPageTemplate = CMSAbstractDataProperties.LoadTransformation(uniView.PagerControl, DirectPageTemplate);
            }

            if (!String.IsNullOrEmpty(LayoutTemplate))
            {
                uniView.PagerControl.LayoutTemplate = CMSAbstractDataProperties.LoadTransformation(uniView.PagerControl, LayoutTemplate);
            }

            #endregion


            // Relationships
            uniView.RelatedNodeIsOnTheLeftSide = RelatedNodeIsOnTheLeftSide;
            uniView.RelationshipName           = RelationshipName;
            uniView.RelationshipWithNodeGuid   = RelationshipWithNodeGUID;

            // Transformation properties
            uniView.TransformationName                   = TransformationName;
            uniView.HierarchicalTransformationName       = HierarchicalTransformationName;
            uniView.AlternatingTransformationName        = AlternatingTransformationName;
            uniView.FooterTransformationName             = FooterTransformationName;
            uniView.HeaderTransformationName             = HeaderTransformationName;
            uniView.FirstTransformationName              = FirstTransformationName;
            uniView.LastTransformationName               = LastTransformationName;
            uniView.SingleTransformationName             = SingleTransformationName;
            uniView.SeparatorTransformationName          = SeparatorTransformationName;
            uniView.SelectedItemTransformationName       = SelectedItemTransformationName;
            uniView.SelectedFootertemTransformationName  = SelectedFooterItemTransformationName;
            uniView.SelectedHeaderItemTransformationName = SelectedHeaderItemTransformationName;


            // Public properties
            uniView.HideControlForZeroRows = HideControlForZeroRows;
            uniView.ZeroRowsText           = ZeroRowsText;
            uniView.ItemSeparatorValue     = ItemSeparator;
            uniView.FilterName             = FilterName;

            // Edit mode buttons
            if (PageManager.ViewMode.IsLiveSite())
            {
                btnAdd.Visible = false;
                uniView.ShowEditDeleteButtons = false;
            }
            else
            {
                btnAdd.Visible           = ShowNewButton;
                btnAdd.Text              = NewButtonText;
                uniView.ShowDeleteButton = ShowDeleteButton;
                uniView.ShowEditButton   = ShowEditButton;
            }


            string[] mClassNames = uniView.ClassNames.Split(';');
            btnAdd.ClassName = DataHelper.GetNotEmpty(mClassNames[0], "");

            string mPath = "";
            if (uniView.Path.EndsWithCSafe("/%"))
            {
                mPath = uniView.Path.Remove(uniView.Path.Length - 2);
            }
            if (uniView.Path.EndsWithCSafe("/"))
            {
                mPath = uniView.Path.Remove(uniView.Path.Length - 1);
            }

            btnAdd.Path = DataHelper.GetNotEmpty(mPath, "");

            // Add repeater to the filter collection
            CMSControlsHelper.SetFilter(ValidationHelper.GetString(GetValue("WebPartControlID"), ID), uniView);

            if ((uniView.DataSourceControl != null) &&
                (uniView.DataSourceControl.SourceFilterControl != null))
            {
                uniView.DataSourceControl.SourceFilterControl.OnFilterChanged += FilterControl_OnFilterChanged;
            }
        }
    }
Exemplo n.º 7
0
    private void InitTemplates()
    {
        // If is media file id sets use SelectedItemTransformation and hide paging and sorting
        if (mMediaFileID > 0)
        {
            fileList.ItemTemplate           = CMSAbstractDataProperties.LoadTransformation(this, SelectedItemTransformation);
            UniPagerControl.Visible         = false;
            mediaLibrarySort.StopProcessing = true;
            mediaLibrarySort.Visible        = false;
        }
        else
        {
            // Else use transformation name
            fileList.ItemTemplate = CMSAbstractDataProperties.LoadTransformation(this, TransformationName);
        }

        if (!String.IsNullOrEmpty(HeaderTransformation))
        {
            fileList.HeaderTemplate = CMSAbstractDataProperties.LoadTransformation(this, HeaderTransformation);
        }

        if (!String.IsNullOrEmpty(FooterTransformation))
        {
            fileList.FooterTemplate = CMSAbstractDataProperties.LoadTransformation(this, FooterTransformation);
        }

        if (!String.IsNullOrEmpty(SeparatorTransformation))
        {
            fileList.SeparatorTemplate = CMSAbstractDataProperties.LoadTransformation(this, SeparatorTransformation);
        }

        if (!String.IsNullOrEmpty(PagesTemplate))
        {
            UniPagerControl.PageNumbersTemplate = CMSAbstractDataProperties.LoadTransformation(UniPagerControl, PagesTemplate);
        }

        if (!String.IsNullOrEmpty(CurrentPageTemplate))
        {
            UniPagerControl.CurrentPageTemplate = CMSAbstractDataProperties.LoadTransformation(UniPagerControl, CurrentPageTemplate);
        }

        if (!String.IsNullOrEmpty(SeparatorTemplate))
        {
            UniPagerControl.PageNumbersSeparatorTemplate = CMSAbstractDataProperties.LoadTransformation(UniPagerControl, SeparatorTemplate);
        }

        if (!String.IsNullOrEmpty(FirstPageTemplate))
        {
            UniPagerControl.FirstPageTemplate = CMSAbstractDataProperties.LoadTransformation(UniPagerControl, FirstPageTemplate);
        }

        if (!String.IsNullOrEmpty(LastPageTemplate))
        {
            UniPagerControl.LastPageTemplate = CMSAbstractDataProperties.LoadTransformation(UniPagerControl, LastPageTemplate);
        }

        if (!String.IsNullOrEmpty(PreviousPageTemplate))
        {
            UniPagerControl.PreviousPageTemplate = CMSAbstractDataProperties.LoadTransformation(UniPagerControl, PreviousPageTemplate);
        }

        if (!String.IsNullOrEmpty(NextPageTemplate))
        {
            UniPagerControl.NextPageTemplate = CMSAbstractDataProperties.LoadTransformation(UniPagerControl, NextPageTemplate);
        }

        if (!String.IsNullOrEmpty(PreviousGroupTemplate))
        {
            UniPagerControl.PreviousGroupTemplate = CMSAbstractDataProperties.LoadTransformation(UniPagerControl, PreviousGroupTemplate);
        }

        if (!String.IsNullOrEmpty(NextGroupTemplate))
        {
            UniPagerControl.NextGroupTemplate = CMSAbstractDataProperties.LoadTransformation(UniPagerControl, NextGroupTemplate);
        }

        if (!String.IsNullOrEmpty(LayoutTemplate))
        {
            UniPagerControl.LayoutTemplate = CMSAbstractDataProperties.LoadTransformation(UniPagerControl, LayoutTemplate);
        }
    }
Exemplo n.º 8
0
    /// <summary>
    /// Setups control properties.
    /// </summary>
    protected void SetupControl()
    {
        // Check StopProcessing property
        if (StopProcessing)
        {
            Visible = false;
        }
        else
        {
            SetContext();

            DataSet users       = null;
            bool    transLoaded = false;

            // Load transformation
            if (!string.IsNullOrEmpty(TransformationName))
            {
                repUsers.ItemTemplate = CMSAbstractDataProperties.LoadTransformation(this, TransformationName);
                transLoaded           = true;
            }

            if ((transLoaded) || (!String.IsNullOrEmpty(Path)))
            {
                // Try to get data from cache
                using (var cs = new CachedSection <DataSet>(ref users, CacheMinutes, true, CacheItemName, "onlineusers", SiteContext.CurrentSiteName, SelectTopN, Columns, Path))
                {
                    if (cs.LoadData)
                    {
                        // Get the data
                        users = SessionManager.GetOnlineUsers(null, null, SelectTopN, Columns, MacroResolver.ResolveCurrentPath(Path), SiteContext.CurrentSiteName, false, false);

                        // Prepare the cache dependency
                        if (cs.Cached)
                        {
                            cs.CacheDependency = GetCacheDependency();
                        }

                        cs.Data = users;
                    }
                }

                // Data bind
                if (!DataHelper.DataSourceIsEmpty(users))
                {
                    // Set to repeater
                    repUsers.DataSource = users;
                    repUsers.DataBind();
                }
            }

            int authenticated = 0;
            int publicUsers   = 0;

            string numbers = string.Empty;

            // Get or generate cache item name
            string cacheItemNameNumbers = CacheItemName;
            if (!string.IsNullOrEmpty(cacheItemNameNumbers))
            {
                cacheItemNameNumbers += "Number";
            }

            // Try to get data from cache
            using (var cs = new CachedSection <string>(ref numbers, CacheMinutes, true, cacheItemNameNumbers, "onlineusersnumber", SiteContext.CurrentSiteName, Path))
            {
                if (cs.LoadData)
                {
                    // Get the data
                    SessionManager.GetUsersNumber(CurrentSiteName, MacroResolver.ResolveCurrentPath(Path), false, false, out publicUsers, out authenticated);

                    // Save to the cache
                    if (cs.Cached)
                    {
                        cs.CacheDependency = GetCacheDependency();
                    }

                    cs.Data = publicUsers.ToString() + ";" + authenticated.ToString();
                }
                else if (!String.IsNullOrEmpty(numbers))
                {
                    // Retrieved from cache
                    string[] nums = numbers.Split(';');

                    publicUsers   = ValidationHelper.GetInteger(nums[0], 0);
                    authenticated = ValidationHelper.GetInteger(nums[1], 0);
                }
            }

            // Check if at least one user is online
            if ((publicUsers + authenticated) == 0)
            {
                ltrAdditionaInfos.Text = NoUsersOnlineText;
            }
            else
            {
                ltrAdditionaInfos.Text = string.Format(AdditionalInfoText, publicUsers + authenticated, publicUsers, authenticated);
            }
        }

        ReleaseContext();
    }
Exemplo n.º 9
0
    /// <summary>
    /// Load transformations with dependence on datasource type and datasource state.
    /// </summary>
    protected void LoadTransformations()
    {
        CMSBaseDataSource docDataSource = DataSourceControl;

        if (!String.IsNullOrEmpty(SelectedItemTransformationName) && (docDataSource != null) && docDataSource.IsSelected)
        {
            basicUniView.ItemTemplate = CMSAbstractDataProperties.LoadTransformation(this, SelectedItemTransformationName);

            if (!String.IsNullOrEmpty(SelectedItemFooterTransformationName))
            {
                basicUniView.FooterTemplate = CMSAbstractDataProperties.LoadTransformation(this, SelectedItemFooterTransformationName);
            }
            else
            {
                basicUniView.FooterTemplate = null;
            }

            if (!String.IsNullOrEmpty(SelectedItemHeaderTransformationName))
            {
                basicUniView.HeaderTemplate = CMSAbstractDataProperties.LoadTransformation(this, SelectedItemHeaderTransformationName);
            }
            else
            {
                basicUniView.HeaderTemplate = null;
            }
        }
        else
        {
            // Apply transformations if they exist
            if (!String.IsNullOrEmpty(TransformationName))
            {
                basicUniView.ItemTemplate = CMSAbstractDataProperties.LoadTransformation(this, TransformationName);
            }
            if (!String.IsNullOrEmpty(AlternatingItemTransformationName))
            {
                basicUniView.AlternatingItemTemplate = CMSAbstractDataProperties.LoadTransformation(this, AlternatingItemTransformationName);
            }
            if (!String.IsNullOrEmpty(FooterTransformationName))
            {
                basicUniView.FooterTemplate = CMSAbstractDataProperties.LoadTransformation(this, FooterTransformationName);
            }
            if (!String.IsNullOrEmpty(HeaderTransformationName))
            {
                basicUniView.HeaderTemplate = CMSAbstractDataProperties.LoadTransformation(this, HeaderTransformationName);
            }
            if (!String.IsNullOrEmpty(SeparatorTransformationName))
            {
                basicUniView.SeparatorTemplate = CMSAbstractDataProperties.LoadTransformation(this, SeparatorTransformationName);
            }
            if (!String.IsNullOrEmpty(FirstItemTransformationName))
            {
                basicUniView.FirstItemTemplate = CMSAbstractDataProperties.LoadTransformation(this, FirstItemTransformationName);
            }
            if (!String.IsNullOrEmpty(LastItemTransformationName))
            {
                basicUniView.LastItemTemplate = CMSAbstractDataProperties.LoadTransformation(this, LastItemTransformationName);
            }
            if (!String.IsNullOrEmpty(SingleItemTransformationName))
            {
                basicUniView.SingleItemTemplate = CMSAbstractDataProperties.LoadTransformation(this, SingleItemTransformationName);
            }
        }
    }