Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.0] Add a global master language for Multilingual Associations #25403

Draft
wants to merge 127 commits into
base: 6.0-dev
Choose a base branch
from

Conversation

lavipr
Copy link
Contributor

@lavipr lavipr commented Jul 2, 2019

This adds an optional global master language for the multilingual associations. The topic that had its beginnings in the two PR's #17881 and #17802 was tackled from scratch.

This gives each association a "Master-Child" relationship. This means that an associated item set with the master language is set as master and the items in the other languages are set as children.
This makes it possible to add new association statuses to the already existing 'not associated' and 'associated' ones: the 'outdated' and 'up-to-date' status. These new statuses maintain the child elements in relation to their master.
When associations are created, the children are given up-to-date status. If the master item is changed, the children will be set to outdated (if they were up-to-date until then). A distinction is made between whether the content history is enabled or not. The difference: content history only saves entries in which changes are really made.
In the Associations List View a new filter for the Association States has been added.

To update an outdated child to up-to-date a new edit view is called, in which it is only possible to save and update the target (i.e. the outdated child).
Here, too, a distinction is made between whether the content history is activated or not. If content history is activated, a customized Compare View of contenthistory is displayed. The changes of the master are displayed since the moment the child was set to outdated and to the current master.
If it is content history disabled, the normal edit view of the reference/master is displayed. The user has to determine whether there are changes to the master or not. Advantage over before: by the status outdated you at least know that someone has saved the master.

