Example #1
0
    /// <summary>
    /// Renders search results into HTML string.
    /// </summary>
    private string RenderResults(DataSet results, string searchText)
    {
        if (results == null)
        {
            // No results
            return(String.IsNullOrEmpty(PredictiveSearchNoResultsContent) ? "" : "<div class='nonSelectable'>" + PredictiveSearchNoResultsContent + "</div>");
        }
        else
        {
            UIRepeater repSearchResults = new UIRepeater();
            IDictionary <string, DataView> indexCategories = new Dictionary <string, DataView>();
            StringWriter stringWriter = new StringWriter();

            // Display categories - create DataView for each index
            if (PredictiveSearchDisplayCategories)
            {
                foreach (DataRow row in results.Tables["results"].Rows)
                {
                    string index = (string)row["index"];

                    if (!indexCategories.ContainsKey(index))
                    {
                        indexCategories.Add(index, new DataView(results.Tables["results"], "index = '" + index + "'", "", DataViewRowState.CurrentRows));
                    }
                }
            }
            // Do not display categories - create DataView of whole table
            else
            {
                indexCategories.Add("results", new DataView(results.Tables["results"]));
            }


            // Render each index category
            foreach (var categories in indexCategories)
            {
                // Display categories
                if (PredictiveSearchDisplayCategories)
                {
                    SearchIndexInfo indexInfo    = SearchIndexInfoProvider.GetSearchIndexInfo(categories.Key);
                    string          categoryName = indexInfo == null ? String.Empty : indexInfo.IndexDisplayName;
                    repSearchResults.HeaderTemplate = new TextTransformationTemplate("<div class='predictiveSearchCategory nonSelectable'>" + categoryName + "</div>");
                }

                // Fill repeater with results
                repSearchResults.ItemTemplate = CMSDataProperties.LoadTransformation(this, PredictiveSearchResultItemTransformationName);
                repSearchResults.DataSource   = categories.Value;
                repSearchResults.DataBind();
                repSearchResults.RenderControl(new HtmlTextWriter(stringWriter));
            }

            // More results
            if (PredictiveSearchMaxResults == results.Tables["results"].Rows.Count)
            {
                stringWriter.Write(String.Format(PredictiveSearchMoreResultsContent, CreateSearchUrl(searchText)));
            }

            return(stringWriter.ToString());
        }
    }
Example #2
0
    /// <summary>
    /// Load transformations with dependence on current datasource type and datasource type.
    /// </summary>
    protected void LoadTransformations()
    {
        CMSBaseDataSource dataSource = this.DataSourceControl as CMSBaseDataSource;

        if ((dataSource != null) && !String.IsNullOrEmpty(this.TransformationName))
        {
            this.BasicBingMaps.ItemTemplate = CMSDataProperties.LoadTransformation(this, this.TransformationName, false);
        }
    }
    /// <summary>
    /// Load transformations with dependence on current datasource type and datasource type.
    /// </summary>
    protected void LoadTransformations()
    {
        CMSBaseDataSource dataSource = DataSourceControl as CMSBaseDataSource;

        if ((dataSource != null) && !String.IsNullOrEmpty(TransformationName))
        {
            BasicGoogleMaps.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName);
        }
    }
    /// <summary>
    /// Load transformations with dependence on data source type and data source state.
    /// </summary>
    protected void LoadTransformations()
    {
        CMSBaseDataSource dataSource = SPDataSource as CMSBaseDataSource;

        // If data source exists and is selected and selected transformation isn't null
        if ((dataSource != null) && (dataSource.IsSelected) && (!String.IsNullOrEmpty(SelectedItemTransformationName)))
        {
            // Set item transformation
            BasicRepeater.ItemTemplate = CMSDataProperties.LoadTransformation(this, SelectedItemTransformationName, false);

            // Set footer transformation
            if (!String.IsNullOrEmpty(SelectedItemFooterTransformationName))
            {
                BasicRepeater.FooterTemplate = CMSDataProperties.LoadTransformation(this, SelectedItemFooterTransformationName, false);
            }
            else
            {
                BasicRepeater.FooterTemplate = null;
            }

            // Set header transformation
            if (!String.IsNullOrEmpty(SelectedItemHeaderTransformationName))
            {
                BasicRepeater.HeaderTemplate = CMSDataProperties.LoadTransformation(this, SelectedItemHeaderTransformationName, false);
            }
            else
            {
                BasicRepeater.HeaderTemplate = null;
            }
        }
        else
        {
            // Apply transformations if they exist
            if (!String.IsNullOrEmpty(TransformationName))
            {
                BasicRepeater.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName, false);
            }
            if (!String.IsNullOrEmpty(AlternatingItemTransformationName))
            {
                BasicRepeater.AlternatingItemTemplate = CMSDataProperties.LoadTransformation(this, AlternatingItemTransformationName, false);
            }
            if (!String.IsNullOrEmpty(FooterTransformationName))
            {
                BasicRepeater.FooterTemplate = CMSDataProperties.LoadTransformation(this, FooterTransformationName, false);
            }
            if (!String.IsNullOrEmpty(HeaderTransformationName))
            {
                BasicRepeater.HeaderTemplate = CMSDataProperties.LoadTransformation(this, HeaderTransformationName, false);
            }
            if (!String.IsNullOrEmpty(SeparatorTransformationName))
            {
                BasicRepeater.SeparatorTemplate = CMSDataProperties.LoadTransformation(this, SeparatorTransformationName, false);
            }
        }
    }
Example #5
0
    /// <summary>
    /// Load transformations with dependence on current datasource type and datasource type.
    /// </summary>
    protected void LoadTransformations()
    {
        CMSBaseDataSource docDataSource = this.DataSourceControl as CMSBaseDataSource;

        if ((docDataSource != null) && (docDataSource.IsSelected) && (!String.IsNullOrEmpty(this.SelectedItemTransformationName)))
        {
            this.BasicDataList.ItemTemplate = CMSDataProperties.LoadTransformation(this, this.SelectedItemTransformationName, false);

            if (!String.IsNullOrEmpty(this.SelectedItemFooterTransformationName))
            {
                this.BasicDataList.FooterTemplate = CMSDataProperties.LoadTransformation(this, this.SelectedItemFooterTransformationName, false);
            }
            else
            {
                this.BasicDataList.FooterTemplate = null;
            }

            if (!String.IsNullOrEmpty(this.SelectedItemHeaderTransformationName))
            {
                this.BasicDataList.HeaderTemplate = CMSDataProperties.LoadTransformation(this, this.SelectedItemHeaderTransformationName, false);
            }
            else
            {
                this.BasicDataList.HeaderTemplate = null;
            }
        }
        else
        {
            // Apply transformations if they exist
            if (!String.IsNullOrEmpty(this.AlternatingItemTransformationName))
            {
                this.BasicDataList.AlternatingItemTemplate = CMSDataProperties.LoadTransformation(this, this.AlternatingItemTransformationName, false);
            }

            if (!String.IsNullOrEmpty(this.FooterTransformationName))
            {
                this.BasicDataList.FooterTemplate = CMSDataProperties.LoadTransformation(this, this.FooterTransformationName, false);
            }

            if (!String.IsNullOrEmpty(this.HeaderTransformationName))
            {
                this.BasicDataList.HeaderTemplate = CMSDataProperties.LoadTransformation(this, this.HeaderTransformationName, false);
            }

            if (!String.IsNullOrEmpty(this.TransformationName))
            {
                this.BasicDataList.ItemTemplate = CMSDataProperties.LoadTransformation(this, this.TransformationName, false);
            }

            if (!String.IsNullOrEmpty(this.SeparatorTransformationName))
            {
                this.BasicDataList.SeparatorTemplate = CMSDataProperties.LoadTransformation(this, this.SeparatorTransformationName, false);
            }
        }
    }
Example #6
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        // Handle stop processing
        if (!this.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.ItemDataBound += rptCategoryList_ItemDataBound;
                    rptCategoryList.DataSource     = data;

                    if (String.IsNullOrEmpty(TransformationName))
                    {
                        rptCategoryList.ItemTemplate = CMSDataProperties.LoadTransformation(this, "[]", false);
                    }
                    else
                    {
                        rptCategoryList.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName, false);
                    }
                    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 current data source type and data source state.
    /// </summary>
    protected void LoadTransformations()
    {
        CMSBaseDataSource dataSource = SPDataSource as CMSBaseDataSource;

        if ((dataSource != null) && (dataSource.IsSelected) && (!String.IsNullOrEmpty(SelectedItemTransformationName)))
        {
            BasicDataList.ItemTemplate = CMSDataProperties.LoadTransformation(this, SelectedItemTransformationName, false);

            if (!String.IsNullOrEmpty(SelectedItemFooterTransformationName))
            {
                BasicDataList.FooterTemplate = CMSDataProperties.LoadTransformation(this, SelectedItemFooterTransformationName, false);
            }
            else
            {
                BasicDataList.FooterTemplate = null;
            }

            if (!String.IsNullOrEmpty(SelectedItemHeaderTransformationName))
            {
                BasicDataList.HeaderTemplate = CMSDataProperties.LoadTransformation(this, SelectedItemHeaderTransformationName, false);
            }
            else
            {
                BasicDataList.HeaderTemplate = null;
            }
        }
        else
        {
            // Apply transformations if they exist
            if (!String.IsNullOrEmpty(AlternatingItemTransformationName))
            {
                BasicDataList.AlternatingItemTemplate = CMSDataProperties.LoadTransformation(this, AlternatingItemTransformationName, false);
            }

            if (!String.IsNullOrEmpty(FooterTransformationName))
            {
                BasicDataList.FooterTemplate = CMSDataProperties.LoadTransformation(this, FooterTransformationName, false);
            }

            if (!String.IsNullOrEmpty(HeaderTransformationName))
            {
                BasicDataList.HeaderTemplate = CMSDataProperties.LoadTransformation(this, HeaderTransformationName, false);
            }

            if (!String.IsNullOrEmpty(TransformationName))
            {
                BasicDataList.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName, false);
            }

            if (!String.IsNullOrEmpty(SeparatorTransformationName))
            {
                BasicDataList.SeparatorTemplate = CMSDataProperties.LoadTransformation(this, SeparatorTransformationName, false);
            }
        }
    }
    /// <summary>
    /// Loads ITemplates from transformation names
    /// </summary>
    private void LoadTemplates()
    {
        // Transformation
        if (!String.IsNullOrEmpty(TransformationName))
        {
            activeTemplate = CMSDataProperties.LoadTransformation(this, TransformationName);
            autoGenerate   = false;
        }

        // Inactive
        if (!String.IsNullOrEmpty(InactiveItemTransformationName))
        {
            inactiveTemplate = CMSDataProperties.LoadTransformation(this, InactiveItemTransformationName);
            autoGenerate     = false;
        }

        // Current
        if (!String.IsNullOrEmpty(CurrentItemTranformationName))
        {
            currentTemplate = CMSDataProperties.LoadTransformation(this, CurrentItemTranformationName);
            autoGenerate    = false;
        }

        // Alternating
        if (!String.IsNullOrEmpty(AlternatingTransformationName))
        {
            alternatingTemnplate = CMSDataProperties.LoadTransformation(this, AlternatingTransformationName);
            autoGenerate         = false;
        }

        // First
        if (!String.IsNullOrEmpty(FirstTransformationName))
        {
            firstTemplate = CMSDataProperties.LoadTransformation(this, FirstTransformationName);
            autoGenerate  = false;
        }

        // Last
        if (!String.IsNullOrEmpty(LastTransformationName))
        {
            lastTemplate = CMSDataProperties.LoadTransformation(this, LastTransformationName);
            autoGenerate = false;
        }

        // Last inactive
        if (!String.IsNullOrEmpty(LastInactiveTransformationName))
        {
            lastInactiveTemplate = CMSDataProperties.LoadTransformation(this, LastInactiveTransformationName);
            autoGenerate         = false;
        }
    }
