Example #1
0
        public SlideShowImageCollection FetchByQuery(Query qry)
        {
            SlideShowImageCollection coll = new SlideShowImageCollection();

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
Example #2
0
        public SlideShowImageCollection FetchAll()
        {
            SlideShowImageCollection coll = new SlideShowImageCollection();
            Query qry = new Query(SlideShowImage.Schema);

// Begin Bayshore custom code block (rread 6/26/07)
// Ignore records marked for deletion when doing a FetchAll
            if (SlideShowImage.Schema.GetColumn("IsDeleted") != null)
            {
                qry.WHERE("IsDeleted <> true");
            }
            else if (SlideShowImage.Schema.GetColumn("Deleted") != null)
            {
                qry.WHERE("Deleted <> true");
            }
// End Bayshore custom code block

            coll.LoadAndCloseReader(qry.ExecuteReader());
            return(coll);
        }
Example #3
0
        public static SlideShowImageCollection GetByModuleId(int moduleId, string sortBy, string sortDirection)
        {
            string sortdir = String.IsNullOrEmpty(sortDirection) ? "asc" : sortDirection;

            SlideShowImageCollection col = new SlideShowImageCollection().Where("ModuleId", moduleId);

            if (String.IsNullOrEmpty(sortBy))
            {
                return(col.Load());
            }
            if (sortdir == "desc")
            {
                col = col.OrderByDesc(sortBy);
            }
            else
            {
                col = col.OrderByAsc(sortBy);
            }
            return(col.Load());
        }
Example #4
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 #5
0
        public SlideShowImageCollection FetchByID(object Id)
        {
            SlideShowImageCollection coll = new SlideShowImageCollection().Where("Id", Id).Load();

            return(coll);
        }
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");

                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);
                }
            }
        }
        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());
        }