Proyectos de Subversion Moodle

Rev

Rev 4 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 4 Rev 5
Línea 1... Línea 1...
1
/**
1
/**
2
 * Defines the behavior of the configuration page of a Point of View block.
2
 * Defines the behavior of the configuration page of a Point of View block.
3
 * @copyright  2020 Quentin Fombaron, 2021 Astor Bizard
3
 * @copyright  2020 Quentin Fombaron, 2021 Astor Bizard
4
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
4
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
5
 */
5
 */
6
define("block_point_view/script_config_point_view",["jquery","core/ajax","core/notification"],(function($,ajax,notification){function buttonWithAjaxCall($button,message,ajaxmethod,ajaxargs,callback){$button.click((function(e){M.util.show_confirm_dialog(e,{message:M.util.get_string(message,"block_point_view"),callback:function(){ajax.call([{methodname:"block_point_view_"+ajaxmethod,args:ajaxargs,done:callback,fail:notification.exception}])}})}))}function setupDifficultyTrackChange(trackcolors){$(".moduletrackselect select").change((function(){$("#track_"+$(this).data("id")).css({"background-color":trackcolors[$(this).val()]})})).change()}return{init:function(envconf,trackcolors){var $enableReactions,$enableDifficultyTracks,updateElementsVisibility,updateEnableDisableButtonsFor;$enableReactions=$('[name="config_enable_point_views"]'),$enableDifficultyTracks=$('[name="config_enable_difficultytracks"]'),(updateElementsVisibility=function(){var reactionsEnabled=$enableReactions.val()>0,difficultyTracksEnabled=$enableDifficultyTracks.val()>0;$("fieldset[id^=id_activities_header]").toggle(reactionsEnabled||difficultyTracksEnabled),$(".reactions, fieldset[id^=id_images_header]").toggle(reactionsEnabled),$(".difficultytracks").toggle(difficultyTracksEnabled)})(),$enableReactions.change(updateElementsVisibility),$enableDifficultyTracks.change(updateElementsVisibility),updateEnableDisableButtonsFor=function(sectionOrType){var $checkboxes=$(".cb"+sectionOrType+":checkbox"),nBoxesChecked=$checkboxes.filter(":checked").length;$("#enableall"+sectionOrType).toggleClass("active",nBoxesChecked===$checkboxes.length),$("#disableall"+sectionOrType).toggleClass("active",0===nBoxesChecked)},$(".enablemodulereactions").change((function(){updateEnableDisableButtonsFor($(this).data("type")),updateEnableDisableButtonsFor($(this).data("section"))})).click((function(){$(".enablemodulereactions.highlighted").removeClass("highlighted")})),$(".enable-disable button").each((function(){var sectionOrType=$(this).data("type")||$(this).data("section");updateEnableDisableButtonsFor(sectionOrType),$(this).click((function(){$(".enablemodulereactions.highlighted").removeClass("highlighted"),$(".cb"+sectionOrType+":checkbox").prop("checked",$(this).data("enable")).addClass("highlighted").change()}))})),setupDifficultyTrackChange(trackcolors),buttonWithAjaxCall($("#delete_custom_pix"),"deleteemojiconfirmation","delete_custom_pix",{contextid:envconf.contextid,courseid:envconf.courseid,draftitemid:$('input[name="config_point_views_pix"]').val()},(function(){$('.pix-preview[data-source="custom"], #delete_custom_pix').remove(),document.querySelector("[id^=fitem_id_config_point_views_pix] .fp-path-folder-name").click()})),$("[name=config_pixselect]").change((function(){var newsource=$(this).val();$("img.currentpix").each((function(){var $img=$('img[data-source="'+newsource+'"][data-reaction="'+$(this).data("reaction")+'"]');1==$img.length&&$img.attr("src")>""&&$(this).attr("src",$img.attr("src"))}))})),buttonWithAjaxCall($("#cleanup_reactions"),"cleanupreactionsconfirmation","update_db",{func:"cleanup",courseid:envconf.courseid},(function(){notification.alert(M.util.get_string("info","moodle"),M.util.get_string("reactionscleanedupsuccessfully","block_point_view"),M.util.get_string("ok","moodle"))})),buttonWithAjaxCall($("#reset_reactions"),"resetreactionsconfirmation","update_db",{func:"reset",courseid:envconf.courseid},(function(){notification.alert(M.util.get_string("info","moodle"),M.util.get_string("reactionsresetsuccessfully","block_point_view"),M.util.get_string("ok","moodle"))})),$("[data-role=reset_module").each((function(){var cmid=$(this).data("cmid");buttonWithAjaxCall($(this),"resetreactionsonmoduleconfirmation","update_db",{func:"reset",courseid:envconf.courseid,cmid:cmid},(function(){notification.alert(M.util.get_string("info","moodle"),M.util.get_string("reactionsresetsuccessfully","block_point_view"),M.util.get_string("ok","moodle"))}))}))},setupDifficultyTrackChange:setupDifficultyTrackChange}}));
6
define("block_point_view/script_config_point_view",["jquery","core/ajax","core/notification"],(function($,ajax,notification){function buttonWithAjaxCall($button,message,ajaxmethod,ajaxargs,callback){$button.click((function(e){M.util.show_confirm_dialog(e,{message:M.util.get_string(message,"block_point_view"),callback:function(){ajax.call([{methodname:"block_point_view_"+ajaxmethod,args:ajaxargs,done:callback,fail:notification.exception}])}})}))}return{init:function(envconf,trackcolors){var $enableReactions,$enableDifficultyTracks,updateElementsVisibility,updateEnableDisableButtonsFor;$enableReactions=$("#id_config_enable_point_views"),$enableDifficultyTracks=$("#id_config_enable_difficultytracks"),(updateElementsVisibility=function(){var reactionsEnabled=$enableReactions.val()>0,difficultyTracksEnabled=$enableDifficultyTracks.val()>0;$("#id_activities_header").toggle(reactionsEnabled||difficultyTracksEnabled),$(".reactions, #id_images_header").toggle(reactionsEnabled),$(".difficultytracks").toggle(difficultyTracksEnabled)})(),$enableReactions.change(updateElementsVisibility),$enableDifficultyTracks.change(updateElementsVisibility),updateEnableDisableButtonsFor=function(sectionOrType){var $checkboxes=$(".cb"+sectionOrType+":checkbox"),nBoxesChecked=$checkboxes.filter(":checked").length;$("#enableall"+sectionOrType).toggleClass("active",nBoxesChecked===$checkboxes.length),$("#disableall"+sectionOrType).toggleClass("active",0===nBoxesChecked)},$(".enablemodulereactions").change((function(){updateEnableDisableButtonsFor($(this).data("type")),updateEnableDisableButtonsFor($(this).data("section"))})).click((function(){$(".enablemodulereactions.highlighted").removeClass("highlighted")})),$(".enable-disable button").each((function(){var sectionOrType=$(this).data("type")||$(this).data("section");updateEnableDisableButtonsFor(sectionOrType),$(this).click((function(){$(".enablemodulereactions.highlighted").removeClass("highlighted"),$(".cb"+sectionOrType+":checkbox").prop("checked",$(this).data("enable")).addClass("highlighted").change()}))})),$(".moduletrackselect select").change((function(){$("#track_"+$(this).data("id")).css({"background-color":trackcolors[$(this).val()]})})).change(),buttonWithAjaxCall($("#delete_custom_pix"),"deleteemojiconfirmation","delete_custom_pix",{contextid:envconf.contextid,courseid:envconf.courseid,draftitemid:$('input[name="config_point_views_pix"]').val()},(function(){$('.pix-preview[data-source="custom"], #delete_custom_pix').remove(),document.querySelector("#fitem_id_config_point_views_pix .fp-path-folder-name").click()})),$("[name=config_pixselect]").change((function(){var newsource=$(this).val();$("img.currentpix").each((function(){var $img=$('img[data-source="'+newsource+'"][data-reaction="'+$(this).data("reaction")+'"]');1==$img.length&&$img.attr("src")>""&&$(this).attr("src",$img.attr("src"))}))})),buttonWithAjaxCall($("#cleanup_reactions"),"cleanupreactionsconfirmation","update_db",{func:"cleanup",courseid:envconf.courseid},(function(){notification.alert(M.util.get_string("info","moodle"),M.util.get_string("reactionscleanedupsuccessfully","block_point_view"),M.util.get_string("ok","moodle"))})),buttonWithAjaxCall($("#reset_reactions"),"resetreactionsconfirmation","update_db",{func:"reset",courseid:envconf.courseid},(function(){notification.alert(M.util.get_string("info","moodle"),M.util.get_string("reactionsresetsuccessfully","block_point_view"),M.util.get_string("ok","moodle"))})),$("[data-role=reset_module").each((function(){var cmid=$(this).data("cmid");buttonWithAjaxCall($(this),"resetreactionsonmoduleconfirmation","update_db",{func:"reset",courseid:envconf.courseid,cmid:cmid},(function(){notification.alert(M.util.get_string("info","moodle"),M.util.get_string("reactionsresetsuccessfully","block_point_view"),M.util.get_string("ok","moodle"))}))}))}}}));
Línea 7... Línea 7...
7
 
7
 
8
//# sourceMappingURL=script_config_point_view.min.js.map
8
//# sourceMappingURL=script_config_point_view.min.js.map