| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 /* 2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 */ 5 6 /** 7 * @file Plugin for inserting files from imce without image dialog 8 */ 9 ( function() { 10 CKEDITOR.plugins.add( 'imce', 11 { 12 init: function( editor ) 13 { 14 //adding button 15 editor.ui.addButton( 'IMCE', 16 { 17 label: 'IMCE', 18 command: 'IMCEWindow', 19 icon: this.path + 'images/icon.gif' 20 }); 21 22 //opening imce window 23 editor.addCommand( 'IMCEWindow', { 24 exec : function () { 25 var width = editor.config.filebrowserWindowWidth || '80%', 26 height = editor.config.filebrowserWindowHeight || '70%'; 27 28 editor.popup(Drupal.settings.basePath + 'index.php?q=imce\x26app=ckeditor|sendto@ckeditor_setFile|&CKEditorFuncNum=' + editor._.filebrowserFnIMCE, width, height); 29 } 30 }); 31 32 //add editor function 33 editor._.filebrowserFnIMCE = CKEDITOR.tools.addFunction( setFile, editor ) 34 35 //function which receive imce response 36 window.ckeditor_setFile = function (file, win) { 37 var cfunc = win.location.href.split('&'); 38 39 for (var x in cfunc) { 40 if (cfunc[x].match(/^CKEditorFuncNum=\d+$/)) { 41 cfunc = cfunc[x].split('='); 42 break; 43 } 44 } 45 46 CKEDITOR.tools.callFunction(cfunc[1], file); 47 win.close(); 48 }; 49 } 50 } ); 51 function setFile(file) { 52 //checking if it is image 53 if (file.width != 0 && file.height != 0) { 54 this.insertHtml('<img src="' + file.url + '" style="width:' + file.width + 'px;height:' + file.height + 'px;" alt="' + file.name + '" />'); 55 } else { 56 this.insertHtml('<a href="' + file.url + '">' + file.name + '</a>'); 57 } 58 } 59 } )();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |