Example #1
0
        public void Process(List<ITemplateAction> actions, MerchantTribe.Commerce.MerchantTribeApplication app, ITagProvider tagProvider, ParsedTag tag, string innerContents)
        {
            string fileUrl = string.Empty;
            bool secure = app.CurrentRequestContext.RoutingContext.HttpContext.Request.IsSecureConnection;

            var tm = app.ThemeManager();

            string mode = tag.GetSafeAttribute("mode");
            if (mode == "legacy")
            {
                fileUrl = tm.CurrentStyleSheet(app, secure);
            }
            else if (mode == "system")
            {
                string cssFile = tag.GetSafeAttribute("file");
                fileUrl = app.StoreUrl(secure, false) + cssFile.TrimStart('/');
            }
            else
            {
                string fileName = tag.GetSafeAttribute("file");
                fileUrl = tm.ThemeFileUrl(fileName, app);
            }

            string result = string.Empty;
            result = "<link href=\"" + fileUrl + "\" rel=\"stylesheet\" type=\"text/css\" />";
            actions.Add(new Actions.LiteralText(result));
        }
Example #2
0
        public void Process(List<ITemplateAction> actions, MerchantTribe.Commerce.MerchantTribeApplication app, ITagProvider tagProvider, ParsedTag tag, string innerContents)
        {
            SearchFormViewModel model = new SearchFormViewModel();
            string rootUrl = app.StoreUrl(false, true);
            model.SearchFormUrl = rootUrl + "search";
            model.ButtonImageUrl = app.ThemeManager().ButtonUrl("Go", app.CurrentRequestContext.RoutingContext.HttpContext.Request.IsSecureConnection);

            actions.Add(new Actions.PartialView("~/views/shared/_SearchForm.cshtml", model));
        }
Example #3
0
        public void Process(StringBuilder output, 
                            MerchantTribe.Commerce.MerchantTribeApplication app, 
                            dynamic viewBag,
                            ITagProvider tagProvider, 
                            ParsedTag tag, 
                            string innerContents)
        {
            SearchFormViewModel model = new SearchFormViewModel();
            string rootUrl = app.StoreUrl(false, true);
            model.SearchFormUrl = rootUrl + "search";                        
            model.ButtonImageUrl = app.ThemeManager().ButtonUrl("Go", app.IsCurrentRequestSecure());

            Render(output, model);            
        }
Example #4
0
        public void Process(StringBuilder output, 
                            MerchantTribe.Commerce.MerchantTribeApplication app, 
                            dynamic viewBag,
                            ITagProvider tagProvider, 
                            ParsedTag tag, 
                            string innerContents)
        {
            string fileUrl = string.Empty;
            bool secure = app.IsCurrentRequestSecure();
            var tm = app.ThemeManager();

            string mode = tag.GetSafeAttribute("mode");
            if (mode == "legacy")
            {
                fileUrl = tm.CurrentStyleSheet(app, secure);
            }
            else if (mode == "system")
            {
                string cssFile = tag.GetSafeAttribute("file");
                fileUrl = app.StoreUrl(secure, false) + cssFile.TrimStart('/');
            }
            else
            {
                string fileName = tag.GetSafeAttribute("file");
                fileUrl = tm.ThemeFileUrl(fileName, app);
            }

            if (fileUrl.StartsWith("http://"))
            {
                fileUrl = fileUrl.Replace("http://", "//");
            }

            string result = string.Empty;
            result = "<link href=\"" + fileUrl + "\" rel=\"stylesheet\" type=\"text/css\" />";
            output.Append(result);            
        }
Example #5
0
        private void CheckFor301(string slug, MerchantTribe.Commerce.MerchantTribeApplication app)
        {
            MerchantTribe.Commerce.Content.CustomUrl url = app.ContentServices.CustomUrls.FindByRequestedUrl(slug);
            if (url != null)
            {
                if (url.Bvin != string.Empty)
                {
                    string destination = app.StoreUrl(false, false) + url.RedirectToUrl.TrimStart('/');

                    if (url.IsPermanentRedirect)
                    {
                        app.CurrentRequestContext.RoutingContext.HttpContext.Response.RedirectPermanent(destination);
                    }
                    else
                    {
                        app.CurrentRequestContext.RoutingContext.HttpContext.Response.Redirect(destination);
                    }
                }
            }
        }