Minor: Format code

pull/5246/head
Angel Fernando Quiroz Campos 2 years ago
parent 054905286b
commit 38081c89d5
  1. 623
      assets/js/legacy/app.js
  2. 42
      assets/js/legacy/vendor.js
  3. 20
      assets/vue/App.vue
  4. 6
      src/CoreBundle/Controller/FileManagerController.php

@ -1,151 +1,153 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
const $ = require('jquery'); const $ = require("jquery")
window.jQuery = $; window.jQuery = $
window.$ = $; window.$ = $
global.jQuery = $; global.jQuery = $
global.$ = global.jQuery = $ global.$ = global.jQuery = $
//Routing.setRoutingData(routes); //Routing.setRoutingData(routes);
const locale = document.querySelector('html').lang; const locale = document.querySelector("html").lang
// moment // moment
const { DateTime } = require("luxon"); const { DateTime } = require("luxon")
window.luxon = global.luxon = DateTime; window.luxon = global.luxon = DateTime
import 'select2/dist/js/select2.full.min'; import "select2/dist/js/select2.full.min"
import 'select2/dist/css/select2.min.css'; import "select2/dist/css/select2.min.css"
import 'moment'; import "moment"
//require('flatpickr');
import "jquery-ui-dist/jquery-ui.js"
import "./main"
// Date time settings.
import moment from "moment"
import Sortable from "sortablejs"
import Swal from "sweetalert2"
// Gets HTML content from tinymce // Gets HTML content from tinymce
window.getContentFromEditor = function (id) { window.getContentFromEditor = function (id) {
if (typeof tinymce == "undefined") { if (typeof tinymce == "undefined") {
return false; return false
} }
let content = ''; let content = ""
if (tinymce.get(id)) { if (tinymce.get(id)) {
content = tinymce.get(id).getContent(); content = tinymce.get(id).getContent()
} }
return content; return content
}; }
window.setContentFromEditor = function (id, content) { window.setContentFromEditor = function (id, content) {
if (tinymce.get(id)) { if (tinymce.get(id)) {
tinymce.get(id).setContent(content); tinymce.get(id).setContent(content)
return true; return true
} }
return false; return false
}; }
//require('flatpickr');
import 'jquery-ui-dist/jquery-ui.js';
// const frameReady = require('/public/main/inc/lib/javascript/jquery.frameready.js'); // const frameReady = require('/public/main/inc/lib/javascript/jquery.frameready.js');
// //
// global.frameReady = frameReady; // global.frameReady = frameReady;
// window.frameReady = frameReady; // window.frameReady = frameReady;
require('./vendor'); require("./vendor")
import './main';
// Date time settings. global.moment = moment
import moment from 'moment' moment.locale(locale)
global.moment = moment;
moment.locale(locale);
//$.datepicker.setDefaults($.datepicker.regional[locale]); //$.datepicker.setDefaults($.datepicker.regional[locale]);
//$.datepicker.regional["local"] = $.datepicker.regional[locale]; //$.datepicker.regional["local"] = $.datepicker.regional[locale];
import('qtip2'); import("qtip2")
require('bootstrap-daterangepicker/daterangepicker.js'); require("bootstrap-daterangepicker/daterangepicker.js")
require('blueimp-file-upload'); require("blueimp-file-upload")
require('blueimp-load-image'); require("blueimp-load-image")
import('mediaelement'); import("mediaelement")
require('multiselect-two-sides'); require("multiselect-two-sides")
require('datepair.js'); require("datepair.js")
require('timepicker'); require("timepicker")
//import 'jquery-sortablejs'; //import 'jquery-sortablejs';
import Sortable from 'sortablejs'; window.Sortable = Sortable
window.Sortable = Sortable;
import Swal from 'sweetalert2'; window.Swal = Swal
window.Swal = Swal;
// @todo rework url naming // @todo rework url naming
//const homePublicUrl = Routing.generate('index'); //const homePublicUrl = Routing.generate('index');
const homePublicUrl = '/'; const homePublicUrl = "/"
const mainUrl = homePublicUrl + 'main/'; const mainUrl = homePublicUrl + "main/"
const webAjax = homePublicUrl + 'main/inc/ajax/'; const webAjax = homePublicUrl + "main/inc/ajax/"
$(function () { $(function () {
let courseId = $('body').attr('data-course-id'); let courseId = $("body").attr("data-course-id")
let webCidReq = '&cid=' + courseId + '&sid=' + $('body').attr('data-session-id'); let webCidReq = "&cid=" + courseId + "&sid=" + $("body").attr("data-session-id")
window.webCidReq = webCidReq; window.webCidReq = webCidReq
$("#menu_courses").click(function(){ $("#menu_courses").click(function () {
return false; return false
}); })
$("#menu_social").click(function(){ $("#menu_social").click(function () {
return false; return false
}); })
$("#menu_administrator").click(function(){ $("#menu_administrator").click(function () {
return false; return false
}); })
if (courseId >0) { if (courseId > 0) {
let courseCode = $("body").data("course-code"); let courseCode = $("body").data("course-code")
let logOutUrl = webAjax + 'course.ajax.php?a=course_logout&cidReq=' + courseCode; let logOutUrl = webAjax + "course.ajax.php?a=course_logout&cidReq=" + courseCode
function courseLogout() { function courseLogout() {
$.ajax({ $.ajax({
async: false, async: false,
url: logOutUrl, url: logOutUrl,
success: function () { success: function () {
return 1; return 1
} },
}); })
} }
addMainEvent(window, 'unload', courseLogout ,false);
addMainEvent(window, "unload", courseLogout, false)
} }
$("#open-view-list").click(function () { $("#open-view-list").click(function () {
$("#student-list-work").fadeIn(300); $("#student-list-work").fadeIn(300)
}); })
$("#closed-view-list").click(function () { $("#closed-view-list").click(function () {
$("#student-list-work").fadeOut(300); $("#student-list-work").fadeOut(300)
}); })
// Removes the yellow input in Chrome // Removes the yellow input in Chrome
if (navigator.userAgent.toLowerCase().indexOf("chrome") >= 0) { if (navigator.userAgent.toLowerCase().indexOf("chrome") >= 0) {
$(window).on("load", function () { $(window).on("load", function () {
$('input:-webkit-autofill').each(function () { $("input:-webkit-autofill").each(function () {
var text = $(this).val(); var text = $(this).val()
var name = $(this).attr('name'); var name = $(this).attr("name")
$(this).after(this.outerHTML).remove(); $(this).after(this.outerHTML).remove()
$('input[name=' + name + ']').val(text); $("input[name=" + name + "]").val(text)
}); })
}); })
} }
// MODAL DELETE CONFIRM // MODAL DELETE CONFIRM
$('.delete-swal').click(function (e) { $(".delete-swal").click(function (e) {
e.preventDefault(); // Prevent the href from redirecting directly e.preventDefault() // Prevent the href from redirecting directly
var url = $(this).attr("href"); var url = $(this).attr("href")
var title = $(this).data('title') || $(this).attr("title"); var title = $(this).data("title") || $(this).attr("title")
Swal.fire({ Swal.fire({
title: title, title: title,
text: '', text: "",
icon: 'warning', icon: "warning",
showCancelButton: true, showCancelButton: true,
cancelButtonText: 'Cancel', cancelButtonText: "Cancel",
confirmButtonColor: '#3085d6', confirmButtonColor: "#3085d6",
cancelButtonColor: '#d33', cancelButtonColor: "#d33",
confirmButtonText: 'Yes', confirmButtonText: "Yes",
}).then((result) => { }).then((result) => {
if (result.value) { if (result.value) {
/*Swal.fire( /*Swal.fire(
@ -153,135 +155,146 @@ $(function () {
'Your file has been deleted.', 'Your file has been deleted.',
'success' 'success'
)*/ )*/
window.location.href = url; window.location.href = url
} }
}); })
}); })
// Start modals // Start modals
// class='ajax' loads a page in a modal // class='ajax' loads a page in a modal
$('body').on('click', 'a.ajax', function (e) { $("body").on("click", "a.ajax", function (e) {
e.preventDefault(); e.preventDefault()
var contentUrl = this.href, var contentUrl = this.href,
loadModalContent = $.get(contentUrl), loadModalContent = $.get(contentUrl),
self = $(this); self = $(this)
$.when(loadModalContent).done(function (modalContent) { $.when(loadModalContent).done(function (modalContent) {
var modalTitle = self.data('title') || ' ', var modalTitle = self.data("title") || " ",
globalModalTitle = $('#global-modal').find('#global-modal-title'), globalModalTitle = $("#global-modal").find("#global-modal-title"),
globalModalBody = $('#global-modal').find('#global-modal-body'); globalModalBody = $("#global-modal").find("#global-modal-body")
globalModalTitle.text(modalTitle); globalModalTitle.text(modalTitle)
globalModalBody.html(modalContent); globalModalBody.html(modalContent)
globalModalBody.css({'max-height' : "500px", "overflow" : "auto"}); globalModalBody.css({ "max-height": "500px", overflow: "auto" })
toggleModal('global-modal'); toggleModal("global-modal")
}); })
}); })
$('#global-modal').on('hidden.bs.modal', function () { $("#global-modal").on("hidden.bs.modal", function () {
$(".embed-responsive").find('iframe').remove(); $(".embed-responsive").find("iframe").remove()
}); })
$('#close-global-model').on('click', function () { $("#close-global-model").on("click", function () {
toggleModal('global-modal'); toggleModal("global-modal")
}); })
// Expands an image modal // Expands an image modal
$('a.expand-image').on('click', function (e) { $("a.expand-image").on("click", function (e) {
e.preventDefault(); e.preventDefault()
var title = $(this).attr('title'); var title = $(this).attr("title")
var image = new Image(); var image = new Image()
image.onload = function () { image.onload = function () {
if (title) { if (title) {
$('#expand-image-modal').find('.modal-title').text(title); $("#expand-image-modal").find(".modal-title").text(title)
} else { } else {
$('#expand-image-modal').find('.modal-title').html(' '); $("#expand-image-modal").find(".modal-title").html(" ")
} }
$('#expand-image-modal').find('.modal-body').html(image); $("#expand-image-modal").find(".modal-body").html(image)
$('#expand-image-modal').modal({ $("#expand-image-modal").modal({
show: true show: true,
}); })
}; }
image.src = this.href; image.src = this.href
}); })
// Delete modal // Delete modal
$('#confirm-delete').on('show.bs.modal', function (e) { $("#confirm-delete").on("show.bs.modal", function (e) {
$(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href')); $(this).find(".btn-ok").attr("href", $(e.relatedTarget).data("href"))
//var message = '{{ 'AreYouSureToDeleteJS' | get_lang }}: <strong>' + $(e.relatedTarget).data('item-title') + '</strong>'; //var message = '{{ 'AreYouSureToDeleteJS' | get_lang }}: <strong>' + $(e.relatedTarget).data('item-title') + '</strong>';
var message = 'AreYouSureToDeleteJS : <strong>' + $(e.relatedTarget).data('item-title') + '</strong>'; var message = "AreYouSureToDeleteJS : <strong>" + $(e.relatedTarget).data("item-title") + "</strong>"
if ($(e.relatedTarget).data('item-question')) { if ($(e.relatedTarget).data("item-question")) {
message = $(e.relatedTarget).data('item-question'); message = $(e.relatedTarget).data("item-question")
} }
$('.debug-url').html(message); $(".debug-url").html(message)
}); })
// End modals // End modals
// old jquery.menu.js // old jquery.menu.js
$('#navigation a').stop().animate({ $("#navigation a").stop().animate(
'marginLeft':'50px' {
},1000); marginLeft: "50px",
},
1000,
)
$('#navigation div').hover( $("#navigation div").hover(
function () { function () {
$('a',$(this)).stop().animate({ $("a", $(this)).stop().animate(
'marginLeft':'1px' {
},200); marginLeft: "1px",
},
200,
)
}, },
function () { function () {
$('a',$(this)).stop().animate({ $("a", $(this)).stop().animate(
'marginLeft':'50px' {
},200); marginLeft: "50px",
} },
); 200,
)
},
)
jQuery.fn.filterByText = function (textbox) { jQuery.fn.filterByText = function (textbox) {
return this.each(function () { return this.each(function () {
var select = this; var select = this
var options = []; var options = []
$(select).find('option').each(function () { $(select)
options.push({value: $(this).val(), text: $(this).text()}); .find("option")
}); .each(function () {
$(select).data('options', options); options.push({ value: $(this).val(), text: $(this).text() })
})
$(textbox).bind('change keyup', function () { $(select).data("options", options)
var options = $(select).empty().data('options');
var search = $.trim($(this).val()); $(textbox).bind("change keyup", function () {
var regex = new RegExp(search, "gi"); var options = $(select).empty().data("options")
var search = $.trim($(this).val())
var regex = new RegExp(search, "gi")
$.each(options, function (i) { $.each(options, function (i) {
var option = options[i]; var option = options[i]
if (option.text.match(regex) !== null) { if (option.text.match(regex) !== null) {
$(select).append( $(select).append($("<option>").text(option.text).val(option.value))
$('<option>').text(option.text).val(option.value) }
); })
})
})
} }
});
});
});
};
$(".black-shadow").mouseenter(function () { $(".black-shadow")
$(this).addClass('hovered-course'); .mouseenter(function () {
}).mouseleave(function () { $(this).addClass("hovered-course")
$(this).removeClass('hovered-course'); })
}); .mouseleave(function () {
$(this).removeClass("hovered-course")
})
$("[data-toggle=popover]").each(function (i, obj) { $("[data-toggle=popover]").each(function (i, obj) {
$(this).popover({ $(this).popover({
html: true, html: true,
content: function () { content: function () {
var id = $(this).attr('id'); var id = $(this).attr("id")
return $('#popover-content-' + id).html(); return $("#popover-content-" + id).html()
} },
}); })
}); })
/** /**
* Advanced options * Advanced options
@ -292,31 +305,31 @@ $(function () {
* </div> * </div>
* */ * */
$(".advanced_options").on("click", function (event) { $(".advanced_options").on("click", function (event) {
event.preventDefault(); event.preventDefault()
var id = $(this).attr('id') + '_options'; var id = $(this).attr("id") + "_options"
$("#" + id).toggle(); $("#" + id).toggle()
if ($("#card-container").height() > 700) { if ($("#card-container").height() > 700) {
$("#card-container").css("height", "auto"); $("#card-container").css("height", "auto")
} else { } else {
$("#card-container").css("height", "100vh"); $("#card-container").css("height", "100vh")
} }
if ($("#column-left").hasClass("col-md-12")) { if ($("#column-left").hasClass("col-md-12")) {
$("#column-left").removeClass('col-md-12'); $("#column-left").removeClass("col-md-12")
$("#column-right").removeClass('col-md-12'); $("#column-right").removeClass("col-md-12")
$("#column-right").addClass('col-md-4'); $("#column-right").addClass("col-md-4")
$("#column-left").addClass('col-md-8'); $("#column-left").addClass("col-md-8")
} else { } else {
$("#column-left").removeClass('col-md-8'); $("#column-left").removeClass("col-md-8")
$("#column-right").removeClass('col-md-4'); $("#column-right").removeClass("col-md-4")
$("#column-left").addClass('col-md-12'); $("#column-left").addClass("col-md-12")
$("#column-right").addClass('col-md-12'); $("#column-right").addClass("col-md-12")
} }
if ($("#preview_course_add_course").length >= 0) { if ($("#preview_course_add_course").length >= 0) {
$("#preview_course_add_course").toggle(); $("#preview_course_add_course").toggle()
} }
}); })
/** /**
* <a class="advanced_options_open" href="http://" rel="div_id">Open</a> * <a class="advanced_options_open" href="http://" rel="div_id">Open</a>
@ -324,23 +337,23 @@ $(function () {
* <div id="div_id">Div content</div> * <div id="div_id">Div content</div>
* */ * */
$(".advanced_options_open").on("click", function (event) { $(".advanced_options_open").on("click", function (event) {
event.preventDefault(); event.preventDefault()
var id = $(this).attr('rel'); var id = $(this).attr("rel")
$("#" + id).show(); $("#" + id).show()
}); })
$(".advanced_options_close").on("click", function (event) { $(".advanced_options_close").on("click", function (event) {
event.preventDefault(); event.preventDefault()
var id = $(this).attr('rel'); var id = $(this).attr("rel")
$("#" + id).hide(); $("#" + id).hide()
}); })
// Adv multi-select search input. // Adv multi-select search input.
$('.select_class_filter').each(function () { $(".select_class_filter").each(function () {
var inputId = $(this).attr('id'); var inputId = $(this).attr("id")
inputId = inputId.replace('-filter', ''); inputId = inputId.replace("-filter", "")
$("#" + inputId).filterByText($("#" + inputId + "-filter")); $("#" + inputId).filterByText($("#" + inputId + "-filter"))
}); })
// Mediaelement // Mediaelement
//if ( {{ show_media_element }} == 1) { //if ( {{ show_media_element }} == 1) {
@ -357,122 +370,119 @@ $(function () {
// Table highlight. // Table highlight.
$("form .data_table input:checkbox").click(function () { $("form .data_table input:checkbox").click(function () {
if ($(this).is(":checked")) { if ($(this).is(":checked")) {
$(this).parentsUntil("tr").parent().addClass("row_selected"); $(this).parentsUntil("tr").parent().addClass("row_selected")
} else { } else {
$(this).parentsUntil("tr").parent().removeClass("row_selected"); $(this).parentsUntil("tr").parent().removeClass("row_selected")
} }
}); })
// Tool tip (in exercises) // Tool tip (in exercises)
var tip_options = { var tip_options = {
placement: 'right' placement: "right",
}; }
//$('.boot-tooltip').tooltip(tip_options); //$('.boot-tooltip').tooltip(tip_options);
}); })
$(document).scroll(function () { $(document).scroll(function () {
var valor = $('body').outerHeight() - 700; var valor = $("body").outerHeight() - 700
if ($(this).scrollTop() > 100) { if ($(this).scrollTop() > 100) {
$('.bottom_actions').addClass('bottom_actions_fixed'); $(".bottom_actions").addClass("bottom_actions_fixed")
} else { } else {
$('.bottom_actions').removeClass('bottom_actions_fixed'); $(".bottom_actions").removeClass("bottom_actions_fixed")
} }
if ($(this).scrollTop() > valor) { if ($(this).scrollTop() > valor) {
$('.bottom_actions').removeClass('bottom_actions_fixed'); $(".bottom_actions").removeClass("bottom_actions_fixed")
} else { } else {
$('.bottom_actions').addClass('bottom_actions_fixed'); $(".bottom_actions").addClass("bottom_actions_fixed")
} }
// Exercise warning fixed at the top. // Exercise warning fixed at the top.
var fixed = $("#exercise_clock_warning"); var fixed = $("#exercise_clock_warning")
if (fixed.length) { if (fixed.length) {
if (!fixed.attr('data-top')) { if (!fixed.attr("data-top")) {
// If already fixed, then do nothing // If already fixed, then do nothing
if (fixed.hasClass('subnav-fixed')) return; if (fixed.hasClass("subnav-fixed")) return
// Remember top position // Remember top position
var offset = fixed.offset(); var offset = fixed.offset()
fixed.attr('data-top', offset.top); fixed.attr("data-top", offset.top)
fixed.css('width', '100%'); fixed.css("width", "100%")
} }
if (fixed.attr('data-top') - fixed.outerHeight() <= $(this).scrollTop()) { if (fixed.attr("data-top") - fixed.outerHeight() <= $(this).scrollTop()) {
fixed.addClass('navbar-fixed-top'); fixed.addClass("navbar-fixed-top")
fixed.css('width', '100%'); fixed.css("width", "100%")
} else { } else {
fixed.removeClass('navbar-fixed-top'); fixed.removeClass("navbar-fixed-top")
fixed.css('width', '100%'); fixed.css("width", "100%")
} }
} }
// Admin -> Settings toolbar. // Admin -> Settings toolbar.
if ($('body').width() > 959) { if ($("body").width() > 959) {
if ($('.new_actions').length) { if ($(".new_actions").length) {
if (!$('.new_actions').attr('data-top')) { if (!$(".new_actions").attr("data-top")) {
// If already fixed, then do nothing // If already fixed, then do nothing
if ($('.new_actions').hasClass('new_actions-fixed')) return; if ($(".new_actions").hasClass("new_actions-fixed")) return
// Remember top position // Remember top position
var offset = $('.new_actions').offset(); var offset = $(".new_actions").offset()
var more_top = 0; var more_top = 0
if ($('.subnav').hasClass('new_actions-fixed')) { if ($(".subnav").hasClass("new_actions-fixed")) {
more_top = 50; more_top = 50
} }
$('.new_actions').attr('data-top', offset.top + more_top); $(".new_actions").attr("data-top", offset.top + more_top)
} }
// Check if the height is enough before fixing the icons menu (or otherwise removing it) // Check if the height is enough before fixing the icons menu (or otherwise removing it)
// Added a 30px offset otherwise sometimes the menu plays ping-pong when scrolling to // Added a 30px offset otherwise sometimes the menu plays ping-pong when scrolling to
// the bottom of the page on short pages. // the bottom of the page on short pages.
if ($('.new_actions').attr('data-top') - $('.new_actions').outerHeight() <= $(this).scrollTop() + 30) { if ($(".new_actions").attr("data-top") - $(".new_actions").outerHeight() <= $(this).scrollTop() + 30) {
$('.new_actions').addClass('new_actions-fixed'); $(".new_actions").addClass("new_actions-fixed")
} else { } else {
$('.new_actions').removeClass('new_actions-fixed'); $(".new_actions").removeClass("new_actions-fixed")
} }
} }
} }
}); })
function get_url_params(q, attribute) function get_url_params(q, attribute) {
{ var hash
var hash;
if (q != undefined) { if (q != undefined) {
q = q.split('&'); q = q.split("&")
for (var i = 0; i < q.length; i++) { for (var i = 0; i < q.length; i++) {
hash = q[i].split('='); hash = q[i].split("=")
if (hash[0] == attribute) { if (hash[0] == attribute) {
return hash[1]; return hash[1]
} }
} }
} }
} }
function setCheckbox(value, table_id) function setCheckbox(value, table_id) {
{ var checkboxes = $("#" + table_id + " input:checkbox")
var checkboxes = $("#" + table_id + " input:checkbox");
$.each(checkboxes, function (index, checkbox) { $.each(checkboxes, function (index, checkbox) {
checkbox.checked = value; checkbox.checked = value
if (value) { if (value) {
$(checkbox).parentsUntil("tr").parent().addClass("row_selected"); $(checkbox).parentsUntil("tr").parent().addClass("row_selected")
} else { } else {
$(checkbox).parentsUntil("tr").parent().removeClass("row_selected"); $(checkbox).parentsUntil("tr").parent().removeClass("row_selected")
} }
}); })
return false; return false
} }
function action_click(element, table_id) function action_click(element, table_id) {
{ var d = $("#" + table_id)
var d = $("#" + table_id); if (!confirm("ConfirmYourChoice")) {
if (!confirm('ConfirmYourChoice')) {
//if (!confirm('{{ "ConfirmYourChoice"|get_lang }}')) { //if (!confirm('{{ "ConfirmYourChoice"|get_lang }}')) {
return false; return false
} else { } else {
var action = $(element).attr("data-action"); var action = $(element).attr("data-action")
$('#' + table_id + ' input[name="action"] ').attr("value", action); $("#" + table_id + ' input[name="action"] ').attr("value", action)
d.submit(); d.submit()
return false; return false
} }
} }
@ -484,92 +494,93 @@ function action_click(element, table_id)
* @param inTxtUnhide : text two of the button * @param inTxtUnhide : text two of the button
* @todo : allow to detect if text is from a button or from a <a> * @todo : allow to detect if text is from a button or from a <a>
*/ */
function hideUnhide(inId, inIdTxt, inTxtHide, inTxtUnhide) function hideUnhide(inId, inIdTxt, inTxtHide, inTxtUnhide) {
{ if ($("#" + inId).css("display") == "none") {
if ($('#'+inId).css("display") == "none") { $("#" + inId).show(400)
$('#'+inId).show(400); $("#" + inIdTxt).attr("value", inTxtUnhide)
$('#'+inIdTxt).attr("value", inTxtUnhide);
} else { } else {
$('#'+inId).hide(400); $("#" + inId).hide(400)
$('#'+inIdTxt).attr("value", inTxtHide); $("#" + inIdTxt).attr("value", inTxtHide)
} }
} }
function expandColumnToggle(buttonSelector, col1Info, col2Info) function expandColumnToggle(buttonSelector, col1Info, col2Info) {
{ $(buttonSelector).on("click", function (e) {
$(buttonSelector).on('click', function (e) { e.preventDefault()
e.preventDefault();
col1Info = $.extend({ col1Info = $.extend(
selector: '', {
width: 4 selector: "",
}, col1Info); width: 4,
col2Info = $.extend({ },
selector: '', col1Info,
width: 8 )
}, col2Info); col2Info = $.extend(
{
selector: "",
width: 8,
},
col2Info,
)
if (!col1Info.selector || !col2Info.selector) { if (!col1Info.selector || !col2Info.selector) {
return; return
} }
var col1 = $(col1Info.selector), var col1 = $(col1Info.selector),
col2 = $(col2Info.selector); col2 = $(col2Info.selector)
$('#expand').toggleClass('hide'); $("#expand").toggleClass("hide")
$('#contract').toggleClass('hide'); $("#contract").toggleClass("hide")
if (col2.is('.col-md-' + col2Info.width)) { if (col2.is(".col-md-" + col2Info.width)) {
col2.removeClass('col-md-' + col2Info.width).addClass('col-md-12'); col2.removeClass("col-md-" + col2Info.width).addClass("col-md-12")
col1.removeClass('col-md-' + col1Info.width).addClass('hide'); col1.removeClass("col-md-" + col1Info.width).addClass("hide")
return; return
} }
col2.removeClass('col-md-12').addClass('col-md-' + col2Info.width); col2.removeClass("col-md-12").addClass("col-md-" + col2Info.width)
col1.removeClass('hide').addClass('col-md-' + col1Info.width); col1.removeClass("hide").addClass("col-md-" + col1Info.width)
}); })
} }
function addMainEvent(elm, evType, fn, useCapture) function addMainEvent(elm, evType, fn, useCapture) {
{
if (elm.addEventListener) { if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture); elm.addEventListener(evType, fn, useCapture)
return true; return true
} else if (elm.attachEvent) { } else if (elm.attachEvent) {
elm.attachEvent('on' + evType, fn); elm.attachEvent("on" + evType, fn)
} else { } else {
elm['on'+evType] = fn; elm["on" + evType] = fn
} }
} }
function copyTextToClipBoard(elementId) function copyTextToClipBoard(elementId) {
{
/* Get the text field */ /* Get the text field */
var copyText = document.getElementById(elementId); var copyText = document.getElementById(elementId)
/* Select the text field */ /* Select the text field */
copyText.select(); copyText.select()
/* Copy the text inside the text field */ /* Copy the text inside the text field */
document.execCommand('copy'); document.execCommand("copy")
} }
function toggleModal(modalID) function toggleModal(modalID) {
{ document.getElementById(modalID).classList.toggle("hidden")
document.getElementById(modalID).classList.toggle("hidden"); document.getElementById(modalID + "-backdrop").classList.toggle("hidden")
document.getElementById(modalID + "-backdrop").classList.toggle("hidden"); document.getElementById(modalID).classList.toggle("flex")
document.getElementById(modalID).classList.toggle("flex"); document.getElementById(modalID + "-backdrop").classList.toggle("flex")
document.getElementById(modalID + "-backdrop").classList.toggle("flex");
} }
// Expose functions to be use inside chamilo. // Expose functions to be use inside chamilo.
// @todo check if there's a better way to expose functions. // @todo check if there's a better way to expose functions.
window.expandColumnToggle = expandColumnToggle; window.expandColumnToggle = expandColumnToggle
window.get_url_params = get_url_params; window.get_url_params = get_url_params
window.setCheckbox = setCheckbox; window.setCheckbox = setCheckbox
window.action_click = action_click; window.action_click = action_click
window.hideUnhide = hideUnhide; window.hideUnhide = hideUnhide
window.addMainEvent = addMainEvent; window.addMainEvent = addMainEvent
//window.showTemplates = showTemplates; //window.showTemplates = showTemplates;

