User tests: Successful: Unsuccessful:
Pull Request for Issue #22211.
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.
None
Status | New | ⇒ | Pending |
Category | ⇒ | Administration |
Labels |
Added:
?
|
I have tested this item
Works fine. The IP Address column is not displayed anymore if IP Logging options is set up on NO.
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>
@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)
It works fine, when the IP Address column is not displayed, the IP filter is now not displayed either.
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
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.
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)
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.
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.
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.
I have tested this item
I have tested this item
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
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:
?
|
IP Address
should not be listed as an option.IP Address ascending/descending
ideally should be listed aboveID ascending/descending
.