protected void btnSave_Click(object sender, EventArgs e)
 {
     BaseHandler bh = new BaseHandler();
     PHText t = bh.GetCurrentVersionText(CultureCode, ItemId, ItemType);
     if (t == null)
     {
         t = new PHText();
         t.CreatedByUserId = UserId;
         t.CultureCode = CultureCode;
         t.ItemId = ItemId;
         t.ItemType = ItemType;
     }
     t.Text = System.Net.WebUtility.HtmlDecode(hdnrichtext.Value);
     t.ModifiedByUserId = UserId;
     if (Case == EControlCase.Edit)
     {
         bh.SavePhTextInAllCc(t);
         Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", AttachQS));
     }
     else if (Case == EControlCase.Translate)
     {
         t.CultureCodeStatus = ECultureCodeStatus.HumanTranslated;
         bh.SavePhText(t);
         Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", AttachQS));
     }
 }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     BaseHandler bh = new BaseHandler();
     PHText t = bh.GetCurrentVersionText(CultureCode, ItemId, ItemType);
     if (t == null)
     {
         t = new PHText();
         t.CreatedByUserId = UserId;
         t.CultureCode = CultureCode;
         t.ItemId = ItemId;
         t.ItemType = ItemType;
     }
     t.Text = Regex.Replace(tbTheText.Text, "<[^>]*>", String.Empty);
     if (ddlHeadingType.SelectedIndex > 0)
     {
         t.Text = "<h" + ddlHeadingType.SelectedIndex.ToString() + ">" + t.Text + "</h" + ddlHeadingType.SelectedIndex.ToString() + ">";
     }
     t.ModifiedByUserId = UserId;
     if (Case == EControlCase.Edit)
     {
         bh.SavePhTextInAllCc(t);
         Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", AttachQS));
     }
     else if (Case == EControlCase.Translate)
     {
         t.CultureCodeStatus = ECultureCodeStatus.HumanTranslated;
         bh.SavePhText(t);
         Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", AttachQS));
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     BaseHandler bh = new BaseHandler();
     PHText t = bh.GetCurrentVersionText(CultureCode, ItemId, ItemType);
     PHText translatedFrom;
     if (t != null)
         TheText.Text = t.Text;
     switch (Case)
     {
         case EControlCase.ViewAllowEdit:
             pnlEdit.Visible = true;
             hlEdit.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "edit=" + ControlOrder, AttachQS);
             break;
         case EControlCase.Edit:
             TheText.Visible = false;
             btnSave.Visible = true;
             btnCancel.Visible = true;
             pnlRichTextbox.Visible = true;
             if (t != null)
                 hdnrichtext.Value = TheText.Text;
             break;
         case EControlCase.ViewAllowTranslate:
             pnlOriginalText.Visible = true;
             if (t != null)
             {
                 pnlOriginalText.Visible = true;
                 lblCurrentText.Visible = true;
                 if (t.CultureCodeStatus == ECultureCodeStatus.GoogleTranslated)
                 {
                     pnlTranslateFromGoogle.Visible = true;
                     hlTranslateFromGoogle.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "translatecp=" + ControlOrder, AttachQS);
                     btnGoogleOK.Visible = true;
                 }
                 else
                 {
                     pnlTranslateFromHuman.Visible = true;
                     hlTranslateFromHuman.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "translatecp=" + ControlOrder, AttachQS);
                 }
             }
             translatedFrom = bh.GetCurrentVersionText(CreatedInCultureCode, ItemId, ItemType);
             if (translatedFrom != null)
                 ltOriginalText.Text = translatedFrom.Text;
             break;
         case EControlCase.Translate:
             pnlOriginalText.Visible = true;
             btnSave.Visible = true;
             btnCancel.Visible = true;
             pnlRichTextbox.Visible = true;
             lblCurrentText.Visible = true;
             TheText.Visible = false;
             if (t != null)
                 hdnrichtext.Value = TheText.Text;
             translatedFrom = bh.GetCurrentVersionText(CreatedInCultureCode, ItemId, ItemType);
             if (translatedFrom != null)
                 ltOriginalText.Text = translatedFrom.Text;
             break;
     }
 }
 protected void btnGoogleOK_Click(object sender, EventArgs e)
 {
     BaseHandler bh = new BaseHandler();
     PHText t = bh.GetCurrentVersionText(CultureCode, ItemId, ItemType);
     if (t != null)
     {
         t.CultureCodeStatus = ECultureCodeStatus.HumanTranslated;
         t.ModifiedByUserId = UserId;
         bh.SavePhText(t);
         Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", AttachQS));
     }
 }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     BaseHandler bh = new BaseHandler();
     PHText t = bh.GetCurrentVersionText(CultureCode, ItemId, ItemType);
     if (t == null)
     {
         t = new PHText();
         t.CreatedByUserId = UserId;
         t.CultureCode = CultureCode;
         t.ItemId = ItemId;
         t.ItemType = ItemType;
     }
     t.Text = Regex.Replace(tbTheText.Text, "<[^>]*>", String.Empty);
     t.ModifiedByUserId = UserId;
     if (Case == EControlCase.Edit)
     {
         bh.SavePhTextInAllCc(t);
         if (ItemType == ETextItemType.PluggTitle)
         {
             string newPageName = ItemId.ToString() + ": " + t.Text;
             PluggContainer pc = new PluggContainer(CultureCode, ItemId);
             DNNHelper h = new DNNHelper();
             h.RenameTab(pc.ThePlugg.TabId, newPageName);
         }
         if (ItemType == ETextItemType.CourseTitle)
         {
             string newPageName = "C" + ItemId.ToString() + ": " + t.Text;
             CourseContainer cc = new CourseContainer(CultureCode, ItemId);
             DNNHelper h = new DNNHelper();
             h.RenameTab(cc.TheCourse.TabId, newPageName);
         }
         Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", "edit=0", AttachQS));
     }
     else if (Case == EControlCase.Translate)
     {
         t.CultureCodeStatus = ECultureCodeStatus.HumanTranslated;
         bh.SavePhText(t);
         Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", "translate=0", AttachQS));
     }
 }
