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())); }
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); }
public virtual SC3StringSegment DeserializeTag(ParsedTag tag) { switch (tag.Name) { case "color": return(DeserializeColorTag(tag)); case "margin": return(DeserializeMarginTag(tag)); case "font": return(DeserializeFontSizeTag(tag)); case "center": return(new CenterTextCommand()); case "%p": return(new PresentCommand(false)); case "%e": return(new PresentCommand(true)); default: return(DeserializeMarker(tag)); } }
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 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)); }
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); }
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 + ">"); } }
public string ReturnCorrectRepresentation_WithNoProperties(string value, Tag tag) { var parsedTag = ParsedTag.Create(TagInfo.Create(tag, TagPosition.None, 0)); // works bad with header tag parsedTag.Value = value; return(parsedTag.GetCurrentRepresentation()); }
private Marker DeserializeMarker(ParsedTag tag) { switch (tag.Name.ToLowerInvariant()) { case "%n": return(new Marker(MarkerKind.LineSeperator)); case "name": return(new Marker(MarkerKind.CharacterName)); case "line": return(new Marker(MarkerKind.DialogueLine)); case "rubybase": return(new Marker(MarkerKind.RubyBase)); case "rubytextstart": return(new Marker(MarkerKind.RubyTextStart)); case "rubytextend": return(new Marker(MarkerKind.RubyTextEnd)); case "and": return(new Marker(MarkerKind.NameAndCode)); case "temp": return(new Marker(MarkerKind.TempMarker)); default: throw new InvalidDataException(); } }
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); }
private SetColorCommand DeserializeColorTag(ParsedTag tag) { string index = tag.GetAttribute("index"); var bytes = BinaryUtils.HexStrToBytes(index); return(new SetColorCommand(SC3ExpressionParser.ParseExpression(bytes))); }
public string Process(MerchantTribeApplication app, Dictionary<string, ITagHandler> handlers, ParsedTag tag, string contents) { 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>"); return sb.ToString(); }
public string Process(MerchantTribeApplication app, Dictionary<string, ITagHandler> handlers, ParsedTag tag, string contents) { string fileUrl = string.Empty; bool secure = app.CurrentRequestContext.RoutingContext.HttpContext.Request.IsSecureConnection; ThemeManager 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\" />"; return result; }
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); }
public string Process(MerchantTribeApplication app, Dictionary<string, ITagHandler> handlers, ParsedTag tag, string contents) { string result = string.Empty; Orders.Order o = new Orders.Order(); if (app.CurrentRequestContext.CurrentReceiptOrder != null) { o = app.CurrentRequestContext.CurrentReceiptOrder; // Adwords Tracker at bottom if needed if (app.CurrentStore.Settings.Analytics.UseGoogleAdWords) { result = MerchantTribe.Commerce.Metrics.GoogleAnalytics.RenderGoogleAdwordTracker( o.TotalGrand, app.CurrentStore.Settings.Analytics.GoogleAdWordsId, app.CurrentStore.Settings.Analytics.GoogleAdWordsLabel, app.CurrentStore.Settings.Analytics.GoogleAdWordsBgColor, app.CurrentRequestContext.RoutingContext.HttpContext.Request.IsSecureConnection); } // Add Yahoo Tracker to Bottom if Needed if (app.CurrentStore.Settings.Analytics.UseYahooTracker) { result += MerchantTribe.Commerce.Metrics.YahooAnalytics.RenderYahooTracker( o, app.CurrentStore.Settings.Analytics.YahooAccountId); } } return result; }
public string Process(MerchantTribeApplication app, Dictionary<string, ITagHandler> handlers, ParsedTag tag, string contents) { StringBuilder sb = new StringBuilder(); bool isSecureRequest = app.CurrentRequestContext.RoutingContext.HttpContext.Request.IsSecureConnection; bool textOnly = false; 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; sb.Append("<a href=\"" + storeRootUrl + "\" title=\"" + storeName + "\""); if (contents.Trim().Length > 0) { sb.Append(">"); sb.Append(contents); } else if (app.CurrentStore.Settings.UseLogoImage && textOnly == false) { sb.Append("><img src=\"" + logoImage + "\" alt=\"" + storeName + "\" />"); } else { sb.Append(" class=\"logo\">"); sb.Append(System.Web.HttpUtility.HtmlEncode(logoText)); } sb.Append("</a>"); return sb.ToString(); }
public string Process(MerchantTribeApplication app, Dictionary<string, ITagHandler> handlers, 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); return result; }
private SetFontSizeCommand DeserializeFontSizeTag(ParsedTag tag) { string strSize = tag.GetAttribute("size"); int size = int.Parse(strSize); return(new SetFontSizeCommand(size)); }
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 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>"); } }
public void Process(StringBuilder output, MerchantTribeApplication app, dynamic viewBag, ITagProvider tagProvider, ParsedTag tag, string contents) { Render(output, app, viewBag); }
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); }
public string Process(MerchantTribeApplication app, Dictionary<string, ITagHandler> handlers, ParsedTag tag, string contents) { StringBuilder sb = new StringBuilder(); bool secure = app.CurrentRequestContext.RoutingContext.HttpContext.Request.IsSecureConnection; 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) { sb.Append("<script src='https://ajax.microsoft.com/ajax/jQuery/jquery-1.5.1.min.js' type=\"text/javascript\"></script>"); } else { sb.Append("<script src='http://ajax.microsoft.com/ajax/jQuery/jquery-1.5.1.min.js' type=\"text/javascript\"></script>"); } } else { // Local JQuery sb.Append("<script src='" + baseScriptFolder + "jquery-1.5.1.min.js' type=\"text/javascript\"></script>"); } sb.Append(System.Environment.NewLine); sb.Append("<script src='" + baseScriptFolder + "jquery-ui-1.8.7.custom/js/jquery-ui-1.8.7.custom.min.js' type=\"text/javascript\"></script>"); sb.Append("<script src='" + baseScriptFolder + "jquery.form.js' type=\"text/javascript\"></script>"); sb.Append(System.Environment.NewLine); } else { string src = tag.GetSafeAttribute("src"); string fileName = tag.GetSafeAttribute("file"); if (fileName.Trim().Length > 0) { ThemeManager tm = app.ThemeManager(); src = tm.ThemeFileUrl(fileName, app); } sb.Append("<script src=\"" + src + "\" type=\"text/javascript\"></script>"); } return sb.ToString(); }
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((string)viewBag.analyticsbottom); }
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())); }
public void Process(StringBuilder output, MerchantTribe.Commerce.MerchantTribeApplication app, dynamic viewBag, ITagProvider tagProvider, ParsedTag tag, string innerContents) { output.Append(Render(app, viewBag)); }
private void PassAttribute(ref StringBuilder sb, ParsedTag tag, string name) { string value = tag.GetSafeAttribute(name); if (value.Length > 0) { sb.Append(" " + name + "=\"" + value + "\""); } }
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(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)); }
public string Process(MerchantTribeApplication app, Dictionary<string, ITagHandler> handlers, ParsedTag tag, string contents) { string partName = tag.GetSafeAttribute("part"); ThemeManager tm = app.ThemeManager(); string result = tm.GetTemplatePartFromCurrentTheme(partName); TemplateProcessor proc = new TemplateProcessor(app, result, handlers); string processed = proc.RenderForDisplay(); return processed; }
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()); }
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)); } } }
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)); } } }
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); }
public string Process(MerchantTribeApplication app, Dictionary<string, ITagHandler> handlers, ParsedTag tag, string contents) { StringBuilder sb = new StringBuilder(); foreach (string s in app.CurrentRequestContext.TempMessages) { sb.Append(s); } return sb.ToString(); }
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 })); } } }
public string Process(MerchantTribeApplication app, Dictionary<string, ITagHandler> handlers, ParsedTag tag, string contents) { StringBuilder sb = new StringBuilder(); string rootUrl = app.StoreUrl(false, true); string buttonUrl = app.ThemeManager().ButtonUrl("Go", app.CurrentRequestContext.RoutingContext.HttpContext.Request.IsSecureConnection); sb.Append("<form class=\"searchform\" action=\"" + rootUrl + "search\" method=\"get\">"); sb.Append("<input type=\"text\" name=\"q\" class=\"searchinput\" /> <input class=\"searchgo\" type=\"image\" src=\"" + buttonUrl + "\" alt=\"Search\" />"); sb.Append("</form>"); return sb.ToString(); }
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 void ReturnCorrectHyperlinkRepresentation() { var parsedTag = ParsedTag.Create(new HyperlinkTagInfo(new TagType(TagPosition.None, 0))); parsedTag.Value = "some_text"; parsedTag.AddProperty("href", "ya.ru"); var expectedResult = "<a href=\"ya.ru\">some_text</a>"; var actualResult = parsedTag.GetCurrentRepresentation(); actualResult.Should().Be(expectedResult); }
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); } }
public override SC3StringSegment DeserializeTag(ParsedTag tag) { if (IsNumber(tag.Name)) { return(null); } if (tag.Name == "comment") { return(null); } return(base.DeserializeTag(tag)); }
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)); }
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); }
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 + "\">"); }
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) { string byParam = tag.GetSafeAttribute("by"); dynamic model = new ExpandoObject(); model.By = byParam; output.Append(Render(model)); }
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>"); } } }
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 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); }
private SetMarginCommand DeserializeMarginTag(ParsedTag tag) { if (!tag.Attributes.Any()) { throw new InvalidDataException(); } var attr = tag.Attributes.First(); switch (attr.Key) { case "left": return(new SetMarginCommand(int.Parse(attr.Value), null)); case "top": return(new SetMarginCommand(null, int.Parse(attr.Value))); default: throw new InvalidDataException(); } }