public static string GetValidationImageFormatText(string errorImageName)
        {
            string validationErrorUrl = AspNetUtils.GetFullyQualifiedApplicationRootUrl(GetImageUrl(errorImageName));

            return(string.Format("<img src=\"{0}\" title=\"{{0}}\" alt=\"Error\" style=\"vertical-align:middle\">",
                                 validationErrorUrl));
        }
Example #2
0
 protected override void OnLoad(EventArgs e)
 {
     if (IsPostBack)
     {
         _postbackControl = AspNetUtils.GetPostBackControl(this);
     }
     base.OnLoad(e);
 }
Example #3
0
        protected void ServerValidateTestOrProdPassword(Object source, ServerValidateEventArgs e)
        {
            CustomValidator validator       = (CustomValidator)source;
            PasswordTextBox passwordControl = AspNetUtils.FindDeepControl(this, validator.ControlToValidate) as PasswordTextBox;
            string          password        = passwordControl.Text.Trim();

            e.IsValid = (password.Length > 0);
        }
        protected void addSelectedUsers_Click(object sender, EventArgs e)
        {
            List <string> currentUsernames  = GetUsernames();
            List <string> selectedUsernames = AspNetUtils.GetSelectedValues(listNaasUsers);
            List <string> mergedUsernames   = CollectionUtils.MergeLists(currentUsernames, selectedUsernames);
            string        separator         = FirstUsernameSeparator();

            nameCtrl.Text = StringUtils.Join(separator, mergedUsernames);
        }
        protected void SetControlsVisible(string id, bool isVisible)
        {
            IList <Control> controls = AspNetUtils.FindDeepControls <Control>(resultsGridView, id);

            if (controls != null)
            {
                foreach (Control control in controls)
                {
                    control.Visible = isVisible;
                }
            }
        }
Example #6
0
        protected override void OnInitializeControls(EventArgs e)
        {
            base.OnInitializeControls(e);

            if (!IsPostBack)
            {
                introParagraphs.DataSource = IntroParagraphs;
                introParagraphs.DataBind();
            }

            AspNetUtils.SetFocus(this, textNaasUserFilter, true);
        }
        protected void SetLabelsText(string id, string text)
        {
            IList <Label> controls = AspNetUtils.FindDeepControls <Label>(resultsGridView, id);

            if (controls != null)
            {
                foreach (Label control in controls)
                {
                    control.Text = text;
                }
            }
        }
Example #8
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            PublishIds(ClientIdsToPublish, "g_ClientIds");
            PublishIds(UniqueIdsToPublish, "g_UniqueIds");

            if (RegisteredScriptBlocks.Length > 0)
            {
                string scriptBlocks = RegisteredScriptBlocks.ToString();
                AspNetUtils.RegisterScriptBlock(this, scriptBlocks);
            }
        }
Example #9
0
        protected void ServerValidateGlobalValue(Object source, ServerValidateEventArgs e)
        {
            CustomValidator validator = (CustomValidator)source;
            Control         control   = AspNetUtils.FindDeepControl(validator.Parent, validator.ControlToValidate);

            e.IsValid = true;
            if (control != null)
            {
                DropDownList list = control as DropDownList;
                if ((list != null) && list.Visible)
                {
                    e.IsValid = (list.SelectedValue != NOT_SELECTED_TEXT);
                }
            }
        }
