Début d'intégration de la boît de dialogue d'image de Plinn. Pour l'instant, on affic...
[ckeditor.git] / skins / ckeditor / plugins / plinn_image / dialog / plinn_image.js
diff --git a/skins/ckeditor/plugins/plinn_image/dialog/plinn_image.js b/skins/ckeditor/plugins/plinn_image/dialog/plinn_image.js
new file mode 100644 (file)
index 0000000..424024a
--- /dev/null
@@ -0,0 +1,42 @@
+// (c) Benoît PIN 2006-2007
+// http://plinn.org
+// Licence GPL
+
+var editor             = window.dialogArguments.editor;
+var FCK                        = editor.FCK ;
+var FCKLang            = editor.FCKLang ;
+var FCKConfig  = editor.FCKConfig ;
+var FCKPlugins = editor.FCKPlugins;
+var FCKDebug   = editor.FCKDebug ;
+
+window.onload = function() {
+       var mainFrame = window.frames['main'];
+       mainFrame.src = FCKPlugins.Items['image'].Path + 'embedded_images.html';
+       mainFrame.location.href = mainFrame.src;
+       
+       var tabsFrame = window.frames['tabs'];
+       tabsFrame.src = FCKPlugins.Items['image'].Path + 'plinn_image_tabs.html'
+       tabsFrame.location.href = FCKPlugins.Items['image'].Path + 'plinn_image_tabs.html'
+}
+
+function updateOrInsertImage(url) {
+       var getSizeUrl = url + '/getResizedImageSize';
+       var req = new XMLHttpRequest();
+       req.open("POST", getSizeUrl, false); // synchrone
+       req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
+       var boxSize = FCKConfig.ImageMaxDefaultDimension + '_' + FCKConfig.ImageMaxDefaultDimension;
+       req.send("asXml:boolean=True&size=" + boxSize);
+       var doc = req.responseXML.documentElement;
+       
+       var width = doc.getElementsByTagName('width')[0].firstChild.nodeValue;
+       var height = doc.getElementsByTagName('height')[0].firstChild.nodeValue;
+       
+       
+       var img = FCK.CreateElement('img');
+       img.src = url + '/getResizedImage?size=' + boxSize;
+       img.width = width;
+       img.height = height;
+       
+       //FCK.InsertElement(img);
+       window.close();
+}
\ No newline at end of file