Example #9
0
    /// <summary>
    /// Load transformations with dependence on datasource type and datasource state.
    /// </summary>
    protected void LoadTransformations()
    {
        CMSBaseDataSource docDataSource = DataSourceControl as CMSBaseDataSource;

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

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

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

                DataSet ds = null;

                // Try to get data from cache
                using (CachedSection <DataSet> cs = new CachedSection <DataSet>(ref ds, CacheMinutes, true, CacheItemName, "forumtopcontributors", CMSContext.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();
                }
            }
        }
    }
Example #11
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            basicDatalist.Visible       = false;
            wsDataSource.StopProcessing = true;
        }
        else
        {
            // Setup the control
            // Public
            basicDatalist.RepeatColumns          = RepeatColumns;
            basicDatalist.RepeatLayout           = RepeatLayout;
            basicDatalist.RepeatDirection        = RepeatDirection;
            basicDatalist.HideControlForZeroRows = HideControlForZeroRows;
            basicDatalist.ZeroRowsText           = ZeroRowsText;
            basicDatalist.DataBindByDefault      = DataBindByDefault;

            // Get web service URL, parameters and transformation name
            wsDataSource.WebServiceUrl        = WebServiceURL;
            wsDataSource.WebServiceParameters = WebServiceParameters;
            transformationName = TransformationName;

            // Connect with data source
            basicDatalist.DataSource = wsDataSource.DataSource;

            if (!DataHelper.DataSourceIsEmpty(basicDatalist.DataSource))
            {
                if (transformationName != "")
                {
                    basicDatalist.ItemTemplate = CMSDataProperties.LoadTransformation(basicDatalist, transformationName, false);
                }
            }
            else
            {
                if (HideControlForZeroRows)
                {
                    Visible = false;
                }
            }
        }
    }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            basicRepeater.Visible       = false;
            wsDataSource.StopProcessing = true;
        }
        else
        {
            // Setup the control
            // Public
            basicRepeater.HideControlForZeroRows = HideControlForZeroRows;
            basicRepeater.ZeroRowsText           = ZeroRowsText;
            basicRepeater.DataBindByDefault      = DataBindByDefault;

            // Get web service URL, parameters and transformation name
            wsDataSource.WebServiceUrl        = WebServiceURL;
            wsDataSource.WebServiceParameters = WebServiceParameters;
            transformationName = TransformationName;

            // Connect with data source
            basicRepeater.DataSource = wsDataSource.DataSource;

            if (!DataHelper.DataSourceIsEmpty(basicRepeater.DataSource))
            {
                if ((transformationName != null) && (transformationName.Trim() != ""))
                {
                    // Get url to transformation and load it
                    basicRepeater.ItemTemplate = CMSDataProperties.LoadTransformation(basicRepeater, transformationName, false);
                }
            }
            else
            {
                if (HideControlForZeroRows)
                {
                    Visible = false;
                }
            }
        }
    }
Example #13
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
            ucBingMap.Visible = false;
        }
        else
        {
            #region "Data source properties"

            // Set Documents data source control
            ucDocumentSource.Path       = Path;
            ucDocumentSource.ClassNames = ClassNames;
            ucDocumentSource.CombineWithDefaultCulture = CombineWithDefaultCulture;
            ucDocumentSource.CultureCode                = CultureCode;
            ucDocumentSource.MaxRelativeLevel           = MaxRelativeLevel;
            ucDocumentSource.OrderBy                    = OrderBy;
            ucDocumentSource.SelectOnlyPublished        = SelectOnlyPublished;
            ucDocumentSource.SelectTopN                 = SelectTopN;
            ucDocumentSource.SiteName                   = SiteName;
            ucDocumentSource.WhereCondition             = WhereCondition;
            ucDocumentSource.FilterOutDuplicates        = FilterOutDuplicates;
            ucDocumentSource.CheckPermissions           = CheckPermissions;
            ucDocumentSource.RelationshipName           = RelationshipName;
            ucDocumentSource.RelationshipWithNodeGuid   = RelationshipWithNodeGUID;
            ucDocumentSource.RelatedNodeIsOnTheLeftSide = RelatedNodeIsOnTheLeftSide;
            ucDocumentSource.CacheDependencies          = CacheDependencies;
            ucDocumentSource.CacheMinutes               = CacheMinutes;
            ucDocumentSource.CacheItemName              = CacheItemName;
            ucDocumentSource.LoadCurrentPageOnly        = LoadCurrentPageOnly;

            #endregion


            #region "Bing map caching options"

            // Set caching options if server processing is enabled
            if (ucDocumentSource != null && EnableServerProcessing)
            {
                ucBingMap.CacheItemName = ucDocumentSource.CacheItemName;
                ucBingMap.CacheMinutes  = ucDocumentSource.CacheMinutes;

                // Cache depends on data source and properties of web part
                ucBingMap.CacheDependencies = CacheHelper.GetCacheDependencies(CacheDependencies, ucDocumentSource.GetDefaultCacheDependencies());
            }

            #endregion


            #region "Map properties"

            // Set BasicBingMaps control
            CMSMapProperties mp = new CMSMapProperties();
            mp.EnableKeyboardShortcuts = EnableKeyboardShortcuts;
            mp.EnableMapDragging       = EnableMapDragging;
            mp.EnableServerProcessing  = EnableServerProcessing;
            mp.Height                = Height;
            mp.Latitude              = Latitude;
            mp.LatitudeField         = LatitudeField;
            mp.Location              = DefaultLocation;
            mp.LocationField         = LocationField;
            mp.Longitude             = Longitude;
            mp.LongitudeField        = LongitudeField;
            mp.MapId                 = ClientID;
            mp.MapKey                = MapKey;
            mp.MapType               = MapType;
            mp.Scale                 = Scale;
            mp.ShowNavigationControl = ShowNavigationControl;
            mp.ShowScaleControl      = ShowScaleControl;
            mp.ToolTipField          = ToolTipField;
            mp.IconField             = IconField;
            mp.Width                 = Width;
            mp.ZoomScale             = ZoomScale;

            ucBingMap.DataBindByDefault      = false;
            ucBingMap.MapProperties          = mp;
            ucBingMap.ItemTemplate           = CMSDataProperties.LoadTransformation(this, TransformationName);
            ucBingMap.MainScriptPath         = "~/CMSWebParts/Maps/Documents/BingMaps_files/BingMaps.js";
            ucBingMap.HideControlForZeroRows = HideControlForZeroRows;

            if (!String.IsNullOrEmpty(ZeroRowsText))
            {
                ucBingMap.ZeroRowsText = ZeroRowsText;
            }

            #endregion


            if (reloadData)
            {
                ucDocumentSource.DataSource = null;
            }

            // Connects Bing map with data source
            ucBingMap.DataSource  = ucDocumentSource.DataSource;
            ucBingMap.RelatedData = ucDocumentSource.RelatedData;

            if (HasData)
            {
                ucBingMap.DataBind();
            }
        }
    }
Example #14
0
    private void InitTemplates()
    {
        // If is media file id sets use SelectedItemTransformation and hide paging and sorting
        if (mMediaFileID > 0)
        {
            fileList.ItemTemplate           = CMSDataProperties.LoadTransformation(this, SelectedItemTransformation, false);
            UniPagerControl.Visible         = false;
            mediaLibrarySort.StopProcessing = true;
            mediaLibrarySort.Visible        = false;
        }
        else
        {
            // Else use transformation name
            fileList.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName, false);
        }

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

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

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

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

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

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

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

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

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

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

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

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

        if (!String.IsNullOrEmpty(LayoutTemplate))
        {
            UniPagerControl.LayoutTemplate = CMSDataProperties.LoadTransformation(UniPagerControl, LayoutTemplate, false);
        }
    }
    /// <summary>
    /// Setups the templates.
    /// </summary>
    private void SetupTemplates()
    {
        #region "Repeater template properties"

        // Apply transformations if they exist
        ucRepeater.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName);

        if (!string.IsNullOrEmpty(AlternatingItemTransformationName))
        {
            ucRepeater.AlternatingItemTemplate = CMSDataProperties.LoadTransformation(this, AlternatingItemTransformationName);
        }
        if (!string.IsNullOrEmpty(FooterTransformationName))
        {
            ucRepeater.FooterTemplate = CMSDataProperties.LoadTransformation(this, FooterTransformationName);
        }
        if (!string.IsNullOrEmpty(HeaderTransformationName))
        {
            ucRepeater.HeaderTemplate = CMSDataProperties.LoadTransformation(this, HeaderTransformationName);
        }
        if (!string.IsNullOrEmpty(SeparatorTransformationName))
        {
            ucRepeater.SeparatorTemplate = CMSDataProperties.LoadTransformation(this, SeparatorTransformationName);
        }

        #endregion


        #region "UniPager template properties"

        // UniPager template properties
        if (!string.IsNullOrEmpty(PagesTemplate))
        {
            ucPager.PageNumbersTemplate = CMSDataProperties.LoadTransformation(ucPager, PagesTemplate);
        }

        if (!string.IsNullOrEmpty(CurrentPageTemplate))
        {
            ucPager.CurrentPageTemplate = CMSDataProperties.LoadTransformation(ucPager, CurrentPageTemplate);
        }

        if (!string.IsNullOrEmpty(SeparatorTemplate))
        {
            ucPager.PageNumbersSeparatorTemplate = CMSDataProperties.LoadTransformation(ucPager, SeparatorTemplate);
        }

        if (!string.IsNullOrEmpty(FirstPageTemplate))
        {
            ucPager.FirstPageTemplate = CMSDataProperties.LoadTransformation(ucPager, FirstPageTemplate);
        }

        if (!string.IsNullOrEmpty(LastPageTemplate))
        {
            ucPager.LastPageTemplate = CMSDataProperties.LoadTransformation(ucPager, LastPageTemplate);
        }

        if (!string.IsNullOrEmpty(PreviousPageTemplate))
        {
            ucPager.PreviousPageTemplate = CMSDataProperties.LoadTransformation(ucPager, PreviousPageTemplate);
        }

        if (!string.IsNullOrEmpty(NextPageTemplate))
        {
            ucPager.NextPageTemplate = CMSDataProperties.LoadTransformation(ucPager, NextPageTemplate);
        }

        if (!string.IsNullOrEmpty(PreviousGroupTemplate))
        {
            ucPager.PreviousGroupTemplate = CMSDataProperties.LoadTransformation(ucPager, PreviousGroupTemplate);
        }

        if (!string.IsNullOrEmpty(NextGroupTemplate))
        {
            ucPager.NextGroupTemplate = CMSDataProperties.LoadTransformation(ucPager, NextGroupTemplate);
        }

        if (!string.IsNullOrEmpty(LayoutTemplate))
        {
            ucPager.LayoutTemplate = CMSDataProperties.LoadTransformation(ucPager, LayoutTemplate);
        }

        #endregion
    }
