public static string ToHtmlType(HtmlType type) { switch (type) { case HtmlType.TextHtml: return("text/html"); case HtmlType.TextXml: return("text/xml"); case HtmlType.TextJavaScript: return("text/javascript"); case HtmlType.TextCss: return("text/css"); case HtmlType.TextJqueryTmpl: return("text/x-jquery-tmpl"); case HtmlType.TextMustacheTmpl: return("text/x-mustache-tmpl"); ////ncrunch: no coverage start default: return(string.Empty); ////ncrunch: no coverage end } }
internal static TagBuilder CreateScript(string id, HtmlType type, string src, IHtmlContent content) { var routeValueDictionary = new RouteValueDictionary(new { type = type.ToLocalization() }); if (!string.IsNullOrWhiteSpace(src)) { routeValueDictionary.Merge(new { src }); } if (!string.IsNullOrWhiteSpace(id)) { routeValueDictionary.Merge(new { id }); } return(CreateTag(HtmlTag.Script, content, routeValueDictionary)); }
static TagBuilder CreateScript(string id, HtmlType type, string src, MvcHtmlString content) { var routeValueDictionary = new RouteValueDictionary(new { type = WebEnumConvertToString.ToHtmlType(type) }); if (!string.IsNullOrWhiteSpace(src)) { routeValueDictionary.Merge(new { src }); } if (!string.IsNullOrWhiteSpace(id)) { routeValueDictionary.Merge(new { id }); } return(CreateTag(HtmlTag.Script, content, routeValueDictionary)); }
/// <summary> /// Generate the specified type of Html. /// </summary> /// <param name="type">Html type.</param> /// <returns>Generated Html.</returns> public string GenerateHtml(HtmlType type) { switch (type) { case HtmlType.PreviewHtml: return(GeneratePreviewHtml()); case HtmlType.ObjectHtml: return(_objectHtml); case HtmlType.AdaptiveHtml: return(GenerateAdaptiveHtml()); default: Debug.Fail("Unexpected SmartHtmlType"); return(GeneratePreviewHtml()); } }
///================================================================================ /// Name : PrintAdminProductTypeDDLB /// Description : <summary>관리자 지급 시 사용되는 상품 타입 리스트 박스를 정의한다.</summary> /// Author : [email protected], 2019-11-21 /// Modify History : Just Created. ///================================================================================ public static string PrintAdminProductTypeDDLB(bool boolDefault, HtmlType objHtmlType = HtmlType.freeItemProductType) { StringBuilder pl_objSb = null; try { pl_objSb = new StringBuilder(); if (boolDefault) { pl_objSb.Append(MakeOption("0", "전체", objHtmlType)); } pl_objSb.Append(MakeOption("1", "이용료", objHtmlType)); pl_objSb.Append(MakeOption("2", "레슨", objHtmlType)); } finally { } return(pl_objSb.ToString()); }
///================================================================================ /// Name : PrintProductTypeDDLB /// Description : <summary>일반 구매 시 사용되는 상품 타입 리스트 박스를 정의한다.</summary> /// Author : [email protected], 2019-11-21 /// Modify History : Just Created. ///================================================================================ public static string PrintProductTypeDDLB(bool boolDefault, HtmlType objHtmlType = HtmlType.freeItemProductType) { IDas pl_objDAS = null; StringBuilder pl_objSb = null; try { pl_objSb = new StringBuilder(); pl_objDAS = new IDas(); pl_objDAS.Open(UserGlobal.BOQ_HOST_DAS); pl_objDAS.CommandType = CommandType.StoredProcedure; pl_objDAS.CodePage = 0; pl_objDAS.AddParam("@pi_strDisplayFlag", DBType.adChar, 'Y', 1, ParameterDirection.Input); pl_objDAS.SetQuery("dbo.UP_PRODUCT_TYPE_UR_LST"); if (boolDefault) { pl_objSb.Append(MakeOption("0", "전체", objHtmlType)); } while (pl_objDAS.Read()) { pl_objSb.Append(MakeOption(pl_objDAS.GetString("PRODUCTTYPECODE"), pl_objDAS.GetString("PRODUCTTYPEDESC"), objHtmlType)); } pl_objDAS.CloseTable(); } finally { if (pl_objDAS != null) { pl_objDAS.Close(); } pl_objDAS = null; } return(pl_objSb.ToString()); }
private string GetSnapshotPathIfNeeded(HtmlType htmlType, VideoContext context) { // NOTE: We skip this behavior on IE9+ because of WinLive 589461. if (htmlType == HtmlType.ObjectHtml || ApplicationEnvironment.BrowserVersion.Major >= 9) { return(null); } try { IHTMLElement element = context.GetElement(((IInternalContent)_content).Id); if (element != null) { element = ((IHTMLDOMNode)element).firstChild as IHTMLElement; } if (element != null && (element is IViewObject)) { Bitmap snapshot = HtmlScreenCaptureCore.TakeSnapshot((IViewObject)element, element.offsetWidth, element.offsetHeight); UpdateVideoSnapshot(snapshot); } Uri uri = _content.Files.GetUri(_content.Properties.GetString(VIDEO_PUBLISH_IMAGE, String.Empty)); if (uri != null) { return(uri.ToString()); } } catch (Exception ex) { Trace.WriteLine("Failed to take video snapshot: " + ex); } return(null); }
///---------------------------------------------------------------------- /// <summary> /// option 생성.(value, text 만 입력) /// </summary> ///---------------------------------------------------------------------- private static string MakeOption(string strOptionValue, string strOptionHtml, HtmlType objHtmlType) { string strHTML = string.Empty; switch (objHtmlType) { case HtmlType.freeItemProductType: strHTML = String.Format("<option value='{0}'>{1}</option>", strOptionValue, strOptionHtml); break; case HtmlType.saleProductType: strHTML = String.Format("<li><input type='radio' name='product' id='product{0}' value='{0}'><label for='product{0}'>{1}</label></li>", strOptionValue, strOptionHtml); break; default: break; } return(strHTML); }
private string GetResponse(HtmlType type, params string[] errors) { // Create the basic html structure of the response string html = @"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.1//EN"" ""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd""> <html xmlns=""http://www.w3.org/1999/xhtml""> <head> <meta http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-1"" /> <title>Form Submission</title> {metaRefresh} </head> <body> <div style=""font: 13px arial, verdana, sans-serif; color: red; width: 400px; margin: 100px auto 0px auto; padding: 20px; border: 1px solid black; background-color: #efefef;""> {responseMessage} {googleAnalytics} </div> </body> </html>"; // Set the refresh pause and redirect if (type == HtmlType.Success) html = html.Replace("{metaRefresh}", string.Format("<meta http-equiv=\"refresh\" content=\"{0};URL={1}\" />", RefreshPause.ToString(), RedirectPage)); else html = html.Replace("{metaRefresh}", string.Empty); // Display the success message or the list of errors if (type == HtmlType.Success) { html = html.Replace("{responseMessage}", string.Format("{0}<br /><br /><em>(please wait to be redirected...)</em>", SuccessMessage)); } else { string error = string.Empty; foreach (string e in errors) error += string.Format("• {0}<br />", e); error += "<br /><input type=\"button\" value=\"««« back to form\" onclick=\"history.back(1)\" />"; html = html.Replace("{responseMessage}", error); } // Create the Google Analytics code if required if (type == HtmlType.Success && !string.IsNullOrEmpty(_googleAnalyticsAccount)) { string googleAnalytics = @"<script type=""text/javascript""> var gaJsHost = ((""https:"" == document.location.protocol) ? ""https://ssl."" : ""http://www.""); document.write(unescape(""%3Cscript src='"" + gaJsHost + ""google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"")); </script> <script type=""text/javascript""> try {{ var pageTracker = _gat._getTracker(""{0}""); pageTracker._trackPageview(""{1}""); }} catch(err) {{ }} </script>"; html = html.Replace("{googleAnalytics}", string.Format(googleAnalytics, _googleAnalyticsAccount, _googleGoalsUrl)); } else { html = html.Replace("{googleAnalytics}", string.Empty); } return html; }
private void FindElementsByType(IHtmlDocument document, HtmlType serchType) { string htmlSerchElement = null; if (serchType == HtmlType.Title) { htmlSerchElement = "title"; } else if (serchType == HtmlType.Description) { htmlSerchElement = "meta"; } else if (serchType == HtmlType.H1) { htmlSerchElement = "h1"; } else if (serchType == HtmlType.Img) { htmlSerchElement = "img"; } else if (serchType == HtmlType.Ahref) { htmlSerchElement = "a"; } else if (serchType == HtmlType.Link) { htmlSerchElement = "link"; } var foundHtmlElements = document.All.Where(d => d.LocalName == htmlSerchElement); foreach (var item in foundHtmlElements) { HtmlElements foundHtml = null; if (serchType == HtmlType.Description) { if (item.OuterHtml.Contains("name=\"description\"")) { foundHtml = new HtmlElements() { Content = item.GetAttribute("content"), }; } } else if (serchType == HtmlType.Img) { foundHtml = new HtmlElements() { Content = item.GetAttribute("src"), }; } else if (serchType == HtmlType.Ahref || serchType == HtmlType.Link) { foundHtml = new HtmlElements() { Content = item.GetAttribute("href"), }; } else { foundHtml = new HtmlElements() { Content = item.TextContent, }; } if (foundHtml != null) { foundHtml.TypeId = (int)serchType; foundHtml.Html = item.OuterHtml; foundHtml.Url = _url; FoundElements.Add(foundHtml); } } }
/// <summary> /// Generate the specified type of Html. /// </summary> /// <param name="type">Html type.</param> /// <returns>Generated Html.</returns> public string GenerateHtml(HtmlType type) { switch (type) { case HtmlType.PreviewHtml: return GeneratePreviewHtml(); case HtmlType.ObjectHtml: return _objectHtml; case HtmlType.AdaptiveHtml: return GenerateAdaptiveHtml(); default: Debug.Fail("Unexpected SmartHtmlType"); return GeneratePreviewHtml(); } }
private string GetSnapshotPathIfNeeded(HtmlType htmlType, VideoContext context) { // NOTE: We skip this behavior on IE9+ because of WinLive 589461. if (htmlType == HtmlType.ObjectHtml || ApplicationEnvironment.BrowserVersion.Major >= 9) { return null; } try { IHTMLElement element = context.GetElement(((IInternalContent)_content).Id); if (element != null) { element = ((IHTMLDOMNode)element).firstChild as IHTMLElement; } if (element != null && (element is IViewObject)) { Bitmap snapshot = HtmlScreenCaptureCore.TakeSnapshot((IViewObject)element, element.offsetWidth, element.offsetHeight); UpdateVideoSnapshot(snapshot); } Uri uri = _content.Files.GetUri(_content.Properties.GetString(VIDEO_PUBLISH_IMAGE, String.Empty)); if (uri != null) return uri.ToString(); } catch (Exception ex) { Trace.WriteLine("Failed to take video snapshot: " + ex); } return null; }
public MvcScriptTemplate <TModel> ScriptTemplate <TModel>(string id, HtmlType htmlType = HtmlType.TextMustacheTmpl) { return(new MvcScriptTemplate <TModel>(this.htmlHelper, id, WebEnumConvertToString.ToHtmlType(htmlType))); }