- author
- - Wouter Beek
- To be done
- - Type-based JS response.
After DELETE: remove that post from DOM.
After POST: add that post to DOM.
After PUT: update that post in DOM.
convert_post(+Dict0, -Dict) is det[private]-
- Errors
- - May throw type and instantiation errors.
- To be done
- - Introduce type-testing support in library(error).
convert_dict(+Type, +DictIn, -DictOut) is det[private]
retract_post(+Id)[private]- Remove post Id from the database.
convert_post(+JSON, +Kind, +Id, +Author, +TimeProperty, -Post) is det[private]- Convert a post object into its Prolog equivalent.
post_url(+Id, -HREF) is det[private]- True when HREF is a link to post Id.
- post_link(+Id)[private]
- Generate a link to post Id.
post_process(+Request, ?Kind) is det- HTTP handler that implements a REST interface for postings.
- Arguments:
-
Kind | - is the type of post, and is one of news or
annotation . |
post_process(+Method, +Request, +Kind, +Id, +User) is det[private]- Implement the REST replies.
debug_posts is det[private]- Defeats normal authorization checking for posts,
so during development we don't need to struggle with OAuth,
emails, etc.
nodebug_posts is det[private]- remove the effects of debug_posts
post_authorized(+Request, +User, +Kind) is det[private]-
- throws
- -
http_reply(forbidden(Path))
if the user is not allowed
to post.
- To be done
- - If the user is
anonymous
, we should reply 401 instead
of 403, but we want OpenID login
post(+Post, +Name:atom, -Value) is semidet
- post(+Post, ?Name:atom, -Value) is nondet
- post(-Post, ?Name:atom, -Value) is nondet
- True if Post have Value for the given attribute.
- Arguments:
-
If | - Post is given, it is either the id of a post or a dict
describing the post. When generated, Post is the (atom)
identifier of the post. |
post(+Id:atom, +Options)// is det- Generate HTML for apost. Supported Options:
- orientation(+Orientation:oneof([left,right]))
- Orientation of the post. This is used in binary conversations
to show the different conversation parties.
- standalone(+Standalone:boolean)
- Whether this post is part of multiple posts or not.
post_header(+Id, +Options)// is det[private]- When the post appears in isolation (option
standalone(true)
), the title is not displayed.
posts(+Kind, +Object, +Ids:list(atom), +Options)//- Generate HTML for a list of posts and add a link to add new
posts. Options:
- order_by(+Property)
- Order posts by Property. Properties are defined by post/3.
- add_add_link(+Boolean)
- Add link to add new posts. Default is
true
.
add_post_link(+Kind, +Object)//- Emit HTML that allows for adding a new post
- add_post_freshnesslifetime(+Kind)[private]
- Add fressness menu if Kind =
news
. Freshness times are
represented as seconds.
edit_post_form(+Id)//[private]- Provide a non-displayed editor for post Id if the author of this
post is logged on.
age(+Id:atom, -Age) is det[private]- True when post Id was created Age seconds ago.
author_image(+User:atom)// is det[private]
user_avatar(+User, -AvatarImageLink) is det[private]-
- See also
- - https://en.gravatar.com/site/implement/hash/
- - https://en.gravatar.com/site/implement/images/
find_posts(+Kind, :CheckId, -Ids) is det- True when Ids is a list of all posts of Kind for which
call(CheckId, Id)
is true.
fresh(+Id:atom) is semidet- True if post Id is considered fresh.
all(+Id:atom) is det- News filter, returning all objects
relevance(+Id:atom, -Relevance:between(0.0,1.0)) is det-
- If Importance is higher, then the dropoff of Relevance is flatter.
- Relevance is 0.0 if
FreshnessLifetime =< Age
.
- Relevance is 1.0 if
Age == 0
.
login_post(+Kind)//[private]- Suggest to login or request permission to get access to the
posting facility.
write_post_js(+Kind, +About)//[private]- Emit JavaScript to manage posts.
vote(+Request)[private]- HTTP POST handler for handling a vote. The posted object is a
JSON object containing the post it and vote.
Returns a JSON object holding the current number of votes.
vote(+PostId, +User, +Vote) is det[private]- Add a vote for PostId.
vote(?PostId, ?Vote) is nondet[private]
vote_up(?PostId, ?Vote) is nondet[private]
vote_down(?PostId, ?Vote) is nondet[private]- True when PostId has been voted with Vote. Vote is either 1 or
-1. The predicates vote_up/2 and vote_down/2 only count up or
down votes.
user_vote_count(+User, -Up, -Down) is det- Number of votes issued by this user.
user_posts(+User, +Kind)//- Show posts from a specific user of the specified Kind.
comment_summary(+Comment)//[private]- Show the first sentence or max first 80 characters of Comment.
user_post_count(+User, +Kind, -Count) is det- True when Count is the number of posts of Kind created by User.
Undocumented predicates
The following predicates are exported, but not or incorrectly documented.
sort_posts(Arg1, Arg2)