I want to use BUEditor with Gallery and/or g2image.

The g2image-js-function needs the textarea.id as variable field. I tried editor.active and editor.active.textArea.

// $Id: g2image.js,v 1.1 2006/03/24 14:04:52 kiz0987 Exp $

function g2ic_open(field) {
  // Find the form id by going back through the hierarchy. Kludge until can get the form id
  // directly from drupal.
  var element = document.getElementById(field).parentNode;
  while (element.tagName != 'FORM') {
    element = element.parentNode;
  }
  var form = element.id;
  var url = G2IMAGE_URI + 'g2image.php?g2ic_form='+form+'&g2ic_field='+field+'&g2ic_tinymce=0';
	var name = 'g2image';
	var w = 600;
	var h = 600;
	var valLeft = (screen.width) ? (screen.width-w)/2 : 0;
	var valTop = (screen.height) ? (screen.height-h)/2 : 0;
	var features = 'width='+w+',height='+h+',left='+valLeft+',top='+valTop+',resizable=1,scrollbars=1';
	window.open(url, name, features);
}

Could you please help me or give me hint for another method to get Gallery or g2Image integrated?

Comments

ufku’s picture

sorry, i dont know much about g2image or gallery.
editor.active.textArea -> this is the textarea element.
editor.active.textArea.id -> this is the id.

derhasi’s picture

Thanks, editor.active.textArea.id worked.
I allready tried it, but only in the admin/settings/bueditor/*, but there it caused an error. But when it's in use it works fine.

So js:g2ic_open(editor.active.textArea.id ); is the right code to implement G2Image for Gallery

ufku’s picture

Status: Active » Closed (fixed)
dennys’s picture

Here is another solution provided by the author of gallery module, you just need to run g2bueditor_open() script.

http://gallery.menalto.com/node/70452