As promised I am posting my message regarding adding an "editItem"
callback to Radio here.
When a weblog post has been edited, how can an application determine
what has been changed?
Using the weblog API to create & modify posts is currently incompatible
with liveTopics. Because liveTopics depends heavily upon, among other
things, the values of adrPost^.flNotOnHomePage and adrPost^.categories,
when these are edited via the API it may cause the liveTopics database
to become broken.
liveTopics manages a Table of Contents (ToC), XFML map & augmented RSS
feed for each weblog category. Imagine a post is associated with 2
topics and is a member of 2 categories. That means it will be listed
under those topics in 2 *distinct* ToC's and up streamed to the
appropriate category location.
Now imagine that the post is edited and one of the categories is
removed. At this point liveTopics must rebuild, for example, the Table
of Contents for that dropped category since it no longer contains the
post that was edited and, if this was the only post in that category
associated with those topics, the topics may disappear too.
So when a post is edited it is important to liveTopics to know *what has
changed* as distinct from what the new values are (So for example
knowing that the post is now in the 'public' category doesn't tell you
that it used to be in the 'private' and 'project' categories before it
This requires that liveTopics be able to ask the question: What
categories was this post in *before* it got edited?
To my knowledge there are two likely ways in which a post can be
(1) Via a weblog post form submission
(2) Using an API e.g. metaweblog
(1) In this case I can use the afterWeblogPostForm call-back. The
call-back is received twice for each post: once (the GET call-back)
before the post is edited and once (the POST call-back) after the post
is edited. I use the GET call-back to make a copy of the weblog post
(in system.temp). When the POST call-back is received I can compare the
copy to the new post and determine whether the values of
'flNotOnHomePage' and 'categories' have been changed.
(2) To handle the weblog API I can only hook the postItem call-back.
However in this case the call-back is received only once, i.e. it gets
the POST call-back, but not the GET call-back. With no opportunity to
see the post before it is edited I have no way of knowing what the
original values of 'flNotOnHomePage' and 'categories' are and, as I
describe above, the new values are not enough information.
I am proposing a solution that would handle both the situation's I
describe (and any other similar scenarios in which a post might get
changed). Essentially what I would like is that UserLand add a new
editItem( adrPost )
with the guarantee that it will be called immediately prior to Radio
modifying the content of a weblog post.
The addition of an editItem() callback would provide a single seamless
solution to both scenarios. Code currently in the afterWeblogPostForm
could be safely moved to editItem and postItem (it doesn't really belong
in AWPF anyway).