? ckeditor-imagebrowser-606568.patch
Index: imagebrowser.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagebrowser/imagebrowser.info,v
retrieving revision 1.2.2.5
diff -u -p -r1.2.2.5 imagebrowser.info
--- imagebrowser.info	19 Jul 2009 14:30:50 -0000	1.2.2.5
+++ imagebrowser.info	15 Nov 2009 19:25:51 -0000
@@ -6,4 +6,4 @@ package = "Image"
 dependencies[] = imageapi
 dependencies[] = image
 dependencies[] = views
-dependencies[] = fckeditor
\ No newline at end of file
+; dependencies[] = fckeditor
\ No newline at end of file
Index: js/imagebrowser.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagebrowser/js/Attic/imagebrowser.js,v
retrieving revision 1.1.2.13
diff -u -p -r1.1.2.13 imagebrowser.js
--- js/imagebrowser.js	13 Oct 2009 15:44:07 -0000	1.1.2.13
+++ js/imagebrowser.js	15 Nov 2009 19:25:51 -0000
@@ -12,23 +12,41 @@
 function SelectFile(url, width, height, alt, link, link_target, styles)
 {
   if(window.opener) {
+    var href=window.location.href.split('&');
+    var app=false;
+    var cfunc=false;
     //url, width, height, alt
-    window.opener.SetUrl( url, width, height, alt );
-
-    if (window.opener.GetE('txtLnkUrl')) {
-      window.opener.GetE('txtLnkUrl').value = link ;
+    for(var x in href){
+      
+      if(href[x].match(/app=[a-z]/i)){
+        app=href[x].split('=');
+        app=app[1];
+      }
+      if(href[x].match(/^CKEditorFuncNum=\d+$/)){
+        cfunc=href[x].split('=');
+        cfunc=cfunc[1];
+      }
     }
+    if(app=='ckeditor'){
+      window.opener.CKEDITOR.tools.callFunction( cfunc, url);
+    } else {
+      window.opener.SetUrl( url, width, height, alt );
 
-    if (window.opener.GetE('cmbLnkTarget')) {
-      window.opener.GetE('cmbLnkTarget').value = link_target ;
-    }
+      if (window.opener.GetE('txtLnkUrl')) {
+        window.opener.GetE('txtLnkUrl').value = link ;
+      }
 
-    if (window.opener.GetE('txtAttClasses')) {
-      if(styles == '') {
-        window.opener.GetE('txtAttClasses').value = 'ibimage';
+      if (window.opener.GetE('cmbLnkTarget')) {
+        window.opener.GetE('cmbLnkTarget').value = link_target ;
       }
-      else {
-        window.opener.GetE('txtAttClasses').value = 'ibimage ' + styles;
+
+      if (window.opener.GetE('txtAttClasses')) {
+        if(styles == '') {
+          window.opener.GetE('txtAttClasses').value = 'ibimage';
+        }
+        else {
+          window.opener.GetE('txtAttClasses').value = 'ibimage ' + styles;
+        }
       }
     }
   }