Exemplo n.º 6
0
 ///<summary>
 /// Load TheHtmlCourseText in the CultureCode language from DB. You must set CourseId and CultureCode to get TheHtmlCourseText
 ///</summary>
 public void LoadTheHtmlCourseText()
 {
     if (TheCourse == null || TheCourse.CourseId == 0 || CultureCode == null)
         throw new Exception("Cannot load TheHtmlCourseText. Need CourseId and CultureCode");
     BaseHandler bh = new BaseHandler();
     TheHtmlCourseText = bh.GetCurrentVersionText(CultureCode, TheCourse.CourseId, ETextItemType.CourseRichRichText);
 }
Exemplo n.º 7
0
        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;
            //    }
            //}
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     BaseHandler bh = new BaseHandler();
     PHText t = bh.GetCurrentVersionText(CultureCode, ItemId, ItemType);
     PHText translatedFrom;
     if (t != null)
         TheText.Text = t.Text;
     switch (Case)
     {
         case EControlCase.ViewAllowEdit:
             pnlEdit.Visible = true;
             hlEdit.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "edit=" + ControlOrder, AttachQS);
             break;
         case EControlCase.Edit:
             TheText.Visible = false;
             btnSave.Visible = true;
             btnCancel.Visible = true;
             pnlEditText.Visible = true;
             if (t != null)
             {
                 if(TheText.Text[0]=='<')
                 {
                     ddlHeadingType.SelectedIndex = Convert.ToInt16(TheText.Text.Substring(2, 1));
                     tbTheText.Text = TheText.Text.Remove(TheText.Text.Length - 5).Remove(0, 4);
                 }
                 else
                 {
                     ddlHeadingType.SelectedIndex = 0;
                     tbTheText.Text = TheText.Text;
                 }
             }
             break;
         case EControlCase.ViewAllowTranslate:
             pnlOriginalText.Visible = true;
             if (t != null)
             {
                 lblCurrentText.Visible = true;
                 if (t.CultureCodeStatus == ECultureCodeStatus.GoogleTranslated)
                 {
                     pnlTranslateFromGoogle.Visible = true;
                     hlTranslateFromGoogle.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "translatecp=" + ControlOrder, AttachQS);
                     btnGoogleOK.Visible = true;
                 }
                 else
                 {
                     pnlTranslateFromHuman.Visible = true;
                     hlTranslateFromHuman.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "translatecp=" + ControlOrder, AttachQS);
                 }
             }
             translatedFrom = bh.GetCurrentVersionText(CreatedInCultureCode, ItemId, ItemType);
             if (translatedFrom != null)
                 ltOriginalText.Text = translatedFrom.Text;
             break;
         case EControlCase.Translate:
             pnlOriginalText.Visible = true;
             btnSave.Visible = true;
             btnCancel.Visible = true;
             lblCurrentText.Visible = true;
             pnlEditText.Visible = true;
             TheText.Visible = false;
             ddlHeadingType.Enabled  = false;
             if (t != null)
             {
                 if (TheText.Text[0] == '<')
                 {
                     ddlHeadingType.SelectedIndex = Convert.ToInt16(TheText.Text.Substring(2, 1));
                     tbTheText.Text = TheText.Text.Remove(TheText.Text.Length - 5).Remove(0, 4);
                 }
                 else
                 {
                     ddlHeadingType.SelectedIndex = 0;
                     tbTheText.Text = TheText.Text;
                 }
             }
             translatedFrom = bh.GetCurrentVersionText(CreatedInCultureCode, ItemId, ItemType);
             if (translatedFrom != null)
                 ltOriginalText.Text = translatedFrom.Text;
             break;
     }
 }
