Difference between revisions of "CGI::FormMagick::Setup"

From SME Server
Jump to navigationJump to search
(Created page with "{{Level|Developer}} === NAME === CGI::FormMagick::Setup - setup/initialisation routines for FormMagick In a root terminal you can do the command below if you want to di...")
 
Line 73: Line 73:
 
=== SEE ALSO ===
 
=== SEE ALSO ===
 
       [http://wiki.contribs.org/CGI::FormMagick CGI::FormMagick]
 
       [http://wiki.contribs.org/CGI::FormMagick CGI::FormMagick]
[[Category:Howto]]
+
 
 
[[Category:SME Server Development Framework]]
 
[[Category:SME Server Development Framework]]
 
[[Category:Development Tools]]
 
[[Category:Development Tools]]
 
[[Category:SME9-Development]]
 
[[Category:SME9-Development]]

Revision as of 22:21, 21 December 2013

PythonIcon.png Skill level: Developer
Risk of inconsistencies with Koozali SME Server methodology, upgrades & functionality is high. One must be knowledgeable about how changes impact their Koozali SME Server. Significant risk of irreversible harm.


NAME

      CGI::FormMagick::Setup - setup/initialisation routines for FormMagick

In a root terminal you can do the command below if you want to display the up-to-date content

perldoc CGI::FormMagick::Setup

SYNOPSIS

        use CGI::FormMagick;

DESCRIPTION

default_xml_filename()

default source filename to the same as the perl script, with .xml extension

parse_xml()

Parses the XML input, setting $fm->{xml} to a usable hash of the form elements, and $fm->{lexicon} to a hash of the l10n lexicon.

The $fm->{xml} hash has the following form:

          {
              ’form’ => {
                  ’post-event’ => ’submit_order’,
                  ’title’ => ’FormMagick demo application’
              },
              ’pages’ => [
                  {
                       ’post-event’ => ’lookup_group_info’,
                       ’fields’ => [
                           {
                               ’type’ => ’text’,
                               ’id’ => ’firstname’,
                               ’validation’ => ’nonblank’,
                               ’label’ => ’first name’
                           },
                           {
                               ’type’ => ’text’,
                               ’id’ => ’lastname’,
                               ’validation’ => ’nonblank’,
                               ’label’ => ’last name’
                           }
                           {
                               ’type’ => ’fragment’,
                               ’content’ => ’This is a simple fragment’
                           }
                           {
                               ’type’ => ’subroutine’,
                               ’src’ => ’fragment_subroutine_name()’
                           }
                       ],
                       ’name’ => ’Personal’,
                       ’title’ => ’Personal details’
                  }
              ]
          };

Note on lexicon files: If FormMagick was given a charset argument, then the output will be encoded in that character set. Otherwise, it will be in UTF-8.

clean_field_list

Given a messy field list (as seen as @page_fields in parse_xml()), removes extraneous data and returns a clean list.

clean_page_list(\@form_elements, \%form_attributes)

Given a messy list of form elements (as seen as @form_elements in parse_xml()), removes extraneous data and returns: 1) a clean list of pages in the form, and 2) a lexicon hash.

$self->clean_xml_array($xml)

Cleans up XML by removing superfluous stuff. Given an array of XML, returns a cleaner array.

initialise_sessiondir($self)

Figures out where the session tokens should be kept.

SEE ALSO

      CGI::FormMagick