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 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);
        }
    }