protected void Page_Load(object sender, EventArgs e) { string coursePageName = ((DotNetNuke.Framework.CDefault)this.Page).Title; coursePageName = coursePageName.Replace("C", ""); CourseId = Convert.ToInt32(coursePageName); CultureCode = (Page as DotNetNuke.Framework.PageBase).PageCulture.Name; BaseHandler bh = new BaseHandler(); cc = new CourseContainer(CultureCode, CourseId); IsAuthorized = ((this.UserId != -1 && cc.TheCourse.WhoCanEdit == EWhoCanEdit.Anyone) || cc.TheCourse.CreatedByUserId == this.UserId || (UserInfo.IsInRole("Administator"))); if (Request.Form["__EVENTTARGET"] == "btnWhoCanEdit") { // Fire event btnWhoCanEdit_Click(this, new EventArgs()); } if (Request.Form["__EVENTTARGET"] == "btnListed") { // Fire event btnListed_Click(this, new EventArgs()); } UserController uc = new UserController(); UserInfo u = uc.GetUser(PortalId, cc.TheCourse.CreatedByUserId); hlCreatedBy.Text = u.DisplayName; hlCreatedBy.NavigateUrl = DotNetNuke.Common.Globals.UserProfileURL(cc.TheCourse.CreatedByUserId); lbltheCreatedOn.Text = cc.TheCourse.CreatedOnDate.ToString(); rblWhoCanEdit.Items.Clear(); rblWhoCanEdit.Items.Add("Anyone"); rblWhoCanEdit.Items.Add("Only me"); rblWhoCanEdit.SelectedValue = "Anyone"; switch (cc.TheCourse.WhoCanEdit) { case EWhoCanEdit.Anyone: lbltheWhoCanEdit.Text = "Anyone"; break; case EWhoCanEdit.OnlyMe: lbltheWhoCanEdit.Text = "Only me"; rblWhoCanEdit.SelectedValue = "Only me"; break; case EWhoCanEdit.NotSet : lbltheWhoCanEdit.Text = "Not set"; break; } rblListed.Items.Clear(); rblListed.Items.Add(Localization.GetString("Listed.Text", this.LocalResourceFile)); rblListed.Items.Add(Localization.GetString("NotListed.Text", this.LocalResourceFile)); rblListed.SelectedIndex = 0; if (cc.TheCourse.IsListed) lblTheListed.Text = "Yes"; else { lblTheListed.Text = "No"; rblListed.SelectedIndex = 1; } if (cc.TheCourse.CreatedByUserId == this.UserId) { btnWhoCanEdit.Visible = true; btnListed.Visible = true; } cc.LoadDescription(); if (cc.TheDescription != null) lbltheDespription.Text = cc.TheDescription.Text; else lbltheDespription.Text = "-"; if(cc.TheCourse.CreatedByUserId == this.UserId || UserInfo.IsInRole("Administator")) { btnDelete.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { try { string CourseTitle = ((DotNetNuke.Framework.CDefault)this.Page).Title;//get Course from page title CourseTitle = CourseTitle.Replace("C", ""); if (!string.IsNullOrEmpty(CourseTitle)) { Courseid = Convert.ToInt32(CourseTitle); } curlan = (Page as DotNetNuke.Framework.PageBase).PageCulture.Name; cc = new CourseContainer(curlan, Courseid); CallLocalization(); EditStr = Page.Request.QueryString["edit"]; IsAuthorized = (cc.TheCourse.WhoCanEdit == EWhoCanEdit.Anyone || cc.TheCourse.CreatedByUserId == this.UserId || UserInfo.IsInRole("Administator")); if (this.UserId == -1) { IsAuthorized = false; } IsCase3 = (EditStr == "1" && IsAuthorized); IsCase2 = (EditStr == "2" && IsAuthorized); BaseHandler bh = new BaseHandler(); if (cc.TheDescription == null) cc.LoadDescription(); if (cc.TheTitle == null) cc.LoadTitle(); LoadRichRichText(); lblDescription.Text = Server.HtmlDecode(cc.TheDescription.Text); lblTitle.Text = Server.HtmlDecode(cc.TheTitle.Text); lblRichRichTxt.Text = Server.HtmlDecode(cc.TheRichRichText.Text); BindTree(cc.TheCourse.SubjectId); PageLoadFun(); } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }