Beispiel #1
0
    /// <summary>
    /// OnPreview handler.
    /// </summary>
    protected void forumEdit_OnPreview(object sender, EventArgs e)
    {
        // Preview title
        ltrTitle.Text = GetString("Forums_ForumNewPost_Header.Preview");
        // Display placeholder
        plcPreview.Visible = true;

        // Post properties
        ForumPostInfo fpi = sender as ForumPostInfo;

        if (fpi != null)
        {
            ltrAvatar.Text   = AvatarImage(fpi);
            ltrSubject.Text  = HTMLHelper.HTMLEncode(fpi.PostSubject);
            ltrText.Text     = ResolvePostText(fpi.PostText);
            ltrUserName.Text = HTMLHelper.HTMLEncode(fpi.PostUserName);
            ltrTime.Text     = TimeZoneUIMethods.ConvertDateTime(fpi.PostTime, this).ToString();

            BadgeInfo bi            = null;
            string    badgeName     = null;
            string    badgeImageUrl = null;

            bi = BadgeInfoProvider.GetBadgeInfo(MembershipContext.AuthenticatedUser.UserSettings.UserBadgeID);
            if (bi != null)
            {
                badgeName     = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(bi.BadgeDisplayName));
                badgeImageUrl = HTMLHelper.HTMLEncode(bi.BadgeImageURL);
            }

            ltrBadge.Text = GetNotEmpty(badgeName, "<div class=\"Badge\">" + badgeName + "</div>", "<div class=\"Badge\">" + GetString("Forums.PublicBadge") + "</div>", ForumActionType.Badge) +
                            GetNotEmpty(badgeImageUrl, "<div class=\"BadgeImage\"><img alt=\"" + badgeName + "\" src=\"" + GetImageUrl(ValidationHelper.GetString(badgeImageUrl, "")) + "\" /></div>", "", ForumActionType.Badge);
        }
    }
Beispiel #2
0
    protected string GetDateRead(object messageReadDate)
    {
        DateTime messageRead = ValidationHelper.GetDateTime(messageReadDate, DateTimeHelper.ZERO_TIME);

        if (currentUserInfo == null)
        {
            currentUserInfo = MembershipContext.AuthenticatedUser;
        }
        if (currentSiteInfo == null)
        {
            currentSiteInfo = SiteContext.CurrentSite;
        }
        DateTime currentDateTime = ValidationHelper.GetDateTime(messageReadDate, DateTimeHelper.ZERO_TIME);

        if (messageRead != DateTimeHelper.ZERO_TIME)
        {
            if (IsLiveSite)
            {
                return(TimeZoneUIMethods.ConvertDateTime(currentDateTime, this).ToString());
            }

            return(TimeZoneHelper.ConvertToUserTimeZone(currentDateTime, true, currentUserInfo, currentSiteInfo));
        }

        return(GetString("Messaging.OutboxMessageUnread"));
    }
Beispiel #3
0
    protected object inboxGrid_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName.ToLowerCSafe())
        {
        case "messagesendernickname":
        case "messagesubject":
            // Avoid XSS
            return(HTMLHelper.HTMLEncode(Convert.ToString(parameter)));

        case "messagesent":
            if (currentUserInfo == null)
            {
                currentUserInfo = MembershipContext.AuthenticatedUser;
            }
            if (currentSiteInfo == null)
            {
                currentSiteInfo = SiteContext.CurrentSite;
            }
            DateTime currentDateTime = ValidationHelper.GetDateTime(parameter, DateTimeHelper.ZERO_TIME);
            if (IsLiveSite)
            {
                return(TimeZoneUIMethods.ConvertDateTime(currentDateTime, this));
            }
            else
            {
                return(TimeZoneHelper.ConvertToUserTimeZone(currentDateTime, true, currentUserInfo, currentSiteInfo));
            }
        }
        return(parameter);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsAdHocForum)
        {
            plcHeader.Visible = false;
        }

        // Check whether subscription is for forum or post
        if (ForumContext.CurrentSubscribeThread == null)
        {
            ltrTitle.Text = GetString("ForumSubscription.SubscribeForum");
        }
        else
        {
            plcPreview.Visible = true;

            ltrTitle.Text = GetString("ForumSubscription.SubscribePost");

            ltrAvatar.Text   = AvatarImage(ForumContext.CurrentSubscribeThread);
            ltrSubject.Text  = HTMLHelper.HTMLEncode(ForumContext.CurrentSubscribeThread.PostSubject);
            ltrText.Text     = ResolvePostText(ForumContext.CurrentSubscribeThread.PostText);
            ltrUserName.Text = HTMLHelper.HTMLEncode(ForumContext.CurrentSubscribeThread.PostUserName);
            ltrTime.Text     = TimeZoneUIMethods.ConvertDateTime(ForumContext.CurrentSubscribeThread.PostTime, this).ToString();
        }
    }
    /// <summary>
    /// Reloads the form data.
    /// </summary>
    public override void ReloadData()
    {
        base.ReloadData();

        if (MessageID > 0)
        {
            messageInfo = BoardMessageInfoProvider.GetBoardMessageInfo(MessageID);
            if (messageInfo != null)
            {
                EditedObject = messageInfo;

                // Check whether edited message belongs to a board from current site
                if ((Board != null) && (Board.BoardSiteID != SiteContext.CurrentSiteID))
                {
                    EditedObject = null;
                }

                // Set textfields and checkboxes
                txtEmail.Text       = messageInfo.MessageEmail;
                txtMessage.Text     = messageInfo.MessageText;
                txtURL.Text         = messageInfo.MessageURL;
                txtUserName.Text    = messageInfo.MessageUserName;
                chkApproved.Checked = messageInfo.MessageApproved;
                chkSpam.Checked     = messageInfo.MessageIsSpam;
                lblInserted.Text    = TimeZoneUIMethods.ConvertDateTime(messageInfo.MessageInserted, this).ToString();
            }
        }
        else
        {
            ClearForm();
        }
    }
Beispiel #6
0
    protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName)
        {
        case "remove":
            if (sender is CMSGridActionButton)
            {
                // Get action button
                CMSGridActionButton deleteBtn = (CMSGridActionButton)sender;
                deleteBtn.Enabled = friendsManagePermission;

                return(deleteBtn);
            }
            else
            {
                return(string.Empty);
            }

        case "approve":
            if (sender is CMSGridActionButton)
            {
                // Get action button
                CMSGridActionButton approveBtn = (CMSGridActionButton)sender;
                // Get full row view
                DataRowView drv = UniGridFunctions.GetDataRowView((DataControlFieldCell)approveBtn.Parent);
                // Add custom reject action
                approveBtn.OnClientClick = "return FM_Approve_" + ClientID + "('" + drv["FriendID"] + "',null,'" + ApproveDialogUrl + "');";
                approveBtn.Enabled       = friendsManagePermission;
                return(approveBtn);
            }
            else
            {
                return(string.Empty);
            }

        case "friendrejectedwhen":
            if (currentUserInfo == null)
            {
                currentUserInfo = MembershipContext.AuthenticatedUser;
            }
            if (currentSiteInfo == null)
            {
                currentSiteInfo = SiteContext.CurrentSite;
            }
            DateTime currentDateTime = ValidationHelper.GetDateTime(parameter, DateTimeHelper.ZERO_TIME);
            if (IsLiveSite)
            {
                return(TimeZoneUIMethods.ConvertDateTime(currentDateTime, this));
            }
            else
            {
                return(TimeZoneHelper.ConvertToUserTimeZone(currentDateTime, true, currentUserInfo, currentSiteInfo));
            }

        case "formattedusername":
            return(HTMLHelper.HTMLEncode(Functions.GetFormattedUserName(Convert.ToString(parameter), IsLiveSite)));
        }
        return(parameter);
    }
Beispiel #7
0
    /// <summary>
    /// Loads the data.
    /// </summary>
    private void LoadData()
    {
        // Get the forum post
        ForumPostInfo fpi = ForumPostInfoProvider.GetForumPostInfo(ValidationHelper.GetInteger(PostID, 0));
        ForumInfo     fi  = null;

        if (fpi != null)
        {
            fi = ForumInfoProvider.GetForumInfo(fpi.PostForumID);
        }
        else
        {
            return;
        }

        if (fi.ForumEnableAdvancedImage)
        {
            ltrText.AllowedControls = ControlsHelper.ALLOWED_FORUM_CONTROLS;
        }
        else
        {
            ltrText.AllowedControls = "none";
        }

        // Display converted datetime for live site
        lblDate.Text = TimeZoneUIMethods.ConvertDateTime(ValidationHelper.GetDateTime(fpi.PostTime, DateTimeHelper.ZERO_TIME), this).ToString();

        lblUser.Text    = HTMLHelper.HTMLEncode(fpi.PostUserName);
        lblSubject.Text = HTMLHelper.HTMLEncode(fpi.PostSubject);

        DiscussionMacroResolver dmh = new DiscussionMacroResolver();

        dmh.EnableBold          = fi.ForumEnableFontBold;
        dmh.EnableItalics       = fi.ForumEnableFontItalics;
        dmh.EnableStrikeThrough = fi.ForumEnableFontStrike;
        dmh.EnableUnderline     = fi.ForumEnableFontUnderline;
        dmh.EnableCode          = fi.ForumEnableCodeSnippet;
        dmh.EnableColor         = fi.ForumEnableFontColor;
        dmh.EnableImage         = fi.ForumEnableImage || fi.ForumEnableAdvancedImage;
        dmh.EnableQuote         = fi.ForumEnableQuote;
        dmh.EnableURL           = fi.ForumEnableURL || fi.ForumEnableAdvancedURL;
        dmh.MaxImageSideSize    = fi.ForumImageMaxSideSize;
        dmh.QuotePostText       = GetString("DiscussionMacroResolver.QuotePostText");

        if (fi.ForumHTMLEditor)
        {
            dmh.EncodeText = false;
            dmh.ConvertLineBreaksToHTML = false;
        }
        else
        {
            dmh.EncodeText = true;
            dmh.ConvertLineBreaksToHTML = true;
        }

        // Resolve the macros and display the post text
        ltrText.Text = dmh.ResolveMacros(fpi.PostText);
    }
    protected object gridBoards_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName)
        {
        case "enabled":
            bool enabled = ValidationHelper.GetBoolean(parameter, false);

            return(UniGridFunctions.ColoredSpanYesNo(enabled));

        case "opened":
            bool opened = IsBoardOpened((DataRowView)parameter);

            return(UniGridFunctions.ColoredSpanYesNo(opened));

        case "moderated":
            bool moderated = ValidationHelper.GetBoolean(parameter, false);

            return(UniGridFunctions.ColoredSpanYesNo(moderated));

        case "document":
            DataRowView dr = parameter as DataRowView;
            if (dr != null)
            {
                // If the document path is empty alter it with the default '/'
                string   documentPath = ValidationHelper.GetString(dr["DocumentNamePath"], "");
                int      siteId       = ValidationHelper.GetInteger(dr["NodeSiteID"], 0);
                SiteInfo site         = SiteInfoProvider.GetSiteInfo(siteId);

                if (string.IsNullOrEmpty(documentPath))
                {
                    documentPath = "/";
                }

                if (site.Status == SiteStatusEnum.Running)
                {
                    int    nodeID  = ValidationHelper.GetInteger(dr["NodeID"], 0);
                    string culture = ValidationHelper.GetString(dr["DocumentCulture"], "");

                    return("<a class=\"js-unigrid-action js-viewDocument\"" +
                           "href=\"javascript:void(0)\" " +
                           "data-node-id=\"" + nodeID + "\" " +
                           "data-document-culture=\"" + culture + "\">" + HTMLHelper.HTMLEncode(documentPath) + "</a>");
                }
            }
            return("");

        case "lastpost":
            DateTime lastPost = ValidationHelper.GetDateTime(parameter, DateTimeHelper.ZERO_TIME);

            return(lastPost == DateTimeHelper.ZERO_TIME ? GetString("general.na") : TimeZoneUIMethods.ConvertDateTime(lastPost, this).ToString());

        default:
            return("");
        }
    }
    /// <summary>
    /// UniGrid external data bound.
    /// </summary>
    private object gridDocs_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        sourceName = sourceName.ToLowerCSafe();
        switch (sourceName)
        {
        // Column 'DocumentWorkflowStepID'
        case "documentworkflowstepid":
            int stepId = ValidationHelper.GetInteger(parameter, 0);
            if (stepId > 0)
            {
                // Get workflow step display name
                WorkflowStepInfo wsi = WorkflowStepInfo.Provider.Get(stepId);
                if (wsi != null)
                {
                    return(ResHelper.LocalizeString(wsi.StepDisplayName));
                }
            }
            break;

        case "documentmodifiedwhen":
        case "documentmodifiedwhentooltip":

            TimeZoneInfo tzi;

            // Get current time for user contribution list on live site
            string result = TimeZoneUIMethods.GetDateTimeForControl(this, ValidationHelper.GetDateTime(parameter, DateTimeHelper.ZERO_TIME), out tzi).ToString();

            // Display time zone shift if needed
            if ((tzi != null) && TimeZoneHelper.TimeZonesEnabled)
            {
                if (sourceName.EndsWithCSafe("tooltip"))
                {
                    result = TimeZoneHelper.GetUTCLongStringOffset(tzi);
                }
                else
                {
                    result += TimeZoneHelper.GetUTCStringOffset(tzi);
                }
            }
            return(result);

        // Action 'edit'
        case "edit":
            ((Control)sender).Visible = AllowEdit && CheckGroupPermission("editpages");
            break;

        // Action 'delete'
        case "delete":
            ((Control)sender).Visible = AllowDelete && CheckGroupPermission("deletepages");
            break;
        }

        return(parameter);
    }
