예제 #1
0
        protected void lvSlideShow_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                SlideShowImage slideShowImage = e.Item.DataItem as SlideShowImage;
                if (slideShowImage != null)
                {
                    //HtmlAnchor anchorLinkUrl = e.Item.FindControl("anchorLinkUrl") as HtmlAnchor;

                    //if (anchorLinkUrl != null)
                    //{
                    //    if (!string.IsNullOrEmpty(slideShowImage.LinkUrl))
                    //    {
                    //        anchorLinkUrl.HRef = slideShowImage.LinkUrl;
                    //    }
                    //}

                    HtmlContainerControl liSlide = e.Item.FindControl("liSlide") as HtmlContainerControl;

                    if (liSlide != null)
                    {
                        if (!string.IsNullOrEmpty(slideShowImage.LinkUrl))
                        {
                            liSlide.Attributes["onclick"] = "window.location = '" + slideShowImage.LinkUrl + "';";
                        }
                    }
                }
            }
        }
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            lblMessage.Text = string.Empty;

            SlideShowImage slideImg = SlideShowImage.GetById(this.ContentId);

            // Update the content
            slideImg.SlideTextContentName = txtContentName.Text.Trim();
            slideImg.SlideTextContent     = txtContent.Value;
            slideImg.LinkUrl = txtLinkUrl.Text.Trim();

            slideImg.Save(Page.User.Identity.Name);

            // Reload content
            SetEditableContent();

            lblMessage.Text = "<br>Your changes have been saved.";
        }
 protected void lvSlideShow_ItemDataBound(object sender, ListViewItemEventArgs e)
 {
     if (e.Item.ItemType == ListViewItemType.DataItem)
     {
         SlideShowImage slideShowImage = e.Item.DataItem as SlideShowImage;
         if (slideShowImage != null)
         {
             HtmlAnchor anchorLinkUrl = e.Item.FindControl("anchorLinkUrl") as HtmlAnchor;
             if (anchorLinkUrl != null)
             {
                 if (!string.IsNullOrEmpty(slideShowImage.LinkUrl))
                 {
                     anchorLinkUrl.HRef = slideShowImage.LinkUrl;
                 }
             }
         }
     }
 }
예제 #4
0
        public void Insert(int ModuleId, string ImageFileName, int SortOrder, string LinkUrl, string SlideTextContent, string SlideTextContentName)
        {
            SlideShowImage item = new SlideShowImage();

            item.ModuleId = ModuleId;

            item.ImageFileName = ImageFileName;

            item.SortOrder = SortOrder;

            item.LinkUrl = LinkUrl;

            item.SlideTextContent = SlideTextContent;

            item.SlideTextContentName = SlideTextContentName;


            item.Save(UserName);
        }
예제 #5
0
        public void InsertAndReturnIdentity(int ModuleId, string ImageFileName, int SortOrder, string LinkUrl, string SlideTextContent, string SlideTextContentName, out object newId)
        {
            SlideShowImage item = new SlideShowImage();

            item.ModuleId = ModuleId;

            item.ImageFileName = ImageFileName;

            item.SortOrder = SortOrder;

            item.LinkUrl = LinkUrl;

            item.SlideTextContent = SlideTextContent;

            item.SlideTextContentName = SlideTextContentName;


            item.Save(UserName);

            newId = item.Id;
        }
        private void SetEditableContent()
        {
            lblMessage.Text  = string.Empty;
            txtContent.Value = String.Empty;
            SlideShowImage slideImage;

            slideImage = SlideShowImage.GetById(this.ContentId);

            if (slideImage != null)
            {
                this.ContentName = slideImage.SlideTextContentName;
                this.ContentText = slideImage.SlideTextContent;
                this.LinkUrl     = slideImage.LinkUrl;
            }

            txtContent.Value    = this.ContentText;
            txtContentName.Text = this.ContentName;
            txtLinkUrl.Text     = this.LinkUrl;

            //EditorModalPopup.Show();
        }
예제 #7
0
 protected void ImagesLinksList_ItemDataBound(object sender, RepeaterItemEventArgs args)
 {
     switch (args.Item.ItemType)
     {
     case ListItemType.Item:
     case ListItemType.AlternatingItem:
     {
         SlideShowImage slideShowImage = args.Item.DataItem as SlideShowImage;
         if (slideShowImage != null)
         {
             HtmlAnchor anchorLinkUrl = args.Item.FindControl("anchorLinkUrl") as HtmlAnchor;
             if (anchorLinkUrl != null)
             {
                 if (!string.IsNullOrEmpty(slideShowImage.LinkUrl))
                 {
                     anchorLinkUrl.HRef = slideShowImage.LinkUrl;
                 }
             }
         }
     }
     break;
     }
 }
예제 #8
0
        public void Update(int Id, int ModuleId, string ImageFileName, int SortOrder, string LinkUrl, string SlideTextContent, string SlideTextContentName)
        {
            SlideShowImage item = new SlideShowImage();

            item.MarkOld();
            item.IsLoaded = true;

            item.Id = Id;

            item.ModuleId = ModuleId;

            item.ImageFileName = ImageFileName;

            item.SortOrder = SortOrder;

            item.LinkUrl = LinkUrl;

            item.SlideTextContent = SlideTextContent;

            item.SlideTextContentName = SlideTextContentName;

            item.Save(UserName);
        }
예제 #9
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);
            }
        }
예제 #10
0
 public bool Delete(object Id)
 {
     return(SlideShowImage.Delete(Id) == 1);
 }
예제 #11
0
 public bool Destroy(object Id)
 {
     return(SlideShowImage.Destroy(Id) == 1);
 }
예제 #12
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);
                }
            }
        }
예제 #13
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 = "";
        }
예제 #14
0
        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());
        }