/// <summary> /// Sets the callback URL of the ActionMenu. It represents the service url with correct parameters for the actions. /// </summary> private void SetServiceUrl() { var scParams = GetReplacedScenarioParameters(); var context = UITools.FindContextInfo(this, ContextInfoID); var path = !string.IsNullOrEmpty(ContextInfoID) ? context.Path : NodePath; var encodedReturnUrl = Uri.EscapeDataString(PortalContext.Current.RequestedUri.PathAndQuery); var encodedParams = Uri.EscapeDataString(scParams ?? string.Empty); if (string.IsNullOrEmpty(path)) { path = ContentView.GetContentPath(this); } if (string.IsNullOrEmpty(path)) { this.Visible = false; return; } var head = NodeHead.Get(path); if (head == null || !SecurityHandler.HasPermission(head, PermissionType.See)) { this.Visible = false; return; } this.Content = Content.Load(path); // Pre-check action count. If empty, hide the action menu. if (CheckActionCount) { var actionCount = 0; if (!string.IsNullOrEmpty(Scenario)) { actionCount = ActionFramework.GetActions(this.Content, Scenario, scParams, null).Count(); } if (actionCount < 2 && string.Equals(Scenario, "new", StringComparison.CurrentCultureIgnoreCase)) { ClickDisabled = true; } else if (actionCount == 0) { this.Visible = false; return; } } // Pre-check required permissions var permissions = SenseNet.ContentRepository.Fields.PermissionChoiceField.ConvertToPermissionTypes(RequiredPermissions).ToArray(); if (permissions.Length > 0 && !SecurityHandler.HasPermission(head, permissions)) { this.Visible = false; return; } ServiceUrl = string.Format(ODataTools.GetODataOperationUrl(path, "SmartAppGetActions") + "?scenario={0}&back={1}¶meters={2}", Scenario, encodedReturnUrl, encodedParams); }