? ? Success
Pull Request for # 9454

User tests: Successful: Unsuccessful:

avatar anibalsanchez
anibalsanchez
18 Mar 2016

Pull Request for Issue #9454.

Summary of Changes

The original button from media/images fixes the issue in the case I have found.

Testing Instructions

Paste the following same code to generate a button to choose an image and fill the name field of a user in administrator/components/com_users/views/user/tmpl/edit.php

Before the patch, in J3.5 RC4, the image can't be inserted in the name field.

After the patch, when you select an image and Insert it, the file name replaces the user name.

    $idTag = 'jform_name';
    $remoteUrl = 'index.php?option=com_media&view=images&tmpl=component&asset=com_users&author=' . JFactory::getUser()->id . '&fieldid=' . $idTag;
    $buttonId = $idTag . '_btn';

    JHtml::_('bootstrap.modal');
    $test_control[] = '<a id="' . $buttonId . '" href="#' . $idTag . '_modal" role="button" class="btn" data-toggle="modal" title="' . JText::_('JSELECT') . '">' . JText::_('JSELECT') . '</a>';
    $test_control[] = JHtmlBootstrap::renderModal(
            $idTag . '_modal',
            array(
            'url' => $remoteUrl,
            'title' => JText::_('JSELECT'),
            'height' => '600px', 'width' => '500px')
    );

    echo implode('', $test_control);

    JFactory::getDocument()->addScriptDeclaration("
    window.jInsertFieldValue = function(value, id) {jQuery('#' + id).val(value);};
    window.jModalClose = function() {jQuery('div.modal').modal('hide');};
    ");   
avatar anibalsanchez anibalsanchez - open - 18 Mar 2016
avatar anibalsanchez anibalsanchez - change - 18 Mar 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 18 Mar 2016
Labels Added: ?
avatar brianteeman brianteeman - change - 18 Mar 2016
Category Media Manager
avatar brianteeman brianteeman - change - 18 Mar 2016
Rel_Number 0 9454
Relation Type Pull Request for
avatar anibalsanchez
anibalsanchez - comment - 18 Mar 2016

@brianteeman A minor note, #9454 has "label:3.5.0-blocker". Does this one inherit the same label?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9466.

avatar brianteeman brianteeman - change - 18 Mar 2016
Labels Added: ?
avatar brianteeman
brianteeman - comment - 18 Mar 2016

@wilsonge added the blocker tag - i guess it makes sense it is here as well. Added

avatar anibalsanchez
anibalsanchez - comment - 19 Mar 2016

@dgt41 @ggppdk please, test to confirm it is a viable fix.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9466.

avatar richard67 richard67 - test_item - 19 Mar 2016 - Tested successfully
avatar richard67
richard67 - comment - 19 Mar 2016

I have tested this item :white_check_mark: successfully on cdce08d

I pasted the code snippet between php tags at the end of administrator/components/com_users/views/user/tmpl/edit.php, but also at the end of administrator/templates/hathor/html/com_users/user/edit.php before last closing div.

Before patch: Works for Hathor but not for Isis.

After patch: Works for both Hathor and Isis.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9466.

avatar dgt41
dgt41 - comment - 19 Mar 2016

@anibalsanchez I get an error for normal form fields:
screen shot 2016-03-19 at 15 33 39

May I ask why you don't do something like:

$idTag = 'form_name';
$extraData = array(
    'disabled'      => false,
    'value'         => '',
    'asset'         => 'asset',
    'readonly'      => false,
    'id'            => 'someId',
    'name'          => 'name',
    'authorField'   => 'author',
    'authorId'      => JFactory::getUser()->id,
    'folder'        => '',
    'link'          => 'index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;asset=com_users&amp;author=' . JFactory::getUser()->id . '&amp;fieldid=' . $idTag,
    'preview'       => '',
    'previewHeight' => '',
    'previewWidth'  => '',
);

echo JLayoutHelper::render('joomla.form.field.media', $extraData);

This way you don;t mess mess with the internals of the field and it will work fine in all cases

avatar JoomliC
JoomliC - comment - 19 Mar 2016

@dgt41 maybe a stupid question... (as you mention "don't ask" when you added it ;-) ) but why there are overrides for form fields layouts inside Isis ?... (i don't understand the reason, and the logic... sorry if a stupid question... or not...)

avatar dgt41
dgt41 - comment - 19 Mar 2016

@JoomliC The root/layouts file is the one with mootools modal, the overrides are the ones for bootstrap. The difference is that the bootstrap javascript is different than that we had for mootools and the reason was to make it compatible with the new repeatable field.
Also (if I am not mistaken) the bootstrap also got tabs for selecting or uploading a file

avatar JoomliC
JoomliC - comment - 19 Mar 2016

@dgt41 Ok! Thanks! :+1:
A reason to keep in core the mootools, and not replacing it by the bootstrap one ? (as we know since the very first Joomla 3 that mootools should be removed ? (curiosity...)

avatar dgt41
dgt41 - comment - 19 Mar 2016

I thought that will be B/C, because there are templates out there that don't use bootstrap (although we can load it in the field :( )

avatar anibalsanchez
anibalsanchez - comment - 19 Mar 2016

@dgt41Sure, this media button call can be improved with the latest JLayouts improvements.

I have submitted the issue to fix the legacy API support. I guess there are many extensions still implementing the old way.

avatar anibalsanchez
anibalsanchez - comment - 19 Mar 2016

@dgt41 About the console error, I've been unable to reproduce it. It can be fixed in this way:

                        <button class="btn btn-success button-save-selected" type="button" onclick="<?php if ($this->state->get('field.id')):?>((window.parent.jInsertFieldValue) && (window.parent.jInsertFieldValue(document.getElementById('f_url').value,'<?php echo $this->state->get('field.id');?>')));<?php else:?>ImageManager.onok();<?php endif;?>window.parent.jModalClose();window.parent.jQuery('.modal.in').modal('hide');" data-dismiss="modal"><?php echo JText::_('COM_MEDIA_INSERT') ?></button>

But, it also affects media/images (from where I copy/pasted the button).

5'... I'm adding the condition.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9466.

avatar joomla-cms-bot
joomla-cms-bot - comment - 19 Mar 2016

This PR has received new commits.

CC: @richard67


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9466.

avatar dgt41
dgt41 - comment - 19 Mar 2016

@anibalsanchez can you update protostar layout as well?

avatar joomla-cms-bot
joomla-cms-bot - comment - 19 Mar 2016

This PR has received new commits.

CC: @richard67


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9466.

avatar joomla-cms-bot
joomla-cms-bot - comment - 19 Mar 2016

This PR has received new commits.

CC: @richard67


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9466.

avatar anibalsanchez
anibalsanchez - comment - 19 Mar 2016

Ready to be tested. @richard67 @dgt41 @JoomliC @ggppdk

Cases:

  • Backend. New article, image selection from editor
  • Backend. New article, image selection to Intro Image field
  • Frontend. New article/post, image selection from editor
  • Frontend. Module edition, image selection from editor
  • Backend. Custom field with image selection. Test in User edition as detailed above.
    This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9466.
avatar richard67 richard67 - test_item - 19 Mar 2016 - Tested successfully
avatar richard67
richard67 - comment - 19 Mar 2016

I have tested this item :white_check_mark: successfully on 6fab638

Tested all test cases mentioned in comment above.

Works as desired, no php errors or warning with maximum error reporting.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9466.

avatar MATsxm MATsxm - test_item - 19 Mar 2016 - Tested successfully
avatar MATsxm
MATsxm - comment - 19 Mar 2016

I have tested this item :white_check_mark: successfully on 6fab638

- Backend. New article, image selection from editor

  • Backend. New article, image selection to Intro Image field
  • Frontend. New article/post, image selection from editor
  • Frontend. Module edition, image selection from editor
  • Backend. Custom field with image selection. Test in User edition as detailed above.

Worked as described - Thanks!


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9466.

avatar brianteeman brianteeman - change - 19 Mar 2016
Status Pending Ready to Commit
Labels
avatar brianteeman
brianteeman - comment - 19 Mar 2016

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9466.

avatar joomla-cms-bot joomla-cms-bot - change - 19 Mar 2016
Labels Added: ?
avatar JoomliC JoomliC - test_item - 20 Mar 2016 - Tested successfully
avatar JoomliC
JoomliC - comment - 20 Mar 2016

I have tested this item :white_check_mark: successfully on 6fab638

Tested cases, and other extensions using image field, with success. :+1:


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9466.

avatar wilsonge wilsonge - change - 20 Mar 2016
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2016-03-20 18:28:51
Closed_By wilsonge
avatar wilsonge wilsonge - close - 20 Mar 2016
avatar joomla-cms-bot joomla-cms-bot - close - 20 Mar 2016
avatar wilsonge wilsonge - close - 20 Mar 2016
avatar joomla-cms-bot joomla-cms-bot - change - 20 Mar 2016
Labels Removed: ?
avatar wilsonge
wilsonge - comment - 20 Mar 2016

After discussion with @dgt41 we are just going to remove the template overrides for b/c reasons and stick with the mootools stuff

avatar brianteeman
brianteeman - comment - 20 Mar 2016

:( Thats a shame the change to using separate tabs was an improvement

On 20 March 2016 at 18:29, George Wilson notifications@github.com wrote:

After discussion with @dgt41 https://github.com/dgt41 we are just going
to remove the template overrides for b/c reasons and stick with the
mootools stuff


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#9466 (comment)

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

Add a Comment

Login with GitHub to post a comment