/// <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); }
/// <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> /// 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) { this.ControllerState = GroupModelControllerState.Finished; UPMWebContentGroup webcontentGroup = (UPMWebContentGroup)this.Group; webcontentGroup.WebContentUrl = url; this.ControllerState = GroupModelControllerState.Finished; this.Delegate.GroupModelControllerFinished(this); }
/// <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> /// 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) { this.ControllerState = GroupModelControllerState.Pending; UPMWebContentGroup webcontentGroup = (UPMWebContentGroup)this.Group; if (webcontentGroup != null) { webcontentGroup.WebContentHtml = xmlString; } this.ControllerState = GroupModelControllerState.Finished; this.Delegate.GroupModelControllerFinished(this); }
/// <summary> /// Webs the content meta data failed with error. /// </summary> /// <param name="clientReport">The client report.</param> /// <param name="error">The error.</param> public void WebContentMetaDataFailedWithError(UPWebContentMetadata clientReport, Exception error) { this.ContinueBuildPage(); }
/// <summary> /// Applies the link record identification. /// </summary> /// <param name="recordIdentification">The record identification.</param> /// <param name="context">The context.</param> /// <param name="_viewReference">The view reference.</param> /// <returns></returns> public UPMGroup ApplyLinkRecordIdentification(string recordIdentification, Dictionary <string, object> context, ViewReference _viewReference) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; if (this.formItem != null) { string reportType = this.formItem.ViewReference.ContextValueForKey("ReportType"); if (reportType == "ClientReport") { Menu configMenu = configStore.MenuByName(this.formItem.ViewReference.ContextValueForKey("ConfigName")); this.viewReference = this.formItem.ViewReference.ViewReferenceWith(context); if (configMenu != null) { this.viewReference = configMenu.ViewReference.ViewReferenceWith(this.viewReference.ContextValueForKey("RecordId")); } } else { this.viewReference = this.formItem.ViewReference; } } else { if (_viewReference == null) { Menu configMenu = configStore.MenuByName(this.TabConfig.Type.Substring("WEBCONTENT_".Length)); this.viewReference = configMenu.ViewReference.ViewReferenceWith(recordIdentification); } else { this.viewReference = _viewReference; } } this.webContentMetadata = UPWebContentMetadata.WebContentMetaDataFromViewReference(this.viewReference, this); this.RecordIdentification = this.viewReference.ContextValueForKey("RecordId"); if (this.ExplicitTabIdentifier == null) { this.ExplicitTabIdentifier = this.TabIdentifierForRecordIdentification( !string.IsNullOrEmpty(this.RecordIdentification) ? this.RecordIdentification : recordIdentification); } this.tmpGroup = new UPMWebContentGroup(this.ExplicitTabIdentifier); string linkIdStr = this.viewReference.ContextValueForKey("LinkId"); if (!string.IsNullOrEmpty(linkIdStr)) { this.LinkId = Convert.ToInt32(linkIdStr); } else { this.LinkId = -1; } string parentLink = this.viewReference.ContextValueForKey("ParentLink"); if (!string.IsNullOrEmpty(parentLink)) { this.linkReader = new UPCRMLinkReader(this.RecordIdentification, parentLink, UPRequestOption.FastestAvailable, this); this.linkReader.Start(); this.ControllerState = GroupModelControllerState.Pending; return(null); } this.ContinueBuildGroup(); return(this.Group); }
/// <summary> /// Webs the content meta data failed with error. /// </summary> /// <param name="clientReport">The client report.</param> /// <param name="error">The error.</param> public void WebContentMetaDataFailedWithError(UPWebContentMetadata clientReport, Exception error) { this.ControllerState = GroupModelControllerState.Error; this.Delegate.GroupModelControllerFinished(this); }