private void RegeditNotifyScript() { if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "RegeditNotifyScript")) { Notification notify = new Notification(); DialogWindow dw = notify.DetailDialogWindow; dw.AddUrlClientObjectParameter("KeyValue", "keyValue"); dw.AddUrlClientObjectParameter("Mode", "mode"); StringBuilder s = new StringBuilder(300); s.Append("function ShowNotification(mode, keyValue)"); s.Append("{"); s.Append("var returnValue = '';" + dw.GetShowModalDialogScript("returnValue")); s.Append("if(returnValue=='REFRESH'){return true;}"); s.Append("window.event.cancelBubble = true;return false;"); s.Append("}"); dw = new DialogWindow(); dw.Url = UrlHelper.UrlBase + @"/Home/Notification/NotificationDetail.aspx"; dw.AddUrlClientObjectParameter("KeyValue", "keyValue"); dw.Width = 1000; dw.Height = 700; s.Append("function ShowNotify(keyValue)"); s.Append("{"); s.Append("var returnValue = '';" + dw.GetShowModalDialogScript("returnValue")); s.Append("window.event.cancelBubble = true;return false;"); s.Append("}"); Parent.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "RegeditNotifyScript", s.ToString(), true); } }
private void RenderShowContact() { if (!ClientScript.IsClientScriptBlockRegistered(this.GetType(), "JsShowContact")) { DialogWindow dw = new DialogWindow(); dw.Width = 600; dw.Height = 600; dw.DisplayScrollBar = true; dw.Url = UrlHelper.UrlBase + "/Public/MessageContactSearch.aspx"; dw.AddUrlClientObjectParameter("UserIds", string.Format("document.getElementById('{0}').value",this.HidReceiveUserId.ClientID)); StringBuilder s = new StringBuilder(); s.Append("function ShowContact()"); s.Append("{"); s.Append(" var tObj;"); s.Append(" var nativeNames='';"); s.Append(" var userIds='';"); s.Append(" var returnValue = '';"); s.Append(" " + dw.GetShowModalDialogScript("returnValue")); s.Append("if(typeof(returnValue) == 'undefined' || typeof(returnValue) == 'string')"); s.Append("{"); s.Append("return;"); s.Append("}"); s.Append("else if(typeof(returnValue) == 'object')"); s.Append("{"); s.Append("for(var i=0;i<returnValue.length;i++)"); s.Append("{"); //第一行 s.Append("if (i==0)"); s.Append("{"); s.Append("tObj = returnValue[0];"); s.Append("nativeNames = tObj.nativeName;"); s.Append("userIds = tObj.userId;"); s.Append("}"); //从第二行开始,在最后先插入行,再向新行赋值 s.Append("else"); s.Append("{"); s.Append("tObj = returnValue[i];"); s.Append("nativeNames = nativeNames + ';' + tObj.nativeName;"); s.Append("userIds = userIds + ';'+ tObj.userId;"); s.Append("}");// end if s.Append("}");// end for s.Append("}");// end if s.AppendFormat("document.getElementById('{0}').value=nativeNames;", this.TxtReceiveUserName.ClientID); s.AppendFormat("document.getElementById('{0}').value=userIds;", this.HidReceiveUserId.ClientID); s.Append("}\n"); ClientScript.RegisterClientScriptBlock(this.GetType(), "JsShowContact", s.ToString(), true); } }
private void RenderClientScript() { if (!this.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "JsRoleFunctionOperationScript")) { StringBuilder s = new StringBuilder(""); RM rm = new RM(ResourceFile.Msg); hRoleID.Value = Fn.ToString(Request.QueryString["RoleID"]); s.AppendFormat("{0}.treeNodeSrc='RoleFunctionOperationGetTreeNodes.aspx?RoleID={1}';", Trv1.ClientID, hRoleID.Value); s.AppendFormat("{0}.databind();", Trv1.ClientID); this.ClientScript.RegisterStartupScript(this.GetType(), "settreesrc", s.ToString(), true); DialogWindow detailWindow = new DialogWindow(); detailWindow.Width = 600; detailWindow.Height = 650; detailWindow.DisplayScrollBar = false; detailWindow.Url = UrlHelper.UrlBase + "/Security/RoleFunctionOperationDetail.aspx"; detailWindow.AddUrlClientObjectParameter("Mode", "mode"); detailWindow.AddUrlParameter("RoleID", Fn.ToString(Request.QueryString["RoleID"])); detailWindow.AddUrlClientObjectParameter("FunctionID", String.Format("f_getSelectedNodeID({0})", this.Trv1.ClientID)); StringBuilder sWin = new StringBuilder(500); sWin.AppendFormat("var userId = {0};", CurrentUser.UserID); sWin.Append("function CheckDelete()"); sWin.Append("{"); sWin.Append("if(!CheckSelected()) {alert('").Append(rm["PleaseSelectRow"]).Append("');return false;}"); sWin.Append("if(!window.confirm('").Append(rm["ConfirmDeleteNode"]).Append("')){return false;}"); sWin.Append("return true;"); sWin.Append("}\n"); sWin.Append("function CheckSelected()"); sWin.Append("{"); sWin.AppendFormat(@"if({0}.selectedNodeIndex == ''){{return false;}} else {{return true;}}", this.Trv1.ClientID); sWin.Append("}\n"); sWin.Append("function ShowDetail(mode)"); sWin.Append("{"); sWin.Append("if(mode != 'ADD' && !CheckSelected()) {alert('").Append(rm["PleaseSelectNode"]).Append("');return;}"); sWin.Append("var returnValue = '';"); sWin.Append(detailWindow.GetShowModalDialogScript("returnValue")); sWin.Append("if(returnValue=='refresh'){refreshSelectedNode();}"); sWin.Append("}\n"); sWin.AppendFormat("var pageAddRight='{0}';", PageRight.AddRight); sWin.AppendFormat("var pageEditRight ='{0}';", PageRight.EditRight); sWin.AppendFormat("var pageDeleteRight ='{0}';", PageRight.DeleteRight); detailWindow = null; this.ClientScript.RegisterStartupScript(this.GetType(), "JsRoleFunctionOperationScript", sWin.ToString(), true); } }
private void RegeditPhotoOriginal() { PageBase page = (PageBase)this.Page; if (!page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "RegeditPhotoOriginal")) { DialogWindow dw = new DialogWindow(); dw.Url = UrlHelper.UrlBase + "/UploadFile/PhotoOriginal.aspx"; dw.AddUrlParameter("UserId", Fn.ToString(UserId)); dw.Width = 350; dw.Height = 350; Random r = new Random(); StringBuilder s = new StringBuilder(); s.Append("function showOriginalImg()"); s.Append("{"); s.Append(dw.GetShowModalDialogScript()); s.Append("}"); page.ClientScript.RegisterClientScriptBlock(this.GetType(), "RegeditPhotoOriginal", s.ToString(), true); } }
private void RegeditAddAttachmentScript() { PageBase page = this.Page as PageBase; //弹出文件上传的窗体 if (!page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "RegeditAddAttachmentScript")) { DialogWindow dw = new DialogWindow(); dw.Url = UrlHelper.UrlBase + "/UploadFile/FileUpload.aspx"; dw.AddUrlParameter("ApplicationId", Fn.ToString(ApplicationId)); dw.AddUrlParameter("InstanceId", Fn.ToString(InstanceId)); dw.AddUrlParameter("FolderId", Fn.ToString(FolderId)); dw.AddUrlParameter("Version", Version); dw.AddUrlParameter("DeleteRight", DeleteRight.ToString()); dw.AddUrlParameter("CheckDeleteProc", CheckDeleteProc); dw.Width = 700; dw.Height = 490; StringBuilder s = new StringBuilder(); s.Append("function onAddAttachmentClick()"); s.Append("{"); s.Append("var returnValue = '';" + dw.GetShowModalDialogScript("returnValue")); s.Append("if(returnValue =='REFRESH'){return true;}"); s.Append("window.event.cancelBubble = true;return false;"); s.Append("}"); page.ClientScript.RegisterClientScriptBlock(this.GetType(), "RegeditAddAttachmentScript", s.ToString(), true); } }
private void RegeditUploadPhoto() { SetUpDetailPageBase<HRUser> page = (SetUpDetailPageBase<HRUser>)this.Page; if (!page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "RegeditUploadPhoto")) { DialogWindow dw = new DialogWindow(); dw.Url = UrlHelper.UrlBase + "/UploadFile/PhotoUpload.aspx"; dw.AddUrlParameter("UserId", Fn.ToString(page.RowData["user_id"])); dw.Width = 600; dw.Height = 450; Random r = new Random(); StringBuilder s = new StringBuilder(); //弹出文件上传的窗体 s.Append("function onUploadPhoto()"); s.Append("{"); s.AppendFormat("var img = document.getElementById('{0}');", Img.ClientID); s.Append("var returnValue = '';" + dw.GetShowModalDialogScript("returnValue")); s.Append("if(returnValue =='REFRESH'){refreshImg(img);}"); s.Append("window.event.cancelBubble = true;return false;"); s.Append("}"); //dw = new DialogWindow(); //dw.Url = UrlHelper.UrlBase + "/UploadFile/PhotoOriginal.aspx"; //dw.AddUrlParameter("UserId", Fn.ToString(page.RowData["user_id"])); //dw.Width = 350; //dw.Height = 350; //s.Append("function showOriginalImg()"); //s.Append("{"); //s.Append(dw.GetShowModalDialogScript()); //s.Append("}"); page.ClientScript.RegisterClientScriptBlock(this.GetType(), "RegeditUploadPhoto", s.ToString(), true); } }
private void RegditDetailScript() { if (!ClientScript.IsClientScriptBlockRegistered(this.GetType(), "JsScriptGeographyTree")) { RM rm = new RM(ResourceFile.Msg); StringBuilder s = new StringBuilder(700); DialogWindow dw = new DialogWindow(); dw.Width = 500; dw.Height = 325; dw.DisplayScrollBar = true; dw.Url = UrlHelper.UrlBase + "/Setup/FileFolderDetail.aspx"; dw.AddUrlClientObjectParameter("Mode", "mode"); dw.AddUrlClientObjectParameter("KeyValue", "f_getSelectedNodeID(TVOrg)"); dw.AddUrlClientObjectParameter("ParentName", "f_getSelectedNodeText(TVOrg)"); dw.AddUrlClientObjectParameter("ParentID", "f_getSelectedNodeID(TVOrg)");//Folder_ID s.Append("function ShowDetail(mode,type)"); s.Append("{"); s.AppendFormat("if(mode != 'ADD' && !CheckSelected()) {{alert('{0}');return;}}", rm["PleaseSelectNode"]); s.Append("var returnValue = '';" + dw.GetShowModalDialogScript("returnValue")); s.Append("if(returnValue=='REFRESH'){refreshParentNode(mode,type);}"); s.Append("}\n"); this.ClientScript.RegisterClientScriptBlock(this.GetType(), "JsScriptGeographyTree", s.ToString(), true); } }
void RenderClientScript() { RM rm = new RM(ResourceFile.Msg); RadioButtonList RblOperation = (RadioButtonList)GrdActivity.Rows[GrdActivity.EditIndex].FindControl("RblOperation"); UcButton BtnSubmit = (UcButton)GrdActivity.Rows[GrdActivity.EditIndex].FindControl("BtnSubmit"); BtnSubmit.OnClientClick = string.Format("if(!window.confirm('{0}')) return false;", rm["ConfirmSubmitForm"]); StringBuilder s = new StringBuilder(200); s.Append("function OnClientSubmit()"); s.Append("{"); s.Append("var selectedVal='';"); s.Append("var grd;"); s.Append("var grds =document.getElementsByTagName('TABLE');"); s.AppendFormat("for(var i=0;i<grds.length;i++){{if(grds[i].getAttribute('id')=='{0}'){{grd=grds[i];break;}}}}", RblOperation.ClientID);//定位gridview s.Append("var a =grd.getElementsByTagName(\"input\");"); s.Append("for (var i=0;i<a.length;i++){if (a[i].type == 'radio'){if (a[i].checked){selectedVal=a[i].value;break;}}}"); foreach (ListItem item in RblOperation.Items) { if (item.Value.ToUpper() == "FORWARD") { DialogWindow w = new DialogWindow(); w.Url = UrlHelper.UrlBase + "/DSS/IDMP/GetForwardPerson.aspx"; w.Width = 400; w.Height = 280; s.Append("if(selectedVal=='FORWARD')"); s.Append("{"); s.Append("var returnValue = '';"); s.Append(w.GetShowModalDialogScript("returnValue")); s.Append("if(returnValue == null || returnValue == ''){ return false;}"); s.AppendFormat("document.all('{0}').value = returnValue;", HidForwardPerson.ClientID); s.Append("}"); } } s.AppendFormat("if (selectedVal==''){{alert('{0}');return false;}}", rm["PleaseSelectOperation"]); s.AppendFormat("if(!window.confirm('{0}')) return false;", rm["ConfirmSubmitForm"]); s.Append("return true;"); s.Append("}\n"); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientscript", s.ToString(), true); BtnSubmit.OnClientClick = "if(!OnClientSubmit()){return false;} window.returnValue='REFRESH';"; if (mode != PageMode.View) { BtnSubmit.Enabled = false; } else { BtnSubmit.Enabled = true; } }
protected virtual void RenderClientScript() { if (!this.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "JsFDefinition")) { RM rm = new RM(ResourceFile.Msg); DialogWindow detailWindow = new DialogWindow(); detailWindow.Width = 700; detailWindow.Height = 520; detailWindow.DisplayScrollBar = true; detailWindow.Url = UrlHelper.UrlBase + "/Security/FunctionDefinitionDetail.aspx"; detailWindow.AddUrlClientObjectParameter("Mode", "mode"); detailWindow.AddUrlClientObjectParameter("KeyValue", String.Format("f_getSelectedNodeID({0})", UcTreeMenuList.ClientID)); detailWindow.AddUrlClientObjectParameter("Version", String.Format("f_getSelectedNodeType({0})", UcTreeMenuList.ClientID)); StringBuilder s = new StringBuilder(500); s.AppendFormat("var userId = {0};", CurrentUser.UserID); //check if there is a selected node. s.Append("function CheckSelected()"); s.Append("{"); s.AppendFormat(@"if({0}.selectedNodeIndex == ''){{return false;}} else {{return true;}}", UcTreeMenuList.ClientID); s.Append("}\n"); //view details. s.Append("function ShowDetail(mode)"); s.Append("{"); s.Append("if(mode != 'ADD' && !CheckSelected()) {alert('").Append(rm ["PleaseSelectNode"]).Append("');return;}"); s.Append("var returnValue = '';"); s.Append(detailWindow.GetShowModalDialogScript("returnValue")); s.Append("if(returnValue=='REFRESH'){refreshParentNode(mode);}"); s.Append("}\n"); detailWindow = null; //delete selected row s.Append("function CheckDelete()"); s.Append("{"); s.Append("if(!CheckSelected()) {alert('").Append(rm ["PleaseSelectRow"]).Append("');return false;}"); s.Append("if(!window.confirm('").Append(rm ["ConfirmDeleteNode"]).Append("')){return false;}"); s.Append("return true;"); s.Append("}\n"); //copy selected row s.Append("function CheckCut()"); s.Append("{"); s.Append("if(!CheckSelected()) {alert('").Append(rm ["PleaseSelectRow"]).Append("');return false;}"); s.Append("if(!window.confirm('").Append(rm ["ConfirmCutNode"]).Append("')){return false;}"); s.Append("return true;"); s.Append("}\n"); //cut selected row s.Append("function CheckCopy()"); s.Append("{"); s.Append("if(!CheckSelected()) {alert('").Append(rm ["PleaseSelectRow"]).Append("');return false;}"); s.Append("if(!window.confirm('").Append(rm ["ConfirmCopyNode"]).Append("')){return false;}"); s.Append("return true;"); s.Append("}\n"); s.Append("var pageAddRight='" + PageRight.AddRight + "';"); s.Append("var pageEditRight ='" + PageRight.EditRight + "';"); s.Append("var pageDeleteRight ='" + PageRight.DeleteRight + "';"); s.Append("var pageReadRight ='" + PageRight.ReadRight + "';"); this.ClientScript.RegisterClientScriptBlock(this.GetType(), "JsFDefinition", s.ToString(), true); } if (!this.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "JsStartTree")) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("{0}.treeNodeSrc='FunctionDefinitionGetChildNodes.aspx?parentNodeID={1}';", this.UcTreeMenuList.ClientID, 0); sb.AppendFormat("{0}.databind();", UcTreeMenuList.ClientID); sb.AppendFormat(";var TVOrg =document.getElementById('{0}');", this.UcTreeMenuList.ClientID); this.ClientScript.RegisterStartupScript(this.GetType(), "JsStartTree", sb.ToString(), true); } }
private void RenderViewClientScript() { if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "JsProcessListView")) { DialogWindow dw = new DialogWindow(); dw.Url = UrlHelper.UrlBase + VersionCompareFormPath; dw.AddUrlClientObjectParameter("CurBakID", "bakId"); dw.AddUrlClientObjectParameter("CurVersion", "version"); dw.AddUrlParameter("FunctionID", RightFunctionID.ToString()); dw.AddUrlParameter("BakFormPath", BakFormPath); dw.AddUrlParameter("VersionCompareProcName", VersionCompareProcName); dw.AddUrlParameter("VersionCompareAllProcName", VersionCompareAllProcName); dw.Width = 1000; dw.Height = 700; StringBuilder s = new StringBuilder(300); s.Append("function ShowVersionCompare(bakId,version)"); s.Append("{"); s.Append(dw.GetShowModalDialogScript()); s.Append("}"); dw = new DialogWindow(); dw.Url = UrlHelper.UrlBase + BakFormPath; dw.AddUrlClientObjectParameter("Mode", "mode"); dw.AddUrlClientObjectParameter("KeyValue", "keyvalue"); dw.AddUrlClientObjectParameter("Version", "version"); dw.AddUrlParameter("FunctionID", RightFunctionID.ToString()); dw.Width = 1000; dw.Height = 700; s.Append("function ShowBakForm(mode,keyvalue,version)"); s.Append("{"); s.Append(dw.GetShowModalDialogScript()); s.Append("}"); Parent.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "JsProcessListView", s.ToString().Trim(), true); } }
private void RegeditBackUpDetail() { if (!this.Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "RegeditBackUpDetail")) { DialogWindow dw = new DialogWindow(); dw.Url = UrlHelper.UrlBase + BakFormPath; dw.AddUrlClientObjectParameter("Mode", "mode"); dw.AddUrlClientObjectParameter("KeyValue", "keyvalue"); dw.AddUrlClientObjectParameter("Version", "version"); dw.AddUrlParameter("FunctionID", FunctionID); dw.Width = 1000; dw.Height = 700; StringBuilder s = new StringBuilder(100); s.Append("function ShowBakForm(mode,keyvalue,version)"); s.Append("{"); s.Append(dw.GetShowModalDialogScript()); s.Append("}"); this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "RegeditBackUpDetail", s.ToString().Trim(), true); } }