? ? Success

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
28 Dec 2016

Summary of Changes

For TinyMCE plugin I have changed the access check, to use "usergroup" instead of "viewlevel", as @infograf768 sugested.
It seems better idea than use "viewlevel".

How it works now:
Each Set can be assigned to multiple Usergroups.
In case if user assigned to multiple groups, and each of these group has different Sets, then will be used last one allowed Set (order: 3, 2, 1, 0).

Also I have made small changes to allow to use Old parameters, where it possible, for avoid some BC problem. Fallback possible only for the params that available in the Set form.

Testing Instructions

test usergroup
Make user in specific group, then play with TinyMCE plugin access option, try to edit the toolbar. And make sure the changes applies to assigned group.

test BC
easy way I found:
Use old site Joomla 3.6, and copy to Joomla 3.7 the values of the params column from #__extensions table (for plg_editors_tinymce extension).
And make sure the plugin use the params by default.

Documentation Changes Required

as part of #11926

avatar Fedik Fedik - open - 28 Dec 2016
avatar Fedik Fedik - change - 28 Dec 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 28 Dec 2016
Category Front End Plugins
7ff4179 28 Dec 2016 avatar Fedik cs
avatar Fedik Fedik - change - 28 Dec 2016
Labels Added: ?
avatar Fedik
Fedik - comment - 28 Dec 2016

It seems Travis failed because UFO ? was near

avatar infograf768
infograf768 - comment - 28 Dec 2016

@fedik
While we test this find here my patch for B/C (obviously done with your former code)
https://www.dropbox.com/s/4fv1vhlkjqsyv6v/tiny_BC.diff?dl=0

avatar ggppdk
ggppdk - comment - 28 Dec 2016

You forgot to change the label of the 'set' parameter "Access" to be :
"Assign set to groups"

or even a shorter label:
"Assign set to"

avatar Fedik
Fedik - comment - 28 Dec 2016

@ggppdk it part of #13367 ?

avatar Fedik
Fedik - comment - 28 Dec 2016

@infograf768 oh it is heavy, it is very heavy ?

avatar infograf768
infograf768 - comment - 28 Dec 2016

@infograf768 oh it is heavy, it is very heavy ?

yes, heavy, but does not cost in terms of performance and prevents using the conditional each time it is necessary

Tested this PR and it is working good.
Set 2 for author, set 1 for Editor
A user both as Author and Editor will get the Editor layout

Remark:
I am not sure the presets should be pre-assigned to any user group as these may have changed drastically in one's site.
It could be by default for a new install imho (in joomla.sql)

I could save a set without any Usergroup chosen: shall we accept this?

Let's test further:
With @ggppdk we were wondering what to do when we have
Authors 1, Authors 2: TinyMCE-Set 1
Authors 3, Authors 4: TinyMCE-Set 2
and a user is in both Author 1 and Author 4
(Used Author, but it could be anything else)

All Authors user groups being at the same level in the hierarchy.

I was thinking that the only solution would be to use the Set/Layout with the highest number (or the lowest depending on discussion).

What do you think?

avatar infograf768
infograf768 - comment - 28 Dec 2016

Hint: to test B/C with my .diff (which can be applied OK after this PR is applied), install a 3.6.5 and copy the tinyMCE params, then paste them in staging.

avatar ggppdk
ggppdk - comment - 28 Dec 2016

oh it is heavy, it is very heavy

@Fedik
It terms of performance it costs zero

so i guess with term "heavy",
you speak of all the old code appearing inside tinymce.php

We can simply only add 1 "if" statement that checks for old configuration, inside tinymce.php,
and move the old code into a legacy.php file (or similar name) and load it

  • thus you get your tinymce.php to be clean of old code
  • no performance hit,
  • and still avoid the configuration B/C break in article / record forms of all existing sites, immediately after Joomla is upgraded ...

[EDIT]
@Fedik
If you agree with the above, can you do it ? (since you have best knowledge of us on the tinymce code and it should take little of your time)

avatar Fedik
Fedik - comment - 28 Dec 2016

so i guess with term "heavy", you speak of all the old code appearing inside tinymce.php

yeap, this ?
And it will remain there forever ?
But I think I will use it.

I am not sure the presets should be pre-assigned to any user group as these may have changed drastically in one's site.
It could be by default for a new install imho

