Ejemplo n.º 1
0
        protected void Image_SaveButton_Click(object sender, EventArgs e)
        {
            HttpPostedFile postedFile    = Image_FileUploadCtl.PostedFile;
            string         filename      = String.Empty;
            string         fileExtension = String.Empty;

            if (!this.IsJQuerySlidingTextContentSlideShow)
            {
                if (null == postedFile)
                {
                    throw new InvalidOperationException("Image_FileUploadCtl.PostedFile is null.");
                }

                filename = Path.GetFileName(Image_FileUploadCtl.PostedFile.FileName);
                Regex reg = new Regex(@"[^A-Za-z0-9.()_]");
                filename      = reg.Replace(filename, String.Empty);
                fileExtension = Path.GetExtension(filename);


                if (!IsFileExtensionValid(fileExtension))
                {
                    Msg.ShowError(string.Format("Invalid file format. Image format must be {0} format.",
                                                (this.IsFlashSlideShow ? AllowedImageTypes_Flash_Text : AllowedImageTypes_Normal_Text)));
                    return;
                }
            }

            //SlideShow_Image image = new SlideShow_Image();
            SlideShowImage image = new SlideShowImage();

            image.ModuleId      = this.ModuleId;
            image.ImageFileName = filename;

            if (this.IsJQuerySlidingTextContentSlideShow)
            {
                image.SlideTextContentName = Content_Name.Text.Trim();
                image.SlideTextContent     = SlideContent.Text;
            }
            else
            {
                if (IsGalleryViewSlideShow)
                {
                    image.SlideTextContentName = Content_Name.Text.Trim();
                    image.SlideTextContent     = SlideContent.Text;
                }

                string savePath = Server.MapPath(image.GetFullPath());
                string saveDir  = Path.GetDirectoryName(savePath);

                if (!Directory.Exists(saveDir))
                {
                    Directory.CreateDirectory(saveDir);
                }

                if (File.Exists(savePath))
                {
                    image.ImageFileName = RenameFile(filename, fileExtension, savePath);
                }

                Image_FileUploadCtl.SaveAs(Server.MapPath(image.GetFullPath()));
            }

            image.Save();

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

            SlideShowImagesCtl.Load_(this.ModuleId);

            if (this.IsJQuerySlidingTextContentSlideShow)
            {
                Msg.ShowSuccess("Added new content to slide show.");

                SlideContent.Text = String.Empty;
                Content_Name.Text = String.Empty;
            }
            else
            {
                Msg.ShowSuccess("Added new image to slide show.");
            }

            Content_Name.Text = "";
            SlideContent.Text = "";
        }
Ejemplo n.º 2
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();
            }
        }