コード例 #1
0
    public override void ShowWarning(string text, string description = null, string tooltipText = null, bool persistent = true)
    {
        var messages = new MessagesPlaceHolder();
        pnlMessages.Controls.Add(messages);

        messages.ShowWarning(text, description, tooltipText);
    }
コード例 #2
0
    public override void ShowWarning(string text, string description = null, string tooltipText = null, bool persistent = true)
    {
        var messages = new MessagesPlaceHolder();

        pnlMessages.Controls.Add(messages);

        messages.ShowWarning(text, description, tooltipText);
    }
コード例 #3
0
    /// <summary>
    /// Ensures message labels on the page.
    /// </summary>
    protected override MessagesPlaceHolder EnsureMessagesPlaceHolder()
    {
        MessagesPlaceHolder messagesPlaceHolder = base.EnsureMessagesPlaceHolder();

        messagesPlaceHolder.OffsetX = 16;
        messagesPlaceHolder.OffsetY = 16;
        return(messagesPlaceHolder);
    }
コード例 #4
0
    private void AddError(bool condition, LocalizedLabel label, string validationResult)
    {
        if (condition)
        {
            string anchorScript = label != null?String.Format("onclick=\"{0}\";", MessagesPlaceHolder.GetAnchorScript(label.ClientID, null)) : String.Empty;

            AddError(label.GetText(), validationResult, anchorScript);

            mSubmitValid = false;
        }
    }
コード例 #5
0
    /// <summary>
    /// Reloads the control.
    /// </summary>
    public void Reload()
    {
        pnlTypeSelector.Visible = false;

        if (IsNewItemEdited)
        {
            drpFieldType.Items.Clear();

            ListItem li = null;

            if (!IsAlternativeForm && !IsInheritedForm)
            {
                li = new ListItem(GetString("fieldeditor.fieldtype.standard"), FieldTypeEnum.Standard.ToStringRepresentation());
                drpFieldType.Items.Add(li);

                if (DevelopmentMode)
                {
                    li = new ListItem(GetString("fieldeditor.fieldtype.primary"), FieldTypeEnum.Primary.ToStringRepresentation());
                    drpFieldType.Items.Add(li);
                }

                if (EnableSystemFields)
                {
                    li = new ListItem(GetString("fieldeditor.fieldtype.document"), FieldTypeEnum.Document.ToStringRepresentation());
                    drpFieldType.Items.Add(li);
                }
            }

            if (AllowDummyFields)
            {
                li = new ListItem(GetString("fieldeditor.fieldtype.dummy"), FieldTypeEnum.Dummy.ToStringRepresentation());
                drpFieldType.Items.Add(li);
            }

            if (AllowExtraFields)
            {
                li = new ListItem(GetString("fieldeditor.fieldtype.extra"), FieldTypeEnum.Extra.ToStringRepresentation());
                drpFieldType.Items.Add(li);
            }

            // Display only for two or more options
            if (drpFieldType.Items.Count > 1)
            {
                pnlTypeSelector.Visible = true;
            }
            else if (AllowDummyFields)
            {
                MessagesPlaceHolder.ShowInformation(GetString("fieldeditor.fieldtype.currentfieldisdummy"));
            }

            drpFieldType.SelectedIndex = 0;
        }
    }
コード例 #6
0
    /// <summary>
    /// Validate inputs (category, custom category, URL, email) and submit submission data.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void Submit(object sender, EventArgs e)
    {
        // Category is a header (not set)
        AddError(ValidationHelper.GetString(drpCategory.SelectedValue, "header").Contains("header"), lblCategory, GetString("support.category.validation"));
        // Custom category is empty
        AddError(txtCategoryCustom.Visible && String.IsNullOrEmpty(ValidationHelper.GetString(txtCategoryCustom.Text, null)), lblCategory, GetString("support.category.custom.validation"));

        // URL is invalid
        AddError(!String.IsNullOrEmpty(txtURL.Text) && !ValidationHelper.IsURL(txtURL.Text) && !URLHelper.IsLocalUrl(txtURL.Text), lblURL, GetString("support.url.validation"));

        // Email is invalid
        AddError(!String.IsNullOrEmpty(txtEmail.Value.ToString()) && !txtEmail.IsValid(), lblEmail, GetString("general.correctemailformat"));

        // Email is empty
        AddError(String.IsNullOrEmpty(txtEmail.Value.ToString()), lblEmail, GetString("general.requireemail"));

        if (mSubmitValid)
        {
            try
            {
                // Create POST fields
                MultipartFormDataContent submission = new MultipartFormDataContent();
                FillSubmission(ref submission);
                Metrics.SendSubmission(submission);
            }
            catch (Exception ex)
            {
                // Log exception messages
                AddError(Regex.Replace(CMS.EventLog.EventLogProvider.GetExceptionLogMessage(ex), @"\r\n?|\n", "<br />"));

                mSubmitValid = false;
            }
        }

        if (!mSubmitValid)
        {
            // Add header message to the error box
            MessagesPlaceHolder.PrependError(GetString("basicform.errorvalidationerror|general.errorvalidationerror"), "<br /><br />");
            return;
        }

        // Alter close to work as an application
        if (QueryHelper.GetBoolean("application", false))
        {
            RedirectToInformation("support.success");
        }
        else
        {
            // Close dialog
            ScriptHelper.RegisterStartupScript(this, typeof(string), "Close", "CloseDialog();", true);
        }
    }
