Page 1 of 1

TinyMCE and absolute urls

Posted: Wed Mar 28, 2007 8:23 am
by linsec
Hi,

Im having issues in NMS where TinyMCE is stripping any absolute urls in the page after submitting it. This is naturally causing broken images and links when the page is being displayed in an email client.

Ive tried modifying the relative_url and convert_url options to 'false' in the tiny_mce.js file, but it doesnt seem to work.

Can the TinyMCE dev shed any light on this?

Thanks.

Harby.

Re: TinyMCE and absolute urls

Posted: Tue Sep 25, 2007 3:58 pm
by nuno
I have same problem !!!
any hep??

Re: TinyMCE and absolute urls

Posted: Wed Sep 26, 2007 12:29 am
by nuno
Im having issues in NMS where TinyMCE is stripping any absolute urls in the page after submitting it. This is naturally causing broken images and links when the page is being displayed in an email client.

please i need help on that

UPDATE


if to put in absolute they are    http%3A//domain.com/uploads/images/myimage.jpg


Any sugestions please guys!!!!

Re: TinyMCE and absolute urls

Posted: Sat Nov 10, 2007 8:37 pm
by KC
nuno wrote:
if to put in absolute they are    http%3A//domain.com/uploads/images/myimage.jpg
This does not work with me...

Kees

Re: TinyMCE and absolute urls

Posted: Sat Nov 10, 2007 8:57 pm
by KC
adding

Code: Select all

convert_urls : "false",
in tinyconfig.php does the job for me...

Not checked what it does with other jobs!!!!!!!!!!

Kees

Re: TinyMCE and absolute urls

Posted: Sat Nov 10, 2007 9:49 pm
by nuno
KC wrote: adding

Code: Select all

convert_urls : "false",
in tinyconfig.php does the job for me...

Not checked what it does with other jobs!!!!!!!!!!

Kees
thanks

In that place? (line)


Solved 50% but still  http%3A//domain.com/uploads/images/myimage.jpg

Re: TinyMCE and absolute urls

Posted: Sat Nov 10, 2007 10:10 pm
by KC
I placed it just under

relative_urls : "true",

Grtz Kees

Re: TinyMCE and absolute urls

Posted: Sun Nov 11, 2007 12:53 am
by nuno
See the attached image already tried to think of everything!  ???  :P  >:(

Re: TinyMCE and absolute urls

Posted: Wed Nov 14, 2007 11:45 am
by bmunsch
Hello,

Have you the solution for the absolute urls ?

Thanks

Re: TinyMCE and absolute urls

Posted: Sun Nov 18, 2007 4:57 pm
by nuno
bmunsch wrote: Hello,

Have you the solution for the absolute urls ?

Thanks
Hello community

For sending images in the body of newsletters already solved, continuing the TinyMCE with relative urls,  is the best.

For e-mail clients like (Outlook) see the images of the body of the message included in the module NMS in the file action.process_queue.php


+- line 435

Code: Select all

 switch( $message['templateid'] )
	{
	case -1: // html message (no template)
	  $mailer->SetBody($bodytext);
	  $mailer->IsHTML(true);
	  break;
	      
	case -2: // text message
	  $mailer->SetBody($bodytext);
	  $mailer->IsHTML(false);
	  break;

	default: // page template
	  // assign the message as {$message_text} variable
	  $this->smarty->assign('message_text',$bodytext);

replace for this


   

Code: Select all

  switch( $message['templateid'] )
	{
	case -1: // html message (no template)
	  $mailer->SetBody($bodytext);
	  $mailer->IsHTML(true);
	  break;
	      
	case -2: // text message
	  $mailer->SetBody($bodytext);
	  $mailer->IsHTML(false);
	  break;

	default: // page template
	  // assign the message as {$message_text} variable
	   
//////////// ADDED ///////////////////////////////////////////////////
$fullAbsolute = $config['image_uploads_url'];
$bodytext = str_replace("uploads/images", $fullAbsolute ,$bodytext);
///////////////////END ADDED //////////////////////////////////////////

	  $this->smarty->assign('message_text',$bodytext);

FOR NOW HAS BEEN THE ONLY SOLUTION THAT FIND AND WORKS IN PERFECTION, WHO HAVE BETTER CAN DEMONSTRATING, NOT HIDE JUST FOR YOU OWN, AFTER ALL THE MAGIC OF OPEN SOUCE It CAN SHARE!

Re: TinyMCE and absolute urls

Posted: Mon Apr 21, 2008 4:30 pm
by hedgomatic
I was having this problem as well. Here's how I fixed it:

first, open modules/TinyMCE/tinymce/jscripts/tiny_mce/plugins/simplebrowser/frmresources.list.html

look around line 90 for the following:

Code: Select all

function OpenFile( fileUrl )
{
    window.top.opener.TinyMCE_SimpleBrowserPlugin.browserCallback(escape(fileUrl)) ;
    window.top.close() ;
    //window.top.opener.focus() ; //AT 20060217 - causing focus problems, link dialog would loose focus
}

I changed it to

Code: Select all

function OpenFile( fileUrl )
{
    fileUrl = escape(fileUrl);
    fileUrl = fileUrl.replace('%3A',':');
   
    window.top.opener.TinyMCE_SimpleBrowserPlugin.browserCallback(fileUrl) ;
    window.top.close() ;
    //window.top.opener.focus() ; //AT 20060217 - causing focus problems, link dialog would loose focus
}

the problem is that escape() is replacing the colon in http://.

We're all on windows machines which don't allow colons in a filename anyway, but should that be a concern, you might want to try something like

    fileUrl = fileUrl.replace('http%3A/','http:/');

instead.

Re: TinyMCE and absolute urls

Posted: Mon Apr 21, 2008 4:39 pm
by calguy1000
The NMS module post-processes all content (just prior to sending the message) to change all relative links to absolute links.

I call it like this:
$htmlbody = make_absolute_links($htmlbody,$config['root_url']);

and here's the body of that function:

Code: Select all

function make_absolute_links($src,$base_url)
{
  // Extracts strings containing href or src="something"
  // that "something" can't begin with / or contain a :
  // because that would indicate that its already a relative URI

  // adjust the base url to have a trailing slash if it doesn't already
  $base_url = cms_join_path($base_url,'.');

  while (eregi("(href|src|action)=\"(([^/])[[:alnum:]/+=%&_.~?-]*)\"", 
	       $src, $regs)) {
    $input_uri = $regs[2];

    //Inputs the extracted string into the function make_abs
    $output_uri = _make_abs($input_uri, $base_url);

    //Replaces the relative URI with the absolute one
    $src = eregi_replace("((href|src|action)=\")$input_uri(\")", "\\1$output_uri\\3", $src);

    //Repeats over again until no relative URI:s are detected
 }

 return($src);

}

Re: TinyMCE and absolute urls

Posted: Fri Sep 26, 2008 12:53 pm
by blast2007
To whom still interested:

Alby found a bug in /modules/TinyMCE/templates/tinyconfig.tpl

http://forum.cmsmadesimple.org/index.ph ... icseen#new

regards
blast