Beispiel #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CopyValues(forumEdit);

        if (IsAdHocForum)
        {
            plcHeader.Visible = false;
        }

        forumEdit.OnPreview            += forumEdit_OnPreview;
        forumEdit.OnModerationRequired += new EventHandler(forumEdit_OnModerationRequired);

        // Check whether subscription is for forum or post
        if (ForumContext.CurrentReplyThread == null)
        {
            ltrTitle.Text = GetString("Forums_ForumNewPost_Header.NewThread");

            if (ForumContext.CurrentPost != null && ForumContext.CurrentMode == ForumMode.Edit)
            {
                ltrTitle.Text = GetString("Forums_ForumNewPost_Header.EditPost");
            }
        }
        else
        {
            plcPreview.Visible = true;
            ltrTitle.Text      = GetString("Forums_ForumNewPost_Header.Reply");
            ltrAvatar.Text     = AvatarImage(ForumContext.CurrentReplyThread);
            ltrSubject.Text    = HTMLHelper.HTMLEncode(ForumContext.CurrentReplyThread.PostSubject);
            ltrText.Text       = ResolvePostText(ForumContext.CurrentReplyThread.PostText);
            ltrUserName.Text   = HTMLHelper.HTMLEncode(ForumContext.CurrentReplyThread.PostUserName);
            ltrTime.Text       = TimeZoneUIMethods.ConvertDateTime(ForumContext.CurrentReplyThread.PostTime, this).ToString();

            UserSettingsInfo usi           = UserSettingsInfoProvider.GetUserSettingsInfoByUser(ForumContext.CurrentReplyThread.PostUserID);
            BadgeInfo        bi            = null;
            string           badgeName     = null;
            string           badgeImageUrl = null;

            if (usi != null)
            {
                bi = BadgeInfoProvider.GetBadgeInfo(usi.UserBadgeID);
                if (bi != null)
                {
                    badgeName     = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(bi.BadgeDisplayName));
                    badgeImageUrl = HTMLHelper.HTMLEncode(bi.BadgeImageURL);
                }
            }

            ltrBadge.Text = GetNotEmpty(badgeName, "<div class=\"Badge\">" + badgeName + "</div>", "<div class=\"Badge\">" + GetString("Forums.PublicBadge") + "</div>", ForumActionType.Badge) +
                            GetNotEmpty(badgeImageUrl, "<div class=\"BadgeImage\"><img alt=\"" + badgeName + "\" src=\"" + GetImageUrl(ValidationHelper.GetString(badgeImageUrl, "")) + "\" /></div>", "", ForumActionType.Badge);
        }
    }
Beispiel #11
0
    /// <summary>
    /// Reload data.
    /// </summary>
    public void LoadData()
    {
        if (Comment == null)
        {
            return;
        }

        SetUserPicture();

        if (!String.IsNullOrEmpty(Comment.CommentUrl))
        {
            lnkName.Text        = HTMLHelper.HTMLEncode(Comment.CommentUserName);
            lnkName.NavigateUrl = Comment.CommentUrl;

            AddRelAttribute();

            lblName.Visible = false;
        }
        else
        {
            lblName.Text    = HTMLHelper.HTMLEncode(Comment.CommentUserName);
            lnkName.Visible = false;
        }

        lblText.Text = HTMLHelper.HTMLEncodeLineBreaks(Comment.CommentText);
        lblDate.Text = TimeZoneUIMethods.ConvertDateTime(Comment.CommentDate, this).ToString();

        string url = "~/CMSModules/Blogs/Controls/Comment_Edit.aspx";

        if (IsLiveSite)
        {
            url = "~/CMSModules/Blogs/CMSPages/Comment_Edit.aspx";
        }

        lnkEdit.OnClientClick    = String.Format("EditComment('{0}?commentID={1}'); return false;", ResolveUrl(url), CommentID);
        lnkDelete.OnClientClick  = String.Format("if(ConfirmDelete()) {{ {0}; }} return false;", GetPostBackEventReference("delete"));
        lnkApprove.OnClientClick = String.Format("{0}; return false;", GetPostBackEventReference("approve"));
        lnkReject.OnClientClick  = String.Format("{0}; return false;", GetPostBackEventReference("reject"));

        // Initialize report abuse
        ucInlineAbuseReport.ReportTitle             = ResHelper.GetString("BlogCommentDetail.AbuseReport", CultureHelper.GetDefaultCultureCode(SiteContext.CurrentSiteName)) + Comment.CommentText;
        ucInlineAbuseReport.ReportObjectID          = CommentID;
        ucInlineAbuseReport.CMSPanel.Roles          = AbuseReportRoles;
        ucInlineAbuseReport.CMSPanel.SecurityAccess = AbuseReportSecurityAccess;
        ucInlineAbuseReport.CMSPanel.OwnerID        = AbuseReportOwnerID;
    }
