protected void Page_Load(object sender, System.EventArgs e)
        {
            // Add password changer
            MemberPasswordTxt.Controls.Add(new UserControl().LoadControl(SystemDirectories.Umbraco + "/controls/passwordChanger.ascx"));

            if (Member.InUmbracoMemberMode())
            {
                _document  = new cms.businesslogic.member.Member(int.Parse(Request.QueryString["id"]));
                m_Member   = Membership.GetUser(_document.Id);
                tmp        = new controls.ContentControl(_document, controls.ContentControl.publishModes.NoPublish, "TabView1");
                tmp.Width  = Unit.Pixel(666);
                tmp.Height = Unit.Pixel(666);
                plc.Controls.Add(tmp);

                if (!IsPostBack)
                {
                    MemberLoginNameTxt.Text = _document.LoginName;
                    MemberEmail.Text        = _document.Email;
                }
                PlaceHolder ph = new PlaceHolder();
                MemberLoginNameTxt.ID = "loginname";
                ph.Controls.Add(MemberLoginNameTxt);
                ph.Controls.Add(MemberLoginNameVal);
                MemberLoginNameVal.ControlToValidate = MemberLoginNameTxt.ID;
                string[] errorVars = { ui.Text("login") };
                MemberLoginNameVal.ErrorMessage       = " " + ui.Text("errorHandling", "errorMandatoryWithoutTab", errorVars, null);
                MemberLoginNameVal.EnableClientScript = false;
                MemberLoginNameVal.Display            = ValidatorDisplay.Dynamic;

                tmp.PropertiesPane.addProperty(ui.Text("login"), ph);
                tmp.PropertiesPane.addProperty(ui.Text("password"), MemberPasswordTxt);
                tmp.PropertiesPane.addProperty("Email", MemberEmail);
            }
            else
            {
                m_Member = Membership.GetUser(Request.QueryString["id"]);
                MemberLoginNameTxt.Text = m_Member.UserName;
                if (!IsPostBack)
                {
                    MemberEmail.Text = m_Member.Email;
                }

                m_MemberShipPanel.Width = 300;
                m_MemberShipPanel.Text  = ui.Text("edit") + " " + m_Member.UserName;
                umbraco.uicontrols.Pane props = new umbraco.uicontrols.Pane();
                MemberLoginNameTxt.Enabled = false;

                // check for pw support
                if (!Membership.Provider.EnablePasswordRetrieval)
                {
                    MemberPasswordTxt.Controls.Clear();
                    MemberPasswordTxt.Controls.Add(
                        new LiteralControl("<em>" + ui.Text("errorHandling", "errorChangingProviderPassword") + "</em>"));
                }

                props.Controls.Add(AddProperty(ui.Text("login"), MemberLoginNameTxt));
                props.Controls.Add(AddProperty(ui.Text("password"), MemberPasswordTxt));
                props.Controls.Add(AddProperty("Email", MemberEmail));
                m_MemberShipPanel.Controls.Add(props);
                plc.Controls.Add(m_MemberShipPanel);
            }

            // Groups
            umbraco.uicontrols.Pane p = new umbraco.uicontrols.Pane();
            _memberGroups.ID    = "Membergroups";
            _memberGroups.Width = 175;
            string selectedMembers = "";

            foreach (string role in Roles.GetAllRoles())
            {
                // if a role starts with __umbracoRole we won't show it as it's an internal role used for public access
                if (!role.StartsWith("__umbracoRole"))
                {
                    ListItem li = new ListItem(role);
                    if (!IsPostBack)
                    {
                        if (Roles.IsUserInRole(m_Member.UserName, role))
                        {
                            selectedMembers += role + ",";
                        }
                    }
                    _memberGroups.Items.Add(li);
                }
            }
            _memberGroups.Value = selectedMembers;

            p.addProperty(ui.Text("membergroup"), _memberGroups);

            if (Member.InUmbracoMemberMode())
            {
                tmp.tpProp.Controls.Add(p);
                tmp.Save += new System.EventHandler(tmp_save);
            }
            else
            {
                m_MemberShipPanel.Controls.Add(p);
            }
        }
