Gossamer Forum
Home : Products : Others : Fileman :

Base HREF fix to see images in HTML editor

Quote Reply
Base HREF fix to see images in HTML editor
I gave the fix shown below a try and it does help but doesn't quite fix the problem. What happens is, if the images for a page are in a sub dir ... ie: root/help/helpimages/image.gif the editor now looks for the images in ... root/helpimages/image.gif.

Now, we can't really have image folders on scattered all over the root - very messy indeed! So, instead of having <%HOST%> defined as the root could we have it defined as... root/images/ ? This way we could create an image folder at the root and then place sub directories in the image folder, containing the images for particular pages. I believe this would be a good trade off that would allow us to see our images when using the wysiwyg editor on most of the pages in a site. Any ideas how to make this change? It sounds like a small change in coding but I'm not a programmer so I could be way off base here.

I installed this script primarily as a means to manage files remotely, but then found the inclusion of the code editor really helps speed up small changes to files. All in all, the text editor is what I use most but now I guess I'm getting a little greedy!

Thank you so much for this wonderful product. I can't imagine using anything else when I'm off site, and find I even use it for quick code fixes when I'm in the office.

1. Add these new lines ,in red , at the end of FileMan.pm:
Code:

sub js_quote_include {
my $file = shift;
my $tags = GT::Template->tags;
my ($host) = $tags->{html_url} =~ m,(\w+://[^/]*?/)?,;

my $in = new GT::CGI;
my $css_file = $in->cookie('scheme') || 'fileman';
my $color;
CASE: {
($css_file eq 'fileman') and $color = '#D6D6D6', last CASE;
($css_file eq 'gt') and $color = '#d9e4f2', last CASE;
($css_file eq 'maple') and $color = '#F0E8CE', last CASE;
($css_file eq 'rainy') and $color = '#CFD8C2', last CASE;
($css_file eq 'rose') and $color = '#DEC9CE', last CASE;
}
my $parsed = GT::Template->parse("$tags->{template_root}/common/$file",
{
host => $host,
html_url => $tags->{html_url},
scrollbar_arrow_color => 'black',
scrollbar_base_color => $color,
editor_base_color => $color,
advanced_editor_background => 'white',
advanced_editor_font => 'arial'});
$parsed =~ s{([\\/'"<>])}{\\$1}g;
$parsed =~ s/(?:\r\n|\r|\n)/\\n/g;
return \$parsed;
}


2. Add a new line <base href="<%host%>"> to templates/common/editor_editor.html, below the HEAD tag.
Quote Reply
Re: [zedd] Base HREF fix to see images in HTML editor In reply to
Hi,

Thanks for the feedback.

If you look at the editor_editor.html, you will see the code below:
<script>
var host = window.location.protocol + '//' + window.location.hostname
document.write('<base href="' + host + '">');
</script>

So, you don't need to customize the FileMan.pm.

TheStone.

B.
Quote Reply
Re: [TheStone] Base HREF fix to see images in HTML editor In reply to
Hello again

I removed the modifications from fileman.pm and editor_editor.html as suggested and now when I attempt to view a page in HTML mode I see Fileman 2.0.3 is now attempting to grab the image from the cgi-bin once again :( Here's the path I'm now getting... http://www.extremevoltage.com/...ages/Great-Ideas.gif

The mods I had added would have tried to pull the image from http://www.extremevoltage.com/images/Great-Ideas.gif which is a lot closer. The actual image resides in root/helpdesk/images/Great-Ideas.gif

I'm assuming from the above response that this should no longer be an issue with v2.0.3 so perhaps I'm doing something wrong?

Thanks in advance for any help!
Quote Reply
Re: [zedd] Base HREF fix to see images in HTML editor In reply to
Sorry, but things goofed up a little. I undid the modifications using fileman but it stripped the Head tags out of editor_editor.html. I replaced the missing tags and used FTP to upload the changes and now without any mods I can see FileMan is indeed attempting to pull the images off the root. root/images/image.gif The original image is in root/helpdesk/images/image.gif. It doesn't seem as though Base HREF can dig any deeper than the root and so I'm once again wondering if I can code my Base HREF to root/images/ and then I could put all of my image folders within the root images folder. Sorry to be a pain!

Take care :)