2012年3月24日星期六

Cheap Coach BagsIn the OpenJWebCKEditor3

In the OpenJWebCKEditor3.5.3 integrated online editor QQ: 29803446 because the FCKeditor has been upgraded to version ckeditor3.5.3 ,so openjweb platform and the integration of the ckeditor3.
5.3 ,the original fckeditor2.6 can use .This paper describes how to integrate ckeditor into your web application .First downloaded from the Internet ckeditor3.5.3 ,unpack into their web application .
A font and size ,integrated ckeditor,Moncler Sale, if need personalized custom list of fonts and font size, need to open the ckeditor directory under the ckeditor.js file ,because the ckeditor default font font such as Arial, no Chinese ,can be found in ckeditor.
js i.font_names = this sentence ,a modification of the original i.font_names values, the modified content :i.font_names = / u5b8b / u4f53 / u6977 / u4f53_GB2312 ;u4eff ;/ / u5b8b_GB2312 ;/ u9ed1 / u4f53 / u65b0 / u5b8b / u4f53 ;Black ;Arial ;Arial ;Comic Sans MS ;Courier New ;Tahoma ;Times New Roman ;Verdana ; ;name modification :find i.
fontSize_sizes = this sentence ,the sentence that defines editor using font size: i.fontSize_sizes = 8 / 9 / 8px ;9px ;10 10px ;11 11px ;12 12px ;14 14px ;16 16px ;18 18px ;20 20px ;22 22px ;24 24px ;26 26px ;28 28px ;36 / 36px 48 / 48px ;;72 / 72px ;if you need to add or delete name ,can modify the value of i.
fontSize_sizes .Two ,if the editor editor button button in some need to hide ,can modify the config.js file ,config.js, onfig.toolbar_A = Source , , , , , ,Moncler UK,, , , Scayt , , ,, , ,, , , , , , , ,, Subscript , , , ,, , , , , , , , , , , , , , , , , , , , , , , , , ;this code is configuration editor tool button ,in which &rsquo / &rsquo ;;said line, each pair of set is a set of buttons ,different groups of buttons between the separation line .
Three ,upload files Ckeditor no longer provide Java version of the file upload and selected document from the server functionality ,developers need to achieve their own .This section describes the upload and browse server file concrete realization way .
The first is specified in a config.js browser server file and upload the file page :config.filebrowserBrowseUrl = / portal / common / FileManager.jsp ;config.filebrowserUploadUrl = / portal / common / uploadCK2.
jsp ;config.filebrowserImageUploadUrl = / portal / common / uploadCK2.jsp ?Type = Images ;above respectively assigned browse server file page FileManager.jsp ,upload files page uploadCK2.
jsp ,/ portal said that the current web application name ,is also the JSP request.getContextPath ( ) to get the value of .Below is the code :uploadCK2.jsp < ;%@page import = java.
io.File %> ;< ;%@page import = java.util.UUID %> ;< ;%@page import = org.apache.commons.fileupload.FileItem %> ;< ;%@page import = java.util.List %> ;< ;%@page import = org.
apache.commons.fileupload.disk.DiskFileItemFactory %> ;< ;%@page import = org.apache.commons.fileupload.FileItemFactory %> ;< ;%@page import = org.apache.commons.fileupload.servlet.ServletFileUpload %> ;< ;% @ page language = Java contentType = text / HTML ;charset = UTF-8 pageEncoding = UTF-8 %> ;< ;DOCTYPE HTML PUBLIC !- / / W3C / / DTD HTML Transitional / / EN 4.
01 http: / / www.w3.org / TR / html4 / loose.dtd > ;< ;html> ;< ;head> ;< ;meta http-equiv = Content-Type content = text / HTML ;charset = > ;< ;meta UTF-8 http-equiv = pragma content = no-cache > ;< ;meta http-equiv = cache-control content = no-cache > ;< ;meta http-equiv = expires content = 0 > ;< ;title> ;file upload / title> ;< ;< ;< ;body> ;head> < ;String callbac % K = request.
getParameter ( CKEditorFuncNum ) ;String relativePath = / userfiles / image / ;/ / upload files stored in the application of Web / userfiles / image / directory ,according to the needs of their own modifications of if ( ServletFileUpload.
isMultipartContent ( request ) ) / / checks post to the page of type form enctype = multipart / is it right? {String type = form-data types ;if ( request.getParameter ( type ) != null ) / / get the file classification of type = request.
getParameter ( type ) . ToLowerCase ( ) + / ;FileItemFactory factory = new DiskFileItemFactory ( ) ;ServletFileUpload servletFileUpload = new ServletFileUpload ( factory ) ;servletFileUpload.
setHeaderEncoding ( UTF-8 ) ;/ / address file name gibberish question List< ;FileItem> ;fileItemsList = servletFileUpload.parseRequest ( request ) ;System.out.println ( fileItemsList.
size ( ) ) ;for ( FileItem item :fileItemsList ) {if ( !Item.isFormField ( ) ) {String fileName = item.getName ( ) ;fileName = fileName.replace ( / / ,/ ) ;String ful LName = fileName ;fileName = fileName.
substring ( fileName.lastIndexOf ( / ) + 1 ) ;/ / save the file to the server int i = 0 ;String tmpFileName = request.getSession ( ) . GetServletContext ( ) . GetRealPath ( relativePath+fileName ) ;String newFile = tmpFileName ;File file = new File ( tmpFileName ) ;if ( tmpFileName.
toLowerCase !( ) . EndsWith ( JPG ) tmpFileName.toLowerCase ( ) . EndsWith ( JPEG ) tmpFileName.toLowerCase ( ) . EndsWith ( BMP ) tmpFileName.toLowerCase ( ) . EndsWith ( GIF ) tmpFileName.
toLowerCase ( ) . EndsWith ( BMP ) tmpFileName.toLowerCase ( ) . EndsWith ( . PNG ) tmpFileName.toLowerCase ( ) . EndsWith ( SWF ) tmpFileName.toLowerCase ( ) . EndsWith ( Doc ) tmpFileName.
toLowerCase ( ) . EndsWith ( . PDF ) ) {out.println ( < ;script type = / JavaScript ;alert ( prohibited uploading this file ! ) ;window.parent.CKEDITOR.tools.callFunction ( + callback + ,+ ( request.
getContextPath ) + relativePath + blank.jpg + + ) < ;script> ;return ;} ) ;While ( file.exists ( ) ) / / name ,file name automatically add 1 {if ( tmpFileName.lastIndexOf ( .
> ) ;- 1 ) {newFile = tmpFileName.substring ( 0 ,tmpFileName.lastIndexOf ( .) ) + String.valueOf ( I + + ) + .+ tmpFileName.substring ( tmpFileName.lastIndexOf ( .) + 1 ) ;} else / / no extension ,not allowed to upload { / / newFile = tmpFileName+String.
valueOf ( I + + ) ;the out.println ( < ;script type = / JavaScript ;alert ( upload a file with no extension ,Vibram Five Fingers! ) ;window.parent.CKEDITOR.tools.callFunction ( + callback + , + ( request.
getContextPath ) + relativePath + blank.jpg + + ) < ;script> ;return ;} ) ;file = new File ( newFile ) ;} if ( !File.getParentFile ( ) . Exists ( ) ) {file.getParentFile ( ) .
Mkdirs ( ) ;} String newFileName = newFile.replace ( / / ,/ ) ;newFileName = newFileName.substring ( newFileName.lastIndexOf ( / ) + 1 ) ;item.write ( file ) ;out.println ( < ;script type = / JavaScript window.
parent.CKEDITOR.tools.callFunction ( > + callback + ,+ ( request.getContextPath ) + relativePath+newFileName + + ) < ;script> ;break ;) ;} } } %> ;< ;< ;body> html> note: ( 1) if you use the Struts2 frame ,and web.
xml set in < ;filter-mapping> ;< ;filter-name> ;struts2< ;< ;url-pattern> ;filter-name> *. Jsp< ;url-pattern> ;< ;filter-mapping> ;need to comment out this code ,or access to the uploadCK2.
jsp ,Struts2 intercepts file upload .But if you remove this code ,if the access URL connections are directly specified a JSP file ,rather than . Action the end connection ,for example ,Cheap Coach Bags,uploadCK2.
jsp can Struts2 tag ,because Struts2 . JSP the end do not filter ,so JSP Struts2 tags have no effect .( 2) in the JSP specifies the default storage file location as / userfiles / image / ( 3) upload files if duplicate, automatic file name plus 1 ,such as aaa.
jpg if already exists ,it automatically named aaa1.jpg ,if aaa1.jpg exists, will be named aaa2.jpg .See :four ,browse server file this section describes how to realize browse server selection ,inserted into the edit of ckeditor area, openjweb server browse function provides users online management browser folder ,delete server image files ,browse server interface can specify the image upload directory .
Below is the configuration of the browse server connection, ckeditor insert image pop-up page displayed in the &ldquo ;browse server &rdquo ;button ,see below: ,browse server, display server web application specified under certain images directory tree ,click the left directory node ,will display on the right side of this directory file .
But on this interface, file upload, select ,delete ,rename ,build directory functions ,actually also can be used as a HTTP version of the network hard disk management tool .Below is the browse server interface : if you need to open the pictures ,can directly click on the picture file name browse pictures .
Because the server file browsing relates to JSP more, here is not affixed to a specific JSP code .Posted below a directory tree by recursively access code :/ * * * returns a directory of all the subdirectories * @ param rootPath * @ return * / public static String getSubFolders ( String dir ,String parentHashCode ) {String temp = ;File root = new File ( DIR logger.
info ( ) ;father Directory :+ DIR ) ;File filesOrDirs = root.listFiles ( ) ;if ( filesOrDirs = = null ) return null ;String result = new String ;for ( int i = 0 ;I < ;filesOrDirs.
length ;I + + ) {if ( filesOrDirs . IsDirectory ( ) ) {result = filesOrDirs . GetName ( ) ;/ / temp + = filesOrDirs i . GetName ( ) + ,;String path = filesOrDirs .
GetAbsolutePath ( ) ;path.replace ( path = / ,path = path.replace ( ) ;/ / ,) ;temp + = filesOrDirs i . GetName ( ) + / + String.valueOf ( filesOrDirs . HashCode ( ) ) + / + parentHashCode + / + path + ,Coach Outlet,;if ( parentHashCode.
equals ( 0 ) ) {logger.info ( the subdirectory as :) ;logger.info ( filesOrDirs . GetAbsolutePath ( ) ) ;} temp + = getSubFolders ( filesOrDirs . GetAbsolutePath ( ) ,String.
valueOf ( filesOrDirs . HashCode ( ) ) ) ;} else { / / result = filesOrDirs . GetName ( ) ;/ / temp + = filesOrDirs . GetName ( ) + ,;} } / / logger.info ( file :) ;/ / if ( temp.
Related articles:

没有评论:

发表评论