Example #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            // Try get external pager
            pgr = UniPagerControl;
            bool isExternal = true;

            // Check whether external pager is set
            if (pgr == null)
            {
                isExternal = false;
                pgr        = pgrSearch;

                // UniPager properties
                pgrSearch.PageSize       = PageSize;
                pgrSearch.GroupSize      = GroupSize;
                pgrSearch.QueryStringKey = QueryStringKey;
                pgrSearch.DisplayFirstLastAutomatically    = DisplayFirstLastAutomatically;
                pgrSearch.DisplayPreviousNextAutomatically = DisplayPreviousNextAutomatically;
                pgrSearch.HidePagerForSinglePage           = HidePagerForSinglePage;
                pgrSearch.PagerMode = PagingMode;
                pgrSearch.MaxPages  = MaxPages;
            }

            if (!isExternal)
            {
                #region "UniPager template properties"

                // UniPager direct templates
                if (PageNumbersTemplate != null)
                {
                    pgrSearch.PageNumbersTemplate = PageNumbersTemplate;
                }

                if (CurrentPageTemplate != null)
                {
                    pgrSearch.CurrentPageTemplate = CurrentPageTemplate;
                }

                if (PageNumbersSeparatorTemplate != null)
                {
                    pgrSearch.PageNumbersSeparatorTemplate = PageNumbersSeparatorTemplate;
                }

                if (FirstPageTemplate != null)
                {
                    pgrSearch.FirstPageTemplate = FirstPageTemplate;
                }

                if (LastPageTemplate != null)
                {
                    pgrSearch.LastPageTemplate = LastPageTemplate;
                }

                if (PreviousPageTemplate != null)
                {
                    pgrSearch.PreviousPageTemplate = PreviousPageTemplate;
                }

                if (NextPageTemplate != null)
                {
                    pgrSearch.NextPageTemplate = NextPageTemplate;
                }

                if (PreviousGroupTemplate != null)
                {
                    pgrSearch.PreviousGroupTemplate = PreviousGroupTemplate;
                }

                if (NextGroupTemplate != null)
                {
                    pgrSearch.NextGroupTemplate = NextGroupTemplate;
                }

                if (LayoutTemplate != null)
                {
                    pgrSearch.LayoutTemplate = LayoutTemplate;
                }

                // UniPager template properties
                if (!String.IsNullOrEmpty(PagesTemplateName))
                {
                    pgrSearch.PageNumbersTemplate = CMSDataProperties.LoadTransformation(pgrSearch, PagesTemplateName);
                }

                if (!String.IsNullOrEmpty(CurrentPageTemplateName))
                {
                    pgrSearch.CurrentPageTemplate = CMSDataProperties.LoadTransformation(pgrSearch, CurrentPageTemplateName);
                }

                if (!String.IsNullOrEmpty(SeparatorTemplateName))
                {
                    pgrSearch.PageNumbersSeparatorTemplate = CMSDataProperties.LoadTransformation(pgrSearch, SeparatorTemplateName);
                }

                if (!String.IsNullOrEmpty(FirstPageTemplateName))
                {
                    pgrSearch.FirstPageTemplate = CMSDataProperties.LoadTransformation(pgrSearch, FirstPageTemplateName);
                }

                if (!String.IsNullOrEmpty(LastPageTemplateName))
                {
                    pgrSearch.LastPageTemplate = CMSDataProperties.LoadTransformation(pgrSearch, LastPageTemplateName);
                }

                if (!String.IsNullOrEmpty(PreviousPageTemplateName))
                {
                    pgrSearch.PreviousPageTemplate = CMSDataProperties.LoadTransformation(pgrSearch, PreviousPageTemplateName);
                }

                if (!String.IsNullOrEmpty(NextPageTemplateName))
                {
                    pgrSearch.NextPageTemplate = CMSDataProperties.LoadTransformation(pgrSearch, NextPageTemplateName);
                }

                if (!String.IsNullOrEmpty(PreviousGroupTemplateName))
                {
                    pgrSearch.PreviousGroupTemplate = CMSDataProperties.LoadTransformation(pgrSearch, PreviousGroupTemplateName);
                }

                if (!String.IsNullOrEmpty(NextGroupTemplateName))
                {
                    pgrSearch.NextGroupTemplate = CMSDataProperties.LoadTransformation(pgrSearch, NextGroupTemplateName);
                }

                if (!String.IsNullOrEmpty(LayoutTemplateName))
                {
                    pgrSearch.LayoutTemplate = CMSDataProperties.LoadTransformation(pgrSearch, LayoutTemplateName);
                }

                #endregion
            }

            // Load transformation
            if (!string.IsNullOrEmpty(TransformationName) && !IgnoreTransformations)
            {
                repSearchResults.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName);
            }
            // Set transformation directly
            else
            {
                repSearchResults.ItemTemplate            = ItemTemplate;
                repSearchResults.HeaderTemplate          = HeaderTemplate;
                repSearchResults.FooterTemplate          = FooterTemplate;
                repSearchResults.AlternatingItemTemplate = AlternatingItemTemplate;
                repSearchResults.SeparatorTemplate       = SeparatorTemplate;
            }

            plcBasicRepeater.Controls.Clear();
            repSearchResults.ID = "repSearchResults";
            plcBasicRepeater.Controls.Add(repSearchResults);

            Visible = true;
        }
    }
Example #17
0
    /// <summary>
    /// Load transformations with dependence on datasource type and datasource state.
    /// </summary>
    protected void LoadTransformations()
    {
        CMSBaseDataSource docDataSource = DataSourceControl as CMSBaseDataSource;

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

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

            if (!String.IsNullOrEmpty(SelectedItemHeaderTransformationName))
            {
                basicUniView.HeaderTemplate = CMSDataProperties.LoadTransformation(this, SelectedItemHeaderTransformationName, false);
            }
            else
            {
                basicUniView.HeaderTemplate = null;
            }
        }
        else
        {
            // Apply transformations if they exist
            if (!String.IsNullOrEmpty(TransformationName))
            {
                basicUniView.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName, false);
            }
            if (!String.IsNullOrEmpty(AlternatingItemTransformationName))
            {
                basicUniView.AlternatingItemTemplate = CMSDataProperties.LoadTransformation(this, AlternatingItemTransformationName, false);
            }
            if (!String.IsNullOrEmpty(FooterTransformationName))
            {
                basicUniView.FooterTemplate = CMSDataProperties.LoadTransformation(this, FooterTransformationName, false);
            }
            if (!String.IsNullOrEmpty(HeaderTransformationName))
            {
                basicUniView.HeaderTemplate = CMSDataProperties.LoadTransformation(this, HeaderTransformationName, false);
            }
            if (!String.IsNullOrEmpty(SeparatorTransformationName))
            {
                basicUniView.SeparatorTemplate = CMSDataProperties.LoadTransformation(this, SeparatorTransformationName, false);
            }
            if (!String.IsNullOrEmpty(FirstItemTransformationName))
            {
                basicUniView.FirstItemTemplate = CMSDataProperties.LoadTransformation(this, FirstItemTransformationName, false);
            }
            if (!String.IsNullOrEmpty(LastItemTransformationName))
            {
                basicUniView.LastItemTemplate = CMSDataProperties.LoadTransformation(this, LastItemTransformationName, false);
            }
            if (!String.IsNullOrEmpty(SingleItemTransformationName))
            {
                basicUniView.SingleItemTemplate = CMSDataProperties.LoadTransformation(this, SingleItemTransformationName, false);
            }
        }
    }
