Swiss Magic Data Editor: Difference between revisions

From IHRIS Wiki
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
La mayor parte de la configuración del software iHRIS se maneja definiendo los [[Configuration (Magic) Data|datos magic ]].  Para manejar la edición estructurada y como se muestran estos datos magic de configuración y evitar la corrupción de los datos, se desarrolló un conjunto de clases de php, los editores de datos Swiss Magic. Estos se utilizan, por ejemplo en la definición de las relaciones entre formularios e informes.
Most of the configuration of the iHRIS software is handled by defining [[Configuration (Magic) Data|magic data]].  To handle structured editing and display of this configuration/magic data and avoid corruption of data, a set of PHP classes, the Swiss Magic data editors, was developed.   These are used, for example, in defining form relationships and reports.


Los editores Swiss Magic editan y ven jerárquicamente los datos de configuración. este artículo describe la estructura de las clases Swiss Magic PHP.
The Swiss Magic editors hierarchically edit and view the configuration data. This article describes the structure of the Swiss Magic PHP classes.


==Características==
==Features==
*Proporciona diferentes maneras de atravesar la jerarquía de la configuración de los datos magic por medio de diferentes fábricas
*Provides different ways of traversing the configuration magic data hierarchy via different factories
*Mucho de las buenas características de AJAX se han incluído para mostrar sub-menús dentro del menú actual
*Lots of AJAX goodness built in to display sub-menus within the current menu
*Utilizado en la herramienta de construcción de "Relaciones de Formularios" y de "Informes Personalizados"
*Used in the "Form Relationship" builder and the "Custom Reporting" tool
*Utilizado en la herramienta de "Configuración de Módulos
*Used in the "Configure Modules" tool
*El procesamiento y muestra de los datos ya está localizado. Solamente necesita llamar "renameInputs()" para renombrar cualquiera de sus elementos de formularios html.
*Processing and Displaying of data is already localized. You only need to call "renameInputs()" to rename any of your html form elements.


==Ejemplos==
==Examples==
*[[Swiss Magic Data -- Form Relationships|Relaciones de Formularios]]
*[[Swiss Magic Data -- Form Relationships|Form Relationships]]
*Informes
*Reports
*Visualización de Informes
*Report Views


==El Nodo Swiss==
==The Swiss Node==
Un '''nodo swiss''' es una sub-clase de I2CE_Swiss.  Puede pensar en las clases I2Ce_Swiss como definidores de un GUI widget para la interacción con los magic data. Asociados a un nodo swiss esta:
A '''swiss node''' is a subclass of I2CE_Swiss.  You can think of the I2Ce_Swiss classes as defining a GUI widget for interacting with magic data. Associated to a swiss node is:
*un nodo de magic data
*a magic data node
Un nodo swiss tiene las siguientes funciones:
A swiss node has the following functions:
*valores de visualización guardados en este nodo de magic data
*display values saved at its magic data node
*crear una interfaz de usuario para editar los valores en este nodo de magic data
*create a user interface to edit the values at its magic data node
*procesar un arreglo asociativo de valores para actualizar el nodo de magic data
*process an associative array of values to update the magic data node
*determiner los ''tipos'' de sus nodos swiss secundariosUn nodo de tipo $type es un nodo de clase I2CE_Swiss_$type.
*determine the ''types'' of its child swiss nodesA node of type $type is a node of class I2CE_Swiss_$type.


===Métodos a implementar===
===Methods To Implement===
Al crear un Nuevo tipo Swiss solamente debe implementar estos métodos:
When creating a new Swiss type you only need to implement these methods:
*displayValues() El método utilizado para mostrar los datos asociados con el swiss node. Pueden definirse con diferentes accionesHay dos acciones principales:
*displayValues() The method used to display the data associated with swiss node. Can be defined for different actionsThere are two main actions:
**view: La acción de mostrar  una vista de solo lectura de los datos magic en ese nodo.
**view: The action to display a read-only view of the magic data at that node.
**edit: La acción de mostrar una vista de edición de los datos magic en ese nodo.
**edit: The action to display an edit view of the magic data data at that node.
*processValues() El método utilizado par procesar un arreglo asociaso de valores y actualizar los datos magic. Debe ser definida
*processValues() The method used to process an associated array of values and update the magic data. Needs to be defined
*getChildType()  Obtiene el tipo de secundario swiss con el nombre dado.
*getChildType()  Gets the type of the swiss child with the given name.
===Useful Methods===
The following methods should be used
*getStorage()  Gets the magic data node associate to the swiss node.
*getChild() Gets the child swiss node with the given name.
*renameInputs()  Needs to be called to rename all html input/select/textarea form elements of the given DOMNode are associated to that swiss node.
*addAjaxLink() Adds a link to child swiss node.  If the browser is AJAX happy, it will do so in a AJAX manner.  Otherwise it is simply a link
*get/set/hasField()  Convenience methods to access the named (scalar) magic data child node.


