0

I follow these steps:

1) Open file permissions page in modal dialog clicking "Document Permissions" button on the Ribbon menu. The next page is opened: enter image description here

2) Then I click "Modify" -> "Edit User Permissions" and the next page is opened as modal dialog. enter image description here

3) After that I click "OK" button on the current model dialog. This dialog is closed successfully and then my modal dialog which was opened at first step is redirected to the list where I selected current item. See picture below: enter image description here

But I want only refresh my model dialog opened at first step, when I click "OK" button on the second model dialog. What should I do to solve this problem?

1 Answer 1

1

I solve this trouble. I create custom action which has the same id as system button, then set callback and call location.reload(true) in that callback. here is my code:

<CustomAction Id="Ribbon.Permission.Modify"
Location="CommandUI.Ribbon"
RequireSiteAdministrator="false" >
<CommandUIExtension>
  <CommandUIDefinitions>
    <CommandUIDefinition Location="Ribbon.Permission.Modify.EditUsrPerm">
      <Button
        Id="Ribbon.Permission.Modify.EditUsrPerm"
        Command="EditItemPermission"
        Sequence="11"
        Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-128" Image16by16Left="-192"
        Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="-96" Image32by32Left="-384"
        LabelText="$Resources:core,cui_EditUsrPerm;"
        Alt="$Resources:core,cui_EditUsrPerm;"
        ToolTipTitle="$Resources:core,cui_EditUsrPermToolTipTitle;"
        ToolTipDescription="$Resources:core,cui_EditUsrPermToolTip;"
        TemplateAlias="o1"
      />
    </CommandUIDefinition>
  </CommandUIDefinitions>
  <CommandUIHandlers>
    <CommandUIHandler
      Command="EditItemPermission"
      EnabledScript="javascript: 
            function IsEntriesSelected()
            {
                // form.PrincipalId and form.PrincipalName locate in /_layouts/User.aspx
                var form = document.forms.aspnetForm;
                  var elemId = form.PrincipalId;
                  var elemName = form.PrincipalName;

                  if (elemId == null)
                      return false;

                  var len = elemId.length;
                  if (len == null)
                  {
                        if(elemId.checked)
                            return true;
                  }
                  else
                  {
                        for (var i = 0; i &lt; len; i++)
                        {
                            if (elemId[i].checked)
                                return true;
                        }
                   }
              }

            IsEntriesSelected();"
      CommandAction= "javascript:

            function SetRolesFromModalDialog()
            {
               // this function locate in /_layouts/User.aspx
               var selected = GetSelectedPrincipals();
                 var ids = selected.strIds;

               // strAclObject - this variable locate in /_layouts/User.aspx
               var options =
                {
                    url:'/_layouts/editprms.aspx?obj=' + strAclObject + '&amp;sel=' + escapeProperly(ids),
                    allowMaximize: false,
                    showClose: true,
                    showMaximized: false,
                    dialogReturnValueCallback: CallBack 
                };

               SP.UI.ModalDialog.showModalDialog(options);
            }

            function CallBack(dialogResult, retValue)
            {
                if(dialogResult == SP.UI.DialogResult.OK) 
                     location.reload(true);
            }

            SetRolesFromModalDialog();"
    />
  </CommandUIHandlers>
</CommandUIExtension>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.