Skip to content

Multilanguage (but not only): Adding field menuitem to login menu item#10249

Merged
roland-d merged 5 commits intojoomla:stagingfrom
infograf768:login_menu_redirect
May 7, 2016
Merged

Multilanguage (but not only): Adding field menuitem to login menu item#10249
roland-d merged 5 commits intojoomla:stagingfrom
infograf768:login_menu_redirect

Conversation

@infograf768
Copy link
Copy Markdown
Member

@infograf768 infograf768 commented May 5, 2016

For a reason that I ignore (history I guess), the Login menu item contains a Redirect field in text format.
For multilanguage (as well as monolanguage), it is better to have a "menuitem" type field, which will prevent any error as the redirect should be internal. In that case it is an Itemid which is saved in the database (as already exists for the Logout menu item).
The issue here was to remain B/C while letting people use the alternative "menuitem" field.

To accomplish this, I added a new field of type "menuitem" (for the login and logout parts of the Login menu item), created 2 new rules, and added showon to let display only one field at a time and throw an alert preventing saving a value both in the ancient "Login Redirect" and the new "Menu Item Login Redirect" and as well for "Logout Redirect" and the new "Menu Item Logout Redirect".

When the menuitem field is used, the patch also checks if Multilang is on and, if it is, adds the necessary lang tag to the redirect.

Once this is merge, we will be able to merge a pending PR #9724 allowing multilanguage users to choose any redirection in the login module too, including associations when automatic change is on.

New interface (it is B/C as default is "Login Redirect" text field)

screen shot 2016-05-05 at 09 48 12

If choosing "Menu Item"

screen shot 2016-05-05 at 09 49 26

To test, enter internal values in the "Login redirect" and "Logout redirect" fields, save.
Then patch and test in monolanguage and multilanguage.

For example, if both fields are used for login (or/and logout), validation will prevent saving the menu item and we will get a Warning.

screen shot 2016-05-05 at 09 53 43

or

screen shot 2016-05-05 at 09 56 03

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-staging labels May 5, 2016
@infograf768
Copy link
Copy Markdown
Member Author

@andrepereiradasilva @brianteeman @richard67 @Bakual @mannybiker

Thanks for testing.

@brianteeman
Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on 6fa9124

Great stuff


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

@brianteeman
Copy link
Copy Markdown
Contributor

Is it possible to make the default be the new menu item option and the custom url only displayed on load if it is set
that should still be b/c


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

@infograf768
Copy link
Copy Markdown
Member Author