Beispiel #12
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        // In design mode is pocessing of control stoped
        if (StopProcessing)
        {
            calItems.StopProcessing = true;
        }
        else
        {
            // Set properties from Webpart form
            calItems.CacheItemName             = CacheItemName;
            calItems.CacheDependencies         = CacheDependencies;
            calItems.CacheMinutes              = CacheMinutes;
            calItems.CheckPermissions          = CheckPermissions;
            calItems.ClassNames                = ClassNames;
            calItems.CategoryName              = CategoryName;
            calItems.CombineWithDefaultCulture = CombineWithDefaultCulture;

            calItems.CultureCode                = CultureCode;
            calItems.MaxRelativeLevel           = MaxRelativeLevel;
            calItems.OrderBy                    = OrderBy;
            calItems.Path                       = Path;
            calItems.RelatedNodeIsOnTheLeftSide = RelatedNodeIsOnTheLeftSide;

            calItems.RelationshipName         = RelationshipName;
            calItems.RelationshipWithNodeGuid = RelationshipWithNodeGuid;
            calItems.SelectOnlyPublished      = SelectOnlyPublished;
            calItems.SiteName = SiteName;

            calItems.TransformationName = TransformationName;
            calItems.WhereCondition     = WhereCondition;
            calItems.DayField           = DayField;
            calItems.FilterName         = FilterName;

            calItems.SelectedColumns = Columns;

            calItems.HideDefaultDayNumber      = HideDefaultDayNumber;
            calItems.DisplayOnlySingleDayItem  = DisplayOnlySingleDayItem;
            calItems.NoEventTransformationName = NoEventTransformationName;

            var currentDate = TimeZoneUIMethods.ConvertDateTime(DateTime.Now, this).Date;
            calItems.TodaysDate  = currentDate;
            calItems.VisibleDate = currentDate;
        }
    }
    /// <summary>
    /// Returns the approval text in format "date (approved by user full name)".
    /// </summary>
    /// <param name="date">Date time</param>
    /// <param name="userId">User id</param>
    private string GetApprovalInfoText(DateTime date, int userId)
    {
        string retval = "";

        if (date != DateTimeHelper.ZERO_TIME)
        {
            // Get current time
            retval = TimeZoneUIMethods.ConvertDateTime(date, this).ToString();

            UserInfo ui = UserInfoProvider.GetUserInfo(userId);
            if (ui != null)
            {
                // Add user's full name
                retval += " (" + HTMLHelper.HTMLEncode(ui.FullName) + ")";
            }
        }
        return(retval);
    }
    protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName.ToLowerCSafe())
        {
        case "messageisspam":
            return(UniGridFunctions.ColoredSpanYesNoReversed(parameter));

        case "edit":
            CMSGridActionButton editButton = ((CMSGridActionButton)sender);
            int boardID = ValidationHelper.GetInteger(((DataRowView)((GridViewRow)parameter).DataItem).Row["BoardID"], 0);

            string url = "~/CMSModules/MessageBoards/Tools/Messages/Message_Edit.aspx";
            if (IsLiveSite)
            {
                url = "~/CMSModules/MessageBoards/CMSPages/Message_Edit.aspx";
            }

            editButton.OnClientClick = "modalDialog('" + ApplicationUrlHelper.ResolveDialogUrl(((EditPageUrl == "") ? url : EditPageUrl)) +
                                       "?boardid=" + boardID + "&messageId=" + editButton.CommandArgument + "', 'MessageEdit', 800, 535); return false;";
            break;

        case "approve":
            bool approve = ValidationHelper.GetBoolean(((DataRowView)((GridViewRow)parameter).DataItem).Row["MessageApproved"], false);
            if (!approve)
            {
                CMSGridActionButton button = ((CMSGridActionButton)sender);
                button.IconCssClass = "icon-check-circle";
                button.IconStyle    = GridIconStyle.Allow;
                button.ToolTip      = GetString("general.approve");
            }
            else
            {
                CMSGridActionButton button = ((CMSGridActionButton)sender);
                button.IconCssClass = "icon-times-circle";
                button.IconStyle    = GridIconStyle.Critical;
                button.ToolTip      = GetString("general.reject");
            }
            break;

        case "messageinserted":
            return(TimeZoneUIMethods.ConvertDateTime(ValidationHelper.GetDateTime(parameter, DateTimeHelper.ZERO_TIME), this).ToString());
        }
        return(parameter);
    }
    private void GridView_DataBound(object sender, EventArgs e)
    {
        //convert boolean values from DB to user-friendly information strings in the list
        for (int i = 0; i < gridElem.GridView.Rows.Count; i++)
        {
            // Date time string
            string dateTime = String.Empty;

            // Change timezone for live site
            DateTime dt = TimeZoneUIMethods.ConvertDateTime(ValidationHelper.GetDateTime(gridElem.GridView.Rows[i].Cells[6].Text, DateTimeHelper.ZERO_TIME), this);
            if (dt != DateTimeHelper.ZERO_TIME)
            {
                dateTime = dt.ToString();
            }

            // Set value to the grid
            gridElem.GridView.Rows[i].Cells[6].Text = dateTime;
        }
    }
    /// <summary>
    /// Fills the data into form for specified Group member.
    /// </summary>
    private void HandleExistingMember(GroupMemberInfo groupMemberInfo)
    {
        if (groupMemberInfo != null)
        {
            // Fill controls with data from existing user
            int      userId = ValidationHelper.GetInteger(groupMemberInfo.MemberUserID, 0);
            UserInfo ui     = UserInfoProvider.GetUserInfo(userId);
            if (ui != null)
            {
                lblFullName.Text = HTMLHelper.HTMLEncode(ui.FullName);
            }

            txtComment.Text = groupMemberInfo.MemberComment;

            string approved = GetApprovalInfoText(groupMemberInfo.MemberApprovedWhen, groupMemberInfo.MemberApprovedByUserID);
            if (String.IsNullOrWhiteSpace(approved))
            {
                rowApproved.Visible = false;
            }
            else
            {
                lblMemberApproved.Text = approved;
                rowApproved.Visible    = true;
            }

            string rejected = GetApprovalInfoText(groupMemberInfo.MemberRejectedWhen, groupMemberInfo.MemberApprovedByUserID);
            if (String.IsNullOrWhiteSpace(rejected))
            {
                rowRejected.Visible = false;
            }
            else
            {
                lblMemberRejected.Text = rejected;
                rowRejected.Visible    = true;
            }

            lblMemberJoined.Text = TimeZoneUIMethods.ConvertDateTime(groupMemberInfo.MemberJoined, this).ToString();
        }
    }
    /// <summary>
    /// Fill form with the comment data.
    /// </summary>
    protected void LoadCommentData()
    {
        // Get comment info from database
        BlogCommentInfo bci = BlogCommentInfoProvider.GetBlogCommentInfo(mCommentId);

        if (bci != null)
        {
            txtName.Text        = bci.CommentUserName;
            txtUrl.Text         = bci.CommentUrl;
            txtComments.Text    = bci.CommentText;
            txtEmail.Text       = bci.CommentEmail;
            chkApproved.Checked = bci.CommentApproved;
            chkSpam.Checked     = bci.CommentIsSpam;

            if (PortalContext.ViewMode.IsLiveSite() && (MembershipContext.AuthenticatedUser != null))
            {
                lblInsertedDate.Text = TimeZoneUIMethods.ConvertDateTime(bci.CommentDate, this).ToString();
            }
            else
            {
                lblInsertedDate.Text = bci.CommentDate.ToString();
            }
        }
    }
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            calItems.StopProcessing = true;
        }
        else
        {
            calItems.ControlContext = repEvent.ControlContext = ControlContext;

            // Calendar properties
            calItems.CacheItemName = CacheItemName;

            calItems.CacheDependencies         = CacheDependencies;
            calItems.CacheMinutes              = CacheMinutes;
            calItems.CheckPermissions          = CheckPermissions;
            calItems.ClassNames                = ClassNames;
            calItems.CombineWithDefaultCulture = CombineWithDefaultCulture;

            calItems.CultureCode         = CultureCode;
            calItems.MaxRelativeLevel    = MaxRelativeLevel;
            calItems.OrderBy             = OrderBy;
            calItems.WhereCondition      = WhereCondition;
            calItems.Columns             = Columns;
            calItems.Path                = Path;
            calItems.SelectOnlyPublished = SelectOnlyPublished;
            calItems.SiteName            = SiteName;
            calItems.FilterName          = FilterName;

            calItems.RelationshipName           = RelationshipName;
            calItems.RelationshipWithNodeGuid   = RelationshipWithNodeGuid;
            calItems.RelatedNodeIsOnTheLeftSide = RelatedNodeIsOnTheLeftSide;

            calItems.TransformationName        = TransformationName;
            calItems.NoEventTransformationName = NoEventTransformationName;

            calItems.DayField             = DayField;
            calItems.EventEndField        = EventEndField;
            calItems.HideDefaultDayNumber = HideDefaultDayNumber;

            var currentDate = TimeZoneUIMethods.ConvertDateTime(DateTime.Now, this).Date;
            calItems.TodaysDate  = currentDate;
            calItems.VisibleDate = currentDate;

            bool detail = false;

            // If calendar event path is defined event is loaded in accordance to the selected path
            string eventPath = QueryHelper.GetString("CalendarEventPath", null);
            if (!String.IsNullOrEmpty(eventPath))
            {
                detail        = true;
                repEvent.Path = eventPath;

                // Set selected date to specific document
                TreeNode node = GetDocument(eventPath);
                if (node != null)
                {
                    object value = node.GetValue(DayField);
                    if (ValidationHelper.GetDateTimeSystem(value, DateTimeHelper.ZERO_TIME) != DateTimeHelper.ZERO_TIME)
                    {
                        calItems.TodaysDate = TimeZoneUIMethods.ConvertDateTime((DateTime)value, this);
                    }
                }
            }

            // By default select current event from current document value
            PageInfo currentPage = DocumentContext.CurrentPageInfo;
            if ((currentPage != null) && (ClassNames.IndexOf(currentPage.ClassName, StringComparison.InvariantCultureIgnoreCase) >= 0))
            {
                detail        = true;
                repEvent.Path = currentPage.NodeAliasPath;

                // Set selected date to current document
                object value = DocumentContext.CurrentDocument.GetValue(DayField);
                if (ValidationHelper.GetDateTimeSystem(value, DateTimeHelper.ZERO_TIME) != DateTimeHelper.ZERO_TIME)
                {
                    calItems.SelectedDate = TimeZoneUIMethods.ConvertDateTime((DateTime)value, this).Date;
                    calItems.VisibleDate  = calItems.SelectedDate;

                    // Get name of coupled class ID column
                    string idColumn = DocumentContext.CurrentDocument.CoupledClassIDColumn;
                    if (!string.IsNullOrEmpty(idColumn))
                    {
                        // Set selected item ID and the ID column name so it is possible to highlight specific event in the calendar
                        calItems.SelectedItemIDColumn = idColumn;
                        calItems.SelectedItemID       = ValidationHelper.GetInteger(DocumentContext.CurrentDocument.GetValue(idColumn), 0);
                    }
                }
            }

            if (detail)
            {
                // Setup the detail repeater
                repEvent.Visible        = true;
                repEvent.StopProcessing = false;

                repEvent.SelectedItemTransformationName = EventDetailTransformation;
                repEvent.ClassNames = ClassNames;
                repEvent.Columns    = Columns;

                if (!String.IsNullOrEmpty(CacheItemName))
                {
                    repEvent.CacheItemName = CacheItemName + "|detail";
                }

                repEvent.CacheDependencies         = CacheDependencies;
                repEvent.CacheMinutes              = CacheMinutes;
                repEvent.CheckPermissions          = CheckPermissions;
                repEvent.CombineWithDefaultCulture = CombineWithDefaultCulture;

                repEvent.CultureCode = CultureCode;

                repEvent.SelectOnlyPublished = SelectOnlyPublished;
                repEvent.SiteName            = SiteName;

                repEvent.WhereCondition = WhereCondition;
            }
        }
    }
