Ejemplo n.º 1
0
        public override string CreateRenderedViewerMarkup(Uri url, int maxWidth, int maxHeight)
        {
            string videoUrl = new BcWebClient().ResolveMinifiedUrl(url);

            //WORKAROUND for telligent bug
            videoUrl = videoUrl.Replace("&", "&");

            Match match = BcRegex.Match(videoUrl);

            if (match.Success)
            {
                int height = 450;
                int width  = 480;

                bool   isHttps   = !string.IsNullOrEmpty(match.Groups["https"].Value);
                string playerId  = match.Groups["playerId"].Value;
                string playerKey = match.Groups["playerKey"].Value;
                string videoId   = match.Groups["videoId"].Value;

                Globals.ScaleUpDown(ref width, ref height, maxWidth, maxHeight);

                string playerHtml = string.Format(PlayerHtmlTemplateBody, playerId, videoId, playerKey, width, height, isHttps?PLayerHtmlHttpsModifier:string.Empty);

                CSContext context = CSContext.Current;
                Page      page    = null;
                if (context.Context != null)
                {
                    page = context.Context.Handler as Page;
                }

                if (page != null)
                {
                    string id = "video_" + Guid.NewGuid();

                    var wrapper = new StringBuilder();

                    wrapper.Append("<script type=\"text/javascript\" src=\"");
                    wrapper.Append(
                        Globals.FullPath(page.ClientScript.GetWebResourceUrl(typeof(BrightcoveMediaViewer),
                                                                             "FourRoads.Common.TelligentCommunity.Plugins.insertmarkup.js")));
                    wrapper.Append("\"></script>");

                    wrapper.AppendFormat("<div id=\"{0}\"><noscript>{1}</noscript></div>", id, playerHtml);
                    wrapper.Append(string.Format(PlayerHtmlTemplateHead, isHttps ? "s":string.Empty));
                    wrapper.Append("<script type=\"text/javascript\">\n");
                    wrapper.Append("cs_setInnerHtml('");
                    wrapper.Append(id);
                    wrapper.Append("','");
                    wrapper.Append(JavaScript.Encode(playerHtml));
                    wrapper.Append("');");
                    wrapper.Append("\n</script>");
                    wrapper.Append(PlayerHtmlTemplateTail);

                    return(wrapper.ToString());
                }
                return(playerHtml);
            }
            return(string.Empty);
        }
Ejemplo n.º 2
0
        public override string CreateRenderedViewerMarkup(Uri url, int maxWidth, int maxHeight)
        {
            Match match = CSRegex.DailyMotionViewerIdRegex().Match(url.OriginalString);

            if (!match.Success)
            {
                return(string.Empty);
            }
            int width  = 420;
            int height = 0x14b;

            Globals.ScaleUpDown(ref width, ref height, maxWidth, maxHeight);
            string playerHtml = string.Format("<iframe source=\"{3}\" frameborder=\"0\" width=\"{1}\" height=\"{2}\" src=\"http://www.dailymotion.com/embed/video/{0}\" allowfullscreen></iframe>",
                                              Globals.EnsureHtmlEncoded(match.Groups[1].Value), width, height, HttpUtility.HtmlAttributeEncode(url.ToString()));
            CSContext current = CSContext.Current;
            Page      handler = null;

            if (current.Context != null)
            {
                handler = current.Context.Handler as Page;
            }
            if (handler != null)
            {
                string        videoId   = "video_" + Guid.NewGuid().ToString();
                StringBuilder embedHtml = new StringBuilder();
                embedHtml.Append("<script type=\"text/javascript\" src=\"");
                embedHtml.Append(Globals.FullPath(handler.ClientScript.GetWebResourceUrl(typeof(DailyMotionMediaViewer), "FourRoads.Common.TelligentCommunity.Plugins.insertmarkup.js")));
                embedHtml.Append("\"></script>");
                embedHtml.AppendFormat("<div id=\"{0}\"><noscript>{1}</noscript></div>", videoId, playerHtml);
                embedHtml.Append("<script type=\"text/javascript\">\n");
                embedHtml.Append("cs_setInnerHtml('");
                embedHtml.Append(videoId);
                embedHtml.Append("','");
                embedHtml.Append(JavaScript.Encode(playerHtml));
                embedHtml.Append("');");
                embedHtml.Append("\n</script>");
                return(embedHtml.ToString());
            }
            return(playerHtml);
        }
Ejemplo n.º 3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, CSContext CScontext)
        {
            // global policy - assign here or on each controller
            app.UseCors("CorsPolicy");


            app.Use(async(context, next) => {
                await next();
                if (context.Response.StatusCode == 404 &&
                    !Path.HasExtension(context.Request.Path.Value) &&
                    !context.Request.Path.Value.StartsWith("/api/"))
                {
                    context.Request.Path = "/index.html";
                    await next();
                }
            });

            DBInitializer.Initialize(CScontext);

            app.UseMvcWithDefaultRoute();
            app.UseDefaultFiles();
            app.UseStaticFiles();
        }
Ejemplo n.º 4
0
 public PutCustomerPayCommandHandler(CSContext context)
 {
     _context = context;
 }
Ejemplo n.º 5
0
 public OrderController(CSContext context)
 {
     _context = context;
 }
Ejemplo n.º 6
0
 public GetCustomerQueryHandler(CSContext context)
 {
     _context = context;
 }
Ejemplo n.º 7
0
 public WishCardsController(CSContext context)
 {
     _context = context;
 }
Ejemplo n.º 8
0
 public MessageController(CSContext context)
 {
     _context = context;
 }
Ejemplo n.º 9
0
 public MembershipController(CSContext context)
 {
     _context = context;
 }
Ejemplo n.º 10
0
 public UserController(CSContext context)
 {
     _context = context;
 }
Ejemplo n.º 11
0
 public AccController(CSContext context)
 {
     _context = context;
 }
Ejemplo n.º 12
0
 public SellModelsController(CSContext context)
 {
     _context = context;
 }
Ejemplo n.º 13
0
 public ChatroomController(CSContext context)
 {
     _context = context;
 }
Ejemplo n.º 14
0
 protected BaseService(CSContext db)
 {
     _db = db;
 }
Ejemplo n.º 15
0
 public CollectionsController(CSContext context)
 {
     _context = context;
 }
Ejemplo n.º 16
0
 public DeleteCustomerCommandHandler(CSContext context)
 {
     _context = context;
 }
Ejemplo n.º 17
0
 public WishListsController(CSContext context)
 {
     _context = context;
 }
Ejemplo n.º 18
0
 public BuyModelsController(CSContext context)
 {
     _context = context;
 }
Ejemplo n.º 19
0
 public PostCustomerCommandHandler(CSContext context)
 {
     _context = context;
 }