Exemplo n.º 9
0
        private void UpdatePHtext(ETextItemType ItemType, string txt)
        {
            var itemid = Convert.ToInt32(this.ComponentID);

            List<PluggComponent> comps = this.PluggContainer.GetComponentList();
            PluggComponent cToAdd = comps.Find(x => x.PluggComponentId == itemid);
            BaseHandler bh = new BaseHandler();

            var comtype = cToAdd.ComponentType;

            PHText phText = bh.GetCurrentVersionText(this.CurrentLanguage, itemid, ItemType);

            phText.Text = txt;
            phText.CultureCodeStatus = ECultureCodeStatus.GoogleTranslated;
            phText.CreatedByUserId = this.UserID;
            if (this.EditCase == 2)
            {
                phText.CultureCodeStatus = ECultureCodeStatus.HumanTranslated;
                bh.SavePhText(phText);
            }
            else
                bh.SavePhTextInAllCc(phText);
            // bh.SavePhText(phText);
            Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabID, "", new string[] { "edit=1", "language=" + this.CurrentLanguage }));
        }
Exemplo n.º 10
0
        private void UpdatePHtext(ETextItemType ItemType, string txt)
        {
            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;

            PHText phText = bh.GetCurrentVersionText(curlan, itemid, ItemType);

            phText.Text = txt;
            phText.CultureCodeStatus = ECultureCodeStatus.GoogleTranslated;
            phText.CreatedByUserId = this.UserId;
            if (EditStr == "2")
            {
                phText.CultureCodeStatus = ECultureCodeStatus.HumanTranslated;
                bh.SavePhText(phText);
            }
            else
            bh.SavePhTextInAllCc(phText);
               // bh.SavePhText(phText);
            Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", new string[] { "edit=" + EditStr, "language=" + curlan }));
        }