Beispiel #19
0
    public void ReloadData()
    {
        if (StopProcessing)
        {
            // Do nothing
            MessageUserButtonsControl.StopProcessing = true;
            UserPictureControl.StopProcessing        = true;
        }
        else
        {
            MessageUserButtonsControl.StopProcessing = false;
            UserPictureControl.StopProcessing        = false;

            if (Message != null)
            {
                // Get current user info
                currentUserInfo = MembershipContext.AuthenticatedUser;
                // Get message user info
                if (MessageMode == MessageModeEnum.Inbox)
                {
                    messageUserInfo = UserInfoProvider.GetUserInfo(Message.MessageSenderUserID);
                }
                else
                {
                    messageUserInfo = UserInfoProvider.GetUserInfo(Message.MessageRecipientUserID);
                }

                // Display only to authorized user
                if ((currentUserInfo.UserID == Message.MessageRecipientUserID) ||
                    (currentUserInfo.UserID == Message.MessageSenderUserID) ||
                    currentUserInfo.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin))
                {
                    pnlViewMessage.Visible = true;
                    lblDateCaption.Text    = GetString("Messaging.Date");
                    lblSubjectCaption.Text = GetString("general.subject");
                    lblFromCaption.Text    = (MessageMode == MessageModeEnum.Inbox) ? GetString("Messaging.From") : GetString("Messaging.To");

                    // Sender exists
                    if (messageUserInfo != null)
                    {
                        UserPictureControl.Visible = true;
                        UserPictureControl.UserID  = messageUserInfo.UserID;

                        // Gravatar support
                        string avType = SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSAvatarType");
                        if (avType == AvatarInfoProvider.USERCHOICE)
                        {
                            avType = messageUserInfo.UserSettings.UserAvatarType;
                        }

                        UserPictureControl.UserAvatarType = avType;

                        // Disable message user buttons on live site for hidden or disabled users
                        if (IsLiveSite && !currentUserInfo.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin) && (messageUserInfo.UserIsDisabledManually || messageUserInfo.UserIsHidden))
                        {
                            MessageUserButtonsControl.RelatedUserId = 0;
                        }
                        else
                        {
                            MessageUserButtonsControl.RelatedUserId = messageUserInfo.UserID;
                        }
                        lblFrom.Text = HTMLHelper.HTMLEncode(Functions.GetFormattedUserName(messageUserInfo.UserName, messageUserInfo.FullName, messageUserInfo.UserNickName, IsLiveSite));
                    }
                    else
                    {
                        MessageUserButtonsControl.RelatedUserId = 0;
                        lblFrom.Text = HTMLHelper.HTMLEncode(Message.MessageSenderNickName);
                    }
                    string body = Message.MessageBody;
                    // Resolve macros
                    DiscussionMacroResolver dmh = new DiscussionMacroResolver();
                    body = dmh.ResolveMacros(body);

                    lblSubject.Text = HTMLHelper.HTMLEncodeLineBreaks(Message.MessageSubject);
                    if (IsLiveSite)
                    {
                        lblDate.Text = TimeZoneUIMethods.ConvertDateTime(Message.MessageSent, this).ToString();
                    }
                    else
                    {
                        lblDate.Text = TimeZoneHelper.ConvertToUserTimeZone(Message.MessageSent, true, currentUserInfo, SiteContext.CurrentSite);
                    }
                    lblBody.Text = body;
                }
            }
            else
            {
                ShowError(GetString("Messaging.MessageDoesntExist"));
            }
        }
    }
