protected override IEnumerable <XElement> getSpecificData(WebContext context) { if (context.session == null) { throw new AccessDeniedException(); } PageOuter pageOuter = PageOuter.createFromUrl(this.url, context.userSettings.uploadsPerPage); List <Upload> uploads = Upload.LoadByIds( from stringId in Config.instance.mainConnection.LoadIdsByConditions( Upload.TableSpec.instance, new EmptyCondition(), pageOuter, new JoinSpec[0], new SortSpec[] { new SortSpec( Upload.TableSpec.instance.getColumnSpec(Upload.TableSpec.FIELD_UPLOADDATE), pageOuter.ascendingDirection ), new SortSpec( Upload.TableSpec.instance.getIdSpec(), pageOuter.ascendingDirection ), } ) select int.Parse(stringId) ); return(new XElement[] { new XElement("uploads", from upload in uploads select upload.exportToXml(context), pageOuter.exportToXml(2, 5, 2) ) }); }
override protected IEnumerable <XElement> getSpecificData(WebContext context) { Board board = this.url.board; PageOuter pageOuter = PageOuter.createFromUrl(this.url, context.userSettings.threadsPerPage); IEnumerable <Thread> threads = board.getThreads(pageOuter, pageOuter.descendingDirection); XElement[] result = new XElement[] { new XElement("currentLocation", board.exportToXmlSimpleWithParent(context)), new XElement("boards", from subBoard in board.subBoards select subBoard.exportToXml(context, Board.SubboardsOptions.FirstLevel)), new XElement("threads", from thread in threads select thread.exportToXml(context), pageOuter.exportToXml(1, 5, 1) ) }; if (context.session != null) { if (pageOuter.start == 0) { board.markAsRead(context.session.account); } } return(result); }
override protected IEnumerable <XElement> getSpecificData(WebContext context) { PageOuter pageOuter = PageOuter.createFromUrl(this.url, context.userSettings.postsPerPage); IEnumerable <Post> posts = Post.LoadByIds( from stringId in Config.instance.mainConnection.LoadIdsByConditions( Post.TableSpec.instance, new ComparisonCondition( Post.TableSpec.instance.getIdSpec(), ComparisonType.GREATEROREQUAL, Thread.FORMALREADMIN.ToString() ), pageOuter, new JoinSpec[0], new SortSpec[] { new SortSpec( Post.TableSpec.instance.getIdSpec(), pageOuter.descendingDirection ) } ) select int.Parse(stringId) ); XElement[] result = new XElement[] { new XElement("posts", from post in posts select post.exportToXml(context), pageOuter.exportToXml(2, 5, 2) ) }; return(result); }
override protected IEnumerable <XElement> getSpecificData(WebContext context) { PageOuter pageOuter = PageOuter.createFromUrl(this.url, context.userSettings.threadsPerPage); IEnumerable <Thread> threads = Thread.LoadByIds( from stringId in Config.instance.mainConnection.LoadIdsByConditions( Thread.TableSpec.instance, new ComparisonCondition( Thread.TableSpec.instance.getColumnSpec(Thread.TableSpec.FIELD_LASTPOSTID), ComparisonType.GREATEROREQUAL, Thread.FORMALREADMIN.ToString() ), pageOuter, new JoinSpec[0], new SortSpec[] { new SortSpec( Thread.TableSpec.instance.getColumnSpec(Thread.TableSpec.FIELD_LASTPOSTID), pageOuter.descendingDirection ) } ) select int.Parse(stringId) ); XElement[] result = new XElement[] { new XElement("threads", from thread in threads select thread.exportToXml(context), pageOuter.exportToXml(1, 5, 1) ) }; return(result); }
override protected IEnumerable <XElement> getUserSpecificData(WebContext context, User user) { PageOuter pageOuter = PageOuter.createFromUrl(this.url, context.userSettings.threadsPerPage); IEnumerable <Poll.Vote> votes = Poll.Vote.LoadByIds( from stringId in Config.instance.mainConnection.LoadIdsByConditions( Poll.Vote.TableSpec.instance, new ComparisonCondition( Poll.Vote.TableSpec.instance.getColumnSpec(Poll.Vote.TableSpec.FIELD_USERID), ComparisonType.EQUAL, user.id.ToString() ), pageOuter, new JoinSpec[0], new SortSpec[] { new SortSpec( Poll.Vote.TableSpec.instance.getIdSpec(), pageOuter.descendingDirection ) } ) select int.Parse(stringId) ); return(new XElement[] { new XElement("polls", from vote in votes select vote.poll.exportToXml(context), pageOuter.exportToXml(2, 5, 2) ) }); }
override protected IEnumerable <XElement> getSpecificData(WebContext context) { Board board = this.url.board; PageOuter pageOuter = PageOuter.createFromUrl(this.url, context.userSettings.postsPerPage); IEnumerable <Thread> threads = board.getThreads( pageOuter, new SortSpec[] { new SortSpec( Thread.TableSpec.instance.getColumnSpec(Thread.TableSpec.FIELD_ID), pageOuter.ascendingDirection ), } ); return(new XElement[] { new XElement("currentLocation", board.exportToXmlSimpleWithParent(context)), new XElement("boards", from subBoard in board.subBoards select subBoard.exportToXml(context, Board.SubboardsOptions.FirstLevel)), new XElement("posts", from thread in threads select thread.firstPost.exportToXml( context, new XElement("specific", thread.exportToXml(context)) ), pageOuter.exportToXml(1, 5, 1) ) }); }
override protected IEnumerable <XElement> getSpecificData(WebContext context) { PageOuter pageOuter = PageOuter.createFromUrl(this.url, context.userSettings.threadsPerPage); IEnumerable <Poll> polls = Poll.LoadByIds( from stringId in Config.instance.mainConnection.LoadIdsByConditions( Poll.TableSpec.instance, new EmptyCondition(), pageOuter, new JoinSpec[0], new SortSpec[] { new SortSpec( Poll.TableSpec.instance.getIdSpec(), pageOuter.reversed ) } ) select int.Parse(stringId) ); return(new XElement[] { new XElement("polls", from poll in polls select poll.exportToXml(context), pageOuter.exportToXml(2, 5, 2) ) }); }
override protected IEnumerable <XElement> getSpecificData(WebContext context) { Thread thread = this.url.thread; PageOuter pageOuter = PageOuter.createFromUrl( this.url, context.userSettings.postsPerPage, new Dictionary <char, Func <string, long> > { { 'p', s => Config.instance.mainConnection.GetCountByConditions( Post.TableSpec.instance, new ComplexCondition( ConditionsJoinType.AND, new ComparisonCondition( Post.TableSpec.instance.getColumnSpec(Post.TableSpec.FIELD_THREADID), ComparisonType.EQUAL, thread.id.ToString() ), new ComparisonCondition( Post.TableSpec.instance.getIdSpec(), ComparisonType.LESSTHAN, int.Parse(s).ToString() ) ) ) } } ); IEnumerable <Post> posts = thread.getPosts(pageOuter, pageOuter.ascendingDirection); int lastReadId = 0; if (context.session != null) { lastReadId = thread.getLastReadId(context.session.account); } XElement[] result = new XElement[] { new XElement("currentLocation", thread.exportToXmlSimpleWithParent(context)), thread.exportToXml(context), new XElement("posts", from post in posts select post.exportToXml( context, new XElement("isUnread", (post.id > lastReadId).ToPlainString()) ), pageOuter.exportToXml(2, 5, 2) ) }; thread.incrementViewsCounter(); if ((context.session != null) && (posts.Count() > 0)) { thread.markAsRead(context.session.account, posts.Min(), posts.Max()); } return(result); }
override protected IEnumerable <XElement> getSpecificData(WebContext context) { Account interlocutor = this.url.interlocutor; PMConversation conversation = PMConversation.LoadByAccounts(context.session.account, interlocutor); PageOuter pageOuter = PageOuter.createFromUrl( this.url, context.userSettings.postsPerPage, new Dictionary <char, Func <string, long> > { { 'p', s => Config.instance.mainConnection.GetCountByConditions( PMMessage.TableSpec.instance, new ComplexCondition( ConditionsJoinType.AND, new ComparisonCondition( PMMessage.TableSpec.instance.getColumnSpec(PMMessage.TableSpec.FIELD_OWNERID), ComparisonType.EQUAL, context.session.account.id.ToString() ), new ComparisonCondition( PMMessage.TableSpec.instance.getColumnSpec(PMMessage.TableSpec.FIELD_INTERLOCUTORID), ComparisonType.EQUAL, interlocutor.id.ToString() ), new ComparisonCondition( PMMessage.TableSpec.instance.getIdSpec(), ComparisonType.LESSTHAN, int.Parse(s).ToString() ) ) ) } } ); IEnumerable <PMMessage> messages = conversation.getMessages(pageOuter, context, pageOuter.ascendingDirection); XElement[] result = new XElement[] { conversation.exportToXml(context, false), new XElement("messages", from message in messages select message.exportToXml(context), pageOuter.exportToXml(2, 5, 2) ) }; if (messages.Count() > 0) { conversation.markAsRead(context.session.account, messages.Min(), messages.Max()); } foreach (var message in messages) { message.MarkAsRead(context.session.account); } return(result); }
override protected IEnumerable <XElement> getUserSpecificData(WebContext context, User user) { PageOuter pageOuter = PageOuter.createFromUrl(this.url, context.userSettings.postsPerPage); IEnumerable <Thread> threads = user.getThreads(pageOuter, pageOuter.descendingDirection); return(new XElement[] { new XElement("threads", from thread in threads select thread.exportToXml(context), pageOuter.exportToXml(1, 5, 1) ) }); }
override protected IEnumerable <XElement> getSpecificData(WebContext context) { PageOuter pageOuter = PageOuter.createFromUrl(this.url, context.userSettings.usersPerPage); IEnumerable <User> users = User.getUsers(pageOuter, pageOuter.ascendingDirection); return(new XElement[] { new XElement("users", from user in users select user.exportToXmlForViewing(context), pageOuter.exportToXml(2, 5, 2) ) }); }
override protected IEnumerable <XElement> getUserSpecificData(WebContext context, User user) { PageOuter pageOuter = PageOuter.createFromUrl(this.url, context.userSettings.postsPerPage); IEnumerable <Post> posts = user.getPosts(pageOuter, pageOuter.descendingDirection); return(new XElement[] { new XElement("posts", from post in posts select post.exportToXml(context), pageOuter.exportToXml(2, 5, 2) ) }); }
override protected IEnumerable <XElement> getSpecificData(WebContext context) { PageOuter pageOuter = PageOuter.createFromUrl(this.url, context.userSettings.threadsPerPage); IEnumerable <PMConversation> conversations = PMConversation.getConversations(context.session.account, pageOuter, pageOuter.descendingDirection); XElement[] result = new XElement[] { new XElement("conversations", from conversation in conversations select conversation.exportToXml(context, false), pageOuter.exportToXml(1, 5, 1) ) }; return(result); }