zoukankan      html  css  js  c++  java
  • 最近要用到cuteeditor编辑器,先转一篇留言着看

    CuteEditor编辑器功能很强大,也很丰富,不过再好的东西也有缺点.
    这个编辑器上传图片是把所有图片都放到根目录下的upload文件夹中,编辑器也不是自动命名图片,这时候图片就可能会重名,在网上找了许久,用的人也不多,方法也没找到,最后还是自己写把!
    CuteSoft_Client\CuteEditor\Dialogs\下的
    Gecko_InsertImage.Frame.aspx
    InsertImage.Frame.aspx
    SelectImage.Frame.aspx
    操作插入图片的3个文件夹
    在头部加入引用
    <%@ Import Namespace="System.IO" %>
    找到
                protected override void InitOfType()
                {
                    fs.VirtualRoot = CuteEditor.EditorUtility.ProcessWebPath(Context, null, secset.ImageGalleryPath).TrimEnd('/') + "/";
                }
    替换成
                protected bool myCreateDirectory(string path)
                {
                    try
                    {
                        if (Directory.Exists(path))
                        {
                            Response.Write("目录已经存在!");
                            return true;
                        }
                        else
                        {
                            DirectoryInfo di = Directory.CreateDirectory(path);
                            Response.Write("目录应创建成功!");
                            return true;
                        }
                    }
                    catch
                    {
                        Response.Write("出现异常!");
                        return false;
                    }
                    finally { }
                }
                protected override void InitOfType()
                {

                    string username = Request.Cookies["hnusername"].Value;

                    string filename = Server.MapPath(secset.ImageGalleryPath + "/" + username);
                    if (myCreateDirectory(filename))
                    {
                        fs.VirtualRoot = CuteEditor.EditorUtility.ProcessWebPath(Context, null, filename).TrimEnd('/') + "/";
                    }
                    else
                    {
                        fs.VirtualRoot = CuteEditor.EditorUtility.ProcessWebPath(Context, null, secset.ImageGalleryPath).TrimEnd('/') + "/";
                    }
                }

    3个文件一样就OK,然后每个用户就有自己可以使用的文件夹了.
    编辑器有2个上传图片功能的按钮,把前面的一个改成只能插入图片,不能上传图片.
    如果不想改很多,只要把上传的功能隐藏就可以.这样前面的上传按钮就改成了只能插入图片,并且可以插入所有用户已经上传的图片.
    OK

  • 相关阅读:
    HDU 5912 Fraction (模拟)
    CodeForces 722C Destroying Array (并查集)
    CodeForces 722B Verse Pattern (水题)
    CodeForces 722A Broken Clock (水题)
    CodeForces 723D Lakes in Berland (dfs搜索)
    CodeForces 723C Polycarp at the Radio (题意题+暴力)
    CodeForces 723B Text Document Analysis (水题模拟)
    CodeForces 723A The New Year: Meeting Friends (水题)
    hdu 1258
    hdu 2266 dfs+1258
  • 原文地址:https://www.cnblogs.com/yeagen/p/1333088.html
Copyright © 2011-2022 走看看