30
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-06-03 23:10:50 +00:00
This commit is contained in:
Tuan Pham Ngoc 2021-08-16 13:17:32 +07:00
parent 966e62786a
commit a80e3d4dab
6 changed files with 23 additions and 18 deletions

View File

@ -211,6 +211,10 @@ class WeblinkField extends FormField
); );
} }
$closeButtonClick = "window.processModalEdit(this, '$this->id', 'add', 'weblink', 'cancel', 'weblink-form'); return false;";
$saveButtonClick = "window.processModalEdit(this, '$this->id', 'add', 'weblink', 'save', 'weblink-form'); return false;";
$applyButtonClick = "window.processModalEdit(this, '$this->id', 'add', 'weblink', 'apply', 'weblink-form'); return false;";
// New weblink modal // New weblink modal
if ($allowNew) if ($allowNew)
{ {
@ -228,13 +232,13 @@ class WeblinkField extends FormField
'bodyHeight' => '70', 'bodyHeight' => '70',
'modalWidth' => '80', 'modalWidth' => '80',
'footer' => '<a role="button" class="btn" aria-hidden="true"' 'footer' => '<a role="button" class="btn" aria-hidden="true"'
. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'weblink\', \'cancel\', \'weblink-form\'); return false;">' . ' onclick="' . $closeButtonClick . '">'
. Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</a>' . Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</a>'
. '<a role="button" class="btn btn-primary" aria-hidden="true"' . '<a role="button" class="btn btn-primary" aria-hidden="true"'
. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'weblink\', \'save\', \'weblink-form\'); return false;">' . ' onclick="' . $saveButtonClick . '">'
. Text::_('JSAVE') . '</a>' . Text::_('JSAVE') . '</a>'
. '<a role="button" class="btn btn-success" aria-hidden="true"' . '<a role="button" class="btn btn-success" aria-hidden="true"'
. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'weblink\', \'apply\', \'weblink-form\'); return false;">' . ' onclick="' . $applyButtonClick . '">'
. Text::_('JAPPLY') . '</a>', . Text::_('JAPPLY') . '</a>',
) )
); );
@ -257,13 +261,13 @@ class WeblinkField extends FormField
'bodyHeight' => '70', 'bodyHeight' => '70',
'modalWidth' => '80', 'modalWidth' => '80',
'footer' => '<a role="button" class="btn" aria-hidden="true"' 'footer' => '<a role="button" class="btn" aria-hidden="true"'
. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'weblink\', \'cancel\', \'weblink-form\'); return false;">' . ' onclick="' . $closeButtonClick . '">'
. Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</a>' . Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</a>'
. '<a role="button" class="btn btn-primary" aria-hidden="true"' . '<a role="button" class="btn btn-primary" aria-hidden="true"'
. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'weblink\', \'save\', \'weblink-form\'); return false;">' . ' onclick="' . $saveButtonClick . '">'
. Text::_('JSAVE') . '</a>' . Text::_('JSAVE') . '</a>'
. '<a role="button" class="btn btn-success" aria-hidden="true"' . '<a role="button" class="btn btn-success" aria-hidden="true"'
. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'weblink\', \'apply\', \'weblink-form\'); return false;">' . ' onclick="' . $applyButtonClick . '">'
. Text::_('JAPPLY') . '</a>', . Text::_('JAPPLY') . '</a>',
) )
); );

View File

@ -81,6 +81,7 @@ class AdministratorService
if ($items) if ($items)
{ {
$app = Factory::getApplication();
$languages = LanguageHelper::getContentLanguages(array(0, 1)); $languages = LanguageHelper::getContentLanguages(array(0, 1));
$content_languages = array_column($languages, 'lang_code'); $content_languages = array_column($languages, 'lang_code');
@ -91,7 +92,8 @@ class AdministratorService
$text = $item->lang_code; $text = $item->lang_code;
$url = Route::_('index.php?option=com_weblinks&task=weblink.edit&id=' . (int) $item->id); $url = Route::_('index.php?option=com_weblinks&task=weblink.edit&id=' . (int) $item->id);
$tooltip = '<strong>' . htmlspecialchars($item->language_title, ENT_QUOTES, 'UTF-8') . '</strong><br>' $tooltip = '<strong>' . htmlspecialchars($item->language_title, ENT_QUOTES, 'UTF-8') . '</strong><br>'
. htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8') . '<br>' . Text::sprintf('JCATEGORY_SPRINTF', $item->category_title); . htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8')
. '<br>' . Text::sprintf('JCATEGORY_SPRINTF', $item->category_title);
$classes = 'badge bg-secondary'; $classes = 'badge bg-secondary';
$item->link = '<a href="' . $url . '" class="' . $classes . '">' . $text . '</a>' $item->link = '<a href="' . $url . '" class="' . $classes . '">' . $text . '</a>'
@ -100,7 +102,7 @@ class AdministratorService
else else
{ {
// Display warning if Content Language is trashed or deleted // Display warning if Content Language is trashed or deleted
Factory::getApplication()->enqueueMessage(Text::sprintf('JGLOBAL_ASSOCIATIONS_CONTENTLANGUAGE_WARNING', $item->lang_code), 'warning'); $app->enqueueMessage(Text::sprintf('JGLOBAL_ASSOCIATIONS_CONTENTLANGUAGE_WARNING', $item->lang_code), 'warning');
} }
} }
} }

