Beispiel #1
0
        public static string GetIframeString(int YouTubeId, string _PageCultureCode)
        {
            BaseHandler bh = new BaseHandler();

            Plugghest.Base2.YouTube yt = bh.GetYouTubeByComponentId(YouTubeId);
            return(yt != null?yt.GetIframeString(_PageCultureCode) : "(currently no video)");
        }
        protected void btnYtSave_Click(object sender, EventArgs e)
        {
            //string curlan = (Page as DotNetNuke.Framework.PageBase).PageCulture.Name;
            //int pluggid = Convert.ToInt32(((DotNetNuke.Framework.CDefault)this.Page).Title);
            //PluggContainer p = new PluggContainer(curlan, pluggid);

            //List<PluggComponent> comps = p.GetComponentList();

            //BaseHandler bh = new BaseHandler();

            //List<object> objToadd = new List<object>();
            BaseHandler bh = new BaseHandler();
            YouTube yt = bh.GetYouTubeByComponentId(YouTubeId);
            if (yt == null)
                yt = new YouTube();
            try
            {
                yt.YouTubeTitle = yttitle.Value;
                yt.YouTubeDuration = Convert.ToInt32(ytduration.Value);
                yt.YouTubeCode = ytYouTubeCode.Value;
                yt.YouTubeAuthor = ytAuthor.Value;
                yt.YouTubeCreatedOn = Convert.ToDateTime(ytYouTubeCreatedOn.Value);
                yt.YouTubeComment = ytYouTubeComment.Value;
                yt.PluggComponentId = YouTubeId;
            }
            catch
            {

            }

            bh.SaveYouTube(yt);
        }
Beispiel #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            List <PluggComponent> comps = this.PluggContainer.GetComponentList();

            BaseHandler   bh       = new BaseHandler();
            List <object> objToadd = new List <object>();

            Plugghest.Base2.YouTube yt = bh.GetYouTubeByComponentId(this.ComponentID);
            if (yt == null)
            {
                yt = new Plugghest.Base2.YouTube();
            }
            try
            {
                yt.YouTubeTitle     = yttitle.Value;
                yt.YouTubeDuration  = Convert.ToInt32(ytduration.Value);
                yt.YouTubeCode      = ytYouTubeCode.Value;
                yt.YouTubeAuthor    = ytAuthor.Value;
                yt.YouTubeCreatedOn = Convert.ToDateTime(ytYouTubeCreatedOn.Value);
                yt.YouTubeComment   = ytYouTubeComment.Value;
                yt.PluggComponentId = this.ComponentID;
            }
            catch
            {
            }

            bh.SaveYouTube(yt);

            Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabID, "", new string[] { "edit=1", "language=" + this.CurrentLanguage }));
        }
Beispiel #4
0
 public void CreateYouTube(YouTube p)
 {
     using (IDataContext ctx = DataContext.Instance())
     {
         var rep = ctx.GetRepository <YouTube>();
         rep.Insert(p);
     }
 }
Beispiel #5
0
 public void DeleteYouTube(YouTube p)
 {
     using (IDataContext db = DataContext.Instance())
     {
         var rep = db.GetRepository <YouTube>();
         rep.Delete(p);
     }
 }
 public void CreateYouTube(YouTube p)
 {
     using (IDataContext ctx = DataContext.Instance())
     {
         var rep = ctx.GetRepository<YouTube>();
         rep.Insert(p);
     }
 }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     BaseHandler bh = new BaseHandler();
     YouTube yt = bh.GetYouTubeByComponentId(PluggComponentId);
     if (yt == null)
         yt = new YouTube();
     yt.YouTubeTitle = yttitle.Value;
     yt.YouTubeDuration = Convert.ToInt32(ytduration.Value);
     yt.YouTubeCode = ytYouTubeCode.Value;
     yt.YouTubeAuthor = ytAuthor.Value;
     yt.YouTubeCreatedOn = Convert.ToDateTime(ytYouTubeCreatedOn.Value);
     yt.YouTubeComment = ytYouTubeComment.Value;
     yt.PluggComponentId = PluggComponentId;
     bh.SaveYouTube(yt);
     Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", "edit=0", AttachQS));
 }
 public void SaveYouTube(YouTube y)
 {
     if (y == null || y.YouTubeCode == null || y.YouTubeCode == "")
     {
         return;  //Nothing to save
     }
     if (y.YouTubeId == 0)
     {
         y.CreatedOn = DateTime.Now;
         rep.CreateYouTube(y);
     }
     else
     {
         rep.UpdateYouTube(y);
     }
 }
