Example #1
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            Controls.Clear();

            string searchText = Resources.Resource.SearchButtonText;

            if (actionText != string.Empty)
            {
                searchText = actionText;
            }

            if (!linkOnly)
            {
                if (!String.IsNullOrEmpty(searchContainerElement))
                {
                    SetUpDefaultClick();
                }

                tb    = new TextBox();
                tb.ID = this.ID + "_tbFS";
                if (inputPlaceHolderText != string.Empty)
                {
                    tb.Attributes.Add("Placeholder", inputPlaceHolderText);
                }
                this.Controls.Add(tb);
            }

            if (renderAsButton)
            {
                mb      = new mojoButton();
                mb.ID   = this.ID + "_mbFS";
                mb.Text = searchText;
                if (actionCssClass != string.Empty)
                {
                    mb.CssClass = actionCssClass;
                }
                mb.Click += new EventHandler(mbFS_Click);
                this.Controls.Add(mb);
            }
            else
            {
                lb      = new LinkButton();
                lb.ID   = this.ID + "_lbFS";
                lb.Text = searchText;
                if (actionCssClass != string.Empty)
                {
                    lb.CssClass = actionCssClass;
                }
                lb.Click += new EventHandler(lbFS_Click);
                this.Controls.Add(lb);
            }
        }
Example #2
0
        private void PopulateControls()
        {
            if (siteSettings == null)
            {
                return;
            }
            if (siteSettings.DisableDbAuth)
            {
                this.Visible = false; return;
            }

            LoginCtrl.SetRedirectUrl = SetRedirectUrl;

            lblUserID     = (SiteLabel)this.LoginCtrl.FindControl("lblUserID");
            lblEmail      = (SiteLabel)this.LoginCtrl.FindControl("lblEmail");
            txtUserName   = (TextBox)this.LoginCtrl.FindControl("UserName");
            txtPassword   = (TextBox)this.LoginCtrl.FindControl("Password");
            chkRememberMe = (CheckBox)this.LoginCtrl.FindControl("RememberMe");
            btnLogin      = (mojoButton)this.LoginCtrl.FindControl("Login");
            lnkRecovery   = (HyperLink)this.LoginCtrl.FindControl("lnkPasswordRecovery");
            lnkExtraLink  = (HyperLink)this.LoginCtrl.FindControl("lnkRegisterExtraLink");

            if (WebConfigSettings.DisableAutoCompleteOnLogin)
            {
                txtUserName.AutoCompleteType = AutoCompleteType.Disabled;
                txtPassword.AutoCompleteType = AutoCompleteType.Disabled;
            }

            divCaptcha = (Panel)LoginCtrl.FindControl("divCaptcha");
            captcha    = (CaptchaControl)LoginCtrl.FindControl("captcha");
            if (!siteSettings.RequireCaptchaOnLogin)
            {
                if (divCaptcha != null)
                {
                    divCaptcha.Visible = false;
                }
                if (captcha != null)
                {
                    captcha.Captcha.Enabled = false;
                }
            }
            else
            {
                captcha.ProviderName        = siteSettings.CaptchaProvider;
                captcha.RecaptchaPrivateKey = siteSettings.RecaptchaPrivateKey;
                captcha.RecaptchaPublicKey  = siteSettings.RecaptchaPublicKey;
            }

            if ((siteSettings.UseEmailForLogin) && (!siteSettings.UseLdapAuth))
            {
                if (!WebConfigSettings.AllowLoginWithUsernameWhenSiteSettingIsUseEmailForLogin)
                {
                    EmailValidator regexEmail = new EmailValidator();
                    regexEmail.ControlToValidate = txtUserName.ID;
                    regexEmail.ErrorMessage      = Resource.LoginFailedInvalidEmailFormatMessage;
                    this.LoginCtrl.Controls.Add(regexEmail);
                }
            }

            if (siteSettings.UseEmailForLogin && !siteSettings.UseLdapAuth)
            {
                this.lblUserID.Visible = false;
            }
            else
            {
                this.lblEmail.Visible = false;
            }

            if (SetFocus)
            {
                txtUserName.Focus();
            }

            lnkRecovery.Visible = ((siteSettings.AllowPasswordRetrieval || siteSettings.AllowPasswordReset) && (!siteSettings.UseLdapAuth ||
                                                                                                                (siteSettings.UseLdapAuth && siteSettings.AllowDbFallbackWithLdap)));

            lnkRecovery.NavigateUrl = this.LoginCtrl.PasswordRecoveryUrl;
            lnkRecovery.Text        = this.LoginCtrl.PasswordRecoveryText;

            lnkExtraLink.NavigateUrl = siteRoot + "/Secure/Register.aspx";
            lnkExtraLink.Text        = Resource.RegisterLink;
            lnkExtraLink.Visible     = siteSettings.AllowNewRegistration;

            string returnUrlParam = Page.Request.Params.Get("returnurl");

            if (!String.IsNullOrEmpty(returnUrlParam))
            {
                //string redirectUrl = returnUrlParam;
                lnkExtraLink.NavigateUrl += "?returnurl=" + SecurityHelper.RemoveMarkup(returnUrlParam);
            }

            chkRememberMe.Visible = siteSettings.AllowPersistentLogin;
            chkRememberMe.Text    = this.LoginCtrl.RememberMeText;

            if (WebConfigSettings.ForcePersistentAuthCheckboxChecked)
            {
                chkRememberMe.Checked = true;
                chkRememberMe.Visible = false;
            }

            btnLogin.Text = this.LoginCtrl.LoginButtonText;
            //SiteUtils.SetButtonAccessKey(btnLogin, AccessKeys.LoginAccessKey);
        }
