Beispiel #1
0
        public void Process(StringBuilder output, 
            MerchantTribeApplication app, 
            dynamic viewBag, 
            ITagProvider tagProvider, 
            ParsedTag tag, string contents)
        {
            string areaName = tag.GetSafeAttribute("name");

            string result = contents;

            // Get area data from the category if it exists, otherwise use the default area content
            if (app.CurrentRequestContext.CurrentCategory != null)
            {
                CategoryPageVersion v = app.CurrentRequestContext.CurrentCategory.GetCurrentVersion();
                if (v != null)
                {
                    string fromCat = v.Areas.GetAreaContent(areaName);
                    if (fromCat.Trim().Length > 0)
                    {
                        result = fromCat;
                    }
                }
            }

            // do replacements for legacy tags here
            //result = MerchantTribe.Commerce.Utilities.TagReplacer.ReplaceContentTags(result,
            //                app,
            //                "",
            //                app.IsCurrentRequestSecure());
            output.Append(result);
        }
Beispiel #2
0
        public void Process(StringBuilder output,
                            MerchantTribeApplication app,
                            dynamic viewBag,
                            ITagProvider tagProvider,
                            ParsedTag tag, string contents)
        {
            string areaName = tag.GetSafeAttribute("name");

            string result = contents;

            // Get area data from the category if it exists, otherwise use the default area content
            if (app.CurrentRequestContext.CurrentCategory != null)
            {
                CategoryPageVersion v = app.CurrentRequestContext.CurrentCategory.GetCurrentVersion();
                if (v != null)
                {
                    string fromCat = v.Areas.GetAreaContent(areaName);
                    if (fromCat.Trim().Length > 0)
                    {
                        result = fromCat;
                    }
                }
            }

            // do replacements for legacy tags here
            //result = MerchantTribe.Commerce.Utilities.TagReplacer.ReplaceContentTags(result,
            //                app,
            //                "",
            //                app.IsCurrentRequestSecure());
            output.Append(result);
        }
Beispiel #3
0
        public void Process(List<ITemplateAction> actions, MerchantTribe.Commerce.MerchantTribeApplication app, ITagProvider tagProvider, ParsedTag tag, string innerContents)
        {
            this.App = app;
            this.Url = new System.Web.Mvc.UrlHelper(app.CurrentRequestContext.RoutingContext);
            CurrentCategory = app.CurrentRequestContext.CurrentCategory;
            if (CurrentCategory == null)
            {
                CurrentCategory = new Category();
                CurrentCategory.Bvin = "0";
            }

            StringBuilder sb = new StringBuilder();

            sb.Append("<div class=\"categorymenu\">");
            sb.Append("<div class=\"decoratedblock\">");

            string title = tag.GetSafeAttribute("title");
            if (title.Trim().Length > 0)
            {
                sb.Append("<h4>" + title + "</h4>");
            }

            sb.Append("<ul>");

            int maxDepth = 5;

            string mode = tag.GetSafeAttribute("mode");
            switch (mode.Trim().ToUpperInvariant())
            {
                case "ROOT":
                case "ROOTS":
                    // Root Categories Only
                    LoadRoots(sb);
                    break;
                case "ALL":
                    // All Categories
                    LoadAllCategories(sb, maxDepth);
                    break;
                case "":
                case "PEERS":
                    // Peers, Children and Parents
                    LoadPeersAndChildren(sb);
                    break;
                case "ROOTPLUS":
                    // Show root and expanded children
                    LoadRootPlusExpandedChildren(sb);
                    break;
                default:
                    // All Categories
                    LoadPeersAndChildren(sb);
                    break;
            }

            sb.Append("</ul>");

            sb.Append("</div>");
            sb.Append("</div>");

            actions.Add(new Actions.LiteralText(sb.ToString()));
        }
Beispiel #4
0
        public void Process(List<ITemplateAction> actions, MerchantTribe.Commerce.MerchantTribeApplication app, ITagProvider tagProvider, ParsedTag tag, string innerContents)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<" + _tagName);

            string pathToTemplate = app.ThemeManager().ThemeFileUrl("",app) + "templates/";

            foreach (var att in tag.Attributes)
            {
                string name = att.Key;
                string val = att.Value;
                if (_attributesToFix.Contains(att.Key.ToLowerInvariant()))
                {
                    val = FixUpValue(val, pathToTemplate);
                }
                sb.Append(" " + name + "=\"" + val + "\"");
            }

            if (tag.IsSelfClosed)
            {
                sb.Append("/>");
            }
            else
            {
                sb.Append(">" + innerContents + "</" + _tagName + ">");
            }

            actions.Add(new Actions.LiteralText(sb.ToString()));
        }
Beispiel #5
0
 public Processor(MerchantTribeApplication app, dynamic viewBag, string template, ITagProvider tagProvider)
 {
     this.MTApp       = app;
     this.TagProvider = tagProvider;
     this.Template    = template;
     this.ViewBag     = viewBag;
 }
Beispiel #6
0
 public Processor(MerchantTribeApplication app, dynamic viewBag, string template, ITagProvider tagProvider)
 {
     this.MTApp = app;
     this.TagProvider = tagProvider;
     this.Template = template;
     this.ViewBag = viewBag;
 }
