protected void btnSave_Click(object sender, EventArgs e) { BaseHandler bh = new BaseHandler(); PHLatex t = bh.GetCurrentVersionLatexText(CultureCode, ItemId, ItemType); if (t == null) { t = new PHLatex(); t.CreatedByUserId = UserId; t.CultureCode = CultureCode; t.ItemId = ItemId; t.ItemType = ItemType; } t.ModifiedByUserId = UserId; if (Case == EControlCase.Edit) { t.Text = tbEnterLatex.Text; t.HtmlText = ""; bh.SaveLatexTextInAllCc(t); Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", "edit=0", AttachQS)); } else if (Case == EControlCase.Translate) { PHLatex translatedFrom = bh.GetCurrentVersionLatexText(CreatedInCultureCode, ItemId, ItemType); if (translatedFrom != null) { t.Text = translatedFrom.Text; t.HtmlText = System.Net.WebUtility.HtmlDecode(teTranslate.Text); t.CultureCodeStatus = ECultureCodeStatus.HumanTranslated; bh.SaveLatexText(t); Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", "translate=0", AttachQS)); } } }
protected void btnGoogleOK_Click(object sender, EventArgs e) { BaseHandler bh = new BaseHandler(); PHLatex t = bh.GetCurrentVersionLatexText(CultureCode, ItemId, ItemType); if (t != null) { t.CultureCodeStatus = ECultureCodeStatus.HumanTranslated; t.ModifiedByUserId = UserId; bh.SaveLatexText(t); Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", "translate=0", AttachQS)); } }
///<summary> /// Load TheLatexCourseText in the CultureCode language from DB. You must set CourseId and CultureCode to get TheHtmlCourseText ///</summary> public void LoadTheLatexCourseText() { if (TheCourse == null || TheCourse.CourseId == 0 || CultureCode == null) throw new Exception("Cannot load TheHtmlCourseText. Need CourseId and CultureCode"); BaseHandler bh = new BaseHandler(); TheLatexCourseText = bh.GetCurrentVersionLatexText(CultureCode, TheCourse.CourseId, ELatexItemType.CourseLatexText); }
protected void btnSaveRRt_Click(object sender, EventArgs e) { List<PluggComponent> comps = this.PluggContainer.GetComponentList(); PluggComponent cToAdd = comps.Find(x => x.PluggComponentId == this.ComponentID); BaseHandler bh = new BaseHandler(); var comtype = cToAdd.ComponentType; PHLatex latex = bh.GetCurrentVersionLatexText(this.CurrentLanguage, this.ComponentID, ELatexItemType.PluggComponentLatex); latex.CultureCodeStatus = ECultureCodeStatus.GoogleTranslated; latex.ItemId = this.ComponentID; latex.CreatedByUserId = this.UserID; latex.Text = System.Net.WebUtility.HtmlDecode(richrichtext.Text); //bh.SaveLatexText(latex); bh.SaveLatexTextInAllCc(latex); Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabID, "", new string[] { "edit=1", "language=" + this.CurrentLanguage })); }
protected void btnTest_Click(object sender, EventArgs e) { BaseHandler bh = new BaseHandler(); PluggContainer pc = new PluggContainer("en-US", 31); List<PluggComponent> comps = pc.GetComponentList(); foreach(PluggComponent comp in comps) { switch (comp.ComponentType) { case EComponentType.Label: PHText lbl = bh.GetCurrentVersionText(pc.CultureCode, comp.PluggComponentId, ETextItemType.PluggComponentLabel); //Handle label break; case EComponentType.RichText: PHText rt = bh.GetCurrentVersionText(pc.CultureCode, comp.PluggComponentId, ETextItemType.PluggComponentRichText); //Handle rich text break; case EComponentType.RichRichText: PHText rrt = bh.GetCurrentVersionText(pc.CultureCode, comp.PluggComponentId, ETextItemType.PluggComponentRichRichText); //Handle richrich text break; case EComponentType.Latex: PHLatex lt = bh.GetCurrentVersionLatexText(pc.CultureCode, comp.PluggComponentId, ELatexItemType.PluggComponentLatex); //Handle Latex text break; case EComponentType.YouTube: YouTube yt = bh.GetYouTubeByComponentId(comp.PluggComponentId); //Handle YouTube break; } } PHText rrText = bh.GetCurrentVersionText(pc.CultureCode, comps[0].PluggComponentId, ETextItemType.PluggComponentRichRichText); string myText = rrText.Text; //int x; //PluggComponent vv = comps[0]; //foreach(PluggComponent c in comps) //{ // x = c.PluggComponentId; //} //pc.ThePlugg.CreatedByUserId = 1; //pc.ThePlugg.ModifiedByUserId = 1; //pc.ThePlugg.WhoCanEdit = EWhoCanEdit.Anyone; //pc.SetTitle("This is my Title"); //pc.SetDescription("This is my description"); //List<object> cmpData = new List<object>(); //YouTube v = new YouTube(); //v.YouTubeAuthor = ""; //v.YouTubeCode = "asdasdasdas"; //v.YouTubeComment = ""; //v.YouTubeCreatedOn = DateTime.Now; //v.YouTubeDuration = 100; //v.YouTubeTitle = "This is my Title"; //cmpData.Add(v); //PHText htmlText = new PHText(); //htmlText.Text = "This is my Html text"; //htmlText.ItemType = ETextItemType.PluggComponentRichRichText; //cmpData.Add(htmlText); //bh.SavePlugg(pc, cmpData); //PHLatex latexText = new PHLatex(); //latexText.Text = "This is my Latex text"; //latexText.ItemType = ELatexItemType.PluggComponentLatex; //cmpData.Add(latexText); //pc.LoadComponents(); //switch (pc.TheComponents.GetType().Name) //{ // case "Aba": // break; //} //pc.ThePlugg = bh.GetPlugg(1); //pc.LoadComponents(); //foreach (var c in pc.TheComponents) //{ // switch (c.GetType().Name) // { // case "PHText": // PHText xx = (PHText)c; // string x = theTitle; // break; // } //} }
private void DisPlayPluggComp() { List<PluggComponent> comps = p.GetComponentList(); BaseHandler bh = new BaseHandler(); string ddl = ""; string str = "</select></div><hr />"; int i = 0, IntCompOrder = 1; if (comps.Count == 0) { ShowNoComMsg(); } ddl = CreateDropDown(ddl); Label dynamicLabel = new Label(); if (IsCase3) { chkComTxt = true; } int? subid = p.ThePlugg.SubjectId; CreateSubject(i, subid); bool isLastComp = false; foreach (PluggComponent comp in comps) { isLastComp = (IntCompOrder == comps.Count); switch (comp.ComponentType) { case EComponentType.Label: PHText lbl = bh.GetCurrentVersionText(curlan, comp.PluggComponentId, ETextItemType.PluggComponentLabel); //This condition is used for editing plugg string LabHTMLstring = ""; if (IsCase3) { if (lbl.Text == "(No text)") lbl.Text = "(currently no text)"; LabHTMLstring = CreateDiv(lbl, "Label" + i, LabComponenttxt+" " + IntCompOrder + ": " + BtnLabelTxt); int orderid = comp.ComponentOrder; CreateBtnDel(orderid, "btncsdel", "btnlbDel" + i + ""); CreateBtnEdit(comp, lbl, "btncsdel", "btnlbEdit" + i + ""); if (isLastComp) { LabHTMLstring = "<hr /></div>" + LabAddNewcomTxt + " after "+LabComponenttxt+" " + IntCompOrder + ": <select class='ddlclass' id='ddl" + i + "'>"; } else { LabHTMLstring = "<hr /></div>" + LabAddNewcomTxt + " between " + LabComponenttxt + " " + IntCompOrder + " and " + (IntCompOrder + 1).ToString() + ": <select class='ddlclass' id='ddl" + i + "'>"; } LabHTMLstring = LabHTMLstring + ddl; divTitle.Controls.Add(new LiteralControl(LabHTMLstring)); CreateBtnAdd(orderid, "btncs", "btnlbAdd" + i + ""); divTitle.Controls.Add(new LiteralControl(str)); } else if (lbl.Text == "(No text)") { IntCompOrder--; break; } //This condition is used for Translation The Plugg Text(same for all cases) else if (IsCase2) { LabHTMLstring = CreateDiv(lbl, "Label" + i, LabComponenttxt+" " + IntCompOrder + ": " + BtnLabelTxt); if (lbl.CultureCodeStatus == ECultureCodeStatus.GoogleTranslated) { CreateBtnImproveHumGoogleTrans(comp, lbl, "googletrans", "btnrtIGT" + i + "", BtnImpgoogleTransTxt); CreateBtnGoogleT(lbl, "googleTrasok", "btnGTText" + i + ""); } if (lbl.CultureCodeStatus == ECultureCodeStatus.HumanTranslated) { CreateBtnImproveHumGoogleTrans(comp, lbl, "btnhumantrans", "btnlbl" + i + "",BtnImproveHumTransTxt); } divTitle.Controls.Add(new LiteralControl(str)); chkComTxt = true; } else { if (lbl.Text == "(No text)") { break; } if (lbl != null) divTitle.Controls.Add(new LiteralControl("<div>" + lbl.Text + "</div> ")); // string LabHTMLstring = CreateDiv(lbl, "Label" + i, BtnLabelTxt); chkComTxt = true; } break; case EComponentType.RichText: PHText rt = bh.GetCurrentVersionText(curlan, comp.PluggComponentId, ETextItemType.PluggComponentRichText); if (IsCase3) { if (rt.Text == "(No text)") rt.Text = "(currently no text)"; string RtHTMLstring = CreateDiv(rt, "RichText" + i, LabComponenttxt+" " + IntCompOrder + ": " + BtnRichTextTxt); int RTorderid = comp.ComponentOrder; CreateBtnDel(RTorderid, "btncsdel", "btnrtDel" + i + ""); CreateBtnEdit(comp, rt, "btncsdel", "btnrtEdit" + i + ""); if (isLastComp) { RtHTMLstring = "<hr /></div>" + LabAddNewcomTxt + " after " + LabComponenttxt + " " + IntCompOrder + ": <select class='ddlclass' id='Rtddl" + i + "'>"; } else { RtHTMLstring = "<hr /></div>" + LabAddNewcomTxt + " between " + LabComponenttxt + " " + IntCompOrder + " and " + (IntCompOrder + 1).ToString() + ": <select class='ddlclass' id='Rtddl" + i + "'>"; } RtHTMLstring = RtHTMLstring + ddl; divTitle.Controls.Add(new LiteralControl(RtHTMLstring)); CreateBtnAdd(RTorderid, "btncs", "btnrtAdd" + i + ""); divTitle.Controls.Add(new LiteralControl(str)); } else if (rt.Text == "(No text)") { IntCompOrder--; break; } else if (IsCase2) { string RtHTMLstring = CreateDiv(rt, "RichText" + i, LabComponenttxt+" " + IntCompOrder + ": " + BtnRichTextTxt); if (rt.CultureCodeStatus == ECultureCodeStatus.GoogleTranslated) { CreateBtnImproveHumGoogleTrans(comp, rt, "googletrans", "btnrtIGT" + i + "", BtnImpgoogleTransTxt); CreateBtnGoogleT(rt, "googleTrasok", "btnrtGTText" + i + ""); } if (rt.CultureCodeStatus == ECultureCodeStatus.HumanTranslated) { CreateBtnImproveHumGoogleTrans(comp, rt, "btnhumantrans", "btnrtIHT" + i + "",BtnImproveHumTransTxt); } divTitle.Controls.Add(new LiteralControl(str)); chkComTxt = true; } else { if (rt.Text == "(No text)") { break; } divTitle.Controls.Add(new LiteralControl("<div>" + rt.Text + "</div> ")); // string RtHTMLstring = CreateDiv(rt, "RichText" + i, BtnRichTextTxt); chkComTxt = true; } break; case EComponentType.RichRichText: PHText rrt = bh.GetCurrentVersionText(curlan, comp.PluggComponentId, ETextItemType.PluggComponentRichRichText); if (IsCase3) { if (rrt.Text == "(No text)") rrt.Text = "(currently no text)"; string RRTHTMLstring = CreateDiv(rrt, "RichRichText" + i, LabComponenttxt+" " + IntCompOrder + ": " + BtnRichRichTxttxt); int RRTorderid = comp.ComponentOrder; CreateBtnDel(RRTorderid, "btncsdel", "btnrrtDel" + i + ""); CreateBtnEdit(comp, rrt, "btncsdel", "btnrrtEdit" + i + ""); if (isLastComp) { RRTHTMLstring = "<hr /></div>" + LabAddNewcomTxt + " after " + LabComponenttxt + " " + IntCompOrder + ": <select class='ddlclass' id='Rtddl" + i + "'>"; } else { RRTHTMLstring = "<hr /></div>" + LabAddNewcomTxt + " between " + LabComponenttxt + " " + IntCompOrder + " and " + (IntCompOrder + 1).ToString() + ": <select class='ddlclass' id='Rtddl" + i + "'>"; } RRTHTMLstring = RRTHTMLstring + ddl; divTitle.Controls.Add(new LiteralControl(RRTHTMLstring)); CreateBtnAdd(RRTorderid, "btncs", "btnrrtAdd" + i + ""); divTitle.Controls.Add(new LiteralControl(str)); } else if (rrt.Text == "(No text)") { IntCompOrder--; break; } else if (IsCase2) { string RRTHTMLstring = CreateDiv(rrt, "RichRichText" + i, LabComponenttxt+" " + IntCompOrder + ": " + BtnRichRichTxttxt); if (rrt.CultureCodeStatus == ECultureCodeStatus.GoogleTranslated) { CreateBtnImproveHumGoogleTrans(comp, rrt, "googletrans", "btnrrtIGT" + i + "",BtnImpgoogleTransTxt); CreateBtnGoogleT(rrt, "googleTrasok", "btnrrtGTText" + i + ""); } if (rrt.CultureCodeStatus == ECultureCodeStatus.HumanTranslated) { CreateBtnImproveHumGoogleTrans(comp, rrt, "btnhumantrans", "btnrrtIHT" + i + "",BtnImproveHumTransTxt); } divTitle.Controls.Add(new LiteralControl(str)); chkComTxt = true; } else { if (rrt.Text == "(No text)") { break; } divTitle.Controls.Add(new LiteralControl("<div>" + rrt.Text + "</div> ")); //string RRTHTMLstring = CreateDiv(rrt, "RichRichText" + i, BtnRichRichTxttxt); chkComTxt = true; } break; case EComponentType.Latex: PHLatex lat = bh.GetCurrentVersionLatexText(curlan, comp.PluggComponentId, ELatexItemType.PluggComponentLatex); if (IsCase3) { if (lat.Text == "(No text)") lat.Text = "(currently no text)"; string LatHTMLstring = CreateDivLat(lat, "Latex" + i, IntCompOrder); // string RRTHTMLstring = CreateDivLat(lat, "Latex" + i, "Component " + IntCompOrder + ": " + BtnRichRichTxttxt, IntCompOrder); int ltorderid = comp.ComponentOrder; CreateBtnDel(ltorderid, "btncsdel", "btnltDel" + i + ""); Button editbtn = new Button(); editbtn.CssClass = "btncsdel"; editbtn.ID = "btnltEdit" + i; editbtn.Text = BtnEditTxt; editbtn.Click += (s, e) => { CallLatFun(ltorderid, comp, lat, "1"); }; divTitle.Controls.Add(editbtn); if (isLastComp) { LatHTMLstring = "<hr /></div>" + LabAddNewcomTxt + " after " + LabComponenttxt + " " + IntCompOrder + ": <select class='ddlclass' id='ltddl" + i + "'>"; } else { LatHTMLstring = "<hr /></div>" + LabAddNewcomTxt + " between " + LabComponenttxt + " " + IntCompOrder + " and " + (IntCompOrder + 1).ToString() + ": <select class='ddlclass' id='ltddl" + i + "'>"; } LatHTMLstring = LatHTMLstring + ddl; divTitle.Controls.Add(new LiteralControl(LatHTMLstring)); CreateBtnAdd(ltorderid, "btncs", "btnlatexAdd" + i + ""); divTitle.Controls.Add(new LiteralControl(str)); } else { if (lat.Text == "(No text)") { break; } divTitle.Controls.Add(new LiteralControl("<div>" + lat.Text + "</div> ")); // string LatHTMLstring = CreateDivLat(lat, "Latex" + i, IntCompOrder); if (IsCase2) divTitle.Controls.Add(new LiteralControl("<hr />")); chkComTxt = true; } break; case EComponentType.YouTube: YouTube yt = bh.GetYouTubeByComponentId(comp.PluggComponentId); string strYoutubeIframe = ""; string ytYouTubecode = ""; try { strYoutubeIframe = yt.GetIframeString(p.CultureCode); } catch { strYoutubeIframe = "(currently no video)"; } if (yt == null) { ytYouTubecode = "(currently no video)"; } else { ytYouTubecode = yt.YouTubeCode; } var ytdivid = "Youtube" + i; var ytddlid = "ytddl" + i; var ytorderid = comp.ComponentOrder; string ytHTMLstring = ""; if (IsCase3) { ytHTMLstring = "<div><div id=" + ytdivid + " class='Main'>" + LabComponenttxt+" " + IntCompOrder + ": " + "YouTube"; divTitle.Controls.Add(new LiteralControl(ytHTMLstring)); CreateBtnDel(ytorderid, "btncsdel", "btnytDel" + i + ""); string IdYt = "btnrrtEdit" + i; CreateBtnYTEdit(comp, yt, ytorderid, "btncsdel", "IdYt" + i + ""); if (isLastComp) { ytHTMLstring = "</div>" + strYoutubeIframe + "</br><hr />" + LabAddNewcomTxt + " after " + LabComponenttxt + " " + IntCompOrder + ": <select class='ddlclass' id=" + ytddlid + ">"; } else { ytHTMLstring = "</div>" + strYoutubeIframe + "</br><hr />" + LabAddNewcomTxt + " between " + LabComponenttxt + " " + IntCompOrder + " and " + (IntCompOrder + 1).ToString() + ": <select class='ddlclass' id=" + ytddlid + ">"; } ytHTMLstring = ytHTMLstring + ddl; divTitle.Controls.Add(new LiteralControl(ytHTMLstring)); CreateBtnAdd(ytorderid, "btncs", "btnytAdd" + i + ""); divTitle.Controls.Add(new LiteralControl(str)); } else if (strYoutubeIframe == "(currently no video)") { IntCompOrder--; break; } else { if (strYoutubeIframe == "(currently no video)") { break; } // divTitle.Controls.Add(new LiteralControl("<div>" + strYoutubeIframe + "</div> ")); ytHTMLstring = "<div>" + strYoutubeIframe + "</div>"; if (IsCase2) divTitle.Controls.Add(new LiteralControl("<div><div id=" + ytdivid + " class='Main'>" + LabComponenttxt+" " + IntCompOrder + ": " + "YouTube")); divTitle.Controls.Add(new LiteralControl(ytHTMLstring)); if (IsCase2) divTitle.Controls.Add(new LiteralControl("<hr />")); chkComTxt = true; } break; } i++; IntCompOrder++; } if (!chkComTxt) ShowNoComMsg(); }
protected void btnSaveRRt_Click(object sender, EventArgs e) { var id = hdnlabel.Value; var itemid = Convert.ToInt32(id); List<PluggComponent> comps = p.GetComponentList(); PluggComponent cToAdd = comps.Find(x => x.PluggComponentId == Convert.ToInt32(id)); BaseHandler bh = new BaseHandler(); var comtype = cToAdd.ComponentType; switch (cToAdd.ComponentType) { case EComponentType.RichRichText: //PHText RichRichText = bh.GetCurrentVersionText(curlan, itemid, ETextItemType.PluggComponentRichRichText); //RichRichText.Text = richrichtext.Text; PHText objPHtext = new PHText(System.Net.WebUtility.HtmlDecode(richrichtext.Text), curlan, ETextItemType.PluggComponentRichRichText); objPHtext.CultureCodeStatus = ECultureCodeStatus.GoogleTranslated; objPHtext.ItemId = itemid; objPHtext.CreatedByUserId = this.UserId; if (EditStr == "2") objPHtext.CultureCodeStatus = ECultureCodeStatus.HumanTranslated; bh.SavePhTextInAllCc(objPHtext); break; case EComponentType.Latex: PHLatex latex = bh.GetCurrentVersionLatexText(curlan, Convert.ToInt32(id), ELatexItemType.PluggComponentLatex); latex.CultureCodeStatus = ECultureCodeStatus.GoogleTranslated; latex.ItemId = itemid; latex.CreatedByUserId = this.UserId; latex.Text = System.Net.WebUtility.HtmlDecode(richrichtext.Text); //bh.SaveLatexText(latex); bh.SaveLatexTextInAllCc(latex); break; } Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", new string[] { "edit=" + EditStr, "language=" + curlan })); }
protected void btnSaveRRt_Click(object sender, EventArgs e) { BaseHandler bh = new BaseHandler(); PHLatex latex = bh.GetCurrentVersionLatexText(this.CurrentLanguage, this.ComponentID, ELatexItemType.PluggComponentLatex); latex.CultureCodeStatus = ECultureCodeStatus.HumanTranslated; latex.ModifiedByUserId = this.UserID; latex.Text = System.Net.WebUtility.HtmlDecode(txtRRtext.Text); bh.SaveLatexText(latex); Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabID, "", new string[] { "edit=1", "language=" + this.CurrentLanguage })); }
protected void Page_Load(object sender, EventArgs e) { BaseHandler bh = new BaseHandler(); PHLatex t = bh.GetCurrentVersionLatexText(CultureCode, ItemId, ItemType); PHLatex translatedFrom; if (t != null) ltTheText.Text = t.HtmlText; switch (Case) { case EControlCase.ViewAllowEdit: pnlEdit.Visible = true; hlEdit.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "edit=" + ControlOrder, AttachQS); break; case EControlCase.Edit: lblCurrentText.Visible = true; pnlTheText.Visible = false; pnlEnterLatex.Visible = true; if (t != null) tbEnterLatex.Text = t.Text; btnSave.Visible = true; btnCancel.Visible = true; break; case EControlCase.ViewAllowTranslate: lblCurrentText.Visible = true; pnlOriginalText.Visible = true; if (t != null) { if (t.CultureCodeStatus == ECultureCodeStatus.GoogleTranslated) { pnlTranslateFromGoogle.Visible = true; hlTranslateFromGoogle.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "translate=" + ControlOrder, AttachQS); btnGoogleOK.Visible = true; } else { pnlTranslateFromHuman.Visible = true; hlTranslateFromHuman.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "translate=" + ControlOrder, AttachQS); } } translatedFrom = bh.GetCurrentVersionLatexText(CreatedInCultureCode, ItemId, ItemType); if (translatedFrom != null) ltOriginalText.Text = translatedFrom.HtmlText; break; case EControlCase.Translate: lblCurrentText.Visible = true; pnlTheText.Visible = false; pnlOriginalText.Visible = true; pnlTranslate.Visible = true; btnSave.Visible = true; btnCancel.Visible = true; if (t != null) teTranslate.Text = t.HtmlText; translatedFrom = bh.GetCurrentVersionLatexText(CreatedInCultureCode, ItemId, ItemType); if (translatedFrom != null) ltOriginalText.Text = translatedFrom.HtmlText; break; } }