Example #3
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

              Controls.Clear();

              string searchText = Resources.Resource.SearchButtonText;
              if (actionText != string.Empty) searchText = actionText;

              if (!linkOnly)
              {
              if (!String.IsNullOrEmpty(searchContainerElement))
              {
                  SetUpDefaultClick();
              }

              tb = new TextBox();
              tb.ID = this.ID + "_tbFS";
              if (inputPlaceHolderText != string.Empty) tb.Attributes.Add("Placeholder", inputPlaceHolderText);
              this.Controls.Add(tb);
              }

              if (renderAsButton)
              {
              mb = new mojoButton();
              mb.ID = this.ID + "_mbFS";
              mb.Text = searchText;
              if (actionCssClass != string.Empty) mb.CssClass = actionCssClass;
              mb.Click += new EventHandler(mbFS_Click);
              this.Controls.Add(mb);
              }
              else
              {
              lb = new LinkButton();
              lb.ID = this.ID + "_lbFS";
              lb.Text = searchText;
              if (actionCssClass != string.Empty) lb.CssClass = actionCssClass;
              lb.Click += new EventHandler(lbFS_Click);
              this.Controls.Add(lb);
              }
        }
Example #4
0
        private void PopulateControls()
        {
            if (siteSettings == null) { return; }
            if (siteSettings.DisableDbAuth) { this.Visible = false; return; }

            LoginCtrl.SetRedirectUrl = setRedirectUrl;

            lblUserID = (SiteLabel)this.LoginCtrl.FindControl("lblUserID");
            lblEmail = (SiteLabel)this.LoginCtrl.FindControl("lblEmail");
            txtUserName = (TextBox)this.LoginCtrl.FindControl("UserName");
            txtPassword = (TextBox)this.LoginCtrl.FindControl("Password");
            chkRememberMe = (CheckBox)this.LoginCtrl.FindControl("RememberMe");
            btnLogin = (mojoButton)this.LoginCtrl.FindControl("Login");
            lnkRecovery = (HyperLink)this.LoginCtrl.FindControl("lnkPasswordRecovery");
            lnkExtraLink = (HyperLink)this.LoginCtrl.FindControl("lnkRegisterExtraLink");

            if (WebConfigSettings.DisableAutoCompleteOnLogin)
            {
                txtUserName.AutoCompleteType = AutoCompleteType.Disabled;
                txtPassword.AutoCompleteType = AutoCompleteType.Disabled;
            }

            divCaptcha = (Panel)LoginCtrl.FindControl("divCaptcha");
            captcha = (CaptchaControl)LoginCtrl.FindControl("captcha");
            if (!siteSettings.RequireCaptchaOnLogin)
            {
                if (divCaptcha != null) { divCaptcha.Visible = false; }
                if (captcha != null) { captcha.Captcha.Enabled = false; }
            }
            else
            {
                captcha.ProviderName = siteSettings.CaptchaProvider;
                captcha.RecaptchaPrivateKey = siteSettings.RecaptchaPrivateKey;
                captcha.RecaptchaPublicKey = siteSettings.RecaptchaPublicKey;

            }

            if ((siteSettings.UseEmailForLogin) && (!siteSettings.UseLdapAuth))
            {
                if (!WebConfigSettings.AllowLoginWithUsernameWhenSiteSettingIsUseEmailForLogin)
                {
                    EmailValidator regexEmail = new EmailValidator();
                    regexEmail.ControlToValidate = txtUserName.ID;
                    regexEmail.ErrorMessage = Resource.LoginFailedInvalidEmailFormatMessage;
                    this.LoginCtrl.Controls.Add(regexEmail);
                }

            }

            if (siteSettings.UseEmailForLogin && !siteSettings.UseLdapAuth)
            {
                this.lblUserID.Visible = false;
            }
            else
            {
                this.lblEmail.Visible = false;
            }

            if (setFocus) { txtUserName.Focus(); }

            lnkRecovery.Visible = ((siteSettings.AllowPasswordRetrieval ||siteSettings.AllowPasswordReset) && (!siteSettings.UseLdapAuth ||
                                                                           (siteSettings.UseLdapAuth && siteSettings.AllowDbFallbackWithLdap)));

            lnkRecovery.NavigateUrl = this.LoginCtrl.PasswordRecoveryUrl;
            lnkRecovery.Text = this.LoginCtrl.PasswordRecoveryText;

            lnkExtraLink.NavigateUrl = siteRoot + "/Secure/Register.aspx";
            lnkExtraLink.Text = Resource.RegisterLink;
            lnkExtraLink.Visible = siteSettings.AllowNewRegistration;

            string returnUrlParam = Page.Request.Params.Get("returnurl");
            if (!String.IsNullOrEmpty(returnUrlParam))
            {
                //string redirectUrl = returnUrlParam;
                lnkExtraLink.NavigateUrl += "?returnurl=" + SecurityHelper.RemoveMarkup(returnUrlParam);
            }

            chkRememberMe.Visible = siteSettings.AllowPersistentLogin;
            chkRememberMe.Text = this.LoginCtrl.RememberMeText;

            if (WebConfigSettings.ForcePersistentAuthCheckboxChecked)
            {
                chkRememberMe.Checked = true;
                chkRememberMe.Visible = false;
            }

            btnLogin.Text = this.LoginCtrl.LoginButtonText;
            //SiteUtils.SetButtonAccessKey(btnLogin, AccessKeys.LoginAccessKey);
        }
Example #5
0
        /// <summary>
        /// Sets up the javscript for this map instance to be created.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            LoadSettings();
            IncludeGMapScript();


            pnlMapCanvas          = new Panel();
            pnlMapCanvas.CssClass = "gmap";
            pnlMapCanvas.ID       = "pnlMapCanvas";

            this.Controls.Add(pnlMapCanvas);

            if (enableDrivingDirections)
            {
                btnGetDirections          = new mojoButton();
                btnGetDirections.ID       = "btnGetDirections";
                btnGetDirections.Text     = directionsButtonText;
                btnGetDirections.ToolTip  = directionsButtonToolTip;
                btnGetDirections.CssClass = "button gmapbutton";


                this.Controls.Add(btnGetDirections);

                Literal space = new Literal();
                space.Text = "&nbsp;";
                this.Controls.Add(space);

                txtStartLocation          = new TextBox();
                txtStartLocation.ID       = "txtStartLocation";
                txtStartLocation.CssClass = "gmaptextbox";
                this.Controls.Add(txtStartLocation);

                pnlDirections          = new Panel();
                pnlDirections.ID       = "pnlDirections";
                pnlDirections.CssClass = "gdirections";
                this.Controls.Add(pnlDirections);

                if (useOldApi)
                {
                    btnGetDirections.Attributes.Add("onclick", "showMapAndDirections('" + pnlMapCanvas.ClientID
                                                    + "','" + pnlDirections.ClientID + "','" + txtStartLocation.ClientID + "','"
                                                    + location + "','" + CultureInfo.CurrentUICulture.TwoLetterISOLanguageName + "');return false;");
                }
                else
                {
                    string attribscr;
                    attribscr = "showMapAndDirections('" + pnlMapCanvas.ClientID
                                + "','" + pnlDirections.ClientID + "','" + txtStartLocation.ClientID + "','"
                                + location + "'";
                    if (enableZoom)
                    {
                        attribscr += ",true";
                    }
                    else
                    {
                        attribscr += ",false";
                    }
                    if (enableMapType)
                    {
                        attribscr += ",true";
                    }
                    else
                    {
                        attribscr += ",false";
                    }
                    attribscr += ", '" + this.GmapType.ToString() + "'";

                    attribscr += ");return false;";
                    btnGetDirections.Attributes.Add("onclick", attribscr);
                }

                this.DefaultButton = btnGetDirections.ID;
            }

            if (
                (!mapWidth.EndsWith("px")) &&
                (!mapWidth.EndsWith("%"))
                )
            {
                mapWidth += "px";
            }

            if (SiteUtils.UseMobileSkin())
            {
                this.pnlMapCanvas.Attributes.Add("style", "width:98%;"
                                                 + "height:" + mapHeight.ToInvariantString() + "px;");
            }
            else
            {
                this.pnlMapCanvas.Attributes.Add("style", "width:"
                                                 + mapWidth
                                                 + ";height:" + mapHeight.ToInvariantString() + "px;");
            }

            SetupCss();
            SetupScript();
        }