Beispiel #7
0
        public void Process(List<ITemplateAction> actions, MerchantTribeApplication app, ITagProvider tagProvider, ParsedTag tag, string contents)
        {
            string areaName = tag.GetSafeAttribute("name");

            string result = contents;

            // Get area data from the category if it exists, otherwise use the default area content
            if (app.CurrentRequestContext.CurrentCategory != null)
            {
                CategoryPageVersion v = app.CurrentRequestContext.CurrentCategory.GetCurrentVersion();
                if (v != null)
                {
                    string fromCat = v.Areas.GetAreaContent(areaName);
                    if (fromCat.Trim().Length > 0)
                    {
                        result = fromCat;
                    }
                }
            }

            // do replacements for legacy tags here
            result = MerchantTribe.Commerce.Utilities.TagReplacer.ReplaceContentTags(result,
                            app,
                            "",
                            app.CurrentRequestContext.RoutingContext.HttpContext.Request.IsSecureConnection);
            actions.Add(new Actions.LiteralText(result));
        }
Beispiel #8
0
        public void Process(StringBuilder output,
                            MerchantTribe.Commerce.MerchantTribeApplication app,
                            dynamic viewBag,
                            ITagProvider tagProvider,
                            ParsedTag tag,
                            string innerContents)
        {
            bool   isSecureRequest = app.IsCurrentRequestSecure();
            bool   textOnly        = !app.CurrentStore.Settings.UseLogoImage;
            string textOnlyTag     = tag.GetSafeAttribute("textonly").Trim().ToLowerInvariant();

            if (textOnlyTag == "1" || textOnlyTag == "y" || textOnlyTag == "yes" || textOnlyTag == "true")
            {
                textOnly = true;
            }

            string storeRootUrl = app.CurrentStore.RootUrl();
            string storeName    = app.CurrentStore.Settings.FriendlyName;
            string logoImage    = app.CurrentStore.Settings.LogoImageFullUrl(app, isSecureRequest);
            string logoText     = app.CurrentStore.Settings.LogoText;

            LogoViewModel model = new LogoViewModel();

            model.InnerContent = innerContents.Trim();
            model.LinkUrl      = storeRootUrl;
            model.LogoImageUrl = logoImage;
            model.LogoText     = logoText;
            model.StoreName    = storeName;
            model.UseTextOnly  = textOnly;

            Render(output, model);
        }
Beispiel #9
0
        public void Process(StringBuilder output,
                            MerchantTribe.Commerce.MerchantTribeApplication app,
                            dynamic viewBag,
                            ITagProvider tagProvider,
                            ParsedTag tag,
                            string innerContents)
        {
            MiniPagerViewModel model = new MiniPagerViewModel();

            model.TotalPages = tag.GetSafeAttributeAsInteger("totalpages");
            if (model.TotalPages >= 1)
            {
                // manual load
                model.CurrentPage         = tag.GetSafeAttributeAsInteger("currentpage");
                model.PagerUrlFormat      = tag.GetSafeAttribute("urlformat");
                model.PagerUrlFormatFirst = tag.GetSafeAttribute("urlformatfirst");
                if (model.CurrentPage < 1)
                {
                    model.CurrentPage = GetPageFromRequest(app);
                }
            }
            else
            {
                // find everything from current category
                model = FindModelForCurrentCategory(app, viewBag, tag);
            }

            Render(output, model);
        }
 public SearchController(IPostProvider postProvider, SearchResultMapper searchResultMapper, ICategoryProvider categoryProvider, ITagProvider tagProvider)
 {
     _postProvider       = postProvider;
     _categoryProvider   = categoryProvider;
     _tagProvider        = tagProvider;
     _searchResultMapper = searchResultMapper;
 }
Beispiel #11
0
        public void Process(StringBuilder output,
                            MerchantTribe.Commerce.MerchantTribeApplication app,
                            dynamic viewBag,
                            ITagProvider tagProvider,
                            ParsedTag tag,
                            string innerContents)
        {
            MiniPagerViewModel model = new MiniPagerViewModel();

            model.TotalPages = tag.GetSafeAttributeAsInteger("totalpages");
            if (model.TotalPages >= 1)
            {
                // manual load
                model.CurrentPage = tag.GetSafeAttributeAsInteger("currentpage");
                model.PagerUrlFormat = tag.GetSafeAttribute("urlformat");
                model.PagerUrlFormatFirst = tag.GetSafeAttribute("urlformatfirst");
                if (model.CurrentPage < 1) model.CurrentPage = GetPageFromRequest(app);
            }
            else
            {
                // find everything from current category
                model = FindModelForCurrentCategory(app, viewBag, tag);
            }
            
            Render(output, model);
        }
Beispiel #12
0
        public void Process(StringBuilder output, 
                            MerchantTribe.Commerce.MerchantTribeApplication app, 
                            dynamic viewBag,
                            ITagProvider tagProvider, 
                            ParsedTag tag, 
                            string innerContents)
        {
            output.Append("<" + _tagName);
            
            string pathToTemplate = app.ThemeManager().ThemeFileUrl("",app) + "templates/";
            if (pathToTemplate.StartsWith("http://"))
            {
                pathToTemplate = pathToTemplate.Replace("http://", "//");
            }

            foreach (var att in tag.Attributes)
            {
                string name = att.Key;
                string val = att.Value;
                if (_attributesToFix.Contains(att.Key.ToLowerInvariant()))
                {
                    val = FixUpValue(val, pathToTemplate);
                }
                output.Append(" " + name + "=\"" + val + "\"");                
            }
            
            if (tag.IsSelfClosed)
            {
                output.Append("/>");
            }
            else
            {
                output.Append(">" + innerContents + "</" + _tagName + ">");
            }                        
        }