Beispiel #20
0
    /// <summary>
    /// Reload data.
    /// </summary>
    public override void ReloadData()
    {
        ForumPostInfo fpi = null;
        ForumInfo     fi;


        #region "Load data"

        if (PostData != null)
        {
            fpi = ForumPostInfo.New(PostData);
        }

        if (fpi == null)
        {
            fpi = PostInfo;
        }

        if (fpi != null)
        {
            PostData = fpi;
            fi       = ForumInfoProvider.GetForumInfo(fpi.PostForumID);
        }
        else
        {
            return;
        }

        #endregion


        if (fi.ForumEnableAdvancedImage)
        {
            ltlText.AllowedControls = ControlsHelper.ALLOWED_FORUM_CONTROLS;
        }
        else
        {
            ltlText.AllowedControls = "none";
        }

        lnkUserName.Text = HTMLHelper.HTMLEncode(fpi.PostUserName);

        // Display converted datetime for live site
        lblDate.Text = " (" + TimeZoneUIMethods.ConvertDateTime(ValidationHelper.GetDateTime(fpi.PostTime, DateTimeHelper.ZERO_TIME), this).ToString() + ")";

        lblSubject.Text = HTMLHelper.HTMLEncode(fpi.PostSubject);
        DiscussionMacroResolver dmh = new DiscussionMacroResolver();
        dmh.EnableBold          = fi.ForumEnableFontBold;
        dmh.EnableItalics       = fi.ForumEnableFontItalics;
        dmh.EnableStrikeThrough = fi.ForumEnableFontStrike;
        dmh.EnableUnderline     = fi.ForumEnableFontUnderline;
        dmh.EnableCode          = fi.ForumEnableCodeSnippet;
        dmh.EnableColor         = fi.ForumEnableFontColor;
        dmh.EnableImage         = fi.ForumEnableImage || fi.ForumEnableAdvancedImage;
        dmh.EnableQuote         = fi.ForumEnableQuote;
        dmh.EnableURL           = fi.ForumEnableURL || fi.ForumEnableAdvancedURL;
        dmh.MaxImageSideSize    = fi.ForumImageMaxSideSize;
        dmh.QuotePostText       = GetString("DiscussionMacroResolver.QuotePostText");

        if (fi.ForumHTMLEditor)
        {
            dmh.EncodeText = false;
            dmh.ConvertLineBreaksToHTML = false;
        }
        else
        {
            dmh.EncodeText = true;
            dmh.ConvertLineBreaksToHTML = true;
        }

        ltlText.Text = "<div class=\"PostText\">" + dmh.ResolveMacros(fpi.PostText) + "</div>";

        userAvatar.Text = AvatarImage(fpi);

        if (DisplayBadgeInfo)
        {
            if (fpi.PostUserID > 0)
            {
                UserInfo ui = UserInfoProvider.GetUserInfo(fpi.PostUserID);
                if ((ui != null) && !ui.IsPublic())
                {
                    BadgeInfo bi = BadgeInfoProvider.GetBadgeInfo(ui.UserSettings.UserBadgeID);
                    if (bi != null)
                    {
                        ltlBadge.Text = "<div class=\"Badge\">" + HTMLHelper.HTMLEncode(bi.BadgeDisplayName) + "</div>";
                    }
                }
            }

            // Set public badge if no badge is set
            if (String.IsNullOrEmpty(ltlBadge.Text))
            {
                ltlBadge.Text = "<div class=\"Badge\">" + GetString("Forums.PublicBadge") + "</div>";
            }
        }

        if (EnableSignature)
        {
            if (fpi.PostUserSignature.Trim() != "")
            {
                plcSignature.Visible = true;
                ltrSignature.Text    = HTMLHelper.HTMLEncode(fpi.PostUserSignature);
            }
        }

        if (!DisplayOnly)
        {
            string threadId = ForumPostInfoProvider.GetPostRootFromIDPath(ValidationHelper.GetString(GetData(PostData, "PostIdPath"), "")).ToString();

            // Reply
            if (IsAvailable(PostData, ForumActionType.Reply))
            {
                lnkReply.Visible     = true;
                lnkReply.Text        = GetString("Forums_WebInterface_ForumPost.replyLinkText");
                lnkReply.NavigateUrl = URLHelper.UpdateParameterInUrl(GetURL(PostData, ForumActionType.Reply), "threadid", threadId);
            }
            else
            {
                lnkReply.Visible = false;
            }

            // Quote
            if (IsAvailable(PostData, ForumActionType.Quote))
            {
                lnkQuote.Visible     = true;
                lnkQuote.Text        = GetString("Forums_WebInterface_ForumPost.quoteLinkText");
                lnkQuote.NavigateUrl = URLHelper.UpdateParameterInUrl(GetURL(PostData, ForumActionType.Quote), "threadid", threadId);
            }
            else
            {
                lnkQuote.Visible = false;
            }

            // Display subscribe link
            if (IsAvailable(PostData, ForumActionType.SubscribeToPost))
            {
                lnkSubscribe.Visible     = true;
                lnkSubscribe.Text        = GetString("Forums_WebInterface_ForumPost.Subscribe");
                lnkSubscribe.NavigateUrl = URLHelper.UpdateParameterInUrl(GetURL(PostData, ForumActionType.SubscribeToPost), "threadid", threadId);
            }
            else
            {
                lnkSubscribe.Visible = false;
            }

            lnkUserName.CssClass = "PostUserLink";

            if (!String.IsNullOrEmpty(fpi.PostUserMail) && (fi.ForumDisplayEmails))
            {
                lnkUserName.NavigateUrl = "mailto:" + HTMLHelper.HTMLEncode(fpi.PostUserMail) + "?subject=" + HTMLHelper.HTMLEncode(fpi.PostSubject);
                lnkUserName.CssClass    = "PostUser";
            }
        }

        // Display action panel only if reply to link or subscription link are visible
        plcActions.Visible = ((lnkReply.Visible || lnkSubscribe.Visible || lnkQuote.Visible) && !DisplayOnly);

        if ((lnkReply.Visible) && (lnkQuote.Visible || lnkSubscribe.Visible))
        {
            lblActionSeparator.Visible = true;
        }

        if ((lnkQuote.Visible) && (lnkSubscribe.Visible))
        {
            lblActionSeparator2.Visible = true;
        }
    }
    /// <summary>
    /// On btnRegister click.
    /// </summary>
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        string currentSiteName = SiteContext.CurrentSiteName;

        // Check banned IPs
        if (!BannedIPInfoProvider.IsAllowed(currentSiteName, BanControlEnum.AllNonComplete))
        {
            lblError.Visible = true;
            lblError.Text    = GetString("General.BannedIP");
            return;
        }

        // Exit if problem occurs
        if (errorOccurs)
        {
            return;
        }

        string    result = null;
        Validator val    = new Validator();

        // Check name fields if required
        if (RequireName)
        {
            result = val
                     .NotEmpty(txtFirstName.Text.Trim(), GetString("eventmanager.firstnamerequired"))
                     .NotEmpty(txtLastName.Text.Trim(), GetString("eventmanager.lastnamerequired"))
                     .Result;
        }
        // Check e-mail field
        if (String.IsNullOrEmpty(result))
        {
            result = val
                     .NotEmpty(txtEmail.Text.Trim(), GetString("eventmanager.emailrequired"))
                     .MatchesCondition(txtEmail, input => input.IsValid(), GetString("eventmanager.emailrequired"))
                     .Result;
        }
        // Check phone field if required
        if (RequirePhone && String.IsNullOrEmpty(result))
        {
            result = val.NotEmpty(txtPhone.Text.Trim(), GetString("eventmanager.phonerequired")).Result;
        }

        if (String.IsNullOrEmpty(result))
        {
            // Allow registration if opened
            if (IsRegistrationOpened)
            {
                if (EventNode != null)
                {
                    if (!EventAttendeeInfoProvider.IsRegisteredForEvent(EventNode.NodeID, txtEmail.Text.Trim()))
                    {
                        // Add new attendant to the event
                        EventAttendeeInfo eai = AddAttendantToEvent();

                        if (eai != null)
                        {
                            // Log activity
                            LogEventBookingActivity(eai);

                            // Send invitation e-mail
                            TimeZoneInfo tzi;
                            TimeZoneUIMethods.GetDateTimeForControl(this, DateTime.Now, out tzi);
                            EventProvider.SendInvitation(currentSiteName, EventNode, eai, tzi);

                            lblRegInfo.Text    = GetString("eventmanager.registrationsucceeded");
                            lblRegInfo.Visible = true;
                            // Hide registration form
                            pnlReg.Visible = false;
                        }
                    }
                    else
                    {
                        // User is already registered
                        lblError.Text    = GetString("eventmanager.attendeeregistered");
                        lblError.Visible = true;
                    }
                }
                else
                {
                    // Event does not exist
                    lblError.Text    = GetString("eventmanager.eventnotexist");
                    lblError.Visible = true;
                    // Hide registration form
                    pnlReg.Visible = false;
                }
            }
            else
            {
                // Event registration is not opened
                lblError.Text    = GetString("eventmanager.notopened");
                lblError.Visible = true;
                // Hide registration form
                pnlReg.Visible = false;
            }
        }
        else
        {
            // Display error message
            lblError.Text    = result;
            lblError.Visible = true;
        }
    }
