Example #1
0
        public void Insert(int ModuleId, short Height, short Width, short ImageDisplayTime, short ImageDisplayOrder, bool ImageLooping, short ImageFadeTime, int ImageXPosition, int ImageYPosition, string FlashFileName, int NavType, int WrapType, string SlideShowClassName)
        {
            SlideShowModule item = new SlideShowModule();

            item.ModuleId = ModuleId;

            item.Height = Height;

            item.Width = Width;

            item.ImageDisplayTime = ImageDisplayTime;

            item.ImageDisplayOrder = ImageDisplayOrder;

            item.ImageLooping = ImageLooping;

            item.ImageFadeTime = ImageFadeTime;

            item.ImageXPosition = ImageXPosition;

            item.ImageYPosition = ImageYPosition;

            item.FlashFileName = FlashFileName;

            item.NavType = NavType;

            item.WrapType = WrapType;

            item.SlideShowClassName = SlideShowClassName;


            item.Save(UserName);
        }
Example #2
0
        /// <summary>
        /// Checks that the custom module data exists. If the custom module
        /// object cannot be retrieved (e.g., this is the initial creation of
        /// the module), then a new module object is created using the module
        /// id assigned by the CMS.
        /// </summary>
        private void EnsureModule()
        {
            //model.SlideShow_Module module = model.SlideShow_Module.Get(this.ModuleId);
            SlideShowModule module = SlideShowModule.GetByModuleId(this.ModuleId);

            if (null == module)
            {
                module          = new SlideShowModule();
                module.ModuleId = this.ModuleId;
                module.Save();
            }
        }
Example #3
0
        protected void SlideShow_Module_SaveButton_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid || !ValidateInput_SlideShow_Module())
            {
                return;
            }

            SlideShowModule slideShow_Module = GetInput_SlideShow_Module();

            slideShow_Module.SlideShowClassName = ClassNameTextBox.Text;
            slideShow_Module.Save();

            cms.Admin.RedirectToMainMenu(this.PageNavigationId);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SlideShowModule module = SlideShowModule.GetByModuleId(this.ModuleId);
                if (null == module)
                {
                    throw new ArgumentException("Invalid SlideShow module id.");
                }

                FlashSlideShowCtl.FlashUrl = module.FlashFileName;
                FlashSlideShowCtl.Height   = module.Height;
                FlashSlideShowCtl.Width    = module.Width;

                //the flash must be programmed to send moduleId to ~/images.xml.aspx?moduleId=n.
                FlashSlideShowCtl.FlashVars = "moduleId=" + this.ModuleId;
            }
        }