Beispiel #13
0
        public void Process(StringBuilder output, 
                            MerchantTribe.Commerce.MerchantTribeApplication app, 
                            dynamic viewBag,
                            ITagProvider tagProvider, 
                            ParsedTag tag, 
                            string innerContents)
        {            
            bool isSecureRequest = app.IsCurrentRequestSecure();            
            bool textOnly = !app.CurrentStore.Settings.UseLogoImage;
            string textOnlyTag = tag.GetSafeAttribute("textonly").Trim().ToLowerInvariant();
            if (textOnlyTag == "1" || textOnlyTag == "y" || textOnlyTag == "yes" || textOnlyTag == "true") textOnly = true;

            string storeRootUrl = app.CurrentStore.RootUrl();
            string storeName = app.CurrentStore.Settings.FriendlyName;
            string logoImage = app.CurrentStore.Settings.LogoImageFullUrl(app, isSecureRequest);
            string logoText = app.CurrentStore.Settings.LogoText;

            LogoViewModel model = new LogoViewModel();
            model.InnerContent = innerContents.Trim();
            model.LinkUrl = storeRootUrl;
            model.LogoImageUrl = logoImage;
            model.LogoText = logoText;
            model.StoreName = storeName;
            model.UseTextOnly = textOnly;

            Render(output, model);            
        }
Beispiel #14
0
        public void Process(StringBuilder output, 
            MerchantTribe.Commerce.MerchantTribeApplication app,
            dynamic viewBag,
            ITagProvider tagProvider,
            ParsedTag tag,
            string innerContents)
        {
            output.Append("<" + _tagName);

            string pathToTemplate = app.ThemeManager().ThemeFileUrl("",app) + "templates/";
            if (pathToTemplate.StartsWith("http://"))
            {
                pathToTemplate = pathToTemplate.Replace("http://", "//");
            }

            foreach (var att in tag.Attributes)
            {
                string name = att.Key;
                string val = att.Value;
                if (_attributesToFix.Contains(att.Key.ToLowerInvariant()))
                {
                    val = FixUpValue(val, pathToTemplate);
                }
                output.Append(" " + name + "=\"" + val + "\"");
            }

            if (tag.IsSelfClosed)
            {
                output.Append("/>");
            }
            else
            {
                output.Append(">" + innerContents + "</" + _tagName + ">");
            }
        }
Beispiel #15
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));
        }
        public TagService([NotNull] ITagDataSourceProvider tagDataSourceProvider,
                          [NotNull] ITagEntityProvider tagEntityProvider,
                          [NotNull] ITagEntityRepositoryProvider tagEntityRepositoryProvider,
                          [NotNull] ITagProvider tagProvider,
                          [NotNull] IUnitOfWork unitOfWork)
        {
            if (tagDataSourceProvider == null)
            {
                throw new ArgumentNullException(nameof(tagDataSourceProvider));
            }
            if (tagEntityProvider == null)
            {
                throw new ArgumentNullException(nameof(tagEntityProvider));
            }
            if (tagEntityRepositoryProvider == null)
            {
                throw new ArgumentNullException(nameof(tagEntityRepositoryProvider));
            }
            if (tagProvider == null)
            {
                throw new ArgumentNullException(nameof(tagProvider));
            }
            if (unitOfWork == null)
            {
                throw new ArgumentNullException(nameof(unitOfWork));
            }

            _tagDataSourceProvider       = tagDataSourceProvider;
            _tagEntityProvider           = tagEntityProvider;
            _tagEntityRepositoryProvider = tagEntityRepositoryProvider;
            _tagProvider = tagProvider;
            _unitOfWork  = unitOfWork;
        }
Beispiel #17
0
        public void Process(StringBuilder output, 
                            MerchantTribe.Commerce.MerchantTribeApplication app, 
                            dynamic viewBag,
                            ITagProvider tagProvider, 
                            ParsedTag tag, 
                            string innerContents)
        {            
            bool secure = app.IsCurrentRequestSecure();            
            string mode = tag.GetSafeAttribute("mode");

            if (mode == "system")
            {
                string baseScriptFolder = app.CurrentStore.RootUrl();
                if (secure) baseScriptFolder = app.CurrentStore.RootUrlSecure();
                if (baseScriptFolder.EndsWith("/") == false)
                {
                    baseScriptFolder += "/";
                }
                baseScriptFolder += "scripts/";

                bool useCDN = false;
                string cdn = tag.GetSafeAttribute("cdn");
                if (cdn == "1" || cdn == "true" || cdn == "y" || cdn == "Y") useCDN = true;

                if (useCDN)
                {
                    // CDN JQuery
                    if (secure)
                    {
                        output.Append("<script src='https://ajax.microsoft.com/ajax/jQuery/jquery-1.5.1.min.js' type=\"text/javascript\"></script>");
                    }
                    else
                    {
                        output.Append("<script src='http://ajax.microsoft.com/ajax/jQuery/jquery-1.5.1.min.js' type=\"text/javascript\"></script>");
                    }
                }
                else
                {
                    // Local JQuery
                    output.Append("<script src='" + baseScriptFolder + "jquery-1.5.1.min.js' type=\"text/javascript\"></script>");
                }
                output.Append(System.Environment.NewLine);

                output.Append("<script src='" + baseScriptFolder + "jquery-ui-1.8.7.custom/js/jquery-ui-1.8.7.custom.min.js' type=\"text/javascript\"></script>");
                output.Append("<script src='" + baseScriptFolder + "jquery.form.js' type=\"text/javascript\"></script>");
                output.Append(System.Environment.NewLine);
            }
            else
            {
                string src = tag.GetSafeAttribute("src");
                string fileName = tag.GetSafeAttribute("file");
                if (fileName.Trim().Length > 0)
                {
                    var tm = app.ThemeManager();
                    src = tm.ThemeFileUrl(fileName, app);
                }
                output.Append("<script src=\"" + src + "\" type=\"text/javascript\"></script>");
            }            
        }
