Skip to content

Commit

Permalink
Merge branch '4.0-dev' into 4.0-dev-chmst
Browse files Browse the repository at this point in the history
  • Loading branch information
chmst committed Jul 11, 2018
2 parents 5d17c4c + 39ab4f8 commit e66144c
Show file tree
Hide file tree
Showing 18 changed files with 130 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

// Fieldsets to not automatically render by /layouts/joomla/edit/params.php
$this->ignore_fieldsets = array('jmetadata', 'item_associations');
$this->useCoreUI = true;

// In case of modal
$isModal = $input->get('layout') == 'modal' ? true : false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@
</div>
<div class="row">
<?php if ($published >= 0) : ?>
<div class="form-group col-md-6">
<div class="controls">
<?php echo HTMLHelper::_('batch.tag'); ?>
</div>
<div class="form-group col-md-6">
<div class="controls">
<?php echo HTMLHelper::_('batch.item', 'com_content'); ?>
</div>
</div>
<?php endif; ?>
<div class="form-group col-md-6">
<div class="controls">
<?php echo HTMLHelper::_('batch.tag'); ?>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

defined('_JEXEC') or die;

$title = JText::_('COM_MEDIA_CREATE_NEW_FOLDER');
use Joomla\CMS\Language\Text;

$title = Text::_('COM_MEDIA_CREATE_NEW_FOLDER');
?>
<button class="btn btn-sm btn-info" onclick="MediaManager.Event.fire('onClickCreateFolder');">
<span class="icon-folder-close" title="<?php echo $title; ?>"></span> <?php echo $title; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

defined('_JEXEC') or die;

$title = JText::_('JTOOLBAR_DELETE');
use Joomla\CMS\Language\Text;

$title = Text::_('JTOOLBAR_DELETE');
?>
<button class="btn btn-sm btn-danger" onclick="MediaManager.Event.fire('onClickDelete');">
<span class="icon-delete" title="<?php echo $title; ?>"></span> <?php echo $title; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

defined('_JEXEC') or die;

$title = JText::_('JTOOLBAR_UPLOAD');
use Joomla\CMS\Language\Text;

$title = Text::_('JTOOLBAR_UPLOAD');
?>
<button class="btn btn-sm btn-success" onclick="MediaManager.Event.fire('onClickUpload');">
<span class="icon-upload" title="<?php echo $title; ?>"></span> <?php echo $title; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Joomla\Component\Media\Administrator\Exception\FileExistsException;
use Joomla\Component\Media\Administrator\Exception\FileNotFoundException;
use Joomla\Component\Media\Administrator\Exception\InvalidPathException;
use Joomla\CMS\Language\Text;

\JLoader::import('joomla.filesystem.file');

Expand Down Expand Up @@ -54,7 +55,7 @@ public function execute($task)
// Check token for requests which do modify files (all except get requests)
if ($method !== 'GET' && !Session::checkToken('json'))
{
throw new \InvalidArgumentException(\JText::_('JINVALID_TOKEN'), 403);
throw new \InvalidArgumentException(Text::_('JINVALID_TOKEN'), 403);
}

$doTask = strtolower($method) . ucfirst($task);
Expand All @@ -64,7 +65,7 @@ public function execute($task)

if (!in_array($this->doTask, $this->taskMap))
{
throw new \Exception(\JText::sprintf('JLIB_APPLICATION_ERROR_TASK_NOT_FOUND', $task), 405);
throw new \Exception(Text::sprintf('JLIB_APPLICATION_ERROR_TASK_NOT_FOUND', $task), 405);
}

