0

仅使用静态 HTML+JavaScript,如何显示给定 CMIS 1.1 端点/存储库的给定文件夹的内容?

它可能看起来像这样:

<html>
    <head>
        <script>
          var endpoint = "http://cmis.alfresco.com/cmisbrowser";
          var repository = "bb212ecb-122d-47ea-b5c1-128affb9cd8f";
          var folder = "/";
        </script>
    </head>
    <body>

        <!-- Some magic JavaScript call to the CMIS 1.1 browser binding -->
        <!-- Some minimalist formatting of the JSONP reply -->

    </body>
</html>
4

1 回答 1

0

使用 JQuery 进行查询,使用 json2html 进行模板化:

<html>
    <head>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <script type="text/javascript" src="json2html.js"></script>
        <script type="text/javascript" src="jquery.json2html.js"></script>
        <script>
            var endpoint = "http://cmis.alfresco.com/cmisbrowser";
            var repository = "bb212ecb-122d-47ea-b5c1-128affb9cd8f";
            var folder = "/";
        </script>
    </head>
    <body>
        <ul/>
        <script>
            $.getJSON(
            endpoint + "/" + repository + "/root?succinct=true&callback=?",

            function(data) {
                var transform = [{
                    "tag": "li",
                    "html": "${object.succinctProperties.cmis:name}"
                }];
                $("ul").json2html(data.objects, transform);
            });
        </script>
    </body>
</html>

结果:列表被每个 CMIS 对象填满,显示其名称。

我刚刚基于这个想法创建了一个新的开源项目:WebCMIS

于 2013-08-27T08:58:52.960 回答