424024acfcffdc09f101709eba78dde296808e56
[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 FCK = editor.FCK ;
7 var FCKLang = editor.FCKLang ;
8 var FCKConfig = editor.FCKConfig ;
9 var FCKPlugins = editor.FCKPlugins;
10 var FCKDebug = editor.FCKDebug ;
11
12 window.onload = function() {
13 var mainFrame = window.frames['main'];
14 mainFrame.src = FCKPlugins.Items['image'].Path + 'embedded_images.html';
15 mainFrame.location.href = mainFrame.src;
16
17 var tabsFrame = window.frames['tabs'];
18 tabsFrame.src = FCKPlugins.Items['image'].Path + 'plinn_image_tabs.html'
19 tabsFrame.location.href = FCKPlugins.Items['image'].Path + 'plinn_image_tabs.html'
20 }
21
22 function updateOrInsertImage(url) {
23 var getSizeUrl = url + '/getResizedImageSize';
24 var req = new XMLHttpRequest();
25 req.open("POST", getSizeUrl, false); // synchrone
26 req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
27 var boxSize = FCKConfig.ImageMaxDefaultDimension + '_' + FCKConfig.ImageMaxDefaultDimension;
28 req.send("asXml:boolean=True&size=" + boxSize);
29 var doc = req.responseXML.documentElement;
30
31 var width = doc.getElementsByTagName('width')[0].firstChild.nodeValue;
32 var height = doc.getElementsByTagName('height')[0].firstChild.nodeValue;
33
34
35 var img = FCK.CreateElement('img');
36 img.src = url + '/getResizedImage?size=' + boxSize;
37 img.width = width;
38 img.height = height;
39
40 //FCK.InsertElement(img);
41 window.close();
42 }