Changing List Displays: Difference between revisions

From IHRIS Wiki
Line 32: Line 32:
     <version>4.1.0</version>
     <version>4.1.0</version>
     <requirement name="ihris-manage-PersonPosition">
     <requirement name="ihris-manage-PersonPosition">
       <!-- We will be customizing by extending the existing PersonPosition class which is defined in the ihris-manage-PersonPosition module.  Thus we need  to require it here-->
       <!-- We will be customizing by extending the existing PersonPosition class which is defined in the ihris-manage-PersonPosition module.   
          Thus we need  to require it here-->
       <atLeast version="4.1" />
       <atLeast version="4.1" />
       <lessThan version="4.2" />
       <lessThan version="4.2" />
     </requirement>
     </requirement>
     <path name="templates">
     <path name="templates">
       <!-- Since we are removing the position code, we will want to make customized .html templates which do not reference the "postion+code".  We will store them in the templates subdirectory of this module -->
       <!-- Since we are removing the position code, we will want to make customized .html templates which do not reference the "postion+code".   
          We will store them in the templates subdirectory of this module -->
       <value>./templates</value>
       <value>./templates</value>
     </path>
     </path>
     <!-- set the priority of this module higher than the "ihris-manage-PersonPostion" modules (which is 350) so that we load this module's templates over the ihris-manage-PersonPosition templates-->
     <!-- set the priority of this module higher than the "ihris-manage-PersonPostion" modules (which is 350) so that we load this module's  
        templates over the ihris-manage-PersonPosition templates-->
     <priority>380</priority>
     <priority>380</priority>
   </metadata>
   </metadata>
Line 75: Line 78:
           </configurationGroup>
           </configurationGroup>
     </configurationGroup>
     </configurationGroup>
  </configurationGroup>
</I2CEConfiguration>
</source>
</source>
Note:  we have set the versions based on 4.1 of the software, this may be different for you if you are using version 4.0.
Note:  we have set the versions based on 4.1 of the software, this may be different for you if you are using version 4.0.

Revision as of 10:42, 15 November 2011

There are many lists in the system and there are many options on how to display them.

Example: Position List

The Default Display

The default position list display is set in the configuration .xml file for the ihris-manage-PersonPosition module. You can see where this is defined in magic data on lines 795-811. Here we are defining the "default" list display at the magic data node:

/modules/forms/formClasses/iHRIS_Position/meta/list/default

The three important parts here are:

  • The "display_string" which is "%s: %s (%s, %s)". Whenever you see a '%s' you in the display string we expect to substitute a field of the form into the string. For more details, see the explanation of the printf format.
  • The "display_args" which are the fields that are passed to the display string. These are substituted in order into the display string.
    • 0:code
    • 1:title
    • 2:facility
    • 3:department
  • The order in which the list is displayed. We are specifying that we first sort by the position code. Then, if two positions have the same code for some reason (or no code at all), then we sort by the title
    • 0:code
    • 1:title

Changing the Default Display

Suppose that you wanted to customized the position list so that it no longer displays the position code. We could create a module containing our "position" customizations that would require the "ihris-manage-PersonPosition" module and define a new display as in the following: <source lang='xml'> <?xml version="1.0"?> <!DOCTYPE I2CEConfiguration SYSTEM "I2CE_Configuration.dtd"> <I2CEConfiguration name="my-Position">

 <metadata>
   <displayName>My Position</displayName>
   <category>Application Component</category>
   <description>Module for my customized position form </description>
   <creator>Intrahealth Informatics</creator>
   <email>hris@capacityproject.org</email>
   <link>https://launchpad.net/ihris-manage</link>
   <version>4.1.0</version>
   <requirement name="ihris-manage-PersonPosition">
     <atLeast version="4.1" />
     <lessThan version="4.2" />
   </requirement>
   <path name="templates">
     <value>./templates</value>
   </path>
   <priority>380</priority>
 </metadata>
 <configurationGroup name="my-Position" path="/I2CE">
    <configurationGroup name='MyPosition' path="/modules/forms/forms/position">
         <configuration name="class" values="single">
           <value>MyPosition</value>
         </configuration>
    </configurationGroup>
    <configurationGroup name='MyPositionClass' path="/modules/forms/formClasses/MyPosition">
         <configuration name="extends">
           <displayName>The class this form extends</displayName>
             <value>0:title</value>
             <value>1:facility</value>
             <value>2:department</value>
           </configuration>
           <configuration name="sort_fields" type="delimited" values="many">
             <value>0:title</value>
             <value>1:facility</value>
             <value>2:department</value>
           </configuration>
         </configurationGroup>
    </configurationGroup>
 </configurationGroup>

</I2CEConfiguration> </source> Note: we have set the versions based on 4.1 of the software, this may be different for you if you are using version 4.0.