Beispiel #18
0
 public void Process(StringBuilder output, 
                     MerchantTribeApplication app, 
                     dynamic viewBag, 
                     ITagProvider tagProvider, 
                     ParsedTag tag, string contents)
 {
     Render(output, app, viewBag);
 }
Beispiel #19
0
 public DeleteController(IPostProvider postProvider, ICategoryProvider categoryProvider, ITagProvider tagProvider,
                         ICommentProvider commentProvider)
 {
     _postProvider     = postProvider;
     _categoryProvider = categoryProvider;
     _tagProvider      = tagProvider;
     _commentProvider  = commentProvider;
 }
Beispiel #20
0
 public void Process(StringBuilder output,
                     MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag, string contents)
 {
     Render(output, app, viewBag);
 }
Beispiel #21
0
        public void Process(StringBuilder output, 
                            MerchantTribe.Commerce.MerchantTribeApplication app, 
                            dynamic viewBag,
                            ITagProvider tagProvider, 
                            ParsedTag tag, 
                            string innerContents)
        {
            
            int linksPerRow = 9;
            string tryLinksPerRow = tag.GetSafeAttribute("linksperrow");
            int temp1 = -1;
            if (int.TryParse(tryLinksPerRow, out temp1)) linksPerRow = temp1;
            if (linksPerRow < 1) linksPerRow = 1;

            int maxLinks = 9;
            int temp2 = -1;
            string tryMaxLinks = tag.GetSafeAttribute("maxlinks");
            if (int.TryParse(tryMaxLinks, out temp2)) maxLinks = temp2;
            if (maxLinks < 1) maxLinks = 1;

            int tabIndex = 0;
            string tryTabIndex = tag.GetSafeAttribute("tabindex");
            int.TryParse(tryTabIndex, out tabIndex);
            if (tabIndex < 0) tabIndex = 0;

            

            MainMenuViewModel model = new MainMenuViewModel();
            model.LinksPerRow = linksPerRow;
            model.MaxLinks = maxLinks;            

            //Find Categories to Display in Menu
            List<MerchantTribe.Commerce.Catalog.CategorySnapshot> categories = app.CatalogServices.Categories.FindForMainMenu();

            int tempTabIndex = 0;
            foreach (var c in categories)
            {
                var l = new MainMenuViewModelLink();
                l.AltText = c.MetaTitle;
                l.DisplayName = c.Name;
                l.TabIndex = tempTabIndex;
                l.Target = string.Empty;
                l.IsActive = false;
                l.Url = MerchantTribe.Commerce.Utilities.UrlRewriter.BuildUrlForCategory(c, app.CurrentRequestContext.RoutingContext);

                if (c.Bvin == SessionManager.CategoryLastId) l.IsActive = true;
                if (c.SourceType == MerchantTribe.Commerce.Catalog.CategorySourceType.CustomLink ||
                    c.SourceType == MerchantTribe.Commerce.Catalog.CategorySourceType.CustomPage)
                {
                    if (c.CustomPageOpenInNewWindow) l.Target = "_blank";
                }

                model.Links.Add(l);
                tempTabIndex += 1;
            }

            Render(output, model);            
        }
Beispiel #22
0
 public void Process(StringBuilder output,
                     MerchantTribe.Commerce.MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag,
                     string innerContents)
 {
     output.Append(MerchantTribe.Commerce.Utilities.HtmlRendering.PromoTag());
 }
 public void Process(List<ITemplateAction> actions, MerchantTribe.Commerce.MerchantTribeApplication app, ITagProvider tagProvider, ParsedTag tag, string innerContents)
 {
     StringBuilder sb = new StringBuilder();
     foreach (string s in app.CurrentRequestContext.TempMessages)
     {
         sb.Append(s);
     }
     actions.Add(new Actions.LiteralText(sb.ToString()));
 }
Beispiel #24
0
 public ConsoleTagCloudBuilder(
     ITagProvider tagProvider,
     ITagCloudVisualizator visualizator,
     ITagCloudBuilderProperties properties)
 {
     this.tagProvider  = tagProvider;
     this.visualizator = visualizator;
     this.properties   = properties;
 }
 public void Process(StringBuilder output,
                     MerchantTribe.Commerce.MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag,
                     string innerContents)
 {
     output.Append(Render(app, viewBag));
 }
