EditField.pm
NAME
Communiware::DE::EditField - Dynamic element EditField
SYNOPSIS
<:EditField name value [options...]:>
DESCRIPTION
Generates field for editing item attribute or links of given type in the posting form. May occur inside <:Post ...:> ....<:EndPost:> container only.
PARAMETERS
- Name
- Name is name of attribute or value of LINKTYPE_ID.
- Value
- Value is value to be set. For links it may be comma-separated list of item_id. If list started with comma, current value is inserted.
-
If value is left empty, current one is used.
- Options
- The rest of EditField arguments threated as options. All of them are added to the generated input elements. Each option has form option=value, thus value can contain commas.
-
There are some common options:
- filter
- Value of this option is a filter which should return [name,description] pairs for the allowed value.
- options
-
The value option with name
options
has formname1=value1,name2=value2,...
. The following two calls are indentical: -
<:EditField NAME VALUE aa=bb cc=dd ee=ff:> <:EditField NAME VALUE options=aa=bb,cc=dd,ee=ff:>
-
This feature can be useful if you should pass to EditField several options as one parameter:
-
<:Define OPTS aa=bb,cc=dd:> . . . <:EditField NAME VALUE options=@OPTS:> These options cannot contain commas.
For some attributes special cases of options exists.
ATTRIBUTE PROCESSING
- TEXT
- Textarea field is created for it and pluggable datatypes are used to process it.
-
See also UPLOAD field.
-
If user have cookie WYSIWYG set to true value and his browser is MSIE then applet window is generated. If cookie is set to false, then message is displayed below text window with class ``editfieldwarn'' pointing user to instructions to enable WYSIWYG plugin. (This often requires changes in IE security settings and/or upgrade of Active-X element supplied with IE, so by default it is off).
-
This behavoir can be prevented by specifying option wysiwyg with value no.
-
There are following option (not counting attributes of generated <textarea> tag available:
- representation
- Representation of text to edit. List of possible representations is datatype-specific. For HTML datatype following representations are defined: 'HTML' (all tags are visible and editable), 'Text' (tags are converted into simplified markup, any tags which cannot be converted are lost), and 'auto' (default, equals to 'Text' if source text representation was 'Text', 'HTML' otherwise).
- wysiwyg
- ``yes'' or ``no''. Default ``yes''. If set to no, WYSIWYG Html editor would never be shown in this field, regardless of user preferences.
- help
- ``yes'' or ``no''. Default ``yes''. If set to ``yes'', links to the documentation pages will be shown below the field. If set to ``no'', they will be suppressed. If set to template id, this help will be shown through this template instead of default when link is followed.
- UPLOAD
- Alternate way to set item text - by uploading a file rather than editing field directly. If both TEXT and UPLOAD are used in same posting, TEXT is used only when no upload file is specified, becouse text typically have default value - old text of item.
- UPLOAD_PIC_id
- Where id is alphanumeric combination of characters - upload field for picture.
-
<:EditField UPLOAD_PIC_COVER1:> <:EditField UPLOAD_PIC_COVER2:> <:EditField UPLOAD_PIC_MAIN:>
- PICn
- Where n is number - upload field for picture. This syntax is obsolete, please see UPLOAD_PIC_id
- PASSWD
- Has option ``delimiter=text''. It means that specified text would be output to resulting HTML between two copies of password field. Defaults to .
- TEMPLATE_ID
- If TYPE_ID defined in current context it lists templates suitable for this type of item. Else it switch to standard handler for STRING-attributes. If PARENT_ID defined we can detect default template for current item more accurately. You can define this attributes in current Form or Posting context:
-
<:Define PARENT_ID @CURRENT_ITEM:> <:Define TYPE_ID @NEW_TYPE:>
- STATUS
- If item has workflow, then check rights of current user and present only those variants which are allowed.
-
Otherwise behave just like other attribute with defined set of values
- attributes of type RICHTEXT
- If size=n option is specified, then text field is created. Otherwise, textarea field is created for these attributes.
-
Option representation controls whether value is represented as
Text
orHtml
. Default isText
. - FORMAT
- Created a menu of possible values for format parameter of Communiware::Preprocess::preprocess_text.
- NO_LINT
- Checkbox with lable ``disable syntax checking''
- SAVE,SKIP,BACK,RENAME and DELETE
- Submit button is created
- INHERIT
- Hidden field is created.
- STRING and NUMBER attributes
- Simple text field is generated, unless attribute has values table defined, or filter={some filter} option is specified.
-
In these cases it generates popup menu.
-
If filter option is specified, than values returned by given filter as ITEM_ID would be used as values for edited attribute and values of TITLE would be used for menu label.
-
filter option takes precedence over values table of attribute.
-
If cols=n and/or cols=n options are specified, then textarea field is created. Otherwise, text field is created with size attribute.
- DATE attributes
- Text field is created and date in Communiware internal format is displayed. It is better to support format option as Input date does. Has option ``format_hint=yes''. It turns on or off hint on date format.
- Link types and Link types with _FOR suffix
- Creates text field where comma-separated item ids may be entered. If option filter=some filter is specified, editing would be restricted to items which match filter result. It means that all linked items which do not match filter, wouldn't be displayed in EditField, and user would not be able to unlink them.
-
This, however, doesn't prevent user from entering item ids which don't match the filter into field.
For all other attributes simple text field is created