Example #1
0
 private void PopulateTreeNodes(List<CourseItem> LstCourseItem, TreeNodeCollection RootNodes)
 {
     foreach (CourseItem ObjCourseItem in LstCourseItem)
     {
         TreeNode NodeToAdd = new TreeNode();
         if (ObjCourseItem.ItemType.ToString() == ECourseItemType.Plugg.ToString())
         {
             BaseHandler plugghandler = new BaseHandler();
             PluggContainer p = new PluggContainer();
             p.ThePlugg = plugghandler.GetPlugg(ObjCourseItem.ItemId);
             string curlan = (Page as PageBase).PageCulture.Name;
             p.CultureCode = curlan;
             p.LoadTitle();
             NodeToAdd.Text = "<a  style='text-decoration: underline;cursor: pointer; ' href='/" + ObjCourseItem.ItemId + "' >" + p.TheTitle.Text + "</a>";
         }
         else
         {
             NodeToAdd.Text = Convert.ToString(ObjCourseItem.label);
         }
         NodeToAdd.SelectAction = TreeNodeSelectAction.None;
         RootNodes.Add(NodeToAdd);
         if (ObjCourseItem.children != null)
             PopulateTreeNodes((List<CourseItem>)ObjCourseItem.children, NodeToAdd.ChildNodes);
     }
 }
Example #2
0
        public void SavePlugg(PluggContainer p)
        {
            try
            {
                bool isNew = p.ThePlugg.PluggId == 0;

                //Temporary - remove soon
                p.ThePlugg.Title = "Title no longer here";
                p.ThePlugg.CreatedByUserId = 1;
                p.ThePlugg.ModifiedByUserId = 1;

                if (isNew)
                    rep.CreatePlugg(p.ThePlugg);
                else
                    rep.UpdatePlugg(p.ThePlugg);

                //Todo: Update..
                p.TheTitle.ItemId = p.ThePlugg.PluggId;
                p.TheTitle.ItemType = ETextItemType.PluggTitle;
                p.TheTitle.CcStatus = ECCStatus.InCreationLanguage;
                p.TheTitle.CreatedByUserId = p.ThePlugg.CreatedByUserId;
                p.TheTitle.ModifiedByUserId = p.ThePlugg.ModifiedByUserId;
                SavePhText(p.TheTitle);

                //Todo: Update..
                if (p.TheHtmlText != null)
                {
                    p.TheHtmlText.ItemId = p.ThePlugg.PluggId;
                    p.TheHtmlText.ItemType = ETextItemType.PluggHtml;
                    p.TheHtmlText.CcStatus = ECCStatus.InCreationLanguage;
                    p.TheHtmlText.CreatedByUserId = p.ThePlugg.CreatedByUserId;
                    p.TheHtmlText.ModifiedByUserId = p.ThePlugg.ModifiedByUserId;
                    SavePhText(p.TheHtmlText);
                }

                //Todo: Update..
                if (p.TheLatex != null)
                {
                    p.TheLatex.ItemId = p.ThePlugg.PluggId;
                    p.TheLatex.ItemType = ELatexType.Plugg;
                    p.TheLatex.CcStatus = ECCStatus.InCreationLanguage;
                    p.TheLatex.CreatedByUserId = p.ThePlugg.CreatedByUserId;
                    p.TheLatex.ModifiedByUserId = p.ThePlugg.ModifiedByUserId;
                    LatexToMathMLConverter myConverter = new LatexToMathMLConverter(p.TheLatex.Text);
                    myConverter.Convert();
                    p.TheLatex.HtmlText = myConverter.HTMLOutput;
                    SaveLatexText(p.TheLatex);
                }

                LocaleController lc = new LocaleController();
                var locales = lc.GetLocales(PortalID);
                foreach (var locale in locales)
                {
                    if (locale.Key != p.ThePlugg.CreatedInCultureCode)
                    {
                        GoogleTranslate(p.TheTitle, locale.Key);
                        if (p.TheHtmlText != null)
                            GoogleTranslate(p.TheHtmlText, locale.Key);
                        if (p.TheLatex != null)
                            GoogleTranslate(p.TheLatex, locale.Key);
                    }
                }

                //Create PluggPage
                DNNHelper d = new DNNHelper();
                string pageUrl = p.ThePlugg.PluggId.ToString();
                string pageName = pageUrl + ": " + p.TheTitle.Text;
                TabInfo newTab = d.AddPluggPage(pageName, pageUrl);
                p.ThePlugg.TabId = newTab.TabID;
                rep.UpdatePlugg(p.ThePlugg);
            }
            catch (Exception)
            {
                //Todo: Update
                DeletePlugg(p.ThePlugg);
                throw;
            }
        }