Example #18
0
    /// <summary>
    /// Reloads the data.
    /// </summary>
    /// <param name="forceReload">Indicates if the rload should be forced</param>
    public void ReloadData(bool forceReload)
    {
        #region "Repeater template properties"

        // Apply transformations if they exist
        ucRepeater.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName);

        if (!string.IsNullOrEmpty(AlternatingItemTransformationName))
        {
            ucRepeater.AlternatingItemTemplate = CMSDataProperties.LoadTransformation(this, AlternatingItemTransformationName);
        }
        if (!string.IsNullOrEmpty(FooterTransformationName))
        {
            ucRepeater.FooterTemplate = CMSDataProperties.LoadTransformation(this, FooterTransformationName);
        }
        if (!string.IsNullOrEmpty(HeaderTransformationName))
        {
            ucRepeater.HeaderTemplate = CMSDataProperties.LoadTransformation(this, HeaderTransformationName);
        }
        if (!string.IsNullOrEmpty(SeparatorTransformationName))
        {
            ucRepeater.SeparatorTemplate = CMSDataProperties.LoadTransformation(this, SeparatorTransformationName);
        }

        #endregion


        #region "UniPager template properties"

        // UniPager template properties
        if (!string.IsNullOrEmpty(PagesTemplate))
        {
            ucPager.PageNumbersTemplate = CMSDataProperties.LoadTransformation(ucPager, PagesTemplate);
        }

        if (!string.IsNullOrEmpty(CurrentPageTemplate))
        {
            ucPager.CurrentPageTemplate = CMSDataProperties.LoadTransformation(ucPager, CurrentPageTemplate);
        }

        if (!string.IsNullOrEmpty(SeparatorTemplate))
        {
            ucPager.PageNumbersSeparatorTemplate = CMSDataProperties.LoadTransformation(ucPager, SeparatorTemplate);
        }

        if (!string.IsNullOrEmpty(FirstPageTemplate))
        {
            ucPager.FirstPageTemplate = CMSDataProperties.LoadTransformation(ucPager, FirstPageTemplate);
        }

        if (!string.IsNullOrEmpty(LastPageTemplate))
        {
            ucPager.LastPageTemplate = CMSDataProperties.LoadTransformation(ucPager, LastPageTemplate);
        }

        if (!string.IsNullOrEmpty(PreviousPageTemplate))
        {
            ucPager.PreviousPageTemplate = CMSDataProperties.LoadTransformation(ucPager, PreviousPageTemplate);
        }

        if (!string.IsNullOrEmpty(NextPageTemplate))
        {
            ucPager.NextPageTemplate = CMSDataProperties.LoadTransformation(ucPager, NextPageTemplate);
        }

        if (!string.IsNullOrEmpty(PreviousGroupTemplate))
        {
            ucPager.PreviousGroupTemplate = CMSDataProperties.LoadTransformation(ucPager, PreviousGroupTemplate);
        }

        if (!string.IsNullOrEmpty(NextGroupTemplate))
        {
            ucPager.NextGroupTemplate = CMSDataProperties.LoadTransformation(ucPager, NextGroupTemplate);
        }

        if (!string.IsNullOrEmpty(LayoutTemplate))
        {
            ucPager.LayoutTemplate = CMSDataProperties.LoadTransformation(ucPager, LayoutTemplate);
        }

        #endregion


        if (forceReload)
        {
            ucDataSource.DataSource = null;
        }

        // Connects repeater with data source
        ucRepeater.DataSource  = ucDataSource.DataSource;
        ucRepeater.RelatedData = ucDataSource.RelatedData;

        if (HasData)
        {
            ucRepeater.DataBind();
        }
    }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            if (!String.IsNullOrEmpty(TransformationName))
            {
                // Basic control properties
                repMediaLib.HideControlForZeroRows = HideControlForZeroRows;
                repMediaLib.ZeroRowsText           = ZeroRowsText;

                // Data source properties
                srcMediaLib.WhereCondition     = WhereCondition;
                srcMediaLib.OrderBy            = OrderBy;
                srcMediaLib.TopN               = SelectTopN;
                srcMediaLib.CacheItemName      = CacheItemName;
                srcMediaLib.CacheDependencies  = CacheDependencies;
                srcMediaLib.CacheMinutes       = CacheMinutes;
                srcMediaLib.SelectedColumns    = Columns;
                srcMediaLib.SiteName           = SiteName;
                srcMediaLib.ShowGroupLibraries = ShowGroupLibraries;


                #region "Repeater template properties"

                // Apply transformations if they exist
                repMediaLib.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName);

                if (!String.IsNullOrEmpty(AlternatingItemTransformationName))
                {
                    repMediaLib.AlternatingItemTemplate = CMSDataProperties.LoadTransformation(this, AlternatingItemTransformationName);
                }
                if (!String.IsNullOrEmpty(FooterTransformationName))
                {
                    repMediaLib.FooterTemplate = CMSDataProperties.LoadTransformation(this, FooterTransformationName);
                }
                if (!String.IsNullOrEmpty(HeaderTransformationName))
                {
                    repMediaLib.HeaderTemplate = CMSDataProperties.LoadTransformation(this, HeaderTransformationName);
                }
                if (!String.IsNullOrEmpty(SeparatorTransformationName))
                {
                    repMediaLib.SeparatorTemplate = CMSDataProperties.LoadTransformation(this, SeparatorTransformationName);
                }

                #endregion


                // UniPager properties
                pagerElem.PageSize       = PageSize;
                pagerElem.GroupSize      = GroupSize;
                pagerElem.QueryStringKey = QueryStringKey;
                pagerElem.DisplayFirstLastAutomatically    = DisplayFirstLastAutomatically;
                pagerElem.DisplayPreviousNextAutomatically = DisplayPreviousNextAutomatically;
                pagerElem.HidePagerForSinglePage           = HidePagerForSinglePage;

                switch (PagingMode.ToLowerCSafe())
                {
                case "postback":
                    pagerElem.PagerMode = UniPagerMode.PostBack;
                    break;

                default:
                    pagerElem.PagerMode = UniPagerMode.Querystring;
                    break;
                }


                #region "UniPager template properties"

                // UniPager template properties
                if (!String.IsNullOrEmpty(PagesTemplate))
                {
                    pagerElem.PageNumbersTemplate = CMSDataProperties.LoadTransformation(pagerElem, PagesTemplate);
                }

                if (!String.IsNullOrEmpty(CurrentPageTemplate))
                {
                    pagerElem.CurrentPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, CurrentPageTemplate);
                }

                if (!String.IsNullOrEmpty(SeparatorTemplate))
                {
                    pagerElem.PageNumbersSeparatorTemplate = CMSDataProperties.LoadTransformation(pagerElem, SeparatorTemplate);
                }

                if (!String.IsNullOrEmpty(FirstPageTemplate))
                {
                    pagerElem.FirstPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, FirstPageTemplate);
                }

                if (!String.IsNullOrEmpty(LastPageTemplate))
                {
                    pagerElem.LastPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, LastPageTemplate);
                }

                if (!String.IsNullOrEmpty(PreviousPageTemplate))
                {
                    pagerElem.PreviousPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousPageTemplate);
                }

                if (!String.IsNullOrEmpty(NextPageTemplate))
                {
                    pagerElem.NextPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextPageTemplate);
                }

                if (!String.IsNullOrEmpty(PreviousGroupTemplate))
                {
                    pagerElem.PreviousGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousGroupTemplate);
                }

                if (!String.IsNullOrEmpty(NextGroupTemplate))
                {
                    pagerElem.NextGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextGroupTemplate);
                }

                if (!String.IsNullOrEmpty(DirectPageTemplate))
                {
                    pagerElem.DirectPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, DirectPageTemplate);
                }

                if (!String.IsNullOrEmpty(LayoutTemplate))
                {
                    pagerElem.LayoutTemplate = CMSDataProperties.LoadTransformation(pagerElem, LayoutTemplate);
                }

                #endregion


                // Connects repeater with data source
                repMediaLib.DataSource = srcMediaLib.DataSource;

                if (!DataHelper.DataSourceIsEmpty(srcMediaLib.DataSource))
                {
                    repMediaLib.DataBind();
                }
            }
        }
    }
    /// <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;

            // Pager
            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 = CMSDataProperties.LoadTransformation(uniView.PagerControl, PagesTemplate, false);
            }

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

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

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

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

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

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

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

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

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

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

            #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;

            uniView.DataSourceName    = DataSourceName;
            uniView.DataSourceControl = DataSourceControl;

            // Edit mode buttons
            if ((PageManager.ViewMode == ViewModeEnum.LiveSite) || !PageManager.IsAuthorized)
            {
                btnAdd.Visible = false;
                uniView.ShowEditDeleteButtons = false;
            }
            else
            {
                btnAdd.Visible = ShowNewButton;
                btnAdd.Text    = NewButtonText;
                uniView.ShowEditDeleteButtons = ShowEditDeleteButtons;
            }


            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"), ClientID), uniView);

            if ((uniView.DataSourceControl != null) &&
                (uniView.DataSourceControl.SourceFilterControl != null))
            {
                ((CMSAbstractBaseFilterControl)uniView.DataSourceControl.SourceFilterControl).OnFilterChanged += new ActionEventHandler(FilterControl_OnFilterChanged);
            }
        }
    }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            if (!String.IsNullOrEmpty(TransformationName))
            {
                // Basic control properties
                repMessages.HideControlForZeroRows = HideControlForZeroRows;
                repMessages.ZeroRowsText           = HTMLHelper.HTMLEncode(ZeroRowsText);

                // Data source properties
                boardDataSource.ShowGroupMessages = true;
                boardDataSource.TopN               = SelectTopN;
                boardDataSource.OrderBy            = OrderBy;
                boardDataSource.CacheItemName      = CacheItemName;
                boardDataSource.CacheDependencies  = CacheDependencies;
                boardDataSource.CacheMinutes       = CacheMinutes;
                boardDataSource.SourceFilterName   = FilterName;
                boardDataSource.SelectOnlyApproved = DisplayOnlyApproved;
                boardDataSource.SiteName           = SiteContext.CurrentSiteName;
                boardDataSource.SelectedColumns    = Columns;


                #region "Repeater template properties"

                // Apply transformations if they exist
                repMessages.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName);

                if (!String.IsNullOrEmpty(AlternatingItemTransformationName))
                {
                    repMessages.AlternatingItemTemplate = CMSDataProperties.LoadTransformation(this, AlternatingItemTransformationName);
                }
                if (!String.IsNullOrEmpty(FooterTransformationName))
                {
                    repMessages.FooterTemplate = CMSDataProperties.LoadTransformation(this, FooterTransformationName);
                }
                if (!String.IsNullOrEmpty(HeaderTransformationName))
                {
                    repMessages.HeaderTemplate = CMSDataProperties.LoadTransformation(this, HeaderTransformationName);
                }
                if (!String.IsNullOrEmpty(SeparatorTransformationName))
                {
                    repMessages.SeparatorTemplate = CMSDataProperties.LoadTransformation(this, SeparatorTransformationName);
                }

                #endregion


                // UniPager properties
                pagerElem.PageSize       = PageSize;
                pagerElem.GroupSize      = GroupSize;
                pagerElem.QueryStringKey = QueryStringKey;
                pagerElem.DisplayFirstLastAutomatically    = DisplayFirstLastAutomatically;
                pagerElem.DisplayPreviousNextAutomatically = DisplayPreviousNextAutomatically;
                pagerElem.HidePagerForSinglePage           = HidePagerForSinglePage;

                switch (PagingMode.ToLowerCSafe())
                {
                case "postback":
                    pagerElem.PagerMode = UniPagerMode.PostBack;
                    break;

                default:
                    pagerElem.PagerMode = UniPagerMode.Querystring;
                    break;
                }


                #region "UniPager template properties"

                // UniPager template properties
                if (!String.IsNullOrEmpty(PagesTemplate))
                {
                    pagerElem.PageNumbersTemplate = CMSDataProperties.LoadTransformation(pagerElem, PagesTemplate);
                }

                if (!String.IsNullOrEmpty(CurrentPageTemplate))
                {
                    pagerElem.CurrentPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, CurrentPageTemplate);
                }

                if (!String.IsNullOrEmpty(SeparatorTemplate))
                {
                    pagerElem.PageNumbersSeparatorTemplate = CMSDataProperties.LoadTransformation(pagerElem, SeparatorTemplate);
                }

                if (!String.IsNullOrEmpty(FirstPageTemplate))
                {
                    pagerElem.FirstPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, FirstPageTemplate);
                }

                if (!String.IsNullOrEmpty(LastPageTemplate))
                {
                    pagerElem.LastPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, LastPageTemplate);
                }

                if (!String.IsNullOrEmpty(PreviousPageTemplate))
                {
                    pagerElem.PreviousPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousPageTemplate);
                }

                if (!String.IsNullOrEmpty(NextPageTemplate))
                {
                    pagerElem.NextPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextPageTemplate);
                }

                if (!String.IsNullOrEmpty(PreviousGroupTemplate))
                {
                    pagerElem.PreviousGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousGroupTemplate);
                }

                if (!String.IsNullOrEmpty(NextGroupTemplate))
                {
                    pagerElem.NextGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextGroupTemplate);
                }

                if (!String.IsNullOrEmpty(DirectPageTemplate))
                {
                    pagerElem.DirectPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, DirectPageTemplate);
                }

                if (!String.IsNullOrEmpty(LayoutTemplate))
                {
                    pagerElem.LayoutTemplate = CMSDataProperties.LoadTransformation(pagerElem, LayoutTemplate);
                }

                #endregion


                string where = "(GroupName = N'" + SqlHelper.GetSafeQueryString(GroupName, false) + "')";

                if (!string.IsNullOrEmpty(WhereCondition))
                {
                    where = "(" + WhereCondition + ") AND (" + where + ")";
                }

                boardDataSource.WhereCondition = where;

                repMessages.DataSourceControl = boardDataSource;

                repMessages.DataBind();
            }
        }
    }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        // Set stop processing to inner controls trough property setter
        StopProcessing = StopProcessing;

        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            BasicDataList.DataBindByDefault = false;
            pagerElem.PageControl           = BasicDataList.ID;

            if (!String.IsNullOrEmpty(TransformationName))
            {
                // Set SharePoint data source properties
                SPDataSource.Username          = Username;
                SPDataSource.Password          = EncryptionHelper.DecryptData(Password);
                SPDataSource.ListName          = ListName;
                SPDataSource.SPServiceURL      = SPServiceURL;
                SPDataSource.ShowReturnedCAML  = ShowReturnedCAML;
                SPDataSource.RowLimit          = RowLimit;
                SPDataSource.Query             = Query;
                SPDataSource.ViewFields        = ViewFields;
                SPDataSource.UseClassicDataset = UseClassicDataset;
                SPDataSource.Fields            = Fields;
                SPDataSource.Mode                  = Mode;
                SPDataSource.ItemIDField           = ItemIDField;
                SPDataSource.SelectedItemFieldName = SelectedItemFieldName;
                SPDataSource.ItemIDFieldType       = ItemIDFieldType;
                SPDataSource.CacheItemName         = CacheItemName;
                SPDataSource.CacheDependencies     = CacheDependencies;
                SPDataSource.CacheMinutes          = CacheMinutes;


                // Classic dataset OR XSLT transformation
                if (UseClassicDataset)
                {
                    // Basic DataList properties
                    BasicDataList.RepeatColumns          = RepeatColumns;
                    BasicDataList.RepeatLayout           = RepeatLayout;
                    BasicDataList.RepeatDirection        = RepeatDirection;
                    BasicDataList.HideControlForZeroRows = HideControlForZeroRows;
                    BasicDataList.ZeroRowsText           = ZeroRowsText;

                    // UniPager properties
                    pagerElem.PageSize       = PageSize;
                    pagerElem.GroupSize      = GroupSize;
                    pagerElem.QueryStringKey = QueryStringKey;
                    pagerElem.DisplayFirstLastAutomatically    = DisplayFirstLastAutomatically;
                    pagerElem.DisplayPreviousNextAutomatically = DisplayPreviousNextAutomatically;
                    pagerElem.HidePagerForSinglePage           = HidePagerForSinglePage;

                    // Set pager mode
                    switch (PagingMode.ToLowerCSafe())
                    {
                    case "postback":
                        pagerElem.PagerMode = UniPagerMode.PostBack;
                        break;

                    default:
                        pagerElem.PagerMode = UniPagerMode.Querystring;
                        break;
                    }


                    #region "UniPager template properties"

                    // UniPager template properties
                    if (!string.IsNullOrEmpty(PagesTemplate))
                    {
                        pagerElem.PageNumbersTemplate = CMSDataProperties.LoadTransformation(pagerElem, PagesTemplate, false);
                    }

                    // Current page
                    if (!string.IsNullOrEmpty(CurrentPageTemplate))
                    {
                        pagerElem.CurrentPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, CurrentPageTemplate, false);
                    }

                    // Separator
                    if (!string.IsNullOrEmpty(SeparatorTemplate))
                    {
                        pagerElem.PageNumbersSeparatorTemplate = CMSDataProperties.LoadTransformation(pagerElem, SeparatorTemplate, false);
                    }

                    // First page
                    if (!string.IsNullOrEmpty(FirstPageTemplate))
                    {
                        pagerElem.FirstPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, FirstPageTemplate, false);
                    }

                    // Last page
                    if (!string.IsNullOrEmpty(LastPageTemplate))
                    {
                        pagerElem.LastPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, LastPageTemplate, false);
                    }

                    // Previous page
                    if (!string.IsNullOrEmpty(PreviousPageTemplate))
                    {
                        pagerElem.PreviousPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousPageTemplate, false);
                    }

                    // Next page
                    if (!string.IsNullOrEmpty(NextPageTemplate))
                    {
                        pagerElem.NextPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextPageTemplate, false);
                    }

                    // Previous group
                    if (!string.IsNullOrEmpty(PreviousGroupTemplate))
                    {
                        pagerElem.PreviousGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousGroupTemplate, false);
                    }

                    // Next group
                    if (!string.IsNullOrEmpty(NextGroupTemplate))
                    {
                        pagerElem.NextGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextGroupTemplate, false);
                    }

                    // Direct page
                    if (!String.IsNullOrEmpty(DirectPageTemplate))
                    {
                        pagerElem.DirectPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, DirectPageTemplate, false);
                    }

                    // Layout
                    if (!string.IsNullOrEmpty(LayoutTemplate))
                    {
                        pagerElem.LayoutTemplate = CMSDataProperties.LoadTransformation(pagerElem, LayoutTemplate, false);
                    }

                    #endregion
                }
                else
                {
                    plcDataset.Visible = false;
                    plcXSLT.Visible    = true;
                }

                // Load and bind data
                BindData();
            }
        }
    }