Example #10
0
        protected void ServerValidateNotSelectedControl(Object source, ServerValidateEventArgs e)
        {
            CustomValidator validator = (CustomValidator)source;
            Control         control   = AspNetUtils.FindDeepControl(this, validator.ControlToValidate);

            e.IsValid = true;
            if (control != null)
            {
                DropDownList dropDownList = control as DropDownList;
                if (dropDownList != null)
                {
                    string text = dropDownList.SelectedItem.Text;
                    e.IsValid = (text != NOT_SELECTED_TEXT);
                }
            }
        }
        protected override void OnInitializeControls(EventArgs e)
        {
            base.OnInitializeControls(e);

            if (!IsPostBack)
            {
                introParagraphs.DataSource = IntroParagraphs;
                introParagraphs.DataBind();

                currentPasswordValue.Text = newPasswordValue1.Text = newPasswordValue2.Text = string.Empty;

                AspNetUtils.SetFocus(this, currentPasswordValue, false);
            }
            else
            {
                divPageError.Visible = false;
            }
        }
        protected override void OnInitializeControls(EventArgs e)
        {
            base.OnInitializeControls(e);

            if (!this.IsPostBack)
            {
                SecureMasterPage.SetupPage(SideTabs, SelectedTabIndex);
                introParagraphs.DataSource = IntroParagraphs;
                introParagraphs.DataBind();

                roleCtrl.DataSource = EnumUtils.GetAllDescriptions <SystemRoleType>();
                roleCtrl.DataBind();

                if (_modelState.DataItem.IsDemoUser == null)
                {
                    // Not a demo server
                    IsDemoUserLabel.Visible = IsDemoUserCheckBox.Visible = false;
                }
                else
                {
                    IsDemoUserCheckBox.Checked = _modelState.DataItem.IsDemoUser.Value;
                }
                passwordCtrl.Text = confirmPasswordCtrl.Text = string.Empty;
                ShowHidePasswordControl();
                if (string.IsNullOrEmpty(_modelState.Affiliate))
                {
                    affiliateLabel.Visible = affiliateValue.Visible = false;
                }
                else
                {
                    affiliateValue.Text = _modelState.Affiliate;
                }
                nameCtrl.Enabled = _modelState.IsNewUser;
                if (nameCtrl.Enabled)
                {
                    AspNetUtils.SetFocus(this, nameCtrl, false);
                }
                else if (passwordCtrl.Visible)
                {
                    AspNetUtils.SetFocus(this, passwordCtrl, false);
                }
            }
            IsDemoUserCheckBox.AutoPostBack = !_modelState.IsNewUser;
        }
Example #13
0
        protected override void OnInitializeControls(EventArgs e)
        {
            if (Response.IsRequestBeingRedirected)
            {
                return;
            }

            base.OnInitializeControls(e);

            if (!IsPostBack)
            {
                introParagraphs.DataSource = IntroParagraphs;
                introParagraphs.DataBind();

                addArgumentBtn.Visible = !string.IsNullOrEmpty(_dataModel._dataItem.Id);

                AspNetUtils.SetFocus(this, codeCtrl, true);
            }
        }
Example #14
0
        protected void ServerValidateRequiredIfVisible(Object source, ServerValidateEventArgs e)
        {
            CustomValidator validator = (CustomValidator)source;
            Control         control   = AspNetUtils.FindDeepControl(this, validator.ControlToValidate);

            e.IsValid = true;
            if (control != null)
            {
                if (control.Visible)
                {
                    TextBox textBox = control as TextBox;
                    if (textBox != null)
                    {
                        string text = textBox.Text.Trim();
                        e.IsValid = (text.Length > 0);
                    }
                }
            }
        }
Example #15
0
        protected override void OnInitializeControls(EventArgs e)
        {
            if (Response.IsRequestBeingRedirected)
            {
                return;
            }

            base.OnInitializeControls(e);

            if (!IsPostBack)
            {
                introParagraphs.DataSource = IntroParagraphs;
                introParagraphs.DataBind();

                flowDropDownList.DataSource = _dataItemService.GetDataFlowNames();
                flowDropDownList.DataBind();

                AspNetUtils.SetFocus(this, fileUpload, false);
            }
        }
        protected override void OnInitializeControls(EventArgs e)
        {
            if (Response.IsRequestBeingRedirected)
            {
                return;
            }

            base.OnInitializeControls(e);

            if (!IsPostBack)
            {
                introParagraphs.DataSource = IntroParagraphs;
                introParagraphs.DataBind();

                versionCtrl.DataSource = EnumUtils.GetAllDescriptions <EndpointVersionType>();
                versionCtrl.DataBind();

                addPartnerBtn.Visible = !string.IsNullOrEmpty(_dataItem.Id);

                AspNetUtils.SetFocus(this, nameCtrl, true);
            }
        }
