Documentation OTRS 5
Total Page:16
File Type:pdf, Size:1020Kb
Documentation OTRS 5 - Developer Manual Build Date: 2015-05-12 OTRS 5 - Developer Manual Copyright © 2003-2015 OTRS AG This work is copyrighted by OTRS AG. You may copy it in whole or in part as long as the copies retain this copyright statement. The source code of this document can be found at github, in the repository doc-developer. Contributions are more than welcome. You can also help translating it to your language at Transifex. UNIX is a registered trademark of X/Open Company Limited. Linux is a registered trademark of Linus Torvalds. MS- DOS, Windows, Windows 95, Windows 98, Windows NT, Windows 2000, Windows XP, Windows 2003, Windows Vista and Windows 7 are registered trademarks of Microsoft Corporation. Other trademarks and registered trademarks are: SUSE and YaST of SUSE Linux GmbH, Red Hat and Fedora are registered trademarks of Red Hat, Inc. Mandrake is a registered trademark of MandrakeSoft, SA. Debian is a registered trademark of Software in the Public Interest, Inc. MySQL and the MySQL Logo are registered trademarks of Oracle Corporation and/or its affiliates. All trade names are used without the guarantee for their free use and are possibly registered trade marks. OTRS AG essentially follows the notations of the manufacturers. Other products mentioned in this manual may be trademarks of the respective manufacturer. Table of Contents 1. Getting Started .......................................................................................................... 1 1. Development Environment ................................................................................. 1 1.1. Framework checkout ................................................................................ 1 1.2. Useful Tools .............................................................................................. 1 1.3. Linking Expansion Modules ...................................................................... 1 2. Architecture Overview ........................................................................................ 2 2.1. Directories ................................................................................................ 3 2.2. Files .......................................................................................................... 4 2.3. Core Modules ........................................................................................... 4 2.4. Frontend Handle ...................................................................................... 4 2.5. Frontend Modules .................................................................................... 5 2.6. CMD Frontend .......................................................................................... 5 2.7. Generic Interface Modules ....................................................................... 5 2.8. Scheduler Task Handler Modules ............................................................. 6 2.9. Database .................................................................................................. 6 2. OTRS Internals - How it Works .................................................................................. 7 1. Config Mechanism .............................................................................................. 7 1.1. Defaults.pm: OTRS Default Configuration .............................................. 7 1.2. Automatically Generated Configuration Files ........................................... 7 1.3. XML Config Options ................................................................................. 7 1.4. Accessing Config Options at Runtime .................................................... 10 2. Database Mechanism ....................................................................................... 11 2.1. How it works .......................................................................................... 11 2.2. Database Drivers ................................................................................... 14 2.3. Supported Databases ............................................................................ 14 3. Log Mechanism ................................................................................................ 14 4. Skins ................................................................................................................. 14 4.1. Skin Basics ............................................................................................. 14 4.2. How skins are loaded ............................................................................ 14 4.3. Creating a New Skin .............................................................................. 16 5. The CSS and JavaScript "Loader" ..................................................................... 17 5.1. How it works .......................................................................................... 17 5.2. Basic Operation ..................................................................................... 18 5.3. Configuring the Loader: JavaScript ........................................................ 19 5.4. Configuring the Loader: CSS .................................................................. 21 6. Templating Mechanism ..................................................................................... 22 6.1. Template Commands ............................................................................. 23 6.2. Using a template file ............................................................................. 29 7. Localization / Translation Mechanism ............................................................... 29 7.1. Marking translatable strings in the source files ..................................... 29 7.2. Collecting translatable strings into the translation database ................. 30 7.3. The translation process itself ................................................................. 31 7.4. Using the translated data from the code ............................................... 31 3. How to Extend OTRS ............................................................................................... 32 1. Writing a new OTRS frontend module .............................................................. 32 1.1. What we want to write .......................................................................... 32 1.2. Default Config File ................................................................................. 32 1.3. Frontend Module .................................................................................... 33 1.4. Core Module ........................................................................................... 33 1.5. Template File .......................................................................................... 34 1.6. Language File ......................................................................................... 34 1.7. Summary ................................................................................................ 35 2. Using the power of the OTRS module layers ................................................... 35 2.1. Authentication and user management .................................................. 35 2.2. Preferences ............................................................................................ 42 iii 2.3. Other core functions .............................................................................. 51 2.4. Frontend Modules .................................................................................. 72 2.5. Generic Interface Modules ..................................................................... 80 2.6. Scheduler Task Handler Modules ........................................................... 95 2.7. Dynamic Fields ....................................................................................... 97 2.8. Email Handling ..................................................................................... 129 4. How to Publish Your OTRS Extensions ................................................................... 132 1. Package Management .................................................................................... 132 1.1. Package Distribution ............................................................................ 132 1.2. Package Commands ............................................................................. 132 2. Package Building ............................................................................................ 133 2.1. Package Spec File ................................................................................ 133 2.2. Example .sopm .................................................................................... 139 2.3. Package Build ...................................................................................... 140 2.4. Package Life Cycle - Install/Upgrade/Uninstall ..................................... 140 3. Package Porting .............................................................................................. 140 3.1. From OTRS 4 to 5 ................................................................................ 140 3.2. From OTRS 3.3 to 4 ............................................................................. 142 5. Contributing to OTRS ............................................................................................. 150 1. Sending Contributions .................................................................................... 150 2. Translating OTRS ...........................................................................................