Example #23
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            if (!String.IsNullOrEmpty(TransformationName))
            {
                repMostActiveThread.ItemTemplate           = CMSDataProperties.LoadTransformation(this, TransformationName);
                repMostActiveThread.HideControlForZeroRows = HideControlForZeroRows;
                repMostActiveThread.ZeroRowsText           = ZeroRowsText;

                // Set data source groupid according to group name
                if (!String.IsNullOrEmpty(GroupName))
                {
                    if (GroupName == PredefinedObjectType.COMMUNITY_CURRENT_GROUP)
                    {
                        forumDataSource.GroupID = ModuleCommands.CommunityGetCurrentGroupID();
                    }
                    else
                    {
                        GeneralizedInfo gi = ModuleCommands.CommunityGetGroupInfoByName(GroupName, SiteName);
                        if (gi != null)
                        {
                            forumDataSource.GroupID = ValidationHelper.GetInteger(gi.GetValue("GroupID"), 0);
                        }
                        else
                        {
                            forumDataSource.StopProcessing = true;
                        }
                    }
                }

                if (!forumDataSource.StopProcessing)
                {
                    forumDataSource.TopN               = SelectTopN;
                    forumDataSource.OrderBy            = "PostThreadPosts DESC";
                    forumDataSource.CacheItemName      = CacheItemName;
                    forumDataSource.CacheDependencies  = CacheDependencies;
                    forumDataSource.CacheMinutes       = CacheMinutes;
                    forumDataSource.SelectOnlyApproved = false;
                    forumDataSource.SiteName           = SiteName;
                    forumDataSource.ShowGroupPosts     = ShowGroupPosts && String.IsNullOrEmpty(ForumGroups);
                    forumDataSource.SelectedColumns    = Columns;

                    #region "Complete where condition"

                    string where = "";

                    // Get groups part of where condition
                    string[] groups = ForumGroups.Split(';');
                    foreach (string group in groups)
                    {
                        if (group != "")
                        {
                            if (where != "")
                            {
                                where += " OR ";
                            }
                            where += "(GroupName = N'" + SqlHelper.GetSafeQueryString(group, false) + "')";
                        }
                    }
                    where = "(" + (where == "" ? "(GroupName NOT LIKE 'AdHoc%')" : "(" + where + ")") + " AND (PostLevel = 0))";

                    // Append where condition and set PostLevel to 0 (only threads are needed)
                    // and filter out AdHoc forums
                    if (!String.IsNullOrEmpty(WhereCondition))
                    {
                        where += " AND (" + WhereCondition + ")";
                    }

                    #endregion


                    forumDataSource.WhereCondition        = where;
                    forumDataSource.CheckPermissions      = true;
                    repMostActiveThread.DataSourceControl = forumDataSource;
                    repMostActiveThread.DataBind();
                }
            }
        }
    }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        repFriends.DataBindByDefault = false;
        pagerElem.PageControl        = repFriends.ID;

        if (StopProcessing || (CurrentUser == null))
        {
            // Do nothing
            srcFriends.StopProcessing = true;
        }
        else
        {
            if (!String.IsNullOrEmpty(TransformationName))
            {
                // Basic control properties
                repFriends.HideControlForZeroRows = HideControlForZeroRows;
                repFriends.ZeroRowsText           = ZeroRowsText;

                // Data source properties
                srcFriends.WhereCondition    = WhereCondition;
                srcFriends.OrderBy           = OrderBy;
                srcFriends.UserID            = CurrentUser.UserID;
                srcFriends.SourceFilterName  = FilterName;
                srcFriends.CacheItemName     = CacheItemName;
                srcFriends.CacheDependencies = CacheDependencies;
                srcFriends.CacheMinutes      = CacheMinutes;
                srcFriends.FriendStatus      = FriendStatus;
                srcFriends.SelectedColumns   = Columns;


                #region "Repeater template properties"

                // Apply transformations if they exist
                repFriends.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName);

                if (!string.IsNullOrEmpty(AlternatingItemTransformationName))
                {
                    repFriends.AlternatingItemTemplate = CMSDataProperties.LoadTransformation(this, AlternatingItemTransformationName);
                }
                if (!string.IsNullOrEmpty(FooterTransformationName))
                {
                    repFriends.FooterTemplate = CMSDataProperties.LoadTransformation(this, FooterTransformationName);
                }
                if (!string.IsNullOrEmpty(HeaderTransformationName))
                {
                    repFriends.HeaderTemplate = CMSDataProperties.LoadTransformation(this, HeaderTransformationName);
                }
                if (!string.IsNullOrEmpty(SeparatorTransformationName))
                {
                    repFriends.SeparatorTemplate = CMSDataProperties.LoadTransformation(this, SeparatorTransformationName);
                }

                #endregion


                // UniPager properties
                pagerElem.PageSize       = PageSize;
                pagerElem.GroupSize      = GroupSize;
                pagerElem.QueryStringKey = QueryStringKey;
                pagerElem.DisplayFirstLastAutomatically    = DisplayFirstLastAutomatically;
                pagerElem.DisplayPreviousNextAutomatically = DisplayPreviousNextAutomatically;
                pagerElem.HidePagerForSinglePage           = HidePagerForSinglePage;

                switch (PagingMode.ToLowerCSafe())
                {
                case "postback":
                    pagerElem.PagerMode = UniPagerMode.PostBack;
                    break;

                default:
                    pagerElem.PagerMode = UniPagerMode.Querystring;
                    break;
                }


                #region "UniPager template properties"

                // UniPager template properties
                if (!string.IsNullOrEmpty(PagesTemplate))
                {
                    pagerElem.PageNumbersTemplate = CMSDataProperties.LoadTransformation(pagerElem, PagesTemplate);
                }

                if (!string.IsNullOrEmpty(CurrentPageTemplate))
                {
                    pagerElem.CurrentPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, CurrentPageTemplate);
                }

                if (!string.IsNullOrEmpty(SeparatorTemplate))
                {
                    pagerElem.PageNumbersSeparatorTemplate = CMSDataProperties.LoadTransformation(pagerElem, SeparatorTemplate);
                }

                if (!string.IsNullOrEmpty(FirstPageTemplate))
                {
                    pagerElem.FirstPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, FirstPageTemplate);
                }

                if (!string.IsNullOrEmpty(LastPageTemplate))
                {
                    pagerElem.LastPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, LastPageTemplate);
                }

                if (!string.IsNullOrEmpty(PreviousPageTemplate))
                {
                    pagerElem.PreviousPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousPageTemplate);
                }

                if (!string.IsNullOrEmpty(NextPageTemplate))
                {
                    pagerElem.NextPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextPageTemplate);
                }

                if (!string.IsNullOrEmpty(PreviousGroupTemplate))
                {
                    pagerElem.PreviousGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousGroupTemplate);
                }

                if (!string.IsNullOrEmpty(NextGroupTemplate))
                {
                    pagerElem.NextGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextGroupTemplate);
                }

                if (!String.IsNullOrEmpty(DirectPageTemplate))
                {
                    pagerElem.DirectPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, DirectPageTemplate);
                }

                if (!string.IsNullOrEmpty(LayoutTemplate))
                {
                    pagerElem.LayoutTemplate = CMSDataProperties.LoadTransformation(pagerElem, LayoutTemplate);
                }

                #endregion


                // Connects repeater with data source
                repFriends.DataSource = srcFriends.DataSource;
            }

            pagerElem.RebindPager();
            repFriends.DataBind();
        }
    }
