private void RenderJsonList(HttpContext context) { context.Response.ContentType = "text/javascript"; Encoding encoding = new UTF8Encoding(); context.Response.ContentEncoding = encoding; siteRoot = SiteUtils.GetNavigationSiteRoot(); context.Response.Write("var tinyMCETemplateList = ["); if (WebConfigSettings.AddSystemContentTemplatesAboveSiteTemplates) //true by default { RenderSystemTemplateItems(context); } List <ContentTemplate> templates = ContentTemplate.GetAll(siteSettings.SiteGuid); foreach (ContentTemplate t in templates) { context.Response.Write(comma); context.Response.Write("['" + t.Title + "','" + siteRoot + "/Services/TinyMceTemplates.ashx?g=" + t.Guid.ToString() + "','']"); comma = ","; } if (WebConfigSettings.AddSystemContentTemplatesBelowSiteTemplates) //false by default { RenderSystemTemplateItems(context); } context.Response.Write("];"); }
private void RenderJsonList(HttpContext context) { context.Response.ContentType = "text/javascript"; Encoding encoding = new UTF8Encoding(); context.Response.ContentEncoding = encoding; siteRoot = SiteUtils.GetNavigationSiteRoot(); // Register a templates definition set named "mojo". context.Response.Write("CKEDITOR.addTemplates( 'mojo',{"); context.Response.Write("\"imagesPath\":\"" + siteRoot + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/htmltemplateimages/" + "\""); context.Response.Write(",\"templates\":"); context.Response.Write("["); //2018/10/31 -- we don't really want to use these anymore. we're adding the ability to have templates in the skin but not system wide templates if (WebConfigSettings.AddSystemContentTemplatesAboveSiteTemplates) //false by default { RenderSystemTemplateItems(context); } List <ContentTemplate> templates = ContentTemplate.GetAll(siteSettings.SiteGuid); foreach (ContentTemplate t in templates) { if (!WebUser.IsInRoles(t.AllowedRoles)) { continue; } context.Response.Write(comma); context.Response.Write("{"); context.Response.Write("\"title\":\"" + t.Title.JsonEscape() + "\""); context.Response.Write(",\"image\":\"" + t.ImageFileName.JsonEscape() + "\""); context.Response.Write(",\"description\":\"" + t.Description.RemoveLineBreaks().JsonEscape() + "\""); // is this going to work? context.Response.Write(",\"html\":\"" + t.Body.RemoveLineBreaks().JsonEscape() + "\""); context.Response.Write("}"); comma = ","; } //2018/10/31 -- we don't really want to use these anymore. we're adding the ability to have templates in the skin but not system wide templates if (WebConfigSettings.AddSystemContentTemplatesBelowSiteTemplates) //false by default { RenderSystemTemplateItems(context); } context.Response.Write("]"); context.Response.Write("});"); }
private void RenderJsonList(HttpContext context) { context.Response.ContentType = "text/javascript"; Encoding encoding = new UTF8Encoding(); context.Response.ContentEncoding = encoding; siteRoot = SiteUtils.GetNavigationSiteRoot(); // Register a templates definition set named "C". context.Response.Write("CKEDITOR.addTemplates( 'C',{"); context.Response.Write("imagesPath:'" + siteRoot + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/htmltemplateimages/" + "'"); context.Response.Write(", templates :"); context.Response.Write("["); if (WebConfigSettings.AddSystemContentTemplatesAboveSiteTemplates) //true by default { RenderSystemTemplateItems(context); } List <ContentTemplate> templates = ContentTemplate.GetAll(siteSettings.SiteGuid); foreach (ContentTemplate t in templates) { context.Response.Write(comma); context.Response.Write("{"); context.Response.Write("title:'" + t.Title + "'"); context.Response.Write(",image:'" + t.ImageFileName + "'"); context.Response.Write(",description:'" + t.Description.RemoveLineBreaks() + "'"); // is this going to work? context.Response.Write(",html:'" + t.Body.RemoveLineBreaks() + "'"); context.Response.Write("}"); comma = ","; } if (WebConfigSettings.AddSystemContentTemplatesBelowSiteTemplates) //false by default { RenderSystemTemplateItems(context); } context.Response.Write("]"); context.Response.Write("});"); }
private void RenderSiteTemplates(HttpContext context, XmlTextWriter xmlTextWriter) { List <ContentTemplate> templates = ContentTemplate.GetAll(siteSettings.SiteGuid); foreach (ContentTemplate template in templates) { if (!WebUser.IsInRoles(template.AllowedRoles)) { continue; } xmlTextWriter.WriteStartElement("Template"); xmlTextWriter.WriteAttributeString("title", template.Title); xmlTextWriter.WriteAttributeString("image", template.ImageFileName); xmlTextWriter.WriteStartElement("Description"); xmlTextWriter.WriteValue(template.Description); xmlTextWriter.WriteEndElement(); xmlTextWriter.WriteStartElement("Html"); xmlTextWriter.WriteCData(template.Body); xmlTextWriter.WriteEndElement(); //Html xmlTextWriter.WriteEndElement(); //Template } }
// public void ExportAsJson(HttpContext context) //{ // HttpContext.Current.Response.ContentType = "application/octet-stream"; // siteRoot = SiteUtils.GetNavigationSiteRoot(); // context.Response.Write(",\"templates\":"); // context.Response.Write("["); // List<ContentTemplate> templates = ContentTemplate.GetAll(siteSettings.SiteGuid); // foreach (ContentTemplate t in templates) // { // if (!WebUser.IsInRoles(t.AllowedRoles)) { continue; } // context.Response.Write(comma); // context.Response.Write("{"); // context.Response.Write("\"title\":\"" + t.Title.JsonEscape() + "\""); // context.Response.Write(",\"image\":\"" + t.ImageFileName.JsonEscape() + "\""); // context.Response.Write(",\"description\":\"" + t.Description.RemoveLineBreaks().JsonEscape() + "\""); // // is this going to work? // context.Response.Write(",\"html\":\"" + t.Body.RemoveLineBreaks().JsonEscape() + "\""); // context.Response.Write("}"); // comma = ","; // } // context.Response.Write("]"); // context.Response.Write("});"); // HttpContext.Current.Response.AddHeader("Content-Disposition", $"attachment; filename={siteSettings.SiteName} Content Templates.json"); // } private void RenderJsonList(HttpContext context, bool export = false) { Encoding encoding = new UTF8Encoding(); context.Response.ContentEncoding = encoding; siteRoot = SiteUtils.GetNavigationSiteRoot(); if (export) { context.Response.ContentType = "application/octet-stream"; // Set template definition set name as "skin". context.Response.Write("CKEDITOR.addTemplates( 'skin',{"); // Set standard image path context.Response.Write("\"imagesPath\": mojoSkinPath + \"" + "/templates/thumbs/" + "\""); context.Response.AddHeader("Content-Disposition", $"attachment; filename={siteSettings.SiteName} Content Templates.js"); } else { context.Response.ContentType = "text/javascript"; // Register a templates definition set named "mojo". context.Response.Write("CKEDITOR.addTemplates( 'mojo',{"); // Set standard image path context.Response.Write("\"imagesPath\":\"" + siteRoot + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/htmltemplateimages/" + "\""); } context.Response.Write(",\"templates\":"); context.Response.Write("["); //2018/10/31 -- we don't really want to use these anymore. we're adding the ability to have templates in the skin but not system wide templates //if (WebConfigSettings.AddSystemContentTemplatesAboveSiteTemplates) //false by default //{ // RenderSystemTemplateItems(context); //} List <ContentTemplate> templates = ContentTemplate.GetAll(siteSettings.SiteGuid); foreach (ContentTemplate t in templates) { if (!WebUser.IsInRoles(t.AllowedRoles)) { continue; } context.Response.Write(comma); context.Response.Write("{"); context.Response.Write("\"title\":\"" + t.Title.JsonEscape() + "\""); context.Response.Write(",\"image\":\"" + t.ImageFileName.JsonEscape() + "\""); context.Response.Write(",\"description\":\"" + t.Description.RemoveLineBreaks().JsonEscape() + "\""); // is this going to work? context.Response.Write(",\"html\":\"" + t.Body.RemoveLineBreaks().JsonEscape() + "\""); context.Response.Write("}"); comma = ","; } //2018/10/31 -- we don't really want to use these anymore. we're adding the ability to have templates in the skin but not system wide templates //if (WebConfigSettings.AddSystemContentTemplatesBelowSiteTemplates) //false by default // { // RenderSystemTemplateItems(context); // } context.Response.Write("]"); context.Response.Write("});"); }
private void RenderJsonList(HttpContext context) { if (WebConfigSettings.TinyMceUseV4) { context.Response.ContentType = "application/json"; } else { context.Response.ContentType = "text/javascript"; } Encoding encoding = new UTF8Encoding(); context.Response.ContentEncoding = encoding; siteRoot = SiteUtils.GetNavigationSiteRoot(); if (WebConfigSettings.TinyMceUseV4) { context.Response.Write("["); } else { context.Response.Write("var tinyMCETemplateList = ["); } //2018/10/31 -- we don't really want to use these anymore. we're adding the ability to have templates in the skin but not system wide templates if (WebConfigSettings.AddSystemContentTemplatesAboveSiteTemplates) //false by default { RenderSystemTemplateItems(context); } List <ContentTemplate> templates = ContentTemplate.GetAll(siteSettings.SiteGuid); foreach (ContentTemplate t in templates) { if (WebConfigSettings.TinyMceUseV4) { context.Response.Write(comma); context.Response.Write("{\"title\":\"" + t.Title.JsonEscape() + "\",\"url\":\"" + siteRoot + "/Services/TinyMceTemplates.ashx?g=" + t.Guid.ToString() + "\"}"); } else { context.Response.Write(comma); context.Response.Write("[\"" + t.Title.JsonEscape() + "\",\"" + siteRoot + "/Services/TinyMceTemplates.ashx?g=" + t.Guid.ToString() + "\",\"\"]"); } comma = ","; } //2018/10/31 -- we don't really want to use these anymore. we're adding the ability to have templates in the skin but not system wide templates if (WebConfigSettings.AddSystemContentTemplatesBelowSiteTemplates) //false by default { RenderSystemTemplateItems(context); } if (WebConfigSettings.TinyMceUseV4) { context.Response.Write("]"); } else { context.Response.Write("];"); } }