Esempio n. 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="workflow">The entity reference to the workflow record.</param>
 /// <param name="url">Url to the service to complete the execute workflow request.</param>
 /// <param name="label">Text displayed for the button.</param>
 /// <param name="tooltip">Text displayed for a tooltip.</param>
 /// <param name="enabled">Indicates if the link is enabled or not.</param>
 public WorkflowActionLink(EntityReference workflow, UrlBuilder url, string label, string tooltip, bool enabled = true)
 {
     Workflow = workflow;
     Modal    = new ViewWorkflowModal();
     Type     = LinkActionType.Workflow;
     Enabled  = enabled;
     URL      = url;
     Label    = label;
     Tooltip  = tooltip;
     QueryStringIdParameterName = null;
 }
Esempio n. 2
0
        public WorkflowActionLink(IPortalContext portalContext, EntityReference workflow, int languageCode,
                                  WorkflowAction action, bool enabled = true, UrlBuilder url = null, string portalName = null)
            : base(portalContext, languageCode, action, LinkActionType.Workflow, enabled, url, portalName, DefaultButtonLabel, DefaultButtonLabel)
        {
            Modal = new ViewWorkflowModal();

            CustomizeModal = action.WorkflowDialogTitle != null || action.WorkflowDialogPrimaryButtonText != null || action.WorkflowDialogCloseButtonText != null;

            Workflow = workflow;

            if (url == null)
            {
                URL = EntityListFunctions.BuildControllerActionUrl("ExecuteWorkflow", "EntityGrid",
                                                                   new { area = "Portal", __portalScopeId__ = portalContext.Website.Id });
            }

            var buttonLabel   = action.ButtonLabel.GetLocalizedString(languageCode);
            var buttonTooltip = action.ButtonTooltip.GetLocalizedString(languageCode);

            if (!string.IsNullOrWhiteSpace(buttonLabel) && !string.IsNullOrWhiteSpace(buttonTooltip) && action.WorkflowId != Guid.Empty)
            {
                return;
            }

            var wrkflow = portalContext.ServiceContext.CreateQuery("workflow")
                          .FirstOrDefault(w => w.GetAttributeValue <Guid>("workflowid") == action.WorkflowId);

            if (wrkflow == null)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(buttonLabel))
            {
                Label = DefaultButtonLabel;
            }

            // Try to extract the text only if the label has HTML
            string nohtmlLabel = Regex.Replace(Label, @"<[^>]*>", string.Empty);

            if (string.IsNullOrWhiteSpace(buttonTooltip))
            {
                Tooltip = nohtmlLabel;
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Parameterless Constructor
 /// </summary>
 public WorkflowActionLink()
 {
     Modal   = new ViewWorkflowModal();
     Enabled = false;
 }