We begin with some sub-macros used within
macro "showReference" defined below.Displays the title of a referenced object, with a link on
it to reach the consult view for this object. If we are on a back reference, the link
allows to reach the correct page where the forward reference is defined.Displays icons for triggering actions on a given
referenced object (edit, delete, etc).
Edit the element
Delete the element
Arrows for moving objects up or down
Move upMove down
Displays the "plus" icon that allows to add new object
through a reference widget. Indeed, If field was declared as "addable", we must provide
an icon for creating a new linked object (at least if multiplicities allow it).
This macro shows a reference field. More precisely, it shows nothing, but calls
a Javascript function that will asynchonously call (via a XmlHttpRequest object) the
macro 'showReferenceContent' defined below, that will really show content.
It requires:
- isBack (bool) Is the reference a backward or forward reference?
- fieldName (string) The name of the reference field (if it is a forward reference)
or the name of the Archetypes relationship (if it is a backward reference)
- innerRef (bool) Are we rendering a reference within a reference or not?
- contextObj (object) the object from which the reference starts
- labelId (string) the i18n id of the reference field label
- descrId (string) the i18n id of the reference field description
This macro is called by a XmlHttpRequest for displaying the paginated referred objects
of a reference field.
This macro displays the Reference widget on a "consult" page.
The definition of "atMostOneRef" above may sound strange: we shouldn't check the actual number
of referenced objects. But for back references people often forget to specify multiplicities.
So concretely, multiplicities (0,None) are coded as (0,1).Display a simplified widget if maximum number of
referenced objects is 1.
If there is no object...
If there is an object...
Display a fieldset in all other cases.A carriage return needed in some cases.
This macro displays the Reference widget on an "edit" page