在CKFinder中自定义baseUrl和baseDir [英] Customize baseUrl and baseDir in CKFinder

查看:566
本文介绍了在CKFinder中自定义baseUrl和baseDir的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在许多CMS应用程序中使用CKEditor和CKFinder for Coldfusion。这些应用程序指向我们服务器上的不同网站,因此我们希望CKFinder设置将文件上传到每个应用程序的特定目录。

We use CKEditor and CKFinder for Coldfusion in many of our CMS applications. These apps point to different sites on our server, so we want CKFinder setup to upload files to directories specific to each app. But we one want one shared location for the CKEditor and CKFinder files on the server.

在config.cfm文件中,我们设置了默认的baseURL和baseDir,如下所示:

In the config.cfm file, we have setup the default baseURL and baseDir like this:

config.baseUrl = "http://www.oursite.com/_files/site1/ckfinder_uploads/";    
config.baseDir = '\\ourserver01\_files\site1\ckfinder_uploads\';

在每个应用程序的头文件中,我们包括以下内容来实例化CKEditor和CKFinder适配器):

In the header file for each app, we include the following to instantiate CKEditor and CKFinder (including the jQuery adapter):

<script type="text/javascript" src="/shared/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/shared/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript" src="/shared/ckfinder/ckfinder.js"></script>

<script type="text/javascript">
  $(document).ready(function(){
    CKFinder.setupCKEditor( null, '/shared/ckfinder/' );
  });
</script>



当我在其中一个应用程序中打开CKFinder窗口时,它会正确打开到默认的baseURL / baseDir 。但是,如何覆盖这些默认值?我尝试将CKFinder setupCKEditor函数更改为以下没有运气:

When I open a CKFinder window in one of the apps, it correctly opens to the default baseURL/baseDir. However, how can I override those defaults? I tried changing the CKFinder setupCKEditor function to the following with no luck:

CKFinder.setupCKEditor( null, { basePath:'/shared/ckfinder/', baseUrl:"http://www.oursite.com/_files/NEWSITE/ckfinder_uploads/", baseDir:"\\\\ourserver01\\_files\\NEWSITE\\ckfinder_uploads\\" } );

它忽略了这一点,并使用默认值。想法?谢谢!

It just ignored this and used the defaults. Thoughts? Thanks!!

推荐答案

这是我做的。这不是完美的,但它的工作。使用CF,在CKFinder目录中有一个config.cfm文件,您可以在其中设置baseUrl和baseDir。在那里,我将这两个变量的值设置为两个相应的浏览器cookie。然后,我在不同应用的标题中设置Cookie值,以便它们可以反映我所在的应用。

Here's what I did. It's not perfect, but it works. With CF, there's a config.cfm file in the CKFinder directory where you set baseUrl and baseDir. There, I set the value of these two variables to two corresponding browser cookies. Then I set the cookie values in the headers of the different apps, so that they can reflect the app I'm in.

缺点是如果您有2个应用,只有您最近打开的那个将设置正确的cookie值。如果有人知道更好,相似(或不相似)的方式,我会感兴趣。

The downside is if you have 2 apps open, only the one you opened most recently will have the correct cookie values set. If anyone knows of a better, similar (or not similar) way of doing this, I'd be interested.

谢谢!
Nick

Thanks! Nick

这篇关于在CKFinder中自定义baseUrl和baseDir的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