public ViewActionLink(IPortalContext portalContext, int languageCode, Action action, LinkActionType type,
                              bool enabled = false, UrlBuilder url = null, string portalName = null, string label = null, string tooltip = null, string busyText = null)
        {
            var buttonLabel    = action.ButtonLabel.GetLocalizedString(languageCode);
            var buttonTooltip  = action.ButtonTooltip.GetLocalizedString(languageCode);
            var buttonBusyText = action.ButtonBusyLabel.GetLocalizedString(languageCode);

            ActionButtonAlignment = action.ActionButtonAlignment;
            ActionButtonPlacement = action.ActionButtonPlacement;
            ActionButtonStyle     = action.ActionButtonStyle;
            ActionIndex           = action.ActionIndex;
            ButtonCssClass        = action.ButtonCssClass;
            Confirmation          = action.Confirmation.GetLocalizedString(languageCode);
            Enabled             = enabled;
            this.FilterCriteria = action.FilterCriteria;
            Label = !string.IsNullOrWhiteSpace(buttonLabel) ? buttonLabel : label == null?GetDefaultButtonLabel() : label;

            SuccessMessage = action.SuccessMessage.GetLocalizedString(languageCode);
            ShowModal      = action.ShowModal ?? ShowModal.No;
            Tooltip        = !string.IsNullOrWhiteSpace(buttonTooltip) ? buttonTooltip : tooltip == null?GetDefaultButtonTooltip() : tooltip;

            Type     = type;
            URL      = url;
            BusyText = !string.IsNullOrEmpty(buttonBusyText) ? buttonBusyText : busyText;
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="type">Type of action</param>
 /// <param name="enabled">Indicates if the action is enabled or not</param>
 /// <param name="url">URL target of the action link</param>
 /// <param name="label">Display label</param>
 /// <param name="tooltip">Tooltip display text</param>
 /// <param name="queryStringIdParameterName">The name of the Query String parameter containing the record id. Not applicable to Type 'Insert'.</param>
 public ViewActionLink(LinkActionType type, bool enabled, UrlBuilder url, string label, string tooltip, string queryStringIdParameterName)
 {
     Type    = type;
     Enabled = enabled;
     URL     = url;
     Label   = label;
     Tooltip = tooltip;
     QueryStringIdParameterName = !string.IsNullOrWhiteSpace(queryStringIdParameterName) ? queryStringIdParameterName : "id";
 }
 public RedirectActionLink(EntityReference page, LinkActionType type, bool enabled, string label, string tooltip)
     : base(type, enabled, null, label, tooltip, null)
 {
     if (page == null || page.LogicalName != "adx_webpage")
     {
         return;
     }
     WebPage    = page;
     OnComplete = JsonConfiguration.OnComplete.RedirectToWebPage;
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LinkAnnotation" /> class.
 /// </summary>
 /// <param name="Links">Link to the document..</param>
 /// <param name="ActionType">ActionType.</param>
 /// <param name="Action">Action.</param>
 /// <param name="Highlighting">Highlighting.</param>
 /// <param name="Color">Color.</param>
 /// <param name="Rect">Rect.</param>
 /// <param name="Id">Id.</param>
 public LinkAnnotation(List <Link> Links = default(List <Link>), LinkActionType ActionType = default(LinkActionType), string Action = default(string), LinkHighlightingMode Highlighting = default(LinkHighlightingMode), Color Color = default(Color), Rectangle Rect = default(Rectangle), string Id = default(string))
 {
     this.Links        = Links;
     this.ActionType   = ActionType;
     this.Action       = Action;
     this.Highlighting = Highlighting;
     this.Color        = Color;
     this.Rect         = Rect;
     this.Id           = Id;
 }
        public FormViewActionLink(IPortalContext portalContext, int languageCode, FormViewAction action, LinkActionType type, bool enabled = false, string portalName = null, string label = null, string tooltip = null)
            : base(portalContext, languageCode, action, type, enabled, null, portalName, label, tooltip)
        {
            var    targetType = action.TargetType.GetValueOrDefault(TargetType.EntityForm);
            string url        = null;

            Enabled        = enabled;
            Type           = type;
            SuccessMessage = action.SuccessMessage.GetLocalizedString(languageCode);
            Target         = targetType;
            var detailsButtonLabel   = action.ButtonLabel.GetLocalizedString(languageCode);
            var detailsButtonTooltip = action.ButtonTooltip.GetLocalizedString(languageCode);

            Label   = !string.IsNullOrWhiteSpace(detailsButtonLabel) ? detailsButtonLabel : label;
            Tooltip = !string.IsNullOrWhiteSpace(detailsButtonTooltip) ? detailsButtonTooltip : tooltip;

            switch (targetType)
            {
            case TargetType.EntityForm:
                if (action.EntityFormId != null)
                {
                    EntityForm = new EntityReference("adx_entityform", action.EntityFormId.GetValueOrDefault());
                }
                return;

            case TargetType.WebPage:
                if (action.RedirectWebpageId != null)
                {
                    url = action.GetRedirectWebPageUrl(portalContext, portalName);
                }
                break;

            case TargetType.Url:
                if (action.RedirectUrl != null)
                {
                    url = action.RedirectUrl;
                }
                break;
            }

            if (string.IsNullOrEmpty(url))
            {
                return;
            }

            var urlBuilder = new UrlBuilder(url);

            URL = urlBuilder;
        }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LinkAnnotation" /> class.
 /// </summary>
 /// <param name="Links">Link to the document.</param>
 /// <param name="ActionType">ActionType (required)</param>
 /// <param name="Action">Action (required)</param>
 /// <param name="Highlighting">Highlighting (required)</param>
 /// <param name="Color">Color</param>
 /// <param name="Rect">Rect (required)</param>
 /// <param name="Id">Id</param>
 public LinkAnnotation(List <Link> Links = default(List <Link>), LinkActionType ActionType = default(LinkActionType), string Action = default(string), LinkHighlightingMode Highlighting = default(LinkHighlightingMode), Color Color = default(Color), Rectangle Rect = default(Rectangle), string Id = default(string))
 {
     // to ensure "ActionType" is required (not null)
     if (ActionType == null)
     {
         throw new InvalidDataException("ActionType is a required property for LinkAnnotation and cannot be null");
     }
     else
     {
         this.ActionType = ActionType;
     }
     // to ensure "Action" is required (not null)
     if (Action == null)
     {
         throw new InvalidDataException("Action is a required property for LinkAnnotation and cannot be null");
     }
     else
     {
         this.Action = Action;
     }
     // to ensure "Highlighting" is required (not null)
     if (Highlighting == null)
     {
         throw new InvalidDataException("Highlighting is a required property for LinkAnnotation and cannot be null");
     }
     else
     {
         this.Highlighting = Highlighting;
     }
     // to ensure "Rect" is required (not null)
     if (Rect == null)
     {
         throw new InvalidDataException("Rect is a required property for LinkAnnotation and cannot be null");
     }
     else
     {
         this.Rect = Rect;
     }
     this.Links = Links;
     this.Color = Color;
     this.Id    = Id;
 }
        public FormViewActionLink(EntityReference entityReference, LinkActionType type, bool enabled, string label, string tooltip, string queryStringIdParameterName)
            : base(type, enabled, null, label, tooltip, queryStringIdParameterName)
        {
            if (entityReference == null)
            {
                return;
            }
            switch (entityReference.LogicalName)
            {
            case "adx_webpage":
                WebPage = entityReference;
                Target  = TargetType.WebPage;
                break;

            case "adx_entityform":
                EntityForm = entityReference;
                Target     = TargetType.EntityForm;
                break;
            }
        }
 public FormViewActionLink(LinkActionType type, bool enabled, UrlBuilder url, string label, string tooltip, string queryStringIdParameterName)
     : base(type, enabled, url, label, tooltip, queryStringIdParameterName)
 {
     Target = TargetType.Url;
 }
        public RedirectActionLink(IPortalContext portalContext, int languageCode, RedirectAction action, LinkActionType type, bool enabled = false, UrlBuilder url = null, string portalName = null, string label = null, string tooltip = null) : base(portalContext, languageCode, action, type, enabled, url, portalName, label, tooltip)
        {
            string redirectUrl = null;

            OnComplete = action.OnComplete.GetValueOrDefault(JsonConfiguration.OnComplete.Refresh);

            switch (OnComplete)
            {
            case JsonConfiguration.OnComplete.Refresh:
                return;

            case JsonConfiguration.OnComplete.RedirectToWebPage:
                if (action.RedirectWebpageId != null)
                {
                    redirectUrl = action.GetRedirectWebPageUrl(portalContext, portalName);
                }
                break;

            case JsonConfiguration.OnComplete.RedirectToUrl:
                if (action.RedirectUrl != null)
                {
                    redirectUrl = action.RedirectUrl;
                }
                break;
            }

            if (string.IsNullOrEmpty(redirectUrl))
            {
                return;
            }

            var urlBuilder = new UrlBuilder(redirectUrl);

            RedirectUrl = urlBuilder;
        }
 public RedirectActionLink(LinkActionType type, bool enabled, UrlBuilder url, string label, string tooltip)
     : base(type, enabled, url, label, tooltip, null)
 {
     OnComplete = JsonConfiguration.OnComplete.Refresh;
 }