Exemplo n.º 11
0
        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 Page_Load(object sender, EventArgs e)
 {
     if (ItemType == ETextItemType.PluggDescription || ItemType == ETextItemType.CourseDescription)
     {
         tbTheText.TextMode = TextBoxMode.MultiLine;
         tbTheText.Height = 120;
         tbOriginalText.TextMode = TextBoxMode.MultiLine;
         tbOriginalText.Height = 120;
     }
     BaseHandler bh = new BaseHandler();
     PHText t = bh.GetCurrentVersionText(CultureCode, ItemId, ItemType);
     PHText translatedFrom;
     if (t != null)
         tbTheText.Text = t.Text;
     switch (Case)
     {
         case EControlCase.ViewAllowEdit:
             pnlEdit.Visible = true;
             hlEdit.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "edit=" + ControlOrder, AttachQS);
             break;
         case EControlCase.Edit:
             tbTheText.Enabled = true;
             btnSave.Visible = true;
             btnCancel.Visible = true;
             if (t != null)
                 tbTheText.Text = t.Text;
             break;
         case EControlCase.ViewAllowTranslate:
             if (t != null)
             {
                 pnlOriginalText.Visible = true;
                 lblCurrentText.Visible = true;
                 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.GetCurrentVersionText(CreatedInCultureCode, ItemId, ItemType);
             if (translatedFrom != null)
                 tbOriginalText.Text = translatedFrom.Text;
             break;
         case EControlCase.Translate:
             btnSave.Visible = true;
             btnCancel.Visible = true;
             tbTheText.Enabled = true;
             pnlOriginalText.Visible = true;
             lblCurrentText.Visible = true;
             if (t != null)
                 tbTheText.Text = t.Text;
             translatedFrom = bh.GetCurrentVersionText(CreatedInCultureCode, ItemId, ItemType);
             if (translatedFrom != null)
                 tbOriginalText.Text = translatedFrom.Text;
             break;
     }
 }
Exemplo n.º 13
0
 protected void btnSaveTranslation_Click(object sender, EventArgs e)
 {
     BaseHandler bh = new BaseHandler();
     PHText t = bh.GetCurrentVersionText(Language, Convert.ToInt32(hdnNodeSubjectId.Value), ETextItemType.Subject);
     t.Text = tbNewTranslation.Text;
     t.CultureCodeStatus = ECultureCodeStatus.HumanTranslated;
     bh.SavePhText(t);
     tbNewTranslation.Text = "";
     BindTree();
 }
Exemplo n.º 14
0
        private void UpdatePHtext(ETextItemType ItemType, string txt)
        {
            BaseHandler bh = new BaseHandler();

            PHText phText = bh.GetCurrentVersionText(curlan, cc.TheCourse.CourseId, ItemType);

            phText.Text = txt;
            phText.CreatedByUserId = this.UserId;
            phText.CultureCodeStatus = ECultureCodeStatus.HumanTranslated;
            bh.SavePhText(phText);
        }
Exemplo n.º 15
0
 protected void btnImpGTransT_Click(object sender, EventArgs e)
 {
     BaseHandler bh = new BaseHandler();
     ETextItemType ItemType = ETextItemType.CourseTitle;
     PHText phText = bh.GetCurrentVersionText(curlan, cc.TheCourse.CourseId, ItemType);
     phText.CultureCodeStatus = ECultureCodeStatus.HumanTranslated;
     bh.SavePhText(phText);
     Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", new string[] { "edit=" + EditStr, "language=" + curlan }));
 }
Exemplo n.º 16
0
 ///<summary>
 /// Load the title in the CultureCode language from DB. You must set PluggId and CultureCode to get the Title
 ///</summary>
 public void LoadTitle()
 {
     if (ThePlugg == null || ThePlugg.PluggId == 0)
         throw new Exception("Cannot load title. Need PluggId");
     BaseHandler bh = new BaseHandler();
     TheTitle = bh.GetCurrentVersionText(CultureCode, ThePlugg.PluggId, ETextItemType.PluggTitle);
 }
Exemplo n.º 17
0
 ///<summary>
 /// Load the Description in the CultureCode language from DB. You must set CourseId and CultureCode to get the Description
 ///</summary>
 public void LoadDescription()
 {
     if (TheCourse == null || TheCourse.CourseId == 0 || CultureCode == null)
         throw new Exception("Cannot load Description. Need CourseId and CultureCode");
     BaseHandler bh = new BaseHandler();
     TheDescription = bh.GetCurrentVersionText(CultureCode, TheCourse.CourseId, ETextItemType.CourseDescription);
 }
Exemplo n.º 18
0
        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);
            }
        }