Kindeditor配置

 

  
  
  
  
  1. //D:\Tomcat6.0\webapps\zswz\attached/ 
  2. String savePath = request.getSession().getServletContext().getRealPath("/").replace("hzview","red5") + "streams/"; 
  3. //文件保存目录URL /zswz/attached/ 
  4. String saveUrl = "/red5/"+ "streams/"; 
  5. System.out.println(savePath); 
  6. System.out.println(saveUrl); 
  7. //定义允许上传的文件扩展名 
  8. //定义允许上传的文件扩展名 
  9. HashMap<String, String> extMap = new HashMap<String, String>(); 
  10. extMap.put("image", "gif,jpg,jpeg,png,bmp"); 
  11. extMap.put("flash", "swf,flv,mp4"); 
  12. extMap.put("media", "swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb,mp4"); 
  13. extMap.put("file", "doc,docx,xls,xlsx,ppt,htm,html,txt,zip,rar,gz,bz2"); 
 
  
  
  
  
  1. if (!Arrays.<String> asList(extMapif.get(dirName).split(",")) 
  2.             .contains(fileExt2)) { 
  3.         HashMap<String, String> extMap2 = new HashMap<String, String>(); 
  4.         extMap2.put("flash", "swf,flv"); 
  5.         extMap2.put("media", 
  6.                 "swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb,mp4"); 
  7.  
  8.         if (Arrays.<String> asList(extMap2.get(dirName).split(",")) 
  9.                 .contains(fileExt2)) { 
  10.             String filePath = savePath + newImgName; 
  11.             String filePath2 = savePath
  12.             ConverVideo cv = new ConverVideo(filePath, filePath2, 
  13.                     filePath2, filePath2, filePath2); 
  14.             //  ConverVideo cv=new ConverVideo(filePath); 
  15.             cv.beginConver(); 
  16.             //ProcessFlvImg pfi = new ProcessFlvImg(); 
  17.             //  pfi.processImg(filePath); 
  18.  
  19.         } 
  20.     } 


 

   
   
   
   
  1. <link rel="stylesheet" href="<%=path %>/kindeditor/themes/default/default.css" /> 
  2.     <link rel="stylesheet" href="<%=path %>/kindeditor/plugins/code/prettify.css" /> 
  3.     <script charset="utf-8" src="<%=path %>/kindeditor/kindeditor.js"></script> 
  4.     <script charset="utf-8" src="<%=path %>/kindeditor/lang/zh_CN.js"></script> 
  5.     <script charset="utf-8" src="<%=path %>/kindeditor/plugins/code/prettify.js"></script> 
  6.     <script> 
  7.         KindEditor.ready(function(K) { 
  8.             var editor1 = K.create('textarea[name="content"]', { 
  9.                 afterUpload :function (url) { 
  10.                             //  alert(url); 
  11.                             var _msg = url.toString(); 
  12.                             var _picture_name = _msg.substring(_msg 
  13.                                     .lastIndexOf("/") + 1); 
  14.                             var _picture_path = Substring(_msg); 
  15.                             var _imagestr = "<input type='checkbox' name='imageUrl'   checked='checked' value='"+url+"' id='"+url+"' onClick='clickImage(this.value);this.checked=false ' />附件<label>"+_picture_name+"</label></a><br/>"; 
  16.                             var imageArray = new Array(".jpg", ".jpeg", ".gif", 
  17.                                     ".png", ".bmp"); 
  18.  
  19.                             var hou = _msg.substring(_msg.lastIndexOf(".")); 
  20.                             for ( var i = 0; i < imageArray.length; i++) { 
  21.                                 if (imageArray[i] == hou) { 
  22.                                     $("#uploadList").append(_imagestr); 
  23.                                 } 
  24.                             } 
  25.  
  26.                             var _videostr = "<input type='checkbox' name='videoUrl'  checked='checked' value='"+ url+ "' id='"+url+"' onClick='clickImage(this.value);this.checked=false' />附件<label>
  27.                                     + _picture_name 
  28.                                     + "</label></a><br/>"; 
  29.                             var videoArray = new Array(".swf", ".flv", ".avi", 
  30.                                     ".mp3", ".wav",".wma",".wmv",".mid",".mpg",".asf",".rm",".rmvb",".mp4"); 
  31.                             for ( var i = 0; i < videoArray.length; i++) { 
  32.                                 if (videoArray[i] == hou) { 
  33.                                     $("#videouploadList").append(_videostr); 
  34.                                 } 
  35.                             } 
  36.                             }, 
  37.                 cssPath : '<%=path %>/kindeditor/plugins/code/prettify.css', 
  38.                 uploadJson : '<%=path %>/kindeditor/jsp/upload_json.jsp', 
  39.                 fileManagerJson : '<%=path %>/kindeditor/jsp/file_manager_json.jsp', 
  40.                 allowFileManager : true, 
  41.                  
  42.                 filterMode:false, 
  43.                 afterCreate : function() { 
  44.                     var self = this
  45.                     K.ctrl(document, 13, function() { 
  46.                         self.sync(); 
  47.                         document.forms['example'].submit(); 
  48.                     }); 
  49.                     K.ctrl(self.edit.doc, 13, function() { 
  50.                         self.sync(); 
  51.                         document.forms['example'].submit(); 
  52.                     }); 
  53.                 } 
  54.                  
  55.                  
  56.             }); 
  57.             prettyPrint(); 
  58.         }); 
  59.          
  60.     function Substring(s) { 
  61.                             return s.substring(s.substring(0, 
  62.                                     s.lastIndexOf("/")).lastIndexOf("/"), 
  63.                                     s.length); 
  64.                         } 
  65.                          
  66.     function clickImage(abc) 
  67.     { 
  68.     alert(abc); 
  69.         var r = confirm("你确认要删除吗?"); 
  70.     //  if(document.abc.checked){ 
  71.     //      abc.style.display="none" 
  72.     //  } 
  73.         if (r == true) { 
  74.         $("#"+abc).attr("display","none"); 
  75.             var url = 'deletefile'
  76.             var params = { 
  77.                 imageUrl : abc 
  78.             };           
  79.             jQuery.post(url, params, callbackFun, 'json'); 
  80.         return true;     
  81.         } 
  82.     } 
  83.      
  84.         //  style="display:none" 
  85.          function callbackFun(data) 
  86.             { 
  87.                     alert(data.result); 
  88.                     return true; 
  89.                 //对应HelloWorld类的message属性 
  90.                      //获取数据后渲染页面 
  91.              }       

 

    
    
    
    
  1. <td> 
  2.                     上传文件必须在 ?之间 
  3.                     <br> 
  4.                     <textarea name="content" cols="100" rows="8" style="width:700px;height:200px;visibility:hidden;"></textarea> 
  5.      
  6.                 </td> 
  7.                 <hr /> 
  8.  
  9.  
  10.  
  11. <tr> 
  12.                 <td> 
  13.                     图片URL: 
  14.                 </td> 
  15.                 <td> 
  16.                     <div id="uploadList"></div> 
  17.                 </td> 
  18.             </tr> 
  19.             <br> 
  20.             <tr> 
  21.                 <td> 
  22.                     视频音频URL: 
  23.                 </td> 
  24.                 <td> 
  25.                     <div id="videouploadList"></div> 
  26.                     <br> 
  27.                 </td> 
  28.             </tr> 

你可能感兴趣的:(配置,kindeditor)