[geeklog-devel] Staticpage checkin/checkout functionality; staticpage refresh option

Joe Mucchiello joe at ThrowingDice.com
Sun Jun 10 10:42:08 EDT 2007


This is yet another thing that would work better if the plugin API 
for hooking display/edit/save were complete. The current 
implementation of PLG_setTemplateVars and PLG_itemSaved doesn't cut 
it. Back in Jan/Feb were talking about this but nothing came of it. I 
still advocate a specific API with 3 functions to replace the current 
incomplete API. There should be itemDisplay, itemOpenEditor, and 
itemSave functions. All of them should be able to cause the intended 
action to be aborted. So in the case of this idea, the itemOpenEditor 
routine would return "already checked out" if the editor should not 
display due to someone else having the object checked out. Likewise, 
the itemSave function would fail if the checkout expired before save 
was called.

A project that would go through the core and do this would not be so 
large, I would think.

function PLG_itemDisplay($objtype, $mode, $objid, &$template);
Where $objtype would be something like 'story', 'staticpage', etc., 
$mode can be 'browser' or 'print', $objid would identify the object 
(sid, sp_id, etc), $template is the actual template object.

function PLG_itemOpenEditor($objtype, $mode, $A, &$template);
Where $objtype as above, $mode can be 'edit', 'newadmin', or 
'newsubmission', $A is data for the object if it exists. The plugin 
must reply true. If it replies with a string, the string is 
considered an error result and displayed as such in lieu of the editor.

function PLG_itemSave($objtype, $mode, $A, $request = null);
Where mode is 'new', 'edit' or 'delete', $objtype is as above, $A is 
the set of fields to save, $request is the $_POST array if we are in 
a post. Return from this is like the return from showEditor, a string 
indicates an error.

Dirk, I know you objected before because we have most of this in 
place. But it would be nice to be able to stop the editor or save 
from happening with a plugin. That would make the data objects far 
more extensible.

   Joe

At 02:38 AM 6/10/2007, Heather Engineering wrote:
>I needed this for a site, so figured I'd send it in.
>
>1) Checkin/checkout facility for plugins (just used for staticpages
>but could easily be extended)
>2) Refresh option for staticpages (refresh to edited page on saving).
>
>Not done yet: block on moderation page (moderation.php) showing items
>checked out, and option to check in.
>
>Text below is also in attached text file. Suggestions welcome, or if
>someone wants to improve on this, please do.
>Refresh option would also be nice for stories - some users find it
>confusing to see administration pages and like to just edit and
>return to the story/page where they started out.
>
>Euan.
>
>**
>http://www.heatherengineering.com/

----
Joe Mucchiello
Throwing Dice Games
http://www.throwingdice.com 




More information about the geeklog-devel mailing list