Beispiel #26
0
 public void Process(StringBuilder output,
                     MerchantTribe.Commerce.MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag,
                     string innerContents)
 {
     output.Append((string)viewBag.analyticsbottom);
 }
Beispiel #27
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));
        }
Beispiel #28
0
        public void Process(List<ITemplateAction> actions, MerchantTribe.Commerce.MerchantTribeApplication app, ITagProvider tagProvider, ParsedTag tag, string innerContents)
        {
            string byParam = tag.GetSafeAttribute("by");

            dynamic model = new ExpandoObject();
            model.By = byParam;

            actions.Add(new Actions.PartialView("~/views/shared/_copyright.cshtml", model));
        }
 public void Process(StringBuilder output,
                     MerchantTribe.Commerce.MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag,
                     string innerContents)
 {
     output.Append((string)viewBag.analyticsbottom);
 }
Beispiel #30
0
 public void Process(StringBuilder output, 
                     MerchantTribe.Commerce.MerchantTribeApplication app, 
                     dynamic viewBag,
                     ITagProvider tagProvider, 
                     ParsedTag tag, 
                     string innerContents)
 {
    output.Append(MerchantTribe.Commerce.Utilities.HtmlRendering.PromoTag());
 }
 public void Process(StringBuilder output,
                     MerchantTribe.Commerce.MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag,
                     string innerContents)
 {
     output.Append(Render(app, viewBag));
 }
Beispiel #32
0
        void ITagHandler.Process(List<ITemplateAction> actions, MerchantTribeApplication app, ITagProvider tagProvider, ParsedTag tag, string innerContents)
        {
            string partName = tag.GetSafeAttribute("part");

            ThemeManager tm = app.ThemeManager();
            string result = tm.GetTemplatePartFromCurrentTheme(partName);
            Processor proc = new Processor(app, result, tagProvider);
            var subActions = proc.RenderForDisplay();
            actions.AddRange(subActions);
        }
 public void Process(StringBuilder output, 
                     MerchantTribe.Commerce.MerchantTribeApplication app, 
                     dynamic viewBag, 
                     ITagProvider tagProvider, 
                     ParsedTag tag, 
                     string innerContents)
 {
     var rendered = MiniProfiler.RenderIncludes();            
     output.Append(rendered.ToHtmlString());            
 }
Beispiel #34
0
        public void Process(StringBuilder output,
                            MerchantTribe.Commerce.MerchantTribeApplication app,
                            dynamic viewBag,
                            ITagProvider tagProvider,
                            ParsedTag tag,
                            string innerContents)
        {
            List <BreadCrumbItem> extras = new List <BreadCrumbItem>();

            string[] parts = innerContents.Split(',');
            if (parts.Length > 0)
            {
                foreach (string p in parts)
                {
                    string[] linkParts = p.Split('|');
                    if (linkParts.Length > 0)
                    {
                        string name = linkParts[0].Trim();
                        if (name.Length > 0)
                        {
                            BreadCrumbItem item = new BreadCrumbItem();
                            item.Name = linkParts[0].Trim();
                            item.Link = "";
                            if (linkParts.Length > 1)
                            {
                                item.Link = linkParts[1].Trim();
                            }
                            extras.Add(item);
                        }
                    }
                }
            }

            string mode = tag.GetSafeAttribute("mode");

            if (mode == "manual")
            {
                output.Append(RenderManual(app, extras));
            }
            else
            {
                if (app.CurrentRequestContext.CurrentProduct != null)
                {
                    output.Append(RenderProduct(app, extras));
                }
                else if (app.CurrentRequestContext.CurrentCategory != null)
                {
                    output.Append(RenderCategory(app, extras));
                }
                else
                {
                    output.Append(RenderManual(app, extras));
                }
            }
        }
Beispiel #35
0
        public void Process(StringBuilder output, 
                            MerchantTribe.Commerce.MerchantTribeApplication app, 
                            dynamic viewBag,
                            ITagProvider tagProvider, 
                            ParsedTag tag, 
                            string innerContents)
        {
            List<BreadCrumbItem> extras = new List<BreadCrumbItem>();

            string[] parts = innerContents.Split(',');
            if (parts.Length > 0)
            {
                foreach (string p in parts)
                {
                    string[] linkParts = p.Split('|');
                    if (linkParts.Length > 0)
                    {
                        string name = linkParts[0].Trim();
                        if (name.Length > 0)
                        {
                            BreadCrumbItem item = new BreadCrumbItem();
                            item.Name = linkParts[0].Trim();
                            item.Link = "";
                            if (linkParts.Length > 1)
                            {
                                item.Link = linkParts[1].Trim();
                            }
                            extras.Add(item);
                        }
                    }
                }
            }

            string mode = tag.GetSafeAttribute("mode");
            if (mode == "manual")
            {
                output.Append(RenderManual(app, extras));
            }
            else
            {
                if (app.CurrentRequestContext.CurrentProduct != null)
                {
                    output.Append(RenderProduct(app, extras));
                }
                else if (app.CurrentRequestContext.CurrentCategory != null)
                {
                    output.Append(RenderCategory(app, extras));                    
                }
                else
                {
                    output.Append(RenderManual(app, extras));
                }
            }
        }
