ckfinder.net完全讲解五(ckfinder按钮失效禁用)

1.添加js

  <script src="Js/jquery/jquery-1.4.4.min.js" type="text/javascript"></script>
    <script src="CkEditor/ckfinder/ckfinder.js" type="text/javascript"></script>
    <script type="text/javascript">
        var api;
        function BrowseServer(inputId) {
            var finder = new CKFinder({ width: 600 });
            finder.basePath = 'CkEditor/ckfinder/';//ckfinder所在路径
            finder.callback = function (api) {//ckfinder创建时函数
                var toolId = api.addToolPanel('<h3>My tool</h3><p>Sample content.</p>');
                var toolId2 = api.addTool('<h3>My tool2</h3><p>Sample content.</p>');
                // Show tool
                api.showTool(toolId);
                api.showTool(toolId2);
                // 文件查看餐单失效
                var enableAgain = api.disableFileContextMenuOption('viewFile', false);
                // 重新有效
               // enableAgain();
            }

             api = finder.popup(); //调用ckfinder
            //alert("bb");
           // window.setTimeout(function () { api.closePopup(); }, 5000);
           
        }
        function closeServer() {//ckfinder关闭函数
            api.closePopup(function () {
                alert("按钮关闭");
            });
        }
        function destroyServer() {//ckfinder销毁函数
            api.destroy(function () {
                alert('The CKFinder instance was destroyed.');
            });
        }
        $(function () {
            $("#btnAdd").click(function () {
                BrowseServer("aa");
            });
            $("#btnClose").click(function () {
                closeServer();//关闭弹出对话框
                destroyServer();//销毁api
            });
            $("#btnDestroy").click(function () {
                destroyServer();
            });
        });
    </script>
2.添加按钮

    <div>
        <input type="button" id="btnAdd" value="上传" />
        <input type="button" id="btnClose" value="关闭"/>
        <input type="button" id="btnDestroy" value="销毁"/>
    </div>

3.点击上传弹出ckfinder上传对话框,上诉效果如下图

6.文件夹右键菜单选项按钮失效

<script src="Js/jquery/jquery-1.4.4.min.js" type="text/javascript"></script>
    <script src="CkEditor/ckfinder/ckfinder.js" type="text/javascript"></script>
    <script type="text/javascript">
        var api;
        function BrowseServer(inputId) {
            var finder = new CKFinder({ width: 600 });
            finder.basePath = 'CkEditor/ckfinder/';//ckfinder所在路径
            finder.callback = function (api) {//ckfinder创建时函数
                var toolId = api.addToolPanel('<h3>My tool</h3><p>Sample content.</p>');
                var toolId2 = api.addTool('<h3>My tool2</h3><p>Sample content.</p>');
                // Show tool
                api.showTool(toolId);
                api.showTool(toolId2);
                // 文件查看餐单失效
                var enableAgain = api.disableFileContextMenuOption('viewFile', false);
                // 重新有效
                // enableAgain();
                //添加文件夹显示路径
                //
                var menuItem = {
                    label: 'Show Url',
                    command: 'DisplayUrl'//其他地方调用命令标识
                };
                //添加至文件夹右键下拉餐单中
                api.addFolderContextMenuOption(menuItem, function (api, folder) {
                    api.openMsgDialog("", "The URL of the selected folder: " + folder.getUrl());
                });
                //文件餐单显示url按钮失效
                api.disableFolderContextMenuOption('DisplayUrl', true);
            }

             api = finder.popup(); //调用ckfinder
            //alert("bb");
           // window.setTimeout(function () { api.closePopup(); }, 5000);
           
        }
        function closeServer() {//ckfinder关闭函数
            api.closePopup(function () {
                alert("按钮关闭");
            });
        }
        function destroyServer() {//ckfinder销毁函数
            api.destroy(function () {
                alert('The CKFinder instance was destroyed.');
            });
        }
        $(function () {
            $("#btnAdd").click(function () {
                BrowseServer("aa");
            });
            $("#btnClose").click(function () {
                closeServer();//关闭弹出对话框
                destroyServer();//销毁api
            });
            $("#btnDestroy").click(function () {
                destroyServer();
            });
        });
    </script>

7.效果如下图




阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