コード例 #1
0
ファイル: Area.cs プロジェクト: appliedi/MerchantTribe
        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);
        }
コード例 #2
0
ファイル: Area.cs プロジェクト: mikeshane/MerchantTribe
        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);
        }
コード例 #3
0
ファイル: PageMenu.cs プロジェクト: NightOwl888/MerchantTribe
        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()));
        }
コード例 #4
0
ファイル: UrlFixer.cs プロジェクト: NightOwl888/MerchantTribe
        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()));
        }
コード例 #5
0
 public Processor(MerchantTribeApplication app, dynamic viewBag, string template, ITagProvider tagProvider)
 {
     this.MTApp       = app;
     this.TagProvider = tagProvider;
     this.Template    = template;
     this.ViewBag     = viewBag;
 }
コード例 #6
0
ファイル: Processor.cs プロジェクト: appliedi/MerchantTribe
 public Processor(MerchantTribeApplication app, dynamic viewBag, string template, ITagProvider tagProvider)
 {
     this.MTApp = app;
     this.TagProvider = tagProvider;
     this.Template = template;
     this.ViewBag = viewBag;
 }
コード例 #7
0
ファイル: Area.cs プロジェクト: NightOwl888/MerchantTribe
        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));
        }
コード例 #8
0
ファイル: Logo.cs プロジェクト: mikeshane/MerchantTribe
        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);
        }
コード例 #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);
        }
コード例 #10
0
 public SearchController(IPostProvider postProvider, SearchResultMapper searchResultMapper, ICategoryProvider categoryProvider, ITagProvider tagProvider)
 {
     _postProvider       = postProvider;
     _categoryProvider   = categoryProvider;
     _tagProvider        = tagProvider;
     _searchResultMapper = searchResultMapper;
 }
コード例 #11
0
ファイル: MiniPager.cs プロジェクト: appliedi/MerchantTribe
        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);
        }
コード例 #12
0
ファイル: UrlFixer.cs プロジェクト: appliedi/MerchantTribe
        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 + ">");
            }                        
        }
コード例 #13
0
ファイル: Logo.cs プロジェクト: appliedi/MerchantTribe
        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);            
        }
コード例 #14
0
ファイル: UrlFixer.cs プロジェクト: mikeshane/MerchantTribe
        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 + ">");
            }
        }
コード例 #15
0
ファイル: Css.cs プロジェクト: NightOwl888/MerchantTribe
        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));
        }
コード例 #16
0
        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;
        }
コード例 #17
0
ファイル: JavaScript.cs プロジェクト: appliedi/MerchantTribe
        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>");
            }            
        }
コード例 #18
0
ファイル: AdminPanel.cs プロジェクト: appliedi/MerchantTribe
 public void Process(StringBuilder output, 
                     MerchantTribeApplication app, 
                     dynamic viewBag, 
                     ITagProvider tagProvider, 
                     ParsedTag tag, string contents)
 {
     Render(output, app, viewBag);
 }
コード例 #19
0
 public DeleteController(IPostProvider postProvider, ICategoryProvider categoryProvider, ITagProvider tagProvider,
                         ICommentProvider commentProvider)
 {
     _postProvider     = postProvider;
     _categoryProvider = categoryProvider;
     _tagProvider      = tagProvider;
     _commentProvider  = commentProvider;
 }
コード例 #20
0
 public void Process(StringBuilder output,
                     MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag, string contents)
 {
     Render(output, app, viewBag);
 }
コード例 #21
0
ファイル: MainMenu.cs プロジェクト: appliedi/MerchantTribe
        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);            
        }
コード例 #22
0
ファイル: PromoTag.cs プロジェクト: mikeshane/MerchantTribe
 public void Process(StringBuilder output,
                     MerchantTribe.Commerce.MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag,
                     string innerContents)
 {
     output.Append(MerchantTribe.Commerce.Utilities.HtmlRendering.PromoTag());
 }
コード例 #23
0
 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()));
 }
コード例 #24
0
 public ConsoleTagCloudBuilder(
     ITagProvider tagProvider,
     ITagCloudVisualizator visualizator,
     ITagCloudBuilderProperties properties)
 {
     this.tagProvider  = tagProvider;
     this.visualizator = visualizator;
     this.properties   = properties;
 }