Beispiel #36
0
        public void Process(StringBuilder output,
                            MerchantTribe.Commerce.MerchantTribeApplication app,
                            dynamic viewBag,
                            ITagProvider tagProvider,
                            ParsedTag tag,
                            string innerContents)
        {
            var rendered = MiniProfiler.RenderIncludes();

            output.Append(rendered.ToHtmlString());
        }
Beispiel #37
0
 public void Process(StringBuilder output, 
                     MerchantTribe.Commerce.MerchantTribeApplication app, 
                     dynamic viewBag,
                     ITagProvider tagProvider, 
                     ParsedTag tag, 
                     string innerContents)
 {
     string title = viewBag.PageTitle;
     if (string.IsNullOrEmpty(title)) title = viewBag.Title;
     output.Append(HttpUtility.HtmlEncode(title));
 }
        public void Process(StringBuilder output,
                            MerchantTribe.Commerce.MerchantTribeApplication app,
                            dynamic viewBag,
                            ITagProvider tagProvider,
                            ParsedTag tag,
                            string innerContents)
        {
            var profiler = MiniProfiler.Current;

            var model = new List <SingleCategoryViewModel>();

            int columns = tag.GetSafeAttributeAsInteger("columns");

            if (columns < 1)
            {
                columns = 3;
            }

            string source = tag.GetSafeAttribute("source");

            switch (source.Trim().ToLowerInvariant())
            {
            case "manual":
                string        manualBvins = tag.GetSafeAttribute("categories");
                List <string> bvins       = manualBvins.Split(',').ToList();
                model = PrepSubCategories(app.CatalogServices.Categories.FindManySnapshots(bvins), app);
                break;

            default:
                using (profiler.Step("Pull Products for Category"))
                {
                    var cat = app.CurrentRequestContext.CurrentCategory;


                    string categoryId = tag.GetSafeAttribute("categories");
                    using (profiler.Step("Checking for non-current category on grid"))
                    {
                        if (categoryId.Trim().Length < 1 || categoryId.Trim().ToLowerInvariant() == "current")
                        {
                            if (app.CurrentRequestContext.CurrentCategory != null)
                            {
                                categoryId = app.CurrentRequestContext.CurrentCategory.Bvin;
                                cat        = app.CatalogServices.Categories.Find(categoryId);
                            }
                        }
                    }

                    model = PrepSubCategories(app.CatalogServices.Categories.FindVisibleChildren(cat.Bvin), app);
                }
                break;
            }

            Render(output, app, viewBag, model, columns);
        }
Beispiel #39
0
 public EditController(IPostProvider postProvider, ICategoryProvider categoryProvider, ITagProvider tagProvider,
                       ICommentProvider commentProvider, TagAdminMapper tagMapper, CategoryAdminMapper categoryMapper,
                       PostAdminMapper postMapper)
 {
     _postProvider     = postProvider;
     _categoryProvider = categoryProvider;
     _tagProvider      = tagProvider;
     _commentProvider  = commentProvider;
     _tagMapper        = tagMapper;
     _categoryMapper   = categoryMapper;
     _postMapper       = postMapper;
 }
        public void Process(List<ITemplateAction> actions, MerchantTribe.Commerce.MerchantTribeApplication app, ITagProvider tagProvider, ParsedTag tag, string innerContents)
        {
            List<BreadCrumbItem> extras = new List<BreadCrumbItem>();

            string[] parts = innerContents.Split(',');
            if (parts.Length > 0)
            {
                foreach (string p in parts)
                {
                    string[] linkParts = p.Split('|');
                    if (linkParts.Length > 0)
                    {
                        string name = linkParts[0].Trim();
                        if (name.Length > 0)
                        {
                            BreadCrumbItem item = new BreadCrumbItem();
                            item.Name = linkParts[0].Trim();
                            item.Link = "";
                            if (linkParts.Length > 1)
                            {
                                item.Link = linkParts[1].Trim();
                            }
                            extras.Add(item);
                        }
                    }
                }
            }

            string mode = tag.GetSafeAttribute("mode");
            if (mode == "manual")
            {
                actions.Add(new Actions.CallAction("BreadCrumb", "ManualTrail",
                        new { extras = extras }));
            }
            else
            {
                if (app.CurrentRequestContext.CurrentProduct != null)
                {
                    actions.Add(new Actions.CallAction("BreadCrumb", "ProductTrail",
                        new { product = app.CurrentRequestContext.CurrentProduct, extras = extras }));
                }
                else if (app.CurrentRequestContext.CurrentCategory != null)
                {
                    actions.Add(new Actions.CallAction("BreadCrumb", "CategoryTrail",
                        new { cat = app.CurrentRequestContext.CurrentCategory, extras = extras }));
                }
                else
                {
                    actions.Add(new Actions.CallAction("BreadCrumb", "ManualTrail",
                        new { extras = extras }));
                }
            }
        }
Beispiel #41
0
 public void Process(StringBuilder output, 
                     MerchantTribe.Commerce.MerchantTribeApplication app, 
                     dynamic viewBag,
                     ITagProvider tagProvider, 
                     ParsedTag tag, 
                     string innerContents)
 {            
     foreach (string s in app.CurrentRequestContext.TempMessages)
     {
         output.Append(s);
     }                        
 }