Example #17
0
        protected override void OnInitializeControls(EventArgs e)
        {
            if (Response.IsRequestBeingRedirected)
            {
                return;
            }

            base.OnInitializeControls(e);

            addEndpointUserBtn.Visible = false;

            if (!IsPostBack)
            {
                introParagraphs.DataSource = IntroParagraphs;
                introParagraphs.DataBind();

                if (!string.IsNullOrEmpty(DataItem.Id))
                {
                    removeBtn.Visible            = true;
                    usernameDropDownList.Visible = false;
                    usernameLabel.Visible        = true;

                    AspNetUtils.SetFocus(this, testNaasPasswordCtrl, true);
                }
                else
                {
                    removeBtn.Visible     = false;
                    usernameLabel.Visible = false;

                    usernameDropDownList.Visible       = true;
                    usernameDropDownList.DataTextField = usernameDropDownList.DataValueField = "NaasAccount";
                    usernameDropDownList.DataSource    = EndpointUserService.GetAllPossibleEndpointUsers(VisitHelper.GetVisit());
                    usernameDropDownList.DataBind();

                    AspNetUtils.SetFocus(this, usernameDropDownList, true);
                }
            }
        }
        protected override void OnInitializeControls(EventArgs e)
        {
            if (Response.IsRequestBeingRedirected)
            {
                return;
            }

            base.OnInitializeControls(e);

            if (!IsPostBack)
            {
                introParagraphs.DataSource = IntroParagraphs;
                introParagraphs.DataBind();

                importSettingsCheckBoxList.DataSource = EnumUtils.GetAllDescriptions <ImportExportSettings>();
                importSettingsCheckBoxList.DataBind();

                importSettingsTypeDropDown.DataSource = EnumUtils.GetAllDescriptions <ImportExpertSettingsType>();
                importSettingsTypeDropDown.DataBind();
                importSettingsTypeDropDown.SelectedIndex = 0;
                importSettingsCheckBoxList.Enabled       = false;

                importActionDropDown.DataSource = EnumUtils.GetAllDescriptions <ImportSettingsAction>();
                importActionDropDown.DataBind();
                importActionDropDown.SelectedIndex = 0;

                exportSettingsCheckBoxList.DataSource = EnumUtils.GetAllDescriptions <ImportExportSettings>();
                exportSettingsCheckBoxList.DataBind();

                exportSettingsTypeDropDown.DataSource = EnumUtils.GetAllDescriptions <ImportExpertSettingsType>();
                exportSettingsTypeDropDown.DataBind();
                exportSettingsTypeDropDown.SelectedIndex = 0;
                exportSettingsCheckBoxList.Enabled       = false;

                AspNetUtils.SetFocus(this, fileUpload, false);
            }
        }
        protected override void OnInitializeControls(EventArgs e)
        {
            if (Response.IsRequestBeingRedirected)
            {
                return;
            }

            base.OnInitializeControls(e);

            if (!this.IsPostBack)
            {
                SecureMasterPage.SetupPage(SideTabs, SelectedTabIndex);
                introParagraphs.DataSource = GetIntroParagraphs();
                introParagraphs.DataBind();

                roleCtrl.DataSource = EnumUtils.GetAllDescriptions <SystemRoleType>();
                roleCtrl.DataBind();

                if (!_isAddUsers)
                {
                    // Edit user
                    nameValue.Text = _editUserAccount.NaasAccount;

                    affiliateValue.Text = _userAffiliate;

                    activeCtrl.Checked = _editUserAccount.IsActive;

                    SelectedRole = _editUserAccount.Role;

                    addUsersBtn.Visible      = false;
                    deleteUserBtn.Enabled    = _canDeleteUser;
                    removeUserBtn.Enabled    = _canRemoveUser;
                    resetPasswordBtn.Enabled = _canResetPassword;
                }
                else
                {
                    // Add users
                    passwordCtrl.Text = confirmPasswordCtrl.Text = string.Empty;

                    createInNaasCheckBox.Checked = true;

                    saveUserBtn.Visible = deleteUserBtn.Visible = resetPasswordBtn.Visible = false;

                    if (_editUserAccount != null)
                    {
                        SelectedRole       = _editUserAccount.Role;
                        activeCtrl.Checked = _editUserAccount.IsActive;
                        nameCtrl.Text      = _editUserAccount.NaasAccount;
                    }
                    else
                    {
                        SelectedRole = SystemRoleType.Authed;
                    }

                    AspNetUtils.SetFocus(this, nameCtrl, true);
                }

                UpdateVisibleRows();

                addSelectedUsers.Enabled = false;

                RebindFlowRepeater();
            }
            else
            {
                divPageError.Visible = false;
            }
        }
