Automatically Generated Form Pages

From IHRIS Wiki

Starting with the 4.1.6 release of iHRIS you will now have the ability to generate pages to edit and view forms entirely in magic data, avoiding the need to create or edit .html files as well as .php files.

Below we present the types of pages made available and the magic data options need to configure them. This magic data should live under /I2CE/page/$pageName or /modules/$moduleName/page/$pageName.


I2CE_PageFormAuto

This is the simplest page used to edit a single form which is not a child form of another form. The magic data used to define this page is as follows:

  • class: required scalar node with value 'I2CE_PageFormAuto/
  • style: optional scalar node. See page styles for more information. Recommended value is 'shell'.
  • args: required parent node
    • primary_form: required scalar node. The name of the form to edit
    • title: Required scalar node. The page title.
    • auto_template:required parent node
      • disabled. Optional scalar node. If set and evaluates to true, then we do not use the auto generation to display this page. Instead we would fall back to using .html template methods.
      • task: Optional scalar node. A task the user must have in order to edit this form.
      • view_link: Optional scalar node. The link to view this form once the form has been successfully saved. If not set, it will default to 'view_$form.html?id=' where $form is as in primary_form.
      • display_order: optional scalar node. It should be a comma separated list of field names and is used to specify the order in which the fields are displayed. Example would be 'firstname,surname,nationality'
      • display_name: Optional scalar node. Defaults to the display name of the form. It is the text put in the black header row of the edit table.
      • title: Optional scalar node. If not set it uses the values of args/title. This is main text displayed at the top of the page's content.
        • fields:Optional parent node. Keys of children are field names
          • $field: optional parent node.
            • enabled: Optional scalar node. Defaults to 1. If set to 0, this field is not displayed.
            • attributes: Optional parent node. Keys are names of attributes that we want to set for displaying this node
              • showhead: Optional scalar node. Specifies the header to display for this form field. Defaults to 'default'

An minimal example to create a page to edit the person form would look like:

array(
 'class'=>'I2CE_PageFormAuto',
 'style'=>'shell',
 'args'=>Array(
   'primary_form'=>'person',
   'auto_template'=>array(),
   'title'=>'Add/Edit Person'  
 )
)


I2CE_PageFormParent

This is a page used to edit the child form of a parent form. The magic data used to define this page is as follows:

  • class: required scalar node. Value is 'I2CE_PageFormParent'
  • style: optional scalar node. See [[Page and Templates#Page Styles | page styles] for more information. Recommended value is 'shell'
  • args: required parent node
    • title: required scalar node. The page title
    • primary_form: required scalar node. The child form that we are editing
    • view_link:optional scalar node. The link to view the form. Defaults to "view_$form?id="
    • parent_form: required scalar node. THe parent form of the child form that we are editing
    • parent_view_link:optional scalar node. The link to view the parent form. Defaults to "view_$parentForm?id=". This is the page we are directed to on a succesful save
    • auto_template:optional parent node. If not set, we fall back to .html files for displaying and editing.
      • disabled. Optional scalar node. If set and evaluates to true, then we do not use the auto generation to display this page. Instead we would fall back to using .html template methods.
      • task: Optional scalar node. A task the user must have in order to edit this form.
      • display_order: optional scalar node. It should be a comma separated list of field names and is used to specify the order in which the fields are displayed. Example would be 'firstname,surname,nationality'
      • display_name: Optional scalar node. Defaults to the display name of the form. It is the text put in the black header row of the edit table.
      • title: Optional scalar node. If not set it uses the values of args/title. This is main text displayed at the top of the page's content.
      • fields:Optional parent node. Keys of children are field names
        • $field: optional parent node.
          • enabled: Optional scalar node. Defaults to 1. If set to 0, this field is not displayed.
            • attributes: Optional parent node. Keys are names of attributes that we want to set for displaying this node
              • showhead: Optional scalar node. Specifies the header to display for this form field. Defaults to 'default'

I2CE_PageViewChildren

This is a page used to view a form any optionally any child forms. The magic data used to define this page is as follows: This is a page used to edit the child form of a parent form. The magic data used to define this page is as follows:

  • class: required scalar node. Value is 'I2CE_PageViewChildren'
  • style: optional scalar node. See [[Page and Templates#Page Styles | page styles] for more information. Recommended value is 'shell'
  • args: required parent node
    • title: required scalar node. The page title
    • primary_form: required scalar node. The child form that we are editing
    • auto_template:optional parent node. If not set, we fall back to .html files for displaying and editing.
      • disabled. Optional scalar node. If set and evaluates to true, then we do not use the auto generation to display this page. Instead we would fall back to using .html template methods.
      • append_node. optional scalar node. Defaults to 'siteContent' where we should append our auto generated template.
      • task: Optional scalar node. A task the user must have in order to edit this form.
      • display_order: optional scalar node. It should be a comma separated list of field names and is used to specify the order in which the fields are displayed. Example would be 'firstname,surname,nationality'
      • display_name: Optional scalar node. Defaults to the display name of the form. It is the text put in the black header row of the edit table.
      • title: Optional scalar node. If not set it uses the values of args/title. This is main text displayed at the top of the page's content.
      • fields:Optional parent node. Keys of children are field names
        • $field: optional parent node.
          • enabled: Optional scalar node. Defaults to 1. If set to 0, this field is not displayed.
            • attributes: Optional parent node. Keys are names of attributes that we want to set for displaying this node
              • showhead: Optional scalar node. Specifies the header to display for this form field. Defaults to 'default'
      • children:optional parent node.
        • disabled. Optional scalar node. If set and evaluates to true, then we do not use the auto generation to display this page. Instead we would fall back to using .html template methods.
        • fields: TO BE CONTINUED