Example #3
0
 private void SetValues(PluggContainer p)
 {
     lblTranslatedPluggeTitle.Text = p.TheTitle.Text;
     txtTranslatedPluggeTitle.Text = p.TheTitle.Text;
     btnCancelTranslatedPluggeTitle.Style.Add("display", "none");
     if (p.TheTitle.CcStatus == ECCStatus.HumanTranslated)
     {
         SetValueHumanTranslated();
     }
     else if (p.TheTitle.CcStatus == ECCStatus.GoogleTranslated)
     {
         SetValuesGoogleTranslated();
     }
 }
Example #4
0
        private PluggContainer GetPluggContainer(string curlan)
        {
            BaseHandler plugghandler = new BaseHandler();
            int pluggid = Convert.ToInt32(((DotNetNuke.Framework.CDefault)this.Page).Title);

            PluggContainer p = new PluggContainer();
            p.ThePlugg = plugghandler.GetPlugg(pluggid);
            p.CultureCode = curlan;
            p.LoadTitle();
            return p;
        }
Example #5
0
        public void SavePlugg(PluggContainer p)
        {
            try
            {
                bool isNew = p.ThePlugg.PluggId == 0;

                //Temporary - remove soon
                p.ThePlugg.Title            = "Title no longer here";
                p.ThePlugg.CreatedByUserId  = 1;
                p.ThePlugg.ModifiedByUserId = 1;

                if (isNew)
                {
                    rep.CreatePlugg(p.ThePlugg);
                }
                else
                {
                    rep.UpdatePlugg(p.ThePlugg);
                }

                //Todo: Update..
                p.TheTitle.ItemId           = p.ThePlugg.PluggId;
                p.TheTitle.ItemType         = ETextItemType.PluggTitle;
                p.TheTitle.CcStatus         = ECCStatus.InCreationLanguage;
                p.TheTitle.CreatedByUserId  = p.ThePlugg.CreatedByUserId;
                p.TheTitle.ModifiedByUserId = p.ThePlugg.ModifiedByUserId;
                SavePhText(p.TheTitle);

                //Todo: Update..
                if (p.TheHtmlText != null)
                {
                    p.TheHtmlText.ItemId           = p.ThePlugg.PluggId;
                    p.TheHtmlText.ItemType         = ETextItemType.PluggHtml;
                    p.TheHtmlText.CcStatus         = ECCStatus.InCreationLanguage;
                    p.TheHtmlText.CreatedByUserId  = p.ThePlugg.CreatedByUserId;
                    p.TheHtmlText.ModifiedByUserId = p.ThePlugg.ModifiedByUserId;
                    SavePhText(p.TheHtmlText);
                }

                //Todo: Update..
                if (p.TheLatex != null)
                {
                    p.TheLatex.ItemId           = p.ThePlugg.PluggId;
                    p.TheLatex.ItemType         = ELatexType.Plugg;
                    p.TheLatex.CcStatus         = ECCStatus.InCreationLanguage;
                    p.TheLatex.CreatedByUserId  = p.ThePlugg.CreatedByUserId;
                    p.TheLatex.ModifiedByUserId = p.ThePlugg.ModifiedByUserId;
                    LatexToMathMLConverter myConverter = new LatexToMathMLConverter(p.TheLatex.Text);
                    myConverter.Convert();
                    p.TheLatex.HtmlText = myConverter.HTMLOutput;
                    SaveLatexText(p.TheLatex);
                }

                LocaleController lc = new LocaleController();
                var locales         = lc.GetLocales(PortalID);
                foreach (var locale in locales)
                {
                    if (locale.Key != p.ThePlugg.CreatedInCultureCode)
                    {
                        GoogleTranslate(p.TheTitle, locale.Key);
                        if (p.TheHtmlText != null)
                        {
                            GoogleTranslate(p.TheHtmlText, locale.Key);
                        }
                        if (p.TheLatex != null)
                        {
                            GoogleTranslate(p.TheLatex, locale.Key);
                        }
                    }
                }

                //Create PluggPage
                DNNHelper d        = new DNNHelper();
                string    pageUrl  = p.ThePlugg.PluggId.ToString();
                string    pageName = pageUrl + ": " + p.TheTitle.Text;
                TabInfo   newTab   = d.AddPluggPage(pageName, pageUrl);
                p.ThePlugg.TabId = newTab.TabID;
                rep.UpdatePlugg(p.ThePlugg);
            }
            catch (Exception)
            {
                //Todo: Update
                DeletePlugg(p.ThePlugg);
                throw;
            }
        }