Beispiel #9
0
        public YouTube GetYouTubeByComponentId(int componentId)
        {
            IEnumerable <YouTube> yt;
            YouTube theYt = null;

            using (IDataContext ctx = DataContext.Instance())
            {
                var rep = ctx.GetRepository <YouTube>();
                yt = rep.Find("WHERE PluggComponentId = @0", componentId);
            }

            if (yt.Any())
            {
                theYt = yt.First(); //Can only be at most one.
            }
            return(theYt);
        }
        protected void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtTitle.Text.Trim() == "")
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Err", "alert('Please enter title !')", true);
                    return;
                }
                BaseHandler    bh      = new BaseHandler();
                List <object>  cmpData = new List <object>();
                PluggContainer pc      = new PluggContainer(new Localization().CurrentCulture);
                //pc.ThePlugg.CreatedByUserId = this.UserId;
                //pc.ThePlugg.ModifiedByUserId = this.UserId;
                pc.ThePlugg.PluggId = 0;
                pc.SetTitle(txtTitle.Text);

                //pc.SetDescription(txtDescription.Text);

                PHText RichRichText = new PHText();
                RichRichText.ItemType = ETextItemType.PluggComponentRichRichText;
                cmpData.Add(RichRichText);

                Plugghest.Base2.YouTube objYouTube = new Plugghest.Base2.YouTube();
                cmpData.Add(objYouTube);

                bh.SavePlugg(pc, cmpData);

                txtTitle.Text = "";
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Success", "alert('New Plugg is created successfully')", true);
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Error", "alert('Error : " + ex.Message + "')", true);
            }
        }
Beispiel #11
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtTitle.Text.Trim() == "")
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Err", "alert('Please enter title !')", true);
                    return;
                }
                BaseHandler bh = new BaseHandler();
                List<object> cmpData = new List<object>();
                PluggContainer pc = new PluggContainer(new Localization().CurrentCulture);
                //pc.ThePlugg.CreatedByUserId = this.UserId;
                //pc.ThePlugg.ModifiedByUserId = this.UserId;
                pc.ThePlugg.PluggId = 0;
                pc.SetTitle(txtTitle.Text);

                //pc.SetDescription(txtDescription.Text);

                PHText RichRichText = new PHText();
                RichRichText.ItemType = ETextItemType.PluggComponentRichRichText;
                cmpData.Add(RichRichText);

                Plugghest.Base2.YouTube objYouTube = new Plugghest.Base2.YouTube();
                cmpData.Add(objYouTube);

                bh.SavePlugg(pc, cmpData);

                txtTitle.Text = "";
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Success", "alert('New Plugg is created successfully')", true);
            }
            catch (Exception ex)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Error", "alert('Error : " + ex.Message + "')", true);
            }
        }
Beispiel #12
0
        protected void btnSaveTitle_Click(object sender, EventArgs e)
        {
            BaseHandler bh = new BaseHandler();
            PluggContainer pc = new PluggContainer(new Localization().CurrentCulture);
            pc.ThePlugg.CreatedByUserId = this.UserId;
            pc.ThePlugg.ModifiedByUserId = this.UserId;
            pc.ThePlugg.PluggId = 0;
            pc.ThePlugg.WhoCanEdit = (EWhoCanEdit)Enum.Parse(typeof(EWhoCanEdit), rdEditPlug.SelectedValue);
            pc.SetTitle(txtTitle.Text);
            pc.SetDescription(txtDescription.Text);

            List<object> cmpData = new List<object>();

            foreach (string StrCmpData in hdcmpData.Value.Split(new string[] { "$#%#$%" }, StringSplitOptions.RemoveEmptyEntries))
            {
                string[] straCmpData = StrCmpData.Split(new string[] { "$$$&$$$" }, StringSplitOptions.RemoveEmptyEntries);

                switch (straCmpData[0])
                {
                    case "RichRichText":
                        PHText RichRichText = new PHText();
                        RichRichText.Text = straCmpData[1];
                        RichRichText.ItemType = ETextItemType.PluggComponentRichRichText;
                        cmpData.Add(RichRichText);
                        break;
                    case "RichText":
                        PHText RichText = new PHText();
                        RichText.Text = straCmpData[1];
                        RichText.ItemType = ETextItemType.PluggComponentRichText;
                        cmpData.Add(RichText);
                        break;
                    case "Label":
                        PHText Label = new PHText();
                        Label.Text = straCmpData[1];
                        Label.ItemType = ETextItemType.PluggComponentLabel;
                        cmpData.Add(Label);
                        break;
                    case "Latex":
                        PHLatex Latex = new PHLatex(straCmpData[1], new Localization().CurrentCulture,ELatexItemType.PluggComponentLatex);
                        cmpData.Add(Latex);
                        break;
                    case "YouTube":
                        Plugghest.Base2.YouTube objYouTube = new Plugghest.Base2.YouTube();
                        string[] strYoutubeval = straCmpData[1].Split(new string[] { "&&&$$&&&" }, StringSplitOptions.RemoveEmptyEntries);
                        objYouTube.YouTubeAuthor = strYoutubeval[3];
                        objYouTube.YouTubeCode = strYoutubeval[2];
                        objYouTube.YouTubeComment = strYoutubeval[5];
                        objYouTube.YouTubeCreatedOn = Convert.ToDateTime(strYoutubeval[4]);
                        objYouTube.YouTubeDuration = Convert.ToInt32(strYoutubeval[1]);
                        objYouTube.YouTubeTitle = strYoutubeval[0];
                        cmpData.Add(objYouTube);
                        break;
                }

            }
            bh.SavePlugg(pc, cmpData);
        }
 public void UpdateYouTube(YouTube p)
 {
     using (IDataContext db = DataContext.Instance())
     {
         var rep = db.GetRepository<YouTube>();
         rep.Update(p);
     }
 }
        public void SaveYouTube(YouTube y)
        {
            if (y == null || y.YouTubeCode == null || y.YouTubeCode == "")
                return;  //Nothing to save

            if (y.YouTubeId == 0)
            {
                y.CreatedOn = DateTime.Now;
                rep.CreateYouTube(y);
            }
            else
                rep.UpdateYouTube(y);
        }
