/// <summary> /// /// </summary> /// <param name="ctr"></param> /// <returns></returns> public static ControlRenderMode GetControlRenderMode(Control ctr) { PageRenderMode pageRenderMode = Request.GetRequestPageRenderMode(); ControlRenderMode renderMode = new ControlRenderMode(pageRenderMode); PageRenderModePageCache currentPageCache = PageRenderModeHelper.GetPageRenderModeCache(ctr.Page); PageRenderModePageCache requestPageCache = renderMode.PageCache; int currentPageLevel = GetPageLevel(currentPageCache); string currentPageUniqueID = GetPageUniqueID(currentPageCache); int requestPageLevel = GetPageLevel(requestPageCache); string requestPageUniqueID = GetPageUniqueID(requestPageCache); if (requestPageLevel == currentPageLevel) { if (ctr.UniqueID == pageRenderMode.RenderControlUniqueID) { renderMode.OnlyRenderSelf = true; } } else if (requestPageLevel > currentPageLevel) { string id = requestPageUniqueID.Split(',')[currentPageLevel]; if (ctr.UniqueID == id) { renderMode.OnlyRenderSelf = true; } } return(renderMode); }
/// <summary> /// 获得客户端显示对话框的url /// </summary> /// <returns></returns> protected virtual string GetDialogUrl() { PageRenderMode originalPageRenderMode = WebUtility.GetRequestPageRenderMode(); string controlID = null; if (originalPageRenderMode != null) { controlID = ScriptControlHelper.GetPageUniqueID(originalPageRenderMode.PageCache); } if (controlID.IsNotEmpty()) { controlID = controlID + "$" + this.UniqueID; } else { controlID = this.UniqueID; } PageRenderMode pageRenderMode = new PageRenderMode(controlID, "DialogControl"); string url = WebUtility.GetRequestExecutionUrl(pageRenderMode); NameValueCollection originalParams = UriHelper.GetUriParamsCollection(url); originalParams.Remove(PassportManager.TicketParamName); return(UriHelper.CombineUrlParams(url, originalParams, UriHelper.GetUriParamsCollection(this.ControlParams.ToRequestParams()))); }
/// <summary> /// 根据UserID生成弹出对话框的url地址 /// </summary> /// <returns></returns> protected override string GetDialogUrl() { PageRenderMode pageRenderMode = new PageRenderMode(this.UniqueID, "DialogControl"); string url = WebUtility.GetRequestExecutionUrl(pageRenderMode, "userID"); return(url + "&" + this.ControlParams.ToRequestParams()); }
private Control CreateStatusDisplayControl(WfProcessCurrentInfo atp, UserIMAddressCollection extendInfo) { HtmlGenericControl Container = new HtmlGenericControl("span"); HtmlGenericControl firstLine = new HtmlGenericControl("span"); Container.Controls.Add(firstLine); HtmlAnchor statusAnchor = new HtmlAnchor(); firstLine.Controls.Add(statusAnchor); statusAnchor.InnerHtml = GetStatusText(atp, extendInfo); statusAnchor.HRef = "#"; string deptName = atp.Department.DisplayName; statusAnchor.Title = GetAllAssigneesStatusText(atp); statusAnchor.Attributes["onclick"] = "onWfStatusLinkClick()"; HtmlGenericControl seperator = new HtmlGenericControl("span"); firstLine.Controls.Add(seperator); seperator.InnerHtml = " "; PageRenderMode mode = WebUtility.GetRequestPageRenderMode(); if (mode.IsHtmlRender) { HtmlAnchor traceAnchor = new HtmlAnchor(); firstLine.Controls.Add(traceAnchor); HtmlImage logo = new HtmlImage(); traceAnchor.Controls.Add(logo); logo.Style["border"] = "none"; logo.Alt = Translator.Translate(Define.DefaultCulture, "流程跟踪..."); logo.Style["vertical-align"] = "middle"; logo.Src = GetImageByStatus(atp.Status); InitTraceControlEntry(traceAnchor, atp.ResourceID, atp.InstanceID); } HtmlGenericControl secondLine = new HtmlGenericControl("div"); Container.Controls.Add(secondLine); secondLine.Controls.Add(CreateDetailControl(atp, extendInfo)); secondLine.Style["display"] = "none"; return(Container); }
/// <summary> /// 根据resourceID和processID生成弹出对话框的url地址 /// </summary> /// <returns></returns> protected override string GetDialogUrl() { PageRenderMode pageRenderMode = new PageRenderMode(this.UniqueID, "DialogControl"); string url = WebUtility.GetRequestExecutionUrl(pageRenderMode, "resourceID", "activityID", "processID"); NameValueCollection originalParams = UriHelper.GetUriParamsCollection(url); originalParams.Remove(PassportManager.TicketParamName); return(UriHelper.CombineUrlParams(url, originalParams, UriHelper.GetUriParamsCollection(this.ControlParams.ToRequestParams()))); }
protected override void OnPreRender(EventArgs e) { PageRenderMode pageRenderMode = new PageRenderMode(this.UniqueID, "openExportWordDocumentUrl"); pageRenderMode.ContentTypeKey = ResponseContentTypeKey.WORD.ToString(); pageRenderMode.DispositionType = ResponseDispositionType.Inline; pageRenderMode.AttachmentFileName = "exports.doc"; pageRenderMode.UseNewPage = false; exportUrl.Value = WebUtility.GetRequestExecutionUrl(pageRenderMode); exportBtn.Visible = WebUtility.GetRequestPageRenderMode().IsHtmlRender; base.OnPreRender(e); }
public override void RenderControl(HtmlTextWriter writer) { PageRenderMode renderMode = WebUtility.GetRequestPageRenderMode(); if (renderMode.IsHtmlRender == false) { StringBuilder strB = new StringBuilder(); StringWriter sw = new StringWriter(strB); using (HtmlTextWriter baseWriter = new HtmlTextWriter(sw)) { base.RenderControl(baseWriter); } renderMode.RenderPageOnlySelf(strB.ToString()); } else { base.RenderControl(writer); } }
private void CheckAccessTicket(AccessTicketCheckPhase phase) { if (this.Enabled && IsCheckPhaseMatched(phase)) { PageRenderMode renderMode = Request.GetRequestPageRenderMode(); if (renderMode == null || renderMode.UseNewPage == false) { Uri matchedUrl = null; if (this.CheckUrl) { matchedUrl = this.Page.Request.Url; } AccessTicketCheckEventArgs eventArgs = null; try { AccessTicket ticket = AccessTicketManager.CheckAccessTicket(matchedUrl, this.UrlCheckParts, this.Timeout); eventArgs = new AccessTicketCheckEventArgs(ticket, true, string.Empty); } catch (AccessTicketCheckException ex) { AccessTicket ticket = AccessTicketManager.GetAccessTicket(); eventArgs = new AccessTicketCheckEventArgs(ticket, false, ex.Message); } OnTicketChecking(eventArgs); if (eventArgs.IsValid == false) { throw new AccessTicketCheckException(eventArgs.ErrorMessage); } } } }
public Requests.CmsPageRequest Build(IHttpRequest httpRequest) { var routeRaw = httpRequest.QueryString[PageDesignerUriComponents.PageId]; var environmentRaw = httpRequest.QueryString[PageDesignerUriComponents.ContentEnvironment]; var contentVersionRaw = httpRequest.QueryString[PageDesignerUriComponents.ContentVersion]; var viewModeRaw = httpRequest.QueryString[PageDesignerUriComponents.ViewMode]; var siteRaw = httpRequest.QueryString[PageDesignerUriComponents.SiteId]; PageRenderMode pageRenderMode = PageRenderMode.Readonly; if (!string.IsNullOrWhiteSpace(viewModeRaw)) { pageRenderMode = (PageRenderMode)Enum.Parse(typeof(PageRenderMode), viewModeRaw, true); } ContentEnvironment env = ContentEnvironment.Live; if (!string.IsNullOrWhiteSpace(environmentRaw)) { env = (ContentEnvironment)Enum.Parse(typeof(ContentEnvironment), environmentRaw, true); } else { if (pageRenderMode == PageRenderMode.PageDesigner) { env = ContentEnvironment.Draft; } } decimal contentVersion = 0; if (!string.IsNullOrWhiteSpace(contentVersionRaw)) { contentVersion = Convert.ToDecimal(contentVersionRaw); } var routeContext = new Requests.CmsPageRequest(); routeContext.PageRenderMode = pageRenderMode; SiteRoute route; if (!string.IsNullOrWhiteSpace(routeRaw)) { route = new ContentPageRoute { Authority = UriAuthorityFilter.Any, PageId = new Guid(routeRaw), SiteId = new Guid(siteRaw), }; } else { var success = CmsRoutes.Current.TryResolveRoute(httpRequest.Uri, out route); } routeContext.Route = route; if (route?.PageId == null) { return(routeContext); } var cmsPageVersions = new CmsPageRepository().FindContentVersions(By.ContentId(route.PageId.Value), env).Result; if (env == ContentEnvironment.Archive) { routeContext.CmsPage = cmsPageVersions.Single(x => x.ContentVersion == contentVersion); } else { routeContext.CmsPage = cmsPageVersions.Single(); } return(routeContext); }
/// <summary> /// 通过页面输出模式,构造出UniqueID为controlUniqueID的控件输出模式 /// </summary> /// <param name="pageRenderMode">页面输出模式</param> /// <remarks>通过页面输出模式,构造出UniqueID为controlUniqueID的控件输出模式</remarks> public ControlRenderMode(PageRenderMode pageRenderMode) : this() { LoadFromPageRenderMode(pageRenderMode); }
/// <summary> /// 通过页面输出状态,加载控件的输出状态 /// </summary> /// <param name="pageRenderMode">页面输出模式</param> /// <remarks>通过页面输出状态,加载控件的输出状态</remarks> public void LoadFromPageRenderMode(PageRenderMode pageRenderMode) { //if (!string.IsNullOrEmpty(controlUniqueID) && controlUniqueID == pageRenderMode.RenderControlUniqueID) //{ // this._OnlyRenderSelf = true; //} this._UseNewPage = pageRenderMode.UseNewPage; this._ContentTypeKey = pageRenderMode.ContentTypeKey; this._DispositionType = pageRenderMode.DispositionType; this._AttachmentFileName = pageRenderMode.AttachmentFileName; this._PageCache = pageRenderMode.PageCache; this._RenderArgument = pageRenderMode.RenderArgument; }
/// <summary> /// 获得客户端显示对话框的url /// </summary> /// <returns></returns> protected virtual string GetDialogUrl() { PageRenderMode originalPageRenderMode = Request.GetRequestPageRenderMode(); string controlID = null; if (originalPageRenderMode != null) controlID = ScriptControlHelper.GetPageUniqueID(originalPageRenderMode.PageCache); if (controlID.IsNotEmpty()) controlID = controlID + "$" + this.UniqueID; else controlID = this.UniqueID; PageRenderMode pageRenderMode = new PageRenderMode(controlID, "DialogControl"); string url = Request.GetRequestExecutionUrl(pageRenderMode); NameValueCollection originalParams = UriHelper.GetUriParamsCollection(url); originalParams.Remove(TicketParamName); return UriHelper.CombineUrlParams(url, originalParams); }