Example #25
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        repLatestPosts.DataBindByDefault = false;
        pagerElem.PageControl            = repLatestPosts.ID;

        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            if (!String.IsNullOrEmpty(TransformationName))
            {
                // Basic control properties
                repLatestPosts.HideControlForZeroRows = HideControlForZeroRows;
                repLatestPosts.ZeroRowsText           = ZeroRowsText;

                // Set data source groupID according to group name
                if (!String.IsNullOrEmpty(GroupName))
                {
                    GeneralizedInfo gi = ModuleCommands.CommunityGetGroupInfoByName(GroupName, SiteName);
                    if (gi != null)
                    {
                        forumDataSource.GroupID = ValidationHelper.GetInteger(gi.GetValue("GroupID"), 0);
                    }
                    else
                    {
                        // Do nothing if no group is set
                        forumDataSource.StopProcessing = true;
                    }
                }

                if (!forumDataSource.StopProcessing)
                {
                    // Data source properties
                    forumDataSource.TopN               = SelectTopN;
                    forumDataSource.OrderBy            = OrderBy;
                    forumDataSource.CacheItemName      = CacheItemName;
                    forumDataSource.CacheDependencies  = CacheDependencies;
                    forumDataSource.CacheMinutes       = CacheMinutes;
                    forumDataSource.SourceFilterName   = FilterName;
                    forumDataSource.SelectOnlyApproved = SelectOnlyApproved;
                    forumDataSource.SiteName           = SiteName;
                    forumDataSource.SelectedColumns    = Columns;
                    forumDataSource.ShowGroupPosts     = ShowGroupPosts && String.IsNullOrEmpty(ForumGroups);


                    #region "Repeater template properties"

                    // Apply transformations if they exist
                    repLatestPosts.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName);

                    // Alternating item
                    if (!String.IsNullOrEmpty(AlternatingItemTransformationName))
                    {
                        repLatestPosts.AlternatingItemTemplate = CMSDataProperties.LoadTransformation(this, AlternatingItemTransformationName);
                    }

                    // Footer
                    if (!String.IsNullOrEmpty(FooterTransformationName))
                    {
                        repLatestPosts.FooterTemplate = CMSDataProperties.LoadTransformation(this, FooterTransformationName);
                    }

                    // Header
                    if (!String.IsNullOrEmpty(HeaderTransformationName))
                    {
                        repLatestPosts.HeaderTemplate = CMSDataProperties.LoadTransformation(this, HeaderTransformationName);
                    }

                    // Separator
                    if (!String.IsNullOrEmpty(SeparatorTransformationName))
                    {
                        repLatestPosts.SeparatorTemplate = CMSDataProperties.LoadTransformation(this, SeparatorTransformationName);
                    }

                    #endregion


                    // UniPager properties
                    pagerElem.PageSize       = PageSize;
                    pagerElem.GroupSize      = GroupSize;
                    pagerElem.QueryStringKey = QueryStringKey;
                    pagerElem.DisplayFirstLastAutomatically    = DisplayFirstLastAutomatically;
                    pagerElem.DisplayPreviousNextAutomatically = DisplayPreviousNextAutomatically;
                    pagerElem.HidePagerForSinglePage           = HidePagerForSinglePage;

                    // Set pager mode
                    switch (PagingMode.ToLowerCSafe())
                    {
                    case "postback":
                        pagerElem.PagerMode = UniPagerMode.PostBack;
                        break;

                    default:
                        pagerElem.PagerMode = UniPagerMode.Querystring;
                        break;
                    }


                    #region "UniPager template properties"

                    // UniPager template properties
                    if (!String.IsNullOrEmpty(PagesTemplate))
                    {
                        pagerElem.PageNumbersTemplate = CMSDataProperties.LoadTransformation(pagerElem, PagesTemplate);
                    }

                    // Current page
                    if (!String.IsNullOrEmpty(CurrentPageTemplate))
                    {
                        pagerElem.CurrentPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, CurrentPageTemplate);
                    }

                    // Separator
                    if (!String.IsNullOrEmpty(SeparatorTemplate))
                    {
                        pagerElem.PageNumbersSeparatorTemplate = CMSDataProperties.LoadTransformation(pagerElem, SeparatorTemplate);
                    }

                    // First page
                    if (!String.IsNullOrEmpty(FirstPageTemplate))
                    {
                        pagerElem.FirstPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, FirstPageTemplate);
                    }

                    // Last page
                    if (!String.IsNullOrEmpty(LastPageTemplate))
                    {
                        pagerElem.LastPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, LastPageTemplate);
                    }

                    // Previous page
                    if (!String.IsNullOrEmpty(PreviousPageTemplate))
                    {
                        pagerElem.PreviousPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousPageTemplate);
                    }

                    // Next page
                    if (!String.IsNullOrEmpty(NextPageTemplate))
                    {
                        pagerElem.NextPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextPageTemplate);
                    }

                    // Previous group
                    if (!String.IsNullOrEmpty(PreviousGroupTemplate))
                    {
                        pagerElem.PreviousGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousGroupTemplate);
                    }

                    // Next group
                    if (!String.IsNullOrEmpty(NextGroupTemplate))
                    {
                        pagerElem.NextGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextGroupTemplate);
                    }

                    // Direct page
                    if (!String.IsNullOrEmpty(DirectPageTemplate))
                    {
                        pagerElem.DirectPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, DirectPageTemplate);
                    }

                    // Layout
                    if (!String.IsNullOrEmpty(LayoutTemplate))
                    {
                        pagerElem.LayoutTemplate = CMSDataProperties.LoadTransformation(pagerElem, LayoutTemplate);
                    }

                    #endregion


                    #region "Complete where condition"

                    string where = "";
                    string[] groups = ForumGroups.Split(';');

                    // Create where condition for all forum groups
                    foreach (string group in groups)
                    {
                        if (group != "")
                        {
                            if (where != "")
                            {
                                where += "OR";
                            }
                            where += "(GroupName = N'" + SqlHelper.GetSafeQueryString(group, false) + "')";
                        }
                    }

                    // Add custom where condition
                    if (!string.IsNullOrEmpty(WhereCondition))
                    {
                        if (string.IsNullOrEmpty(where))
                        {
                            where = WhereCondition;
                        }
                        else
                        {
                            where = "(" + WhereCondition + ") AND (" + where + ")";
                        }
                    }

                    #endregion

                    // Set forum data source
                    forumDataSource.WhereCondition   = where;
                    forumDataSource.CheckPermissions = true;
                    repLatestPosts.DataSourceControl = forumDataSource;
                }
            }

            pagerElem.RebindPager();
            repLatestPosts.DataBind();
        }
    }
