Holidays-Reloaded
Introduction
OpenGroupware allows you to customize your holidays and holidays groups (including school holidays), without the need of recompilation. It is posible to eliminate some German holidays, add our specific holidays and change holidays groups so it will appear in the web UI.
The text below works for the RPM packages offered by the OpenGroupware.org development team. It may not be exacly the same for the user-compiled versions because the paths may be different. I have not checked the Debian packages.
Preamble: How to display the "German Holidays" in your Calendar
The starting point was to try to understand how the German holidays get displayed. The file for the German school holidays is Holidays.plist. This file is in the source code in
DocumentAPI/OGoScheduler/Holidays.plist
This file is actually in the following path in your RPM installation:
/usr/local/share/opengroupware.org-1.0a/Holidays.plist
OpenGroupware will show the German school holidays in your Calendar, provided you have selected them in the Calendar Preferences. If not, consider upgrading OpenGroupware to the newest packages.
Changing Holiday Groups in the Calendar Preferences Web UI
In the Calendar preferences, you will see the German School Holidays. These Holidays may not be suited for your need. Fortunately you can change this by the use of the Defaults command. (To issue a Defaults command you must be logged on as user ogo)
Where are the German holidays defined?
One of the reasons to activate the German holidays is to have them working and to try to change them to accomodate your local holidays.
The names in the Calendar Preferences interface are from Germany: Hesse, Berlin, Bavaria and so on. Sure they have reputation for good beer.These names are available from the webUI by the file LSWScheduler.strings in your language project file. For example:
/usr/local/share/opengroupware.org-1.0a/translations/English.lproj/LSWScheduler.strings /usr/local/share/opengroupware.org-1.0a/translations/<My-Language>.lproj/LSWScheduler.strings
Inspecting LSWScheduler.strings we see that the German holidays group names are refered internally by the following keywords:
holidaygroup_bay = "Bavaria"; holidaygroup_ber = "Berlin"; holidaygroup_bra = "Brandenburg"; holidaygroup_bre = "Bremen"; ... ... holidaygroup_sah = "Saxony-Anhalt"; holidaygroup_slh = "Schleswig-H."; holidaygroup_thu = "Thuringia";
The groups holidaygroup_bay, holidaygroup_ber, holidaygroup_bra,..., holidaygroup_thu are the keyword to the holidays logic inside OpenGroupware. These keywords groups are defined by the Defaults command on the ogo-webui-1.0a dictionary
#su - ogo
-bash-2.05b$ Default write ogo-webui-1.0a scheduler_school_holidays \
'{
holidaygroup_bay = "";
holidaygroup_ber = "";
holidaygroup_bra = "";
holidaygroup_bre = "";
(snip)
}'
The check-boxes in the WebUI are build with the following Defaults command
-bash-2.05b$ Default write ogo-webui-1.0a scheduler_show_holiday_holidaygroup_bay NO -bash-2.05b$ Default write ogo-webui-1.0a scheduler_show_holiday_holidaygroup_ber NO -bash-2.05b$ Default write ogo-webui-1.0a scheduler_show_holiday_holidaygroup_bra NO -bash-2.05b$ Default write ogo-webui-1.0a scheduler_show_holiday_holidaygroup_bre NO .... (snip)
where you can also change NO to YES if you want the checkbox marked by default.
Adding your own holiday group in the webUI
If you want to create your own holidays group you need to issue your own Defaults command and add the new strings in the corresponding language file.
Let us suppose that you want to add the holidays of the XYZ province in your country. Issue the following command
-bash-2.05b$ Default write ogo-webui-1.0a scheduler_school_holidays
'{
holidaygroup_xyz = "";
...
}'
The checkbox corresponding to My XYZ Province will be displayed if the following line is inserted into the same file:
... -bash-2.05b$ Default write ogo-webui-1.0a scheduler_show_holiday_holidaygroup_xyz NO ...
Change NO to YES if you want the checkbox marked by default.
Then give the proper name of the province into your language. To do so edit the file
/usr/local/share/opengroupware.org-1.0a/translations/<My-Language>.lproj/LSWScheduler.strings
holidaygroup_xyz = "My XYZ Province";
After defining all the holidays groups you may start OpenrGroupware and it should now display My XYZ Province in the section School Holidays in the Calendar Preferences. Note that you can change the term "School Holiday" as well if you want, for example "Province Holidays".
Remember that these modification must be saved adequately because the modified files will be overwritten at each new update of the RPM packages.
Adding dates to your new holiday group
Now you probably want to insert the dates of the holidays for "My XYZ Province". This will be now done modifying the file Holiday.plist.
Holiday.plist is located here
/usr/local/share/opengroupware.org-1.0a/Holidays.plist
The contects may look like this:
scheduler_2005_holidays ={
xyz = {
"01-21" = "SaoSebastiaoRJ";
"04-23" = "SaoJorgeRJ";
"04-12" = "SaoBeneditoAR";
"12-08" = "ImaculadaConceicaoAR";
"11-20" = "ConcienciaNegra";
};
SP = {
"01-25" = "SaoPauloSP";
"07-09" = "RevolucaoConstitucionalista";
};
MG = {
"" = "";
};
...
The key xyz refers to the holiday group My XYZ Province. The leftmost part of the equality is the date of the holiday and the rightmost is a translatable keyword.
To get the right string displayed in your webUI you need to give a translated string to the keyword. This is done editing the file
/usr/local/share/opengroupware.org-1.0a/translations/<My-Language>.lproj/OGoSchedulerViews.strings
Add the translatable strings anywhere in the file. It is optional to remove the references to the german holidays, if you don't want them. For example
//XYZ SaoSebastiaoRJ_xyz = "São Sebastião (Rio de Janeiro)"; SaoJorgeRJ_xyz = "São Jorge (Rio de Janeiro)"; SaoBeneditoAR_xyz = "São Benedito (Angra dos Reis)"; ImaculadaConceicaoAR_xyz = "Imaculada Conceição (Angra dos Reis)"; ConcienciaNegra_xyz = "Dia da Conciência Negra"; //SP SaoPauloSP_SP = "São Paulo (Capital)"; RevolucaoConstitucionalista_SP = "Revolução Constitucionalista";
Each keyword must have the suffix _xyz in the lines above, to address the correct province holidays.
Do not forget to save these files as they will be overwriten the next update of OpenGroupware.org.
Other Holidays
You can use the Defaults command to select other holidays (of course related to Germany). Some may be of interest, other perhaps no. For example if you don't need the holiday group Advent, you may issue the following Default command:
-bash-2.05b$ Default write ogo-webui-1.0a scheduler_holiday_groups
'{
holidaygroup_advent = ""; // remove this
holidaygroup_bylaw = "";
holidaygroup_custom_all = "";
holidaygroup_custom_private = "";
}'
and the corresponding checkbox.
-bash-2.05b$ Default delete ogo-webui-1.0a scheduler_show_holiday_holidaygroup_advent
It is then up to you if you want to remove the lines related to the Advent in the corresponding strings in OGoSchedulerViews.strings.
If Mother's Day is not celebrated in your country you can remove it's reference:
// holidays not bound in groups
scheduler_available_holidays = (
"shrovetide", "mothersDay",
"summertimeChange", "wintertimeChange", "christmasEve",
"deathsSunday", "newYearsEve"
);
All these modification must be saved adequately because the modified files will be overwritten at each new update of the RPM packages.
Easter Holidays
Easter calculations are done in the source file SkyHolidayCalculator.m . Easter and Easter-related holidays are included into the group Holidays by law. Apparently this group also adds the May Day (May 1st) and Day of Prayer and Repentance (November 17th).
TO DO:
- As far as I can tell the following piece of code in Default.plist has no effect in the display of holidays.
// holidays scheduler_show_holiday_shrovetide = NO; // Fastnacht scheduler_show_holiday_ascension = YES; // Christi Himmelfahrt scheduler_show_holiday_mothersDay = NO; // Muttertag scheduler_show_holiday_corpusChristi = NO; // Fronleichnam scheduler_show_holiday_summertimeChange = YES; // Sommerzeitumstellung scheduler_show_holiday_wintertimeChange = YES; // Winterzeitumstellung scheduler_show_holiday_christmasEve = YES; // Weihnachtsabend scheduler_show_holiday_newYearsEve = YES; // Silvester scheduler_show_holiday_deathsSunday = NO; // Totensonntag scheduler_show_holiday_newYear = YES; scheduler_show_holiday_holyThreeKings = YES; scheduler_show_holiday_goodFriday = YES; scheduler_show_holiday_easter = YES; scheduler_show_holiday_firstMay = YES; scheduler_show_holiday_whitsun = YES; scheduler_show_holiday_germanUnityDay = YES; scheduler_show_holiday_reformationsDay = YES; scheduler_show_holiday_allSaintsDay = YES; scheduler_show_holiday_christmasDay = YES; scheduler_show_holiday_boxingDay = YES; scheduler_show_holiday_firstAdvent = NO; scheduler_show_holiday_secondAdvent = NO; scheduler_show_holiday_thirdAdvent = NO; scheduler_show_holiday_fourthAdvent = NO; scheduler_show_holiday_dayOfPrayerAndRepetance = YES;
- Pull-out Easter group from "Holiday by law"
- Code cleanup of SkyHolidayCalculator.m
- Perhaps create a "my-country" RPM package with specificities (such as holidays, time zones) of you country, to be donwloaded in a "extra" folder of the official site, out of the "core" packages.
- write "Holidays Revolutions"?.