using System; using System.Data; using System.Collections; using System.Web; using System.Web.UI; using CMS.GlobalHelper; using CMS.PortalControls; public partial class CMSWebParts_ContentRating_ContentRating : CMSAbstractWebPart { #region "Properties" /// /// Gets or sets max value of scale. /// public int MaxRatingValue { get { return ValidationHelper.GetInteger(GetValue("MaxRatingValue"), elemRating.MaxRatingValue); } set { SetValue("MaxRatingValue", value); } } /// /// Gets or sets value that indicates whether unrated value is allowed. /// public bool AllowZeroValue { get { return ValidationHelper.GetBoolean(GetValue("AllowZeroValue"), elemRating.AllowZeroValue); } set { SetValue("AllowZeroValue", value); } } /// /// Gets or sets current value. If value is negative number then document /// rating is used. /// public string ExternalValue { get { return ValidationHelper.GetString(GetValue("ExternalValue"), elemRating.ExternalValue); } set { SetValue("ExternalValue", value); } } /// /// Code name of control that manages rating scale. /// public string RatingType { get { return ValidationHelper.GetString(GetValue("RatingType"), elemRating.RatingType); } set { SetValue("RatingType", value); } } /// /// If true the brief result info is shown. /// public bool ShowResultMessage { get { return ValidationHelper.GetBoolean(GetValue("ShowResultMessage"), elemRating.ShowResultMessage); } set { SetValue("ShowResultMessage", value); } } /// /// Gets or sets result info message. /// public string ResultMessage { get { return ValidationHelper.GetString(GetValue("ResultMessage"), elemRating.ResultMessage); } set { SetValue("ResultMessage", value); } } /// /// Gets or sets message that is displayed after rating. /// public string MessageAfterRating { get { return ValidationHelper.GetString(GetValue("MessageAfterRating"), elemRating.MessageAfterRating); } set { SetValue("MessageAfterRating", value); } } /// /// Gets or sets message that is displayed when user forgot to rate. /// public string ErrorMessage { get { return ValidationHelper.GetString(GetValue("ErrorMessage"), elemRating.ErrorMessage); } set { SetValue("ErrorMessage", value); } } /// /// Gets or sets value that indicates wheter rating is allowed for public users. /// public bool AllowForPublic { get { return ValidationHelper.GetBoolean(GetValue("AllowForPublic"), elemRating.AllowForPublic); } set { SetValue("AllowForPublic", value); } } /// /// Enables/disables checking if user rated. /// public bool CheckIfUserRated { get { return ValidationHelper.GetBoolean(GetValue("CheckIfUserRated"), elemRating.CheckIfUserRated); } set { SetValue("CheckIfUserRated", value); } } /// /// If true, the control is hidden when user is not authorized. /// public bool HideToUnauthorizedUsers { get { return ValidationHelper.GetBoolean(GetValue("HideToUnauthorizedUsers"), elemRating.HideToUnauthorizedUsers); } set { SetValue("HideToUnauthorizedUsers", value); } } /// /// Gets or sets the value that determines whether permissions are checked. /// public bool CheckPermissions { get { return ValidationHelper.GetBoolean(GetValue("CheckPermissions"), elemRating.CheckPermissions); } set { SetValue("CheckPermissions", value); elemRating.CheckPermissions = value; } } #endregion #region "Methods" /// /// Content loaded event handler. /// public override void OnContentLoaded() { base.OnContentLoaded(); SetupControl(); } /// /// Initializes the control properties. /// protected void SetupControl() { if (StopProcessing) { elemRating.StopProcessing = true; } else { elemRating.MaxRatingValue = MaxRatingValue; elemRating.RatingType = RatingType; elemRating.ShowResultMessage = ShowResultMessage; elemRating.ResultMessage = ResultMessage; elemRating.MessageAfterRating = MessageAfterRating; elemRating.AllowForPublic = AllowForPublic; elemRating.CheckIfUserRated = CheckIfUserRated; elemRating.HideToUnauthorizedUsers = HideToUnauthorizedUsers; elemRating.CheckPermissions = CheckPermissions; elemRating.ExternalValue = ExternalValue; elemRating.AllowZeroValue = AllowZeroValue; elemRating.ErrorMessage = ErrorMessage; } } /// /// Reload data. /// public override void ReloadData() { base.ReloadData(); SetupControl(); } #endregion }