It is pre-assigned only for new (like a default value). If user change this options it will not be changed. So no need SQL.

I could save a set without any Usergroup chosen: shall we accept this?

It not a problem, it just will be ignored. And in future we can use them when assign the set to "specific user", in user profile parameters.

I was thinking that the only solution would be to use the Set/Layout with the highest number (or the lowest depending on discussion).

If I right understood your question: In case if user assigned to multiple groups, and each of these group has different Sets, then will be used lowest Set.

Order is next (by default):
0 - admin level
1 - manager level
all > 1 - public level

The checking for this is here

avatar infograf768
infograf768 - comment - 28 Dec 2016

@Fedik

If I right understood your question: In case if user assigned to multiple groups, and each of these group has different Sets, then will be used lowest Set.

Let me explain further:
Here are my groups: At the same level we have Author, Author 1, Author 2 and Author 3

screen shot 2016-12-28 at 15 04 53

My user is assigned to Author 1 and Author 3
screen shot 2016-12-28 at 15 12 49

In Tiny I have 2 specific sets:
Set 3 is assigned to Author 2 and Author 3
(It is a simple set + the Special character icon (The Omega)

screen shot 2016-12-28 at 15 08 03

Set 2 is assigned to Author and Author 1 (It has the LTR and RTL icons)

screen shot 2016-12-28 at 15 17 35

I log in frontend with this user and Create a new article.

I get the Set 2
screen shot 2016-12-28 at 15 22 41

It looks like it is the group id that is used first. (Author 1)

Now I change the Tiny Set3 and include Author 1 instead of Author 2.
I.e. we have 2 sets including Author 1

When logging in frontend the user still gets the Set 2:
screen shot 2016-12-28 at 15 33 05

Last, I use in both sets only the Author 1

screen shot 2016-12-28 at 15 39 29

And I still get Set2

This is what I was concerned with: which is the criteria that will load one specific set instead of the other?

avatar Fedik
Fedik - comment - 28 Dec 2016

@infograf768 the reason why you have got Set 2, is what I told, always will be used lower one. When multiple Set share groupX then will be used the lower available Set. (the same happens when User assigned to multiple different groups, which assigned to the different sets)

Ideally, a different sets should not share the same group.

It would be cool to allow to assign the group only once, then you would not get such confusing. But it tricky thing. Maybe I try some day/year ?

avatar Fedik
Fedik - comment - 28 Dec 2016

ok, I have added onDisplayLegacy for BC. Please test ?
maybe I should add deprecate tag also?

avatar infograf768
infograf768 - comment - 28 Dec 2016

@Fedik
not tested yet, but i really think we need a specific message, in admin, both when using the editor and when editing the plugin. see my proposal.

avatar Fedik
Fedik - comment - 28 Dec 2016

ok, I will add, a bit later ?

avatar joomla-cms-bot joomla-cms-bot - change - 29 Dec 2016
Category Front End Plugins Administration Language & Strings Front End Plugins
avatar Fedik Fedik - change - 29 Dec 2016
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 29 Dec 2016
Category Front End Plugins Administration Language & Strings Administration Language & Strings JavaScript External Library Front End Plugins
avatar Fedik
Fedik - comment - 29 Dec 2016

I have improved the group select, now the group can be selected only once per the set.

avatar infograf768
infograf768 - comment - 29 Dec 2016

Warning is a bit simple.
What about:

PLG_TINY_LEGACY_WARNING="The <a href="_QQ_"%s"_QQ_">TinyMCE Editor Plugin</a> was updated. It is for now using your legacy parameters. By editing the plugin, you can now assign various layouts to specific user groups."

The warning is missing imho when editing the plugin itself (someone may save its parameters without setting them as desired)

Not sure we should limit the message display to twice. I just would not limit it.

avatar Fedik
Fedik - comment - 29 Dec 2016

I have updated the message, thanks @infograf768
And now it also displayed for the plugin configuration.

About limit the message display, let's vote? ?
for me no much difference

avatar infograf768
infograf768 - comment - 29 Dec 2016

And better English for the message if anybody desires. ?

avatar jeckodevelopment
jeckodevelopment - comment - 29 Dec 2016

What about the following?

The <a href="_QQ_"%s"_QQ_">TinyMCE Editor Plugin</a> has been updated. At the moment, it uses your legacy configuration. By editing the plugin, you can now assign various layouts to specific user groups.

avatar infograf768
infograf768 - comment - 29 Dec 2016

better indeed!

avatar Fedik
Fedik - comment - 29 Dec 2016

updated

avatar infograf768
infograf768 - comment - 29 Dec 2016

I have tested this item successfully on 6e5c1d4

@Fedik @AlexRed I think we can get this in now and then look deeper into the UI


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13387.

avatar infograf768 infograf768 - test_item - 29 Dec 2016 - Tested successfully
avatar infograf768
infograf768 - comment - 30 Dec 2016

@ggppdk Please test now

avatar infograf768
infograf768 - comment - 30 Dec 2016

@Fedik

There is an error in your PR.

  1. Using return $this->onDisplayLegacy($name, $content, $width, $height, $col, $row, $buttons, $id, $asset, $author);
    should only depend on $this->params->exists('mode') && $this->params->exists('alignment')

  2. It is for the message that it should depend on
    $app->isClient('administrator') and && $config_warn_count < 2

Therefore the code should be imho:

		// Check for old params for B/C
		$config_warn_count = $app->getUserState('plg_editors_tinymce.config_legacy_warn_count', 0);

		if ($this->params->exists('mode') && $this->params->exists('alignment'))
		{
			if ($app->isClient('administrator') && $config_warn_count < 2)
			{
				$link = JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . $this->getPluginId());
				$app->enqueueMessage(JText::sprintf('PLG_TINY_LEGACY_WARNING', $link), 'warning');
				$app->setUserState('plg_editors_tinymce.config_legacy_warn_count', ++$config_warn_count);
			}

			return $this->onDisplayLegacy($name, $content, $width, $height, $col, $row, $buttons, $id, $asset, $author);
		}
