示例#1
0
        public static void ShowMore(Core core, ShowUPageEventArgs e)
        {
            if (core == null)
            {
                throw new NullCoreException();
            }

            if (!e.Page.Owner.Access.Can("VIEW"))
            {
                core.Functions.Generate403();
                return;
            }

            Template template = new Template("pane.statusmessage.html");
            template.Medium = core.Template.Medium;
            template.SetProse(core.Prose);

            bool moreContent = false;
            long lastId = 0;
            List<StatusMessage> items = StatusFeed.GetItems(core, (User)e.Page.Owner, e.Page.TopLevelPageNumber, 20, e.Page.TopLevelPageOffset, out moreContent);

            foreach (StatusMessage item in items)
            {
                VariableCollection statusMessageVariableCollection = template.CreateChild("status_messages");

                core.Display.ParseBbcode(statusMessageVariableCollection, "STATUS_MESSAGE", core.Bbcode.FromStatusCode(item.Message), e.Page.Owner, true, string.Empty, string.Empty);
                statusMessageVariableCollection.Parse("STATUS_UPDATED", core.Tz.DateTimeToString(item.GetTime(core.Tz)));

                statusMessageVariableCollection.Parse("ID", item.Id.ToString());
                statusMessageVariableCollection.Parse("TYPE_ID", item.ItemKey.TypeId.ToString());
                statusMessageVariableCollection.Parse("USERNAME", item.Poster.DisplayName);
                statusMessageVariableCollection.Parse("USER_ID", item.Poster.Id);
                statusMessageVariableCollection.Parse("U_PROFILE", item.Poster.ProfileUri);
                statusMessageVariableCollection.Parse("U_QUOTE", string.Empty /*core.Hyperlink.BuildCommentQuoteUri(item.Id)*/);
                statusMessageVariableCollection.Parse("U_REPORT", string.Empty /*core.Hyperlink.BuildCommentReportUri(item.Id)*/);
                statusMessageVariableCollection.Parse("U_DELETE", string.Empty /*core.Hyperlink.BuildCommentDeleteUri(item.Id)*/);
                statusMessageVariableCollection.Parse("U_PERMISSIONS", item.Access.AclUri);
                statusMessageVariableCollection.Parse("USER_TILE", item.Poster.Tile);
                statusMessageVariableCollection.Parse("USER_ICON", item.Poster.Icon);
                statusMessageVariableCollection.Parse("URI", item.Uri);

                if (core.Session.IsLoggedIn)
                {
                    if (item.Owner.Id == core.Session.LoggedInMember.Id)
                    {
                        statusMessageVariableCollection.Parse("IS_OWNER", "TRUE");
                    }
                }

                if (item.Info.Likes > 0)
                {
                    statusMessageVariableCollection.Parse("LIKES", string.Format(" {0:d}", item.Info.Likes));
                    statusMessageVariableCollection.Parse("DISLIKES", string.Format(" {0:d}", item.Info.Dislikes));
                }

                if (item.Info.Comments > 0)
                {
                    statusMessageVariableCollection.Parse("COMMENTS", string.Format(" ({0:d})", item.Info.Comments));
                }

                if (item.Access.IsPublic())
                {
                    statusMessageVariableCollection.Parse("IS_PUBLIC", "TRUE");
                    if (item.ItemKey.GetType(core).Shareable)
                    {
                        statusMessageVariableCollection.Parse("SHAREABLE", "TRUE");
                        statusMessageVariableCollection.Parse("U_SHARE", item.ShareUri);

                        if (item.Info.SharedTimes > 0)
                        {
                            statusMessageVariableCollection.Parse("SHARES", string.Format(" {0:d}", item.Info.SharedTimes));
                        }
                    }
                }
                lastId = item.Id;
            }

            string loadMoreUri = core.Hyperlink.BuildStatusUri((User)e.Page.Owner) + "?p=" + (core.TopLevelPageNumber + 1) + "&o=" + lastId;
            core.Response.SendRawText(moreContent ? loadMoreUri : "noMoreContent", template.ToString());
        }
示例#2
0
 public static void ShowAll(object sender, ShowUPageEventArgs e)
 {
     e.Template.SetTemplate("view_contacts.html");
 }