Beispiel #42
0
 public void Process(StringBuilder output,
                     MerchantTribe.Commerce.MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag,
                     string innerContents)
 {
     foreach (string s in app.CurrentRequestContext.TempMessages)
     {
         output.Append(s);
     }
 }
 public ApiService
 (
     IApiRepository repository,
     INowProvider nowProvider,
     ITagProvider tagProvider,
     ILogger <ApiService> logger
 )
 {
     _repository  = repository;
     _nowProvider = nowProvider;
     _tagProvider = tagProvider;
     _logger      = logger;
 }
Beispiel #44
0
        public void Process(StringBuilder output, 
                            MerchantTribe.Commerce.MerchantTribeApplication app, 
                            dynamic viewBag,
                            ITagProvider tagProvider, 
                            ParsedTag tag, 
                            string innerContents)
        {            
            string byParam = tag.GetSafeAttribute("by");
            
            dynamic model = new ExpandoObject();
            model.By = byParam;

            output.Append(Render(model));
        }
Beispiel #45
0
 public void Process(StringBuilder output,
                     MerchantTribe.Commerce.MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag,
                     string innerContents)
 {
     string id = tag.GetSafeAttribute("id");
     if (!string.IsNullOrEmpty((string)viewBag.BodyClass))
     {
         id = viewBag.BodyClass;
     }
     output.Append("<body id=\"" + id + "\">");
 }
Beispiel #46
0
 public void Process(StringBuilder output, 
     MerchantTribe.Commerce.MerchantTribeApplication app,
     dynamic viewBag,
     ITagProvider tagProvider,
     ParsedTag tag,
     string innerContents)
 {
     output.Append("<meta name=\"keywords\" content=\"" + HttpUtility.HtmlEncode((string)viewBag.MetaKeywords) + "\" />");
     output.Append("<meta name=\"description\" content=\"" + HttpUtility.HtmlEncode((string)viewBag.MetaDescription) + "\" />");
     if (!String.IsNullOrEmpty(viewBag.AdditionalMetaTags))
     {
         output.Append((string)viewBag.AdditionalMetaTags);
     }
 }
Beispiel #47
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);            
        }
Beispiel #48
0
 public void Process(StringBuilder output,
                     MerchantTribe.Commerce.MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag,
                     string innerContents)
 {
     output.Append("<meta name=\"keywords\" content=\"" + HttpUtility.HtmlEncode((string)viewBag.MetaKeywords) + "\" />");
     output.Append("<meta name=\"description\" content=\"" + HttpUtility.HtmlEncode((string)viewBag.MetaDescription) + "\" />");
     if (!String.IsNullOrEmpty(viewBag.AdditionalMetaTags))
     {
         output.Append((string)viewBag.AdditionalMetaTags);
     }
 }
Beispiel #49
0
        void ITagHandler.Process(StringBuilder output, 
            MerchantTribeApplication app,
            dynamic viewBag,
            ITagProvider tagProvider,
            ParsedTag tag,
            string innerContents)
        {
            string partName = tag.GetSafeAttribute("part");

            ThemeManager tm = app.ThemeManager();
            string result = tm.GetTemplatePartFromCurrentTheme(partName);
            Processor proc = new Processor(app, viewBag, result, tagProvider);
            proc.RenderForDisplay(output);
        }
Beispiel #50
0
        public void Process(StringBuilder output,
                            MerchantTribe.Commerce.MerchantTribeApplication app,
                            dynamic viewBag,
                            ITagProvider tagProvider,
                            ParsedTag tag,
                            string innerContents)
        {
            string byParam = tag.GetSafeAttribute("by");

            dynamic model = new ExpandoObject();

            model.By = byParam;

            output.Append(Render(model));
        }
Beispiel #51
0
        public void Process(StringBuilder output,
                            MerchantTribe.Commerce.MerchantTribeApplication app,
                            dynamic viewBag,
                            ITagProvider tagProvider,
                            ParsedTag tag,
                            string innerContents)
        {
            string title = viewBag.PageTitle;

            if (string.IsNullOrEmpty(title))
            {
                title = viewBag.Title;
            }
            output.Append(HttpUtility.HtmlEncode(title));
        }
 public RecentsController(ICategoryProvider categoryProvider, ICommentProvider commentProvider,
                          IPostProvider postProvider, ITagProvider tagProvider, TagMapper tagMapper,
                          CommentMapper commentMapper, CategoryMapper categoryMapper,
                          PostMapper postMapper, RecentContentMapper recentContentMapper)
 {
     _categoryProvider    = categoryProvider;
     _commentProvider     = commentProvider;
     _postProvider        = postProvider;
     _tagProvider         = tagProvider;
     _postMapper          = postMapper;
     _categoryMapper      = categoryMapper;
     _commentMapper       = commentMapper;
     _tagMapper           = tagMapper;
     _recentContentMapper = recentContentMapper;
 }
Beispiel #53
0
        public void Process(StringBuilder output,
                            MerchantTribe.Commerce.MerchantTribeApplication app,
                            dynamic viewBag,
                            ITagProvider tagProvider,
                            ParsedTag tag,
                            string innerContents)
        {
            string id = tag.GetSafeAttribute("id");

            if (!string.IsNullOrEmpty((string)viewBag.BodyClass))
            {
                id = viewBag.BodyClass;
            }
            output.Append("<body id=\"" + id + "\">");
        }