Beispiel #22
0
    /// <summary>
    /// Unigrid OnExternalDataBound event.
    /// </summary>
    protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        GroupMemberStatus status = GroupMemberStatus.Approved;
        DataRowView       drv    = null;
        GridViewRow       gvr    = null;
        bool current             = false;

        switch (sourceName.ToLowerCSafe())
        {
        case "memberapprovedwhen":
        case "memberrejectedwhen":
            if (parameter != DBNull.Value)
            {
                // Get current dateTime
                return(TimeZoneUIMethods.ConvertDateTime(Convert.ToDateTime(parameter), this));
            }
            break;

        case "approve":
            gvr = parameter as GridViewRow;
            if (gvr != null)
            {
                drv = gvr.DataItem as DataRowView;
                if (drv != null)
                {
                    // Check for current user
                    if (IsLiveSite && (MembershipContext.AuthenticatedUser.UserID == ValidationHelper.GetInteger(drv["MemberUserID"], 0)))
                    {
                        current = true;
                    }

                    // Do not allow approve hidden or disabled users
                    bool hiddenOrDisabled = IsUserHiddenOrDisabled(drv);

                    status = (GroupMemberStatus)ValidationHelper.GetInteger(drv["MemberStatus"], 0);

                    // Enable or disable Approve button
                    if (!current && (status != GroupMemberStatus.Approved) && !hiddenOrDisabled)
                    {
                        CMSGridActionButton button = ((CMSGridActionButton)sender);
                        button.IconCssClass = "icon-check-circle";
                        button.IconStyle    = GridIconStyle.Allow;
                        button.ToolTip      = GetString("general.approve");
                        button.Enabled      = true;
                    }
                    else
                    {
                        CMSGridActionButton button = ((CMSGridActionButton)sender);
                        button.IconCssClass = "icon-check-circle";
                        button.IconStyle    = GridIconStyle.Allow;
                        button.ToolTip      = GetString("general.approve");
                        button.Enabled      = false;
                    }
                }
            }

            break;

        case "reject":
            gvr = parameter as GridViewRow;
            if (gvr != null)
            {
                drv = gvr.DataItem as DataRowView;
                if (drv != null)
                {
                    // Check for current user
                    if (IsLiveSite && (MembershipContext.AuthenticatedUser.UserID == ValidationHelper.GetInteger(drv.Row["MemberUserID"], 0)))
                    {
                        current = true;
                    }

                    status = (GroupMemberStatus)ValidationHelper.GetInteger(drv["MemberStatus"], 0);

                    // Enable or disable Reject button
                    if (!current && (status != GroupMemberStatus.Rejected))
                    {
                        CMSGridActionButton button = ((CMSGridActionButton)sender);
                        button.IconCssClass = "icon-times-circle";
                        button.IconStyle    = GridIconStyle.Critical;
                        button.ToolTip      = GetString("general.reject");
                        button.Enabled      = true;
                    }
                    else
                    {
                        CMSGridActionButton button = ((CMSGridActionButton)sender);
                        button.IconCssClass = "icon-times-circle";
                        button.IconStyle    = GridIconStyle.Critical;
                        button.ToolTip      = GetString("general.reject");
                        button.Enabled      = false;
                    }
                }
            }
            break;

        case "formattedusername":
            // Format username
            return(HTMLHelper.HTMLEncode(Functions.GetFormattedUserName(Convert.ToString(parameter), IsLiveSite)));

        case "edit":
            gvr = parameter as GridViewRow;
            if (gvr != null)
            {
                drv = gvr.DataItem as DataRowView;
                if (drv != null)
                {
                    // Do not allow approve hidden or disabled users
                    bool hiddenOrDisabled = IsUserHiddenOrDisabled(drv);

                    // Enable or disable Edit button
                    if (!hiddenOrDisabled)
                    {
                        CMSGridActionButton button = ((CMSGridActionButton)sender);
                        button.IconCssClass = "icon-edit";
                        button.IconStyle    = GridIconStyle.Allow;
                        button.ToolTip      = GetString("general.edit");
                        button.Enabled      = true;
                    }
                    else
                    {
                        CMSGridActionButton button = ((CMSGridActionButton)sender);
                        button.IconCssClass = "icon-edit";
                        button.IconStyle    = GridIconStyle.Allow;
                        button.ToolTip      = GetString("general.edit");
                        button.Enabled      = false;
                    }
                }
            }
            break;
        }
        return(parameter);
    }
    /// <summary>
    /// Item data bound handler.
    /// </summary>
    protected void gridItems_ItemDataBound(object sender, DataGridItemEventArgs e)
    {
        if (mGlobalNameID != null)
        {
            foreach (var globalName in mGlobalNameID)
            {
                if (!string.IsNullOrEmpty(globalName))
                {
                    Control ctrl = e.Item.FindControl(globalName);
                    if (ctrl != null)
                    {
                        ((HyperLink)ctrl).Text = ((DataRowView)e.Item.DataItem)[globalName].ToString();
                        int    itemId    = ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue((DataRowView)e.Item.DataItem, "ItemID"), 0);
                        string detailUrl = RequestContext.CurrentURL;

                        // Use current page by default
                        if (!string.IsNullOrEmpty(DetailPagePath))
                        {
                            detailUrl = DocumentURLProvider.GetUrl(DetailPagePath);
                        }

                        // Add querystring parametr
                        detailUrl = URLHelper.AddParameterToUrl(detailUrl, "id", itemId.ToString());

                        ((HyperLink)ctrl).NavigateUrl = detailUrl;
                    }
                }
            }
        }
        // Timezones
        if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
        {
            object dataItem = e.Item.DataItem;
            if (dataItem.GetType() == typeof(DataRowView))
            {
                // Get data row
                DataRow dr = ((DataRowView)dataItem).Row;

                // Get count of columns (depends whether columns are automatically generated)
                int columnCount = gridItems.AutoGenerateColumns ? dr.Table.Columns.Count : gridItems.Columns.Count;

                // Go through all grid columns
                int j = 0;
                for (int i = 0; i < columnCount; i++)
                {
                    // Get column of current index
                    object column = gridItems.AutoGenerateColumns ? dr[i] : gridItems.Columns[i];

                    if (((column.GetType() == typeof(BoundColumn)) && !gridItems.AutoGenerateColumns) || ((column is DateTime) && gridItems.AutoGenerateColumns))
                    {
                        // Get cell or actual value
                        object cell = gridItems.AutoGenerateColumns ? column : dr[((BoundColumn)column).DataField];

                        // Apply timezone settings
                        if (cell is DateTime)
                        {
                            e.Item.Cells[j].Text = TimeZoneUIMethods.ConvertDateTime((DateTime)cell, this).ToString();
                        }
                    }
                    // DataGrid doesn't show the GUID columns if the columns are autogenerated
                    else if (gridItems.AutoGenerateColumns && (column is Guid))
                    {
                        --j;
                    }

                    ++j;
                }
            }
        }
    }