From c22e4cd72ec1cdf8d75e63675c10f329f0bdf7e4 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Tue, 22 Dec 2015 19:07:13 -0500 Subject: [PATCH] Confirm before associate/dissociate forum to LP item - refs BT#10629 --- main/newscorm/learnpath.class.php | 8 ++++---- main/newscorm/lp_add_item.php | 17 ++++++++++++++++- main/newscorm/lp_edit_item.php | 18 ++++++++++++++++++ 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index 492ab11098..be7e57d153 100755 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -5642,9 +5642,9 @@ class learnpath ) ) { $forumIcon = Display::url( - Display::return_icon('forum.png', get_lang('CreateForum'), [], ICON_SIZE_TINY), + Display::return_icon('forum.png', get_lang('DissociateForumToLPItem'), [], ICON_SIZE_TINY), '#', - ['class' => 'btn btn-default disabled'] + ['class' => 'btn btn-default disabled lp-btn-dissociate-forum'] ); } else { $forumIconUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ @@ -5653,9 +5653,9 @@ class learnpath 'lp_id' => $this->lp_id ]); $forumIcon = Display::url( - Display::return_icon('forum.png', get_lang('CreateForum'), [], ICON_SIZE_TINY), + Display::return_icon('forum.png', get_lang('AssociateForumToLPItem'), [], ICON_SIZE_TINY), $forumIconUrl, - ['class' => "btn btn-default"] + ['class' => "btn btn-default lp-btn-associate-forum"] ); } } diff --git a/main/newscorm/lp_add_item.php b/main/newscorm/lp_add_item.php index 0348b5ec0b..052b8cf240 100755 --- a/main/newscorm/lp_add_item.php +++ b/main/newscorm/lp_add_item.php @@ -172,7 +172,22 @@ $(document).ready(function() { $("#hide_bar_template").toggleClass("hide_bar_template_not_hide"); }); - + + $('.lp-btn-associate-forum').on('click', function (e) { + var associate = confirm(''); + + if (!associate) { + e.preventDefault(); + } + }); + + $('.lp-btn-dissociate-forum').on('click', function (e) { + var dissociate = confirm(''); + + if (!dissociate) { + e.preventDefault(); + } + }); }); '); + + if (!associate) { + e.preventDefault(); + } + }); + + $('.lp-btn-dissociate-forum').on('click', function (e) { + var dissociate = confirm(''); + + if (!dissociate) { + e.preventDefault(); + } + }); +});