Beispiel #54
0
        void ITagHandler.Process(StringBuilder output,
                                 MerchantTribeApplication app,
                                 dynamic viewBag,
                                 ITagProvider tagProvider,
                                 ParsedTag tag,
                                 string innerContents)
        {
            string partName = tag.GetSafeAttribute("part");

            ThemeManager tm     = app.ThemeManager();
            string       result = tm.GetTemplatePartFromCurrentTheme(partName);
            Processor    proc   = new Processor(app, viewBag, result, tagProvider);

            proc.RenderForDisplay(output);
        }
Beispiel #55
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);
        }
        public void Process(StringBuilder output,
                            MerchantTribe.Commerce.MerchantTribeApplication app,
                            dynamic viewBag,
                            ITagProvider tagProvider,
                            ParsedTag tag,
                            string innerContents)
        {
            var profiler = MiniProfiler.Current;
                        
            var model = new List<SingleCategoryViewModel>();

            int columns = tag.GetSafeAttributeAsInteger("columns");
            if (columns < 1) columns = 3;                
            
            string source = tag.GetSafeAttribute("source");
            switch (source.Trim().ToLowerInvariant())
            {
                case "manual":
                    string manualBvins = tag.GetSafeAttribute("categories");
                    List<string> bvins = manualBvins.Split(',').ToList();
                    model = PrepSubCategories(app.CatalogServices.Categories.FindManySnapshots(bvins), app);                    
                    break;
                default:
                    using (profiler.Step("Pull Products for Category"))
                    {
                        var cat = app.CurrentRequestContext.CurrentCategory;
                        

                        string categoryId = tag.GetSafeAttribute("categories");
                        using (profiler.Step("Checking for non-current category on grid"))
                        {
                            if (categoryId.Trim().Length < 1 || categoryId.Trim().ToLowerInvariant() == "current")
                            {
                                if (app.CurrentRequestContext.CurrentCategory != null)
                                {
                                    categoryId = app.CurrentRequestContext.CurrentCategory.Bvin;
                                    cat = app.CatalogServices.Categories.Find(categoryId);
                                }
                            }
                        }

                        model = PrepSubCategories(app.CatalogServices.Categories.FindVisibleChildren(cat.Bvin), app);                                            
                    }
                    break;
            }

            Render(output, app, viewBag, model, columns);
        }
        public void Process(StringBuilder output,
                            MerchantTribe.Commerce.MerchantTribeApplication app,
                            dynamic viewBag,
                            ITagProvider tagProvider,
                            ParsedTag tag,
                            string innerContents)
        {
            var category = app.CurrentRequestContext.CurrentCategory;

            if (category != null)
            {
                if (category.ShowTitle == true)
                {
                    output.Append("<h1>" + HttpUtility.HtmlEncode(category.Name) + "</h1>");
                }
            }
        }
Beispiel #58
0
        public void Process(StringBuilder output,
                            MerchantTribe.Commerce.MerchantTribeApplication app,
                            dynamic viewBag,
                            ITagProvider tagProvider,
                            ParsedTag tag,
                            string innerContents)
        {
            string bvin = tag.GetSafeAttribute("bvin");
            string sku  = tag.GetSafeAttribute("sku");

            var product = app.CatalogServices.Products.Find(bvin);

            if (product == null)
            {
                product = app.CatalogServices.Products.FindBySku(sku);
            }

            Render(output, product, app);
        }
        public void Setup()
        {
            WebAppSettings.SetUnitTestPhysicalPath(@"C:\git\MerchantTribe\App\MerchantTribeStore");

            context = ContextHelper.GetFakeRequestContext("", "http://demo.localhost.dev/", "");
            app     = MerchantTribeApplication.InstantiateForMemory(context);

            viewBag = new DynamicViewDataDictionary(() => new System.Web.Mvc.ViewDataDictionary());
            //viewBag.RootUrlSecure = app.StoreUrl(true, false);
            //viewBag.RootUrl = app.StoreUrl(false, true);
            //viewBag.StoreClosed = app.CurrentStore.Settings.StoreClosed;
            //viewBag.StoreName = app.CurrentStore.Settings.FriendlyName;
            //viewBag.StoreUniqueId = app.CurrentStore.StoreUniqueId(app);
            viewBag.CustomerIp = "0.0.0.0";
            //viewBag.CustomerId = app.CurrentCustomerId ?? string.Empty;
            //viewBag.HideAnalytics = app.CurrentStore.Settings.Analytics.DisableMerchantTribeAnalytics;

            tagProvider = new TagProvider();
        }
Beispiel #60
0
        public void Process(StringBuilder output,
                            MerchantTribe.Commerce.MerchantTribeApplication app,
                            dynamic viewBag,
                            ITagProvider tagProvider,
                            ParsedTag tag,
                            string innerContents)
        {
            string colId = tag.GetSafeAttribute("columnid");

            if (string.IsNullOrEmpty(colId))
            {
                colId = tag.GetSafeAttribute("id");
            }
            if (string.IsNullOrEmpty(colId))
            {
                colId = tag.GetSafeAttribute("columnname");
            }

            RenderColumn(output, colId, app, viewBag);
        }