View File

@ -193,7 +193,6 @@ class WeblinkModel extends ItemModel
} }
} }
return $this->_item[$pk]; return $this->_item[$pk];
} }

View File

@ -71,13 +71,13 @@ class HtmlView extends BaseHtmlView
$item->event = new \stdClass; $item->event = new \stdClass;
$results = $app->triggerEvent('onContentAfterTitle', array('com_weblinks.weblink', &$item, &$item->params, $offset)); $results = $app->triggerEvent('onContentAfterTitle', array('com_weblinks.weblink', &$item, &$item->params, $offset));
$item->event->afterDisplayTitle = trim(implode("\n", $results)); $item->event->afterDisplayTitle = trim(implode("\n", $results));
$results = $app->triggerEvent('onContentBeforeDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset)); $results = $app->triggerEvent('onContentBeforeDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset));
$item->event->beforeDisplayContent = trim(implode("\n", $results)); $item->event->beforeDisplayContent = trim(implode("\n", $results));
$results = $app->triggerEvent('onContentAfterDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset)); $results = $app->triggerEvent('onContentAfterDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset));
$item->event->afterDisplayContent = trim(implode("\n", $results)); $item->event->afterDisplayContent = trim(implode("\n", $results));
parent::display($tpl); parent::display($tpl);

View File

@ -60,10 +60,10 @@ $listDirn = $this->escape($this->state->get('list.direction'));
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (empty($this->items)) : ?> <?php if (empty($this->items)) : ?>
<div class="alert alert-info"> <div class="alert alert-info">
<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span> <span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
<?php echo Text::_('COM_WEBLINKS_NO_WEBLINKS'); ?> <?php echo Text::_('COM_WEBLINKS_NO_WEBLINKS'); ?>
</div> </div>
<?php else : ?> <?php else : ?>
<ul class="category list-unstyled"> <ul class="category list-unstyled">
<?php foreach ($this->items as $i => $item) : ?> <?php foreach ($this->items as $i => $item) : ?>
@ -156,7 +156,7 @@ $listDirn = $this->escape($this->state->get('list.direction'));
<div class="mt-2 mb-2"> <div class="mt-2 mb-2">
<?php $images = json_decode($item->images); ?> <?php $images = json_decode($item->images); ?>
<?php if (!empty($images->image_first)) : ?> <?php if (!empty($images->image_first)) : ?>
<?php $imgFloat = '' ;?> <?php $imgFloat = '';?>
<?php if (!empty($images->float_first)) : ?> <?php if (!empty($images->float_first)) : ?>
<?php $imgFloat = $images->float_first == 'right' ? 'float-end' : 'float-start'; ?> <?php $imgFloat = $images->float_first == 'right' ? 'float-end' : 'float-start'; ?>
<?php endif; ?> <?php endif; ?>

View File

@ -64,7 +64,7 @@ if (!$canEdit)
<div class="p-3"> <div class="p-3">
<?php $images = json_decode($this->item->images); ?> <?php $images = json_decode($this->item->images); ?>
<?php if (!empty($images->image_first)) : ?> <?php if (!empty($images->image_first)) : ?>
<?php $imgFloat = '' ;?> <?php $imgFloat = '';?>
<?php if (!empty($images->float_first)) : ?> <?php if (!empty($images->float_first)) : ?>
<?php $imgFloat = $images->float_first == 'right' ? 'float-end' : 'float-start'; ?> <?php $imgFloat = $images->float_first == 'right' ? 'float-end' : 'float-start'; ?>
<?php endif; ?> <?php endif; ?>