Example #26
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            uniView.StopProcessing = true;
        }
        else
        {
            uniView.ControlContext = ControlContext;

            // Query properties
            uniView.QueryName         = this.QueryName;
            uniView.CacheItemName     = CacheItemName;
            uniView.CacheDependencies = CacheDependencies;
            uniView.CacheMinutes      = CacheMinutes;
            uniView.OrderBy           = OrderBy;
            uniView.SelectTopN        = SelectTopN;
            uniView.Columns           = Columns;
            uniView.WhereCondition    = WhereCondition;

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

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

            // Pager transformations
            #region "UniPager template properties"

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

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

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

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

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

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

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

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

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

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

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

            #endregion

            uniView.ParentIDColumnName     = this.ParentIDColumnName;
            uniView.IDColumnName           = this.IDColumnName;
            uniView.LevelColumnName        = this.LevelColumnName;
            uniView.SelectedItemColumnName = this.SelectedItemColumnName;
            uniView.SelectedItemValue      = this.SelectedItemValue;

            // Transformation properties
            uniView.TransformationName             = this.TransformationName;
            uniView.HierarchicalTransformationName = this.HierarchicalTransformationName;
            uniView.AlternatingTransformationName  = this.AlternatingTransformationName;
            uniView.FooterTransformationName       = this.FooterTransformationName;
            uniView.HeaderTransformationName       = this.HeaderTransformationName;
            uniView.FirstTransformationName        = this.FirstTransformationName;
            uniView.LastTransformationName         = this.LastTransformationName;
            uniView.SingleTransformationName       = this.SingleTransformationName;
            uniView.SeparatorTransformationName    = this.SeparatorTransformationName;

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

            // Add repeater to the filter collection
            CMSControlsHelper.SetFilter(ValidationHelper.GetString(GetValue("WebPartControlID"), ClientID), uniView);
        }
    }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        // Set general properties
        repUsers.DataBindByDefault = false;
        pagerElem.PageControl      = repUsers.ID;

        if (StopProcessing)
        {
            // Do nothing
            filterUsers.StopProcessing = true;
            srcUsers.StopProcessing    = true;
        }
        else
        {
            filterUsers.Visible          = ShowFilterControl;
            filterUsers.OnFilterChanged += filterUsers_OnFilterChanged;
            srcUsers.OnFilterChanged    += filterUsers_OnFilterChanged;

            // Basic control properties
            repUsers.HideControlForZeroRows = HideControlForZeroRows;
            repUsers.ZeroRowsText           = ZeroRowsText;


            TreeNode     node = null;
            TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);

            // Check if path is set
            if (String.IsNullOrEmpty(Path))
            {
                TreeNode curDoc = DocumentContext.CurrentDocument;
                // Check if current document is department
                if ((curDoc != null) && (curDoc.NodeClassName.ToLowerCSafe() == DEPARTMENT_CLASS_NAME))
                {
                    node = DocumentContext.CurrentDocument;
                }
            }
            else
            {
                // Obtain document from specified path
                node = tree.SelectSingleNode(SiteName, Path, LocalizationContext.PreferredCultureCode, true, DEPARTMENT_CLASS_NAME, false, false, false);
            }

            // If department document exists and has own ACL continue with initializing controls
            if ((node != null) && node.NodeIsACLOwner)
            {
                // Get users and roles with read permission for department document
                int     aclId   = ValidationHelper.GetInteger(node.GetValue("NodeACLID"), 0);
                DataSet dsRoles = AclItemInfoProvider.GetAllowedRoles(aclId, NodePermissionsEnum.Read, "RoleID");
                DataSet dsUsers = AclItemInfoProvider.GetAllowedUsers(aclId, NodePermissionsEnum.Read, "UserID");

                string where = null;

                // Process users dataset to where condition
                if (!DataHelper.DataSourceIsEmpty(dsUsers))
                {
                    // Get allowed users ids
                    IList <string> users   = DataHelper.GetStringValues(dsUsers.Tables[0], "UserID");
                    string         userIds = TextHelper.Join(", ", users);

                    // Populate where condition with user condition
                    where = SqlHelper.AddWhereCondition("UserID IN (" + userIds + ")", where);
                }

                // Process roles dataset to where condition
                if (!DataHelper.DataSourceIsEmpty(dsRoles))
                {
                    // Get allowed roles ids
                    IList <string> roles   = DataHelper.GetStringValues(dsRoles.Tables[0], "RoleID");
                    string         roleIds = TextHelper.Join(", ", roles);

                    // Populate where condition with role condition
                    where = SqlHelper.AddWhereCondition("UserID IN (SELECT UserID FROM View_CMS_UserRole_MembershipRole_ValidOnly_Joined WHERE RoleID IN (" + roleIds + "))", where, "OR");
                }


                if (!String.IsNullOrEmpty(where))
                {
                    // Check if exist where condition and add it to current where condition
                    where = SqlHelper.AddWhereCondition(WhereCondition, where);

                    // Data source properties
                    srcUsers.WhereCondition     = where;
                    srcUsers.OrderBy            = OrderBy;
                    srcUsers.TopN               = SelectTopN;
                    srcUsers.SelectedColumns    = Columns;
                    srcUsers.SiteName           = SiteName;
                    srcUsers.FilterName         = filterUsers.ID;
                    srcUsers.SourceFilterName   = FilterName;
                    srcUsers.CacheItemName      = CacheItemName;
                    srcUsers.CacheDependencies  = CacheDependencies;
                    srcUsers.CacheMinutes       = CacheMinutes;
                    srcUsers.SelectOnlyApproved = SelectOnlyApproved;
                    srcUsers.SelectHidden       = SelectHidden;

                    // Init data properties
                    filterUsers.InitDataProperties(srcUsers);


                    #region "Repeater template properties"

                    // Apply transformations if they exist
                    if (!String.IsNullOrEmpty(TransformationName))
                    {
                        repUsers.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName);
                    }
                    if (!String.IsNullOrEmpty(AlternatingItemTransformationName))
                    {
                        repUsers.AlternatingItemTemplate = CMSDataProperties.LoadTransformation(this, AlternatingItemTransformationName);
                    }
                    if (!String.IsNullOrEmpty(FooterTransformationName))
                    {
                        repUsers.FooterTemplate = CMSDataProperties.LoadTransformation(this, FooterTransformationName);
                    }
                    if (!String.IsNullOrEmpty(HeaderTransformationName))
                    {
                        repUsers.HeaderTemplate = CMSDataProperties.LoadTransformation(this, HeaderTransformationName);
                    }
                    if (!String.IsNullOrEmpty(SeparatorTransformationName))
                    {
                        repUsers.SeparatorTemplate = CMSDataProperties.LoadTransformation(this, SeparatorTransformationName);
                    }

                    #endregion


                    // UniPager properties
                    pagerElem.PageSize       = PageSize;
                    pagerElem.GroupSize      = GroupSize;
                    pagerElem.QueryStringKey = QueryStringKey;
                    pagerElem.DisplayFirstLastAutomatically    = DisplayFirstLastAutomatically;
                    pagerElem.DisplayPreviousNextAutomatically = DisplayPreviousNextAutomatically;
                    pagerElem.HidePagerForSinglePage           = HidePagerForSinglePage;
                    pagerElem.Enabled = EnablePaging;

                    switch (PagingMode.ToLowerCSafe())
                    {
                    case "querystring":
                        pagerElem.PagerMode = UniPagerMode.Querystring;
                        break;

                    default:
                        pagerElem.PagerMode = UniPagerMode.PostBack;
                        break;
                    }


                    #region "UniPager template properties"

                    // UniPager template properties
                    if (!String.IsNullOrEmpty(PagesTemplate))
                    {
                        pagerElem.PageNumbersTemplate = CMSDataProperties.LoadTransformation(pagerElem, PagesTemplate);
                    }

                    if (!String.IsNullOrEmpty(CurrentPageTemplate))
                    {
                        pagerElem.CurrentPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, CurrentPageTemplate);
                    }

                    if (!String.IsNullOrEmpty(SeparatorTemplate))
                    {
                        pagerElem.PageNumbersSeparatorTemplate = CMSDataProperties.LoadTransformation(pagerElem, SeparatorTemplate);
                    }

                    if (!String.IsNullOrEmpty(FirstPageTemplate))
                    {
                        pagerElem.FirstPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, FirstPageTemplate);
                    }

                    if (!String.IsNullOrEmpty(LastPageTemplate))
                    {
                        pagerElem.LastPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, LastPageTemplate);
                    }

                    if (!String.IsNullOrEmpty(PreviousPageTemplate))
                    {
                        pagerElem.PreviousPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousPageTemplate);
                    }

                    if (!String.IsNullOrEmpty(NextPageTemplate))
                    {
                        pagerElem.NextPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextPageTemplate);
                    }

                    if (!String.IsNullOrEmpty(PreviousGroupTemplate))
                    {
                        pagerElem.PreviousGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousGroupTemplate);
                    }

                    if (!String.IsNullOrEmpty(NextGroupTemplate))
                    {
                        pagerElem.NextGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextGroupTemplate);
                    }

                    if (!String.IsNullOrEmpty(DirectPageTemplate))
                    {
                        pagerElem.DirectPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, DirectPageTemplate);
                    }

                    if (!String.IsNullOrEmpty(LayoutTemplate))
                    {
                        pagerElem.LayoutTemplate = CMSDataProperties.LoadTransformation(pagerElem, LayoutTemplate);
                    }

                    #endregion


                    // Connects repeater with data source
                    repUsers.DataSource = srcUsers.DataSource;
                }
                else
                {
                    // Disable datasource
                    srcUsers.StopProcessing = true;
                }
            }
            else
            {
                // Disable datasource
                srcUsers.StopProcessing = true;
            }

            pagerElem.RebindPager();
            repUsers.DataBind();
        }
    }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        repLatestPosts.DataBindByDefault = false;
        pagerElem.PageControl            = repLatestPosts.ID;

        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            SetContext();

            if (!String.IsNullOrEmpty(TransformationName))
            {
                // Basic control properties
                repLatestPosts.HideControlForZeroRows = HideControlForZeroRows;
                repLatestPosts.ZeroRowsText           = ZeroRowsText;

                // Check if Group name is set
                GroupInfo gi = null;
                if ((CommunityContext.CurrentGroup != null) && (GroupName.ToLower() == CommunityContext.CurrentGroup.GroupName.ToLower()))
                {
                    gi = CommunityContext.CurrentGroup;
                }
                else
                {
                    gi = GroupInfoProvider.GetGroupInfo(GroupName, CMSContext.CurrentSiteName);
                }

                if (gi != null)
                {
                    // Data source properties
                    forumDataSource.TopN              = SelectTopN;
                    forumDataSource.OrderBy           = OrderBy;
                    forumDataSource.CacheItemName     = CacheItemName;
                    forumDataSource.CacheDependencies = CacheDependencies;
                    forumDataSource.CacheMinutes      = CacheMinutes;
                    forumDataSource.SelectedColumns   = Columns;
                    forumDataSource.FilterName        = FilterName;

                    #region "Repeater template properties"

                    // Apply transformations if they exist
                    repLatestPosts.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName, false);

                    if (!String.IsNullOrEmpty(AlternatingItemTransformationName))
                    {
                        repLatestPosts.AlternatingItemTemplate = CMSDataProperties.LoadTransformation(this, AlternatingItemTransformationName, false);
                    }
                    if (!String.IsNullOrEmpty(FooterTransformationName))
                    {
                        repLatestPosts.FooterTemplate = CMSDataProperties.LoadTransformation(this, FooterTransformationName, false);
                    }
                    if (!String.IsNullOrEmpty(HeaderTransformationName))
                    {
                        repLatestPosts.HeaderTemplate = CMSDataProperties.LoadTransformation(this, HeaderTransformationName, false);
                    }
                    if (!String.IsNullOrEmpty(SeparatorTransformationName))
                    {
                        repLatestPosts.SeparatorTemplate = CMSDataProperties.LoadTransformation(this, SeparatorTransformationName, false);
                    }

                    #endregion

                    // UniPager properties
                    pagerElem.PageSize       = PageSize;
                    pagerElem.GroupSize      = GroupSize;
                    pagerElem.QueryStringKey = QueryStringKey;
                    pagerElem.DisplayFirstLastAutomatically    = DisplayFirstLastAutomatically;
                    pagerElem.DisplayPreviousNextAutomatically = DisplayPreviousNextAutomatically;
                    pagerElem.HidePagerForSinglePage           = HidePagerForSinglePage;

                    switch (PagingMode.ToLower())
                    {
                    case "postback":
                        pagerElem.PagerMode = UniPagerMode.PostBack;
                        break;

                    default:
                        pagerElem.PagerMode = UniPagerMode.Querystring;
                        break;
                    }

                    #region "UniPager template properties"

                    // UniPager template properties
                    if (!String.IsNullOrEmpty(PagesTemplate))
                    {
                        pagerElem.PageNumbersTemplate = CMSDataProperties.LoadTransformation(pagerElem, PagesTemplate, false);
                    }

                    if (!String.IsNullOrEmpty(CurrentPageTemplate))
                    {
                        pagerElem.CurrentPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, CurrentPageTemplate, false);
                    }

                    if (!String.IsNullOrEmpty(SeparatorTemplate))
                    {
                        pagerElem.PageNumbersSeparatorTemplate = CMSDataProperties.LoadTransformation(pagerElem, SeparatorTemplate, false);
                    }

                    if (!String.IsNullOrEmpty(FirstPageTemplate))
                    {
                        pagerElem.FirstPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, FirstPageTemplate, false);
                    }

                    if (!String.IsNullOrEmpty(LastPageTemplate))
                    {
                        pagerElem.LastPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, LastPageTemplate, false);
                    }

                    if (!String.IsNullOrEmpty(PreviousPageTemplate))
                    {
                        pagerElem.PreviousPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousPageTemplate, false);
                    }

                    if (!String.IsNullOrEmpty(NextPageTemplate))
                    {
                        pagerElem.NextPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextPageTemplate, false);
                    }

                    if (!String.IsNullOrEmpty(PreviousGroupTemplate))
                    {
                        pagerElem.PreviousGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousGroupTemplate, false);
                    }

                    if (!String.IsNullOrEmpty(NextGroupTemplate))
                    {
                        pagerElem.NextGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextGroupTemplate, false);
                    }

                    if (!String.IsNullOrEmpty(DirectPageTemplate))
                    {
                        pagerElem.DirectPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, DirectPageTemplate, false);
                    }

                    if (!String.IsNullOrEmpty(LayoutTemplate))
                    {
                        pagerElem.LayoutTemplate = CMSDataProperties.LoadTransformation(pagerElem, LayoutTemplate, false);
                    }

                    #endregion

                    forumDataSource.WhereCondition   = WhereCondition;
                    forumDataSource.GroupID          = gi.GroupID;
                    forumDataSource.CheckPermissions = true;
                    forumDataSource.SiteName         = SiteName;
                    repLatestPosts.DataSource        = forumDataSource.DataSource;

                    if (!DataHelper.DataSourceIsEmpty(repLatestPosts.DataSource))
                    {
                        repLatestPosts.DataBind();
                    }
                }
                else
                {
                    forumDataSource.StopProcessing = true;
                }
            }

            ReleaseContext();
        }
    }
