Ejemplo n.º 1
0
        public DynamicRotator()
        {
            Settings = new RotatorSettings();

            Settings.Width = new Unit(950, UnitType.Pixel);
            Settings.Height = new Unit(250, UnitType.Pixel);
        }
Ejemplo n.º 2
0
        protected void Page_Init(object sender, EventArgs e)
        {
            Control ctrlAct = LoadControl(TemplateSourceDirectory.TrimEnd('/') + "/RegCore/QuickStatusAndLink.ascx");
            (ctrlAct as IRegCoreComponent).InitRegCore(true, RotatorSettings.RegCoreServer, RotatorSettings.ProductName, RotatorSettings.ProductCode, RotatorSettings.ProductKey, RotatorSettings.Version, TemplateSourceDirectory.TrimEnd('/') + "/RegCore/", typeof(RotatorSettings));
            this.Controls.Add(ctrlAct);

            string connStr = "";
            string dbOwner = "";
            string objQualifier = "";
            string allowRole = "";
            string allowIp = "";
            string allowInvokeType = "";

            string controlId = Request.QueryString["controlId"];
            string sessionKey = "avt.DynamicRotator." + controlId;
            if (HttpContext.Current.Session[sessionKey] != null) {

                Dictionary<string, string> settings = Session[sessionKey] as Dictionary<string, string>;

                connStr = settings["DbConnectionString"];
                dbOwner = settings["DbOwner"];
                objQualifier = settings["DbObjectQualifier"];
                allowRole = settings["SecurityAllowAspRole"];
                allowIp = settings["SecurityAllowIps"];
                allowInvokeType = settings["SecurityAllowInvokeType"];

            }

            if (string.IsNullOrEmpty(connStr)) {
                Response.Redirect(Server.UrlDecode(Request.QueryString["rurl"]));
                return;
            }

            ctlManageRotator.Configuration = new AspNetConfiguration(connStr, dbOwner, objQualifier, allowRole, allowIp, allowInvokeType);
            RotatorSettings.Init(ctlManageRotator.Configuration);
            ctlManageRotator.ReturnUrl = Server.UrlDecode(Request.QueryString["rurl"]);
            ctlManageRotator.BuyUrl = RotatorSettings.BuyLink + "&aspnet=true";
            ctlManageRotator.ControllerType = typeof(RotatorSettings);

            RotatorSettings rotSettings = new RotatorSettings();
            if (!rotSettings.IsActivated() || rotSettings.IsTrialExpired()) {
                ctlManageRotator.Visible = false;
            }
        }
        protected void ExportData(object sender, EventArgs e)
        {
            RotatorSettings rotatorSettings = new RotatorSettings();
            rotatorSettings.LoadFromDB(Request.QueryString["controlId"]);

            StringBuilder strXML = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            settings.OmitXmlDeclaration = true;
            XmlWriter Writer = XmlWriter.Create(strXML, settings);

            rotatorSettings.SaveToPortableXml(Writer, Request.QueryString["controlId"]);
            Writer.Close();

            tbExportData.Text = strXML.ToString();
            tbExportData.Visible = true;

            _ActiveTab = 2;
        }
Ejemplo n.º 4
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            RotatorSettings rotatorSettings = new RotatorSettings();
            rotatorSettings.Hosts = new System.Collections.Generic.List<System.Web.UI.WebControls.ListItem>();

            PortalAliasController paCtrl = new PortalAliasController();
            foreach (DictionaryEntry de in paCtrl.GetPortalAliases()) {
                PortalAliasInfo paInfo = (PortalAliasInfo)de.Value;
                rotatorSettings.Hosts.Add(new ListItem(paInfo.HTTPAlias, paInfo.HTTPAlias));
            }

            Control ctrlAct = LoadControl(TemplateSourceDirectory.TrimEnd('/') + "/RegCore/QuickStatusAndLink.ascx");
            (ctrlAct as IRegCoreComponent).InitRegCore(IsAdmin, RotatorSettings.RegCoreServer, RotatorSettings.ProductName, RotatorSettings.ProductCode, RotatorSettings.ProductKey, RotatorSettings.Version, TemplateSourceDirectory.TrimEnd('/') + "/RegCore/", typeof(DynamicRotatorController));
            this.pnlAdmin.Controls.Add(ctrlAct);

            if (!rotatorSettings.IsActivated() || rotatorSettings.IsTrialExpired()) {
                DynamicRotator.Visible = false;
            }
        }
Ejemplo n.º 5
0
 void CheckUpdate()
 {
     RotatorSettings settings = new RotatorSettings();
     if (settings.LoadFromDB(Request.Params["controlId"])) {
         Response.Write("{\"lastUpdate\":" + TotalMiliseconds(settings.LastUpdate) + "}");
     } else {
         Response.Write("{\"lastUpdate\":-1}");
     }
 }
        void SaveSettings()
        {
            RotatorSettings settings = new RotatorSettings();
            settings.LoadFromDB(Request.QueryString["controlId"]);

            DataProvider.Instance().Init(Configuration);

            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "Width", tbWidth.Text);
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "Height", tbHeight.Text);
            //DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "RenderEngine", ddRenderEngine.SelectedValue);
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "FallbackImage", tbFallBackImage.Text);
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "AutoStartSlideShow", cbAutoStartSlideShow.Checked ? "true" : "false");
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "ShowBottomButtons", cbShowBottomButtons.Checked ? "true" : "false");
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "ShowPlayPauseControls", cbShowPlayPauseControls.Checked ? "true" : "false");
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "BackgroundColor", tbBackgroundColor.Text);
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "ShowTopTitle", cbShowTopTitle.Checked ? "true" : "false");
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "TopTitleBackground", tbTopTitleBackground.Text);
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "TopTitleBgTransparency", tbTopTitleBgTransparency.Text);
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "TopTitleTextColor", tbTopTitleTextColor.Text);
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "ShowTimerBar", cbShowTimerBar.Checked ? "true" : "false");
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "RandomOrder", cbRandomOrder.Checked ? "true" : "false");
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "SlideButtonsColor", tbSlideButtonsColor.Text);
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "SlideButtonsNumberColor", tbSlideButtonsNumberColor.Text);
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "SlideButtonsType", ddSlideButtonsType.SelectedValue);
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "SlideButtonsXoffset", tbSlideButtonsXoffset.Text);
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "SlideButtonsYoffset", tbSlideButtonsYoffset.Text);
            //DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "TransparentBackground", cbTransparentBackground.Checked ? "true" : "false");
            DataProvider.Instance().UpdateSetting(Request.QueryString["controlId"], "LastUpdate", DateTime.Now.ToString(new CultureInfo("en-US").DateTimeFormat));

            // save slides

            List<int> existingSlides = new List<int>();
            foreach (SlideInfo slide in settings.Slides) {
                existingSlides.Add(slide.Id);
            }

            List<int> existingSlideObjects = new List<int>();

            XmlDocument xmlDocSlides = null;
            //try {
            xmlDocSlides = new XmlDocument();
            xmlDocSlides.LoadXml(Server.HtmlDecode(hdnSlideXml.Value));
            //} catch { xmlDocSlides = null; }

            if (xmlDocSlides != null) {
                foreach (XmlElement xmlSlide in xmlDocSlides.DocumentElement.SelectNodes("slide")) {

                    int slideId = Convert.ToInt32(xmlSlide["id"].InnerText);
                    if (slideId > 0) {
                        existingSlides.Remove(slideId);
                    }

                    SlideInfo slide;
                    if (slideId > 0) {
                        slide = SlideInfo.Get(slideId);
                    } else {
                        slide = new SlideInfo();
                    }

                    slide.ControlId = Request.QueryString["controlId"];
                    slide.Title = xmlSlide["title"].InnerText;
                    slide.DurationSeconds = Convert.ToInt32(xmlSlide["duration"].InnerText);
                    slide.Effect = xmlSlide["effect"].InnerText;
                    try { slide.BackgroundGradientFrom = Color.FromArgb(Convert.ToInt32(xmlSlide["bkGradFrom"].InnerText.Replace("#", "0x"), 16)); } catch { slide.BackgroundGradientFrom = Color.Transparent; }
                    try { slide.BackgroundGradientTo = Color.FromArgb(Convert.ToInt32(xmlSlide["bkGradTo"].InnerText.Replace("#", "0x"), 16)); } catch { slide.BackgroundGradientFrom = Color.Transparent; }
                    slide.SlideUrl = xmlSlide["linkUrl"].InnerText;
                    slide.ButtonCaption = xmlSlide["linkCaption"].InnerText;
                    slide.BtnTextColor = Color.FromArgb(Convert.ToInt32(xmlSlide["btnTextColor"].InnerText.Replace("#", "0x"), 16));
                    slide.BtnBackColor = Color.FromArgb(Convert.ToInt32(xmlSlide["btnBackColor"].InnerText.Replace("#", "0x"), 16));

                    slide.Target = xmlSlide["linkTarget"].InnerText;
                    //slide.UseTextsBackground = xmlSlide["useTextsBk"].InnerText == "true";
                    slide.UseTextsBackground = true;
                    slide.ClickAnywhere = xmlSlide["linkClickAnywhere"].InnerText == "true";

                    //slide.Mp3Url = xmlSlide["mp3Url"].InnerText;
                    //slide.ShowPlayer = xmlSlide["mp3ShowPlayer"].InnerText == "true";
                    //slide.IconColor = Color.FromArgb(Convert.ToInt32(xmlSlide["mp3IconColor"].InnerText.Replace("#", "0x"), 16));

                    slide.ViewOrder = Convert.ToInt32(xmlSlide["viewOrder"].InnerText);

                    slide.Save();

                    // save slide objects
                    foreach (SlideObjectInfo slideObj in slide.SlideObjects) {
                        existingSlideObjects.Add(slideObj.Id);
                    }

                    if (xmlSlide["slideObjects"] != null) {
                        int viewOrder = 0;
                        foreach (XmlElement xmlSlideObj in xmlSlide["slideObjects"].SelectNodes("obj")) {
                            int slideObjId = Convert.ToInt32(xmlSlideObj["id"].InnerText);
                            if (slideObjId > 0) {
                                existingSlideObjects.Remove(slideObjId);
                            }

                            SlideObjectInfo slideObj = new SlideObjectInfo();
                            if (slideObjId > 0) {
                                slideObj.Id = slideObjId;
                            }

                            slideObj.SlideId = slide.Id;
                            slideObj.Name = xmlSlideObj["name"].InnerText;
                            slideObj.Link = xmlSlideObj["linkUrl"].InnerText;
                            slideObj.Text = xmlSlideObj["htmlContents"].InnerText;
                            slideObj.ObjectType = (eObjectType)Enum.Parse(typeof(eObjectType), xmlSlideObj["itemType"].InnerText, true);
                            try { slideObj.ObjectUrl = xmlSlideObj["resUrl"].InnerText; } catch { }
                            try { slideObj.TimeDelay = Convert.ToInt32(xmlSlideObj["delay"].InnerText); } catch { }
                            try { slideObj.TransitionDuration = Convert.ToInt32(xmlSlideObj["duration"].InnerText); } catch { }
                            try { slideObj.Opacity = Convert.ToInt32(xmlSlideObj["opacity"].InnerText); } catch { }
                            try { slideObj.Xposition = Convert.ToInt32(xmlSlideObj["posx"].InnerText); } catch { }
                            try { slideObj.Yposition = Convert.ToInt32(xmlSlideObj["posy"].InnerText); } catch { }
                            try { slideObj.Width = Convert.ToInt32(xmlSlideObj["width"].InnerText); } catch { }
                            try { slideObj.VerticalAlign = (eVerticalAlign)Enum.Parse(typeof(eVerticalAlign), xmlSlideObj["valign"].InnerText, true); } catch { }

                            try { slideObj.GlowSize = Convert.ToInt32(xmlSlideObj["glowSize"].InnerText); } catch { }
                            try { slideObj.GlowStrength = Convert.ToInt32(xmlSlideObj["glowStrength"].InnerText); } catch { }
                            try { slideObj.GlowColor = Color.FromArgb(Convert.ToInt32(xmlSlideObj["glowColor"].InnerText.Replace("#", "0x"), 16)); } catch { }

                            try { slideObj.TextColor = Color.FromArgb(Convert.ToInt32(xmlSlideObj["textColor"].InnerText.Replace("#", "0x"), 16)); } catch { }
                            try { slideObj.TextBackgroundColor = Color.FromArgb(Convert.ToInt32(xmlSlideObj["textBackgroundColor"].InnerText.Replace("#", "0x"), 16)); } catch { }
                            try { slideObj.TextBackgroundOpacity = Convert.ToInt32(xmlSlideObj["textBackgroundOpacity"].InnerText); } catch { }
                            try { slideObj.TextBackgroundPadding = Convert.ToInt32(xmlSlideObj["textBackgroundPadding"].InnerText); } catch { }

                            try { slideObj.AppearMode = (eAppearMode)Enum.Parse(typeof(eAppearMode), xmlSlideObj["appearMode"].InnerText, true); } catch { }
                            try { slideObj.SlideFrom = (eAllDirs)Enum.Parse(typeof(eAllDirs), xmlSlideObj["slideFrom"].InnerText, true); } catch { }
                            try { slideObj.SlideMoveType = (eMoveType)Enum.Parse(typeof(eMoveType), xmlSlideObj["slideMoveType"].InnerText, true); } catch { }
                            try { slideObj.SlideEasingType = (eEasing)Enum.Parse(typeof(eEasing), xmlSlideObj["slideEasingType"].InnerText, true); } catch { }
                            try { slideObj.EffectAfterSlide = (eEffect)Enum.Parse(typeof(eEffect), xmlSlideObj["effectAfterSlide"].InnerText, true); } catch { }

                            slideObj.ViewOrder = viewOrder++;
                            slideObj.Save();
                        }
                    }
                }
            }

            // delete the rest of slide objects
            foreach (int slideObjectId in existingSlideObjects) {
                DataProvider.Instance().RemoveSlideObject(slideObjectId);
            }

            // delete the rest of slides
            foreach (int slideId in existingSlides) {
                DataProvider.Instance().RemoveSlide(slideId);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // check settings
            if (Configuration == null || string.IsNullOrEmpty(Configuration.ConnStr)) {
                Response.Redirect("~/");
            }

            if (!Configuration.HasAccess(Request.QueryString["controlId"])) {
                if (!string.IsNullOrEmpty(Request.QueryString["rurl"])) {
                    Response.Redirect(HttpUtility.UrlDecode(Request.QueryString["rurl"]));
                } else {
                    Response.Redirect("~/");
                }
                return;
            }

            if (!Page.IsPostBack) {

                RotatorSettings settings = new RotatorSettings();

                // check activation
                lblTabActivateContents.Visible = lblTabActivate.Visible = !settings.IsActivated() || settings.IsTrial();

                ddSlideButtonsType.Items.Add(new ListItem("Square (with numbers)", eSlideButtonsType.SquareWithNumbers.ToString()));
                ddSlideButtonsType.Items.Add(new ListItem("Round (no numbers)", eSlideButtonsType.RoundNoNumbers.ToString()));

                // load enums for slides
                ddLinkTarget.Items.Add(new ListItem("Same Window", eLinkTarget._self.ToString()));
                ddLinkTarget.Items.Add(new ListItem("New Window", eLinkTarget._blank.ToString()));
                ddLinkTarget.Items.Add(new ListItem("Parent Window", eLinkTarget._parent.ToString()));
                ddLinkTarget.Items.Add(new ListItem("Named Window...", "other"));
                try { ddLinkTarget.SelectedValue = DefaultSlide.Target.ToString(); } catch { }

                ddAppearMode.DataSource = Enum.GetNames(typeof(eAppearMode));
                ddAppearMode.DataBind();

                // load enums for objects

                ddVerticalAlgin.DataSource = Enum.GetNames(typeof(eVerticalAlign));
                ddVerticalAlgin.DataBind();

                ddObjAppearFromText.DataSource = Enum.GetNames(typeof(eHorizontadDirs));
                ddObjAppearFromText.DataBind();

                ddObjAppearFromImage.DataSource = Enum.GetNames(typeof(eAllDirs));
                ddObjAppearFromImage.DataBind();

                ddObjMoveType.DataSource = Enum.GetNames(typeof(eMoveType));
                ddObjMoveType.DataBind();

                ddObjEasingType.DataSource = Enum.GetNames(typeof(eEasing));
                ddObjEasingType.DataBind();

                ddObjEffect.DataSource = Enum.GetNames(typeof(eEffect));
                ddObjEffect.DataBind();

                //ddRenderEngine.DataSource = Enum.GetNames(typeof(eRenderEngine));
                //ddRenderEngine.DataBind();

                // load settings
                settings.LoadFromDB(Request.QueryString["controlId"]);

                lblControlName.Text = Configuration.FormatTitle(Request.QueryString["controlId"]);
                tbWidth.Text = settings.Width.Value.ToString();
                tbHeight.Text = settings.Height.Value.ToString();
                //ddRenderEngine.SelectedValue = settings.RenderEngine.ToString();
                tbFallBackImage.Text = settings.FallbackImage;
                cbAutoStartSlideShow.Checked = settings.AutoStartSlideShow;
                cbShowBottomButtons.Checked = settings.ShowBottomButtons;
                cbShowPlayPauseControls.Checked = settings.ShowPlayPauseControls;
                tbBackgroundColor.Text = ColorExt.ColorToHexString(settings.BackgroundColor);
                cbShowTopTitle.Checked = settings.ShowTopTitle;
                tbTopTitleBackground.Text = ColorExt.ColorToHexString(settings.TopTitleBackground);
                tbTopTitleBgTransparency.Text = settings.TopTitleBgTransparency.ToString();
                tbTopTitleTextColor.Text = ColorExt.ColorToHexString(settings.TopTitleTextColor);
                cbShowTimerBar.Checked = settings.ShowTimerBar;
                cbRandomOrder.Checked = settings.RandomOrder;
                tbSlideButtonsColor.Text = ColorExt.ColorToHexString(settings.SlideButtonsColor);
                tbSlideButtonsNumberColor.Text = ColorExt.ColorToHexString(settings.SlideButtonsNumberColor);
                try { ddSlideButtonsType.SelectedValue = settings.SlideButtonsType.ToString(); } catch { }
                tbSlideButtonsXoffset.Text = settings.SlideButtonsXoffset.ToString();
                tbSlideButtonsYoffset.Text = settings.SlideButtonsYoffset.ToString();
                //cbTransparentBackground.Checked = settings.TransparentBackground;

                hdnLastUpdate.Value = TotalMiliseconds(settings.LastUpdate).ToString();

                // load slides
                hdnSlideXml.Value = settings.SlidesToDesignerJson();
            } else {
                HandleUploads();
            }
        }
        public SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo)
        {
            RotatorSettings.Init(new DnnConfiguration());
            RotatorSettings settings = new RotatorSettings();
            settings.LoadFromDB(ModInfo.ModuleID.ToString());

            var SearchItemCollection = new SearchItemInfoCollection();

            foreach (SlideInfo slide in settings.Slides)
                SearchItemCollection.Add(IndexSlide(ModInfo, slide));

            return SearchItemCollection;
        }
        public string ExportModule(int ModuleID)
        {
            StringBuilder strXML = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            settings.OmitXmlDeclaration = true;
            XmlWriter Writer = XmlWriter.Create(strXML, settings);

            RotatorSettings.Init(new DnnConfiguration());
            RotatorSettings Settings = new RotatorSettings();
            Settings.LoadFromDB(ModuleID.ToString());

            Settings.SaveToPortableXml(Writer, ModuleID.ToString());

            Writer.Close();

            return strXML.ToString();
        }