Changing Where CKEditor Looks for Images - ckeditor

I am wondering if there is some way to change where CKEditor looks for images. Right now it uses the location of the web page containing the editor as the root directory but I would like to write a javascript function that can change this directory to any arbitrary path passed to the function.
The bigger picture for this is that I'd like to extend the functionality of CKEditor to be able to save the source it creates to whatever location is picked by the user. I've already implemented getting the source and saving it using wxWidgets but am having trouble getting CKEditor to change its working directory so that images can be included from the directory the user picks.
I've tried using some of the properties like baseDir, basePath, and baseHref to make this possible but as far as I can tell none of them quite do what I'm looking for.
So the process would be:
(1) The user picks a directory where the source will be saved
(2) The user creates a page using CKEditor where images from the directory chosen can be included AND DISPLAYED in CKEditor
(3) The user saves the source of their page to the chosen directory (the source saved here should use the relative path to the images because the source is now located in the same directory as the images it includes)
I realize this is a rather unconventional use of CKEditor but if someone might be able to kick me in the right direction to making this happen, I'd really appreciate it.
EDIT:
So after a little experimenting and changing some backslashes to regular slashes, it looks like the baseHref attribute does what I'd like. I've still not been able to change its value at runtime though as I would like. Does anybody know if this is possible with CKEditor? I'd still like to have a javascript function that I can pass a path to and have it change this baseHref value. Right now I have set its value in config.js.
If this isn't possible, I know you can read and write the source in and out of the editor. So I would like to resort to reading and storing the source from the editor, reloading CKEditor with a new config.baseHref, and then writing the source back into the editor. Does anyone know if the CKEditor api provides functionality to reload its configuration?
Thanks.

I don't expect too many people will be trying to do what I was doing here since CKEditor is usually hosted on a server somewhere, but in case someone finds it helpful, here's what I ended up doing.
As I mentioned in the edit to my question, modifying the baseHref gave me the functionality of prepending the image filename with the directory path leading to it. I wasn't able to find a way to modify it while the editor was running so I ended up telling CKEditor to load an external configuration file each time it started with the line
config.customConfig = 'C:/Users/kenwood/Desktop/MarkCreator2/ckeditor/custom_config.js';
Then I used C++ to write new contents to custom_config.js any time I wanted to switch directories.
Unfortunately this method meant I had to read the contents out of the editor, refresh the page, and then write the editor contents back in any time I wanted to change directories. This was adequate for what I needed though.

Related

Joomla cannot unset mod_languages/css/template.css

Joomla 3.x
The following code is not working
unset($doc->_styleSheets[JURI::root(true).'/media/mod_languages/css/template.css']);
thank you
The code is correct and I tested it, it's working fine.
Possibly you are running it in a plugin event after the head is rendered, or you have cached the page and the code is not really running.
In either case, try to put it at the component level, clear cache, and it should work
Update
to identify the component: turn SEF off, and look at the URL it shows as option=com_componentname;
to identify the module, simply rename the modules folder, and update the site; if it works, it's a module.
For plugins, rename the plugins/system and plugins/content first, then drill down until you spot it.
Alternatively, but much slower, you can turn modules and plugins on and off from the backend, until you find the culprit.
A variation which I've used with success in the past:
unset($doc->_styleSheets[$this->baseurl.'/media/mod_languages/css/template.css']);
Update
Here's an alternate method using a module override which should work for you.
if it doesn't already exist, create a new directory titled html in your template's folder, ie: /templates/your-template/html/
inside this, create an new mod_languages folder, ie /templates/your-template/html/mod_languages/
copy the file from joomla-site-root/modules/mod_languages/tmp/default.php to the folder above, ie /templates/your-template/html/mod_languages/default.php
open this file with a text editor and around line 12 look for the line where JHtml is loading the mod_languages CSS, and comment it out.
// JHtml::_('stylesheet', 'mod_languages/template.css', array(), true);
That's it, hopefully, this will do the trick for you.
Overriding Joomla core output using this method is safe and you won't loose your work with future Joomla updates.
More info about Joomla overrides:
https://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core
Good luck!

How to get full image paths from web page using Firebug?

I would like to download all images in full quality from this blog: http://w899c8kcu.homepage.t-online.de/Blog.
I have access to server, but I can not find the directory where the images lie. When I use Firebug on the first picture, it shows me http://w899c8kcu.homepage.t-online.de/Blog;session=f0577255d9df9185d3abe04af0ce922d&focus=CMTOI_de_dtag_hosting_hpcreator_widget_PictureGallery_15716702&path=image.action&frame=CMTOI_de_dtag_hosting_hpcreator_widget_PictureGallery_15716702?id=34877331&width=1000&height=2000&crop=false.
How can I find the file paths like /dirname/image.jpg?
According to its HTML output the page obviously uses the CM4all content management system (CMS).
I don't know how precisely this CMS is working, though generally CMSs normally either save the files under cryptic names within a folder specified in the CMS's configuration or not in the file system at all but within a database.
Also, CMS may only save compressed or resized versions of the original files.
So, if you don't want to or are not able to dig into the server-side script code to find out if and where the images are saved, you should contact the company behind CM4all about this.

updating existing site built in dreamweaver, handling DWT file

I have a client that want's me to make a change to her OTHER site. The other site was built using Dreamweaver.
I guess (I don't build using Dreamweaver) the site pages are being controlled by the template file EXCEPT for the content that is specific to the page.
So I need to change the navigation items.
I found a folder called templates and in that folder is the template.dwt file. I tried copying that file to my desktop, then making the change and uploading back to the ftp site. Of course that had no effect on the nav items. My guess is the file on my desktop does not know to update the other pages as it doesn't know where those pages are.
So how do I go about making the changes to the files on the ftp site using the DWT file?
Do I have to download ALL the html files and the DWT files and somehow create a relationship so when I make the change to the DWT file it updates all the pages on my desktop THEN re-upload all those files back to the ftp site?
Thanks
My guess is that you already figured this out, but just to be sure. You're question is right, the DW template works by when the template is modified (in DW) then you can update all the pages that are linked to it.
If you take the template out of DW and just modify and upload that alone, then nothing will happen to the other pages. So yea, if you know a way to create a link between the template and the other files outside of DW, then that is what you need to do. The other option is using DW and modify the template and then update the other pages, which is done in a semi-automatic way. Semi-automatic, meaning that DW gives the option to update the files either once you save the template or you can save the template and update the files later using DW.
And your guess is correct, the template modifies areas that are not specific to a page. Usually, this is done by creating Editable Regions in the template. Those regions are excluded from change when the template is modified.
You have to create a project in DW and put inside all the files that are "linked" with the template. They usually have tags inside that refer to the template.
Make sure that you keep the same file and folder distribution that the original had. If not, you could have a mess with relative links.
Then, with your template also in the project, open and modify it.
When you save the template, DW will ask you for scan and update related files, if you are lucky it will find and update all of them.

Benefits of hiding file extension (of a webpage) and URL rewriting

The benefits of hiding a file extension that I know of are user-friendly URLs, and a thin layer of security (I say thin because if someone really wanted to find out the extension of a file whose type has been hidden, it probably wouldn't be difficult. Am I wrong?).
But why should you do this (hide the extension), rather than use a file of type "file", with no extension? For example, if I have an extension-less file named "404", Error page works without error (pretend I have absolutely no IE visitors).
Is there any added benefit of actively hiding the extension of a file that has one, over using files that don't have extensions? See any linked pages from schema.org for an example.
You hide the file extensions because it is Good Design.
The idea is that URIs and URLs are independent of implementation and the user should not bother about what type of file he is looking at, whether .php or .html. If I want to look at a page on the latest Fender Strats, I should just go to something like www.fender.com/strats/latest and get all that I need.
The added benefit is that the URL remains "Uniform" and you don't have to change it (especially when the user bookmarks your site), if one day you decide to shift from php to Django or Rails.
Shorter urls are one benefit of leaving out the extension?

Concrete 5 - move C5 code, images and references up to docroot

I have installed, configured and built a site on Concrete 5.5.2.1 and it is all working well. I have a problem that I have a URL of www.ayrshireminis.com/concrete5.5.2.1, for example, which is where the index.htm file sits. Is there a way that I can bring the code back up to the docroot without breaking all references such as image paths in the database for example?
Considering that the download of Concrete 5 includes this directory I am assuming that this is a common issue for some developers when using this CMS.
I'm not sure why you have an "index.htm" file -- there is no such thing in a concrete5 installation. In general, though, you should be able to move the site without problems. A few possible exceptions would be:
Depending on how exactly you're moving things, make sure you get every folder/file. For example, if you're using SSH and do something like mv concrete5.5.2.1/* ./, then you will miss the .htaccess file (because it's hidden). But if you're talking about index.htm files I am guessing you're on a Windows server instead of unix so perhaps this doesn't apply.
In older versions of Concrete5, there was a setting in the config/site.php file called DIR_REL that you would need to change when you move the site. For example, if moving from the concrete5.5.2.1 subdirectory up to the top level, you'd change define('DIR_REL', '/concrete5.5.2.1);todefine('DIR_REL', '');. So take a look in yourconfig/site.phpfile, but if you don't see thedefine('DIR_REL'...` line then don't worry about this step.
If you manually entered full URL's to page links or images, you'll need to update those. Usually this isn't an issue (assuming you use the Concrete5 toolbar that sits above the Rich Text Editor controls -- e.g. "Insert Link to Page", "Insert Image", etc.). But if you notice dead links after you move the site, then either manually update the links by editing the blocks in question, or if you want to make sure you update them all in one fell swoop, you can run the following queries on your database (via PhpMyAdmin, for example):
UPDATE btContentLocal SET content = REPLACE(content, '/old/base/dir/', '/new/dir/') WHERE content LIKE '%/old/base/dir/%';
UPDATE btContentImage SET externalLink = REPLACE(externalLink, '/old/base/dir/', '/new/dir/') WHERE externalLink LIKE '%/old/base/dir/%';
UPDATE btSlideshowImg SET url = REPLACE(url, '/old/base/dir/', '/new/dir/') WHERE url LIKE '%/old/base/dir/%';
Be careful with these queries!! You will need to change it so /old/base/dir/ and /new/dir/ make sense for your particular site. You should absolutely positively back up your database before running these queries otherwise you may completely and utterly destroy your site without any way to get it back!!!
It is actually possible to move the code from a ROOT/concrete5.5.2.1 directory back to the root without running the queries above. I simply moved the code up a directory and everything worked.

Resources