Example #29
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            repUsers.DataBindByDefault = false;
            pagerElem.PageControl      = repUsers.ID;

            filterUsers.Visible          = ShowFilterControl;
            filterUsers.OnFilterChanged += filterUsers_OnFilterChanged;
            srcUsers.OnFilterChanged    += filterUsers_OnFilterChanged;

            // Basic control properties
            repUsers.HideControlForZeroRows = HideControlForZeroRows;
            repUsers.ZeroRowsText           = ZeroRowsText;

            // Data source properties
            srcUsers.WhereCondition     = WhereCondition;
            srcUsers.OrderBy            = OrderBy;
            srcUsers.TopN               = SelectTopN;
            srcUsers.SelectedColumns    = Columns;
            srcUsers.SiteName           = SiteName;
            srcUsers.FilterName         = filterUsers.ID;
            srcUsers.SourceFilterName   = FilterName;
            srcUsers.CacheItemName      = CacheItemName;
            srcUsers.CacheDependencies  = CacheDependencies;
            srcUsers.CacheMinutes       = CacheMinutes;
            srcUsers.SelectOnlyApproved = SelectOnlyApproved;
            srcUsers.SelectHidden       = SelectHidden;

            // Init data properties
            filterUsers.InitDataProperties(srcUsers);


            #region "Repeater template properties"

            // Apply transformations if they exist
            if (!String.IsNullOrEmpty(TransformationName))
            {
                repUsers.ItemTemplate = CMSDataProperties.LoadTransformation(this, TransformationName, false);
            }
            if (!String.IsNullOrEmpty(AlternatingItemTransformationName))
            {
                repUsers.AlternatingItemTemplate = CMSDataProperties.LoadTransformation(this, AlternatingItemTransformationName, false);
            }
            if (!String.IsNullOrEmpty(FooterTransformationName))
            {
                repUsers.FooterTemplate = CMSDataProperties.LoadTransformation(this, FooterTransformationName, false);
            }
            if (!String.IsNullOrEmpty(HeaderTransformationName))
            {
                repUsers.HeaderTemplate = CMSDataProperties.LoadTransformation(this, HeaderTransformationName, false);
            }
            if (!String.IsNullOrEmpty(SeparatorTransformationName))
            {
                repUsers.SeparatorTemplate = CMSDataProperties.LoadTransformation(this, SeparatorTransformationName, false);
            }

            #endregion


            // UniPager properties
            pagerElem.PageSize       = PageSize;
            pagerElem.GroupSize      = GroupSize;
            pagerElem.QueryStringKey = QueryStringKey;
            pagerElem.DisplayFirstLastAutomatically    = DisplayFirstLastAutomatically;
            pagerElem.DisplayPreviousNextAutomatically = DisplayPreviousNextAutomatically;
            pagerElem.HidePagerForSinglePage           = HidePagerForSinglePage;
            pagerElem.Enabled = EnablePaging;

            switch (PagingMode.ToLowerCSafe())
            {
            case "querystring":
                pagerElem.PagerMode = UniPagerMode.Querystring;
                break;

            default:
                pagerElem.PagerMode = UniPagerMode.PostBack;
                break;
            }


            #region "UniPager template properties"

            // UniPager template properties
            if (!String.IsNullOrEmpty(PagesTemplate))
            {
                pagerElem.PageNumbersTemplate = CMSDataProperties.LoadTransformation(pagerElem, PagesTemplate, false);
            }

            if (!String.IsNullOrEmpty(CurrentPageTemplate))
            {
                pagerElem.CurrentPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, CurrentPageTemplate, false);
            }

            if (!String.IsNullOrEmpty(SeparatorTemplate))
            {
                pagerElem.PageNumbersSeparatorTemplate = CMSDataProperties.LoadTransformation(pagerElem, SeparatorTemplate, false);
            }

            if (!String.IsNullOrEmpty(FirstPageTemplate))
            {
                pagerElem.FirstPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, FirstPageTemplate, false);
            }

            if (!String.IsNullOrEmpty(LastPageTemplate))
            {
                pagerElem.LastPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, LastPageTemplate, false);
            }

            if (!String.IsNullOrEmpty(PreviousPageTemplate))
            {
                pagerElem.PreviousPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousPageTemplate, false);
            }

            if (!String.IsNullOrEmpty(NextPageTemplate))
            {
                pagerElem.NextPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextPageTemplate, false);
            }

            if (!String.IsNullOrEmpty(PreviousGroupTemplate))
            {
                pagerElem.PreviousGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, PreviousGroupTemplate, false);
            }

            if (!String.IsNullOrEmpty(NextGroupTemplate))
            {
                pagerElem.NextGroupTemplate = CMSDataProperties.LoadTransformation(pagerElem, NextGroupTemplate, false);
            }

            if (!String.IsNullOrEmpty(DirectPageTemplate))
            {
                pagerElem.DirectPageTemplate = CMSDataProperties.LoadTransformation(pagerElem, DirectPageTemplate, false);
            }

            if (!String.IsNullOrEmpty(LayoutTemplate))
            {
                pagerElem.LayoutTemplate = CMSDataProperties.LoadTransformation(pagerElem, LayoutTemplate, false);
            }

            #endregion


            // Connects repeater with data source
            repUsers.DataSource = srcUsers.DataSource;
            repUsers.DataBind();
        }
    }
Example #30
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 = CMSDataProperties.LoadTransformation(this, TransformationName, false);
                transLoaded           = true;
            }

            if ((transLoaded) || (!String.IsNullOrEmpty(Path)))
            {
                // Try to get data from cache
                using (CachedSection <DataSet> cs = new CachedSection <DataSet>(ref users, this.CacheMinutes, true, this.CacheItemName, "onlineusers", CMSContext.CurrentSiteName, SelectTopN, Columns, Path))
                {
                    if (cs.LoadData)
                    {
                        // Get the data
                        users = SessionManager.GetOnlineUsers(null, null, SelectTopN, Columns, CMSContext.ResolveCurrentPath(Path), CMSContext.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 = this.CacheItemName;
            if (!string.IsNullOrEmpty(cacheItemNameNumbers))
            {
                cacheItemNameNumbers += "Number";
            }

            // Try to get data from cache
            using (CachedSection <string> cs = new CachedSection <string>(ref numbers, this.CacheMinutes, true, cacheItemNameNumbers, "onlineusersnumber", CMSContext.CurrentSiteName, Path))
            {
                if (cs.LoadData)
                {
                    // Get the data
                    SessionManager.GetUsersNumber(CurrentSiteName, CMSContext.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
                {
                    // 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();
    }