?
avatar brianteeman
brianteeman
7 Sep 2016

Steps to reproduce the issue

Create a site using the beez template
Create an article and add it to a menu item and use the protostar template for that menu item
In the front end login and edit the article
Select the insert image from the wysiwyg toolbar to open the image select modal

Expected result

The modal opens in an iframe and is using the assigned protostar template

Actual result

The modal opens in an iframe and is using the default template for the site - in this case beez

avatar brianteeman brianteeman - open - 7 Sep 2016
avatar dgt41
dgt41 - comment - 7 Sep 2016

The url is not specifying any template:
https://github.com/joomla/joomla-cms/blob/staging/plugins/editors/tinymce/tinymce.php#L737-L740

$uploadUrl     = JUri::base() . 'index.php?option=com_media&task=file.upload&tmpl=component&'
                . $session->getName() . '=' . $session->getId()
                . '&' . JSession::getFormToken() . '=1'
                . '&asset=image&format=json';

Was this working before (3.6)? Reverting #11826 has any effect?

avatar brianteeman
brianteeman - comment - 7 Sep 2016

did a quick test on an old site and it looks like it might always have been this way

avatar dgt41
dgt41 - comment - 7 Sep 2016

Then, we can simply add tmpl=' . JFactory::getApplication()->getTemplate() . ' in the url

avatar brianteeman
brianteeman - comment - 7 Sep 2016

... everywhere the modal gets loaded - I just gave one example

avatar dgt41
dgt41 - comment - 7 Sep 2016

here is a solution:
/Users/dimitris/Documents/github_projects/joomla1/plugins/editors-xtd/image/image.php
after line 40

        $template  = $app->getTemplate();

and line 55

            $link = 'index.php?option=com_media&view=images&tmpl=component&e_name=' . $name . '&asset='
                . $asset . '&author=' . $author . '&template=' . $template;

/Users/dimitris/Documents/github_projects/joomla1/administrator/components/com_media/controller.php
replace after line 32 and before `switch($vName)

        $app      = JFactory::getApplication();
        $vType    = JFactory::getDocument()->getType();
        $vName    = $this->input->get('view', 'media', 'string');

        if ($app->isSite())
        {
            $template = $this->input->get('template', 'protostar', 'string');
            $app->setTemplate($template);
        }

This will work only for front end as setTemplate() is only available there!

avatar brianteeman
brianteeman - comment - 7 Sep 2016

Can you submit it as a pr please

avatar dgt41
dgt41 - comment - 7 Sep 2016
avatar brianteeman
brianteeman - comment - 7 Sep 2016

Closed as we have a PR

avatar brianteeman brianteeman - change - 7 Sep 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-09-07 13:40:19
Closed_By brianteeman
avatar brianteeman brianteeman - close - 7 Sep 2016

Add a Comment

Login with GitHub to post a comment