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(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, 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 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(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 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 fileUrl = string.Empty; bool secure = app.IsCurrentRequestSecure(); var tm = app.ThemeManager(); string mode = tag.GetSafeAttribute("mode"); if (mode == "legacy") { fileUrl = tm.CurrentStyleSheet(app, secure); } else if (mode == "system") { string cssFile = tag.GetSafeAttribute("file"); fileUrl = app.StoreUrl(secure, false) + cssFile.TrimStart('/'); } else { string fileName = tag.GetSafeAttribute("file"); fileUrl = tm.ThemeFileUrl(fileName, app); } if (fileUrl.StartsWith("http://")) { fileUrl = fileUrl.Replace("http://", "//"); } string result = string.Empty; result = "<link href=\"" + fileUrl + "\" rel=\"stylesheet\" type=\"text/css\" />"; output.Append(result); }