From 62e69b8bb36ea9bc6c7fecacd5517cca074fa212 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 26 Oct 2023 10:28:59 -0300 Subject: [PATCH] https://github.com/WWBN/AVideo/issues/8576 --- objects/functions.php | 20 +++++--- view/index_shareVideos.php | 56 -------------------- view/jquery-file-upload/form.php | 50 ------------------ view/js/main.js | 88 +++++++++++++++++++++++--------- view/mini-upload-form/form.php | 28 ---------- 5 files changed, 76 insertions(+), 166 deletions(-) diff --git a/objects/functions.php b/objects/functions.php index 03d6b67b2..ff644f75c 100644 --- a/objects/functions.php +++ b/objects/functions.php @@ -1208,13 +1208,19 @@ function getCategoriesSelect($id) { categories, 'hierarchyAndName'), SORT_ASC, $_SESSION['login']->categories); - foreach ($_SESSION['login']->categories as $key => $value) { - echo ''; - } - ?> - + if (Login::canCreateCategory()) { + ?> + + - - - - - - - - - - - - - diff --git a/view/js/main.js b/view/js/main.js index 3d84c2232..474e124e6 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -5,37 +5,75 @@ var modal; * @param {type} href * @returns {Element|getLocation.l} * var l = getLocation("http://example.com/path"); -console.debug(l.hostname) ->> "example.com" -console.debug(l.pathname) ->> "/path" + console.debug(l.hostname) + >> "example.com" + console.debug(l.pathname) + >> "/path" */ -var getLocation = function(href) { +var getLocation = function (href) { var l = document.createElement("a"); l.href = href; return l; }; $(function () { - modal = modal || (function () { - var pleaseWaitDiv = $("#pleaseWaitDialog"); - if (pleaseWaitDiv.length === 0) { - pleaseWaitDiv = $('').appendTo('body'); + modal = modal || (function () { + var pleaseWaitDiv = $("#pleaseWaitDialog"); + if (pleaseWaitDiv.length === 0) { + pleaseWaitDiv = $('').appendTo('body'); + } + + return { + showPleaseWait: function () { + pleaseWaitDiv.modal(); + }, + hidePleaseWait: function () { + pleaseWaitDiv.modal('hide'); + }, + setProgress: function (valeur) { + pleaseWaitDiv.find('.progress-bar').css('width', valeur + '%').attr('aria-valuenow', valeur); + }, + setText: function (text) { + pleaseWaitDiv.find('h2').html(text); + }, + }; + })(); +}); + +var reloadIfIsNotEditingCategoryTimeout; +function addNewCategory(streamerURL) { + clearTimeout(reloadIfIsNotEditingCategoryTimeout); + avideoModalIframe(streamerURL + 'categories'); + reloadIfIsNotEditingCategoryTimeout = setTimeout(function () { + reloadIfIsNotEditingCategory(); + }, 500); +} + +function reloadIfIsNotEditingCategory() { + clearTimeout(reloadIfIsNotEditingCategoryTimeout); + if (!avideoModalIframeIsVisible()) { + loadCategories(); + } else { + reloadIfIsNotEditingCategoryTimeout = setTimeout(function () { + reloadIfIsNotEditingCategory(); + }, 500); } +} - return { - showPleaseWait: function () { - pleaseWaitDiv.modal(); - }, - hidePleaseWait: function () { - pleaseWaitDiv.modal('hide'); - }, - setProgress: function (valeur) { - pleaseWaitDiv.find('.progress-bar').css('width', valeur + '%').attr('aria-valuenow', valeur); - }, - setText: function (text) { - pleaseWaitDiv.find('h2').html(text); - }, - }; -})(); -}); \ No newline at end of file +function loadCategories(streamerURL) { + console.log('loadCategories'); + modal.showPleaseWait(); + $.ajax({ + url: streamerURL + 'objects/categories.json.php', + success: function (response) { + $('.categories_id').empty(); + for (var item in response.rows) { + if (typeof response.rows[item] != 'object') { + continue; + } + $('.categories_id').append(''); + } + modal.hidePleaseWait(); + } + }); +} \ No newline at end of file diff --git a/view/mini-upload-form/form.php b/view/mini-upload-form/form.php index 6e3f353c0..a54758552 100644 --- a/view/mini-upload-form/form.php +++ b/view/mini-upload-form/form.php @@ -15,34 +15,6 @@ - - - -