From bc0934ae10bb1ce18e47fa10ee49abb95b7ccaff Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 10 Mar 2010 04:06:32 +0000 Subject: [PATCH] MINOR Moved PermissionCheckboxSetField specific javascript logic from MemberTableField.js to new sapphire/javascript/PermissionCheckboxSetField.js file git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@100790 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/SecurityAdmin.php | 7 +----- javascript/MemberTableField.js | 40 +--------------------------------- 2 files changed, 2 insertions(+), 45 deletions(-) diff --git a/code/SecurityAdmin.php b/code/SecurityAdmin.php index 0bfde258..bdbfbe4b 100644 --- a/code/SecurityAdmin.php +++ b/code/SecurityAdmin.php @@ -169,12 +169,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider { 'Roles', 'PermissionRole' ); - // Necessary to make Permission code checkboxes behave consistently - $rolesCTF->requirementsForPopupCallback = create_function( - '$popup', - 'Requirements::javascript(CMS_DIR . "/javascript/MemberTableField.js");' - ); - + $rolesTab = $fields->findOrMakeTab('Root.Roles', _t('SecurityAdmin.TABROLES', 'Roles')); $rolesTab->push(new LiteralField( 'RolesDescription', diff --git a/javascript/MemberTableField.js b/javascript/MemberTableField.js index 1663c2d4..e1607782 100755 --- a/javascript/MemberTableField.js +++ b/javascript/MemberTableField.js @@ -278,42 +278,4 @@ MemberFilterButton.prototype = { // has to be external from initialize() because otherwise request will double on each reload - WTF Behaviour.register({ '#Form_EditForm div.MemberTableField table.data input.text' : AjaxMemberLookup -}); - -(function($) { - var checkboxBehaviour = { - initialize: function() { - this.toggleCheckboxes(); - }, - onclick: function(e) { - this.toggleCheckboxes(); - }, - toggleCheckboxes: function() { - var checkboxes = $(this).parents('.field:eq(0)').find('.checkbox').not(this); - - if($(this).is(':checked')) { - checkboxes.each(function() { - $(this).data('SecurityAdmin.oldChecked', $(this).attr('checked')); - $(this).data('SecurityAdmin.oldDisabled', $(this).attr('disabled')); - $(this).attr('disabled', 'disabled'); - $(this).attr('checked', 'checked'); - }); - } else { - checkboxes.each(function() { - $(this).attr('checked', $(this).data('SecurityAdmin.oldChecked')); - $(this).attr('disabled', $(this).data('SecurityAdmin.oldDisabled')); - }); - } - } - }; - - Behaviour.register({ - /** - * Automatically check and disable all checkboxes if ADMIN permissions are selected. - * As they're disabled, any changes won't be submitted (which is intended behaviour), - * checking all boxes is purely presentational. - */ - '#Permissions .valADMIN input': checkboxBehaviour, - '#Codes .valADMIN input': checkboxBehaviour - }); -}(jQuery)); \ No newline at end of file +}); \ No newline at end of file