$data = $this->$doTask();
Expand Down Expand Up @@ -348,7 +349,7 @@ private function checkContent()
{
if (!Factory::getUser()->authorise('core.create', 'com_media'))
{
throw new \Exception(\JText::_('COM_MEDIA_ERROR_CREATE_NOT_PERMITTED'), 403);
throw new \Exception(Text::_('COM_MEDIA_ERROR_CREATE_NOT_PERMITTED'), 403);
}

$params = ComponentHelper::getParams('com_media');
Expand All @@ -361,7 +362,7 @@ private function checkContent()
|| $serverlength > $helper->toBytes(ini_get('post_max_size'))
|| $serverlength > $helper->toBytes(ini_get('memory_limit')))
{
throw new \Exception(\JText::_('COM_MEDIA_ERROR_WARNFILETOOLARGE'), 403);
throw new \Exception(Text::_('COM_MEDIA_ERROR_WARNFILETOOLARGE'), 403);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Component\Media\Administrator\Event\OAuthCallbackEvent;
use Joomla\CMS\Router\Route;

/**
* Plugin Controller for OAuth2.0 callbacks
Expand Down Expand Up @@ -103,7 +104,7 @@ public function oauthcallback()
* Use this for close New Windows opened for OAuth Process
*/
case 'close':
$this->setRedirect(\JRoute::_('index.php?option=com_media&view=plugin&action=close', false));
$this->setRedirect(Route::_('index.php?option=com_media&view=plugin&action=close', false));
break;

// Redirect browser to any page specified by the user
Expand All @@ -117,20 +118,20 @@ public function oauthcallback()

// Redirect browser to Control Panel
case 'control-panel':
$this->setRedirect(\JRoute::_('index.php', false));
$this->setRedirect(Route::_('index.php', false));
break;

// Redirect browser to Media Manager
case 'media-manager':
default:
$this->setRedirect(\JRoute::_('index.php?option=com_media', false));
$this->setRedirect(Route::_('index.php?option=com_media', false));
}
}
catch (\Exception $e)
{
// Display any error
$this->app->enqueueMessage($e->getMessage(), 'error');
$this->setRedirect(\JRoute::_('index.php', false));
$this->setRedirect(Route::_('index.php', false));
}

// Redirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Joomla\CMS\Form\Form;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\HTML\HTMLHelper;

/**
* Media Manager Base Plugin for the media actions
Expand Down Expand Up @@ -71,7 +72,7 @@ public function onContentPrepareForm(Form $form, $data)
*/
protected function loadJs()
{
\JHtml::_(
HTMLHelper::_(
'script',
'plg_media-action_' . $this->_name . '/' . $this->_name . '.js',
array('version' => 'auto', 'relative' => true)
Expand All @@ -87,7 +88,7 @@ protected function loadJs()
*/
protected function loadCss()
{
\JHtml::_(
HTMLHelper::_(
'stylesheet',
'plg_media-action_' . $this->_name . '/' . $this->_name . '.css',
array('version' => 'auto', 'relative' => true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Joomla\CMS\Factory;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Language\Text;

\JLoader::import('joomla.filesystem.file');

Expand Down Expand Up @@ -67,7 +68,7 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
ToolbarHelper::title(\JText::_('COM_MEDIA_EDIT'), 'images mediamanager');
ToolbarHelper::title(Text::_('COM_MEDIA_EDIT'), 'images mediamanager');

ToolbarHelper::apply('apply');
ToolbarHelper::save('save');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Router\Route;

/**
* Media List View
Expand Down Expand Up @@ -65,7 +66,7 @@ public function display($tpl = null)
// Check that there are providers
if (!count($this->providers))
{
$link = \JRoute::_('index.php?option=com_plugins&view=plugins&filter[folder]=filesystem');
$link = Route::_('index.php?option=com_plugins&view=plugins&filter[folder]=filesystem');
Factory::getApplication()->enqueueMessage(Text::sprintf('COM_MEDIA_ERROR_NO_PROVIDERS', $link), CMSApplication::MSG_WARNING);
}

Expand All @@ -90,7 +91,7 @@ protected function prepareToolbar()
$user = Factory::getUser();

// Set the title
ToolbarHelper::title(\JText::_('COM_MEDIA'), 'images mediamanager');
ToolbarHelper::title(Text::_('COM_MEDIA'), 'images mediamanager');

// Add the upload and create folder buttons
if ($user->authorise('core.create', 'com_media'))
Expand All @@ -111,7 +112,7 @@ protected function prepareToolbar()
// Add a delete button
if ($user->authorise('core.delete', 'com_media'))
{
// Instantiate a new JLayoutFile instance and render the layout
// Instantiate a new FileLayout instance and render the layout
$layout = new FileLayout('toolbar.delete');

$bar->appendButton('Custom', $layout->render(array()), 'delete');
Expand Down
11 changes: 6 additions & 5 deletions administrator/components/com_media/tmpl/file/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;

// Add javascripts
HTMLHelper::_('behavior.core');
Expand All @@ -23,7 +24,7 @@
HTMLHelper::_('script', 'com_media/edit-images.js', array('version' => 'auto', 'relative' => true));
// @TODO logic to load plugins per media type

$params = JComponentHelper::getParams('com_media');
$params = ComponentHelper::getParams('com_media');

// Add stylesheets
HTMLHelper::_('stylesheet', 'media/com_media/css/mediamanager.css');
Expand Down
33 changes: 20 additions & 13 deletions administrator/components/com_media/tmpl/media/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,50 @@
*/
defined('_JEXEC') or die;

$doc = JFactory::getDocument();
$params = JComponentHelper::getParams('com_media');
use Joomla\CMS\Session\Session;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;

$doc = Factory::getDocument();
$params = ComponentHelper::getParams('com_media');

// Make sure core.js is loaded before media scripts
JHtml::_('behavior.core');
JHtml::_('behavior.keepalive');
HTMLHelper::_('behavior.core');
HTMLHelper::_('behavior.keepalive');

// Add javascripts
JHtml::_('script', 'media/com_media/js/mediamanager.js');
HTMLHelper::_('script', 'media/com_media/js/mediamanager.js');

// Add stylesheets
JHtml::_('stylesheet', 'media/com_media/css/mediamanager.css');
HTMLHelper::_('stylesheet', 'media/com_media/css/mediamanager.css');

// Populate the language
$this->loadTemplate('texts');

$tmpl = JFactory::getApplication()->input->getCmd('tmpl');
$tmpl = Factory::getApplication()->input->getCmd('tmpl');

// Load the toolbar when we are in an iframe
if ($tmpl == 'component')
{
echo JToolbar::getInstance('toolbar')->render();
echo Toolbar::getInstance('toolbar')->render();
}

// Populate the media config
$config = array(
'apiBaseUrl' => JUri::root() . 'administrator/index.php?option=com_media&format=json',
'csrfToken' => JSession::getFormToken(),
'apiBaseUrl' => Uri::root() . 'administrator/index.php?option=com_media&format=json',
'csrfToken' => Session::getFormToken(),
'filePath' => $params->get('file_path', 'images'),
'fileBaseUrl' => JUri::root() . $params->get('file_path', 'images'),
'fileBaseUrl' => Uri::root() . $params->get('file_path', 'images'),
'fileBaseRelativeUrl' => $params->get('file_path', 'images'),
'editViewUrl' => JUri::root() . 'administrator/index.php?option=com_media&view=file' . (!empty($tmpl) ? ('&tmpl=' . $tmpl) : ''),
'editViewUrl' => Uri::root() . 'administrator/index.php?option=com_media&view=file' . (!empty($tmpl) ? ('&tmpl=' . $tmpl) : ''),
'allowedUploadExtensions' => $params->get('upload_extensions', ''),
'maxUploadSizeMb' => $params->get('upload_maxsize', 10),
'providers' => (array) $this->providers,
'currentPath' => $this->currentPath,
'isModal' => JFactory::getApplication()->input->getCmd('tmpl', '') === 'component' ? true : false,
'isModal' => Factory::getApplication()->input->getCmd('tmpl', '') === 'component' ? true : false,
);
$doc->addScriptOptions('com_media', $config);
?>
Expand Down

0 comments on commit e66144c

Please sign in to comment.