Example #5
0
        /// <summary>
        /// Gets the current entity and fills its with the form input values.
        /// If input is not valid, returns null.
        /// </summary>
        public SlideShowModule GetInput_SlideShow_Module()
        {
            //model.SlideShow_Module slideShow_Module = model.SlideShow_Module.Get(this.ModuleId);
            SlideShowModule slideShow_Module = SlideShowModule.GetByModuleId(this.ModuleId);

            slideShow_Module.FlashFileName     = FlashFileCtl.ImagePath;
            slideShow_Module.Height            = short.Parse(HeightCtl.Text.Trim());
            slideShow_Module.Width             = short.Parse(WidthCtl.Text.Trim());
            slideShow_Module.ImageDisplayTime  = short.Parse(ImageDisplayTimeCtl.Text.Trim());
            slideShow_Module.ImageDisplayOrder = short.Parse(ImageDisplayOrderCtl.Text.Trim());
            slideShow_Module.ImageLooping      = ImageLoopingCtl.Checked;
            slideShow_Module.ImageFadeTime     = short.Parse(ImageFadeTimeCtl.Text.Trim());
            slideShow_Module.ImageXPosition    = 0; //int.Parse(ImageXPositionCtl.Text.Trim());
            slideShow_Module.ImageYPosition    = 0; //int.Parse(ImageYPositionCtl.Text.Trim());

            if (this.IsJQuerySlidingContentSlideShow || this.IsJQuerySlidingTextContentSlideShow)
            {
                slideShow_Module.NavType  = short.Parse(ImageNavTypeCtl.Text.Trim());
                slideShow_Module.WrapType = short.Parse(ImageWrapTypeCtl.Text.Trim());
            }

            return(slideShow_Module);
        }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CreateResolveUrlScript();
            SlideShowModule module = SlideShowModule.GetByModuleId(this.ModuleId);

            if (null == module)
            {
                throw new ArgumentException("Invalid SlideShow module id.");
            }

            if (!IsPostBack)
            {
                // 0 - sequential
                // 1 - random
                SlideShowImageCollection images = SlideShowImage.GetByModuleId(this.ModuleId, "sortOrder", "asc");

                // if random
                if (module.ImageDisplayOrder == 1)
                {
                    Random random = new Random();
                    System.Collections.Generic.List <SlideShowImage> lImages = new System.Collections.Generic.List <SlideShowImage>();
                    foreach (SlideShowImage image in images)
                    {
                        double d = random.NextDouble();
                        if (d > 0.5)
                        {
                            lImages.Add(image);
                        }
                        else
                        {
                            lImages.Insert(0, image);
                        }
                    }
                    ImagesLinksList.DataSource = lImages;
                }
                else
                {
                    // sequential
                    ImagesLinksList.DataSource = images;
                }
                ImagesLinksList.DataBind();
            }

            if (!Page.ClientScript.IsClientScriptBlockRegistered(typeof(JsSlideShow_Display), "wm_xfade_css" + slideshow_div.ClientID))
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(JsSlideShow_Display),
                                                            "wm_xfade_css" + slideshow_div.ClientID,
                                                            module.GetCss(slideshow_div.ClientID),
                                                            false);
            }

            //slideshow javascript adapted from:
            //http://slayeroffice.com/code/imageCrossFade/xfade2.html
            //http://sonspring.com/journal/slideshow-alternative
            if (!Page.ClientScript.IsClientScriptIncludeRegistered(typeof(JsSlideShow_Display), "wm_xfade"))
            {
                string strUrl = ResolveUrl("~/WebModules/SlideShow/public/js/xfade2.js");
                Page.ClientScript.RegisterClientScriptInclude(typeof(JsSlideShow_Display),
                                                              "wm_xfade",
                                                              strUrl);
            }

            if (!Page.ClientScript.IsStartupScriptRegistered(typeof(JsSlideShow_Display), "wm_xfade_" + slideshow_div.ClientID))
            {
                Page.ClientScript.RegisterStartupScript(typeof(JsSlideShow_Display),
                                                        "wm_xfade_" + slideshow_div.ClientID,
                                                        module.GetInitScript(slideshow_div.ClientID),
                                                        true);
            }
        }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CreateResolveUrlScript();
            SlideShowModule module = SlideShowModule.GetByModuleId(this.ModuleId);

            if (null == module)
            {
                throw new ArgumentException("Invalid SlideShow module id.");
            }

            if (!IsPostBack)
            {
                // 0 - sequential
                // 1 - random
                SlideShowImageCollection images = SlideShowImage.GetByModuleId(this.ModuleId, "sortOrder", "asc");

                switch ((NavType)module.NavType)
                {
                case NavType.per_slide:
                {
                    phPerSlideNav.Visible = true;
                    phPrevNextNav.Visible = false;
                }
                break;

                case NavType.prev_next:
                {
                    phPerSlideNav.Visible = false;
                    phPrevNextNav.Visible = true;
                }
                break;

                case NavType.per_slide_with_prev_next:
                {
                    phPerSlideNav.Visible = true;
                    phPrevNextNav.Visible = true;
                }
                break;

                case NavType.none:
                default:
                {
                    phPerSlideNav.Visible = false;
                    phPrevNextNav.Visible = false;
                }
                break;
                }

                // if random
                if (module.ImageDisplayOrder == 1)
                {
                    Random random = new Random();
                    System.Collections.Generic.List <SlideShowImage> lImages = new System.Collections.Generic.List <SlideShowImage>();
                    foreach (SlideShowImage image in images)
                    {
                        double d = random.NextDouble();
                        if (d > 0.5)
                        {
                            lImages.Add(image);
                        }
                        else
                        {
                            lImages.Insert(0, image);
                        }
                    }
                    lvSlideShow.DataSource    = lImages;
                    lvSlideShowNav.DataSource = lImages;
                }
                else
                {
                    // sequential
                    lvSlideShow.DataSource    = images;
                    lvSlideShowNav.DataSource = images;
                }
                lvSlideShow.DataBind();
                lvSlideShowNav.DataBind();
            }

            if (divSlideShow != null)
            {
                if (!Page.ClientScript.IsClientScriptBlockRegistered(typeof(JsSlideShow_Display), "wm_slider_css" + divSlideShow.ClientID))
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(JsSlideShow_Display),
                                                                "wm_xfade_css" + divSlideShow.ClientID,
                                                                module.GetJCarouselTextOnlySliderCss(divSlideShow.ClientID),
                                                                false);
                }

                if (!Page.ClientScript.IsClientScriptIncludeRegistered(typeof(JsSlideShow_Display), "wm_slider"))
                {
                    string strUrl = ResolveUrl("~/WebModules/SlideShow/public/js/jquery.jcarousel.js");
                    Page.ClientScript.RegisterClientScriptInclude(typeof(JsSlideShow_Display),
                                                                  "wm_slider",
                                                                  strUrl);
                }

                if (!Page.ClientScript.IsStartupScriptRegistered(typeof(JsSlideShow_Display), "wm_slider_" + divSlideShow.ClientID))
                {
                    Page.ClientScript.RegisterStartupScript(typeof(JsSlideShow_Display),
                                                            "wm_slider_" + divSlideShow.ClientID,
                                                            module.GetJCarouselTextSliderInitScript(divSlideShow.ClientID),
                                                            true);
                }
            }
        }