===Métodos Utiles===
==The Swiss Factories==
Se deben utilizar los siguientes métodos
The Swiss Factory handles:
*getStorage()  Obtiene el nodo de magic data asociado al nodo swiss.
*provides the appropriate magic data node associated to a swiss node
*getChild() Obtiene el nodo swiss secundario con el nombre dado.
*creates the appropriate child swiss nodes
*renameInputs()  Es necesario llamarlo para renombrar todos los elementos del formulario html input/select/textarea del DOMNode dado que estan asociados a ese nodo swiss.
*traverses the swiss nodes when given a path
*addAjaxLink() Agrega un vincula a un nodo swiss secundario. Si el navegador es compatible con AJAX, lo hará de manera AJAX. De lo contrario sera solamente un vinculo
*pre-process GET/POST variables and passes them to the appropriate swiss node.
*get/set/hasField()  Métodos de conveniencia para tener acceso al nodo secundario de datos magic (escalar) nombrado.
*handles errors in updating values based on GET/POST values.
*implements the Iterator and Count Interface


==Las Fábricas Swiss ==
The Swiss Factory is determined by:
La Fábrica Swiss se encarga de:
*the root magic data node
*proporcionar el nodo de magic data adecuado asociado a un nodo swiss
*the root swiss node class
*crear el nodo swiss secundario adecuado
*atravesar los nodos swiss cuando se da una ruta
*pre-procesar variables GET/POST y pasarlas al nodo swiss adecuado.
*manejar errores en la actualización de valores en base a valores GET/POST.
*implementar las interfaces del Iterador y Count


La Fábrica Swiss esta determinada por:
There are two factories available Swiss Magic and Swiss Config.  These have corresponding I2CE_Page sub-classes to access the web interface.
*el nodo de magic data de raíz
*la clase del nodo swiss de raíz


Hay dos fábricas disponibles Swiss Magic y Swiss ConfigEstas tienen sub-clases correspondientes I2CE_Page para tener acceso a la interfaz de la red.
==Swiss Magic Factory==
This is is the swiss factory do create dynamic content in I2CEThis includes:
*Custom Form Relationships
*Custom Reports
*Custom Report Views
===Parent and Children===
Any (non-scalar) magic data node can serve as the root swiss node.


==Fábrica Swiss Magic==
The children of a swiss node are in one to one correspondence with the child nodes of the corresponding magic data nodeThe names of the child swiss nodes are the same as the names of the child magic data nodes.
Esta es la fábrica swiss para crear contenido dinámico en I2CEEsto incluye:
*Relaciones de Fromularios Personalizadas
*Informes Personalizados
*Visualización de Informes Personalizados
===Primarios y Secundarios===
Cualquier nodo de datos magic (no-escalar) puede servir como el nodo swiss raíz.


El nodo secundario de un nodo swiss está en correspondencia de uno a uno con los nodos secundarios de los nodos de datos magic correspondientes. Los nombres de los nodos swiss secundarios son los mismos que los nombres de los nodos de datos magic secundarios.
===Page Access===
 
This factory can be accessed in the web interface as in instance of the I2CE_Page_SwissMagic class. This is done for:
===Acceso a la Página===
*Form Relationships
Esta fábrica se puede dar en la interfaz de la red como una instancia de la clase I2CE_Page_SwissMagic. Esto se hace para:
*Custom Reports
*Relaciones de Formularios
*Custom Report Views
*Informes Personalizados
*Visualización de Informes Personalizados


==Swiss Config Factory==
==Swiss Config Factory==
Line 84: Line 83:
For the "Configure Modules" page, each module instantiates the a swiss factory by the an instance of the I2CE_Page_SwissConfig class.   
For the "Configure Modules" page, each module instantiates the a swiss factory by the an instance of the I2CE_Page_SwissConfig class.   


