Пример #1
0
 public ResponsiveSidebarPage(string fileName, string path, string offSet, IPageHeader pageHeader)
 {
     _fileName = fileName;
     _path     = path;
     _stringBuilder.Append(PageHeaderHelper.PageHeader(pageHeader, offSet));
     _stringBuilder.Append("<Body>");
 }
Пример #2
0
 public PageBuilder(string fileName, string path, IPageHeader pageHeader)
 {
     _pageHeader = pageHeader;
     _fileName   = fileName;
     _path       = path;
     _stringBuilder.Append(PageHeaderHelper.PageHeader(pageHeader, ""));
     _stringBuilder.Append("<Body>");
 }
Пример #3
0
        public static void MapHeader(PageHeader header, IPageHeader headerInterface)
        {
            if (headerMap.ContainsKey(header))
            {
                throw new Exception("This header is already mapped!");
            }

            headerMap.Add(header, headerInterface);
        }
Пример #4
0
 private void setLocalCache()
 {
     _bodyDataSource        = PdfRptData.MainTableDataSource();
     _rptTemplate           = PdfRptData.Template ?? new BasicTemplateProvider(BasicTemplate.NullTemplate);
     _pdfRptSummarySettings = PdfRptData.SummarySettings;
     _rptEvents             = PdfRptData.MainTableEvents;
     _pdfRptFont            = PdfRptData.PdfFont;
     _pdfRptHeader          = PdfRptData.Header;
     _conventions           = PdfRptData.AdHocColumnsConventions;
 }
        private void setLocalCache()
        {
            if (PdfRptData.MainTableDataSource == null)
            {
                throw new InvalidOperationException("MainTableDataSource is null or empty.");
            }

            _bodyDataSource        = PdfRptData.MainTableDataSource();
            _rptTemplate           = PdfRptData.Template ?? new BasicTemplateProvider(BasicTemplate.NullTemplate);
            _pdfRptSummarySettings = PdfRptData.SummarySettings;
            _rptEvents             = PdfRptData.MainTableEvents;
            _pdfRptFont            = PdfRptData.PdfFont;
            _pdfRptHeader          = PdfRptData.Header;
            _conventions           = PdfRptData.AdHocColumnsConventions;
        }
        public static string PageHeader(IPageHeader pageDetails, string offSet)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("<!DOCTYPE html>");
            stringBuilder.Append("<html lang='en' >");
            stringBuilder.Append("<head>");
            stringBuilder.Append("    <meta charset='UTF-8'>");
            stringBuilder.Append($"    <title>{pageDetails.Title}</title>");
            stringBuilder.Append("<meta http-equiv='Content -Type' content='text/html; charset=UTF-8'>");
            stringBuilder.Append($"<meta name='description' content='{pageDetails.Description}'/>");
            stringBuilder.Append($"<meta name='keywords' content='{string.Join(" ", pageDetails.Keywords)}'/>");
            stringBuilder.Append($"<meta name='title' content='{pageDetails.Title}'/>");
            stringBuilder.Append($"<meta name='author' content='{pageDetails.Author}'>");
            stringBuilder.Append("    <meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=no'>");

            stringBuilder.Append($@"    <link rel='stylesheet' href='{offSet}Scripts/style.css'>");
            stringBuilder.Append($@"<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css' integrity='sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T' crossorigin='anonymous'>");
            stringBuilder.Append($@"<script src='https://code.jquery.com/jquery-3.3.1.slim.min.js' integrity='sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo' crossorigin='anonymous'></script>");
            stringBuilder.Append($@"<script src='https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js' integrity='sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1' crossorigin='anonymous'></script>");

            if (pageDetails.ExtraIncludes.Contains(Enums.BootstrapOptions.GALLERY))
            {
                stringBuilder.Append($@"<script src='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js' integrity='sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM' crossorigin='anonymous'></script>");
                stringBuilder.Append($@"<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css'>");
                stringBuilder.Append($@"<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css' />");
                stringBuilder.Append($@"<link rel='stylesheet' href='{offSet}Scripts/grid-gallery.css'>");
            }
            else
            {
                stringBuilder.Append($@"    <script type='text/javascript' src='{offSet}Scripts/chart.js'></script>");

                if (pageDetails.ExtraIncludes.Contains(Enums.BootstrapOptions.BT))
                {
                    stringBuilder.Append(@"<link rel='stylesheet' href='https://unpkg.com/[email protected]/dist/bootstrap-table.min.css'>");
                }

                stringBuilder.Append($@"<script src='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js' integrity='sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM' crossorigin='anonymous'></script>");
            }

            AddSiteTracker(stringBuilder);
            stringBuilder.Append("</head>");

            return(stringBuilder.ToString());
        }
Пример #7
0
 public void Assign(IPageHeader Source)
 {
     this.BeginUpdate();
     try
     {
         this.LeftText           = Source.LeftText;
         this.RightText          = Source.RightText;
         this.CenterText         = Source.CenterText;
         this.Offset             = Source.Offset;
         this.ReverseOnEvenPages = Source.ReverseOnEvenPages;
         this.Font      = new System.Drawing.Font(Source.Font.FontFamily, Source.Font.Size, Source.Font.Style);
         this.FontColor = Source.FontColor;
         this.Visible   = Source.Visible;
     }
     finally
     {
         this.EndUpdate();
     }
 }
Пример #8
0
        public static void ShowPage(Page pageObject)
        {
            Console.Clear();

            if (!pageMap.ContainsKey(pageObject))
            {
                throw new Exception("Page is not mapped yet!");
            }

            var page = pageMap[pageObject];

            // check if there is a header set, if there is, show the header first!
            if (HeaderController.ContainsHeader(page))
            {
                IPageHeader header = HeaderController.GetHeader(PageHeader.ToolboxHeader);
                Console.ForegroundColor = header.Color;
                Console.WriteLine(header.Content);
                Console.WriteLine("");
                Console.WriteLine("");
                Console.ForegroundColor = page.Color;
            }

            page.Run();
        }
Пример #9
0
 /// <summary>
 /// Defines dynamic headers for pages and individual groups.
 /// </summary>
 /// <param name="header">a dynamic header</param>
 public void CustomHeader(IPageHeader header)
 {
     _pdfReport.DataBuilder.SetHeader(header);
 }
Пример #10
0
        public static void MaybeEnvelope(this HttpResponse response, HttpRequest request, PublicApiOptions apiOptions,
                                         QueryOptions queryOptions,
                                         IPageHeader data, IList <Error> errors, out object body)
        {
            if (FeatureRequested(request, apiOptions.JsonConversion.EnvelopeOperator,
                                 apiOptions.JsonConversion.EnvelopeEnabled))
            {
                body = new EnvelopeBody
                {
                    Data    = data,
                    Status  = response.StatusCode,
                    Headers = response.Headers,
                    Paging  = new PagingInfo
                    {
                        TotalCount   = data.TotalCount,
                        TotalPages   = data.TotalPages,
                        NextPage     = GetNextPage(request, data, queryOptions),
                        PreviousPage = GetPreviousPage(request, data, queryOptions),
                        LastPage     = GetLastPage(request, data, queryOptions)
                    },
                    Errors    = errors,
                    HasErrors = errors?.Count > 0
                };

                response.StatusCode = (int)HttpStatusCode.OK;
                return;
            }

            var link = StringBuilderPool.Scoped(sb =>
            {
                if (data.TotalPages > 1)
                {
                    var firstPage = $"<{GetFirstPage(request, data, queryOptions)}>; rel=\"first\"";
                    sb.Append(firstPage);
                }

                if (data.HasNextPage)
                {
                    var nextPage = $"<{GetNextPage(request, data, queryOptions)}>; rel=\"next\"";
                    if (sb.Length > 0)
                    {
                        sb.Append(", ");
                    }

                    sb.Append(nextPage);
                }

                if (data.HasPreviousPage)
                {
                    var previousPage = $"<{GetPreviousPage(request, data, queryOptions)}>; rel=\"previous\"";
                    if (sb.Length > 0)
                    {
                        sb.Append(", ");
                    }

                    sb.Append(previousPage);
                }

                if (data.TotalPages > 1)
                {
                    var lastPage = $"<{GetLastPage(request, data, queryOptions)}>; rel=\"last\"";
                    if (sb.Length > 0)
                    {
                        sb.Append(", ");
                    }

                    sb.Append(lastPage);
                }
            });

            if (link.Length > 0)
            {
                response.Headers.Add(Constants.HttpHeaders.Link, link);
            }

            response.Headers.Add(queryOptions.TotalCountHeader, data.TotalCount.ToString());
            response.Headers.Add(queryOptions.TotalPagesHeader, data.TotalPages.ToString());
            body = new NestedBody
            {
                Data      = data,
                Errors    = errors,
                HasErrors = errors?.Count > 0
            };
        }
Пример #11
0
 internal static string GetLastPage(HttpRequest request, IPageHeader header, QueryOptions options)
 {
     return(header.TotalPages < 2
         ? null
         : $"{request.Scheme}://{request.Host}{request.Path}?{options.PageOperator}={header.TotalPages}&{options.PerPageOperator}={header.Size}");
 }
Пример #12
0
 internal static string GetNextPage(HttpRequest request, IPageHeader header, QueryOptions options)
 {
     return(!header.HasNextPage
         ? null
         : $"{request.Scheme}://{request.Host}{request.Path}?{options.PageOperator}={header.Index + 2}&{options.PerPageOperator}={header.Size}");
 }
Пример #13
0
 private void setLocalCache()
 {
     _bodyDataSource = PdfRptData.MainTableDataSource();
     _rptTemplate = PdfRptData.Template ?? new BasicTemplateProvider(BasicTemplate.NullTemplate);
     _pdfRptSummarySettings = PdfRptData.SummarySettings;
     _rptEvents = PdfRptData.MainTableEvents;
     _pdfRptFont = PdfRptData.PdfFont;
     _pdfRptHeader = PdfRptData.Header;
     _conventions = PdfRptData.AdHocColumnsConventions;
 }
 /// <summary>
 /// Defines dynamic headers for pages and individual groups.
 /// </summary>
 /// <param name="header">a dynamic header</param>
 public void CustomHeader(IPageHeader header)
 {
     _pdfReport.DataBuilder.SetHeader(header);
 }
Пример #15
0
 /// <summary>
 /// Defines dynamic headers for pages and individual groups.
 /// </summary>
 /// <param name="header">a dynamic header</param>
 public void SetHeader(IPageHeader header)
 {
     _header = header;
 }
Пример #16
0
 /// <summary>
 /// Defines dynamic headers for pages and individual groups.
 /// </summary>
 /// <param name="header">a dynamic header</param>
 public void SetHeader(IPageHeader header)
 {
     _header = header;
 }
Пример #17
0
	internal void SetHeader (IPageHeader header)
	{
		htmlHeader = header;
	}
Пример #18
0
 public static IPublishedContent GetPageHeaderImage(IPageHeader that) => that.Value <IPublishedContent>("pageHeaderImage");
Пример #19
0
 public static IHtmlString GetPageHeaderContent(IPageHeader that) => that.Value <IHtmlString>("pageHeaderContent");
Пример #20
0
 public static string GetPageHeaderTitle(IPageHeader that) => that.Value <string>("pageHeaderTitle");