Did you know ... Search Documentation:
post.pl -- Posts
PublicShow source
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.
Source convert_post(+Dict0, -Dict) is det[private]
Errors
- May throw type and instantiation errors.
To be done
- Introduce type-testing support in library(error).
Source convert_dict(+Type, +DictIn, -DictOut) is det[private]
Source retract_post(+Id)[private]
Remove post Id from the database.
Source convert_post(+JSON, +Kind, +Id, +Author, +TimeProperty, -Post) is det[private]
Convert a post object into its Prolog equivalent.
Source 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.
Source 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.
Source post_process(+Method, +Request, +Kind, +Id, +User) is det[private]
Implement the REST replies.
Source debug_posts is det[private]
Defeats normal authorization checking for posts, so during development we don't need to struggle with OAuth, emails, etc.
Source nodebug_posts is det[private]
remove the effects of debug_posts
Source 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
Source 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.
Source 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.
Source post_header(+Id, +Options)// is det[private]
When the post appears in isolation (option standalone(true)), the title is not displayed.
Source 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.
Source 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.
Source edit_post_form(+Id)//[private]
Provide a non-displayed editor for post Id if the author of this post is logged on.
Source age(+Id:atom, -Age) is det[private]
True when post Id was created Age seconds ago.
Source author_image(+User:atom)// is det[private]
Source user_avatar(+User, -AvatarImageLink) is det[private]
See also
- https://en.gravatar.com/site/implement/hash/
- https://en.gravatar.com/site/implement/images/
Source 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.
Source fresh(+Id:atom) is semidet
True if post Id is considered fresh.
Source all(+Id:atom) is det
News filter, returning all objects
Source 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.
Source login_post(+Kind)//[private]
Suggest to login or request permission to get access to the posting facility.
Source write_post_js(+Kind, +About)//[private]
Emit JavaScript to manage posts.
Source 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.

Source vote(+PostId, +User, +Vote) is det[private]
Add a vote for PostId.
Source vote(?PostId, ?Vote) is nondet[private]
Source vote_up(?PostId, ?Vote) is nondet[private]
Source 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.
Source user_vote_count(+User, -Up, -Down) is det
Number of votes issued by this user.
Source user_posts(+User, +Kind)//
Show posts from a specific user of the specified Kind.
Source comment_summary(+Comment)//[private]
Show the first sentence or max first 80 characters of Comment.
Source 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.

Source sort_posts(Arg1, Arg2)