示例#2
0
		protected void Page_Load(object sender, System.EventArgs e)
		{

            // Add password changer
            MemberPasswordTxt.Controls.Add(new UserControl().LoadControl(SystemDirectories.Umbraco + "/controls/passwordChanger.ascx"));

            if (Member.InUmbracoMemberMode())
            {
                _document = new cms.businesslogic.member.Member(int.Parse(Request.QueryString["id"]));
                m_Member = Membership.GetUser(_document.Id);
                tmp = new controls.ContentControl(_document, controls.ContentControl.publishModes.NoPublish, "TabView1");
                tmp.Width = Unit.Pixel(666);
                tmp.Height = Unit.Pixel(666);
                plc.Controls.Add(tmp);

                if (!IsPostBack)
                {
                    MemberLoginNameTxt.Text = _document.LoginName;
                    MemberEmail.Text = _document.Email;
                }
                PlaceHolder ph = new PlaceHolder();
                MemberLoginNameTxt.ID = "loginname";
                ph.Controls.Add(MemberLoginNameTxt);
                ph.Controls.Add(MemberLoginNameVal);
                MemberLoginNameVal.ControlToValidate = MemberLoginNameTxt.ID;
                string[] errorVars = { ui.Text("login") };
                MemberLoginNameVal.ErrorMessage = " " + ui.Text("errorHandling", "errorMandatoryWithoutTab", errorVars, null);
                MemberLoginNameVal.EnableClientScript = false;
                MemberLoginNameVal.Display = ValidatorDisplay.Dynamic;

                tmp.PropertiesPane.addProperty(ui.Text("login"), ph);
                tmp.PropertiesPane.addProperty(ui.Text("password"), MemberPasswordTxt);
                tmp.PropertiesPane.addProperty("Email", MemberEmail);
            }
            else
            {
                m_Member = Membership.GetUser(Request.QueryString["id"]);
                MemberLoginNameTxt.Text = m_Member.UserName;
                if (!IsPostBack)
                {
                    MemberEmail.Text = m_Member.Email;
                }

                m_MemberShipPanel.Width = 300;
                m_MemberShipPanel.Text = ui.Text("edit") + " " + m_Member.UserName;
                umbraco.uicontrols.Pane props = new umbraco.uicontrols.Pane();
                MemberLoginNameTxt.Enabled = false;

                // check for pw support
                if (!Membership.Provider.EnablePasswordRetrieval) {
                    MemberPasswordTxt.Controls.Clear();
                    MemberPasswordTxt.Controls.Add(
                        new LiteralControl("<em>" + ui.Text("errorHandling", "errorChangingProviderPassword") + "</em>"));
                }

                props.Controls.Add(AddProperty(ui.Text("login"), MemberLoginNameTxt));
                props.Controls.Add(AddProperty(ui.Text("password"), MemberPasswordTxt));
                props.Controls.Add(AddProperty("Email", MemberEmail));
                m_MemberShipPanel.Controls.Add(props);
                plc.Controls.Add(m_MemberShipPanel);
            }

			// Groups
			umbraco.uicontrols.Pane p = new umbraco.uicontrols.Pane();
			_memberGroups.ID = "Membergroups";
			_memberGroups.Width = 175;
			string selectedMembers = "";
			foreach(string role in Roles.GetAllRoles()) 
			{
                // if a role starts with __umbracoRole we won't show it as it's an internal role used for public access
                if (!role.StartsWith("__umbracoRole"))
                {
                    ListItem li = new ListItem(role);
                    if (!IsPostBack)
                    {

                        if (Roles.IsUserInRole(m_Member.UserName, role))
                            selectedMembers += role + ",";
                    }
                    _memberGroups.Items.Add(li);
                }
			}
			_memberGroups.Value = selectedMembers;

            p.addProperty(ui.Text("membergroup"), _memberGroups);

            if (Member.InUmbracoMemberMode())
            {
                tmp.tpProp.Controls.Add(p);
                tmp.Save += new System.EventHandler(tmp_save);
            }
            else
                m_MemberShipPanel.Controls.Add(p);

		}