コード例 #7
0
    /// <summary>
    /// Initializes header action control.
    /// </summary>
    private void InitHeaderActions()
    {
        var hdrActions = CurrentMaster.HeaderActions;

        hdrActions.ActionsList.Clear();

        var sendingIssueAllowed = Issue.IssueStatus == IssueStatusEnum.Idle || Issue.IssueStatus == IssueStatusEnum.ReadyForSending;

        if (!sendingIssueAllowed)
        {
            return;
        }

        var recipientsCountAllowed = LicenseMaxNumberOfRecipients.Value == 0 || MarketableRecipientsCount.Value <= LicenseMaxNumberOfRecipients.Value;

        if (!recipientsCountAllowed)
        {
            MessagesPlaceHolder.AddError(string.Format(GetString("newsletter.issue.send.subcriberlimiterror"), MarketableRecipientsCount.Value, LicenseMaxNumberOfRecipients.Value));
        }

        var hasWidgetWithUnfilledRequiredProperty = Issue.HasWidgetWithUnfilledRequiredProperty();
        var hasWidgetWithMissingDefinition        = Issue.HasWidgetWithMissingDefinition();
        var isValidWidgetDefinition = !hasWidgetWithUnfilledRequiredProperty && !hasWidgetWithMissingDefinition;

        if (!isValidWidgetDefinition)
        {
            MessagesPlaceHolder.AddError(GetString("newsletter.issue.send.widgeterror"));
        }

        if (IsIssueTemplateBased)
        {
            AddTemplateBasedHeaderActions(hdrActions, isValidWidgetDefinition && recipientsCountAllowed);
        }
        else
        {
            AddSendHeaderAction(hdrActions, isValidWidgetDefinition && recipientsCountAllowed, ButtonStyle.Primary);
        }

        hdrActions.ActionPerformed += hdrActions_ActionPerformed;
        hdrActions.ReloadData();

        CurrentMaster.DisplayActionsPanel = true;
    }
コード例 #8
0
    private void InitHeaderActions()
    {
        var hdrActions = CurrentMaster.HeaderActions;

        hdrActions.ActionsList.Clear();

        if (IssueEditingEnabled && !IssueHelper.IsWinnerSelected(Issue))
        {
            hdrActions.ActionsList.Add(new SaveAction());
        }

        if (IssueEditingEnabled && CanIssueBeSent)
        {
            var variants = GetIssueVariants(Issue);

            var variantNamesWithUnfilledRequiredWidgetProperties = GetVariantNamesWithUnfilledRequiredWidgetProperties(variants);
            var variantNamesWithMissingWidgetDefinition          = GetVariantNamesWithMissingWidgetDefinition(variants);

            var isValidDefinition = !variantNamesWithUnfilledRequiredWidgetProperties.Any() &&
                                    !variantNamesWithMissingWidgetDefinition.Any();

            AddSendHeaderAction(hdrActions, isValidDefinition, ButtonStyle.Default);

            if (!isValidDefinition)
            {
                var invalidVariantNames = variantNamesWithUnfilledRequiredWidgetProperties.Union(variantNamesWithMissingWidgetDefinition);

                MessagesPlaceHolder.AddError(string.Format(GetString("newsletter.issue.send.variantwidgeterror"), string.Join(", ", invalidVariantNames)));
            }
        }

        if (IssueEditingEnabled)
        {
            hdrActions.ActionPerformed += hdrActions_OnActionPerformed;
        }

        hdrActions.ReloadData();

        CurrentMaster.DisplayActionsPanel = true;
    }
コード例 #9
0
 private void LoadProperty(FormFieldInfo ffi, FormFieldPropertyEnum property, FormEngineUserControl control, MessagesPlaceHolder msgPlaceHolder)
 {
     if (control != null)
     {
         bool isMacro = ffi.IsMacro(property);
         control.Visible = !isMacro;
         if (!isMacro)
         {
             control.Value = ffi.GetPropertyValue(property);
         }
         else
         {
             msgPlaceHolder.ShowInformation(GetString("FormBuilder.PropertyIsMacro"));
         }
     }
 }
コード例 #10
0
 private void LoadProperty(FormFieldInfo ffi, FormFieldPropertyEnum property, FormEngineUserControl control, MessagesPlaceHolder msgPlaceHolder)
 {
     if (control != null)
     {
         bool isMacro = ffi.IsMacro(property);
         control.Visible = !isMacro;
         if (!isMacro)
         {
             control.Value = ffi.GetPropertyValue(property);
         }
         else
         {
             msgPlaceHolder.ShowInformation(GetString("FormBuilder.PropertyIsMacro"));
         }
     }
 }