示例#3
0
        /*
         * TODO: show status feed history
         */
        public static void Show(Core core, ShowUPageEventArgs e)
        {
            if (core == null)
            {
                throw new NullCoreException();
            }

            if (!e.Page.Owner.Access.Can("VIEW"))
            {
                core.Functions.Generate403();
                return;
            }

            if (core.ResponseFormat == ResponseFormats.Xml)
            {
                ShowMore(core, e);
                return;
            }

            core.Template.SetTemplate("Profile", "viewstatusfeed");

            if (core.Session.IsLoggedIn && e.Page.Owner == core.Session.LoggedInMember)
            {
                core.Template.Parse("OWNER", "TRUE");

            }

            core.Template.Parse("PAGE_TITLE", e.Core.Prose.GetString("STATUS_FEED"));

            PermissionGroupSelectBox permissionSelectBox = new PermissionGroupSelectBox(core, "permissions", e.Page.Owner.ItemKey);

            core.Template.Parse("S_STATUS_PERMISSIONS", permissionSelectBox);

            bool moreContent = false;
            long lastId = 0;
            List<StatusMessage> items = StatusFeed.GetItems(core, (User)e.Page.Owner, e.Page.TopLevelPageNumber, 20, e.Page.TopLevelPageOffset, out moreContent);

            foreach (StatusMessage item in items)
            {
                VariableCollection statusMessageVariableCollection = core.Template.CreateChild("status_messages");

                //statusMessageVariableCollection.Parse("STATUS_MESSAGE", core.Functions.Tldr(item.Message));
                core.Display.ParseBbcode(statusMessageVariableCollection, "STATUS_MESSAGE", core.Bbcode.FromStatusCode(item.Message), e.Page.Owner, true, string.Empty, string.Empty);
                statusMessageVariableCollection.Parse("STATUS_UPDATED", core.Tz.DateTimeToString(item.GetTime(core.Tz)));

                statusMessageVariableCollection.Parse("ID", item.Id.ToString());
                statusMessageVariableCollection.Parse("TYPE_ID", item.ItemKey.TypeId.ToString());
                statusMessageVariableCollection.Parse("USERNAME", item.Poster.DisplayName);
                statusMessageVariableCollection.Parse("USER_ID", item.Poster.Id);
                statusMessageVariableCollection.Parse("U_PROFILE", item.Poster.ProfileUri);
                statusMessageVariableCollection.Parse("U_QUOTE", string.Empty /*core.Hyperlink.BuildCommentQuoteUri(item.Id)*/);
                statusMessageVariableCollection.Parse("U_REPORT", string.Empty /*core.Hyperlink.BuildCommentReportUri(item.Id)*/);
                statusMessageVariableCollection.Parse("U_DELETE", string.Empty /*core.Hyperlink.BuildCommentDeleteUri(item.Id)*/);
                statusMessageVariableCollection.Parse("U_PERMISSIONS", item.Access.AclUri);
                statusMessageVariableCollection.Parse("USER_TILE", item.Poster.Tile);
                statusMessageVariableCollection.Parse("USER_ICON", item.Poster.Icon);
                statusMessageVariableCollection.Parse("URI", item.Uri);

                if (core.Session.IsLoggedIn)
                {
                    if (item.Owner.Id == core.Session.LoggedInMember.Id)
                    {
                        statusMessageVariableCollection.Parse("IS_OWNER", "TRUE");
                    }
                }

                if (item.Info.Likes > 0)
                {
                    statusMessageVariableCollection.Parse("LIKES", string.Format(" {0:d}", item.Info.Likes));
                    statusMessageVariableCollection.Parse("DISLIKES", string.Format(" {0:d}", item.Info.Dislikes));
                }

                if (item.Info.Comments > 0)
                {
                    statusMessageVariableCollection.Parse("COMMENTS", string.Format(" ({0:d})", item.Info.Comments));
                }

                if (item.Access.IsPublic())
                {
                    statusMessageVariableCollection.Parse("IS_PUBLIC", "TRUE");

                    if (item.ItemKey.GetType(core).Shareable)
                    {
                        statusMessageVariableCollection.Parse("SHAREABLE", "TRUE");
                        statusMessageVariableCollection.Parse("U_SHARE", item.ShareUri);

                        if (item.Info.SharedTimes > 0)
                        {
                            statusMessageVariableCollection.Parse("SHARES", string.Format(" {0:d}", item.Info.SharedTimes));
                        }
                    }
                }

                lastId = item.Id;
            }

            core.Display.ParseBlogPagination(core.Template, "PAGINATION", core.Hyperlink.BuildStatusUri((User)e.Page.Owner), 0, moreContent ? lastId : 0);
            core.Template.Parse("U_NEXT_PAGE", core.Hyperlink.BuildStatusUri((User)e.Page.Owner) + "?p=" + (core.TopLevelPageNumber + 1) + "&o=" + lastId);

            /* pages */
            core.Display.ParsePageList(e.Page.Owner, true);

            List<string[]> breadCrumbParts = new List<string[]>();

            breadCrumbParts.Add(new string[] { "*profile", core.Prose.GetString("PROFILE") });
            breadCrumbParts.Add(new string[] { "status-feed", core.Prose.GetString("STATUS_FEED") });

            e.Page.Owner.ParseBreadCrumbs(breadCrumbParts);
        }