Chapter 3: Your First InterWorx Plugin Up Main page Chapter 5: Case Studies 

4 Plugin Advanced Feature Overview

These advanced features are discussed briefly here, and the case studies below demonstrate specific usage examples.

4.1 Form System

InterWorx’s form system is the ideal means to collect data from user input, and is composed of several parts:
  • Forms
    Much like controllers, forms are container elements that hold the various input objects that comprise a submittable form.
  • Inputs
    Inputs come in many varieties, and can represent nearly any sort of user-provided data. Basic types include strings, integers, and selects. They can also be extended to handle specific formats to suit any need.
  • Validators
    Validators are objects that can be assigned to inputs and are useful for validating input coming in via forms.
  • Datasources
    Datasources are objects that define what values are invalid for a given input (for example, with a select, checkbox, or radio input).
It is not required that the InterWorx Form System be used by custom plugins, but doing so includes some nice benefits, such as built-in round-trip ajax validation, automatic form html and javascript management, etc.
figure images/plugins/forms-areas.png
Figure 4.1 Form System Interface Elements

4.2 Payload System

Payloads are an integral part of how information is displayed within InterWorx. Payloads allow developers to easily present and update data dynamically in a wide variety of contexts. To accomplish this, each payload typically includes several key components:
  • Payload Factory Classes
    The primary payload object, payload factory classes allow the various types of payloads ( Payload_Factory_NW_Dns or Payload_Factory_SW_Users, for example) to be instantiated as needed.
  • Payload Data Formats
    The data to be displayed is called the Payload Data, and is a numerically-indexed array of similarly defined stdClass objects.
  • Payload Formatting
    Payload Formatters allow various aspects of a payload — columns, cells, headers — to be formatted by a configurable set of rules. These are only relevant in the web interface.
  • Payload Actions
    By providing an array of controller actions and various format parameters, payloads can optionally execute actions on the displayed data.
figure images/plugins/payload-areas.png
Figure 4.2 Payload System Interface Elements

4.3 Switching Users

For certain user operations, it is advantageous to execute an action as that user (instead of the default iworx user). In such a case the ~iworx/bin/runasuser.pex can be called with parameters for the user’s Unix name and the script or program to be called.
 Chapter 3: Your First InterWorx Plugin Up Main page Chapter 5: Case Studies 

(C) 2019 by InterWorx LLC