Esempio 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);
        }
Esempio 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);
        }
Esempio 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();
        }
Esempio n. 4
0
 public PutCustomerPayCommandHandler(CSContext context)
 {
     _context = context;
 }
Esempio n. 5
0
 public OrderController(CSContext context)
 {
     _context = context;
 }
Esempio n. 6
0
 public GetCustomerQueryHandler(CSContext context)
 {
     _context = context;
 }
Esempio n. 7
0
 public WishCardsController(CSContext context)
 {
     _context = context;
 }
Esempio n. 8
0
 public MessageController(CSContext context)
 {
     _context = context;
 }
Esempio n. 9
0
 public MembershipController(CSContext context)
 {
     _context = context;
 }
Esempio n. 10
0
 public UserController(CSContext context)
 {
     _context = context;
 }
Esempio n. 11
0
 public AccController(CSContext context)
 {
     _context = context;
 }
Esempio n. 12
0
 public SellModelsController(CSContext context)
 {
     _context = context;
 }
Esempio n. 13
0
 public ChatroomController(CSContext context)
 {
     _context = context;
 }
Esempio n. 14
0
 protected BaseService(CSContext db)
 {
     _db = db;
 }
Esempio n. 15
0
 public CollectionsController(CSContext context)
 {
     _context = context;
 }
Esempio n. 16
0
 public DeleteCustomerCommandHandler(CSContext context)
 {
     _context = context;
 }
Esempio n. 17
0
 public WishListsController(CSContext context)
 {
     _context = context;
 }
Esempio n. 18
0
 public BuyModelsController(CSContext context)
 {
     _context = context;
 }
Esempio n. 19
0
 public PostCustomerCommandHandler(CSContext context)
 {
     _context = context;
 }