コード例 #25
0
 public void Process(StringBuilder output,
                     MerchantTribe.Commerce.MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag,
                     string innerContents)
 {
     output.Append(Render(app, viewBag));
 }
コード例 #26
0
 public void Process(StringBuilder output,
                     MerchantTribe.Commerce.MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag,
                     string innerContents)
 {
     output.Append((string)viewBag.analyticsbottom);
 }
コード例 #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));
        }
コード例 #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));
        }
コード例 #29
0
 public void Process(StringBuilder output,
                     MerchantTribe.Commerce.MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag,
                     string innerContents)
 {
     output.Append((string)viewBag.analyticsbottom);
 }
コード例 #30
0
ファイル: PromoTag.cs プロジェクト: appliedi/MerchantTribe
 public void Process(StringBuilder output, 
                     MerchantTribe.Commerce.MerchantTribeApplication app, 
                     dynamic viewBag,
                     ITagProvider tagProvider, 
                     ParsedTag tag, 
                     string innerContents)
 {
    output.Append(MerchantTribe.Commerce.Utilities.HtmlRendering.PromoTag());
 }
コード例 #31
0
 public void Process(StringBuilder output,
                     MerchantTribe.Commerce.MerchantTribeApplication app,
                     dynamic viewBag,
                     ITagProvider tagProvider,
                     ParsedTag tag,
                     string innerContents)
 {
     output.Append(Render(app, viewBag));
 }
コード例 #32
0
ファイル: Include.cs プロジェクト: NightOwl888/MerchantTribe
        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);
        }
コード例 #33
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());            
 }
コード例 #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));
                }
            }
        }
コード例 #35
0
ファイル: BreadCrumbs.cs プロジェクト: appliedi/MerchantTribe
        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));
                }
            }
        }
コード例 #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());
        }
コード例 #37
0
ファイル: PageTitle.cs プロジェクト: appliedi/MerchantTribe
 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));
 }
コード例 #38
0
        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);
        }
コード例 #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;
 }
コード例 #40
0
        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 }));
                }
            }
        }
コード例 #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);
     }                        
 }
コード例 #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);
     }
 }
コード例 #43
0
 public ApiService
 (
     IApiRepository repository,
     INowProvider nowProvider,
     ITagProvider tagProvider,
     ILogger <ApiService> logger
 )
 {
     _repository  = repository;
     _nowProvider = nowProvider;
     _tagProvider = tagProvider;
     _logger      = logger;
 }
コード例 #44
0
ファイル: Copyright.cs プロジェクト: appliedi/MerchantTribe
        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));
        }
コード例 #45
0
ファイル: BodyOpen.cs プロジェクト: appliedi/MerchantTribe
 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 + "\">");
 }
コード例 #46
0
ファイル: MetaTags.cs プロジェクト: mikeshane/MerchantTribe
 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);
     }
 }
コード例 #47
0
ファイル: SearchForm.cs プロジェクト: appliedi/MerchantTribe
        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);            
        }
コード例 #48
0
ファイル: MetaTags.cs プロジェクト: mikeshane/MerchantTribe
 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);
     }
 }
コード例 #49
0
ファイル: Include.cs プロジェクト: mikeshane/MerchantTribe
        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);
        }
コード例 #50
0
ファイル: Copyright.cs プロジェクト: mikeshane/MerchantTribe
        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));
        }
コード例 #51
0
ファイル: PageTitle.cs プロジェクト: mikeshane/MerchantTribe
        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));
        }
コード例 #52
0
 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;
 }
コード例 #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 + "\">");
        }
コード例 #54
0
ファイル: Include.cs プロジェクト: mikeshane/MerchantTribe
        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);
        }
コード例 #55
0
ファイル: SearchForm.cs プロジェクト: mikeshane/MerchantTribe
        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);
        }
コード例 #56
0
        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);
        }
コード例 #57
0
        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>");
                }
            }
        }
コード例 #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);
        }
コード例 #59
0
        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();
        }
コード例 #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);
        }