[[Category:Technical Overview]][[Category:Magic Data]][[Category:Review2013]][[Category:Needs Intro]]
[[Category:Magic Data]][[Category:Review2013]]

Latest revision as of 11:28, 8 November 2013

Most of the configuration of the iHRIS software is handled by defining magic data. To handle structured editing and display of this configuration/magic data and avoid corruption of data, a set of PHP classes, the Swiss Magic data editors, was developed. These are used, for example, in defining form relationships and reports.

The Swiss Magic editors hierarchically edit and view the configuration data. This article describes the structure of the Swiss Magic PHP classes.

Features

  • Provides different ways of traversing the configuration magic data hierarchy via different factories
  • Lots of AJAX goodness built in to display sub-menus within the current menu
  • Used in the "Form Relationship" builder and the "Custom Reporting" tool
  • Used in the "Configure Modules" tool
  • Processing and Displaying of data is already localized. You only need to call "renameInputs()" to rename any of your html form elements.

Examples

The Swiss Node

A swiss node is a subclass of I2CE_Swiss. You can think of the I2Ce_Swiss classes as defining a GUI widget for interacting with magic data. Associated to a swiss node is:

  • a magic data node

A swiss node has the following functions:

  • display values saved at its magic data node
  • create a user interface to edit the values at its magic data node
  • process an associative array of values to update the magic data node
  • determine the types of its child swiss nodes. A node of type $type is a node of class I2CE_Swiss_$type.

Methods To Implement

When creating a new Swiss type you only need to implement these methods:

  • displayValues() The method used to display the data associated with swiss node. Can be defined for different actions. There are two main actions:
    • view: The action to display a read-only view of the magic data at that node.
    • edit: The action to display an edit view of the magic data data at that node.
  • processValues() The method used to process an associated array of values and update the magic data. Needs to be defined
  • getChildType() Gets the type of the swiss child with the given name.

Useful Methods

The following methods should be used

  • getStorage() Gets the magic data node associate to the swiss node.
  • getChild() Gets the child swiss node with the given name.
  • renameInputs() Needs to be called to rename all html input/select/textarea form elements of the given DOMNode are associated to that swiss node.
  • addAjaxLink() Adds a link to child swiss node. If the browser is AJAX happy, it will do so in a AJAX manner. Otherwise it is simply a link
  • get/set/hasField() Convenience methods to access the named (scalar) magic data child node.

The Swiss Factories

The Swiss Factory handles:

  • provides the appropriate magic data node associated to a swiss node
  • creates the appropriate child swiss nodes
  • traverses the swiss nodes when given a path
  • pre-process GET/POST variables and passes them to the appropriate swiss node.
  • handles errors in updating values based on GET/POST values.
  • implements the Iterator and Count Interface

The Swiss Factory is determined by:

  • the root magic data node
  • the root swiss node class

There are two factories available Swiss Magic and Swiss Config. These have corresponding I2CE_Page sub-classes to access the web interface.

Swiss Magic Factory

This is is the swiss factory do create dynamic content in I2CE. This includes:

  • Custom Form Relationships
  • Custom Reports
  • Custom Report Views

Parent and Children

Any (non-scalar) magic data node can serve as the root swiss node.

The children of a swiss node are in one to one correspondence with the child nodes of the corresponding magic data node. The names of the child swiss nodes are the same as the names of the child magic data nodes.

Page Access

This factory can be accessed in the web interface as in instance of the I2CE_Page_SwissMagic class. This is done for:

  • Form Relationships
  • Custom Reports
  • Custom Report Views

Swiss Config Factory

This is the Swiss Factory designed for the configure modules tool.

Parent And Children

In this factory the child swiss nodes of a given swiss class are defined by a module configuration XML#Defining Magic Data in Configuration Files file. The root parent swiss node is the main <configurationGroup> in the configuration XML file.

The child swiss nodes associated to a given <configurationGroup> are exactly the child <configuration>s and <configurationGroup>s on that node. The names of the child swiss nodes are the names of the child <configuration> and <configurationGroup> nodes.

The magic data node associated to a swiss node is the exactly the magic data node associated to the given <configuration> or <configurationGroup> node as defined by the path and name attributes.

Page Access

For the "Configure Modules" page, each module instantiates the a swiss factory by the an instance of the I2CE_Page_SwissConfig class.