Beispiel #1
0
        static IHtmlControl GetDialogBlock(IDataLayer forumConnection, UserStorage userStorage,
                                           LightObject user, RowLink dialog, int messageIndex)
        {
            LightObject collocutor = userStorage.FindUser(dialog.Get(DialogueType.CollocutorId));

            if (collocutor == null)
            {
                return(null);
            }

            bool        read      = dialog.Get(DialogueType.Unread);
            bool        inbox     = dialog.Get(DialogueType.Inbox);
            LightObject author    = inbox ? collocutor : user;
            DateTime    localTime = dialog.Get(DialogueType.ModifyTime).ToLocalTime();

            HBefore before = null;

            if (!inbox)
            {
                before = std.BeforeAwesome(@"\f112", 8);
            }

            IHtmlControl messageBlock = new HPanel("", new IHtmlControl[] {
                new HPanel(
                    ViewUserHlp.AvatarBlock(collocutor)
                    ).PositionAbsolute().Left(0).Top(0).Padding(7, 5, 10, 5),
                new HPanel(
                    new HPanel(
                        new HLabel(collocutor.Get(UserType.Login)).FontBold(),
                        new HLabel(collocutor.Get(UserType.FirstName)).MarginLeft(5),
                        new HLabel(localTime.ToString("dd.MM.yyyy HH:mm")).PositionAbsolute().Right(5)
                        .FontSize("90%").Color(Decor.minorColor)
                        ).PositionRelative().MarginBottom(6),
                    new HLabel(
                        //BasketballHlp.PreViewComment(dialog.Get(DialogueType.Content)),
                        dialog.Get(DialogueType.Content),
                        before
                        ).Block().PaddingBottom(15).BorderBottom("1px solid silver").MarginBottom(5)
                    .FontBold(read).Color(read ? Decor.textColor : Decor.minorColor)
                    .Width("100%").NoWrap().Overflow("hidden").CssAttribute("text-overflow", "ellipsis")
                    ).BoxSizing().Width("100%").BorderLeft(Decor.columnBorder).Padding(7, 5, 5, 5)
            },
                                                   new HHover().Background(Decor.pageBackground)
                                                   ).PositionRelative().PaddingLeft(64).BorderTop("2px solid #fff").Color(Decor.textColor);

            //if (messageIndex % 2 != 0)
            //  messageBlock.Background(Decor.evenBackground);

            return(new HLink(string.Format("{0}", UrlHlp.ShopUrl("dialog", collocutor.Id)),
                             messageBlock,
                             new HHover().Background(Decor.pageBackground)
                             ).TextDecoration("none"));
        }
Beispiel #2
0
        static IHtmlControl GetInnerCommentElement(int commentCount, string newsUrl)
        {
            HBefore before = new HBefore().ContentIcon(9, 11).BackgroundImage(UrlHlp.ImageUrl("page.gif"))
                             .VAlign(-2).MarginRight(5);

            if (commentCount == 0)
            {
                return(new HLabel(commentCount, before).Color("#9c9c9c"));
            }

            return(new HPanel(
                       new HLink(string.Format("{0}#comments", newsUrl),
                                 commentCount.ToString(), before
                                 )
                       ).InlineBlock());
        }