Skip to content

Commit

Permalink
Merge branch '4.0-dev' into 4.0-dev-datetime-default-com-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
richard67 authored Oct 2, 2019
2 parents ff5a696 + 7a94590 commit 6c4fdc7
Show file tree
Hide file tree
Showing 25 changed files with 153 additions and 161 deletions.
3 changes: 2 additions & 1 deletion administrator/components/com_mails/Model/TemplateModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\AdminModel;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Table\Table;
use Joomla\Registry\Registry;
use Joomla\Utilities\ArrayHelper;

Expand Down Expand Up @@ -185,7 +186,7 @@ public function getItem($pk = null)
}

/**
* Method to get a single record.
* Get the master data for a mail template.
*
* @param integer $pk The id of the primary key.
*
Expand Down
68 changes: 41 additions & 27 deletions administrator/components/com_mails/Model/TemplatesModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
defined('_JEXEC') or die;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\LanguageHelper;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Database\QueryInterface;

/**
* Methods supporting a list of mail template records.
Expand All @@ -29,6 +29,7 @@ class TemplatesModel extends ListModel
* @param array $config An optional associative array of configuration settings.
*
* @since __DEPLOY_VERSION__
* @throws \Exception
*/
public function __construct($config = array())
{
Expand All @@ -39,7 +40,7 @@ public function __construct($config = array())
'language', 'a.language',
'subject', 'a.subject',
'body', 'a.body',
'htmlnody', 'a.htmlbody'
'htmlbody', 'a.htmlbody'
);
}

Expand All @@ -64,9 +65,6 @@ public function __construct($config = array())
*/
protected function populateState($ordering = null, $direction = null)
{
// Initialise variables.
$app = Factory::getApplication('administrator');

// Load the parameters.
$params = ComponentHelper::getParams('com_mails');
$this->setState('params', $params);
Expand All @@ -85,17 +83,19 @@ protected function populateState($ordering = null, $direction = null)
public function getItems()
{
$items = parent::getItems();
$id = '';

$db = $this->getDbo();
$query = $db->getQuery(true)
->select('language')
->from('#__mail_templates')
->order('language ASC');
->select($db->quoteName('language'))
->from($db->quoteName('#__mail_templates'))
->where($db->quoteName('template_id') . ' = :id')
->order($db->quoteName('language') . ' ASC')
->bind(':id', $id);

foreach ($items as $item)
{
$query->clear('where')
->where('template_id = ' . $db->q($item->template_id));
$id = $item->template_id;
$db->setQuery($query);
$item->languages = $db->loadColumn();
}
Expand All @@ -115,48 +115,62 @@ protected function getListQuery()
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
$user = Factory::getUser();

// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.*'
$db->quoteName('a') . '.*'
)
);
$query->from($db->quoteName('#__mail_templates') . ' AS a')
->group('a.template_id, a.language, a.subject, a.body, a.htmlbody, a.attachments, a.params');
$query->from($db->quoteName('#__mail_templates', 'a'))
->group(
[
$db->quoteName('a.template_id'),
$db->quoteName('a.language'),
$db->quoteName('a.subject'),
$db->quoteName('a.body'),
$db->quoteName('a.htmlbody'),
$db->quoteName('a.attachments'),
$db->quoteName('a.params'),
]
);

// Filter by search in title.
$search = $this->getState('filter.search');

if (!empty($search))
if ($search = trim($this->getState('filter.search')))
{
if (stripos($search, 'id:') === 0)
{
$query->where('a.template_id = ' . $query->q(substr($search, 3)));
$search = substr($search, 3);
$query->where($db->quoteName('a.template_id') . ' = :search')
->bind(':search', $search);
}
else
{
$search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%'));
$query->where('(a.template_id LIKE ' . $search
. ' OR a.subject LIKE ' . $search
. ' OR a.body LIKE ' . $search
. ' OR a.htmlbody LIKE ' . $search . ')'
);
$search = '%' . str_replace(' ', '%', $search) . '%';
$query->where(
'(' . $db->quoteName('a.template_id') . ' LIKE :search1'
. ' OR ' . $db->quoteName('a.subject') . ' LIKE :search2'
. ' OR ' . $db->quoteName('a.body') . ' LIKE :search3'
. ' OR ' . $db->quoteName('a.htmlbody') . ' LIKE :search4)'
)
->bind([':search1', ':search2', ':search3', ':search4'], $search);
}
}

// Filter on the extension.
if ($language = $this->getState('filter.extension'))
if ($extension = $this->getState('filter.extension'))
{
$query->where('a.template_id LIKE ' . $db->quote($language . '.%'));
$extension .= '.%';
$query->where($db->quoteName('a.template_id') . ' LIKE :extension')
->bind(':extension', $extension);
}

// Filter on the language.
if ($language = $this->getState('filter.language'))
{
$query->where('a.language = ' . $db->quote($language));
$query->where($db->quoteName('a.language') . ' = :language')
->bind(':language', $language);
}

return $query;
Expand Down
21 changes: 18 additions & 3 deletions administrator/components/com_mails/View/Template/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Toolbar\Toolbar;
Expand All @@ -28,7 +29,7 @@ class HtmlView extends BaseHtmlView
/**
* The Form object
*
* @var Joomla\CMS\Form\Form
* @var \Joomla\CMS\Form\Form
*/
protected $form;

Expand All @@ -46,12 +47,26 @@ class HtmlView extends BaseHtmlView
*/
protected $state;

/**
* The template data
*
* @var array
*/
protected $templateData;

/**
* Master data for the mail template
*
* @var CMSObject
*/
protected $master;

/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
* @return void
*
* @since __DEPLOY_VERSION__
*/
Expand All @@ -65,7 +80,7 @@ public function display($tpl = null)
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \JViewGenericdataexception(implode("\n", $errors), 500);
throw new GenericDataException(implode("\n", $errors), 500);
}

list($component, $template_id) = explode('.', $this->item->template_id, 2);
Expand Down
11 changes: 7 additions & 4 deletions administrator/components/com_mails/View/Templates/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Pagination\Pagination;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;

Expand Down Expand Up @@ -42,21 +45,21 @@ class HtmlView extends BaseHtmlView
/**
* The pagination object
*
* @var \JPagination
* @var Pagination
*/
protected $pagination;

/**
* The model state
*
* @var \JObject
* @var CMSObject
*/
protected $state;

/**
* Form object for search filters
*
* @var \JForm
* @var Form
*/
public $filterForm;

Expand All @@ -72,7 +75,7 @@ class HtmlView extends BaseHtmlView
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
* @return void
*
* @since __DEPLOY_VERSION__
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@
<div class="row mt-2">
<div class="col-md-8" id="conditional-section">
<?php if($this->type == 'file') : ?>
<p class="lead"><?php echo Text::sprintf('COM_TEMPLATES_TEMPLATE_FILENAME', $this->source->filename, $this->template->element); ?></p>
<p class="lead"><?php echo Text::sprintf('COM_TEMPLATES_TEMPLATE_FILENAME', '&#x200E;' . $this->source->filename, $this->template->element); ?></p>
<p class="lead path hidden"><?php echo $this->source->filename; ?></p>
<?php endif; ?>
<?php if($this->type == 'image') : ?>
<p class="lead"><?php echo Text::sprintf('COM_TEMPLATES_TEMPLATE_FILENAME', $this->image['path'], $this->template->element); ?></p>
<p class="lead"><?php echo Text::sprintf('COM_TEMPLATES_TEMPLATE_FILENAME', '&#x200E;' . $this->image['path'], $this->template->element); ?></p>
<p class="lead path hidden"><?php echo $this->image['path']; ?></p>
<?php endif; ?>
<?php if($this->type == 'font') : ?>
<p class="lead"><?php echo Text::sprintf('COM_TEMPLATES_TEMPLATE_FILENAME', $this->font['rel_path'], $this->template->element); ?></p>
<p class="lead"><?php echo Text::sprintf('COM_TEMPLATES_TEMPLATE_FILENAME', '&#x200E;' . $this->font['rel_path'], $this->template->element); ?></p>
<p class="lead path hidden"><?php echo $this->font['rel_path']; ?></p>
<?php endif; ?>
</div>
Expand Down
4 changes: 2 additions & 2 deletions administrator/language/en-GB/en-GB.com_associations.ini
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ COM_ASSOCIATIONS_SELECT_TARGET="Select Target"
COM_ASSOCIATIONS_SELECT_TARGET_LANGUAGE="- Select Target Language -"
COM_ASSOCIATIONS_TABLE_CAPTION="Table of Associations"
COM_ASSOCIATIONS_TITLE="Associations"
COM_ASSOCIATIONS_TITLE_EDIT="Multilingual Associations: Edit Associations (%1s &gt; %2s)"
COM_ASSOCIATIONS_TITLE_LIST="Multilingual Associations (%1s &gt; %2s)"
COM_ASSOCIATIONS_TITLE_EDIT="Multilingual Associations: Edit Associations (%1s > %2s)"
COM_ASSOCIATIONS_TITLE_LIST="Multilingual Associations (%1s > %2s)"
COM_ASSOCIATIONS_TITLE_LIST_SELECT="Multilingual Associations: Select Item Type and Language"
COM_ASSOCIATIONS_XML_DESCRIPTION="Improved multilingual content management component"
COM_ASSOCIATIONS_YOU_ARE_NOT_ALLOWED_TO_CHECKIN_THIS_ITEM="You can't check in this item"

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<files>
<filename module="mod_multilangstatus">mod_multilangstatus.php</filename>
<folder>tmpl</folder>
<folder>language</folder>
</files>

<languages>
Expand Down

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion administrator/modules/mod_stats_admin/mod_stats_admin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<files>
<filename module="mod_stats_admin">mod_stats_admin.php</filename>
<folder>tmpl</folder>
<folder>language</folder>
<filename>helper.php</filename>
</files>
<languages>
Expand Down
1 change: 0 additions & 1 deletion administrator/modules/mod_version/mod_version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<namespace>Joomla\Module\Version</namespace>
<files>
<filename module="mod_version">mod_version.php</filename>
<folder>language</folder>
<folder>tmpl</folder>
<filename>helper.php</filename>
</files>
Expand Down
4 changes: 2 additions & 2 deletions administrator/modules/mod_version/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Joomla\CMS\Language\Text;

?>
<diV class="header-item-content">
<div class="header-item-content">
<div class="joomlaversion d-flex">
<div class="d-flex align-items-end mx-auto">
<span class="fab fa-joomla" aria-hidden="true"></span>
Expand All @@ -22,4 +22,4 @@
<span aria-hidden="true"><?php echo $version; ?></span>
</div>
</div>
</diV>
</div>
15 changes: 15 additions & 0 deletions build/media_source/com_templates/css/admin-templates-default.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,18 @@
.switcher-label-0, .switcher-label-1 {
white-space: nowrap;
}

/* RTL overrides for templates editing*/
[dir=rtl] .diff-pane {
text-align: left;
}

[dir=rtl] #core-pane textarea,
#override-pane textarea {
text-align: left;
}

[dir=rtl] #core-pane joomla-editor-codemirror,
#override-pane joomla-editor-codemirror {
text-align: left;
}
Loading

0 comments on commit 6c4fdc7

Please sign in to comment.