コード例 #1
0
    /// <summary>
    /// Initializes the controls.
    /// </summary>
    private void SetupControls()
    {
        // If the web part shouldn't proceed further
        if (StopProcessing)
        {
            msgBoard.BoardProperties.StopProcessing = true;
            Visible = false;
        }
        else
        {
            // Set the message board transformation
            msgBoard.MessageTransformation = MessageTransformation;

            // Set sorting
            msgBoard.OrderBy = String.IsNullOrEmpty(OrderBy) ? "MessageInserted DESC" : OrderBy;

            // Set buttons
            msgBoard.BoardProperties.ShowApproveButton = ShowApprove;
            msgBoard.BoardProperties.ShowDeleteButton  = ShowDelete;
            msgBoard.BoardProperties.ShowEditButton    = ShowEdit;
            msgBoard.BoardProperties.ShowRejectButton  = ShowReject;

            // Set fields
            msgBoard.FormResourcePrefix             = ResourcePrefix;
            msgBoard.BoardProperties.ShowNameField  = ShowNameField;
            msgBoard.BoardProperties.ShowEmailField = ShowEmailField;
            msgBoard.BoardProperties.ShowURLField   = ShowURLField;

            // Set rating
            msgBoard.BoardProperties.EnableContentRating = EnableContentRating;
            msgBoard.BoardProperties.RatingType          = RatingType;
            msgBoard.BoardProperties.MaxRatingValue      = MaxRatingValue;
            msgBoard.BoardProperties.AllowEmptyRating    = AllowEmptyRating;
            msgBoard.BoardProperties.CheckIfUserRated    = CheckIfUserRated;

            // Set caching
            msgBoard.CacheItemName     = CacheItemName;
            msgBoard.CacheMinutes      = CacheMinutes;
            msgBoard.CacheDependencies = CacheDependencies;

            // Set web part only properties
            msgBoard.BoardProperties.BoardEnableAnonymousRead = EnableAnonymousRead;
            msgBoard.BoardProperties.CheckPermissions         = CheckPermissions;
            msgBoard.NoMessagesText = NoMessagesText;

            // Use board properties
            if (BoardObj != null)
            {
                msgBoard.BoardProperties.BoardAccess      = BoardObj.BoardAccess;
                msgBoard.BoardProperties.BoardName        = BoardObj.BoardName;
                msgBoard.BoardProperties.BoardDisplayName = BoardObj.BoardDisplayName;

                msgBoard.BoardProperties.BoardUnsubscriptionUrl   = BoardInfoProvider.GetUnsubscriptionUrl(BoardObj.BoardUnsubscriptionURL, SiteContext.CurrentSiteName);
                msgBoard.BoardProperties.BoardBaseUrl             = (string.IsNullOrEmpty(BoardObj.BoardBaseURL)) ? ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSBoardBaseURL"), "") : BoardObj.BoardBaseURL;
                msgBoard.BoardProperties.BoardEnableSubscriptions = BoardObj.BoardEnableSubscriptions;
                msgBoard.BoardProperties.BoardOpened        = BoardObj.BoardOpened;
                msgBoard.BoardProperties.BoardRequireEmails = BoardObj.BoardRequireEmails;
                msgBoard.BoardProperties.BoardModerated     = BoardObj.BoardModerated;
                msgBoard.BoardProperties.BoardUseCaptcha    = BoardObj.BoardUseCaptcha;
                msgBoard.BoardProperties.BoardOpenedFrom    = BoardObj.BoardOpenedFrom;
                msgBoard.BoardProperties.BoardOpenedTo      = BoardObj.BoardOpenedTo;
                msgBoard.MessageBoardID = BoardObj.BoardID;
            }
            // Use default properties
            else
            {
                // If the board is user and information on current user wasn't supplied hide the web part
                if (((BoardOwner == "user") && (CurrentUser == null)))
                {
                    if (!String.IsNullOrEmpty(NoMessagesText))
                    {
                        msgBoard.NoMessagesText = NoMessagesText;
                    }
                    Visible = false;
                }
                else
                {
                    // Default board- document related continue
                    msgBoard.BoardProperties.BoardAccess = BoardAccess;
                    msgBoard.BoardProperties.BoardOwner  = BoardOwner;
                    msgBoard.BoardProperties.BoardName   = GetBoardName(WebPartName, BoardOwner);

                    string boardDisplayName;
                    if (!String.IsNullOrEmpty(BoardDisplayName))
                    {
                        boardDisplayName = BoardDisplayName;
                    }
                    // Use predefined display name format
                    else
                    {
                        boardDisplayName = DocumentContext.CurrentPageInfo.GetDocumentName() + " (" + DocumentContext.CurrentPageInfo.DocumentNamePath + ")";
                    }
                    // Limit display name length
                    msgBoard.BoardProperties.BoardDisplayName = TextHelper.LimitLength(boardDisplayName, 250, "");

                    msgBoard.BoardProperties.BoardUnsubscriptionUrl   = BoardInfoProvider.GetUnsubscriptionUrl(BoardUnsubscriptionUrl, SiteContext.CurrentSiteName);
                    msgBoard.BoardProperties.BoardBaseUrl             = (string.IsNullOrEmpty(BoardBaseUrl)) ? ValidationHelper.GetString(SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSBoardBaseURL"), "") : BoardBaseUrl;
                    msgBoard.BoardProperties.BoardEnableSubscriptions = BoardEnableSubscriptions;
                    msgBoard.BoardProperties.BoardOpened        = BoardOpened;
                    msgBoard.BoardProperties.BoardRequireEmails = BoardRequireEmails;
                    msgBoard.BoardProperties.BoardModerated     = BoardModerated;
                    msgBoard.BoardProperties.BoardRoles         = BoardRoles;
                    msgBoard.BoardProperties.BoardModerators    = BoardModerators;
                    msgBoard.BoardProperties.BoardUseCaptcha    = BoardUseCaptcha;
                    msgBoard.BoardProperties.BoardOpenedFrom    = BoardOpenedFrom;
                    msgBoard.BoardProperties.BoardOpenedTo      = BoardOpenedTo;
                    msgBoard.BoardProperties.BoardLogActivity   = LogActivity;
                    msgBoard.MessageBoardID = 0;
                }
            }
        }
    }
コード例 #2
0
    /// <summary>
    /// Initializes the controls.
    /// </summary>
    private void SetupControls()
    {
        // If the web part shouldn't proceed further
        if (this.StopProcessing)
        {
            this.msgBoard.BoardProperties.StopProcessing = true;
            this.Visible = false;
        }
        else
        {
            // Set the message board transformation
            this.msgBoard.MessageTransformation = this.MessageTransformation;

            // Set buttons
            this.msgBoard.BoardProperties.ShowApproveButton = this.ShowApprove;
            this.msgBoard.BoardProperties.ShowDeleteButton  = this.ShowDelete;
            this.msgBoard.BoardProperties.ShowEditButton    = this.ShowEdit;
            this.msgBoard.BoardProperties.ShowRejectButton  = this.ShowReject;

            // Set caching
            this.msgBoard.CacheItemName     = this.CacheItemName;
            this.msgBoard.CacheMinutes      = this.CacheMinutes;
            this.msgBoard.CacheDependencies = this.CacheDependencies;

            // Use board properties
            if (this.BoardObj != null)
            {
                this.msgBoard.BoardProperties.BoardAccess      = this.BoardObj.BoardAccess;
                this.msgBoard.BoardProperties.BoardOwner       = "group";
                this.msgBoard.BoardProperties.BoardName        = this.BoardObj.BoardName;
                this.msgBoard.BoardProperties.BoardDisplayName = this.BoardObj.BoardDisplayName;

                this.msgBoard.BoardProperties.BoardUnsubscriptionUrl   = BoardInfoProvider.GetUnsubscriptionUrl(this.BoardObj.BoardUnsubscriptionURL, CMSContext.CurrentSiteName);
                this.msgBoard.BoardProperties.BoardBaseUrl             = (string.IsNullOrEmpty(this.BoardObj.BoardBaseURL)) ? ValidationHelper.GetString(SettingsKeyProvider.GetStringValue(CMSContext.CurrentSiteName + ".CMSBoardBaseURL"), "") : this.BoardObj.BoardBaseURL;
                this.msgBoard.BoardProperties.BoardEnableSubscriptions = this.BoardObj.BoardEnableSubscriptions;
                this.msgBoard.BoardProperties.BoardOpened              = this.BoardObj.BoardOpened;
                this.msgBoard.BoardProperties.BoardRequireEmails       = this.BoardObj.BoardRequireEmails;
                this.msgBoard.BoardProperties.BoardModerated           = this.BoardObj.BoardModerated;
                this.msgBoard.BoardProperties.BoardUseCaptcha          = this.BoardObj.BoardUseCaptcha;
                this.msgBoard.BoardProperties.BoardOpenedFrom          = this.BoardObj.BoardOpenedFrom;
                this.msgBoard.BoardProperties.BoardOpenedTo            = this.BoardObj.BoardOpenedTo;
                this.msgBoard.BoardProperties.BoardEnableAnonymousRead = this.EnableAnonymousRead;
                this.msgBoard.BoardProperties.EnableContentRating      = this.EnableContentRating;
                this.msgBoard.BoardProperties.CheckPermissions         = this.CheckPermissions;
                this.msgBoard.BoardProperties.RatingType     = this.RatingType;
                this.msgBoard.BoardProperties.MaxRatingValue = this.MaxRatingValue;
                this.msgBoard.MessageBoardID = this.BoardObj.BoardID;
                this.msgBoard.NoMessagesText = this.NoMessagesText;
            }
            // Use default properties
            else
            {
                // If the board is group and information on current group wasn't supplied hide the web part
                if (this.CurrentGroup == null)
                {
                    this.Visible = false;
                }
                else
                {
                    // Default board- document related continue
                    this.msgBoard.BoardProperties.BoardAccess = this.BoardAccess;
                    this.msgBoard.BoardProperties.BoardOwner  = "group";
                    this.msgBoard.BoardProperties.BoardName   = GetBoardName(this.WebPartName);

                    string boardDisplayName = null;
                    if (!String.IsNullOrEmpty(this.BoardDisplayName))
                    {
                        boardDisplayName = this.BoardDisplayName;
                    }
                    // Use predefined display name format
                    else
                    {
                        boardDisplayName = CMSContext.CurrentPageInfo.DocumentName + " (" + CMSContext.CurrentPageInfo.DocumentNamePath + ")";
                    }
                    // Limit display name length
                    this.msgBoard.BoardProperties.BoardDisplayName = TextHelper.LimitLength(boardDisplayName, 250, "");

                    this.msgBoard.BoardProperties.BoardUnsubscriptionUrl   = BoardInfoProvider.GetUnsubscriptionUrl(this.BoardUnsubscriptionUrl, CMSContext.CurrentSiteName);
                    this.msgBoard.BoardProperties.BoardBaseUrl             = (string.IsNullOrEmpty(this.BoardBaseUrl)) ? ValidationHelper.GetString(SettingsKeyProvider.GetStringValue(CMSContext.CurrentSiteName + ".CMSBoardBaseURL"), "") : this.BoardBaseUrl;
                    this.msgBoard.BoardProperties.BoardEnableSubscriptions = this.BoardEnableSubscriptions;
                    this.msgBoard.BoardProperties.BoardOpened              = this.BoardOpened;
                    this.msgBoard.BoardProperties.BoardRequireEmails       = this.BoardRequireEmails;
                    this.msgBoard.BoardProperties.BoardModerated           = this.BoardModerated;
                    this.msgBoard.BoardProperties.BoardModerators          = this.BoardModerators;
                    this.msgBoard.BoardProperties.BoardUseCaptcha          = this.BoardUseCaptcha;
                    this.msgBoard.BoardProperties.BoardOpenedFrom          = this.BoardOpenedFrom;
                    this.msgBoard.BoardProperties.BoardOpenedTo            = this.BoardOpenedTo;
                    this.msgBoard.BoardProperties.BoardEnableAnonymousRead = this.EnableAnonymousRead;
                    this.msgBoard.BoardProperties.BoardLogActivity         = this.BoardLogActivity;
                    this.msgBoard.BoardProperties.EnableContentRating      = this.EnableContentRating;
                    this.msgBoard.BoardProperties.CheckPermissions         = this.CheckPermissions;
                    this.msgBoard.BoardProperties.RatingType     = this.RatingType;
                    this.msgBoard.BoardProperties.MaxRatingValue = this.MaxRatingValue;
                    this.msgBoard.MessageBoardID = 0;
                    this.msgBoard.NoMessagesText = this.NoMessagesText;
                }
            }
        }
    }