Example #6
0
        /// <summary>
        /// Sets up the javscript for this map instance to be created.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            LoadSettings();
            IncludeGMapScript();

            pnlMapCanvas = new Panel();
            pnlMapCanvas.CssClass = "gmap";
            pnlMapCanvas.ID = "pnlMapCanvas";

            this.Controls.Add(pnlMapCanvas);

            if (enableDrivingDirections)
            {
                btnGetDirections = new mojoButton();
                btnGetDirections.ID = "btnGetDirections";
                btnGetDirections.Text = directionsButtonText;
                btnGetDirections.ToolTip = directionsButtonToolTip;
                btnGetDirections.CssClass = "button gmapbutton";

                this.Controls.Add(btnGetDirections);

                Literal space = new Literal();
                space.Text = "&nbsp;";
                this.Controls.Add(space);

                txtStartLocation = new TextBox();
                txtStartLocation.ID = "txtStartLocation";
                txtStartLocation.CssClass = "gmaptextbox";
                this.Controls.Add(txtStartLocation);

                pnlDirections = new Panel();
                pnlDirections.ID = "pnlDirections";
                pnlDirections.CssClass = "gdirections";
                this.Controls.Add(pnlDirections);

                if (useOldApi)
                {
                    btnGetDirections.Attributes.Add("onclick", "showMapAndDirections('" + pnlMapCanvas.ClientID
                        + "','" + pnlDirections.ClientID + "','" + txtStartLocation.ClientID + "','"
                        + location + "','" + CultureInfo.CurrentUICulture.TwoLetterISOLanguageName + "');return false;");
                }
                else
                {
                    string attribscr;
                    attribscr = "showMapAndDirections('" + pnlMapCanvas.ClientID
                        + "','" + pnlDirections.ClientID + "','" + txtStartLocation.ClientID + "','"
                        + location + "'";
                    if (enableZoom)
                    {
                        attribscr += ",true";
                    }
                    else
                    {
                        attribscr += ",false";
                    }
                    if (enableMapType)
                    {
                        attribscr += ",true";
                    }
                    else
                    {
                        attribscr += ",false";
                    }
                    attribscr += ", '" + this.GmapType.ToString() + "'";

                    attribscr += ");return false;";
                    btnGetDirections.Attributes.Add("onclick", attribscr);

                }

                this.DefaultButton = btnGetDirections.ID;

            }

            if (
                (!mapWidth.EndsWith("px"))
                && (!mapWidth.EndsWith("%"))
            )
            {
                mapWidth += "px";
            }

            if (SiteUtils.UseMobileSkin())
            {
                this.pnlMapCanvas.Attributes.Add("style", "width:98%;"
                + "height:" + mapHeight.ToInvariantString() + "px;");
            }
            else
            {
                this.pnlMapCanvas.Attributes.Add("style", "width:"
                    + mapWidth
                    + ";height:" + mapHeight.ToInvariantString() + "px;");
            }

            SetupCss();
            SetupScript();
        }