/// <summary> /// Gets common CSS that mobile apps need to properly display pages using Page Content Service /// </summary> /// <param name="type">Type of CSS bundle to fetch</param> /// <returns>DownloadableArtifact information. NULL on errors.</returns> public async Task <DownloadableArtifact> GetCss(CssType type = CssType.Base) { StringBuilder uri = new StringBuilder(); uri.Append(ENDPOINT_BASE_URI).Append("data/css/mobile/") .Append(Enum.GetName(typeof(CssType), type).ToLower()); // Since we get a download, we cannot use the GET() method in the base. RestApi.RestApiClient client = new RestApi.RestApiClient(new Uri(uri.ToString())); client.RequestHeaders.Add("Accept", "text/css"); HttpResponseMessage responseMessage = client.Get(); if (responseMessage.IsSuccessStatusCode) { return(new DownloadableArtifact() { ContentLength = responseMessage.Content.Headers.ContentLength.Value, ContentType = responseMessage.Content.Headers.ContentType.MediaType, Stream = await responseMessage.Content.ReadAsStreamAsync() }); } return(null); }
//IO:2 <- OK /// <summary> /// Cancella un file CSS /// </summary> /// <param name="SkinPath">Il path base di una skin</param> /// <param name="Type">Il tipo di css</param> public static void DelCssFile(String SkinPath, CssType Type) { String FileName = GetFullCssName(SkinPath, Type, false); Delete.File(FileName); Create.TextFile(FileName, "", true, false); }
public int IndexOf(string name, CssType cssType, string strfor) { for (int i = 0; i < base.Count; i++) { if (((this[i].Type == cssType) && this[i].Name.Equals(name)) && this[i].For.Equals(strfor)) { return(i); } } return(-1); }
public async Task <ActionResult> PutSiteSectionAsync(int cssTypeId, CssType cssType) { if (cssTypeId == cssType.CssTypeId) { _db.Attach(cssType).State = EntityState.Modified; await _db.SaveChangesAsync(); return(Ok(cssType)); } return(BadRequest()); }
public async Task <ActionResult <CssType> > AddSiteSectionAsync(CssType cssType) { if (cssType is null) { return(BadRequest()); } _db.CssTypes.Add(cssType); await _db.SaveChangesAsync(); return(Ok(cssType)); }
// BasePath => C:\inetput\wwwroot\Comol\Skin\ // SkinPath = BasePath + SkinIs => C:\inetput\wwwroot\Comol\Skin\45\ // BaseVirtualPath => /Comol_Elle3/File/Skin/ /// <summary> /// Nome completo del file /// </summary> /// <param name="SkinPath">Path base della skin</param> /// <param name="Type">Tipo di css</param> /// <returns>es: C:\inetput\wwwroot\Comol\Skin\45\Main.css</returns> public static String GetFullCssName(String SkinPath, CssType Type, Boolean IsWeb) { if (SkinPath == "") { return(""); } String FullName = SkinPath;// +"\\" + SkinId.ToString(); // return BasePath + "\\" + SkinId.ToString() + "\\" + ImageDir; if (IsWeb) { FullName = FullName.Replace("\\", "/"); if (!FullName.EndsWith("/")) { FullName += "/"; } //FullName.Replace("//", "/"); // Tanto non lo fa... } else { FullName = FullName.Replace("/", "\\"); if (!FullName.EndsWith("\\")) { FullName += "\\"; } //FullName.Replace("\\\\", "\\"); // Tanto non lo fa... } switch (Type) { case CssType.Main: FullName += MainCss; break; case CssType.IE: FullName += IECss; break; case CssType.Admin: FullName += AdminCss; break; case CssType.Login: FullName += LoginCss; break; } return(FullName); }
public void SetNameValue(string cssName, string cssValue, CssType cssType, string strFor) { int num = this.a.IndexOf(cssName.ToLower(), cssType, strFor); if (num != -1) { Css css = this.a[num]; css.Value = cssValue; this.a[num] = css; } else { Css css2 = new Css { Name = cssName.ToLower(), Value = cssValue, Type = cssType, For = strFor }; this.a.Add(css2); } }
public static System.Web.WebPages.HelperResult Css(CssType type) { return(new System.Web.WebPages.HelperResult(__razor_helper_writer => { #line 49 "..\..\App_Code\Content.cshtml" string src; switch (type) { case CssType.Blitzer: src = "https://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/themes/blitzer/jquery-ui.css"; break; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } #line default #line hidden WebViewPage.WriteLiteralTo(@__razor_helper_writer, " <link href=\""); #line 61 "..\..\App_Code\Content.cshtml" WebViewPage.WriteTo(@__razor_helper_writer, src); #line default #line hidden WebViewPage.WriteLiteralTo(@__razor_helper_writer, "\" rel=\"Stylesheet\" type=\"text/css\" />\r\n"); #line 62 "..\..\App_Code\Content.cshtml" #line default #line hidden })); }
public void ParseStyleString(string style, CssType type, string forstr) { string str1 = style; char[] chArray = new char[1] { ';' }; foreach (string str2 in str1.Split(chArray)) { string str3 = str2.Replace("\n", "").Trim(); int length = str3.IndexOf(":"); if (length != -1) { string str4 = str3.Substring(0, length).Trim(); if (HTMLTree.IsCss2(str4)) { this.g.SetNameValue(str4, str3.Substring(length + 1).Trim(), type, forstr); } } } }
// E' necessario copiare man mano tutti i file, // visto che si basano sull'id di sottoggetti che vengono ricreati /// <summary> /// Crea una copia di un css di una skin /// </summary> /// <param name="SourceSkinID">ID Skin sorgente</param> /// <param name="BasePath">Percorso base</param> /// <param name="DestSkinId">ID Skin destinazione</param> /// <param name="Type">Tipo di CSS</param> public static void CopyCss(Int64 SourceSkinID, String BasePath, Int64 DestSkinId, CssType Type) { String Source = GetFullCssName(BasePath + "/" + SourceSkinID, Type, false); String Destination = GetFullCssName(BasePath + "/" + DestSkinId, Type, false); CopyAndReplace(Source, Destination); }
private void WriteFootnotesBlock(CssType type) { if (type != CssType.Scripture) return; m_writer.WriteLine(" @footnotes {"); // Prince XML m_writer.WriteLine(" border-top: thin solid black;"); m_writer.WriteLine(" padding: 0.3em 0;"); m_writer.WriteLine(" margin-top: 0.6em;"); m_writer.WriteLine(" margin-left: 2pi;"); m_writer.WriteLine(" }"); m_writer.WriteLine(" @footnote {"); // CSS3 m_writer.WriteLine(" border-top: thin solid black;"); m_writer.WriteLine(" padding: 0.3em 0;"); m_writer.WriteLine(" margin-top: 0.6em;"); m_writer.WriteLine(" margin-left: 2pi;"); m_writer.WriteLine(" }"); }
/// <summary> /// Write a Cascading Style Sheet file based on the layouts accumulated in /// m_dictCssXnode and the given stylesheet. /// </summary> /// <param name="sOutputFile"></param> /// <param name="vss"></param> /// <param name="type"></param> /// <param name="pub"></param> public void WriteCssFile(string sOutputFile, IVwStylesheet vss, CssType type, IPublication pub) { // Read all the style information from the database. ReadStyles(vss); // Write the Cascading Style Sheet. using (m_writer = FileUtils.OpenFileForWrite(sOutputFile, Encoding.UTF8)) { m_writer.WriteLine("/* Cascading Style Sheet generated by {0} version {1} on {2} {3} */", System.Reflection.Assembly.GetEntryAssembly().GetName().Name, System.Reflection.Assembly.GetEntryAssembly().GetName().Version, DateTime.Now.ToLongDateString(), DateTime.Now.ToShortTimeString()); m_writer.WriteLine("@page {"); m_writer.WriteLine(" counter-increment: page;"); if (pub != null) { //pub.BaseFontSize; //pub.BaseLineSpacing; //pub.BindingEdge; //pub.GutterLoc; //pub.GutterMargin; //pub.PageHeight; //pub.PageWidth; //pub.SheetLayout; //pub.SheetsPerSig; if (pub.PaperHeight != 0 && pub.PaperWidth != 0) { m_writer.WriteLine(" height: {0}pt;", ConvertMptToPt(pub.PaperHeight)); m_writer.WriteLine(" width: {0}pt;", ConvertMptToPt(pub.PaperWidth)); } else if (pub.IsLandscape) { m_writer.WriteLine(" height: 8.5in;"); m_writer.WriteLine(" width: 11in;"); } else { m_writer.WriteLine(" height: 11in;"); m_writer.WriteLine(" width: 8.5in;"); } if (pub.DivisionsOS.Count > 0) { m_writer.WriteLine(" margin: {0}pt {1}pt {2}pt {3}pt;", ConvertMptToPt(pub.DivisionsOS[0].PageLayoutOA.MarginTop), ConvertMptToPt(pub.IsLeftBound ? pub.DivisionsOS[0].PageLayoutOA.MarginOutside : pub.DivisionsOS[0].PageLayoutOA.MarginInside), ConvertMptToPt(pub.DivisionsOS[0].PageLayoutOA.MarginBottom), ConvertMptToPt(pub.IsLeftBound ? pub.DivisionsOS[0].PageLayoutOA.MarginInside : pub.DivisionsOS[0].PageLayoutOA.MarginOutside)); string sInside = pub.IsLeftBound ? "left" : "right"; string sOutside = pub.IsLeftBound ? "right" : "left"; WriteHeaderFooterBlock("top-" + sInside, pub.DivisionsOS[0].HFSetOA.DefaultHeaderOA.InsideAlignedText); WriteHeaderFooterBlock("top-center", pub.DivisionsOS[0].HFSetOA.DefaultHeaderOA.CenteredText); WriteHeaderFooterBlock("top-" + sOutside, pub.DivisionsOS[0].HFSetOA.DefaultHeaderOA.OutsideAlignedText); WriteHeaderFooterBlock("bottom-" + sInside, pub.DivisionsOS[0].HFSetOA.DefaultFooterOA.InsideAlignedText); WriteHeaderFooterBlock("bottom-center", pub.DivisionsOS[0].HFSetOA.DefaultFooterOA.CenteredText); WriteHeaderFooterBlock("bottom-"+sOutside, pub.DivisionsOS[0].HFSetOA.DefaultFooterOA.OutsideAlignedText); //pub.DivisionsOS[0].PageLayoutOA.PosFooter; //pub.DivisionsOS[0].PageLayoutOA.PosHeader; //pub.DivisionsOS[0].StartAt; WriteFootnotesBlock(type); if (pub.DivisionsOS[0].DifferentEvenHF) { m_writer.WriteLine("}"); if (pub.IsLeftBound) m_writer.WriteLine("@page :left {"); else m_writer.WriteLine("@page :right {"); WriteHeaderFooterBlock("top-" + sInside, pub.DivisionsOS[0].HFSetOA.EvenHeaderOA.OutsideAlignedText); WriteHeaderFooterBlock("top-center", pub.DivisionsOS[0].HFSetOA.EvenHeaderOA.CenteredText); WriteHeaderFooterBlock("top-" + sOutside, pub.DivisionsOS[0].HFSetOA.EvenHeaderOA.InsideAlignedText); WriteHeaderFooterBlock("bottom-" + sInside, pub.DivisionsOS[0].HFSetOA.EvenFooterOA.OutsideAlignedText); WriteHeaderFooterBlock("bottom-center", pub.DivisionsOS[0].HFSetOA.EvenFooterOA.CenteredText); WriteHeaderFooterBlock("bottom-" + sOutside, pub.DivisionsOS[0].HFSetOA.EvenFooterOA.InsideAlignedText); } if (pub.DivisionsOS[0].DifferentFirstHF) { m_writer.WriteLine("}"); m_writer.WriteLine("@page :first {"); WriteHeaderFooterBlock("top-" + sInside, pub.DivisionsOS[0].HFSetOA.FirstHeaderOA.InsideAlignedText); WriteHeaderFooterBlock("top-center", pub.DivisionsOS[0].HFSetOA.FirstHeaderOA.CenteredText); WriteHeaderFooterBlock("top-" + sOutside, pub.DivisionsOS[0].HFSetOA.FirstHeaderOA.OutsideAlignedText); WriteHeaderFooterBlock("bottom-" + sInside, pub.DivisionsOS[0].HFSetOA.FirstFooterOA.InsideAlignedText); WriteHeaderFooterBlock("bottom-center", pub.DivisionsOS[0].HFSetOA.FirstFooterOA.CenteredText); WriteHeaderFooterBlock("bottom-" + sOutside, pub.DivisionsOS[0].HFSetOA.FirstFooterOA.OutsideAlignedText); } m_cColumns = pub.DivisionsOS[0].NumColumns; } } else if (type == CssType.Dictionary) { m_writer.WriteLine(" margin: 2cm 2cm 2cm 2cm;"); m_writer.WriteLine(" @top-left {"); m_writer.WriteLine(" content: string(guideword, first);"); WriteSansSerifFontFamilyForWs(m_cache.DefaultVernWs, true); m_writer.WriteLine(" font-weight: bold;"); m_writer.WriteLine(" font-size: 12pt;"); m_writer.WriteLine(" margin-top: 1em;"); m_writer.WriteLine(" }"); m_writer.WriteLine(" @top-center {"); m_writer.WriteLine(" content: counter(page);"); m_writer.WriteLine(" margin-top: 1em"); m_writer.WriteLine(" }"); m_writer.WriteLine(" @top-right {"); m_writer.WriteLine(" content: string(guideword, last);"); WriteSansSerifFontFamilyForWs(m_cache.DefaultVernWs, true); m_writer.WriteLine(" font-weight: bold;"); m_writer.WriteLine(" font-size: 12pt;"); m_writer.WriteLine(" margin-top: 1em;"); m_writer.WriteLine(" }"); WriteFootnotesBlock(type); m_writer.WriteLine("}"); m_writer.WriteLine("@page :first {"); m_writer.WriteLine(" @top-left { content: ''; }"); m_writer.WriteLine(" @top-center { content: ''; }"); m_writer.WriteLine(" @top-right { content: ''; }"); } else if (type == CssType.Scripture) { m_writer.WriteLine(" margin: 2cm 2cm 2cm 2cm;"); m_writer.WriteLine(" counter-increment: page;"); WriteFootnotesBlock(type); } else if (type == CssType.Notebook) { m_writer.WriteLine(" margin: 2cm 2cm 2cm 2cm;"); m_writer.WriteLine(" counter-increment: page;"); } m_writer.WriteLine("}"); m_writer.WriteLine(); var langProj = m_cache.LangProject; foreach (var ws in langProj.CurrentAnalysisWritingSystems.Union(langProj.CurrentPronunciationWritingSystems).Union(langProj.CurrentVernacularWritingSystems)) { var dir = ws.RightToLeftScript; m_writer.WriteLine(":lang(" + ws.IcuLocale+ ") {direction:" + (dir ? "rtl" : "ltr") + "}"); } m_writer.WriteLine(); if (type == CssType.Dictionary) { ProcessDictionaryTypeClasses(); } else if (type == CssType.Scripture) { foreach (string sClass in m_dictClassData.Keys) ProcessScriptureCssStyle(sClass, m_dictClassData[sClass]); } else if (type == CssType.Notebook) { ProcessNotebookTypeClasses(); } m_writer.Close(); } m_writer = null; }