Example #8
0
        private void LoadModule()
        {
            WebModuleInfo   module    = WebModule.GetModule(this.ModuleId);
            SlideShowModule slideshow = SlideShowModule.GetByModuleId(this.ModuleId);

            //model.SlideShow_Module slideshow = model.SlideShow_Module.Get(this.ModuleId);

            ClassName_div.Visible = false;
            ClassNameTextBox.Text = slideshow.SlideShowClassName ?? string.Empty;

            this.IsFlashSlideShow = (module.WebModuleType.Name == "Slide Show (Flash)");

            this.IsJQuerySlidingContentSlideShow = (module.WebModuleType.Name == "Slide Show (Sliding jQuery)");

            this.IsJQuerySlidingTextContentSlideShow = (module.WebModuleType.Name == "Slide Show (Sliding jQuery WYSIWYG)");

            this.IsGalleryViewSlideShow = (module.WebModuleType.Name == "Slide Show (Image Gallery)");

            this.IsFlexSlideShow = (module.WebModuleType.Name == "Slide Show (Flex SlideShow)");

            FlashFileCtl.ImagePath    = slideshow.FlashFileName;
            HeightCtl.Text            = slideshow.Height.ToString();
            WidthCtl.Text             = slideshow.Width.ToString();
            ImageDisplayTimeCtl.Text  = slideshow.ImageDisplayTime.ToString();
            ImageDisplayOrderCtl.Text = slideshow.ImageDisplayOrder.ToString();
            ImageLoopingCtl.Checked   = slideshow.ImageLooping;
            ImageFadeTimeCtl.Text     = slideshow.ImageFadeTime.ToString();
            //ImageXPositionCtl.Text = slideshow.ImageXPosition.ToString();
            //ImageYPositionCtl.Text = slideshow.ImageYPosition.ToString();

            if (this.IsJQuerySlidingContentSlideShow || this.IsJQuerySlidingTextContentSlideShow)
            {
                ImageNavTypeCtl.Text  = slideshow.NavType.ToString();
                ImageWrapTypeCtl.Text = slideshow.WrapType.ToString();
            }

            if (this.IsJQuerySlidingTextContentSlideShow)
            {
                SlideShowImagesCtl.IsJQuerySlidingTextContentSlideShow = true;
            }

            if (this.IsGalleryViewSlideShow)
            {
                SlideShowImagesCtl.IsGalleryViewSlideShow = true;
            }

            SlideShowImagesCtl.Load_(this.ModuleId);

            if (this.IsFlashSlideShow)
            {
                InitFlashSlideshowAdmin();
            }
            else if (this.IsJQuerySlidingContentSlideShow)
            {
                InitJQuerySlidingContentSlideshowAdmin();
            }
            else if (this.IsJQuerySlidingTextContentSlideShow)
            {
                InitJQuerySlidingTextContentSlideshowAdmin();
            }
            else if (this.IsGalleryViewSlideShow)
            {
                InitGalleryViewSlideshowAdmin();
            }
            else if (this.IsFlexSlideShow)
            {
                InitFlexSlideShow();
            }
            else
            {
                InitNormalSlideshowAdmin();
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            int    moduleId;
            string moduleId_s = context.Request.QueryString["moduleId"];

            if (null == moduleId_s)
            {
                throw new ArgumentNullException("moduleId");
            }
            if (!int.TryParse(moduleId_s, out moduleId))
            {
                return;
            }

            SlideShowModule module = SlideShowModule.GetByModuleId(moduleId);

            if (null == module)
            {
                throw new ArgumentException("Invalid SlideShow module id.");
            }

            SlideShowImageCollection slideshowImages = SlideShowImage.GetByModuleId(moduleId);

            //construct the images XML.

            //timer : number of seconds between each image transition
            //order : how you want your images displayed. choose either 'sequential' or 'random'
            //fadeTime : velocity of image crossfade. Increment for faster fades, decrement for slower. Approximately equal to seconds.
            //looping : if the slide show is in sequential mode, this stops the show at the last image (use 'yes' for looping, 'no' for not)
            //xpos : x position of all loaded clips (0 is default)
            //ypos : y position of all loaded clips (0 is default)

            string imageDisplayOrder_s = ((ImageDisplayOrder)module.ImageDisplayOrder).ToString();
            string imageLooping_s      = module.ImageLooping ? "yes" : "no";

            StringBuilder output = new StringBuilder();

            output.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
            output.AppendLine(string.Format("<gallery timer=\"{0}\" fadetime=\"{1}\" order=\"{2}\" looping=\"{3}\" xpos=\"{4}\" ypos=\"{5}\">",
                                            module.ImageDisplayTime,
                                            module.ImageFadeTime,
                                            imageDisplayOrder_s,
                                            imageLooping_s,
                                            module.ImageXPosition,
                                            module.ImageYPosition));

            //paths must be relative to the site root (i.e., absolute).
            foreach (SlideShowImage i in slideshowImages)
            {
                output.AppendLine(string.Format("\t<image path=\"{0}\" />",
                                                VirtualPathUtility.ToAbsolute(i.GetFullPath())));
            }

            output.AppendLine("</gallery>");

            //
            //output
            //

            context.Response.Cache.SetCacheability(HttpCacheability.Public);
            context.Response.Cache.SetExpires(DateTime.Now.AddDays(1));

            context.Response.ClearHeaders();
            context.Response.ClearContent();
            context.Response.Clear();
            context.Response.ContentType = "text/xml";

            context.Response.Write(output.ToString());
        }
Example #10
0
 public bool Delete(object ModuleId)
 {
     return(SlideShowModule.Delete(ModuleId) == 1);
 }
Example #11
0
 public bool Destroy(object ModuleId)
 {
     return(SlideShowModule.Destroy(ModuleId) == 1);
 }