Example #20
0
        protected override void OnInitializeControls(EventArgs e)
        {
            LoadModel();

            if (Response.IsRequestBeingRedirected)
            {
                return;
            }

            base.OnInitializeControls(e);

            bool disableEditing = (Model == null);

            if (!disableEditing && !this.IsPostBack)
            {
                introParagraphs.DataSource = IntroParagraphs;
                introParagraphs.DataBind();

                _disableRepeaterEditing = disableEditing = !CanEditFlowById(Model.FlowId);

                ICollection <SimpleDataService> implementers = GetDataServiceImplementersForFlow(Model.FlowId);
                if (!CollectionUtils.IsNullOrEmpty(implementers))
                {
                    implementerDropDownList.DataSource     = implementers;
                    implementerDropDownList.DataTextField  = "PluginInfoDisplayString";
                    implementerDropDownList.DataValueField = "PluginInfoImplementerString";
                    implementerDropDownList.DataBind();
                    implementerDropDownList.Items.Insert(0, NOT_SELECTED_TEXT);
                    implementerDropDownList.SelectedIndex = 0;
                    if (Model.DataService.PluginInfo != null)
                    {
                        implementerDropDownList.SelectedValue = Model.DataService.PluginInfo.ImplementerString;
                    }
                }
                else
                {
                    implementerDropDownList.Items.Clear();
                    implementerDropDownList.Enabled = false;
                    typeDropDownList.Items.Clear();
                    typeDropDownList.Enabled = false;
                }
                if (Model.IsNewService)
                {
                    deleteBtn.Visible      = false;
                    activeCheckBox.Checked = true;
                }
                else
                {
                    nameEdit.Text          = Model.DataService.Name;
                    PluginInfoBinder       = Model.DataService.PluginInfo;
                    activeCheckBox.Checked = Model.DataService.IsActive;
                    ServiceTypeBinder      = Model.DataService.Type;
                }

                SyncControlsToCurrentImplementer();
            }
            if (disableEditing)
            {
                nameEdit.Enabled           = implementerDropDownList.Enabled = typeDropDownList.Enabled =
                    activeCheckBox.Enabled = false;
                deleteBtn.Visible          = saveBtn.Visible = false;
                CustomValidator7.Visible   = false;
                flowNameLabel.Enabled      = false;
                cancelBtn.Text             = "Back";
            }
            _disableRepeaterEditing = !nameEdit.Enabled;
            if (nameEdit.Enabled)
            {
                AspNetUtils.SetFocus(this, nameEdit, true);
            }
        }
Example #21
0
        protected override void OnInitializeControls(EventArgs e)
        {
            LoadModel();

            if (Response.IsRequestBeingRedirected)
            {
                return;
            }

            base.OnInitializeControls(e);

            bool disableEditing = (Model == null);

            if (!disableEditing && !this.IsPostBack)
            {
                SecureMasterPage.SetupPage(SideTabs, SelectedTabIndex);

                introParagraphs.DataSource = IntroParagraphs;
                introParagraphs.DataBind();

                contactsDropDownList.DataSource = FlowService.GetFlowContactList();
                contactsDropDownList.DataBind();

                if (Model.IsNewFlow)
                {
                    if (!CanEditNewFlows())
                    {
                        ResponseRedirect("~/Secure/Flow.aspx");
                        return;
                    }
                    deleteBtn.Visible = false;
                }
                else
                {
                    if (!CanViewFlowByName(Model.DataFlow.FlowName))
                    {
                        ResponseRedirect("~/Secure/Flow.aspx");
                        return;
                    }
                    nameEdit.Text                      = Model.DataFlow.FlowName;
                    descriptionTextBox.Text            = Model.DataFlow.Description;
                    contactsDropDownList.SelectedValue = Model.ContactUsername;
                    webInfoTextBox.Text                = Model.DataFlow.InfoUrl;
                    protectedCheckBox.Checked          = Model.DataFlow.IsProtected;
                    disableEditing                     = !CanEditFlowByName(Model.DataFlow.FlowName);
                    nameEdit.Enabled                   = false;
                    deleteBtn.Visible                  = CanEditNewFlows();
                }
            }
            if (disableEditing)
            {
                nameEdit.Enabled           = descriptionTextBox.Enabled = contactsDropDownList.Enabled =
                    webInfoTextBox.Enabled = protectedCheckBox.Enabled = false;
                deleteBtn.Visible          = saveBtn.Visible = false;
                CustomValidator7.Visible   = false;
                cancelBtn.Text             = "Back";
            }
            else if (!this.IsPostBack)
            {
                if (nameEdit.Enabled)
                {
                    AspNetUtils.SetFocus(this, nameEdit, false);
                }
                else if (descriptionTextBox.Enabled)
                {
                    AspNetUtils.SetFocus(this, descriptionTextBox, true);
                }
            }
        }
 public virtual void RegisterScriptBlock(string clientScript)
 {
     AspNetUtils.RegisterScriptBlock(this, clientScript);
 }
 public virtual void RegisterCssFile(string cssFilePageRelativePath)
 {
     AspNetUtils.RegisterCssFile(this, cssFilePageRelativePath);
 }
 public virtual void RegisterScriptFile(string scriptFilePageRelativePath)
 {
     AspNetUtils.RegisterScriptFile(this, scriptFilePageRelativePath);
 }