? ? Pending

User tests: Successful: Unsuccessful:

avatar joomdonation
joomdonation
19 Sep 2018

Pull Request for Issue #22211.

Summary of Changes

This PR fixes issue described at #22211. Instead of always showing IP address sort options, it will now only be shown if IP logging is enabled.

Testing Instructions

  1. Install Joomla 3.9 beta (or latest staging)
  2. Go to Users -> User Actions Log, click on Options button in the toolbar, set IP logging to No
  3. Before patch: Access to Users -> User Actions Log, you still see IP address sort options in sort dropdown.
  4. After patch: The IP address sort options will only be show if you enable IP Logging. If you disable IP Logging, the IP address sort options will be removed

Documentation Changes Required

None

avatar joomdonation joomdonation - open - 19 Sep 2018
avatar joomdonation joomdonation - change - 19 Sep 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 19 Sep 2018
Category Administration
avatar joomdonation joomdonation - change - 19 Sep 2018
Labels Added: ?
avatar Quy
Quy - comment - 19 Sep 2018

IP Address should not be listed as an option.

ipaddress

IP Address ascending/descending ideally should be listed above ID ascending/descending.

avatar Sandra97
Sandra97 - comment - 19 Sep 2018

I have tested this item successfully on 42d4938

Works fine. The IP Address column is not displayed anymore if IP Logging options is set up on NO.


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

avatar Sandra97 Sandra97 - test_item - 19 Sep 2018 - Tested successfully
avatar Quy
Quy - comment - 19 Sep 2018

I don't know how it is done, but in another XML there is a requires attribute that maybe implemented here.

			<option value="rating_count ASC" requires="vote">JGLOBAL_VOTES_ASC</option>
			<option value="rating_count DESC" requires="vote">JGLOBAL_VOTES_DESC</option>
			<option value="rating ASC" requires="vote">JGLOBAL_RATINGS_ASC</option>
			<option value="rating DESC" requires="vote">JGLOBAL_RATINGS_DESC</option>
avatar joomdonation
joomdonation - comment - 19 Sep 2018

@Quy

  1. IP Address was there because of a typo in the code. It's fixed now
  2. Currently, our Form API is not flexible enough to allow adding new options to any position we want, it can only be added at the end, so we can only have it as how it's for now
  3. The requires is a special handle(kind of hack) for List custom field type. requires="vote" mean the option will only available if vote plugin is enabled, see https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/form/fields/list.php#L137 . It should be used here

@Sandra97 Could you please help testing it again? Making sure the issue which @Quy mentioned is sorted ( IP Address column should not be displayed at all)

avatar Sandra97
Sandra97 - comment - 19 Sep 2018

It works fine, when the IP Address column is not displayed, the IP filter is now not displayed either.

avatar joomdonation
joomdonation - comment - 19 Sep 2018

Great. Thanks for confirming @Sandra97

avatar Ruud68
Ruud68 - comment - 19 Sep 2018

Hi, @joomdonation although this works, I think that the proposed direction/solution of @Quy is better?

A quick (working) mockup:
in file: ./libraries/joomla/form/fields/list.php

                                // Requires IP Logging enabled
                                if (in_array('iplogging', $requires) && !ComponentHelper::getParams('com_actionlogs')->get('ip_logging', 0))
                                {
                                        continue;
                                }

and in file: ./administrator/components/com_actionlogs/models/forms/filter_actionlogs.xml

                        <option value="a.user_id DESC">COM_ACTIONLOGS_NAME_DESC</option>
                        <option value="a.ip_address ASC" requires="iplogging">COM_ACTIONLOGS_IP_ADDRESS_ASC</option>
                        <option value="a.ip_address DESC" requires="iplogging">COM_ACTIONLOGS_IP_ADDRESS_DESC</option>
                        <option value="a.id ASC">JGRID_HEADING_ID_ASC</option>

I can do a PR for this (have it working on my test server), let me know what you think

avatar joomdonation
joomdonation - comment - 19 Sep 2018

Personal, I don't like this. It's not nice when a generic form field class (library) depends on a setting from a component. Not sure how others think about it @mbabker @laoneo

avatar Ruud68
Ruud68 - comment - 19 Sep 2018

The form field already has depenendies on: multiplanguage (plugin), Association (plugin), adminlanguage (module) and vote (content plugin).
All core plugins, modules, components just like com_actionlogs.

avatar joomdonation
joomdonation - comment - 19 Sep 2018

That dependency is there for some reasons I don't know. I think it's not needed here (even if we want the added string in correct order, we have different way to handle in the code of this component if it's really needed)

avatar mbabker
mbabker - comment - 19 Sep 2018

That solution is technically wrong in many ways and should have never been accepted in the first place. The right solution would be a subclass of JFormFieldList with the extra logic specific to that use case.

avatar joomdonation
joomdonation - comment - 19 Sep 2018

@mbabker Do you want to add a new form field type here? Or the current code in this PR is fine?

avatar mbabker
mbabker - comment - 19 Sep 2018

IMO current code is fine if you're OK with the limitation of option ordering. Otherwise, a custom form field is needed to get things in the right order.

avatar joomdonation
joomdonation - comment - 19 Sep 2018

If it's really needed, we can still get it in right order by removing the other two options from xml file and add it dynamic here (like how we are adding ip address sort options).

If anyone really concerns with the ordering of these options, let me know and I will adjust the code. Otherwise, I will leave it as how it's.

avatar Quy
Quy - comment - 19 Sep 2018

I have tested this item successfully on 880cf40


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

avatar Quy Quy - test_item - 19 Sep 2018 - Tested successfully
avatar alikon
alikon - comment - 19 Sep 2018

I have tested this item successfully on 880cf40


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

avatar alikon
alikon - comment - 19 Sep 2018

I have tested this item successfully on 880cf40


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

avatar alikon alikon - test_item - 19 Sep 2018 - Tested successfully
avatar Quy Quy - change - 19 Sep 2018
Status Pending Ready to Commit
avatar Quy
Quy - comment - 19 Sep 2018

RTC


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

avatar mbabker mbabker - change - 22 Sep 2018
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2018-09-22 15:12:33
Closed_By mbabker
Labels Added: ?
avatar mbabker mbabker - close - 22 Sep 2018
avatar mbabker mbabker - merge - 22 Sep 2018

Add a Comment

Login with GitHub to post a comment