avatar infograf768
infograf768 - comment - 30 Dec 2016

Patch proposed here
Fedik#3

avatar infograf768
infograf768 - comment - 30 Dec 2016

I have tested this item successfully on ba19737


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13387.

avatar ggppdk
ggppdk - comment - 30 Dec 2016

I have tested this item successfully on ba19737

Works,

  • the tinyMCE old ("legacy") configuration is always used till tinyMCE editor plugin is saved with a new one
  • the warning message is shown in edit forms only twice per login session (and only in backend) and in tinyMCE editor plugin it is shown continuesly till plugin is saved
  • the usergroups that are already used are used (have been assigned a configuration set) can not be re-selected in another set
  • if a user gets "(is assigned)" multiple configurations by belonging to multiple groups then the last one assigned set is used ... (order: 3, 2, 1, 0).

This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13387.
avatar infograf768 infograf768 - test_item - 30 Dec 2016 - Tested successfully
avatar ggppdk ggppdk - test_item - 30 Dec 2016 - Tested successfully
avatar Fedik
Fedik - comment - 30 Dec 2016

one second ?
I want to move $config_warn_count = $app->getUserState('plg_editors_tinymce.config_legacy_warn_count', 0); under $this->params->exists('mode') && $this->params->exists('alignment')

avatar infograf768
infograf768 - comment - 30 Dec 2016

Thanks! RTC

@rdeutz @wilsonge

Can you merge so that we can go on improving this new feature?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13387.

avatar infograf768 infograf768 - change - 30 Dec 2016
Status Pending Ready to Commit
avatar infograf768
infograf768 - comment - 30 Dec 2016

rtc


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13387.

avatar infograf768
infograf768 - comment - 30 Dec 2016

@Fedik

I want to move $config_warn_count = $app->getUserState('plg_editors_tinymce.config_legacy_warn_count', 0); under $this->params->exists('mode') && $this->params->exists('alignment')

let's do that in another PR as we anyway need to correct some cs (spaces instead of tabs in setoptions.xml, others.

avatar rdeutz rdeutz - change - 30 Dec 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-12-30 08:46:35
Closed_By rdeutz
Labels Added: ?
avatar rdeutz rdeutz - close - 30 Dec 2016
avatar rdeutz rdeutz - merge - 30 Dec 2016
avatar rdeutz rdeutz - reference | 0bb6c5c - 30 Dec 16
avatar rdeutz rdeutz - merge - 30 Dec 2016
avatar rdeutz rdeutz - close - 30 Dec 2016
avatar Fedik Fedik - head_ref_deleted - 30 Dec 2016

Add a Comment

Login with GitHub to post a comment