Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix media manager 'up' button #19443

Merged
merged 1 commit into from
Jan 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions administrator/components/com_media/views/images/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
$onClick = '';
$fieldInput = $this->state->get('field.id');
$isMoo = $input->getInt('ismoo', 1);
$author = $input->getCmd('author');
$asset = $input->getCmd('asset');

JHtml::_('formbehavior.chosen', 'select');

// Load tooltip instance without HTML support because we have a HTML tag in the tip
JHtml::_('bootstrap.tooltip', '.noHtmlTip', array('html' => false));

// Include jQuery
JHtml::_('behavior.core');
JHtml::_('jquery.framework');
JHtml::_('script', 'media/popup-imagemanager.min.js', array('version' => 'auto', 'relative' => true));
JHtml::_('stylesheet', 'media/popup-imagemanager.css', array('version' => 'auto', 'relative' => true));
Expand All @@ -32,10 +35,12 @@
JHtml::_('stylesheet', 'media/popup-imagemanager_rtl.css', array('version' => 'auto', 'relative' => true));
}

JFactory::getDocument()->addScriptDeclaration(
"
var image_base_path = '" . $params->get('image_path', 'images') . "/';
"
JFactory::getDocument()->addScriptOptions(
'mediamanager', array(
'base' => $params->get('image_path', 'images') . '/',
'asset' => $asset,
'author' => $author
)
);

/**
Expand All @@ -60,7 +65,7 @@
?>
<div class="container-popup">

<form action="index.php?option=com_media&amp;asset=<?php echo $input->getCmd('asset'); ?>&amp;author=<?php echo $input->getCmd('author'); ?>" class="form-vertical" id="imageForm" method="post" enctype="multipart/form-data">
<form action="index.php?option=com_media&amp;asset=<?php echo $asset; ?>&amp;author=<?php echo $author; ?>" class="form-vertical" id="imageForm" method="post" enctype="multipart/form-data">

<div id="messages" style="display: none;">
<span id="message"></span><?php echo JHtml::_('image', 'media/dots.gif', '...', array('width' => 22, 'height' => 12), true); ?>
Expand All @@ -86,7 +91,7 @@
</div>
</div>

<iframe id="imageframe" name="imageframe" src="index.php?option=com_media&amp;view=imagesList&amp;tmpl=component&amp;folder=<?php echo $this->state->folder; ?>&amp;asset=<?php echo $input->getCmd('asset'); ?>&amp;author=<?php echo $input->getCmd('author'); ?>"></iframe>
<iframe id="imageframe" name="imageframe" src="index.php?option=com_media&amp;view=imagesList&amp;tmpl=component&amp;folder=<?php echo $this->state->folder; ?>&amp;asset=<?php echo $asset; ?>&amp;author=<?php echo $author; ?>"></iframe>

<div class="well">
<div class="row-fluid">
Expand Down Expand Up @@ -166,7 +171,7 @@
</form>

<?php if ($user->authorise('core.create', 'com_media')) : ?>
<form action="<?php echo JUri::base(); ?>index.php?option=com_media&amp;task=file.upload&amp;tmpl=component&amp;<?php echo $this->session->getName() . '=' . $this->session->getId(); ?>&amp;<?php echo JSession::getFormToken(); ?>=1&amp;asset=<?php echo $input->getCmd('asset'); ?>&amp;author=<?php echo $input->getCmd('author'); ?>&amp;view=images" id="uploadForm" class="form-horizontal" name="uploadForm" method="post" enctype="multipart/form-data">
<form action="<?php echo JUri::base(); ?>index.php?option=com_media&amp;task=file.upload&amp;tmpl=component&amp;<?php echo $this->session->getName() . '=' . $this->session->getId(); ?>&amp;<?php echo JSession::getFormToken(); ?>=1&amp;asset=<?php echo $asset; ?>&amp;author=<?php echo $author; ?>&amp;view=images" id="uploadForm" class="form-horizontal" name="uploadForm" method="post" enctype="multipart/form-data">
<div id="uploadform" class="well">
<fieldset id="upload-noflash" class="actions">
<div class="control-group">
Expand All @@ -183,7 +188,7 @@
</div>
</div>
</fieldset>
<?php JFactory::getSession()->set('com_media.return_url', 'index.php?option=com_media&view=images&tmpl=component&fieldid=' . $input->getCmd('fieldid', '') . '&e_name=' . $input->getCmd('e_name') . '&asset=' . $input->getCmd('asset') . '&author=' . $input->getCmd('author')); ?>
<?php JFactory::getSession()->set('com_media.return_url', 'index.php?option=com_media&view=images&tmpl=component&fieldid=' . $input->getCmd('fieldid', '') . '&e_name=' . $input->getCmd('e_name') . '&asset=' . $asset . '&author=' . $author); ?>
</div>
</form>
<?php endif; ?>
Expand Down
9 changes: 7 additions & 2 deletions media/media/js/popup-imagemanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
var o = this.getUriObject(window.self.location.href),
q = this.getQueryObject(o.query);

var options = Joomla.getOptions('mediamanager');

this.author = options.author;
this.base = options.base;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be
this.base = options.base || image_base_path;
to support existing template overrides

this.asset = options.asset;
this.editor = decodeURIComponent(q.e_name);

// Setup image manager fields object
Expand Down Expand Up @@ -206,7 +211,7 @@
search = path.join('/');

this.setFolder(search);
this.setFrameUrl(search);
this.setFrameUrl(search, this.asset, this.author);
},

/**
Expand All @@ -226,7 +231,7 @@
}
});

$("#f_url").val(image_base_path + file);
$("#f_url").val(this.base + file);
},

/**
Expand Down
2 changes: 1 addition & 1 deletion media/media/js/popup-imagemanager.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.