l'upload des images attachées fonctionne !
[ckeditor.git] / skins / ckeditor / plugins / plinn_image / dialog / plinn_image.js
1 // (c) Benoît PIN 2006-2007
2 // http://plinn.org
3 // Licence GPL
4
5 var editor = window.dialogArguments.editor;
6 var pluginPath = window.dialogArguments.pluginPath;
7 //var FCK = editor.FCK ;
8 //var FCKLang = editor.FCKLang ;
9 //var FCKConfig = editor.FCKConfig ;
10 //var FCKPlugins = editor.FCKPlugins;
11 //var FCKDebug = editor.FCKDebug ;
12
13 window.onload = function() {
14 var mainFrame = window.frames['main'];
15 mainFrame.src = pluginPath + 'dialog/embedded_images.html';
16 mainFrame.location.href = mainFrame.src;
17
18 var tabsFrame = window.frames['tabs'];
19 tabsFrame.src = pluginPath + 'dialog/plinn_image_tabs.html';
20 tabsFrame.location.href = tabsFrame.src;
21 }
22
23 function updateOrInsertImage(url) {
24 var getSizeUrl = url + '/getResizedImageSize';
25 var req = new XMLHttpRequest();
26 req.open("POST", getSizeUrl, false); // synchrone
27 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
28 var boxSize = FCKConfig.ImageMaxDefaultDimension + '_' + FCKConfig.ImageMaxDefaultDimension;
29 req.send("asXml:boolean=True&size=" + boxSize);
30 var doc = req.responseXML.documentElement;
31
32 var width = doc.getElementsByTagName('width')[0].firstChild.nodeValue;
33 var height = doc.getElementsByTagName('height')[0].firstChild.nodeValue;
34
35
36 var img = FCK.CreateElement('img');
37 img.src = url + '/getResizedImage?size=' + boxSize;
38 img.width = width;
39 img.height = height;
40
41 //FCK.InsertElement(img);
42 window.close();
43 }