modxbot / migrate

A testground for migrating issues and other such fun
0 stars 0 forks source link

default_media_source setting in a context does not work with Rich Text Editors #10292

Open spronych opened 10 years ago

spronych commented 10 years ago

spronych created Redmine issue ID 10292

If you add a default_media_source setting to a context that media source is not loaded when a rich text editor (TinyMCE or CKEditor) loads the resource browser. Instead if you add an image or link the resource browser loads the directory that is associated with the “default_media_source” in the main “System Settings” (it ignores the context setting).The context's media source setting does work with template variables though.

The URL that the editors are calling for the resource browser popup looks something like this:

/manager/index.php?a=3&source=3&CKEditor=ext-comp-1091&CKEditorFuncNum=3&langCode=en

So the “source” media id is being recognized correctly (source=3) but this isn’t being passed to the directory listing script:

/connectors/browser/directory.php?action=getList&id=/ (POST value has source=1)

If you modify the URL that is used to launch the resource browser then the context's default_media_source works:

/manager/index.php?a=3&ctx=context_name&CKEditor=ext-comp-1091&CKEditorFuncNum=3&langCode=en

Using "&ctx=context_name" instead of "&source=3" results in the correct directory for the context displaying (the expected behavior).

Fixing this bug would mean either using the "source" parameter interchangeably with the "ctx" parameter or updating the various text editors to modify how they call the resource browser URL (the /core/model/modx/processors/system/config.js.php file doesn't include the 'key' of the active context so these scripts wouldn't have access to what they require for the "ctx" parameter).