TinyMCE and absolute urls

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
linsec
New Member
New Member
Posts: 7
Joined: Wed Dec 07, 2005 1:21 am

TinyMCE and absolute urls

Post 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.
nuno

Re: TinyMCE and absolute urls

Post by nuno »

I have same problem !!!
any hep??
nuno

Re: TinyMCE and absolute urls

Post 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!!!!
Last edited by nuno on Sun Oct 28, 2007 11:06 pm, edited 1 time in total.
KC
Forum Members
Forum Members
Posts: 33
Joined: Fri Feb 02, 2007 12:28 am

Re: TinyMCE and absolute urls

Post 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
KC
Forum Members
Forum Members
Posts: 33
Joined: Fri Feb 02, 2007 12:28 am

Re: TinyMCE and absolute urls

Post 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
nuno

Re: TinyMCE and absolute urls

Post 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
Last edited by nuno on Sat Nov 10, 2007 9:56 pm, edited 1 time in total.
KC
Forum Members
Forum Members
Posts: 33
Joined: Fri Feb 02, 2007 12:28 am

Re: TinyMCE and absolute urls

Post by KC »

I placed it just under

relative_urls : "true",

Grtz Kees
nuno

Re: TinyMCE and absolute urls

Post by nuno »

See the attached image already tried to think of everything!  ???  :P  >:(
Attachments
tiny_help.gif
bmunsch
Forum Members
Forum Members
Posts: 61
Joined: Sat Oct 13, 2007 11:03 am

Re: TinyMCE and absolute urls

Post by bmunsch »

Hello,

Have you the solution for the absolute urls ?

Thanks
nuno

Re: TinyMCE and absolute urls

Post 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!
Last edited by nuno on Mon Nov 19, 2007 11:22 pm, edited 1 time in total.
hedgomatic
New Member
New Member
Posts: 8
Joined: Wed Apr 09, 2008 2:09 pm

Re: TinyMCE and absolute urls

Post 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.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: TinyMCE and absolute urls

Post 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);

}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
blast2007
Power Poster
Power Poster
Posts: 508
Joined: Wed Aug 01, 2007 5:36 pm

Re: TinyMCE and absolute urls

Post 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
Post Reply

Return to “Modules/Add-Ons”