[13120] | 1 | .. _customization: |
---|
| 2 | |
---|
| 3 | Portal Customization |
---|
| 4 | ******************** |
---|
| 5 | |
---|
[13121] | 6 | Portal customization requires profound knowledge of the Python |
---|
| 7 | programming language. Customization is part of the portal deployment |
---|
| 8 | process. It can only be done by the custom package manager and |
---|
| 9 | activated by the system administrator, who is allowed to |
---|
| 10 | update/upgrade the package on the server and restart the portal. |
---|
| 11 | Usually, custom packages are not designed for regular |
---|
| 12 | reconfiguration. Due to the complexity of school fee computation at |
---|
| 13 | Nigerian universities, however, a lot of configuration had to be |
---|
| 14 | done in the Python code and can thus not be subject to online |
---|
| 15 | configuration. Technically speaking, the parameters are only loaded |
---|
| 16 | and registered once during start-up and are not stored in the |
---|
| 17 | database like the configuration parameters described in |
---|
| 18 | :ref:`configuration`. |
---|
[13120] | 19 | |
---|
[13121] | 20 | Kofa must not be customized by manipulating original Kofa code, i.e. |
---|
| 21 | by editing Python files, Zope page templates or ZCML configuration |
---|
| 22 | files in the Kofa base package. Customization is done by deploying a |
---|
| 23 | custom package which can inherit all the Python classes from the |
---|
| 24 | base package, in order to override distinct attributes and methods |
---|
| 25 | and register these customized classes instead of the orginal classes |
---|
| 26 | during start-up. It would go beyond the scope of the user handbook |
---|
| 27 | to explain, how to build such a Kofa custom package. This will be |
---|
| 28 | done in the :ref:`developer_handbook`. Here we roughly describe the |
---|
| 29 | three different customization approaches with a focus on the third |
---|
| 30 | approach, the customization of utility attributes and methods. |
---|
[13120] | 31 | |
---|
| 32 | Localization |
---|
| 33 | ============ |
---|
| 34 | |
---|
[13121] | 35 | The base language of the Kofa User Interface (Kofa UI) is English. |
---|
| 36 | The English language regime has been specified by WAeUP's first |
---|
| 37 | customer, the University of Benin in Nigeria. Kofa is language-aware, |
---|
| 38 | which means it has been translated into different languages (German |
---|
| 39 | and French so far), and the preferred language can be selected via |
---|
| 40 | the UI. The Kofa UI translations and also the English language |
---|
| 41 | regime can be localized in custom packages by overriding single |
---|
| 42 | entries of the language files. Headlines, field labels, field |
---|
| 43 | descriptions, navigation tabs, buttons, page comments, flash |
---|
| 44 | messages etc. can be easily adjusted to the needs of the institution |
---|
| 45 | which wants to deploy Kofa. |
---|
| 46 | |
---|
| 47 | Kofa is using the `GNU gettext utilities |
---|
| 48 | <http://www.gnu.org/software/gettext>`_ for translation and |
---|
| 49 | localization. Translation is done via ``po`` text files which are |
---|
| 50 | located in the ``locales`` folder of a package. Each language has |
---|
[13124] | 51 | its own subfolder. Localized English Kofa terms, for instance, can be |
---|
[13121] | 52 | found in ``locales/en/LC_MESSAGES/waeup.kofa.po``. A single |
---|
| 53 | entry/message consists of two lines. |
---|
| 54 | |
---|
| 55 | Example:: |
---|
| 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 |
---|
| 62 | into a renamed login tab on the right side of the navigation bar. |
---|
| 63 | |
---|
| 64 | ``po`` files must be compiled before restarting the portal. Editing |
---|
| 65 | and compilation of ``po`` files can be done with a nice tool called |
---|
| 66 | 'Poedit' which is `available <https://poedit.net/download>`_ for |
---|
| 67 | various operating systems. |
---|
| 68 | |
---|
| 69 | |
---|
[13120] | 70 | Zope Interfaces |
---|
| 71 | =============== |
---|
| 72 | |
---|
[13124] | 73 | Adding further schema field attributes to content components can be |
---|
| 74 | done by inheriting Zope interfaces from the base package and adding |
---|
| 75 | new schema fields to these custom interfaces, see :ref:`note |
---|
| 76 | <kofa_interfaces>`. This sounds simple, but it isn't. There are many |
---|
| 77 | things to think about, when customizing interfaces: |
---|
| 78 | |
---|
| 79 | 1. 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 | |
---|
| 88 | 2. 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 | |
---|
| 93 | 3. 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 | |
---|
[13120] | 99 | Zope Utilities |
---|
| 100 | ============== |
---|
| 101 | |
---|
[13124] | 102 | Kofa's global utilities are perfectly suited for customization. |
---|
| 103 | Their attributes and methods can be easily overridden in custom |
---|
| 104 | packages. |
---|
[13120] | 105 | |
---|
| 106 | Kofa Utils |
---|
| 107 | ---------- |
---|
| 108 | |
---|
[13124] | 109 | The central `KofaUtils` utility contains not only most dictionaries |
---|
[13132] | 110 | used for sources (see :py:class:`API |
---|
[13133] | 111 | <waeup.kofa.utils.utils.KofaUtils>`) but also **configuration |
---|
[13167] | 112 | attributes** like: |
---|
[13124] | 113 | |
---|
[13132] | 114 | .. autoattribute:: waeup.kofa.utils.utils.KofaUtils.PORTAL_LANGUAGE |
---|
| 115 | :noindex: |
---|
| 116 | |
---|
| 117 | .. autoattribute:: waeup.kofa.utils.utils.KofaUtils.tzinfo |
---|
| 118 | :noindex: |
---|
| 119 | |
---|
| 120 | .. autoattribute:: waeup.kofa.utils.utils.KofaUtils.SYSTEM_MAX_LOAD |
---|
| 121 | :noindex: |
---|
| 122 | |
---|
[13133] | 123 | Customizable **utility methods** are: |
---|
[13124] | 124 | |
---|
[13133] | 125 | .. automethod:: waeup.kofa.utils.utils.KofaUtils.sendContactForm |
---|
[13124] | 126 | :noindex: |
---|
| 127 | |
---|
[13133] | 128 | .. automethod:: waeup.kofa.utils.utils.KofaUtils.fullname |
---|
[13124] | 129 | :noindex: |
---|
| 130 | |
---|
[13133] | 131 | .. automethod:: waeup.kofa.utils.utils.KofaUtils.genPassword |
---|
[13124] | 132 | :noindex: |
---|
| 133 | |
---|
[13133] | 134 | .. automethod:: waeup.kofa.utils.utils.KofaUtils.sendCredentials |
---|
[13124] | 135 | :noindex: |
---|
| 136 | |
---|
[13133] | 137 | .. automethod:: waeup.kofa.utils.utils.KofaUtils.getPaymentItem |
---|
[13124] | 138 | :noindex: |
---|
| 139 | |
---|
[13133] | 140 | Students Utilities |
---|
| 141 | ------------------ |
---|
[13120] | 142 | |
---|
[13133] | 143 | `StudentsUtils` contains the following **configuration attributes**: |
---|
[13132] | 144 | |
---|
| 145 | .. autoattribute:: waeup.kofa.students.utils.StudentsUtils.STUDENT_ID_PREFIX |
---|
| 146 | :noindex: |
---|
| 147 | |
---|
| 148 | .. autoattribute:: waeup.kofa.students.utils.StudentsUtils.SKIP_UPLOAD_VIEWLETS |
---|
| 149 | :noindex: |
---|
| 150 | |
---|
| 151 | .. autoattribute:: waeup.kofa.students.utils.StudentsUtils.PORTRAIT_CHANGE_STATES |
---|
| 152 | :noindex: |
---|
| 153 | |
---|
| 154 | .. autoattribute:: waeup.kofa.students.utils.StudentsUtils.SEPARATORS_DICT |
---|
| 155 | :noindex: |
---|
| 156 | |
---|
| 157 | .. autoattribute:: waeup.kofa.students.utils.StudentsUtils.STUDENT_EXPORTER_NAMES |
---|
| 158 | :noindex: |
---|
| 159 | |
---|
| 160 | .. autoattribute:: waeup.kofa.students.utils.StudentsUtils.STUDENT_BACKUP_EXPORTER_NAMES |
---|
| 161 | :noindex: |
---|
| 162 | |
---|
[13133] | 163 | Customizable **utility methods** are: |
---|
[13124] | 164 | |
---|
[13133] | 165 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.getReturningData |
---|
[13124] | 166 | :noindex: |
---|
| 167 | |
---|
[13133] | 168 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.setReturningData |
---|
[13124] | 169 | :noindex: |
---|
| 170 | |
---|
[13133] | 171 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.setPaymentDetails |
---|
[13124] | 172 | :noindex: |
---|
| 173 | |
---|
[13133] | 174 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.setBalanceDetails |
---|
[13124] | 175 | :noindex: |
---|
| 176 | |
---|
[13133] | 177 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.increaseMatricInteger |
---|
[13124] | 178 | :noindex: |
---|
| 179 | |
---|
[13133] | 180 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.constructMatricNumber |
---|
[13124] | 181 | :noindex: |
---|
| 182 | |
---|
[13133] | 183 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.setMatricNumber |
---|
[13124] | 184 | :noindex: |
---|
| 185 | |
---|
[13133] | 186 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.getAccommodationDetails |
---|
[13124] | 187 | :noindex: |
---|
| 188 | |
---|
[13133] | 189 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.selectBed |
---|
[13124] | 190 | :noindex: |
---|
| 191 | |
---|
[13133] | 192 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.getPDFCreator |
---|
[13124] | 193 | :noindex: |
---|
| 194 | |
---|
[13133] | 195 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.renderPDF |
---|
[13124] | 196 | :noindex: |
---|
| 197 | |
---|
[14655] | 198 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.renderPDFAdmissionLetter |
---|
| 199 | :noindex: |
---|
| 200 | |
---|
| 201 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.renderPDFCourseticketsOverview |
---|
| 202 | :noindex: |
---|
| 203 | |
---|
[13133] | 204 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.renderPDFTranscript |
---|
[13124] | 205 | :noindex: |
---|
| 206 | |
---|
[14655] | 207 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.getDegreeClassNumber |
---|
[13124] | 208 | :noindex: |
---|
| 209 | |
---|
[14655] | 210 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.warnCreditsOOR |
---|
| 211 | :noindex: |
---|
| 212 | |
---|
[13133] | 213 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.getBedCoordinates |
---|
[13124] | 214 | :noindex: |
---|
| 215 | |
---|
[14655] | 216 | .. automethod:: waeup.kofa.students.utils.StudentsUtils.clearance_disabled_message |
---|
| 217 | :noindex: |
---|
[13124] | 218 | |
---|
[14655] | 219 | |
---|
[13133] | 220 | Applicants Utililties |
---|
| 221 | --------------------- |
---|
[13120] | 222 | |
---|
[13133] | 223 | `ApplicantsUtils` contains the following **configuration attributes**: |
---|
[13120] | 224 | |
---|
[13133] | 225 | .. autoattribute:: waeup.kofa.applicants.utils.ApplicantsUtils.APP_TYPES_DICT |
---|
| 226 | :noindex: |
---|
| 227 | |
---|
| 228 | .. autoattribute:: waeup.kofa.applicants.utils.ApplicantsUtils.SEPARATORS_DICT |
---|
| 229 | :noindex: |
---|
| 230 | |
---|
| 231 | Customizable **utility methods** are: |
---|
| 232 | |
---|
| 233 | .. automethod:: waeup.kofa.applicants.utils.ApplicantsUtils.setPaymentDetails |
---|
| 234 | :noindex: |
---|
| 235 | |
---|
| 236 | .. automethod:: waeup.kofa.applicants.utils.ApplicantsUtils.getApplicantsStatistics |
---|
| 237 | :noindex: |
---|
| 238 | |
---|
| 239 | .. automethod:: waeup.kofa.applicants.utils.ApplicantsUtils.sortCertificates |
---|
| 240 | :noindex: |
---|
| 241 | |
---|
| 242 | .. automethod:: waeup.kofa.applicants.utils.ApplicantsUtils.getCertTitle |
---|
| 243 | :noindex: |
---|