diff --git a/install/froxlor.sql.php b/install/froxlor.sql.php index eaaf08fb..2ee1e8ad 100644 --- a/install/froxlor.sql.php +++ b/install/froxlor.sql.php @@ -356,23 +356,6 @@ CREATE TABLE `panel_htpasswds` ( ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_general_ci; -DROP TABLE IF EXISTS `panel_sessions`; -CREATE TABLE `panel_sessions` ( - `hash` varchar(32) NOT NULL default '', - `userid` int(11) unsigned NOT NULL default '0', - `ipaddress` varchar(255) NOT NULL default '', - `useragent` varchar(255) NOT NULL default '', - `lastactivity` int(11) unsigned NOT NULL default '0', - `lastpaging` varchar(255) NOT NULL default '', - `formtoken` char(32) NOT NULL default '', - `language` varchar(64) NOT NULL default '', - `adminsession` tinyint(1) unsigned NOT NULL default '0', - `theme` varchar(255) NOT NULL default '', - PRIMARY KEY (`hash`), - KEY `userid` (`userid`) -) ENGINE=HEAP; - - DROP TABLE IF EXISTS `panel_settings`; CREATE TABLE `panel_settings` ( `settingid` int(11) unsigned NOT NULL auto_increment, diff --git a/templates/Froxlor/assets/js/app.js b/templates/Froxlor/assets/js/app.js index 8bb6b215..1dc4d319 100644 --- a/templates/Froxlor/assets/js/app.js +++ b/templates/Froxlor/assets/js/app.js @@ -1,33 +1,14 @@ import '@fortawesome/fontawesome-free'; - -import jQuery from 'jquery'; -window.$ = jQuery; - -import 'jquery-validation'; -import 'bootstrap'; -import 'chart.js/auto'; - -// Axios -import axios from 'axios'; -window.axios = axios; -window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; +import './bootstrap'; // Vue -import { createApp } from 'vue'; +import {createApp} from 'vue'; + const app = createApp({}); -// import ExampleComponent from './components/ExampleComponent.vue'; -// app.component('example-component', ExampleComponent); -// -// or -// -// Object.entries(import.meta.glob('./**/*.vue', { eager: true })).forEach(([path, definition]) => { -// app.component(path.split('/').pop().replace(/\.\w+$/, ''), definition.default); -// }); - -app.mount('#app'); - // Load jquery components -Object.entries(import.meta.glob('./jquery/*.js', { eager: true })).forEach(([path, definition]) => { +Object.entries(import.meta.glob('./jquery/*.js', {eager: true})).forEach(([path, definition]) => { definition.default(); }); + +app.mount('#app'); diff --git a/templates/Froxlor/assets/js/bootstrap.js b/templates/Froxlor/assets/js/bootstrap.js index e69de29b..6692d82c 100644 --- a/templates/Froxlor/assets/js/bootstrap.js +++ b/templates/Froxlor/assets/js/bootstrap.js @@ -0,0 +1,20 @@ +import _ from 'lodash'; +window._ = _; + +// jQuery +import jQuery from 'jquery'; +window.$ = jQuery; +import 'jquery-validation'; + +// Bootstrap +import * as bootstrap from 'bootstrap'; +window.bootstrap = bootstrap; + +// ChartJS +import Chart from 'chart.js/auto'; +window.Chart = Chart; + +// Axios +import axios from 'axios'; +window.axios = axios; +window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; diff --git a/templates/Froxlor/assets/js/jquery/apikeys.js b/templates/Froxlor/assets/js/jquery/apikeys.js index 5d83c48d..c5203cd3 100644 --- a/templates/Froxlor/assets/js/jquery/apikeys.js +++ b/templates/Froxlor/assets/js/jquery/apikeys.js @@ -1,60 +1,68 @@ -export default function() { - - var timer, delay = 500; - $('div[data-action="apikeys"] #allowed_from').on('keyup change', function () { - var _this = $(this); - clearTimeout(timer); - timer = setTimeout(function () { - var akid = _this.closest('div[data-action="apikeys"]').data('entry'); - $.ajax({ - url: "lib/ajax.php?action=editapikey", - type: "POST", - dataType: "json", - data: { id: akid, allowed_from: _this.val(), valid_until: $('div[data-entry="' + akid + '"] #valid_until').val() }, - success: function (data) { - if (data.message) { +export default function () { + $(function () { + var timer, delay = 500; + $('div[data-action="apikeys"] #allowed_from').on('keyup change', function () { + var _this = $(this); + clearTimeout(timer); + timer = setTimeout(function () { + var akid = _this.closest('div[data-action="apikeys"]').data('entry'); + $.ajax({ + url: "lib/ajax.php?action=editapikey", + type: "POST", + dataType: "json", + data: { + id: akid, + allowed_from: _this.val(), + valid_until: $('div[data-entry="' + akid + '"] #valid_until').val() + }, + success: function (data) { + if (data.message) { + _this.removeClass('is-valid'); + _this.addClass('is-invalid'); + } else { + _this.removeClass('is-invalid'); + _this.addClass('is-valid'); + _this.val(data.allowed_from); + } + }, + error: function (request, status, error) { _this.removeClass('is-valid'); _this.addClass('is-invalid'); - } else { - _this.removeClass('is-invalid'); - _this.addClass('is-valid'); - _this.val(data.allowed_from); } - }, - error: function (request, status, error) { - _this.removeClass('is-valid'); - _this.addClass('is-invalid'); - } - }); - }, delay); - }); + }); + }, delay); + }); - $('div[data-action="apikeys"] #valid_until').on('keyup change', function () { - var _this = $(this); - clearTimeout(timer); - timer = setTimeout(function () { - var akid = _this.closest('div[data-action="apikeys"]').data('entry'); - $.ajax({ - url: "lib/ajax.php?action=editapikey", - type: "POST", - dataType: "json", - data: { id: akid, valid_until: _this.val(), allowed_from: $('div[data-entry="' + akid + '"] #allowed_from').val() }, - success: function (data) { - if (data.message) { + $('div[data-action="apikeys"] #valid_until').on('keyup change', function () { + var _this = $(this); + clearTimeout(timer); + timer = setTimeout(function () { + var akid = _this.closest('div[data-action="apikeys"]').data('entry'); + $.ajax({ + url: "lib/ajax.php?action=editapikey", + type: "POST", + dataType: "json", + data: { + id: akid, + valid_until: _this.val(), + allowed_from: $('div[data-entry="' + akid + '"] #allowed_from').val() + }, + success: function (data) { + if (data.message) { + _this.removeClass('is-valid'); + _this.addClass('is-invalid'); + } else { + _this.removeClass('is-invalid'); + _this.addClass('is-valid'); + _this.val(data.valid_until); + } + }, + error: function (request, status, error) { _this.removeClass('is-valid'); _this.addClass('is-invalid'); - } else { - _this.removeClass('is-invalid'); - _this.addClass('is-valid'); - _this.val(data.valid_until); } - }, - error: function (request, status, error) { - _this.removeClass('is-valid'); - _this.addClass('is-invalid'); - } - }); - }, delay); + }); + }, delay); + }); }); - } diff --git a/templates/Froxlor/assets/js/jquery/configfiles.js b/templates/Froxlor/assets/js/jquery/configfiles.js index 4bbcc05a..739decf6 100644 --- a/templates/Froxlor/assets/js/jquery/configfiles.js +++ b/templates/Froxlor/assets/js/jquery/configfiles.js @@ -1,52 +1,54 @@ -export default function() { - /* - * config files - select all recommended - */ - $('#selectRecommendedConfig').on('click', function () { - $('input[data-recommended]').each(function () { - if ($(this).data('recommended') == 1) { - $(this).prop('checked', true); - } else { - $(this).prop('checked', false); - } - }) - }); - - /* - * export/download JSON file (e.g. for usage with config-services) - */ - $('#downloadSelectionAsJson').on('click', function () { - var formData = $(this).closest('form').serialize(); - window.location = "lib/ajax.php?action=getConfigJsonExport&" + formData; - }); - - /* - * open modal window to show selected config-commands/files - * for selected daemon - */ - $('.show-config').on('click', function () { - var distro = $(this).data('dist'); - var section = $(this).data('section'); - var daemon = $(this).data('daemon'); - - $.ajax({ - url: "lib/ajax.php?action=getConfigDetails", - type: "POST", - dataType: "json", - data: { distro: distro, section: section, daemon: daemon }, - success: function (data) { - $('#configTplShowLabel').html(data.title); - $('#configTplShow .modal-body').html(data.content); - var myModal = new bootstrap.Modal(document.getElementById('configTplShow')); - myModal.show(); - }, - error: function (request, status, error) { - $('#configTplShowLabel').html('Error'); - $('#configTplShow .modal-body').html(''); - var myModal = new bootstrap.Modal(document.getElementById('configTplShow')); - myModal.show(); - } +export default function () { + $(function () { + /* + * config files - select all recommended + */ + $('#selectRecommendedConfig').on('click', function () { + $('input[data-recommended]').each(function () { + if ($(this).data('recommended') == 1) { + $(this).prop('checked', true); + } else { + $(this).prop('checked', false); + } + }) }); + /* + * export/download JSON file (e.g. for usage with config-services) + */ + $('#downloadSelectionAsJson').on('click', function () { + var formData = $(this).closest('form').serialize(); + window.location = "lib/ajax.php?action=getConfigJsonExport&" + formData; + }); + + /* + * open modal window to show selected config-commands/files + * for selected daemon + */ + $('.show-config').on('click', function () { + const distro = $(this).data('dist'); + const section = $(this).data('section'); + const daemon = $(this).data('daemon'); + + $.ajax({ + url: "lib/ajax.php?action=getConfigDetails", + type: "POST", + dataType: "json", + data: {distro: distro, section: section, daemon: daemon}, + success: function (data) { + $('#configTplShowLabel').html(data.title); + $('#configTplShow .modal-body').html(data.content); + const myModal = new bootstrap.Modal(document.getElementById('configTplShow')); + myModal.show(); + }, + error: function (request, status, error) { + $('#configTplShowLabel').html('Error'); + $('#configTplShow .modal-body').html(''); + const myModal = new bootstrap.Modal(document.getElementById('configTplShow')); + myModal.show(); + } + }); + + }); }); } diff --git a/templates/Froxlor/assets/js/jquery/customer.js b/templates/Froxlor/assets/js/jquery/customer.js index c3edeb62..5aa83e47 100644 --- a/templates/Froxlor/assets/js/jquery/customer.js +++ b/templates/Froxlor/assets/js/jquery/customer.js @@ -1,76 +1,77 @@ -export default function() { - - // Make inputs with enabled unlimited checked disabled - $("input[name$='_ul']").each(function () { - var fieldname = $(this).attr("name").substring(0, $(this).attr("name").length - 3); - $("input[name='" + fieldname + "']").prop({ - readonly: $(this).is(":checked"), - required: !$(this).is(":checked") - }); - }); - // change state when unlimited checkboxes are clicked - $("input[name$='_ul']").on('change', function () { - var fieldname = $(this).attr("name").substring(0, $(this).attr("name").length - 3); - $("input[name='" + fieldname + "']").prop({ - readonly: $(this).is(":checked"), - required: !$(this).is(":checked") - }); - if (!$(this).is(":checked")) { - $("input[name='" + fieldname + "']").focus() - } - }); - - // set values from hosting plan when adding/editing a customer according to the plan's values - $('#use_plan').on('change', function () { - var pid = $(this).val(); - if (pid > 0) { - $.ajax({ - url: "admin_plans.php?page=overview&action=jqGetPlanValues", - type: "POST", - data: { - planid: pid - }, - dataType: "json", - success: function (json) { - for (var i in json) { - if (i == 'email_imap' || i == 'email_pop3' || i == 'perlenabled' || i == 'phpenabled' || i == 'dnsenabled' || i == 'logviewenabled') { - /** handle checkboxes **/ - if (json[i] == 1) { - $("input[name='" + i + "']").prop('checked', true); - } else { - $("input[name='" + i + "']").prop('checked', false); - } - } else if (i == 'allowed_phpconfigs') { - /** handle array of values **/ - $("input[name='allowed_phpconfigs[]']").each(function (index) { - $(this).prop('checked', false); - for (var j in json[i]) { - if ($(this).val() == json[i][j]) { - $(this).prop('checked', true); - break; - } - } - }); - } else if (json[i] == -1) { - /** handle unlimited checkboxes **/ - $("input[name='" + i + "_ul']").attr('checked', 'checked'); - $("input[name='" + i + "']").prop({ - readonly: true - }); - } else { - /** handle normal value **/ - $("input[name='" + i + "']").val(json[i]); - $("input[name='" + i + "']").prop({ - readonly: false - }); - $("input[name='" + i + "_ul']").prop('checked', false); - } - } - }, - error: function (a, b) { - console.log(a, b); - } +export default function () { + $(function () { + // Make inputs with enabled unlimited checked disabled + $("input[name$='_ul']").each(function () { + var fieldname = $(this).attr("name").substring(0, $(this).attr("name").length - 3); + $("input[name='" + fieldname + "']").prop({ + readonly: $(this).is(":checked"), + required: !$(this).is(":checked") }); - } + }); + // change state when unlimited checkboxes are clicked + $("input[name$='_ul']").on('change', function () { + var fieldname = $(this).attr("name").substring(0, $(this).attr("name").length - 3); + $("input[name='" + fieldname + "']").prop({ + readonly: $(this).is(":checked"), + required: !$(this).is(":checked") + }); + if (!$(this).is(":checked")) { + $("input[name='" + fieldname + "']").focus() + } + }); + + // set values from hosting plan when adding/editing a customer according to the plan's values + $('#use_plan').on('change', function () { + var pid = $(this).val(); + if (pid > 0) { + $.ajax({ + url: "admin_plans.php?page=overview&action=jqGetPlanValues", + type: "POST", + data: { + planid: pid + }, + dataType: "json", + success: function (json) { + for (var i in json) { + if (i == 'email_imap' || i == 'email_pop3' || i == 'perlenabled' || i == 'phpenabled' || i == 'dnsenabled' || i == 'logviewenabled') { + /** handle checkboxes **/ + if (json[i] == 1) { + $("input[name='" + i + "']").prop('checked', true); + } else { + $("input[name='" + i + "']").prop('checked', false); + } + } else if (i == 'allowed_phpconfigs') { + /** handle array of values **/ + $("input[name='allowed_phpconfigs[]']").each(function (index) { + $(this).prop('checked', false); + for (var j in json[i]) { + if ($(this).val() == json[i][j]) { + $(this).prop('checked', true); + break; + } + } + }); + } else if (json[i] == -1) { + /** handle unlimited checkboxes **/ + $("input[name='" + i + "_ul']").attr('checked', 'checked'); + $("input[name='" + i + "']").prop({ + readonly: true + }); + } else { + /** handle normal value **/ + $("input[name='" + i + "']").val(json[i]); + $("input[name='" + i + "']").prop({ + readonly: false + }); + $("input[name='" + i + "_ul']").prop('checked', false); + } + } + }, + error: function (a, b) { + console.log(a, b); + } + }); + } + }); }); } diff --git a/templates/Froxlor/assets/js/jquery/dnseditor.js b/templates/Froxlor/assets/js/jquery/dnseditor.js index 3f90ad7d..8f44348a 100644 --- a/templates/Froxlor/assets/js/jquery/dnseditor.js +++ b/templates/Froxlor/assets/js/jquery/dnseditor.js @@ -1,19 +1,20 @@ -export default function() { - - // Display helptext to content box according to dns-record type selected - $("select[name='dns_type']").on('change', function () { - var selVal = $(this).val(); - $.ajax({ - url: "lib/ajax.php?action=loadLanguageString", - type: "POST", - dataType: "json", - data: { langid: 'dnseditor.notes.' + selVal }, - success: function (data) { - $("#dns_content").next().html(data); - }, - error: function (request, status, error) { - console.log(request, status, error) - } +export default function () { + $(function () { + // Display helptext to content box according to dns-record type selected + $("select[name='dns_type']").on('change', function () { + var selVal = $(this).val(); + $.ajax({ + url: "lib/ajax.php?action=loadLanguageString", + type: "POST", + dataType: "json", + data: {langid: 'dnseditor.notes.' + selVal}, + success: function (data) { + $("#dns_content").next().html(data); + }, + error: function (request, status, error) { + console.log(request, status, error) + } + }); }); }); } diff --git a/templates/Froxlor/assets/js/jquery/domains.js b/templates/Froxlor/assets/js/jquery/domains.js index 5e21ae6f..ede1f1f5 100644 --- a/templates/Froxlor/assets/js/jquery/domains.js +++ b/templates/Froxlor/assets/js/jquery/domains.js @@ -1,54 +1,29 @@ -export default function() { - /* - * domains - */ - // disable unusable php-configuration by customer settings - $('#customerid').on('change', function () { - var cid = $(this).val(); - $.ajax({ - url: "admin_domains.php?page=domains&action=jqGetCustomerPHPConfigs", - type: "POST", - data: { - customerid: cid - }, - dataType: "json", - success: function (json) { - if (json.length > 0) { - $('#phpsettingid option').each(function () { - var pid = $(this).val(); - $(this).attr("disabled", "disabled"); - for (var i in json) { - if (pid == json[i]) { - $(this).removeAttr("disabled"); - } - } - }); - } - }, - error: function (a, b) { - console.log(a, b); - } - }); - }); - - // show warning if speciallogfile option is toggled - if ($('input[name=speciallogverified]')) { - $('input[name=speciallogfile]').on('click', function () { - $('#speciallogfilenote').remove(); - $('#speciallogfile').removeClass('is-invalid'); - $('#speciallogverified').val(0); +export default function () { + $(function () { + /* + * domains + */ + // disable unusable php-configuration by customer settings + $('#customerid').on('change', function () { + var cid = $(this).val(); $.ajax({ - url: window.location.pathname.substring(1) + "?page=overview&action=jqSpeciallogfileNote", + url: "admin_domains.php?page=domains&action=jqGetCustomerPHPConfigs", type: "POST", data: { - id: $('input[name=id]').val(), newval: +$('#speciallogfile').is(':checked') + customerid: cid }, dataType: "json", success: function (json) { - if (json.changed) { - $('#speciallogfile').addClass('is-invalid'); - $('#speciallogfile').parent().append(json.info); - $('#speciallogverified').val(1); + if (json.length > 0) { + $('#phpsettingid option').each(function () { + var pid = $(this).val(); + $(this).attr("disabled", "disabled"); + for (var i in json) { + if (pid == json[i]) { + $(this).removeAttr("disabled"); + } + } + }); } }, error: function (a, b) { @@ -56,54 +31,81 @@ export default function() { } }); }); - } - /** - * email only domain - hide unnecessary/unused sections - */ - if ($('#id') && $('#email_only').is(':checked')) { - $('#section_b').hide(); - $('#section_bssl').hide(); - $('#section_c').hide(); - $('#section_d').hide(); - } + // show warning if speciallogfile option is toggled + if ($('input[name=speciallogverified]')) { + $('input[name=speciallogfile]').on('click', function () { + $('#speciallogfilenote').remove(); + $('#speciallogfile').removeClass('is-invalid'); + $('#speciallogverified').val(0); + $.ajax({ + url: window.location.pathname.substring(1) + "?page=overview&action=jqSpeciallogfileNote", + type: "POST", + data: { + id: $('input[name=id]').val(), newval: +$('#speciallogfile').is(':checked') + }, + dataType: "json", + success: function (json) { + if (json.changed) { + $('#speciallogfile').addClass('is-invalid'); + $('#speciallogfile').parent().append(json.info); + $('#speciallogverified').val(1); + } + }, + error: function (a, b) { + console.log(a, b); + } + }); + }); + } - /** - * toggle show/hide of sections in case of email only flag - */ - $('#email_only').on('click', function () { - if ($(this).is(':checked')) { - // hide unnecessary sections + /** + * email only domain - hide unnecessary/unused sections + */ + if ($('#id') && $('#email_only').is(':checked')) { $('#section_b').hide(); $('#section_bssl').hide(); $('#section_c').hide(); $('#section_d').hide(); - } else { - // show sections - $('#section_b').show(); - $('#section_bssl').show(); - $('#section_c').show(); - $('#section_d').show(); } - }) - /** - * ssl enabled domain - hide unnecessary/unused sections - */ - if ($('#id') && !$('#sslenabled').is(':checked')) { - $('#section_bssl>.formfields>.row').not(":first").addClass("d-none"); - } + /** + * toggle show/hide of sections in case of email only flag + */ + $('#email_only').on('click', function () { + if ($(this).is(':checked')) { + // hide unnecessary sections + $('#section_b').hide(); + $('#section_bssl').hide(); + $('#section_c').hide(); + $('#section_d').hide(); + } else { + // show sections + $('#section_b').show(); + $('#section_bssl').show(); + $('#section_c').show(); + $('#section_d').show(); + } + }) - /** - * toggle show/hide of sections in case of ssl enabled flag - */ - $('#sslenabled').on('click', function () { - if ($(this).is(':checked')) { - // show sections - $('#section_bssl>.formfields>.row').removeClass("d-none"); - } else { - // hide unnecessary sections + /** + * ssl enabled domain - hide unnecessary/unused sections + */ + if ($('#id') && !$('#sslenabled').is(':checked')) { $('#section_bssl>.formfields>.row').not(":first").addClass("d-none"); } - }) + + /** + * toggle show/hide of sections in case of ssl enabled flag + */ + $('#sslenabled').on('click', function () { + if ($(this).is(':checked')) { + // show sections + $('#section_bssl>.formfields>.row').removeClass("d-none"); + } else { + // hide unnecessary sections + $('#section_bssl>.formfields>.row').not(":first").addClass("d-none"); + } + }) + }); } diff --git a/templates/Froxlor/assets/js/jquery/global.js b/templates/Froxlor/assets/js/jquery/global.js index 54ebe69b..58202f3f 100644 --- a/templates/Froxlor/assets/js/jquery/global.js +++ b/templates/Froxlor/assets/js/jquery/global.js @@ -1,14 +1,20 @@ -export default function() { - /* - * global - */ - $('#historyback').on('click', function (e) { - e.preventDefault(); - history.back(1); - }) +export default function () { + $(function () { + /* + * global + */ + $('#historyback').on('click', function (e) { + e.preventDefault(); + history.back(1); + }) - $('#copySysInfo').on('click', function (e) { - e.preventDefault(); - navigator.clipboard.writeText($('#ccSysInfo').text().trim()); - }) + $('#copySysInfo').on('click', function (e) { + e.preventDefault(); + navigator.clipboard.writeText($('#ccSysInfo').text().trim()); + }) + + $('[data-bs-toggle="popover"]').each(function () { + new bootstrap.Popover($(this)); + }) + }); } diff --git a/templates/Froxlor/assets/js/jquery/install.js b/templates/Froxlor/assets/js/jquery/install.js index 7e76c181..8edfdf71 100644 --- a/templates/Froxlor/assets/js/jquery/install.js +++ b/templates/Froxlor/assets/js/jquery/install.js @@ -1,62 +1,63 @@ -export default function() { - /* - * switch between basic and advanced install mode - */ - $('#switchInstallMode').on('click', function () { - var checked = $(this).prop('checked'); - window.location = window.location.pathname + replaceQueryParam('extended', +checked, window.location.search); - }); +export default function () { + $(function () { + /* + * switch between basic and advanced installation mode + */ + $('#switchInstallMode').on('click', function () { + var checked = $(this).prop('checked'); + window.location = window.location.pathname + replaceQueryParam('extended', +checked, window.location.search); + }); - function replaceQueryParam(param, newval, search) { - var regex = new RegExp("([?;&])" + param + "[^&;]*[;&]?"); - if (search.match(regex)) { - search = search.replace(regex, "$1").replace(/&$/, ''); + function replaceQueryParam(param, newval, search) { + var regex = new RegExp("([?;&])" + param + "[^&;]*[;&]?"); + if (search.match(regex)) { + search = search.replace(regex, "$1").replace(/&$/, ''); + } + return search + '&' + param + '=' + newval; } - return search + '&' + param + '=' + newval; - } - function checkConfigState() { - $.ajax({ - url: window.location.href, - type: "GET", - success: function (data, textStatus, request) { - if (request.status >= 300) { - window.location = "http://" + srvName; - } - }, - error: function (request, textStatus, errorThrown) { - // continue - if (request.status >= 300) { - window.location = "http://" + srvName; + function checkConfigState() { + $.ajax({ + url: window.location.href, + type: "GET", + success: function (data, textStatus, request) { + if (request.status >= 300) { + window.location = "http://" + srvName; + } + }, + error: function (request, textStatus, errorThrown) { + // continue + if (request.status >= 300) { + window.location = "http://" + srvName; + } } + }); + } + + var cTimer; + + /** + * check manual-config switch + */ + $('#manual_config').on('click', function () { + clearInterval(cTimer); + var checked = $(this).prop('checked'); + if (checked) { + // button zum login + $('#submitAuto').addClass('d-none'); + $('#submitManual').removeClass('d-none'); + } else { + cTimer = setInterval(checkConfigState, 1000); + // spinner fürs Warten + $('#submitAuto').removeClass('d-none'); + $('#submitManual').addClass('d-none'); } }); - } - var cTimer; - - /** - * check manual-config switch - */ - $('#manual_config').on('click', function () { - clearInterval(cTimer); - var checked = $(this).prop('checked'); - if (checked) { - // button zum login - $('#submitAuto').addClass('d-none'); - $('#submitManual').removeClass('d-none'); - } else { + if ($('#manual_config').length > 0) { + var srvName = $('#target_servername').val(); + clearInterval(cTimer); cTimer = setInterval(checkConfigState, 1000); - // spinner fürs warten - $('#submitAuto').removeClass('d-none'); - $('#submitManual').addClass('d-none'); } }); - - if ($('#manual_config').length > 0) { - var srvName = $('#target_servername').val(); - clearInterval(cTimer); - cTimer = setInterval(checkConfigState, 1000); - } - } diff --git a/templates/Froxlor/assets/js/jquery/ipsandports.js b/templates/Froxlor/assets/js/jquery/ipsandports.js index a104c357..a14de4a1 100644 --- a/templates/Froxlor/assets/js/jquery/ipsandports.js +++ b/templates/Froxlor/assets/js/jquery/ipsandports.js @@ -1,30 +1,31 @@ -export default function() { - /* - * ipsandports - check for internal ip and output a notice if private-range ip is given - */ - $('#ip').on('change', function () { - var ipval = $(this).val(); - if (ipval.length > 0) { - $('#ipnote').remove(); - $('#ip').removeClass('is-invalid'); - $.ajax({ - url: "admin_ipsandports.php?page=overview&action=jqCheckIP", - type: "POST", - data: { - ip: ipval - }, - dataType: "json", - success: function (json) { - if (json != 0) { - $('#ip').addClass('is-invalid'); - $('#ip').parent().append(json); +export default function () { + $(function () { + /* + * ipsandports - check for internal ip and output a notice if private-range ip is given + */ + $('#ip').on('change', function () { + var ipval = $(this).val(); + if (ipval.length > 0) { + $('#ipnote').remove(); + $('#ip').removeClass('is-invalid'); + $.ajax({ + url: "admin_ipsandports.php?page=overview&action=jqCheckIP", + type: "POST", + data: { + ip: ipval + }, + dataType: "json", + success: function (json) { + if (json != 0) { + $('#ip').addClass('is-invalid'); + $('#ip').parent().append(json); + } + }, + error: function (a, b) { + console.log(a, b); } - }, - error: function (a, b) { - console.log(a, b); - } - }); - } + }); + } + }); }); - } diff --git a/templates/Froxlor/assets/js/jquery/newsfeed.js b/templates/Froxlor/assets/js/jquery/newsfeed.js index e2a991ef..d0368ea6 100644 --- a/templates/Froxlor/assets/js/jquery/newsfeed.js +++ b/templates/Froxlor/assets/js/jquery/newsfeed.js @@ -1,24 +1,26 @@ -export default function() { - /* - * newsfeed - */ - if (document.getElementById('newsfeed')) { - let role = ""; +export default function () { + $(function () { + /* + * newsfeed + */ + if (document.getElementById('newsfeed')) { + let role = ""; - if (typeof $("#newsfeed").data("role") !== "undefined") { - role = "&role=" + $("#newsfeed").data("role"); - } - - $.ajax({ - url: "lib/ajax.php?action=newsfeed" + role + "&theme=" + window.$theme, - type: "GET", - success: function (data) { - $("#newsfeeditems").html(data); - }, - error: function (request, status, error) { - console.log(request, status, error) - $("#newsfeeditems").html('
Error loading newsfeed
'); + if (typeof $("#newsfeed").data("role") !== "undefined") { + role = "&role=" + $("#newsfeed").data("role"); } - }); - } + + $.ajax({ + url: "lib/ajax.php?action=newsfeed" + role + "&theme=" + window.$theme, + type: "GET", + success: function (data) { + $("#newsfeeditems").html(data); + }, + error: function (request, status, error) { + console.log(request, status, error) + $("#newsfeeditems").html('
Error loading newsfeed
'); + } + }); + } + }); } diff --git a/templates/Froxlor/assets/js/jquery/search.js b/templates/Froxlor/assets/js/jquery/search.js index 5e97cd07..815ec671 100755 --- a/templates/Froxlor/assets/js/jquery/search.js +++ b/templates/Froxlor/assets/js/jquery/search.js @@ -1,59 +1,61 @@ -export default function() { - /* - * search - */ - let search = $('#search') +export default function () { + $(function () { + /* + * search + */ + let search = $('#search') - search.on('submit', function (e) { - e.preventDefault(); - }); + search.on('submit', function (e) { + e.preventDefault(); + }); - search.find('input').on('keyup', function () { - let query = $(this).val(); - let dropdown = $('#search .search-results'); - // Hide search if query is empty - if (!query.length) { - dropdown.html(''); - dropdown.parent().hide(); - return; - } - // Show notification for short search query - if (query.length && query.length < 3) { - dropdown.html('
  • Please enter more than 2 characters
  • '); - dropdown.parent().show(); - return; - } - // Search - $.ajax({ - url: "lib/ajax.php?action=searchglobal&theme=" + window.$theme, - type: "POST", - data: { - searchtext: query - }, - dataType: "json", - success: data => { - // Show notification if we got no results - if (Object.keys(data).length === 0) { - dropdown.html('
  • Nothing found!
  • '); - dropdown.parent().show(); - return; - } - - // Clear dropdown and show results + search.find('input').on('keyup', function () { + let query = $(this).val(); + let dropdown = $('#search .search-results'); + // Hide search if query is empty + if (!query.length) { dropdown.html(''); - dropdown.parent().show(); - Object.keys(data).forEach(key => { - dropdown.append('
  • ' + key + '
  • '); - data[key].forEach(item => { - dropdown.append('
  • ' + item.title + '
  • '); - }); - }); - }, - error: function (a, b) { - console.log(a, b); - dropdown.html('
  • Whoops we got some errors!
  • '); - dropdown.parent().show(); + dropdown.parent().hide(); + return; } + // Show notification for short search query + if (query.length && query.length < 3) { + dropdown.html('
  • Please enter more than 2 characters
  • '); + dropdown.parent().show(); + return; + } + // Search + $.ajax({ + url: "lib/ajax.php?action=searchglobal&theme=" + window.$theme, + type: "POST", + data: { + searchtext: query + }, + dataType: "json", + success: data => { + // Show notification if we got no results + if (Object.keys(data).length === 0) { + dropdown.html('
  • Nothing found!
  • '); + dropdown.parent().show(); + return; + } + + // Clear dropdown and show results + dropdown.html(''); + dropdown.parent().show(); + Object.keys(data).forEach(key => { + dropdown.append('
  • ' + key + '
  • '); + data[key].forEach(item => { + dropdown.append('
  • ' + item.title + '
  • '); + }); + }); + }, + error: function (a, b) { + console.log(a, b); + dropdown.html('
  • Whoops we got some errors!
  • '); + dropdown.parent().show(); + } + }); }); }); } diff --git a/templates/Froxlor/assets/js/jquery/tablecolumns.js b/templates/Froxlor/assets/js/jquery/tablecolumns.js index db214b55..09b440c1 100644 --- a/templates/Froxlor/assets/js/jquery/tablecolumns.js +++ b/templates/Froxlor/assets/js/jquery/tablecolumns.js @@ -1,44 +1,46 @@ -export default function() { - /* - * table columns - manage columns modal - */ - $('.manageColumnsModal form').on('submit', function (event) { - $.ajax({ - url: 'lib/ajax.php?action=updatetablelisting&listing=' + $(this).data('listing') + '&theme=' + window.$theme, - type: 'POST', - dataType: 'json', - data: $(this).serialize(), - success: function () { - window.location.href = ''; - }, - error: function (request) { - alert(request.responseJSON.message); - } +export default function () { + $(function () { + /* + * table columns - manage columns modal + */ + $('.manageColumnsModal form').on('submit', function (event) { + $.ajax({ + url: 'lib/ajax.php?action=updatetablelisting&listing=' + $(this).data('listing') + '&theme=' + window.$theme, + type: 'POST', + dataType: 'json', + data: $(this).serialize(), + success: function () { + window.location.href = ''; + }, + error: function (request) { + alert(request.responseJSON.message); + } + }); + event.preventDefault(); }); - event.preventDefault(); - }); - $('.manageColumnsModal form button[data-action="reset"]').on('click', function () { - var form = $(this).parents('form:first'); - $.ajax({ - url: 'lib/ajax.php?action=resettablelisting&listing=' + form.data('listing') + '&theme=' + window.$theme, - type: 'POST', - dataType: 'json', - data: {}, - success: function () { - window.location.href = ''; - }, - error: function (request) { - alert(request.responseJSON.message); - } + $('.manageColumnsModal form button[data-action="reset"]').on('click', function () { + var form = $(this).parents('form:first'); + $.ajax({ + url: 'lib/ajax.php?action=resettablelisting&listing=' + form.data('listing') + '&theme=' + window.$theme, + type: 'POST', + dataType: 'json', + data: {}, + success: function () { + window.location.href = ''; + }, + error: function (request) { + alert(request.responseJSON.message); + } + }); }); - }); - $('.manageColumnsModal form button[data-action="select-all"]').on('click', function () { - $(this).parents('form:first').find('input:checkbox').prop('checked', true); - }); + $('.manageColumnsModal form button[data-action="select-all"]').on('click', function () { + $(this).parents('form:first').find('input:checkbox').prop('checked', true); + }); - $('.manageColumnsModal form button[data-action="unselect-all"]').on('click', function () { - $(this).parents('form:first').find('input:checkbox').prop('checked', false); + $('.manageColumnsModal form button[data-action="unselect-all"]').on('click', function () { + $(this).parents('form:first').find('input:checkbox').prop('checked', false); + }); }); } diff --git a/templates/Froxlor/assets/js/jquery/traffic.js b/templates/Froxlor/assets/js/jquery/traffic.js index df931cf0..7e78e778 100644 --- a/templates/Froxlor/assets/js/jquery/traffic.js +++ b/templates/Froxlor/assets/js/jquery/traffic.js @@ -1,10 +1,12 @@ -export default function() { - /* - * traffic - display helptext to content box according to dns-record type selected - */ - $("select[name='range']").on('change', function () { - var selVal = $(this).val(); - var baseRef = $(this).data('baseref'); - window.location.href = baseRef + '?range=' + selVal; +export default function () { + $(function () { + /* + * traffic - display helptext to content box according to dns-record type selected + */ + $("select[name='range']").on('change', function () { + var selVal = $(this).val(); + var baseRef = $(this).data('baseref'); + window.location.href = baseRef + '?range=' + selVal; + }); }); } diff --git a/templates/Froxlor/assets/js/jquery/updatecheck.js b/templates/Froxlor/assets/js/jquery/updatecheck.js index b2c7cf60..dcc5ef40 100644 --- a/templates/Froxlor/assets/js/jquery/updatecheck.js +++ b/templates/Froxlor/assets/js/jquery/updatecheck.js @@ -1,21 +1,23 @@ -export default function() { - /* - * updatecheck - */ - if (document.getElementById('updatecheck')) { - $.ajax({ - url: "lib/ajax.php?action=updatecheck&theme=" + window.$theme, - type: "GET", - success: function (data) { - $("#updatecheck").html(data); - new bootstrap.Popover(document.getElementById('ucheck')); - }, - error: function (request, status, error) { - console.log(request, status, error) - let message = 'Can\'t check version'; - $("#updatecheck").html(' ' + message + ''); - new bootstrap.Tooltip(document.getElementById('ucheck')); - } - }); - } +export default function () { + $(function () { + /* + * updatecheck + */ + if (document.getElementById('updatecheck')) { + $.ajax({ + url: "lib/ajax.php?action=updatecheck&theme=" + window.$theme, + type: "GET", + success: function (data) { + $("#updatecheck").html(data); + new bootstrap.Popover(document.getElementById('ucheck')); + }, + error: function (request, status, error) { + console.log(request, status, error) + let message = 'Can\'t check version'; + $("#updatecheck").html(' ' + message + ''); + new bootstrap.Tooltip(document.getElementById('ucheck')); + } + }); + } + }); } diff --git a/templates/Froxlor/assets/js/jquery/validation.js b/templates/Froxlor/assets/js/jquery/validation.js index 2b0dee01..f4692e05 100644 --- a/templates/Froxlor/assets/js/jquery/validation.js +++ b/templates/Froxlor/assets/js/jquery/validation.js @@ -1,40 +1,42 @@ -export default function() { - /* - * validation - */ - $('#customer_add,#customer_edit').each(function () { - $(this).validate({ - rules: { - 'name': { - required: function () { - return $('#company').val().length === 0 || $('#firstname').val().length > 0; +export default function () { + $(function () { + /* + * validation + */ + $('#customer_add,#customer_edit').each(function () { + $(this).validate({ + rules: { + 'name': { + required: function () { + return $('#company').val().length === 0 || $('#firstname').val().length > 0; + } + }, + 'firstname': { + required: function () { + return $('#company').val().length === 0 || $('#name').val().length > 0; + } + }, + 'company': { + required: function () { + return $('#name').val().length === 0 + && $('#firstname').val().length === 0; + } } }, - 'firstname': { - required: function () { - return $('#company').val().length === 0 || $('#name').val().length > 0; - } - }, - 'company': { - required: function () { - return $('#name').val().length === 0 - && $('#firstname').val().length === 0; - } - } - }, + }); }); - }); - $('#domain_add,#domain_edit').each(function () { - $(this).validate({ - rules: { - 'ipandport[]': { - required: true, - minlength: 1 + $('#domain_add,#domain_edit').each(function () { + $(this).validate({ + rules: { + 'ipandport[]': { + required: true, + minlength: 1 + } + }, + errorPlacement: function (error, element) { + $(error).prependTo($(element).parent().parent()); } - }, - errorPlacement: function(error, element) { - $(error).prependTo($(element).parent().parent()); - } + }); }); }); } diff --git a/templates/Froxlor/assets/scss/_variables-dark.scss b/templates/Froxlor/assets/scss/_variables-dark.scss deleted file mode 100644 index a047c1f1..00000000 --- a/templates/Froxlor/assets/scss/_variables-dark.scss +++ /dev/null @@ -1,2 +0,0 @@ -// Heading -$heading-border-color-dark: rgba(0,0,0,0.15); diff --git a/templates/Froxlor/assets/scss/_variables.scss b/templates/Froxlor/assets/scss/_variables.scss index 30700f2e..8e1bef65 100644 --- a/templates/Froxlor/assets/scss/_variables.scss +++ b/templates/Froxlor/assets/scss/_variables.scss @@ -82,6 +82,7 @@ $card-border-width: 0; $heading-bg: $navbar-bg; $heading-color: $body-color; $heading-border-color: #dee2e6; +$heading-border-color-dark: rgba(0,0,0,0.15); // Search $search-bg: $navbar-bg; diff --git a/templates/Froxlor/assets/scss/app.scss b/templates/Froxlor/assets/scss/app.scss index 4e01fe42..8287aafc 100644 --- a/templates/Froxlor/assets/scss/app.scss +++ b/templates/Froxlor/assets/scss/app.scss @@ -2,7 +2,6 @@ // Bootstrap @import "variables"; -@import "variables-dark"; @import "bootstrap/scss/bootstrap"; // Theme diff --git a/templates/Froxlor/form/form.html.twig b/templates/Froxlor/form/form.html.twig index 2ac18ce5..b39eb9f7 100644 --- a/templates/Froxlor/form/form.html.twig +++ b/templates/Froxlor/form/form.html.twig @@ -51,6 +51,6 @@ {# add translation for custom validations #} {% if form_data.id is defined and form_data.id in ['customer_add', 'customer_edit', 'domain_add', 'domain_edit'] %} - + {% endif %} {% endmacro %} diff --git a/templates/Froxlor/user/traffic.html.twig b/templates/Froxlor/user/traffic.html.twig index 247bc960..2cff65bd 100644 --- a/templates/Froxlor/user/traffic.html.twig +++ b/templates/Froxlor/user/traffic.html.twig @@ -106,7 +106,7 @@ {% endif %} {% endif %} -