diff --git a/src/components/com_tjucm/media/js/ui/item.js b/src/components/com_tjucm/media/js/ui/item.js new file mode 100644 index 00000000..d085dbed --- /dev/null +++ b/src/components/com_tjucm/media/js/ui/item.js @@ -0,0 +1,12 @@ +/* confirmation message before item deletion */ + jQuery(window).ready(function () { + jQuery('.delete-button').click(deleteItem); + }); + + function deleteItem() + { + if (!confirm(Joomla.JText._('COM_TJUCM_DELETE_MESSAGE'))) + { + return false; + } + } diff --git a/src/components/com_tjucm/media/js/ui/item.min.js b/src/components/com_tjucm/media/js/ui/item.min.js new file mode 100644 index 00000000..5db4df2c --- /dev/null +++ b/src/components/com_tjucm/media/js/ui/item.min.js @@ -0,0 +1 @@ +function deleteItem(){if(!confirm(Joomla.JText._("COM_TJUCM_DELETE_MESSAGE")))return!1}jQuery(window).ready(function(){jQuery(".delete-button").click(deleteItem)}); \ No newline at end of file diff --git a/src/components/com_tjucm/site/includes/tjucm.php b/src/components/com_tjucm/site/includes/tjucm.php index 1f05b010..79bdf3b9 100644 --- a/src/components/com_tjucm/site/includes/tjucm.php +++ b/src/components/com_tjucm/site/includes/tjucm.php @@ -201,6 +201,11 @@ public static function init($location = 'site') HTMLHelper::StyleSheet('media/com_tjucm/css/tjucm.css', $options); } + if ($view == 'item') + { + HTMLHelper::script('media/com_tjucm/js/ui/item.js'); + } + $loaded[$location] = true; } } diff --git a/src/components/com_tjucm/site/views/item/tmpl/default.php b/src/components/com_tjucm/site/views/item/tmpl/default.php index 00fc4663..5d848ca9 100644 --- a/src/components/com_tjucm/site/views/item/tmpl/default.php +++ b/src/components/com_tjucm/site/views/item/tmpl/default.php @@ -1,15 +1,17 @@ + * @package TJ-UCM + * @author TechJoomla * @copyright Copyright (c) 2009-2019 TechJoomla. All rights reserved. - * @license GNU General Public License version 2 or later; see LICENSE.txt + * @license GNU General Public License version 2 or later; see LICENSE.txt */ // No direct access defined('_JEXEC') or die; +/*To load language constant of js file*/ +JText::script('COM_TJUCM_DELETE_MESSAGE'); + $user = JFactory::getUser(); if ($this->form_extra) @@ -59,7 +61,7 @@ { $redirectURL = JRoute::_('index.php?option=com_tjucm&task=itemform.remove&id=' . $this->item->id . '&client=' . $this->client . "&" . JSession::getFormToken() . '=1', false); ?> - + diff --git a/src/components/com_tjucm/site/views/itemform/tmpl/default.php b/src/components/com_tjucm/site/views/itemform/tmpl/default.php index 84ba4cf4..a73a52d4 100644 --- a/src/components/com_tjucm/site/views/itemform/tmpl/default.php +++ b/src/components/com_tjucm/site/views/itemform/tmpl/default.php @@ -116,15 +116,15 @@ form_extra) - { - if($this->id!='0') + { + if ($this->id != '0') { ?> title); ?>

-