protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { BaseHandler bh = new BaseHandler(); CultureCode = (Page as DotNetNuke.Framework.PageBase).PageCulture.Name; PluggId = Convert.ToInt32(((DotNetNuke.Framework.CDefault)this.Page).Title); string coursePluggIdStr = Page.Request.QueryString["cp"]; if (coursePluggIdStr == null) //This is a Plugg outside a course: no menu return; bool isNum = int.TryParse(coursePluggIdStr, out CoursePluggId); if (!isNum) return; currentCPE = bh.GetCPEntity(CoursePluggId); if (currentCPE == null) return; CourseId = currentCPE.CourseId; cc = new CourseContainer(CultureCode, CourseId); if (cc == null) return; pnlTitle.Visible = true; hlBackToCourse.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(cc.TheCourse.TabId, "", ""); cc.LoadPluggs(); CoursePlugg currentCP = bh.FindCoursePlugg(CultureCode, CourseId, CoursePluggId); CoursePlugg nextCP = bh.NextCoursePlugg(currentCP); if (nextCP != null) { PluggContainer p = new PluggContainer(CultureCode, nextCP.PluggId); lnkNextPlugg.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(p.ThePlugg.TabId, "", "cp=" + nextCP.CoursePluggId ); } else { lnkNextPlugg.Enabled = false; } PopulateTreeNodes((List<CoursePlugg>)cc.ThePluggs, TreeViewMain.Nodes); } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
protected void btnAddChild_Click(object sender, EventArgs e) { if (!CheckAddText()) { lblCannotAdd.Visible = true; return; } BaseHandler bh = new BaseHandler(); CoursePluggEntity SelectedCP = bh.GetCPEntity(Convert.ToInt32(hdnNodeCPId.Value)); CreateCP(1, SelectedCP.CoursePluggId); }
protected void Page_Load(object sender, EventArgs e) { try { BaseHandler bh = new BaseHandler(); CultureCode = (Page as DotNetNuke.Framework.PageBase).PageCulture.Name; string coursePluggIdStr = Page.Request.QueryString["cp"]; if (coursePluggIdStr == null) //This is a Plugg outside a course: no menu return; bool isNum = int.TryParse(coursePluggIdStr, out CoursePluggId); if (!isNum) return; currentCPE = bh.GetCPEntity(CoursePluggId); if (currentCPE == null) return; CourseId = currentCPE.CourseId; cc = new CourseContainer(CultureCode, CourseId); if (cc == null) return; InCreationLanguage = (cc.TheCourse.CreatedInCultureCode == CultureCode); IsAuthorized = ((this.UserId != -1 && cc.TheCourse.WhoCanEdit == EWhoCanEdit.Anyone) || cc.TheCourse.CreatedByUserId == this.UserId || (UserInfo.IsInRole("Administator"))); Edit = !string.IsNullOrEmpty(Page.Request.QueryString["editcp"]) ? Convert.ToInt16(Page.Request.QueryString["editcp"]) : -1; Translate = !string.IsNullOrEmpty(Page.Request.QueryString["translatecp"]) ? Convert.ToInt16(Page.Request.QueryString["translatecp"]) : -1; PHText theComment = bh.GetCurrentVersionText(CultureCode, CoursePluggId, ETextItemType.CoursePluggText); if (theComment != null && Edit == -1 && Translate == -1) TheText.Text = theComment.Text; #region hide/display controls if (!InCreationLanguage && UserId > -1 && Translate == -1) { phTranslate.Visible = true; hlTranslate.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "translatecp=0", "cp=" + CoursePluggId); } if (InCreationLanguage && IsAuthorized && Edit == -1) { phEditCPComment.Visible = true; if (theComment==null) hlEditCPComment.Text = Localization.GetString("AddCPComment", this.LocalResourceFile); else hlEditCPComment.Text = Localization.GetString("EditCPComment", this.LocalResourceFile); hlEditCPComment.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "editcp=0", "cp=" + CoursePluggId); } if (!InCreationLanguage && UserId > -1 && Translate > -1) { phExitTranslate.Visible = true; hlExitTranslate.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "cp=" + CoursePluggId); RichControl ucR = (RichControl)this.LoadControl("/DesktopModules/PlugghestControls/RichControl.ascx"); if ((ucR != null)) { ucR.ModuleConfiguration = this.ModuleConfiguration; ucR.ItemId = CoursePluggId; ucR.CultureCode = CultureCode; ucR.CreatedInCultureCode = CultureCode; ucR.CreatedInCultureCode = cc.TheCourse.CreatedInCultureCode; ucR.ControlOrder = 1; ucR.ItemType = ETextItemType.CoursePluggText; ucR.Case = EControlCase.ViewAllowTranslate; if (Translate == 1) ucR.Case = EControlCase.Translate; ucR.LocalResourceFile = "/DesktopModules/PlugghestControls/App_LocalResources/RichControl.ascx"; phTheText.Controls.Add(ucR); } } if (InCreationLanguage && IsAuthorized && Edit > -1) { plInfo.Visible = true; RichControl ucR = (RichControl)this.LoadControl("/DesktopModules/PlugghestControls/RichControl.ascx"); if ((ucR != null)) { ucR.ModuleConfiguration = this.ModuleConfiguration; ucR.ItemId = CoursePluggId; ucR.CultureCode = CultureCode; ucR.CreatedInCultureCode = CultureCode; ucR.ControlOrder = 1; ucR.ItemType = ETextItemType.CoursePluggText; ucR.Case = EControlCase.Edit; ucR.LocalResourceFile = "/DesktopModules/PlugghestControls/App_LocalResources/RichControl.ascx"; phTheText.Controls.Add(ucR); } } #endregion } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }