Integrate ckeditor with ckfinder and implement File Upload
Note: The Java version is integrated and used: JSP + ckeditor + ckfinder (no servlet or other framework technologies)
I. required resources:
For websites used, download files by yourself:
A) ckeditor_3.6.2 (extract)
Download.cksource.com/ckeditor/ckeditor/ckeditor%203.6.2/ckeditor_3.6.2.zip
B) ckeditor-java-3.6.2 (decompression)
Bytes
C) ckfinder_java_2.1 (extract)
Download.cksource.com/ckfinder/ckfinder%20for%20java/2.1/ckfinder_java_2.1.zip
2. perform the following steps:
1. myeclipse create a web project: ckeditor_finder
2. Copy the following folder to webroot:
Ckfinder_java_2.1 \ ckfinder \ ckfinderjava \ ckfinder
Note: The name of the folder after the war package is decompressed is bold in ckfinder.
Ckeditor_3.6.2/ckeditor
3. Copy the ckfinder configuration file under the WEB-INF:
Ckfinder_java_2.1 \ ckfinder \ ckfinderjava \ WEB-INF \ config. xml
4. Copy all the jar files in the following folder to the Web-INF/lib directory:
Ckfinder_java_2.1 \ ckfinder \ ckfinderjava \ WEB-INF \ Lib
Ckeditor-java-3.6.2 \ WEB-INF \ Lib
3. Delete useless files below
The first is the files under ckeditor:
_ Sample, _ source, changes.html, ckeditor_php4.php, ckeditor_php5.php,
Ckeditor. asp, ckeditor. Pack, install.html, license.html
Then the files under ckfinder:
_ Samples, help, changelog.txt, install.txt, license.txt, and translation.txt
4. modify the configuration file config. xml
<Enabled> true </enabled>
<Baseurl>/ckeditor_finder/userfiles/</baseurl>
5. Add the following code to Web. xml:
<servlet><servlet-name>ConnectorServlet</servlet-name> <servlet-class>com.ckfinder.connector.ConnectorServlet</servlet-class><init-param><param-name>XMLConfig</param-name><param-value>/WEB-INF/config.xml</param-value></init-param><init-param><param-name>debug</param-name><param-value>false</param-value></init-param><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>ConnectorServlet</servlet-name><url-pattern>/ckfinder/core/connector/java/connector.java</url-pattern></servlet-mapping><filter><filter-name>FileUploadFilter</filter-name> <filter-class>com.ckfinder.connector.FileUploadFilter</filter-class> <init-param> <param-name>sessionCookieName</param-name> <param-value>JSESSIONID</param-value> </init-param> <init-param> <param-name>sessionParameterName</param-name> <param-value>jsessionid</param-value> </init-param></filter><filter-mapping><filter-name>FileUploadFilter</filter-name><url-pattern>/ckfinder/core/connector/java/connector.java </url-pattern></filter-mapping><session-config><session-timeout>10</session-timeout></session-config>
6. modify the content of the ckeditor/config. JS File
CKEDITOR.editorConfig = function(config) {config.filebrowserBrowseUrl = '/CKEditor_Finder/ckfinder/ckfinder.html';config.filebrowserImageBrowseUrl = '/CKEditor_Finder/ckfinder/ckfinder.html?type=Images';config.filebrowserFlashBrowseUrl = '/CKEditor_Finder/ckfinder/ckfinder.html?type=Flash';config.filebrowserUploadUrl = '/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Files';config.filebrowserImageUploadUrl = '/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Images';config.filebrowserFlashUploadUrl = '/ckfinder/core/connector/java/connector.java?command=QuickUpload&type=Flash';// config.filebrowserWindowWidth = '1000';// config.filebrowserWindowHeight = '700'; config.language = "zh-cn";};
7. Modify the index. jsp file as follows:
<% @ Page Language = "Java" Import = "Java. util. * "pageencoding =" UTF-8 "%> <% @ taglib uri =" http://ckfinder.com "prefix =" ckfinder "%> <% @ taglib uri =" http://ckeditor.com "prefix =" ckeditor "%> <% string Path = request. getcontextpath (); string basepath = request. getscheme () + ": //" + request. getservername () + ":" + request. getserverport () + path + "/"; %> <! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en"> <HTML>
Http: // localhost/ckeditor_finder/
It is very likely or can be said that you will not be as smooth as you are in my video after access, especially regarding Chinese, one important operation is not mentioned above:
This operation is to find tomcat/config/server. xml
<Connector Port = "80" protocol = "HTTP/1.1"
Connectiontimeout = "20000"
Redirectport = "8443" uriencoding = "UTF-8"/>
This setting is used to ensure normal access even if Chinese characters appear in the access path during access. If there are other problems, you can post them to continue with the discussion. ^_^
About cracking:
Replace the text in the box with the position of the preview image.
Location of the file to be replaced:/ckeditor_finder/webroot/ckeditor/plugins/image/dialogs/image. js
Modify the ckfinder. js file:
1. Add the following braces in the ckediter/config. js file:
Config. image_previewtext = "preview image location! Modify it by yourself !! ";
(The files modified below are ckfinder/ckfinder. js files)
2. Return A. bf. length> 0 & A. indexof (A. bf. substr (0, 9 ))! =-1 to return false;
3. Comment this part so that there will be no prompt in the middle after uploading an image.
/*if (!S && (!p || a.bs.indexOf(p) % 8 < 4)) {P.mj = J;S = 1;}if ((P.eu && !T || S) && P.mj) { Q.addClass('files_message'); this.tools.of().setHtml(P.mj);}*/
4. Comment out this part. In this way, the things in the lower left corner will be invisible.
/*if (!B)this.dV().getChild(0).appendHtml(y || z || w != 4 ? r: s+ "\074\x62\x3e"+i.htmlEncode(a.ed)+"\074\057\x62\076\074\x2f\x64\151\x76\x3e");*/
If you do not understand or are uncomfortable, you can download the tutorial video at the following URL: (you also want to upload the video to this website, but it seems that you can only upload images, so it is uploaded to other places)
Http://guoliang0-0-yahoo-cn.iteye.com/blog/1195348