Summary of Changes

  • The Associations List View is the only List View in the backend that has the behavior that no content is displayed the first time this view is called. This is confusing, especially for users who have not yet spent long time with associations. To adapt this list view to the others so that a more uniform behavior is achieved in the backend, the filters for itemtype and language are filled with default values. This means that the two buttons 'delete all associations' and 'delete orphans' must always be displayed accordingly (otherwise they were hidden as soon as a list appears - see Associations - delete / delete orphans #21869). Delete All Associations no longer deletes all associations, but all associations with matching context.
  • The colors for the association states 'associated' and 'not associated' have now changed everywhere: gray for 'not associated' and green for associated and 'up-to-date'. Orange now stands for 'outdated'.
  • The option to set the global master language has been added to the languagefilter plugin.
  • New columns in #__associations:
    • master_id' in which the ID of the master item is stored for the child items otherwise 0 for the master item itself and
    • 'master_date' where either the modified date or the save date of the history table of the master item is stored. The child item gets the same master date as its master item if they are newly associated or when the child item gets updated.
  • Fix bug where newsfeeds and contacts get the same assoc key.
    To prevent associations from receiving the same association key, since id and language can be the same in different contexts, the context is also added as differentiation.
    As the bug appears only after my new queries (key query only), this is fixed here.
  • For the masterlanguage see above.

Testing Instructions

  • Install a new instance because there are changes in the sql.
  • Install at least two languages. For example, install the multilingual sample data and then the normal sample data (so there is sample data for associated and non-associated items).
  • Now no global master language is set yet. The behaviour of the associations should be the same as before. Only the colors have changed.
    No empty list appears in the Associations List View and the delete buttons are now always displayed.
  • Go to the Languagefilter plugin and activate a global master language.
    Go back to the Associations List View. A new filter appears and the associations are displayed differently, also in other List Views with associations.
  • Change a master item. With versions enabled (default) you need to really make changes and save the master in order to check if children gets 'outdated'.
    Update a child element.

Expected result

  • Associations List View without a global Master Language:
    image

  • Articles List View without a global Master Language:
    image

  • Set a global Master Language in the Languagefilter Plugin:
    SetGlobalMaster

  • Associations List View with Global Master Language:
    image

  • Articles List View with Global Master Language:
    image

  • New Update/Edit View for outdated items with versions enabled:
    image

Actual result

  • No global Master Language Setting in the Languagefilter Plugin.
  • No 'outdated' or 'up-to-date' association states.
  • Associations List View:
    FirstEntryAssociations
  • Articles List View:
    image

Documentation Changes Required

Yes

lavipr added 30 commits May 27, 2019 17:15
Since this list view is the only one in which an empty table is displayed before the user specifies what he wants to see via the select boxes, a preselection is defined by "default-values". The default language is set with the default site language, because normally the translations start from this language.
Since the selectboxes now always have a value, the buttons Delete associations and delete orphans of the toolbar are now always displayed.

The "delete associations"-button now only deletes associations in which the user is currently located.
- In addition, the button was adapted to a Confirm button, so that the associated js file and the associated message text could be removed.
- The context is now also included as info in the message text.
- picked code from Wang-Yu-Chao/gsoc18_automatic_multilingual_association@55d46a1
-- remove column "Not Associated" from table
-- removed now unused string
-- removed parameter from function, as it is useless now
--- remove all code using this parameter
-- change color of the language-links
--- grey (secondary) for not associated items
--- green (success) for associated items
This add two fields for setting a masterlanguage in the languagefilter plugin.
To set these parameters correctly there has been added an onExtensionAfterSave event, because these parameters depends on others.
The master item is the one written in the language of the global master language.
- New Column 'parent_id' for saving relationsship of items of an association.
  If an association contains no items with the masterlanguage (it may be not used) the value is -1.
  If an association contains an item with the masterlanguage, this is now the parent and is set with 0.
  The other items of this association get the id of the master item / parent.
- Add new method to get the global master language parameter.
- Change save-methods for the associations table concidering the new column
- Add methods to change the master item in the associations table after saving the Languagefilter Plugin.
- set global master language parameters in multi sample data
After the colors in the association view have changed after the columns have been merged, they are now adjusted for the other lists.
In addition, the association column has been centered in each list.
If a global master language has been set, it is displayed as info in the Language select box , so that it is recognizable which master language has been set.
In order to display the Master-Child relationship of the associations in the lists, the layout was adapted.
So now all children of an association are displayed, if the item in the row is a master item. Otherwise, only the current child-item is displayed with its master item, since there is no direct relationship between the children.
In addition, the links of the association items in the Associations View have been adjusted so that the reference is now oriented to the master item and target to the children.
This adds a new column "assocParams" to the association table where the modified date of the master item is stored. The column for the master item always gets its latest modified date, its children get the modified date when the association is created.

The table of menu items does not yet have a modified date, so the column remains empty.

Also, a new AssociationsHelperClass is added for all Masterlanguage matters.
Adding this filter allows to quickly determine if a master element is associated or not and if child elements are either associated, not associated or obsolete.
Set parent id correctly if no master item is present.
To prevent associations from receiving the same association key, since id and language can be the same in different contexts, the context is also added as differentiation.
As described in WCAG 3.3.2: 'Labels or instructions are provided when content requires user input. (Level A)'
Remove the fieldset for the master language and position its fields after the item association field, as the master fields depend on it.
Filtering for "not associated" did not work correctly when either a child of a master item is not associated or when there is no master item for a child.
Comment on lines +8 to +9
*/

This comment was marked as abuse.

* @package Joomla.Administrator
* @subpackage com_contenthistory
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.

This comment was marked as abuse.

* @package Joomla.Plugin
* @subpackage System.languagefilter
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.

This comment was marked as abuse.

/**
* Content Site Languages Field class.
*
* @since 4.0

This comment was marked as abuse.

*
* @var string
*
* @since 4.0

This comment was marked as abuse.

*
* @return array The field option objects.
*
* @since 4.0

This comment was marked as abuse.

*
* @return void
*
* @since 4.0.0

This comment was marked as abuse.

*
* @return void
*
* @since 4.0.0

This comment was marked as abuse.

*
* @throws Exception
*
* @since 4.0.0

This comment was marked as abuse.

@bembelimen bembelimen marked this pull request as draft December 18, 2021 14:16
@laoneo
Copy link
Member

laoneo commented Apr 15, 2022

Sorry that it took so long to respond. This has a big potential it would be a nice addition for Joomla. Unfortunately it never came out of the draft state and has currently a lot of conflicts, so I'm going to close this. If you are willing to drive it further, please fix the conflicts and rebase it to the 4.2-dev branch so we can help you get it into a testable state. Thanks for your help making Joomla better.

@laoneo laoneo closed this Apr 15, 2022
@bembelimen bembelimen reopened this Apr 15, 2022
@bembelimen
Copy link
Contributor

As mentioned, it's a feature which is useful and if possible should make it into the core. So to not lose it between thousands of closed PRs, it should stay as a draft for a future rework.

@HLeithner HLeithner changed the base branch from 4.1-dev to 4.2-dev June 27, 2022 13:09
@HLeithner
Copy link
Member

This pull request has automatically rebased to 4.2-dev.

@rdeutz rdeutz changed the title [4.1] Add a global master language for Multilingual Associations Add a global master language for Multilingual Associations Oct 21, 2022
@Hackwar Hackwar changed the base branch from 4.2-dev to 5.0-dev October 21, 2022 14:13
@HLeithner HLeithner changed the base branch from 5.0-dev to 5.1-dev September 30, 2023 22:52
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 5.1-dev.

@joomleb
Copy link

joomleb commented Oct 2, 2023

Hi guys,
working on this would be good to pay attention at #19807

@rdeutz rdeutz self-assigned this Oct 24, 2023
@bembelimen bembelimen changed the base branch from 5.1-dev to 6.0-dev March 2, 2024 19:33
@HLeithner HLeithner changed the title Add a global master language for Multilingual Associations [6.0] Add a global master language for Multilingual Associations Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Conflicting Files Feature Language Change This is for Translators PR-5.0-dev PR-6.0-dev Ready to take over This is an abandoned feature which can be taken over by another person to finish it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet