protected void BtnRemove_Click(object sender, EventArgs e)
 {
     BaseHandler plugghandler = new BaseHandler();
     plugghandler.DeleteComponent(this.PluggContainer, this.Order);
     Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this.TabID, "", new string[] { "edit=1", "language=" + this.CurrentLanguage }));
 }
Example #2
0
        protected void btnTest_Click(object sender, EventArgs e)
        {
            BaseHandler bh = new BaseHandler();
            PluggContainer p = new PluggContainer("en-US", 31);
            PluggComponent pc = new PluggComponent();
            pc.ComponentType = EComponentType.YouTube;
            pc.ComponentOrder = 3;
            //bh.AddComponent(p, pc);
            bh.DeleteComponent(p, 3);
            //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;
            //    }
            //}
        }
Example #3
0
 private void callingDelPlugg(int orderid)
 {
     BaseHandler plugghandler = new BaseHandler();
     plugghandler.DeleteComponent(p, orderid);
     Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", new string[] { "edit=1", "language=" + curlan }));
 }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                PluggId = Convert.ToInt32(((DotNetNuke.Framework.CDefault)this.Page).Title);
                CultureCode = (Page as DotNetNuke.Framework.PageBase).PageCulture.Name;
                BaseHandler bh = new BaseHandler();
                pc = new PluggContainer(CultureCode, PluggId);
                if (pc.ThePlugg.IsDeleted)
                    Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(Convert.ToInt32(Localization.GetString("TabPluggDeleted.Text", LocalResourceFile))));
                InCreationLanguage = (pc.ThePlugg.CreatedInCultureCode == CultureCode);
                IsAuthorized = ((this.UserId != -1 && pc.ThePlugg.WhoCanEdit == EWhoCanEdit.Anyone) || pc.ThePlugg.CreatedByUserId == this.UserId || (UserInfo.IsInRole("Administator")));
                Edit = !string.IsNullOrEmpty(Page.Request.QueryString["edit"]) ? Convert.ToInt16(Page.Request.QueryString["edit"]) : -1;
                Translate = !string.IsNullOrEmpty(Page.Request.QueryString["translate"]) ? Convert.ToInt16(Page.Request.QueryString["translate"]) : -1;
                Remove = !string.IsNullOrEmpty(Page.Request.QueryString["remove"]) ? Convert.ToInt16(Page.Request.QueryString["remove"]) : -1;
                DisplayInfo = !string.IsNullOrEmpty(Page.Request.QueryString["info"]) ? Convert.ToInt16(Page.Request.QueryString["info"]) : -1;

                #region hide/display controls
                hlDisplayInfo.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "info=0");
                if(DisplayInfo == 0)
                {
                    pnlDisplayInfo.Visible = false;
                    pnlHideDisplayInfo.Visible = true;
                    hlHideDisplayInfo.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "");
                }

                if (Remove > 0 && IsAuthorized)
                {
                    bh.DeleteComponent(pc, Remove);
                    Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "", "edit=0"));
                }

                if (!InCreationLanguage && UserId > -1 && Translate == -1)
                {
                    pnlToCreationLanguage.Visible = true;
                    hlToCreationLanguage.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "language=" + pc.ThePlugg.CreatedInCultureCode);
                    pnlTranslatePlugg.Visible = true;
                    hlTranslatePlugg.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "translate=0");
                }

                if (InCreationLanguage && UserId > -1 && Edit == -1)
                {
                    pnlEditPlugg.Visible = true;
                    hlEditPlugg.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "edit=0");
                }

                if (!InCreationLanguage && UserId > -1 && Translate > -1)
                {
                    pnlExitTranslateMode.Visible = true;
                    hlExitTranslateMode.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "");
                }

                if (InCreationLanguage && UserId > -1 && Edit > -1)
                {
                    pnlExitEditMode.Visible = true;
                    hlExitEditMode.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "");
                }
                #endregion

                pc.LoadComponents();
                phComponents.Controls.Clear();
                int controlOrder = 1;
                bool editOrTranslateMode = (Edit > -1 || Translate > -1) && UserId > -1;

                if (DisplayInfo == 0)
                {
                    DisplayPluggInfo ucDPI = (DisplayPluggInfo)this.LoadControl("/DesktopModules/DisplayPlugg/DisplayPluggInfo.ascx");
                    if (ucDPI != null)
                    {
                        ucDPI.LocalResourceFile = "/DesktopModules/DisplayPlugg/App_LocalResources/DisplayPluggInfo.ascx";
                        phComponents.Controls.Add(ucDPI);
                    }
                }

                if (editOrTranslateMode)
                {
                    string ComponentHead = "<hr /><h3>" + Localization.GetString("Subject", LocalResourceFile) + "</h3>";
                    phComponents.Controls.Add(new LiteralControl(ComponentHead));
                }
                LoadSubject(controlOrder);
                controlOrder++;

                if (editOrTranslateMode)
                {
                    string ComponentHead = "<hr /><h3>" + Localization.GetString("Title", LocalResourceFile) + "</h3>";
                    phComponents.Controls.Add(new LiteralControl(ComponentHead));
                    EditTitleAndDescription(controlOrder, ETextItemType.PluggTitle);
                    controlOrder++;

                    ComponentHead = "<hr /><h3>" + Localization.GetString("Description", LocalResourceFile) + "</h3>";
                    phComponents.Controls.Add(new LiteralControl(ComponentHead));
                    EditTitleAndDescription(controlOrder, ETextItemType.PluggDescription);
                    controlOrder++;
                }

                #region AddComponents
                int componentOrder = 1;
                foreach (PluggComponent c in pc.TheComponents)
                {
                    if (Edit == 0 && IsAuthorized)
                        Add_AddNewComponentControl(componentOrder);
                    if (editOrTranslateMode)
                    {
                        string ComponentHead = "<hr /><h3>" + Localization.GetString("Component", LocalResourceFile) + " " + c.ComponentOrder + ":  " + c.ComponentType + "</h3>";
                        phComponents.Controls.Add(new LiteralControl(ComponentHead));
                    }
                    switch (c.ComponentType)
                    {
                        case EComponentType.YouTube:
                            LoadYouTube(c, controlOrder);
                            break;
                        case EComponentType.Label:
                            LoadLabel(c, controlOrder);
                            break;
                        case EComponentType.RichRichText:
                            LoadRichRich(c, controlOrder);
                            break;
                        case EComponentType.RichText:
                            LoadRich(c, controlOrder);
                            break;
                        case EComponentType.Latex:
                            LoadLatex(c, controlOrder);
                            break;
                        default:
                            break;
                    }
                    HyperLink hl = new HyperLink();
                    if (Edit == 0 && IsAuthorized)
                    {
                        hl.Text = "Remove Component";
                        hl.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "remove=" + componentOrder);
                        phComponents.Controls.Add(hl);
                    }
                    controlOrder++;
                    componentOrder++;
                }
                if (Edit == 0 && IsAuthorized)
                    Add_AddNewComponentControl(componentOrder);
                if (editOrTranslateMode)
                    phComponents.Controls.Add(new LiteralControl("<hr />"));

                #endregion
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }