Jonathan Druart
89ade834d6
One big patch for one big move. The "News" feature (opac_news) has been hijacked to handle some system preferences (bug 26050). The goal was to take profit of the UI (editor) and the ability to translate the value. Disclaimer: This patch is NOT offering the best implementation but, as we still don't have bug 24975, it cannot be done now. And no, we don't want to wait for it to move forward here. This patch is going into the right direction anyway. This enhancement is going to rename the "News" with a more genertic "Additional contents". We have two different "categories" of content: "news" and "html customizations". What does it bring? - A split on the UI for disambigate the two types of content (news and syspref/html customizations) - A simplification of the edit form: all languages will be translatable on the same view (like the "notice templates") - Ground will be prepared for different types of content (if needed later) - Staff news can be translated How was the "News" area working before this patch? The opac_news DB table contained a (very inconsistent) 'lang' column. The different values were: - '' => news to display at the OPAC and staff interfaces - 'koha' => news for staff only - 'slip' => news for slip notices - $lang => news for OPAC only, translated in $lang ('en', 'es-ES', etc.) - "$location_$lang" => A syspref moved to this "news" area. The syspref is $location, and is translated in $lang. Eg. OpacLoginInstructions_en, OpacLoginInstructions_fr-FR, opacheader_es-ES This patch is improving the DB structure with the following changes: - renaming 'opac_news' with 'additional_contents' - new 'category' column => 'news' or 'html_customizations' - new 'location' column => For 'news': 'staff_and_opac', 'staff_only', 'slip' => For 'html_customizations': the old syspref name (eg. 'OpacLoginInstructions'). - new 'code' column (see later for more info) - the 'lang' column will only contain the language code ('en', 'es-ES', etc.). BUT a 'default' entry will ALWAYS exist for fallback behaviour. We are getting closer to the 'notice template' table structure because we want to match its UI. The 'code' column will bring us the ability to group the different 'additional_contents' rows. The code for a given news will be the same, but the (lang, title, content) will differ. Examples: News 1 will have, for each of the translated versions (category, code, location, branchcode) ('news', 'News1', $location, $branchcode||undef) And the 3 following columns will differ: (title, content, lang) ('title for news 1', 'content for news 1', 'default') ('titulo para 1', 'contenido para 1', 'es-ES') Note that the "category" is not strictely necessary, but it seems better to have the ability to split the different content by category/type easily. Additional changes: - Syspref 'NewsToolEditor' is renamed 'AdditionalContentsEditor' - Koha::NewItem => Koha::AdditionalContent - Koha::News => Koha::AdditionalContents - Script and template renamed from koha-news to additional-contents - Foreign keys have been renamed - Subpermission edit_news has been renamed edit_additional_contents - The UI can now be accessed via a "News" or "HTML customizations" link from the tools module. The related contents will then be displayed (both categories are now split) Changes not done here: - Primary key 'idnew' could be renamed 'id' Limitations of the upgrade: News cannot be grouped by a unique code for existing translations. => A given news will be now displayed several times on the translated interface Any ideas to improve the upgrade behaviour? We will have to add a warning in the release notes to tell libraries to review their news. Test plan: 0. Don't apply the patches 1. Translate the interfaces in some languages . Create some news for staff and OPAC . Create some content for different entry of HTML customizations Note that you are forced to define a 'default'. Also note that you are only forced to fill the title (not the content). This is certainly problematic (see FIXME in the code) as sometime only the content is displayed. . Play with the interface (edit, delete, filter) . Go to the different places the news are displayed, and confirm they are displayed correctly (staff home, opac home, opac rss) . Create 1+ news for 'slip', check an item out and 'print slip' (from the circulation page). You must see the news. . Go to the different places you are expecting the HTML customizations to be present and confirm that you see them. . Switch the lang of the interface and confirm that you now see the content in the translated version . Generate the templates in another language, don't translate the content . Use this language for the interface and confirm that the 'default' version is displauyed. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> |
||
---|---|---|
.. | ||
get | ||
preview |