@ -1,33 +1,35 @@
// require('mediaelement'); // require('mediaelement');
// import('multiselect-two-sides'); // import('multiselect-two-sides');
require('image-map-resizer/js/imageMapResizer.js'); require("image-map-resizer/js/imageMapResizer.js")
require('cropper'); require("cropper")
// require('jquery-ui-timepicker-addon/dist/jquery-ui-timepicker-addon'); // require('jquery-ui-timepicker-addon/dist/jquery-ui-timepicker-addon');
import('select2'); import("select2")
require('timeago'); require("timeago")
//require('sweetalert2'); //require('sweetalert2');
//import('bootstrap-select'); //import('bootstrap-select');
require('easy-pie-chart/dist/jquery.easypiechart.min'); require("easy-pie-chart/dist/jquery.easypiechart.min")
// require('jquery-ui-timepicker-addon'); // require('jquery-ui-timepicker-addon');
require('@fancyapps/fancybox/dist/jquery.fancybox.js'); require("@fancyapps/fancybox/dist/jquery.fancybox.js")
require('@fancyapps/fancybox/src/js/media.js'); require("@fancyapps/fancybox/src/js/media.js")
var hljs = require('highlight.js'); var hljs = require("highlight.js")
global.hljs = hljs; global.hljs = hljs
var textcomplete = require('textcomplete'); var textcomplete = require("textcomplete")
global.textcomplete = textcomplete; global.textcomplete = textcomplete
//global.Chart = require("chart.js/dist/chart").Chart //global.Chart = require("chart.js/dist/chart").Chart
import { Chart, registerables } from 'chart.js'; import { Chart, registerables } from "chart.js"
Chart.register(...registerables); import translateHtml from "../translatehtml.js"
global.Chart = Chart;
require('./annotation.js'); Chart.register(...registerables)
require('../editor.js'); global.Chart = Chart
import translateHtml from '../translatehtml.js';
document.addEventListener('DOMContentLoaded', function () { require("./annotation.js")
translateHtml(); require("../editor.js")
});
document.addEventListener("DOMContentLoaded", function () {
translateHtml()
})