Beispiel #15
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            List<PluggComponent> comps = this.PluggContainer.GetComponentList();

            BaseHandler bh = new BaseHandler();
            List<object> objToadd = new List<object>();
            Plugghest.Base2.YouTube yt = bh.GetYouTubeByComponentId(this.ComponentID);
            if (yt == null)
                yt = new Plugghest.Base2.YouTube();
            try
            {
                yt.YouTubeTitle = yttitle.Value;
                yt.YouTubeDuration = Convert.ToInt32(ytduration.Value);
                yt.YouTubeCode = ytYouTubeCode.Value;
                yt.YouTubeAuthor = ytAuthor.Value;
                yt.YouTubeCreatedOn = Convert.ToDateTime(ytYouTubeCreatedOn.Value);
                yt.YouTubeComment = ytYouTubeComment.Value;
                yt.PluggComponentId = this.ComponentID;
            }
            catch
            {

            }

            bh.SaveYouTube(yt);

            Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabID, "", new string[] { "edit=1", "language=" + this.CurrentLanguage }));
        }
Beispiel #16
0
        protected void btnYtSave_Click(object sender, EventArgs e)
        {
            var id = hdnlabel.Value;
            var itemid = Convert.ToInt32(id);

            List<PluggComponent> comps = p.GetComponentList();

            BaseHandler bh = new BaseHandler();

            List<object> objToadd = new List<object>();

            YouTube yt = bh.GetYouTubeByComponentId(Convert.ToInt32(id));
            if (yt == null)
                yt = new YouTube();
            try
            {
                yt.YouTubeTitle = yttitle.Value;
                yt.YouTubeDuration = Convert.ToInt32(ytduration.Value);
                yt.YouTubeCode = ytYouTubeCode.Value;
                yt.YouTubeAuthor = ytAuthor.Value;
                yt.YouTubeCreatedOn = Convert.ToDateTime(ytYouTubeCreatedOn.Value);
                yt.YouTubeComment = ytYouTubeComment.Value;
                yt.PluggComponentId = itemid;
            }
            catch
            {

            }

            bh.SaveYouTube(yt);

            Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", new string[] { "edit=1", "language=" + curlan }));
        }
Beispiel #17
0
 private void CreateBtnYTEdit(PluggComponent comp, YouTube yt, int ytorderid, string CssClass, string ID)
 {
     Button editbtn = new Button();
     editbtn.CssClass = CssClass;
     editbtn.ID = ID;
     editbtn.Text = BtnEditTxt;
     editbtn.Click += (s, e) => { YouTubeEdit(ytorderid, comp, yt); };
     divTitle.Controls.Add(editbtn);
 }
