예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if(Convert.ToInt32(HostSettingManager.Get(HostSettingNames.UserRegistration)) == (int)UserRegistration.None)
            {
                if (LoginView1.FindControl("RegisterLink") != null)
                    LoginView1.FindControl("RegisterLink").Visible = false;
            }

            var oHelper = new SuckerFishMenuHelper(ProjectId);
            litMenu.Text = oHelper.GetHtml();

            if (HostSettingManager.Get(HostSettingNames.EnableGravatar, true))
            {
                var user = Membership.GetUser(Security.GetUserName());
                if (user != null && user.Email != null)
                {
                    Image img =  (System.Web.UI.WebControls.Image)LoginView1.FindControl("Avatar");
                    img.ImageUrl = PresentationUtils.GetGravatarImageUrl(user.Email, 32);
                }
            }

            ProjectsList.DataTextField = "Name";
            ProjectsList.DataValueField = "Id";

            if (!Page.IsPostBack)
            {
            	string localizedSelectProject = GetGlobalResourceObject("SharedResources", "SelectProject").ToString();
                if (Page.User.Identity.IsAuthenticated)
                {
                    ProjectsList.DataSource = ProjectManager.GetByMemberUserName(Security.GetUserName(), true);
                    ProjectsList.DataBind();
                    ProjectsList.Items.Insert(0, new ListItem(localizedSelectProject));
                }
                else if (!Page.User.Identity.IsAuthenticated && Boolean.Parse(HostSettingManager.Get(HostSettingNames.AnonymousAccess)))
                {
                    ProjectsList.DataSource = ProjectManager.GetPublicProjects();
                    ProjectsList.DataBind();
                    ProjectsList.Items.Insert(0, new ListItem(localizedSelectProject));
                }
                else
                {
                    ProjectsList.Visible = false;
                }

                var item = ProjectsList.Items.FindByValue(ProjectId.ToString());

                if (item != null)
                    ProjectsList.SelectedValue = item.Value;
            }
        }
예제 #2
0
 /// <summary>
 /// Binds the menu options.
 /// </summary>
 private void BindMenuOptions()
 {
     SuckerFishMenuHelper oHelper = new SuckerFishMenuHelper(ProjectId);
     litSucker.Text = oHelper.GetHtml();
 }