private bool IsFlowNavigatorItem(ControlItem item) { if (item.Name != "Submit" && item.Name != "Approve" && item.Name != "Return" && item.Name != "Reject" && item.Name != "Notify" && item.Name != "FlowDelete" && item.Name != "Plus" && item.Name != "Pause" && item.Name != "Comment") { return false; } return true; }
private bool IsControlVisible(ControlItem item) { string ctrlName = item.ControlName; return IsControlVisible(ctrlName) && item.ControlVisible; }
protected override void createButton(HtmlTextWriter writer, ControlItem ctrl, WebGridView gdView) { if (!this.FLActive && GloFix.IsFlowItem(ctrl.ControlName)) return; string command = "cmd" + ctrl.ControlName, text = ctrl.ControlText, imageUrl = ctrl.ImageUrl, mouseOverImageUrl = ctrl.MouseOverImageUrl, disenableImageUrl = ctrl.DisenableImageUrl; int size = ctrl.Size; bool IsVisible = IsControlVisible(ctrl); if (ctrl.ControlName == "Notify" && this.FLNotifyOff) IsVisible = false; bool IsEnable = this.DesignMode ? true : getUserSetEnabled(ctrl.ControlName, this.CurrentNavState); CtrlType ct = ctrl.ControlType; ClientScriptManager csm = Page.ClientScript; string tooltiptext = ""; if (!this.DesignMode) { tooltiptext = SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLTools", "FLWebNavigator", "ControlText", true); string[] arrtext = tooltiptext.Split(';'); switch (ctrl.ControlName) { case "First": text = arrtext[0]; tooltiptext = arrtext[0]; break; case "Previous": text = arrtext[1]; tooltiptext = arrtext[1]; break; case "Next": text = arrtext[2]; tooltiptext = arrtext[2]; break; case "Last": text = arrtext[3]; tooltiptext = arrtext[3]; break; case "Add": text = arrtext[4]; tooltiptext = arrtext[4]; break; case "Update": text = arrtext[5]; tooltiptext = arrtext[5]; break; case "Delete": text = arrtext[6]; tooltiptext = arrtext[6]; break; case "OK": text = arrtext[7]; tooltiptext = arrtext[7]; break; case "Cancel": text = arrtext[8]; tooltiptext = arrtext[8]; break; case "Apply": text = arrtext[9]; tooltiptext = arrtext[9]; break; case "Abort": text = arrtext[10]; tooltiptext = arrtext[10]; break; case "Query": text = arrtext[11]; tooltiptext = arrtext[11]; break; case "Print": text = arrtext[12]; tooltiptext = arrtext[12]; break; case "Export": text = arrtext[13]; tooltiptext = arrtext[13]; break; case "Submit": text = arrtext[14]; tooltiptext = arrtext[14]; break; case "Approve": text = arrtext[15]; tooltiptext = arrtext[15]; break; case "Return": text = arrtext[16]; tooltiptext = arrtext[16]; break; case "Reject": text = arrtext[17]; tooltiptext = arrtext[17]; break; case "Notify": text = arrtext[18]; tooltiptext = arrtext[18]; break; case "FlowDelete": text = arrtext[19]; tooltiptext = arrtext[19]; break; case "Plus": text = arrtext[20]; tooltiptext = arrtext[20]; break; case "Pause": text = arrtext[21]; tooltiptext = arrtext[21]; break; case "Comment": text = arrtext[22]; tooltiptext = arrtext[22]; break; default: tooltiptext = ctrl.ControlName; break; } } writer.RenderBeginTag(HtmlTextWriterTag.Td); #region Button if (ct == CtrlType.Button && IsVisible) { writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + command); if (!isFlowConditionReqired(ctrl.ControlName)) { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "alert('" + SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLClientControls", "FLNavigator", "FlowNotDefine") + "')"); } else if (!hasApplyOrAbort(ctrl.ControlName)) { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "alert('" + SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLClientControls", "FLNavigator", "ApplyFirst") + "')"); } else { if (ctrl.ControlName == "Add") { if (gdView != null && gdView.EditURL != null && gdView.EditURL != "" && !gdView.OpenEditUrlInServerMode) { string url = gdView.getURL(WebGridView.OpenEditMode.Insert, null); if (url != "") writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "window.open('" + url + "','','height=" + gdView.OpenEditHeight + ",width=" + gdView.OpenEditWidth + ",toolbar=no,scrollbars,resizable');return false;"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command)); } } else if (ctrl.ControlName == "Delete") { if (this.SureDelete) { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "if(confirm('sure to delete?')){" + "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command) + "}"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command)); } } else if (ctrl.ControlName == "Submit" || ctrl.ControlName == "Approve" || ctrl.ControlName == "Return" || ctrl.ControlName == "Notify" || ctrl.ControlName == "Plus" || ctrl.ControlName == "Comment" || (ctrl.ControlName == "Pause" && this.OrganizationControl)) { string script = GloScript(ctrl.ControlName); writer.AddAttribute(HtmlTextWriterAttribute.Onclick, script); } else if (ctrl.ControlName == "Apply" || ctrl.ControlName == "Ok" || ctrl.ControlName == "Update") { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command)); //writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var start=new Date().getTime(); while(true) if(new Date().getTime()-start>5000) break; var aaa = document.getElementById('cmdApply');aaa.disabled=true;"); //writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackEventReference(this, command)); } else { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command)); } } // render Button tag writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + size + "px; height:" + ((this.Height.Value <= 20) ? 25 : this.Height.Value) + "px; color:" + this.ForeColor.Name.Replace("ff", "#") + ";background-color:" + this.BackColor.Name.Replace("ff", "#") + ";"); writer.AddAttribute(HtmlTextWriterAttribute.Title, tooltiptext);// new add by ccm if (!IsEnable) { writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "true"); } writer.RenderBeginTag(HtmlTextWriterTag.Button); writer.Write(text); writer.RenderEndTag(); } #endregion #region HyperLink else if (ct == CtrlType.HyperLink && IsVisible) { if (!isFlowConditionReqired(ctrl.ControlName)) { writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:alert('" + SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLClientControls", "FLNavigator", "FlowNotDefine") + "')"); } else if (!hasApplyOrAbort(ctrl.ControlName)) { writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:alert('" + SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLClientControls", "FLNavigator", "ApplyFirst") + "')"); } else { if (ctrl.ControlName == "Add") { if (gdView != null && gdView.EditURL != null && gdView.EditURL != "" && !gdView.OpenEditUrlInServerMode) { string url = gdView.getURL(WebGridView.OpenEditMode.Insert, null); if (url != "") writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:window.open('" + url + "','','height=" + gdView.OpenEditHeight + ",width=" + gdView.OpenEditWidth + ",toolbar=no,scrollbars,resizable');return false;"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + csm.GetPostBackClientHyperlink(this, command)); } } else if (ctrl.ControlName == "Delete") { if (this.SureDelete) { writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:if(confirm('sure to delete?')){" + csm.GetPostBackClientHyperlink(this, command) + "}"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + csm.GetPostBackClientHyperlink(this, command)); } } else if (ctrl.ControlName == "Submit" || ctrl.ControlName == "Approve" || ctrl.ControlName == "Return" || ctrl.ControlName == "Notify" || ctrl.ControlName == "Plus" || ctrl.ControlName == "Comment" || (ctrl.ControlName == "Pause" && this.OrganizationControl)) { string script = GloScript(ctrl.ControlName); writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + script + "}"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + csm.GetPostBackEventReference(this, command)); } } // render Link tag writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + size + "px; color:" + this.ForeColor.Name.Replace("ff", "#") + ";background-color:" + this.BackColor.Name.Replace("ff", "#") + ";"); writer.AddAttribute(HtmlTextWriterAttribute.Title, tooltiptext);// new add by ccm if (!IsEnable) { writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "true"); } writer.RenderBeginTag(HtmlTextWriterTag.A); writer.Write(text); writer.RenderEndTag(); } #endregion #region Image else if (ct == CtrlType.Image && imageUrl != null && imageUrl != "" && IsVisible) { if (!isFlowConditionReqired(ctrl.ControlName)) { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "alert('" + SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLClientControls", "FLNavigator", "FlowNotDefine") + "')"); } else if (!hasApplyOrAbort(ctrl.ControlName)) { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "alert('" + SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLClientControls", "FLNavigator", "ApplyFirst") + "')"); } else { if (ctrl.ControlName == "Add") { if (gdView != null && gdView.EditURL != null && gdView.EditURL != "" && !gdView.OpenEditUrlInServerMode) { string url = gdView.getURL(WebGridView.OpenEditMode.Insert, null); if (url != "") writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "window.open('" + url + "','','height=" + gdView.OpenEditHeight + ",width=" + gdView.OpenEditWidth + ",toolbar=no,scrollbars,resizable');return false;"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackClientHyperlink(this, command)); } } else if (ctrl.ControlName == "Delete") { if (this.SureDelete) { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "if(confirm('sure to delete?')){" + csm.GetPostBackEventReference(this, command) + "}"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackEventReference(this, command)); } } else if (ctrl.ControlName == "Submit" || ctrl.ControlName == "Approve" || ctrl.ControlName == "Return" || ctrl.ControlName == "Notify" || ctrl.ControlName == "Plus" || ctrl.ControlName == "Comment" || (ctrl.ControlName == "Pause" && this.OrganizationControl)) { string script = GloScript(ctrl.ControlName); writer.AddAttribute(HtmlTextWriterAttribute.Onclick, script); } else if (ctrl.ControlName == "Reject") { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "if(confirm('" + SysMsg.GetSystemMessage(CliUtils.fClientLang, "FLClientControls", "FLNavigator", "FlowRejectConfirm") + "')){" + csm.GetPostBackEventReference(this, command) + "}"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackEventReference(this, command)); } } // render Image tag writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + size + "px;"); if (!IsEnable) { if (disenableImageUrl != null && disenableImageUrl != "") writer.AddAttribute(HtmlTextWriterAttribute.Src, disenableImageUrl); else { writer.AddAttribute(HtmlTextWriterAttribute.Src, imageUrl); writer.AddAttribute("onmouseover", "this.src='" + mouseOverImageUrl + "'"); writer.AddAttribute("onmouseout", "this.src='" + imageUrl + "'"); } writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "true"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Src, imageUrl); writer.AddAttribute("onmouseover", "this.src='" + mouseOverImageUrl + "'"); writer.AddAttribute("onmouseout", "this.src='" + imageUrl + "'"); } writer.AddAttribute(HtmlTextWriterAttribute.Alt, tooltiptext);// new add by ccm writer.AddAttribute(HtmlTextWriterAttribute.Title, tooltiptext); writer.RenderBeginTag(HtmlTextWriterTag.Img); writer.RenderEndTag(); } #endregion writer.RenderEndTag(); // </td> writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + this.ControlsGap + "px;"); writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.RenderEndTag(); }
private GridViewInnerNavigatorCollection InitControls(GridViewInnerNavigatorCollection Ctrls) { #region add default controls // Add Add Control ControlItem AddItem = new ControlItem ("Add", "add", WebNavigator.CtrlType.Image, "../image/uipics/add.gif", "../image/uipics/add2.gif", "../image/uipics/add3.gif", 26, true); Ctrls.Add(AddItem); // Add Query Control ControlItem QueryItem = new ControlItem ("Query", "query", WebNavigator.CtrlType.Image, "../image/uipics/query.gif", "../image/uipics/query2.gif", "../image/uipics/query3.gif", 26, true); Ctrls.Add(QueryItem); // Add Apply Control ControlItem ApplyItem = new ControlItem ("Apply", "apply", WebNavigator.CtrlType.Image, "../image/uipics/apply.gif", "../image/uipics/apply2.gif", "../image/uipics/apply3.gif", 26, true); Ctrls.Add(ApplyItem); // Add Abort Control ControlItem AbortItem = new ControlItem ("Abort", "abort", WebNavigator.CtrlType.Image, "../image/uipics/abort.gif", "../image/uipics/abort2.gif", "../image/uipics/abort3.gif", 26, true); Ctrls.Add(AbortItem); // Add OK Control ControlItem OKItem = new ControlItem ("OK", "Insert", WebNavigator.CtrlType.Image, "../image/uipics/ok.gif", "../image/uipics/ok2.gif", "../image/uipics/ok3.gif", 26, true); Ctrls.Add(OKItem); // Add Cancel Control ControlItem CancelItem = new ControlItem ("Cancel", "cancel", WebNavigator.CtrlType.Image, "../image/uipics/cancel.gif", "../image/uipics/cancel2.gif", "../image/uipics/cancel3.gif", 26, true); Ctrls.Add(CancelItem); #endregion return Ctrls; }
protected override void RenderFlowItems(HtmlTextWriter writer) { string[] ctrlTexts = { "submit", "approve", "return", "reject", "notify", "flowdelete", "plus", "pause", "comment" }; if (this.GetServerText) { } #region add default controls //0:submit,1:approve,2:return,3:reject,4:notify,5:flowdelete,6:plus,7:pause bool[] vcs = new bool[9] { true, true, true, true, true, true, true, true, true }; // Add Submit Control ControlItem SubmitItem = new ControlItem("Submit", ctrlTexts[0], CtrlType.Image, "../image/uipics/submit.gif", "../image/uipics/submit2.gif", "", 25, vcs[0]); this.NavControls.Add(SubmitItem); // Add Approve Control ControlItem ApproveItem = new ControlItem("Approve", ctrlTexts[1], CtrlType.Image, "../image/uipics/Approve.gif", "../image/uipics/Approve2.gif", "", 25, vcs[1]); this.NavControls.Add(ApproveItem); // Add Return Control ControlItem ReturnItem = new ControlItem("Return", ctrlTexts[2], CtrlType.Image, "../image/uipics/Return.gif", "../image/uipics/Return2.gif", "", 25, vcs[2]); this.NavControls.Add(ReturnItem); // Add Reject Control ControlItem RejectItem = new ControlItem("Reject", ctrlTexts[3], CtrlType.Image, "../image/uipics/Reject.gif", "../image/uipics/Reject2.gif", "", 25, vcs[3]); this.NavControls.Add(RejectItem); // Add Notify Control ControlItem NotifyItem = new ControlItem("Notify", ctrlTexts[4], CtrlType.Image, "../image/uipics/Notify.gif", "../image/uipics/Notify2.gif", "", 25, vcs[4]); this.NavControls.Add(NotifyItem); // Add FlowDelete Control ControlItem FlowDeleteItem = new ControlItem("FlowDelete", ctrlTexts[5], CtrlType.Image, "../image/uipics/FlowDelete.gif", "../image/uipics/FlowDelete2.gif", "", 25, vcs[5]); this.NavControls.Add(FlowDeleteItem); // Add Plus Control ControlItem plusItem = new ControlItem("Plus", ctrlTexts[6], CtrlType.Image, "../image/uipics/Plus.gif", "../image/uipics/Plus2.gif", "", 25, vcs[6]); this.NavControls.Add(plusItem); // Add Pause Control ControlItem pauseItem = new ControlItem("Pause", ctrlTexts[7], CtrlType.Image, "../image/uipics/Pause.gif", "../image/uipics/Pause2.gif", "", 25, vcs[7]); this.NavControls.Add(pauseItem); // Add Comment Control ControlItem commentItem = new ControlItem("Comment", ctrlTexts[8], CtrlType.Image, "../image/uipics/Comment.gif", "../image/uipics/Comment2.gif", "", 25, vcs[8]); this.NavControls.Add(commentItem); #endregion InitializeFlowStates(); }
protected void InitNavControls(bool NavForAddAndQuery, GridViewRow row, DataControlField[] fields, bool AllowInNav) { if (NavForAddAndQuery) nav1.ID = "InPageNavigatorForAddAndQuery"; else nav2.ID = "InPageNavigatorForOKAndCancel"; nav1.AddDefaultControls = false; nav2.AddDefaultControls = false; string[] ctrlTexts = { "add", "query", "apply", "abort", "insert", "cancel" }; if (this.GetServerText) { language = CliUtils.fClientLang; String message = SysMsg.GetSystemMessage(language, "Srvtools", "WebGridView", "ControlText", true); ctrlTexts = message.Split(';'); } else { int x = ctrlTexts.Length; for (int y = 0; y < x; y++) { foreach (ControlItem item in this.NavControls) { if (item.ControlName.ToUpper() == ctrlTexts[y].ToUpper()) { ctrlTexts[y] = item.ControlText; break; } } } } object obj = this.GetObjByID(this.DataSourceID); WebDataSource wds = null; if (obj != null && obj is WebDataSource) { wds = (WebDataSource)obj; } if (this.NavControls.Count == 0) { #region add default controls if (wds != null && wds.AllowAdd) { // Add Add Control ControlItem AddItem = new ControlItem ("Add", ctrlTexts[0], this.InnerNavigatorShowStyle, "../image/uipics/add.gif", "../image/uipics/add2.gif", "../image/uipics/add3.gif", 26, true); this.NavControls.Add(AddItem); } // Add Query Control ControlItem QueryItem = new ControlItem ("Query", ctrlTexts[1], this.InnerNavigatorShowStyle, "../image/uipics/query.gif", "../image/uipics/query2.gif", "../image/uipics/query3.gif", 26, true); this.NavControls.Add(QueryItem); // Add Apply Control ControlItem ApplyItem = new ControlItem ("Apply", ctrlTexts[2], this.InnerNavigatorShowStyle, "../image/uipics/apply.gif", "../image/uipics/apply2.gif", "../image/uipics/apply3.gif", 26, true); this.NavControls.Add(ApplyItem); // Add Abort Control ControlItem AbortItem = new ControlItem ("Abort", ctrlTexts[3], this.InnerNavigatorShowStyle, "../image/uipics/abort.gif", "../image/uipics/abort2.gif", "../image/uipics/abort3.gif", 26, true); this.NavControls.Add(AbortItem); // Add OK Control ControlItem OKItem = new ControlItem ("OK", ctrlTexts[4], this.InnerNavigatorShowStyle, "../image/uipics/ok.gif", "../image/uipics/ok2.gif", "../image/uipics/ok3.gif", 26, true); this.NavControls.Add(OKItem); // Add Cancel Control ControlItem CancelItem = new ControlItem ("Cancel", ctrlTexts[5], this.InnerNavigatorShowStyle, "../image/uipics/cancel.gif", "../image/uipics/cancel2.gif", "../image/uipics/cancel3.gif", 26, true); this.NavControls.Add(CancelItem); #endregion } nav1.GetServerText = this.GetServerText; nav2.GetServerText = this.GetServerText; nav1.ShowDataStyle = WebNavigator.NavigatorStyle.GridStyle; nav2.ShowDataStyle = WebNavigator.NavigatorStyle.GridStyle; nav1.BindingObject = this.ID; nav2.BindingObject = this.ID; nav1.LinkLable = this.InnerNavigatorLinkLabel; nav2.LinkLable = this.InnerNavigatorLinkLabel; foreach (WebQueryField f in this.QueryFields) { nav1.QueryFields.Add(f); } if (NavForAddAndQuery) { if (AllowInNav) { foreach (ControlItem item in this.NavControls) { if (item.ControlName != "OK" && item.ControlName != "Cancel") { if (item.ControlName == "Add") item.ControlText = ctrlTexts[0]; else if (item.ControlName == "Query") item.ControlText = ctrlTexts[1]; else if (item.ControlName == "Apply") item.ControlText = ctrlTexts[2]; else if (item.ControlName == "Abort") item.ControlText = ctrlTexts[3]; nav1.NavControls.Add(item); } } foreach (Control ctrl in row.Cells[0].Controls) { if (ctrl is Table) { Table t = (Table)ctrl; TableCell tc = new TableCell(); tc.Controls.Add(nav1); int indx = t.Rows[0].Cells.GetCellIndex(tc); if (indx == -1) { t.Rows[0].Cells.Add(tc); } break; } } } } else { foreach (ControlItem item in this.NavControls) { if (item.ControlName == "OK" || item.ControlName == "Cancel") { if (item.ControlName == "OK") item.ControlText = ctrlTexts[4]; else if (item.ControlName == "Cancel") item.ControlText = ctrlTexts[5]; nav2.NavControls.Add(item); } } int i = fields.Length; for (int j = 0; j < i; j++) { if (fields[j] is CommandField || (fields[j] is TemplateField && string.IsNullOrEmpty(fields[j].SortExpression))) //remarked by lily 2009-2-24 爲了可以讓操作列可以設定HeadText //&& (fields[j].HeaderText == null || fields[j].HeaderText == ""))) { row.Cells[j].Controls.Add(nav2); break; } } } }
protected override void Render(HtmlTextWriter writer) { #if !VS90 if (this.NavControls.Count == 0 && AddDefaultControls) { string[] ctrlTexts = { "<<", "<", ">", ">>", "add", "update", "delete", "ok", "cancel", "apply", "abort", "query", "print", "export" }; if (this.GetServerText) { language = CliSysMegLag.GetClientLanguage(); language = CliUtils.fClientLang; String message = SysMsg.GetSystemMessage(language, "Srvtools", "WebNavigator", "ControlText", true); ctrlTexts = message.Split(';'); } // Add First Control ControlItem FirstItem = new ControlItem ("First", ctrlTexts[0], CtrlType.Image, "../image/uipics/first.gif", "../image/uipics/first2.gif", "../image/uipics/first3.gif", 26, true); this.NavControls.Add(FirstItem); // Add Previous Control ControlItem PreviousItem = new ControlItem ("Previous", ctrlTexts[1], CtrlType.Image, "../image/uipics/previous.gif", "../image/uipics/previous2.gif", "../image/uipics/previous3.gif", 26, true); this.NavControls.Add(PreviousItem); // Add Next Control ControlItem NextItem = new ControlItem ("Next", ctrlTexts[2], CtrlType.Image, "../image/uipics/next.gif", "../image/uipics/next2.gif", "../image/uipics/next3.gif", 26, true); this.NavControls.Add(NextItem); // Add Last Control ControlItem LastItem = new ControlItem ("Last", ctrlTexts[3], CtrlType.Image, "../image/uipics/last.gif", "../image/uipics/last2.gif", "../image/uipics/last3.gif", 26, true); this.NavControls.Add(LastItem); // Add Add Control ControlItem AddItem = new ControlItem ("Add", ctrlTexts[4], CtrlType.Image, "../image/uipics/add.gif", "../image/uipics/add2.gif", "../image/uipics/add3.gif", 26, true); this.NavControls.Add(AddItem); // Add Update Control ControlItem UpdateItem = new ControlItem ("Update", ctrlTexts[5], CtrlType.Image, "../image/uipics/edit.gif", "../image/uipics/edit2.gif", "../image/uipics/edit3.gif", 26, true); this.NavControls.Add(UpdateItem); // Add Delete Control ControlItem DeleteItem = new ControlItem ("Delete", ctrlTexts[6], CtrlType.Image, "../image/uipics/delete.gif", "../image/uipics/delete2.gif", "../image/uipics/delete3.gif", 26, true); this.NavControls.Add(DeleteItem); // Add Ok Control ControlItem OKItem = new ControlItem ("OK", ctrlTexts[7], CtrlType.Image, "../image/uipics/ok.gif", "../image/uipics/ok2.gif", "../image/uipics/ok3.gif", 26, true); this.NavControls.Add(OKItem); // Add Cancel Control ControlItem CancelItem = new ControlItem ("Cancel", ctrlTexts[8], CtrlType.Image, "../image/uipics/cancel.gif", "../image/uipics/cancel2.gif", "../image/uipics/cancel3.gif", 26, true); this.NavControls.Add(CancelItem); // Add Apply Control ControlItem ApplyItem = new ControlItem ("Apply", ctrlTexts[9], CtrlType.Image, "../image/uipics/apply.gif", "../image/uipics/apply2.gif", "../image/uipics/apply3.gif", 26, true); this.NavControls.Add(ApplyItem); // Add Abort Control ControlItem AbortItem = new ControlItem ("Abort", ctrlTexts[10], CtrlType.Image, "../image/uipics/abort.gif", "../image/uipics/abort2.gif", "../image/uipics/abort3.gif", 26, true); this.NavControls.Add(AbortItem); // Add Query Control ControlItem QueryItem = new ControlItem ("Query", ctrlTexts[11], CtrlType.Image, "../image/uipics/query.gif", "../image/uipics/query2.gif", "../image/uipics/query3.gif", 26, true); this.NavControls.Add(QueryItem); // Add Print Control ControlItem PrintItem = new ControlItem ("Print", ctrlTexts[12], CtrlType.Image, "../image/uipics/print.gif", "../image/uipics/print2.gif", "../image/uipics/print3.gif", 26, true); this.NavControls.Add(PrintItem); // Add Export Control ControlItem ExportItem = new ControlItem ("Export", ctrlTexts[13], CtrlType.Image, "../image/uipics/export.gif", "../image/uipics/export2.gif", "../image/uipics/export3.gif", 26, true); this.NavControls.Add(ExportItem); this.InitializeStates(); RenderFlowItems(writer); } #endif base.Render(writer); }
protected virtual void createButton(HtmlTextWriter writer, ControlItem ctrl, WebGridView gdView) { string command = "cmd" + ctrl.ControlName, text = ctrl.ControlText, imageUrl = ctrl.ImageUrl, mouseOverImageUrl = ctrl.MouseOverImageUrl, disenableImageUrl = ctrl.DisenableImageUrl; int size = ctrl.Size; bool IsVisible = ctrl.ControlVisible; bool IsEnable = this.DesignMode ? true : getUserSetEnabled(ctrl.ControlName, this.CurrentNavState); CtrlType ct = ctrl.ControlType; ClientScriptManager csm = Page.ClientScript; string tooltiptext = this.AddDefaultControls ? SysMsg.GetSystemMessage(CliUtils.fClientLang, "Srvtools", "WebNavigator", "ControlText", true) : SysMsg.GetSystemMessage(CliUtils.fClientLang, "Srvtools", "WebGridView", "ControlText", true); String sureDelete = SysMsg.GetSystemMessage(CliUtils.fClientLang, "Srvtools", "WebNavigator", "sureDeleteText", true); string[] arrtext = tooltiptext.Split(';'); if (arrtext.Length == 6) { switch (ctrl.ControlName) { case "Add": if (this.GetServerText) { text = arrtext[0]; tooltiptext = arrtext[0]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "Query": if (this.GetServerText) { text = arrtext[1]; tooltiptext = arrtext[1]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "Apply": if (this.GetServerText) { text = arrtext[2]; tooltiptext = arrtext[2]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "Abort": if (this.GetServerText) { text = arrtext[3]; tooltiptext = arrtext[3]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "OK": if (this.GetServerText) { text = arrtext[4]; tooltiptext = arrtext[4]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "Cancel": if (this.GetServerText) { text = arrtext[5]; tooltiptext = arrtext[5]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; } } else if (arrtext.Length >= 14) { switch (ctrl.ControlName) { case "First": if (this.GetServerText) { text = arrtext[0]; tooltiptext = arrtext[0]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "Previous": if (this.GetServerText) { text = arrtext[1]; tooltiptext = arrtext[1]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "Next": if (this.GetServerText) { text = arrtext[2]; tooltiptext = arrtext[2]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "Last": if (this.GetServerText) { text = arrtext[3]; tooltiptext = arrtext[3]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "Add": if (this.GetServerText) { text = arrtext[4]; tooltiptext = arrtext[4]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "Update": if (this.GetServerText) { text = arrtext[5]; tooltiptext = arrtext[5]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "Delete": if (this.GetServerText) { text = arrtext[6]; tooltiptext = arrtext[6]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "OK": if (this.GetServerText) { text = arrtext[7]; tooltiptext = arrtext[7]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "Cancel": if (this.GetServerText) { text = arrtext[8]; tooltiptext = arrtext[8]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "Apply": if (this.GetServerText) { text = arrtext[9]; tooltiptext = arrtext[9]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "Abort": if (this.GetServerText) { text = arrtext[10]; tooltiptext = arrtext[10]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "Query": if (this.GetServerText) { text = arrtext[11]; tooltiptext = arrtext[11]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "Print": if (this.GetServerText) { text = arrtext[12]; tooltiptext = arrtext[12]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; case "Export": if (this.GetServerText) { text = arrtext[13]; tooltiptext = arrtext[13]; } else { text = ctrl.ControlText; tooltiptext = ctrl.ControlName; } break; default: text = ctrl.ControlText; tooltiptext = ctrl.ControlName; break; } } writer.RenderBeginTag(HtmlTextWriterTag.Td); if (ct == CtrlType.Button && IsVisible) { writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + command); if (!IsEnable) { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "return false;"); } else { if (ctrl.ControlName == "Add") { if (gdView != null && gdView.EditURL != null && gdView.EditURL != "" && !gdView.OpenEditUrlInServerMode) { string url = gdView.getURL(WebGridView.OpenEditMode.Insert, null); if (url != "") writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "window.open('" + url + "','','height=" + gdView.OpenEditHeight + ",width=" + gdView.OpenEditWidth + ",scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,status=no');return false;"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command)); //writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackEventReference(this, command)); } } else if (ctrl.ControlName == "Delete") { if (this.SureDelete) { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "if(confirm('" + sureDelete + "')){" + "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command) + "}"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command)); } } else if (ctrl.ControlName == "Apply" || ctrl.ControlName.ToLower() == "ok" || ctrl.ControlName == "Update") { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var button = document.getElementById('" + this.ClientID + command + "');button.disabled=true;" + csm.GetPostBackEventReference(this, command)); //writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "var start=new Date().getTime(); while(true) if(new Date().getTime()-start>5000) break; var aaa = document.getElementById('cmdApply');aaa.disabled=true;"); //writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackEventReference(this, command)); } else { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackEventReference(this, command)); } // render Button tag writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + size + "px; height:" + ((this.Height.Value <= 20) ? 25 : this.Height.Value) + "px; color:" + this.ForeColor.Name.Replace("ff", "#") + ";background-color:" + this.BackColor.Name.Replace("ff", "#") + ";"); writer.AddAttribute(HtmlTextWriterAttribute.Title, tooltiptext);// new add by ccm if (!IsEnable) { writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "true"); } writer.RenderBeginTag(HtmlTextWriterTag.Button); writer.Write(text); writer.RenderEndTag(); } } else if (ct == CtrlType.HyperLink && IsVisible) { if (ctrl.ControlName == "Add") { if (gdView != null && gdView.EditURL != null && gdView.EditURL != "" && !gdView.OpenEditUrlInServerMode) { string url = gdView.getURL(WebGridView.OpenEditMode.Insert, null); if (url != "") writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:window.open('" + url + "','','height=" + gdView.OpenEditHeight + ",width=" + gdView.OpenEditWidth + ",scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,status=no');return false;"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + csm.GetPostBackClientHyperlink(this, command)); } } else if (ctrl.ControlName == "Delete") { if (this.SureDelete) { writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:if(confirm('" + sureDelete + "')){" + csm.GetPostBackClientHyperlink(this, command) + "}"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + csm.GetPostBackClientHyperlink(this, command)); } } else { writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + csm.GetPostBackEventReference(this, command)); } // render Link tag writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + size + "px; color:" + this.ForeColor.Name.Replace("ff", "#") + ";background-color:" + this.BackColor.Name.Replace("ff", "#") + ";"); writer.AddAttribute(HtmlTextWriterAttribute.Title, tooltiptext);// new add by ccm if (!IsEnable) { writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "true"); } writer.RenderBeginTag(HtmlTextWriterTag.A); writer.Write(text); writer.RenderEndTag(); } else if (ct == CtrlType.Image && imageUrl != null && imageUrl != "" && IsVisible) { if (ctrl.ControlName == "Add") { if (gdView != null && gdView.EditURL != null && gdView.EditURL != "" && !gdView.OpenEditUrlInServerMode) { string url = gdView.getURL(WebGridView.OpenEditMode.Insert, null); if (url != "") writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "window.open('" + url + "','','height=" + gdView.OpenEditHeight + ",width=" + gdView.OpenEditWidth + ",scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,status=no');return false;"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackClientHyperlink(this, command)); } } else if (ctrl.ControlName == "Delete") { if (this.SureDelete) { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "if(confirm('" + sureDelete + "')){" + csm.GetPostBackEventReference(this, command) + "}"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackEventReference(this, command)); } } else { writer.AddAttribute(HtmlTextWriterAttribute.Onclick, csm.GetPostBackEventReference(this, command)); } // render Image tag writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + size + "px;"); if (!IsEnable) { if (disenableImageUrl != null && disenableImageUrl != "") writer.AddAttribute(HtmlTextWriterAttribute.Src, disenableImageUrl); else { writer.AddAttribute(HtmlTextWriterAttribute.Src, imageUrl); writer.AddAttribute("onmouseover", "this.src='" + mouseOverImageUrl + "'"); writer.AddAttribute("onmouseout", "this.src='" + imageUrl + "'"); } writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "true"); } else { writer.AddAttribute(HtmlTextWriterAttribute.Src, imageUrl); writer.AddAttribute("onmouseover", "this.src='" + mouseOverImageUrl + "'"); writer.AddAttribute("onmouseout", "this.src='" + imageUrl + "'"); } writer.AddAttribute(HtmlTextWriterAttribute.Alt, tooltiptext);// new add by ccm writer.AddAttribute(HtmlTextWriterAttribute.Title, tooltiptext); writer.RenderBeginTag(HtmlTextWriterTag.Img); writer.RenderEndTag(); } writer.RenderEndTag(); // </td> writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + this.ControlsGap + "px;"); writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.RenderEndTag(); }
protected void InitNavControls(DetailsViewRow row) { nav.ID = "InPageNavigatorForAddAndQuery"; nav.AddDefaultControls = false; string[] ctrlTexts = { "apply", "abort", "query" }; if (this.GetServerText) { //language = CliSysMegLag.GetClientLanguage(); language = CliUtils.fClientLang; String message = SysMsg.GetSystemMessage(language, "Srvtools", "WebDetailsView", "ControlText", true); ctrlTexts = message.Split(';'); } if (this.NavControls.Count == 0) { #region add default controls // Add Apply Control ControlItem ApplyItem = new ControlItem ("Apply", ctrlTexts[0], this.InnerNavigatorShowStyle, "../image/uipics/apply.gif", "../image/uipics/apply2.gif", "../image/uipics/apply3.gif", 26, true); this.NavControls.Add(ApplyItem); // Add Abort Control ControlItem AbortItem = new ControlItem ("Abort", ctrlTexts[1], this.InnerNavigatorShowStyle, "../image/uipics/abort.gif", "../image/uipics/abort2.gif", "../image/uipics/abort3.gif", 26, true); this.NavControls.Add(AbortItem); // Add Query Control ControlItem QueryItem = new ControlItem ("Query", ctrlTexts[2], this.InnerNavigatorShowStyle, "../image/uipics/query.gif", "../image/uipics/query2.gif", "../image/uipics/query3.gif", 26, true); this.NavControls.Add(QueryItem); #endregion } nav.ShowDataStyle = WebNavigator.NavigatorStyle.DetailStyle; nav.BindingObject = this.ID; nav.LinkLable = this.InnerNavigatorLinkLabel; foreach (WebQueryField f in this.QueryFields) { nav.QueryFields.Add(f); } foreach (ControlItem item in this.NavControls) { if (item.ControlName == "Apply") item.ControlText = ctrlTexts[0]; else if (item.ControlName == "Abort") item.ControlText = ctrlTexts[1]; else if (item.ControlName == "Query") item.ControlText = ctrlTexts[2]; nav.NavControls.Add(item); } foreach (Control ctrl in row.Cells[0].Controls) { if (ctrl is Table) { Table t = (Table)ctrl; TableCell tc = new TableCell(); tc.Controls.Add(nav); t.Rows[0].Cells.Add(tc); if (this.PageCount == 1) { t.Rows[0].Cells[0].Controls.Clear(); } break; } } }
private DetailsViewInnerNavigatorCollection InitControls(DetailsViewInnerNavigatorCollection Ctrls) { #region add default controls // Add Apply Control ControlItem ApplyItem = new ControlItem ("Apply", "apply", WebNavigator.CtrlType.Image, "../image/uipics/apply.gif", "../image/uipics/apply2.gif", "../image/uipics/apply3.gif", 26, true); Ctrls.Add(ApplyItem); // Add Abort Control ControlItem AbortItem = new ControlItem ("Abort", "abort", WebNavigator.CtrlType.Image, "../image/uipics/abort.gif", "../image/uipics/abort2.gif", "../image/uipics/abort3.gif", 26, true); Ctrls.Add(AbortItem); // Add Query Control ControlItem QueryItem = new ControlItem ("Query", "query", WebNavigator.CtrlType.Image, "../image/uipics/query.gif", "../image/uipics/query2.gif", "../image/uipics/query3.gif", 26, true); Ctrls.Add(QueryItem); #endregion return Ctrls; }