source: main/waeup.kofa/trunk/docs/source/userdocs/customization.rst @ 13124

Last change on this file since 13124 was 13124, checked in by Henrik Bettermann, 9 years ago

More docs.

File size: 6.8 KB
Line 
1.. _customization:
2
3Portal Customization
4********************
5
6Portal customization requires profound knowledge of the Python
7programming language. Customization is part of the portal deployment
8process. It can only be done by the custom package manager and
9activated by the system administrator, who is allowed to
10update/upgrade the package on the server and restart the portal.
11Usually, custom packages are not designed for regular
12reconfiguration. Due to the complexity of school fee computation at
13Nigerian universities, however, a lot of configuration had to be
14done in the Python code and can thus not be subject to online
15configuration. Technically speaking, the parameters are only loaded
16and registered once during start-up and are not stored in the
17database like the configuration parameters described in
18:ref:`configuration`.
19
20Kofa must not be customized by manipulating original Kofa code, i.e.
21by editing Python files, Zope page templates or ZCML configuration
22files in the Kofa base package. Customization is done by deploying a
23custom package which can inherit all the Python classes from the
24base package, in order to override distinct attributes and methods
25and register these customized classes instead of the orginal classes
26during start-up. It would go beyond the scope of the user handbook
27to explain, how to build such a Kofa custom package. This will be
28done in the :ref:`developer_handbook`. Here we roughly describe the
29three different customization approaches with a focus on the third
30approach, the customization of utility attributes and methods.
31
32Localization
33============
34
35The base language of the Kofa User Interface (Kofa UI) is English.
36The English language regime has been specified by WAeUP's first
37customer, the University of Benin in Nigeria. Kofa is language-aware,
38which means it has been translated into different languages (German
39and French so far), and the preferred language can be selected via
40the UI. The Kofa UI translations and also the English language
41regime can be localized in custom packages by overriding single
42entries of the language files. Headlines, field labels, field
43descriptions, navigation tabs, buttons, page comments, flash
44messages etc. can be easily adjusted to the needs of the institution
45which wants to deploy Kofa.
46
47Kofa is using the `GNU gettext utilities
48<http://www.gnu.org/software/gettext>`_ for translation and
49localization. Translation is done via ``po`` text files which are
50located in the ``locales`` folder of a package. Each language has
51its own subfolder. Localized English Kofa terms, for instance, can be
52found in ``locales/en/LC_MESSAGES/waeup.kofa.po``. A single
53entry/message consists of two lines.
54
55Example::
56
57  msgid "Login"
58  msgstr "Let me in"
59
60``msgid`` contains the original term from the base package,
61``msgstr`` contains its localized/translated version, which results
62into a renamed login tab on the right side of the navigation bar.
63
64``po`` files must be compiled before restarting the portal. Editing
65and compilation of ``po`` files can be done with a nice tool called
66'Poedit' which is `available <https://poedit.net/download>`_ for
67various operating systems.
68
69
70Zope Interfaces
71===============
72
73Adding further schema field attributes to content components can be
74done by inheriting Zope interfaces from the base package and adding
75new schema fields to these custom interfaces, see :ref:`note
76<kofa_interfaces>`. This sounds simple, but it isn't. There are many
77things to think about, when customizing interfaces:
78
791. A customized interface alone doesn't have any effect, beause the
80   content classes still implement the original interfaces. Thus, also
81   all content classes, which are supposed to implement the extended
82   interfaces, must be customized, and must be registered instead of
83   the orginal classes which they inherit from. Drawback is, that this
84   must be done before the first start-up of the portal. Otherwise,
85   instances of the original content classes might have been created
86   which cannot be changed afterwards.
87
882. Also the forms which are being auto-generated by
89   `grok.AutoFields` (see :ref:`views_pages`), must be customized and
90   use the new and extended interfaces. Otherwise added fields won't
91   appear on form pages.
92
933. The same holds for exporters and importers. They also consider
94   the fields from interfaces when processing the data. If we forget to
95   customize exporter or batch processor classes, only the fields from
96   the original interfaces will be exported or reimported.
97
98
99Zope Utilities
100==============
101
102Kofa's global utilities are perfectly suited for customization.
103Their attributes and methods can be easily overridden in custom
104packages.
105
106Kofa Utils
107----------
108
109The central `KofaUtils` utility contains not only most dictionaries
110used for sources (see
111:py:class:`API <waeup.kofa.utils.utils.KofaUtils>`) but also attributes
112like `PORTAL_LANGUAGE` and `tzinfo`. The first defines the default
113language, which is used for pdf slips. The second defines the time
114zone where the institution is located.
115
116Customizable utility methods are:
117
118.. automethod:: waeup.kofa.utils.utils.KofaUtils.sendContactForm()
119   :noindex:
120
121.. automethod:: waeup.kofa.utils.utils.KofaUtils.fullname()
122   :noindex:
123
124.. automethod:: waeup.kofa.utils.utils.KofaUtils.genPassword()
125   :noindex:
126
127.. automethod:: waeup.kofa.utils.utils.KofaUtils.sendCredentials()
128   :noindex:
129
130.. automethod:: waeup.kofa.utils.utils.KofaUtils.getPaymentItem()
131   :noindex:
132
133Students Utils
134--------------
135
136Customizable utility methods are:
137
138.. automethod:: waeup.kofa.students.utils.StudentsUtils.getReturningData()
139   :noindex:
140
141.. automethod:: waeup.kofa.students.utils.StudentsUtils.setReturningData()
142   :noindex:
143
144.. automethod:: waeup.kofa.students.utils.StudentsUtils.setPaymentDetails()
145   :noindex:
146
147.. automethod:: waeup.kofa.students.utils.StudentsUtils.setBalanceDetails()
148   :noindex:
149
150.. automethod:: waeup.kofa.students.utils.StudentsUtils.increaseMatricInteger()
151   :noindex:
152
153.. automethod:: waeup.kofa.students.utils.StudentsUtils.constructMatricNumber()
154   :noindex:
155
156.. automethod:: waeup.kofa.students.utils.StudentsUtils.setMatricNumber()
157   :noindex:
158
159.. automethod:: waeup.kofa.students.utils.StudentsUtils.getAccommodationDetails()
160   :noindex:
161
162.. automethod:: waeup.kofa.students.utils.StudentsUtils.selectBed()
163   :noindex:
164
165.. automethod:: waeup.kofa.students.utils.StudentsUtils.renderPDFAdmissionLetter()
166   :noindex:
167
168.. automethod:: waeup.kofa.students.utils.StudentsUtils.getPDFCreator()
169   :noindex:
170
171.. automethod:: waeup.kofa.students.utils.StudentsUtils.renderPDF()
172   :noindex:
173
174.. automethod:: waeup.kofa.students.utils.StudentsUtils.renderPDFTranscript()
175   :noindex:
176
177.. automethod:: waeup.kofa.students.utils.StudentsUtils.maxCredits()
178   :noindex:
179
180.. automethod:: waeup.kofa.students.utils.StudentsUtils.getBedCoordinates()
181   :noindex:
182
183
184
185
186Applicants Utils
187----------------
188
189
Note: See TracBrowser for help on using the repository browser.