/// <summary> /// Initializes a new instance of the <see cref="UPWebContentPageModelController"/> class. /// </summary> /// <param name="viewReference">The view reference.</param> public UPWebContentPageModelController(ViewReference viewReference) : base(viewReference) { this.SendByEmailActions = new List <Menu>(); this.SendByEmailButtonIsShown = viewReference.ContextValueIsSet("SendByEmail"); var actionStr = viewReference.ContextValueForKey("SendByEmailAction"); var actions = !string.IsNullOrEmpty(viewReference.ContextValueForKey("SendByEmailAction")) ? actionStr.Split(',') : new string[0]; IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; foreach (string action in actions) { Menu menu = configStore.MenuByName(action); if (menu != null) { this.SendByEmailActions.Add(menu); } } this.WebContentMetadata = UPWebContentMetadata.WebContentMetaDataFromReportType(viewReference.ContextValueForKey("ReportType"), this); this.WebContentMetadata.UpdateMetadataWithViewReference(this.ViewReference); this.AllowsXMLExport = this.WebContentMetadata.AllowsXMLExport; this.AllowsFullScreen = this.WebContentMetadata.AllowsFullScreen; this.RecordIdentification = viewReference.ContextValueForKey("RecordId"); IIdentifier identifier = this.BuildIdentifier(); UPMWebContentPage page = new UPMWebContentPage(identifier) { Invalid = true, PrintEnabled = this.ViewReference.ContextValueForKey("ButtonPrint") == "true" }; this.TopLevelElement = page; this.WebContentPage.ReportType = this.WebContentMetadata.ReportType; this.ApplyLoadingStatusOnPage(page); }
private Page UpdatedElementForPage(UPMWebContentPage originalPage) { if (!this.pageBuilt) { if (!this.pageRequested) { this.pageRequested = true; this.BuildPage(); return(this.WebContentPage); } } if (!this.WebContentPage.Invalid) { return(this.WebContentPage); } if (originalPage.Status is UPMErrorStatus) { UPMWebContentPage page = new UPMWebContentPage(originalPage.Identifier) { Status = originalPage.Status, Invalid = true }; this.TopLevelElement = page; return(page); } this.TopLevelElement = this.CreateUpdatedPageWithIdentifier(originalPage.Identifier); return(this.TopLevelElement as Page); }
/// <summary> /// Webs the content meta data finished with redirect URL. /// </summary> /// <param name="clientReport">The client report.</param> /// <param name="url">The URL.</param> public void WebContentMetaDataFinishedWithRedirectUrl(UPWebContentMetadata clientReport, Uri url) { UPMWebContentPage page = new UPMWebContentPage(this.Page.Identifier); page.Invalid = false; this.TopLevelElement = page; page.WebContentUrl = url; this.InformAboutDidChangeTopLevelElement(null, null, null, null); }
/// <summary> /// Builds the client report for page cached. /// </summary> /// <param name="page">The page.</param> /// <param name="cached">if set to <c>true</c> [cached].</param> /// <returns></returns> public override bool BuildClientReportForPage(UPMWebContentPage page, bool cached = false) { if (cached || !this.UpdateReportButtonState()) { return(base.BuildClientReportForPage(page, cached)); } return(false); }
/// <summary> /// Webs the content meta data finished with XML string. /// </summary> /// <param name="clientReport">The client report.</param> /// <param name="xmlString">The XML string.</param> public void WebContentMetaDataFinishedWithXmlString(UPWebContentMetadata clientReport, string xmlString) { UPMWebContentPage page = new UPMWebContentPage(this.Page.Identifier); page.Invalid = false; this.TopLevelElement = page; this.xmlContentString = xmlString; page.ReportType = "ClientReport"; ((UPMWebContentPage)this.Page).WebContentHtml = this.xmlContentString; this.InformAboutDidChangeTopLevelElement(null, null, null, null); }
/// <summary> /// Specials the handling for page. /// </summary> /// <param name="page">The page.</param> /// <returns></returns> protected override Page SpecialHandlingForPage(UPMWebContentPage page) { if (this.LocalUrlOfReportPdf != null) { page.Invalid = false; this.TopLevelElement = page; this.UpdateReportButtonState(); return(page); } return(null); }
/// <summary> /// Initializes a new instance of the <see cref="UPWebContentPageModelController"/> class. /// </summary> /// <param name="htmlString">The HTML string.</param> public UPWebContentPageModelController(string htmlString) : base(null) { this.WebContentMetadata = new UPWebContentMetadataStaticHtml(null); UPMWebContentPage page = new UPMWebContentPage(StringIdentifier.IdentifierWithStringId("Web")) { Invalid = false, ReportType = this.WebContentMetadata.ReportType, WebContentHtml = htmlString }; this.TopLevelElement = page; }
private Page CreateUpdatedPageWithIdentifier(IIdentifier identifier) { UPMWebContentPage page = new UPMWebContentPage(identifier) { ReportType = this.WebContentPage.ReportType, PrintEnabled = this.WebContentPage.PrintEnabled }; Page special = this.SpecialHandlingForPage(page); if (special != null) { return(special); } if (this.WebContentMetadata is UPWebContentMetadataUrl) { UPWebContentMetadataUrl webContentMetaDataUrl = (UPWebContentMetadataUrl)this.WebContentMetadata; page.WebContentUrl = webContentMetaDataUrl.Url; } else if (this.WebContentMetadata is UPWebContentMetadataClientReport) { this.AllowsXMLExport = true; if (!this.BuildClientReportForPage(page)) { return(page); } this.ApplyLoadingStatusOnPage(page); } else if (this.WebContentMetadata is UPWebContentMetadataServerReport) { page.WebContentUrl = ((UPWebContentMetadataServerReport)this.WebContentMetadata).CalcServiceURLWithRecordIdentification(this.RecordIdentification); string loadManuallySetting = this.ViewReference.ContextValueForKey("LoadManually"); if (!string.IsNullOrEmpty(loadManuallySetting) && loadManuallySetting != "false") { page.LoadContentManually = true; } } page.Invalid = false; page.Status = null; return(page); }
/// <summary> /// Builds the client report for page cached. /// </summary> /// <param name="page">The page.</param> /// <param name="cached">if set to <c>true</c> [cached].</param> /// <returns></returns> public virtual bool BuildClientReportForPage(UPMWebContentPage page, bool cached = false) { if (!(this.WebContentMetadata is UPWebContentMetadataClientReport)) { return(true); } UPWebContentMetadataClientReport clientReport = (UPWebContentMetadataClientReport)this.WebContentMetadata; if (cached) { page.Invalid = false; page.WebContentHtml = clientReport.CalcClientReportFromCachedResult(); return(true); } page.Invalid = true; this.ApplyLoadingStatusOnPage(page); clientReport.StartWithRecordIdentificationLinkIdParameters(this.RecordIdentification, this.LinkId, this.FieldValueDictionary); return(false); }
/// <summary> /// Specials the handling for page. /// </summary> /// <param name="page">The page.</param> /// <returns></returns> protected virtual Page SpecialHandlingForPage(UPMWebContentPage page) { return(null); }