[geeklog-devel] Plugin API: Extend Admin's story editor

Dirk Haun dirk at haun-online.de
Sat Feb 26 12:59:58 EST 2005


>Is this the API change that you were referring to in a forum post on 

No. The discussion there was about comments and I was referring to the
changes Vinny made to the comment API.

>I wonder if we could not make a generic API for content and then it may be 
>possible to have it used for any content (stories, comments, or other 

Hmm, yes, that may be worth thinking about.

>Can you give some examples of use

Attachments in stories was one example. I've done that with a similar
extension to submit.php, but the client also wants it for admin/story.php.

So the plugin (an extended version of the file management plugin) would
provide extensions of the editor form to add files to upload and once the
story is saved, I'll have to post-process the uploaded files and also add
a new autotag to the story's text.

For another client, I have to ensure that certain permissions are set for
the story.

>and why 
>it's better to do the call after the record is created and not a  PreSave 
>like we have now for the comments.

One problem I already mentioned is when you have several plugins hooked
into the API and one of them reports a problem while another has already
successfully updated its data (e.g. a separate table). I imagine that
it's slightly easier to recover for that plugin if the data has already
been saved.

The other reason was lazyness ;-) A story has - when created from the
Admin's story editor - a lot of fields. All those would have to be passed
to the plugin. In the current story editor, it would require quite a few
changes to be able to pass the data to the plugin in a consistent form.

But I guess if we come up with a proper and solid API, then it would be
worth making those changes.

To summarize, my main issue is that of aborting the save in case one of
the plugins runs into a problem and has to recover (i.e. revert its own
tables back to a state before the save). Other than that a pre-save would
require more changes in the existing code, there's no real reason to
prefer it over a post-save API call.

Maybe the solution would be some sort of abort API call?

bye, Dirk


More information about the geeklog-devel mailing list