One upload dialog - Two targets ?
| Add comments > |
|
08 Aug 10
Thank you George, but that gets me the same result as when add'ing it using CKEDITOR.on( 'dialogDefinition'.. The actual form in the iframe (and also the recieved one) still doesn't contain the new fields (form-action wasn't changed) SO - Rouge to the rescue - I went ahead and hacked it - Successfully Just one new checkbox in /plugins/image/dialogs/image.js
{ if (action.indexOf("&target=P") == -1) theForm.setAttribute("action",action) // alert("action post: "+theForm.getAttribute("action")) This works perfectly (only tested in Firefox so far..) - just a little concerned about the hardcoded "125_fileInput"... PS: Idea (silly!) for dificulty-rating: "How long have you spent trying to make it work before giving up and asking" - Less than 1 hour : Easy. - Less that 1 day: Medium. - Longer: Rocket Science. Last update: 08 Aug 10 1 comment > |
|
07 Aug 10
The solution should be very easy. I think modifying the CKEditor image plugin will be the most easy way to achieve your goal. Just add the following code to the element list of the Upload tab definitation of /plugins/image/dialogs/image.js {
type : 'checkbox',
id : 'PrivateServer',
label: 'Upload to private server',
checked : true, //set your default value to true
onClick: function(){
CKEDITOR.config.filebrowserUploadUrl = "private server url";
}
},
{
type : 'checkbox',
id : 'PublicServer',
label: 'Upload to public server',
onClick: function(){
CKEDITOR.config.filebrowserUploadUrl = "public server url";
}
}
Rememeber you have to pack the source code using ckpackager.
|
Please login to post answer.

I have already created image handling functions:
An upload reciever (filebrowserUploadUrl) and an image browser dialog (filebrowserBrowseUrl)
- Both work perfectly
BUT of course my users want more... We have two image-databases: Common and Private
- The browser lets the user pick from either.
My upload-reciever (php) can easily put a new image in either of these containers.
- but do I let the user pick which one should be the target ?
Two ideas - both involving modifying the upload-dialog-tab ( file-field + upload-button) adding a target selector:
A) Two different upload-buttons: (Upload to Common) + (Upload to Private)
- both pointing to the same filebrowserUploadUrl but adding a parameter ~ &target=C or &target=P
B) A couple of "radio" selectors: Common or Private - essentially doing the same: adding &target=(P or C)
- with one of them selected by default, so the user can't break it by negligence...
I've really tried, but as a non-jQuery javascript developer, I just can't make sense of it all
So I'd appreciate an example of how to modify the upload-dialog-tab to accomplish (either of) these ?
I have my launch platform ready (I think):
CKEDITOR.on( 'dialogDefinition',
function( ev )
{
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
if ( dialogName == 'image' )
{
var infoTab = dialogDefinition.getContents( 'upload' );