Skip to content

Commit

Permalink
Merge branch '4.0-dev' of https://github.com/joomla/joomla-cms into t…
Browse files Browse the repository at this point in the history
…rash
  • Loading branch information
N6REJ committed Aug 26, 2020
2 parents 8028ea0 + b809711 commit d94d4e0
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 107 deletions.
2 changes: 1 addition & 1 deletion administrator/components/com_menus/tmpl/items/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
<td class="text-center d-none d-md-table-cell">
<?php if ($item->type == 'component') : ?>
<?php if ($item->language == '*' || $item->home == '0') : ?>
<?php echo HTMLHelper::_('jgrid.isdefault', $item->home, $i, 'items.', ($item->language != '*' || !$item->home) && $canChange && !$item->protected, 'cb', null, 'home', 'circle'); ?>
<?php echo HTMLHelper::_('jgrid.isdefault', $item->home, $i, 'items.', ($item->language != '*' || !$item->home) && $canChange && !$item->protected, 'cb', null, 'fa-home', 'fa-circle'); ?>
<?php elseif ($canChange) : ?>
<a href="<?php echo Route::_('index.php?option=com_menus&task=items.unsetDefault&cid[]=' . $item->id . '&' . Session::getFormToken() . '=1'); ?>">
<?php if ($item->language_image) : ?>
Expand Down
8 changes: 4 additions & 4 deletions administrator/modules/mod_user/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@
</button>
<div class="dropdown-menu dropdown-menu-right">
<div class="dropdown-header">
<span class="fas fa-fw fa-user-circle" aria-hidden="true"></span>
<span class="fas fa-user-circle fa-fw" aria-hidden="true"></span>
<?php echo Text::sprintf('MOD_USER_TITLE', $user->name); ?>
</div>
<?php $uri = Uri::getInstance(); ?>
<?php $route = 'index.php?option=com_admin&task=profile.edit&id=' . $user->id . '&return=' . base64_encode($uri) . '#details'; ?>
<a class="dropdown-item" href="<?php echo Route::_($route); ?>">
<span class="fas fa-fw fa-user" aria-hidden="true"></span>
<span class="fas fa-user fa-fw" aria-hidden="true"></span>
<?php echo Text::_('MOD_USER_EDIT_ACCOUNT'); ?>
</a>
<?php $route = 'index.php?option=com_admin&task=profile.edit&id=' . $user->id . '&return=' . base64_encode($uri) . '#attrib-accessibility'; ?>
<a class="dropdown-item" href="<?php echo Route::_($route); ?>">
<span class="fas fa-fw fa-universal-access" aria-hidden="true"></span>
<span class="fas fa-universal-access fa-fw" aria-hidden="true"></span>
<?php echo Text::_('MOD_USER_ACCESSIBILITY_SETTINGS'); ?>
</a>
<?php $route = 'index.php?option=com_login&task=logout&amp;' . Session::getFormToken() . '=1'; ?>
<a class="dropdown-item" href="<?php echo Route::_($route); ?>">
<span class="fas fa-fw fa-power-off" aria-hidden="true"></span>
<span class="fas fa-power-off fa-fw" aria-hidden="true"></span>
<?php echo Text::_('JLOGOUT'); ?>
</a>
</div>
Expand Down
4 changes: 4 additions & 0 deletions administrator/templates/atum/scss/blocks/_utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
&.hidden {
display: none;
}

.control-label {
width: 100%;
}
}

.form-no-columns & {
Expand Down
160 changes: 80 additions & 80 deletions build/media_source/legacy/js/bootstrap-init.es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,96 @@ Joomla = window.Joomla || {};
};

jQuery(document).ready(function($) {
Joomla.Bootstrap = {};

// Initialize some variables
var accordion = Joomla.getOptions('bootstrap.accordion'),
alert = Joomla.getOptions('bootstrap.alert'),
button = Joomla.getOptions('bootstrap.button'),
carousel = Joomla.getOptions('bootstrap.carousel'),
dropdown = Joomla.getOptions('bootstrap.dropdown'),
modal = $('.joomla-modal'),
modals = [].slice.call(document.querySelectorAll('.joomla-modal')),
popover = Joomla.getOptions('bootstrap.popover'),
scrollspy = Joomla.getOptions('bootstrap.scrollspy'),
tabs = Joomla.getOptions('bootstrap.tabs'),
tooltip = Joomla.getOptions('bootstrap.tooltip');

Joomla.Bootstrap.initModal = function(element) {
var $self = $(element);

// Comply with the Joomla API
// Bound element.open()
if (element) {
element.open = function () {
return $self.modal('show');
};

// Bound element.close()
element.close = function () {
return $self.modal('hide');
};
}

$self.on('show.bs.modal', function() {
// Comply with the Joomla API
// Set the current Modal ID
Joomla.Modal.setCurrent(element);

// @TODO throw the standard Joomla event
if ($self.data('url')) {
var modalBody = $self.find('.modal-body');
var el;
modalBody.find('iframe').remove();

// Hacks because com_associations and field modals use pure javascript in the url!
if ($self.data('iframe').indexOf("document.getElementById") > 0){
var iframeTextArr = $self.data('iframe').split('+');
var idFieldArr = iframeTextArr[1].split('"');

idFieldArr[0] = idFieldArr[0].replace(/&quot;/g,'"');

if (!document.getElementById(idFieldArr[1])) {
el = eval(idFieldArr[0]);
} else {
el = document.getElementById(idFieldArr[1]).value;
}

var data_iframe = iframeTextArr[0] + el + iframeTextArr[2];
modalBody.prepend(data_iframe);
} else {
modalBody.prepend($self.data('iframe'));
}
}
}).on('shown.bs.modal', function() {
var modalHeight = $('div.modal:visible').outerHeight(true),
modalHeaderHeight = $('div.modal-header:visible').outerHeight(true),
modalBodyHeightOuter = $('div.modal-body:visible').outerHeight(true),
modalBodyHeight = $('div.modal-body:visible').height(),
modalFooterHeight = $('div.modal-footer:visible').outerHeight(true),
padding = $self.offsetTop,
maxModalHeight = ($(window).height()-(padding*2)),
modalBodyPadding = (modalBodyHeightOuter-modalBodyHeight),
maxModalBodyHeight = maxModalHeight-(modalHeaderHeight+modalFooterHeight+modalBodyPadding);
if ($self.data('url')) {
var iframeHeight = $('.iframe').height();
if (iframeHeight > maxModalBodyHeight){
$('.modal-body').css({'max-height': maxModalBodyHeight, 'overflow-y': 'auto'});
$('.iframe').css('max-height', maxModalBodyHeight-modalBodyPadding);
}
}
// @TODO throw the standard Joomla event
}).on('hide.bs.modal', function() {
$('.modal-body').css({'max-height': 'initial'});
$('.modalTooltip').tooltip('dispose');
// @TODO throw the standard Joomla event
}).on('hidden.bs.modal', function() {
// Comply with the Joomla API
// Remove the current Modal ID
Joomla.Modal.setCurrent('');
// @TODO throw the standard Joomla event
});
};

/** Accordion **/
if (accordion) {
$.each(accordion, function(index, value) {
Expand Down Expand Up @@ -90,85 +167,8 @@ Joomla = window.Joomla || {};
}

/** Modals **/
if (modal.length) {
$.each($('.joomla-modal'), function() {
var $self = $(this);

// element.id is mandatory for modals!!!
var element = $self.get(0);

// Comply with the Joomla API
// Bound element.open()
if (element) {
element.open = function () {
return $self.modal('show');
};

// Bound element.close()
element.close = function () {
return $self.modal('hide');
};
}

$self.on('show.bs.modal', function() {
// Comply with the Joomla API
// Set the current Modal ID
Joomla.Modal.setCurrent(element);

// @TODO throw the standard Joomla event
if ($self.data('url')) {
var modalBody = $self.find('.modal-body');
var el;
modalBody.find('iframe').remove();

// Hacks because com_associations and field modals use pure javascript in the url!
if ($self.data('iframe').indexOf("document.getElementById") > 0){
var iframeTextArr = $self.data('iframe').split('+');
var idFieldArr = iframeTextArr[1].split('"');

idFieldArr[0] = idFieldArr[0].replace(/&quot;/g,'"');

if (!document.getElementById(idFieldArr[1])) {
el = eval(idFieldArr[0]);
} else {
el = document.getElementById(idFieldArr[1]).value;
}

var data_iframe = iframeTextArr[0] + el + iframeTextArr[2];
modalBody.prepend(data_iframe);
} else {
modalBody.prepend($self.data('iframe'));
}
}
}).on('shown.bs.modal', function() {
var modalHeight = $('div.modal:visible').outerHeight(true),
modalHeaderHeight = $('div.modal-header:visible').outerHeight(true),
modalBodyHeightOuter = $('div.modal-body:visible').outerHeight(true),
modalBodyHeight = $('div.modal-body:visible').height(),
modalFooterHeight = $('div.modal-footer:visible').outerHeight(true),
padding = $self.offsetTop,
maxModalHeight = ($(window).height()-(padding*2)),
modalBodyPadding = (modalBodyHeightOuter-modalBodyHeight),
maxModalBodyHeight = maxModalHeight-(modalHeaderHeight+modalFooterHeight+modalBodyPadding);
if ($self.data('url')) {
var iframeHeight = $('.iframe').height();
if (iframeHeight > maxModalBodyHeight){
$('.modal-body').css({'max-height': maxModalBodyHeight, 'overflow-y': 'auto'});
$('.iframe').css('max-height', maxModalBodyHeight-modalBodyPadding);
}
}
// @TODO throw the standard Joomla event
}).on('hide.bs.modal', function() {
$('.modal-body').css({'max-height': 'initial'});
$('.modalTooltip').tooltip('dispose');
// @TODO throw the standard Joomla event
}).on('hidden.bs.modal', function() {
// Comply with the Joomla API
// Remove the current Modal ID
Joomla.Modal.setCurrent('');
// @TODO throw the standard Joomla event
});
});
if (modals.length) {
modals.forEach(function(modal){ Joomla.Bootstrap.initModal(modal); });
}

/** Popover **/
Expand Down
46 changes: 26 additions & 20 deletions build/media_source/system/js/fields/joomla-field-media.w-c.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
this.onSelected = this.onSelected.bind(this);
this.show = this.show.bind(this);
this.clearValue = this.clearValue.bind(this);
this.modalClose = this.modalClose.bind(this);
this.setValue = this.setValue.bind(this);
this.updatePreview = this.updatePreview.bind(this);
}

static get observedAttributes() {
Expand Down Expand Up @@ -157,12 +160,20 @@

connectedCallback() {
this.button = this.querySelector(this.buttonSelect);
this.inputElement = this.querySelector(this.input);
this.buttonClearEl = this.querySelector(this.buttonClear);
this.show = this.show.bind(this);
this.modalClose = this.modalClose.bind(this);
this.clearValue = this.clearValue.bind(this);
this.setValue = this.setValue.bind(this);
this.updatePreview = this.updatePreview.bind(this);
this.modalElement = this.querySelector('.joomla-modal');
this.buttonSaveSelectedElement = this.querySelector(this.buttonSaveSelected);
this.previewElement = this.querySelector('.field-media-preview');

if (!this.button || !this.inputElement || !this.buttonClearEl || !this.modalElement
|| !this.buttonSaveSelectedElement) {
throw new Error('Misconfiguaration...');
}

if (Joomla.Bootstrap && Joomla.Bootstrap.initModal && typeof Joomla.Bootstrap.initModal === 'function') {
Joomla.Bootstrap.initModal(this.modalElement);
}

this.button.addEventListener('click', this.show);

Expand All @@ -183,7 +194,6 @@
}

onSelected(event) {
// event.target.removeEventListener('click', this.onSelected);
event.preventDefault();
event.stopPropagation();

Expand All @@ -192,17 +202,15 @@
}

show() {
this.querySelector('[role="dialog"]').open();
this.modalElement.open();

Joomla.selectedFile = {};

this.querySelector(this.buttonSaveSelected).addEventListener('click', this.onSelected);
this.buttonSaveSelectedElement.addEventListener('click', this.onSelected);
}

modalClose() {
const input = this.querySelector(this.input);

Joomla.getImage(Joomla.selectedFile, input, this)
Joomla.getImage(Joomla.selectedFile, this.inputElement, this)
.then(() => {
Joomla.Modal.getCurrent().close();
Joomla.selectedFile = {};
Expand All @@ -217,7 +225,7 @@
}

setValue(value) {
this.querySelector(this.input).value = value;
this.inputElement.value = value;
this.updatePreview();
}

Expand All @@ -226,20 +234,18 @@
}

updatePreview() {
if (['true', 'static'].indexOf(this.preview) === -1 || this.preview === 'false') {
if (['true', 'static'].indexOf(this.preview) === -1 || this.preview === 'false' || !this.previewElement) {
return;
}

// Reset preview
if (this.preview) {
const input = this.querySelector(this.input);
const { value } = input;
const div = this.querySelector('.field-media-preview');
const { value } = this.inputElement;

if (!value) {
div.innerHTML = '<span class="field-media-preview-icon"></span>';
this.previewElement.innerHTML = '<span class="field-media-preview-icon"></span>';
} else {
div.innerHTML = '';
this.previewElement.innerHTML = '';
const imgPreview = new Image();

switch (this.type) {
Expand All @@ -252,8 +258,8 @@
break;
}

div.style.width = this.previewWidth;
div.appendChild(imgPreview);
this.previewElement.style.width = this.previewWidth;
this.previewElement.appendChild(imgPreview);
}
}
}
Expand Down
12 changes: 10 additions & 2 deletions libraries/src/HTML/Helpers/JGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ public static function action($i, $task, $prefix = '', $active_title = '', $inac
$html[] = $tip ? ' aria-labelledby="' . $ariaid . '"' : '';
$html[] = '>';

if (strpos($active_class, 'fa-') == true || strpos($active_class, 'icon-') == true)
if (strpos($active_class, 'fa-') !== false)
{
$active_class = 'fas ' . $active_class;
}
elseif (strpos($active_class, 'icon-') !== false)
{
$active_class = $active_class;
}
Expand Down Expand Up @@ -139,7 +143,11 @@ public static function action($i, $task, $prefix = '', $active_title = '', $inac
}
else
{
if (strpos($inactive_class, 'fa-') == true || strpos($inactive_class, 'icon-') == true)
if (strpos($inactive_class, 'fa-') !== false)
{
$inactive_class = 'fas ' . $inactive_class;
}
elseif (strpos($inactive_class, 'icon-') !== false)
{
$inactive_class = $inactive_class;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ public static function getList(Registry $params, ArticlesModel $model)
// Category filter
$model->setState('filter.category_id', $params->get('catid', array()));

// State filter
$model->setState('filter.condition', 1);

// User filter
$userId = $user->get('id');

Expand Down

0 comments on commit d94d4e0

Please sign in to comment.