@ -70,9 +70,8 @@ const router = useRouter()
const i18n = useI18n() const i18n = useI18n()
const layout = computed(() => { const layout = computed(() => {
if (route.meta.emptyLayout) { if (route.meta.emptyLayout) {
return EmptyLayout; return EmptyLayout
} }
const queryParams = new URLSearchParams(window.location.search) const queryParams = new URLSearchParams(window.location.search)
@ -90,11 +89,14 @@ const layout = computed(() => {
const legacyContainer = ref(null) const legacyContainer = ref(null)
watch(() => route.name, () => { watch(
() => route.name,
() => {
if (legacyContainer.value) { if (legacyContainer.value) {
legacyContainer.value.innerHTML = "" legacyContainer.value.innerHTML = ""
} }
}) },
)
watchEffect(() => { watchEffect(() => {
if (!legacyContainer.value) { if (!legacyContainer.value) {
@ -151,15 +153,15 @@ onUpdated(() => {
if (!Array.isArray(flashes)) { if (!Array.isArray(flashes)) {
for (const key in flashes) { for (const key in flashes) {
const notificationType = key === 'danger' ? 'Error' : capitalize(key); const notificationType = key === "danger" ? "Error" : capitalize(key)
for (const flashText of flashes[key]) { for (const flashText of flashes[key]) {
notification[`show${notificationType}Notification`](flashText); notification[`show${notificationType}Notification`](flashText)
} }
} }
} }
app.dataset.flashes = ""; app.dataset.flashes = ""
}) })
axios.interceptors.response.use( axios.interceptors.response.use(
@ -189,7 +191,7 @@ watch(
} }
}, },
{ {
inmediate: true inmediate: true,
} },
) )
</script> </script>

@ -11,11 +11,11 @@ use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Exception; use Exception;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
#[Route('/file-manager')] #[Route('/file-manager')]
class FileManagerController extends AbstractController class FileManagerController extends AbstractController
@ -106,7 +106,7 @@ class FileManagerController extends AbstractController
{ {
// Implement logic to download files // Implement logic to download files
// Replace 'path/to/your/files' with the actual path where the files are stored // Replace 'path/to/your/files' with the actual path where the files are stored
$filePath = 'path/to/your/files/' . $filename; $filePath = 'path/to/your/files/'.$filename;
return new BinaryFileResponse($filePath); return new BinaryFileResponse($filePath);
} }

Loading…
Cancel
Save