コード例 #1
0
ファイル: InPageAdminService.cs プロジェクト: thangnm11/MrCMS
        public string GetFormattedBodyContent(GetPropertyData getPropertyData, Controller controller)
        {
            ContentInfo content = GetContent(getPropertyData);

            object entity = content.Entity;

            if (entity is Webpage)
            {
                CurrentRequestData.CurrentPage = entity as Webpage;
            }
            var htmlHelper = MrCMSHtmlHelperExtensions.GetHtmlHelper(controller);

            return(htmlHelper.ParseShortcodes(content.Content).ToHtmlString());
        }
コード例 #2
0
        private MvcHtmlString ReturnTag(ImageInfo imageInfo, string alt, string title, object attributes)
        {
            var tagBuilder = new TagBuilder("img");

            tagBuilder.Attributes.Add("src", imageInfo.ImageUrl);
            tagBuilder.Attributes.Add("alt", alt ?? imageInfo.Title);
            tagBuilder.Attributes.Add("title", title ?? imageInfo.Description);
            if (attributes != null)
            {
                var routeValueDictionary = MrCMSHtmlHelperExtensions.AnonymousObjectToHtmlAttributes(attributes);
                foreach (var kvp in routeValueDictionary)
                {
                    tagBuilder.Attributes.Add(kvp.Key, kvp.Value.ToString());
                }
            }
            return(MvcHtmlString.Create(tagBuilder.ToString(TagRenderMode.SelfClosing)));
        }
コード例 #3
0
        private static void CreateInfo(ExcelPackage excelFile)
        {
            var wsInfo = excelFile.Workbook.Worksheets.Add("Info");

            wsInfo.Cells["A1:D1"].Style.Font.Bold         = true;
            wsInfo.Cells["A:D"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
            wsInfo.Cells["A1"].Value = "MrCMS Version";
            wsInfo.Cells["B1"].Value = "Entity Type for Export";
            wsInfo.Cells["C1"].Value = "Export Date";
            wsInfo.Cells["D1"].Value = "Export Source";

            wsInfo.Cells["A2"].Value = MrCMSHtmlHelperExtensions.AssemblyVersion(null);
            wsInfo.Cells["B2"].Value = "Product";
            wsInfo.Cells["C2"].Style.Numberformat.Format = "YYYY-MM-DD hh:mm:ss";
            wsInfo.Cells["C2"].Value = DateTime.UtcNow;
            wsInfo.Cells["D2"].Value = "MrCMS " + MrCMSHtmlHelperExtensions.AssemblyVersion(null);

            wsInfo.Cells["A:D"].AutoFitColumns();
            wsInfo.Cells["A4"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
            wsInfo.Cells["A4"].Value = "Please do not change any values inside this file.";
        }