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

[ActionsLog] Improve UX for loggable extensions checkboxes with a select all/none SEE #22699 #22674

Closed
wants to merge 8 commits into from

Conversation

cyrezdev
Copy link
Contributor

@cyrezdev cyrezdev commented Oct 16, 2018

EDIT

new PR here: #22699

Pull Request for Issue #22627.

Summary of Changes

capture d ecran 2018-10-16 a 21 20 40

Testing Instructions

*/
public function getInput()
{
$html = '';
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove and start/change line 62 $html =

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @Quy !

I did the changes.

I thought when use concatenation operators, the first one should be empty (to help to keep code diffs minimal)...
Was it changed as a rule or i was wrong ?

Note: some other core files still use first empty (PR needed for code standards ?).
eg https://github.com/joomla/joomla-cms/blob/staging/libraries/vendor/joomla/uri/src/AbstractUri.php#L150

		$uri = '';
		$uri .= $parts & static::SCHEME ? (!empty($this->scheme) ? $this->scheme . '://' : '') : '';
		$uri .= $parts & static::USER ? $this->user : '';
		$uri .= $parts & static::PASS ? (!empty($this->pass) ? ':' : '') . $this->pass . (!empty($this->user) ? '@' : '') : '';
		$uri .= $parts & static::HOST ? $this->host : '';
		$uri .= $parts & static::PORT ? (!empty($this->port) ? ':' : '') . $this->port : '';
		$uri .= $parts & static::PATH ? $this->path : '';
		$uri .= $parts & static::QUERY ? (!empty($query) ? '?' . $query : '') : '';
		$uri .= $parts & static::FRAGMENT ? (!empty($this->fragment) ? '#' . $this->fragment : '') : '';

// Add the script to the document head
JFactory::getDocument()->addScriptDeclaration($script);

$html.= '<div class="well well-small">';
Copy link
Contributor

Choose a reason for hiding this comment

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

Add space before .=

Copy link
Contributor

@mbabker mbabker left a comment

Choose a reason for hiding this comment

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

Looks fine on review, requires tests

…ect all/none

Remove not needed '  ' before $checked (already in $format)
@Quy
Copy link
Contributor

Quy commented Oct 17, 2018

It is still an issue when editing a profile.

Edit a Super User profile
Go to User Actions Log Options
Select None
Click Save

All checkboxes are checked.

@cyrezdev
Copy link
Contributor Author

@Quy Oh! I didn't even see there was this field in super user edit...

To be honnest, i don't see yet how the core extensions are set by default, as no default attribute in plugin system actionlogs form...

@cyrezdev
Copy link
Contributor Author

@Quy Did you test super user with latest staging including #21983 ?

@Quy
Copy link
Contributor

Quy commented Oct 18, 2018

Yes tested with latest staging including #21983.

@SharkyKZ
Copy link
Contributor

The plugin will need to be adjusted. But the field also needs to remove checked attribute from its options.

Test case:
Save com_actionlogs configuration with some or all events selected.
Deselect all events and save again.
No events are saved but all events appear checked.

@cyrezdev
Copy link
Contributor Author

Thanks @SharkyKZ
Do you have tested this PR ?

Test case:
Save com_actionlogs configuration with some or all events selected.
Deselect all events and save again.
No events are saved but all events appear checked.

With this PR, it works for me with com_actionlogs configuration as i've removed there the default attribute from config.xml.
But in plugin system actionlogs, no default attribute for user edit form actionlogs.xml
So it should act as for global options as same form field used.

The issue is with this PR not really the same as it was before.

Maybe in menu/plugin, the issue is the save function does not allow empty submitted data, and then replace by previously saved data.

@SharkyKZ your help could be appreciated to know if a change in form data processed to be done in the plugin, or if another issue elsewhere...

@cyrezdev
Copy link
Contributor Author

cyrezdev commented Oct 18, 2018

@SharkyKZ I've found why this PR does not have effect on super user edit!

In plugin, it is forced to save only if isset. But if empty, it won't update extensions column, and so keep previous setting.

Fix
Adding the following else statement for this if statement here: https://github.com/joomla/joomla-cms/pull/21983/files#diff-bbf838ec8885d4ea43274f7b94e17808R343:

else
{
	$values[] = $this->db->quoteName('extensions') . ' = ""';
}

Would fix issue.

Note: i can add this change to this PR if you think it's ok with this ?

@SharkyKZ
Copy link
Contributor

#21983 was written to maintain the existing behavior of form fields. See #21983 (comment).

Your fix seems OK. But maybe we should store empty JSON array ([]) instead of an empty string. IDK about this.

Also the field itself needs updating to remove checked attribute by default. Otherwise, after deselecting all options and saving they appear checked again, even when default value is not set. See this part

@mbabker
Copy link
Contributor

mbabker commented Oct 18, 2018

Your fix seems OK. But maybe we should store empty JSON array ([]) instead of an empty string. IDK about this.

If a column or data source is expecting a JSON string, then it should always be stored as something that doesn't cause json_decode() to set an error flag. We've got too many places in core where this is being hacked around already.

@cyrezdev
Copy link
Contributor Author

Will redo this PR with changes needed (i did something wrong with udpating this one, and better to get things clear) ;-)

@cyrezdev
Copy link
Contributor Author

PR redo here: #22699
Thanks for comments and help here! 👍

@cyrezdev cyrezdev changed the title [ActionsLog] Improve UX for loggable extensions checkboxes with a select all/none REDO #22669 [ActionsLog] Improve UX for loggable extensions checkboxes with a select all/none SEE #22699 Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants