惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
月光博客
月光博客
MyScale Blog
MyScale Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿
P
Proofpoint News Feed
人人都是产品经理
人人都是产品经理
Last Week in AI
Last Week in AI
罗磊的独立博客
G
Google Developers Blog
Y
Y Combinator Blog
博客园 - 【当耐特】
WordPress大学
WordPress大学
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
J
Java Code Geeks
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Visual Studio Blog
美团技术团队
宝玉的分享
宝玉的分享
Jina AI
Jina AI
小众软件
小众软件
T
Tailwind CSS Blog
A
About on SuperTechFans

博客园 - A A

SharePoint 2013 App 未在此网站上启用应用程序的旁加载 SharePoint Error 查询命令 SharePoint 2013 基于主机头创建站点无法访问 SharePoint 2013 APP 之---很抱歉,应用程序已关闭。如果您知道运行服务器的人员,请告诉他们启用应用程序。 SharePoint服务器修改域和机器名 CAML 多表查询 SPQuery.Joins and ProjectedFields SharePoint 2010 你状态机了吗! SharePoint 文档库打开HTML 直接浏览而不是打开下载对话框 SharePoint Write Logs User Profile Data Web Part 读取属性字段 ECMAScript Client OM(传说中的js客户端编程) - A A 使用SharePoint Management PowerShell来完成对SharePoint的操作 Developer Dashboard 排忧解难!!! 使用SharePoint 人员选择控件 在 WEB APP开发 - A A SharePoint 在Default 下面添加服务端代码 - A A SharePoint 页面库 使用footer - A A 10分钟搞定 SharePoint 集成FCKEditor 标准项目文档 获取AD用户和OU属性字段名称
自定义个性化 EditPeople控件 - A A
A A · 2011-01-03 · via 博客园 - A A

       最近折腾SharePoint 2010 比较多,有些客户想定制EditPeople控件,有些领导感觉那个搜索不太“好”,希望能有一个树形选择就完美了

哎,客户有要求,咱们哪里能不办?

图1

图2

图3

代码 :

<script type="text/javascript" language="javascript">
    /*
    *   Validate User name
    */
    function fetchUserName() {
        var buttonClientID = '<%=imgButtonCheckNames.ClientID%>';
        var htmlButton = document.getElementById(buttonClientID);

        if (htmlButton != null) {   // if the html button found ..
            htmlButton.click();
        }
    }
    function Callback_User(xml) {
        if (xml == null)
            return;
        var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.async = "false";
        xmlDoc.loadXML(xml);
        var txtUserName = document.getElementById('<%=txtUserName.ClientID  %>');
        var node = xmlDoc.getElementsByTagName('Entity');
        var userName = '';
        if (node != null) {
            if (node[0].attributes.getNamedItem('Key') != null) {
                var userName = node[0].attributes.getNamedItem('Key').value;
                txtUserName.value = userName;
            }
        }
    }
    function _Dialog_UserCheck(defaultSearch) {
      
        var txtUserName = document.getElementById('<%=txtUserName.ClientID %>');
       // ctl00$m$g_ab19aaaf_a004_4410_97b2_7974ffada0af$ctl00$txtUserName   
        if (txtUserName.disabled)
            return;
        if (defaultSearch == undefined)
            defaultSearch = '';
        var txtSiteName = document.getElementById('<%=hidSiteName.ClientID %>');
        var sDialogUrl = '\u002f' + txtSiteName.value + '\u002f_layouts\u002fPicker.aspx?MultiSelect=True\u0026CustomProperty=User\u00253B\u00253B15\u00253B\u00253B\u00253BFalse\u0026DialogTitle=\u0025E9\u002580\u002589\u0025E6\u00258B\u0025A9\u0025E4\u0025BA\u0025BA\u0025E5\u002591\u002598\u0026DialogImage=\u00252F\u00255Flayouts\u00252Fimages\u00252Fppeople\u00252Egif\u0026PickerDialogType=Microsoft\u00252ESharePoint\u00252EWebControls\u00252EPeoplePickerDialog\u00252C\u002520Microsoft\u00252ESharePoint\u00252C\u002520Version\u00253D14\u00252E0\u00252E0\u00252E0\u00252C\u002520Culture\u00253Dneutral\u00252C\u002520PublicKeyToken\u00253D71e9bce111e9429c\u0026ForceClaims=False\u0026DisableClaims=False\u0026EnabledClaimProviders=\u0026EntitySeparator=\u00253B\u0025EF\u0025BC\u00259B\u0025EF\u0025B9\u002594\u0025EF\u0025B8\u002594\u0025E2\u00258D\u0025AE\u0025E2\u002581\u00258F\u0025E1\u00258D\u0025A4\u0025D8\u00259B';
        if (txtSiteName.value == '') {
            sDialogUrl = '\u002f_layouts\u002fPicker.aspx?MultiSelect=True\u0026CustomProperty=User\u00253B\u00253B15\u00253B\u00253B\u00253BFalse\u0026DialogTitle=\u0025E9\u002580\u002589\u0025E6\u00258B\u0025A9\u0025E4\u0025BA\u0025BA\u0025E5\u002591\u002598\u0026DialogImage=\u00252F\u00255Flayouts\u00252Fimages\u00252Fppeople\u00252Egif\u0026PickerDialogType=Microsoft\u00252ESharePoint\u00252EWebControls\u00252EPeoplePickerDialog\u00252C\u002520Microsoft\u00252ESharePoint\u00252C\u002520Version\u00253D14\u00252E0\u00252E0\u00252E0\u00252C\u002520Culture\u00253Dneutral\u00252C\u002520PublicKeyToken\u00253D71e9bce111e9429c\u0026ForceClaims=False\u0026DisableClaims=False\u0026EnabledClaimProviders=\u0026EntitySeparator=\u00253B\u0025EF\u0025BC\u00259B\u0025EF\u0025B9\u002594\u0025EF\u0025B8\u002594\u0025E2\u00258D\u0025AE\u0025E2\u002581\u00258F\u0025E1\u00258D\u0025A4\u0025D8\u00259B';
        }
          sDialogUrl = sDialogUrl + '&DefaultSearch=' + escapeProperly(defaultSearch);
        //sDialogUrl = "/_layouts/CustomPeopleEditor/CheckUsesr.aspx?IsDlg=1";
        var sFeatures = 'resizable=yes,status=no,scrollbars=no,menubar=no,directories=no,location=no,width=470,height=530px';

        var rv = commonShowModalDialog(sDialogUrl, sFeatures, Callback_User);
    }
</script>

如果我们把 sDialogUrl = sDialogUrl + '&DefaultSearch=' + escapeProperly(defaultSearch);

换成  sDialogUrl = "/_layouts/CustomPeopleEditor/CheckUsesr.aspx?IsDlg=1";

就会调出我们自己写的treeview控件

 首先动态调用_Dialog_UserCheck 这个函数,然后根据Callback_User回写value

当然要完美实现这一应用,可能还需要额外的代码,作为Demo代码可能已经够了,核心函数都在这里·