Beispiel #18
0
        private void YouTubeEdit(int ytorderid, PluggComponent comp, YouTube yt)
        {
            string ytcode = "";
            if (yt == null)
                ytcode = "";
            else
                ytcode = yt.YouTubeCode;
            hdnlabel.Value = Convert.ToString(comp.PluggComponentId);

            if (comp.ComponentType == EComponentType.YouTube)
            {

                pnlYoutube.Visible = true;
                pnlRRT.Visible = false;
                pnllabel.Visible = false;
                pnlletex.Visible = false;
                richtextbox.Visible = false;
                txtYouTube.Text = ytcode;
            }
            pnlPluggCom.Visible = false;
        }
        public void SavePlugg(PluggContainer p, List <object> cs)
        {
            if (p.ThePlugg.CreatedInCultureCode != null && p.CultureCode != p.ThePlugg.CreatedInCultureCode)
            {
                throw new Exception("Cannot use SavePlugg unless you are saving it in the creation language.");
            }

            p.ThePlugg.CreatedInCultureCode = p.CultureCode;

            try
            {
                bool isNew = p.ThePlugg.PluggId == 0;

                //Temporary - to avoid login - remove soon
                p.ThePlugg.CreatedByUserId  = 1;
                p.ThePlugg.ModifiedByUserId = 1;

                //Save Plugg entity
                p.ThePlugg.ModifiedOnDate = DateTime.Now;

                if (isNew)
                {
                    p.ThePlugg.CreatedOnDate = DateTime.Now;
                    rep.CreatePlugg(p.ThePlugg);
                }
                else
                {
                    rep.UpdatePlugg(p.ThePlugg);
                }

                //Save Title
                if (p.TheTitle == null || p.TheTitle.Text == null)
                {
                    throw new Exception("Cannot Save Plugg. TheTitle cannot be null");
                }

                if (p.TheTitle.TextId == 0)
                {
                    p.TheTitle.ItemId            = p.ThePlugg.PluggId;
                    p.TheTitle.ItemType          = ETextItemType.PluggTitle;
                    p.TheTitle.CultureCodeStatus = ECultureCodeStatus.InCreationLanguage;
                    p.TheTitle.CreatedByUserId   = p.ThePlugg.CreatedByUserId;
                    p.TheTitle.ModifiedByUserId  = p.ThePlugg.ModifiedByUserId;
                }
                SavePhTextInAllCc(p.TheTitle);  //Save or Update

                if (p.TheDescription != null && p.TheDescription.Text != null)
                {
                    if (p.TheDescription.TextId == 0)
                    {
                        p.TheDescription.ItemId            = p.ThePlugg.PluggId;
                        p.TheDescription.ItemType          = ETextItemType.PluggDescription;
                        p.TheDescription.CultureCodeStatus = ECultureCodeStatus.InCreationLanguage;
                        p.TheDescription.CreatedByUserId   = p.ThePlugg.CreatedByUserId;
                        p.TheDescription.ModifiedByUserId  = p.ThePlugg.ModifiedByUserId;
                    }
                    SavePhTextInAllCc(p.TheDescription);
                }

                int            cmpOrder = 1;
                PluggComponent pc       = new PluggComponent();
                pc.PluggId = p.ThePlugg.PluggId;
                foreach (object cmp in cs)
                {
                    pc.ComponentOrder = cmpOrder;
                    switch (cmp.GetType().Name)
                    {
                    case "PHText":
                        PHText theText = (PHText)cmp;
                        switch (theText.ItemType)
                        {
                        case ETextItemType.PluggComponentRichRichText:
                            pc.ComponentType = EComponentType.RichRichText;
                            break;

                        case ETextItemType.PluggComponentRichText:
                            pc.ComponentType = EComponentType.RichText;
                            break;

                        case ETextItemType.PluggComponentLabel:
                            pc.ComponentType = EComponentType.Label;
                            break;
                        }
                        rep.CreatePluggComponent(pc);
                        theText.ItemId          = pc.PluggComponentId;
                        theText.CultureCode     = p.ThePlugg.CreatedInCultureCode;
                        theText.CreatedByUserId = p.ThePlugg.CreatedByUserId;
                        SavePhTextInAllCc(theText);
                        break;

                    case "PHLatex":
                        PHLatex theLatex = (PHLatex)cmp;
                        pc.ComponentType = EComponentType.Latex;
                        rep.CreatePluggComponent(pc);
                        theLatex.ItemId          = pc.PluggComponentId;
                        theLatex.CultureCode     = p.ThePlugg.CreatedInCultureCode;
                        theLatex.CreatedByUserId = p.ThePlugg.CreatedByUserId;
                        SaveLatexTextInAllCc(theLatex);
                        break;

                    case "YouTube":
                        pc.ComponentType = EComponentType.YouTube;
                        rep.CreatePluggComponent(pc);
                        YouTube theVideo = (YouTube)cmp;
                        theVideo.CreatedByUserId  = p.ThePlugg.CreatedByUserId;
                        theVideo.PluggComponentId = pc.PluggComponentId;
                        SaveYouTube(theVideo);
                        break;
                    }
                    cmpOrder++;
                }

                //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;
            }
        }