@brianteeman
If we set the "Choose Login Redirect Type" field default to Menu Item (i.e. value="1", it will indeed not kill what was entered before in the present "Login Redirect" field, thus being B/C indeed. It may just confuse the user who already used that field.
It is an easy change. Let's see what other testers think.

@joomla-cms-bot
Copy link
Copy Markdown

This PR has received new commits.

CC: @brianteeman


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

@brianteeman
Copy link
Copy Markdown
Contributor

But can it be set so that IF custom url not blank then it is displayed.
That should remove any confusion if possible

On 5 May 2016 at 09:21, infograf768 notifications@github.com wrote:

@brianteeman https://github.com/brianteeman
If we set the "Choose Login Redirect Type" field default to Menu Item
(i.e. value="1", it will indeed not kill what was entered before in the
present "Login Redirect" field, thus being B/C indeed. It may just confuse
the user who already used that field.
It is an easy change. Let's see what other testers think.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#10249 (comment)

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

@infograf768
Copy link
Copy Markdown
Member Author

let me see

@infograf768
Copy link
Copy Markdown
Member Author

nope, can'f find how to.
needs more tests and feedback

@mannybiker
Copy link
Copy Markdown
Contributor

Item tested and working. Very useful addition since it was very time consuming and reason for mistakes to find all the correct article id, catid, itemid to compose manually the URL.

I agree with brianteeman on the default behaviour of having the menu item as default option if the custom URL filed is empty, but I understand that if this is technically difficult to achieve it is probably best to keep the Custom URL as the first option so that it is clear that either there is no configured URL or the old data is still there.

@joomla-cms-bot
Copy link
Copy Markdown

This PR has received new commits.

CC: @brianteeman


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

@infograf768
Copy link
Copy Markdown
Member Author

Found the solution. Easier in the morning 😄
The custom URL redirect fields will now display when the fields have a value. I obtained this result by adding a special case in the getItem() method in ROOT/administrator/components/com_menus/models/item.php
Menu Item is now default (test creating a new login menu item).
(Also took off a useless variable in the new rules files)

@mannybiker
@andrepereiradasilva
@brianteeman

Thanks for testing

@brianteeman
Copy link
Copy Markdown
Contributor

Awesome - knew you wouldnt give up until you worked out how to do it

On 6 May 2016 at 07:53, infograf768 notifications@github.com wrote:

Found the solution. Easier in the morning 😄
The custom URL redirect fields will now display when the fields have a
value. I obtained this result by adding a special case in the getItem()
method in ROOT/administrator/components/com_menus/models/item.php
Menu Item is now default (test creating a new login menu item).
(Also took off a useless variable in the new rules files)

@mannybiker https://github.com/mannybiker
@andrepereiradasilva https://github.com/andrepereiradasilva
@brianteeman https://github.com/brianteeman

Thanks for testing


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#10249 (comment)

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

@infograf768
Copy link
Copy Markdown
Member Author

Can you folks set this RTC in issues (after testing 😃 )

@brianteeman
Copy link
Copy Markdown
Contributor

Dont worry - I'm on a train to the sprint right now but will make sure it
gets merged over the weekend

On 6 May 2016 at 08:07, infograf768 notifications@github.com wrote:

Can you folks set this RTC in issues (after testing 😃 )


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#10249 (comment)

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

COM_USERS_FIELD_CATEGORY_ID_LABEL="Category"
COM_USERS_FIELD_ID_LABEL="ID"
COM_USERS_FIELD_LOGIN_MENUITEM="Menu Item"
COM_USERS_FIELD_LOGIN_REDIRECT_CHOICE_DESC="'Custom URL' lets enter any internal url in the Redirect field while 'Menu Item' let's directly select an existing menu item.<br />For a multilingual site, it is advised to choose 'Menu Item'."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change this string to the following as it is better English

+COM_USERS_FIELD_LOGIN_REDIRECT_CHOICE_DESC="'Custom URL' lets you manually enter any internal url in the Redirect field. 'Menu Item' lets you directly select an existing menu item.
For a multilingual site, it is advised to use 'Menu Item'."

@brianteeman
Copy link
Copy Markdown
Contributor

Made a small suggestion for one of the language strings


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

@joomla-cms-bot
Copy link
Copy Markdown

This PR has received new commits.

CC: @brianteeman


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

@infograf768
Copy link
Copy Markdown
Member Author

Done. Thanks Brian.

@brianteeman
Copy link
Copy Markdown
Contributor

brianteeman commented May 6, 2016 via email

item in case some 3rd party component uses similar field names
@joomla-cms-bot
Copy link
Copy Markdown

This PR has received new commits.

CC: @brianteeman


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

@andrepereiradasilva
Copy link
Copy Markdown
Contributor

Didn't do a full test, but discovered this issue.
Used sample data. Created a login menu item with this values.

image

Custom URL in login didn't work, the custom URL in logout worked.

@andrepereiradasilva
Copy link
Copy Markdown
Contributor

Ok i see we have to add internal URI (index.php?....)... hum, this should be in the tooltip.

@MATsxm
Copy link
Copy Markdown

MATsxm commented May 6, 2016

I have tested this item ✅ successfully on 5265043

Thanks


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

@infograf768
Copy link
Copy Markdown
Member Author

@andrepereiradasilva
the tip for the redirect url field is in main en-GB.ini. JFIELD_LOGIN_ etc. I did not touch it. It is unrelated to this PR

@andrepereiradasilva
Copy link
Copy Markdown
Contributor

the tip for the redirect url field is in main en-GB.ini. JFIELD_LOGIN_ etc. I did not touch it. It is unrelated to this PR

i know, just pointing out that.

Tests in en-GB ok. Still have to test in a multilanguage env.

@infograf768
Copy link
Copy Markdown
Member Author

infograf768 commented May 6, 2016

@andrepereiradasilva
I agree the tips for both redirect url are no good as they only say to enter an internal url without specifying the kind of format expected. (Which has created issues when we changed the code in 3.4.8 as the redirect should now be a JURI one.)
My proposal would be to let alone the constant and value in the main ini file and maybe change here all constants to new ones of type COM_USERS_ with better tip, and, as you said in our private chat, add in both fields a placeholder.
OR we could just add the placeholder.
What do you think?

@andrepereiradasilva
Copy link
Copy Markdown
Contributor

i would add the new tooltip indicating that AND add placeholders (in all login/logout forms). But in another PR.

@infograf768
Copy link
Copy Markdown
Member Author

OK, let's do that in another PR and get this one in first.

@andrepereiradasilva
Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on 5265043


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

@brianteeman
Copy link
Copy Markdown
Contributor

Rtc


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label May 6, 2016
@brianteeman brianteeman added this to the Joomla 3.6.0 milestone May 6, 2016
infograf768 added a commit to infograf768/joomla-cms that referenced this pull request May 7, 2016
@roland-d roland-d merged commit caadf91 into joomla:staging May 7, 2016
@roland-d
Copy link
Copy Markdown
Contributor

roland-d commented May 7, 2016

Merged, thanks everybody for participating.

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label May 7, 2016
@infograf768
Copy link
Copy Markdown
Member Author

thanks @roland-d

roland-d pushed a commit that referenced this pull request May 8, 2016
… or login/logout menu items (#9724)

* [imp] Multilanguage: allowing any login redirection

* correcting menulogout to cope with logout set to Default

* better

* Implementing associations redirect from login module redirection

* cs

* Correcting when site is not multilingual

* Taking off the part for menu logout as it is already in #10249
@infograf768
Copy link
Copy Markdown
Member Author

Strings modified here: #10336
please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Language Change This is for Translators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants