예제 #1
0
        public void RenderHeader(BuiltinReportDescriptor data, bool title, bool logo)
        {
            var s = LoadTemplate("builtinreport_header.ent", data.m);

            /* do replacements */
            s.Set("title", data.Caption); /* [dlatikay 20130111] was encoded twice; removed: System.Web.HttpUtility.HtmlEncode */
            switch (data.DQP)
            {
            case "D":
                s.Set("dqp_info", data.m(445));     /* Development system */
                break;

            case "Q":
            case "T":
                s.Set("dqp_info", data.m(443));     /* Test and Training system */
                break;

            default:
                /* naught */
                s.Set("showdqpinfo_commentstart", Html.cstHTMLCommentStart);
                s.Set("showdqpinfo_commentend", Html.cstHTMLCommentEnd);
                break;
            }
            s.Set("logoresourcename", mime.BINGET_NAMEDRESOURCE_CORPORATELOGO);
            s.Set("nonce", Guid.NewGuid().ToString());
            header = s.AsStringBuilder;
        }
예제 #2
0
        public void SubmitToStream(BuiltinReportDescriptor descriptor)
        {
            /* load the master template */
            var raw = LoadTemplate("builtinreport.ent", descriptor.m);

            /* do we need the JS libraries of amline? */
            if (NeedsAMJSLines)
            {
                var flashscript = LoadTemplate("am_embed_js.html", descriptor.m);
                raw.Set("flashscript", flashscript.ToString());
            }
            else
            {
                raw.Set("flashscript", String.Empty); /* added [dlatikay 20120202] */
            }
            /* perform the replacements */
            raw.Set("title", descriptor.ReportPageTitle);
            raw.Set("dqp", descriptor.DQP);                                                                          /* added [dlatikay 20120209] */
            raw.Set("onloadaction", descriptor.Outputformat == FileType.ft_html ? "window.print();" : String.Empty); /* added [dlatikay 20120209] */
            raw.Set("header", header == null ? String.Empty : header.ToString());
            raw.Set("meta", meta == null ? String.Empty : meta.ToString());
            var compositecontent = new StringBuilder();
            var partcounter      = 0;

            foreach (var part in parts)
            {
                compositecontent.AppendFormat("{1}{0}{2}", part.ToString(), (((++partcounter) <= 1) ? String.Empty : "<!-- section ruler -->"), Environment.NewLine);
            }
            raw.Set("rendition", compositecontent.ToString());
            raw.Set("footer", String.Format("<span id=\"builtinreport_footer\">{0}</span>", HttpUtility.HtmlEncode(String.Format(descriptor.m(3252), descriptor.Systemname, descriptor.Systemversion, descriptor.ReportCreationTimestamp)))); /* Created using en-software SHERM v2.1 */
            raw.Set("onafterprint", descriptor.Outputformat == dal.business.FileType.ft_pdf ? "JavaScript:window.location.href='about:blank';" : String.Empty);                                                                               /* when we are rendering a pdf, we will print it to the postscript printer. therefore we need this to allow the silent host browser to detect when printing has finished */

            /* [dlatikay 20111202] if we want html, we get html;
             * stream it out: */
            if (descriptor.Outputformat == dal.business.FileType.ft_html)
            {
                byte[] html = System.Text.UTF8Encoding.UTF8.GetBytes(raw.ToString());
                ResultStream.Write(html, 0, html.Length);
            }
            /* reset if can */
            if (ResultStream.CanSeek)
            {
                ResultStream.Seek(0, SeekOrigin.Begin);
            }
        }