Skip to content

Ajaxifying the Permission Tab#8132

Closed
tflm84 wants to merge 20 commits intojoomla:stagingfrom
tflm84:staging
Closed

Ajaxifying the Permission Tab#8132
tflm84 wants to merge 20 commits intojoomla:stagingfrom
tflm84:staging

Conversation

@tflm84
Copy link
Copy Markdown
Contributor

@tflm84 tflm84 commented Oct 23, 2015

Introduction

This PR fixes a problem of saving permissions within the Global Configuration, Components, Articles, Modules, and anywhere else where permissions can be configured.
If too many permission changes are made, the request is too large, because all settings are transmitted in one big form.
If this form is too big, some data get lost and are not stored in the database. Even worse, there is no feedback, therefore the user can not recognise that anything went wrong.

Fix

This fix splits the form when the save button is clicked. All inputfields which contain permissions will be disabled and not send during the saving progress.
Now, the permissions will be stored immediately after changing a value via AJAX. This solution leads to smaller forms and consistent storage of the permissions.
If something goes wrong, an error message will be displayed.

How to test this patch

  1. Login as administrator
  2. Go to Global Configuration / Components / Articles / Modules / ...
  3. Switch to permission tab
  4. Change any permissions
  5. A green or red checkmark will light up

Worked as a group on that issue: @icampus, @d03ms

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-staging labels Oct 23, 2015
Fix some CS sync the language file and add the correct @SInCE tag
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am sure it can be solved easily with jQuery, and you already use jQuery 😉

@coolman01
Copy link
Copy Markdown

I have tested this item ✅ successfully on 6c38d23

It works as described.
However, if for some reason the user does not want to save all the changes made in e.g. the module, and clicks the "close" button, then the permission changes are already saved. Maybe there could be a message attached to the close button to say "permission chnages saved"


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

@coolcat-creations
Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on 6c38d23


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

@zero-24
Copy link
Copy Markdown
Contributor

zero-24 commented Oct 24, 2015

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Oct 24, 2015
@roland-d roland-d removed the RTC This Pull Request is Ready To Commit label Oct 24, 2015
@roland-d
Copy link
Copy Markdown
Contributor

I have removed the RTC tag for now because I think the PR should be updated with the feedback given by @Fedik and @DGT41

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Oct 24, 2015
@joomla-cms-bot
Copy link
Copy Markdown

This PR has received new commits.

CC: @coolman01, @designbengel


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

@tflm84
Copy link
Copy Markdown
Contributor Author

tflm84 commented Oct 25, 2015

Thanks for your feedback, i put that javascript code in a seperated file in media/system/js/. Also i used the escaped version for the error messages.

@dgrammatiko
Copy link
Copy Markdown
Contributor

@tflm84 can you rename media/system/js/permissions.js to media/system/js/permissions.min.js and the media/system/js/permissions-uncompressed.js to media/system/js/permissions.js ?

@dgrammatiko
Copy link
Copy Markdown
Contributor

And use JHtml::_('script', 'system/js/permissions.min.js', false, true, false, false, true);
instead of

        // Add Javascript for permission change
        $document = JFactory::getDocument();
        $document->addScript('../media/system/js/permissions.js');

@zero-24
Copy link
Copy Markdown
Contributor

zero-24 commented Nov 2, 2015

I have tested this item ✅ successfully on b621ac6

Works great. Great work here. 👍

I have just send a very mirror CS PR at: tflm84#2 to address a space that is to much in a doc block 😄


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

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Nov 2, 2015
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.

I know I am a pain…
but this line needs to be
JHtml::_('script', '/media/system/permissions.min.js', false, true, false, false, true);

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.

Rather a pain than a problem :)

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.

@tflm84 @roland-d we have included the fix here: tflm84#2 so we need just @tflm84 to hit the merge button 😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks for this ;)

@dgrammatiko
Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on b621ac6

Also works fine with the change:
JHtml::_('script', 'media/system/js/permissions.min.js', false, false, false, false, true);


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

Just a very mirror ;) one space to much here
@zero-24
Copy link
Copy Markdown
Contributor

zero-24 commented Nov 2, 2015

RTC on testing now. Thanks 😃


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Nov 2, 2015
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.

You don't need to instantiate the database connection, it is available via $this->db. The database connector is already loaded in the parent class. Please update the code accordingly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i have changed this. hope it is fine so ;)

@roland-d
Copy link
Copy Markdown
Contributor

roland-d commented Nov 2, 2015

Back to pending as we need one more minor code change.


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

@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Nov 2, 2015
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.

Uh no, not like this. Remove line 345 and 346. From line 351 and later replace $db with $this->db. Thanks.

@joomla-cms-bot
Copy link
Copy Markdown

This PR has received new commits.

CC: @coolman01, @designbengel, @DGT41, @zero-24


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

@roland-d
Copy link
Copy Markdown
Contributor

roland-d commented Nov 2, 2015

Code looks good. Thanks. Can we have one more round of tests please? Thanks.

@mironsavan
Copy link
Copy Markdown

I have tested this item ✅ successfully on 8a576c7

Works as expected!


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

@mironsavan
Copy link
Copy Markdown

I have tested this item ✅ successfully on 8a576c7

I have tested this succcessfull on my test site with some different combinations and it works for me


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

@dgrammatiko
Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on 8a576c7


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

@zero-24
Copy link
Copy Markdown
Contributor

zero-24 commented Nov 2, 2015

RTC Thanks for you work and the tests 👍


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Nov 2, 2015
@roland-d roland-d closed this in 88bd35c Nov 2, 2015
@wilsonge wilsonge removed the RTC This Pull Request is Ready To Commit label Jan 17, 2016
@infograf768
Copy link
Copy Markdown
Member

This has broken "Inherited", in the sense that choosing inherited always calculates as "Denied"
#10552

@infograf768
Copy link
Copy Markdown
Member

We also have other bugs for Permissions.
See this one:
screen shot 2016-05-29 at 08 10 55

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.