32
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2025-01-28 23:08:27 +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];
} }