Post.pm
NAME
Communiware::DE::Post - Dynamic element Post
SYNOPSIS
<:Post {new(TYPE)|ITEM} auth return:> .... <:EditField TITLE:> .... <input type=image name=SAVE src=...> <:EndPost:>
<:Post "" auth return:> <:Item {new(TYPE)|ITEM} name condition:> <:EditField TITLE:> .... <:EndItem:> <:Item ... :> .... <:EndItem:> <input type=submit name=SAVE value="Save"> <:EndPost:>
DESCRIPTION
This dynamic element creates form in the template which and performs desired modifications in the Communiware database when submitted.
This dynamic element creates nested context, which provides nessessary data for edited item.
All the item attributes and links are incorporated in this context.
Dynamic element Post have following arguments:
-
Item id to edit or
new(TYPE_ID)
for creation of new item If new item is to be
created, parameter PARENT_ID with value of current ITEM_ID is generated. If
this parameter is empty, then multi-item post form is generated. Each fragment
of this form, responsible for particular item should be included in the
<:Item:> container. See the Communiware::DE::Item manpage for more info on multi-item
postings.
Authorization type. May be either word ``anon'', which allows everybody to use
this posting, word 'registered' which allows any registered communiware user to
use this form, or empty string, which requires write permission on current item
to access this form.
Return specification. May be either an empty string, which means that we should
redisplay this template after submit is processed, keywords 'new' and 'back'
which means - go to newly created/edited item or return to previous page, or
explicit URL specification (if it doesn't start with http, it is considered
item_id and would be prepended with URL prefix).
If you leave this argument empty, you may generate RETURN form variable using <:Input:> dynamic element or <input> html tag, provided you know what you do.
If posting deletes item and it was called from the this item page, or return specification is 'new', it works as 'back' was specified. If it is impossible to determine where user come from, for instance URL was typed by user in corresponding input line, 'back' returns to top page of current server
Any additional parameters should have form name=value and are directly translated into attributes of HTML form tag. You mustn't specify action, method and enctype parameters (they'll be ignored anyway).If you haven't specify name= parameter, some random name might be generated for the form, if it is neccessary for correct function of JavaScript, generated by Communiware dynamic elements (Currently, only EditField TEXT with WYSIWYG plugin)
Each posting form (or Item container) should contain action specifier. Action specifier is an input control, typically submit button or image, but can also be hidden field, with name which specifies action.
Currently there are three actions allowed: SAVE (either create or update existing item), DELETE and BACK.
Actions can be specific to Item container - specified by Input dynamic element inside container, or glibal - specified by HTML input tag or by Input dynamic element outside containers.
Actions are checked in following order:
-
If there is action, specific to this Item container, it takes precedence.
Otherwise, global action is applied.
If there is no suitable action, error is reported and entire posting is rolled
back.
If there is more than one action on same level (either specific or global),
they are applied in following order DELETE, SAVE, BACK.
It is probably not a feature, but at least, documented behavoir.
GLOBAL VARIABLES
Hashes contains pairs container => item_id and vice versa %Communiware::DE::Post::item2container = (); %Communiware::DE::Post::container2item = ();